Debian Codegraph @

xpp/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.c

raw
1 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
2
3 File: oct6100_tsst.c
4
5 Copyright (c) 2001-2007 Octasic Inc.
6
7 Description:
8
9 This file contains the functions used to manage the allocation of TSST
10 control structures in internal memory.
11
12 This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is
13 free software; you can redistribute it and/or modify it under the terms of
14 the GNU General Public License as published by the Free Software Foundation;
15 either version 2 of the License, or (at your option) any later version.
16
17 The OCT6100 GPL API is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 for more details.
21
22 You should have received a copy of the GNU General Public License
23 along with the OCT6100 GPL API; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
25
26 $Octasic_Release: OCT612xAPI-01.00-PR49 $
27
28 $Octasic_Revision: 39 $
29
30 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
31
32
33 /***************************** INCLUDE FILES *******************************/
34
35 #include "octdef.h"
36
37 #include "oct6100api/oct6100_defines.h"
38 #include "oct6100api/oct6100_errors.h"
39
40 #include "apilib/octapi_llman.h"
41
42 #include "oct6100api/oct6100_apiud.h"
43 #include "oct6100api/oct6100_tlv_inst.h"
44 #include "oct6100api/oct6100_chip_open_inst.h"
45 #include "oct6100api/oct6100_chip_stats_inst.h"
46 #include "oct6100api/oct6100_interrupts_inst.h"
47 #include "oct6100api/oct6100_remote_debug_inst.h"
48 #include "oct6100api/oct6100_debug_inst.h"
49 #include "oct6100api/oct6100_api_inst.h"
50 #include "oct6100api/oct6100_tsst_inst.h"
51
52 #include "oct6100api/oct6100_interrupts_pub.h"
53 #include "oct6100api/oct6100_channel_pub.h"
54 #include "oct6100api/oct6100_chip_open_pub.h"
55
56 #include "oct6100_chip_open_priv.h"
57 #include "oct6100_tsst_priv.h"
58
59
60 /**************************** PRIVATE FUNCTIONS ****************************/
61
62
63 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
64
65 Function: Oct6100ApiGetTsstSwSizes
66
67 Description: Gets the sizes of all portions of the API instance pertinent
68 to the management of TSSTs.
69
70 -------------------------------------------------------------------------------
71 | Argument | Description
72 -------------------------------------------------------------------------------
73 f_pInstSizes Pointer to struct containing instance sizes.
74
75 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
76 #if !SKIP_Oct6100ApiGetTsstSwSizes
77 UINT32 Oct6100ApiGetTsstSwSizes(
78 OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes )
79 {
80 UINT32 ulTempVar;
81 UINT32 ulResult;
82
83 /* Determine amount of TSST needed for TSST allocation table. */
84 f_pInstSizes->ulTsstAlloc = 4096 / 8;
85
86 /* Calculate the API memory required for the TSST entry list. */
87 f_pInstSizes->ulTsstEntryList = cOCT6100_MAX_TSSTS * sizeof( tOCT6100_API_TSST_ENTRY );
88
89 /* Calculate memory needed for TSST entry allocation. */
90 ulResult = OctapiLlmAllocGetSize( cOCT6100_MAX_TSSTS, &f_pInstSizes->ulTsstEntryAlloc );
91 if ( ulResult != cOCT6100_ERR_OK )
92 return cOCT6100_ERR_FATAL_4D;
93
94 mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulTsstAlloc, ulTempVar );
95 mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulTsstEntryList, ulTempVar );
96 mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulTsstEntryAlloc, ulTempVar );
97
98 return cOCT6100_ERR_OK;
99 }
100 #endif
101
102
103 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
104
105 Function: Oct6100ApiTsstSwInit
106
107 Description: Initializes all elements of the instance structure associated
108 to the TSST control entries.
109
110 -------------------------------------------------------------------------------
111 | Argument | Description
112 -------------------------------------------------------------------------------
113 f_pApiInstance Pointer to API instance. This tsst is used to keep
114 the present state of the chip and all its resources.
115
116 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
117 #if !SKIP_Oct6100ApiTsstSwInit
118 UINT32 Oct6100ApiTsstSwInit(
119 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance )
120 {
121 tPOCT6100_SHARED_INFO pSharedInfo;
122 tPOCT6100_API_TSST_ENTRY pTsstList;
123 PUINT32 pulTsstAlloc;
124 PVOID pTsstListAlloc;
125 UINT32 ulResult;
126
127 /* Get local pointer(s). */
128 pSharedInfo = f_pApiInstance->pSharedInfo;
129
130 /* Initialize the TSST allocation table to "all free". */
131 mOCT6100_GET_TSST_ALLOC_PNT( pSharedInfo, pulTsstAlloc );
132 Oct6100UserMemSet( pulTsstAlloc, 0x00, 512 );
133
134 /* Initialize all the TSST list entries. */
135 mOCT6100_GET_TSST_LIST_PNT( pSharedInfo, pTsstList );
136 Oct6100UserMemSet( pTsstList, 0xFF, cOCT6100_MAX_TSSTS * sizeof(tOCT6100_API_TSST_ENTRY) );
137
138 /* Initialize the allocation list to manage the TSST entries.*/
139 mOCT6100_GET_TSST_LIST_ALLOC_PNT( pSharedInfo, pTsstListAlloc )
140
141 ulResult = OctapiLlmAllocInit( &pTsstListAlloc, cOCT6100_MAX_TSSTS );
142 if ( ulResult != cOCT6100_ERR_OK )
143 return cOCT6100_ERR_FATAL_4E;
144
145 return cOCT6100_ERR_OK;
146 }
147 #endif
148
149
150 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
151
152 Function: Oct6100ApiValidateTsst
153
154 Description: Validates a timeslot, stream combination.
155
156 -------------------------------------------------------------------------------
157 | Argument | Description
158 -------------------------------------------------------------------------------
159 f_pApiInstance Pointer to API instance. This tsst is used to keep
160 the present state of the chip and all its resources.
161
162 f_ulTimeslot Timeslot component of the TDM TSST.
163 f_ulStream Stream component of the TDM TSST.
164 f_ulNumTssts Number of TSST required.
165 f_ulDirection Direction of the TSST (Input or Output).
166
167 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
168 #if !SKIP_Oct6100ApiValidateTsst
169 UINT32 Oct6100ApiValidateTsst(
170 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
171 IN UINT32 f_ulNumTssts,
172 IN UINT32 f_ulTimeslot,
173 IN UINT32 f_ulStream,
174 IN UINT32 f_ulDirection )
175 {
176 tPOCT6100_SHARED_INFO pSharedInfo;
177 tPOCT6100_API_CHIP_CONFIG pChipConfig;
178
179 /* Obtain local pointer to shared portion of instance. */
180 pSharedInfo = f_pApiInstance->pSharedInfo;
181
182 /* Obtain local pointer to chip configuration. */
183 pChipConfig = &pSharedInfo->ChipConfig;
184
185 /* Check the TDM streams, timeslots component for errors. */
186 if ( f_ulTimeslot == cOCT6100_UNASSIGNED &&
187 f_ulStream != cOCT6100_UNASSIGNED )
188 return cOCT6100_ERR_TSST_TIMESLOT;
189
190 if ( f_ulTimeslot != cOCT6100_UNASSIGNED &&
191 f_ulStream == cOCT6100_UNASSIGNED )
192 return cOCT6100_ERR_TSST_STREAM;
193
194 if ( f_ulStream >= pChipConfig->byMaxTdmStreams )
195 return cOCT6100_ERR_TSST_STREAM;
196
197 /* Check timeslot value based on the frequenccy of the selected stream. */
198 switch ( pChipConfig->aulTdmStreamFreqs[ f_ulStream / 4 ] )
199 {
200 case cOCT6100_TDM_STREAM_FREQ_2MHZ:
201 if ( f_ulTimeslot >= 32 )
202 return cOCT6100_ERR_TSST_TIMESLOT;
203 break;
204 case cOCT6100_TDM_STREAM_FREQ_4MHZ:
205 if ( f_ulTimeslot >= 64 )
206 return cOCT6100_ERR_TSST_TIMESLOT;
207 break;
208 case cOCT6100_TDM_STREAM_FREQ_8MHZ:
209 if ( f_ulTimeslot >= 128 )
210 return cOCT6100_ERR_TSST_TIMESLOT;
211 break;
212 case cOCT6100_TDM_STREAM_FREQ_16MHZ:
213 if ( f_ulTimeslot >= 256 )
214 return cOCT6100_ERR_TSST_TIMESLOT;
215
216 /* Check the stream value based on the direction. */
217 if ( f_ulDirection == cOCT6100_INPUT_TSST && f_ulStream >= 16 )
218 {
219 return cOCT6100_ERR_TSST_STREAM;
220 }
221 else if( f_ulDirection == cOCT6100_OUTPUT_TSST && f_ulStream < 16 )
222 {
223 return cOCT6100_ERR_TSST_STREAM;
224 }
225
226 break;
227 default:
228 return cOCT6100_ERR_FATAL_DC;
229 }
230
231 /* Stream must be odd if two TSSTs are required. */
232 if ( f_ulNumTssts == 2 && ( ( f_ulStream & 0x1) != 0x1 ) )
233 return cOCT6100_ERR_TSST_STREAM;
234
235 return cOCT6100_ERR_OK;
236 }
237 #endif
238
239
240 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
241
242 Function: Oct6100ApiReserveTsst
243
244 Description: Reserves a TSST, only one TSI entry can access a TSST at any one
245 time.
246 If the pointer f_pulTsstListIndex is set to NULL, no TSST list
247 entry will be reserved.
248
249 The index in TSST control memory returned is based on the frequency
250 of the streams where the TSST is located and on the direction of
251 the TSST ( input or output ).
252
253 -------------------------------------------------------------------------------
254 | Argument | Description
255 -------------------------------------------------------------------------------
256 f_pApiInstance Pointer to API instance. This tsst is used to keep
257 the present state of the chip and all its resources.
258
259 f_ulTimeslot Timeslot component of the TDM TSST.
260 f_ulNumTssts Number of TSSTs required.
261 f_ulStream Stream component of the TDM TSST.
262 f_ulDirection Whether the TSST in and input TSST or output TSST.
263 f_pusTsstMemIndex Index of the resulting TSST in the TSST control memory.
264 f_pusTsstListIndex Index in the TSST list of the current entry.
265 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
266 #if !SKIP_Oct6100ApiReserveTsst
267 UINT32 Oct6100ApiReserveTsst(
268 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
269 IN UINT32 f_ulTimeslot,
270 IN UINT32 f_ulStream,
271 IN UINT32 f_ulNumTsst,
272 IN UINT32 f_ulDirection,
273 OUT PUINT16 f_pusTsstMemIndex,
274 OUT PUINT16 f_pusTsstListIndex )
275 {
276 tPOCT6100_SHARED_INFO pSharedInfo;
277 PVOID pTsstListAlloc;
278 PUINT32 pulTsstAlloc;
279 UINT32 ulResult = cOCT6100_ERR_OK;
280 UINT32 ulStream;
281 UINT32 ulTimeslot;
282
283 /* Get local pointer to shared portion of API instance structure. */
284 pSharedInfo = f_pApiInstance->pSharedInfo;
285
286 mOCT6100_GET_TSST_ALLOC_PNT( f_pApiInstance->pSharedInfo, pulTsstAlloc );
287
288 /*==================================================================================*/
289 /* Now make the proper conversion to obtain the TSST value. */
290
291 /* Save the timeslot and stream value received. */
292 ulStream = f_ulStream;
293 ulTimeslot = f_ulTimeslot;
294
295 /* Set the TSST index associated to this stream, timeslot combination. */
296 switch ( f_pApiInstance->pSharedInfo->ChipConfig.aulTdmStreamFreqs[ f_ulStream / 4 ] )
297 {
298 case cOCT6100_TDM_STREAM_FREQ_16MHZ:
299 if ( f_ulDirection == cOCT6100_INPUT_TSST )
300 {
301 ulStream = f_ulStream + ( f_ulTimeslot % 2 ) * 16;
302 ulTimeslot = f_ulTimeslot / 2;
303 }
304 else /* f_ulDirection == cOCT6100_OUTPUT_TSST */
305 {
306 ulStream = ( f_ulStream - 16 ) + ( f_ulTimeslot % 2 ) * 16;
307
308 if ( f_ulStream < 28 && ((f_ulTimeslot % 2) == 1) )
309 {
310 ulTimeslot = ((f_ulTimeslot / 2) + 4) % 128;
311 }
312 else
313 {
314 ulTimeslot = f_ulTimeslot / 2 ;
315 }
316 }
317
318 *f_pusTsstMemIndex = (UINT16)( ulTimeslot * 32 + ulStream );
319 break;
320
321 case cOCT6100_TDM_STREAM_FREQ_8MHZ:
322 *f_pusTsstMemIndex = (UINT16)( ulTimeslot * 32 + ulStream );
323 break;
324
325 case cOCT6100_TDM_STREAM_FREQ_4MHZ:
326 *f_pusTsstMemIndex = (UINT16)( ulTimeslot * 32 * 2 );
327 if ( f_ulDirection == cOCT6100_OUTPUT_TSST )
328 {
329 *f_pusTsstMemIndex = (UINT16)( *f_pusTsstMemIndex + ulStream );
330 }
331 else /* if ( f_ulDirection == cOCT6100_INPUT_TSST ) */
332 {
333 *f_pusTsstMemIndex = (UINT16)( ( 1 * 32 + ulStream ) + *f_pusTsstMemIndex );
334 }
335 break;
336
337 case cOCT6100_TDM_STREAM_FREQ_2MHZ:
338 *f_pusTsstMemIndex = (UINT16)( ulTimeslot * 32 * 4 );
339 if ( f_ulDirection == cOCT6100_OUTPUT_TSST )
340 {
341 *f_pusTsstMemIndex = (UINT16)( ulStream + *f_pusTsstMemIndex );
342 }
343 else /* if ( f_ulDirection == cOCT6100_INPUT_TSST ) */
344 {
345 *f_pusTsstMemIndex = (UINT16)( ( 3 * 32 + ulStream ) + *f_pusTsstMemIndex );
346 }
347 break;
348
349 default:
350 ulResult = cOCT6100_ERR_FATAL_8B;
351 }
352 /*======================================================================*/
353
354
355 /*======================================================================*/
356 /* First reserve the TSST. */
357
358 /* Get local pointer to TSST's entry in allocation table. */
359 switch ( pSharedInfo->ChipConfig.aulTdmStreamFreqs[ ulStream / 4 ] )
360 {
361 case cOCT6100_TDM_STREAM_FREQ_2MHZ:
362 ulTimeslot *= 4;
363 break;
364 case cOCT6100_TDM_STREAM_FREQ_4MHZ:
365 ulTimeslot *= 2;
366 break;
367 case cOCT6100_TDM_STREAM_FREQ_8MHZ:
368 ulTimeslot *= 1;
369 break;
370 case cOCT6100_TDM_STREAM_FREQ_16MHZ:
371 ulTimeslot *= 1;
372 break;
373 default:
374 return cOCT6100_ERR_FATAL_DD;
375 }
376
377 /* Check if entry is already reserved. */
378 if ( ((pulTsstAlloc[ ulTimeslot ] >> ulStream) & 0x1) == 0x1 )
379 return cOCT6100_ERR_TSST_TSST_RESERVED;
380
381 /* Check and reserve the associated TSST if required. */
382 if ( f_ulNumTsst == 2 )
383 {
384 /* Check if entry is already reserved. */
385 if ( ((pulTsstAlloc[ ulTimeslot ] >> (ulStream - 1) ) & 0x1) == 0x1 )
386 return cOCT6100_ERR_TSST_ASSOCIATED_TSST_RESERVED;
387
388 /* The entry is free, it won't anymore. */
389 pulTsstAlloc[ ulTimeslot ] |= (0x1 << (ulStream - 1));
390 }
391
392 /* The entry is free, it won't anymore.*/
393 pulTsstAlloc[ ulTimeslot ] |= (0x1 << ulStream);
394
395 /*======================================================================*/
396
397
398 /*======================================================================*/
399 /* Now reserve a TSST entry if requested. */
400
401 if ( f_pusTsstListIndex != NULL && ulResult == cOCT6100_ERR_OK )
402 {
403 UINT32 ulTsstListIndex;
404
405 /* Reserve a TSST entry in the API TSST list. */
406 mOCT6100_GET_TSST_LIST_ALLOC_PNT( f_pApiInstance->pSharedInfo, pTsstListAlloc );
407
408 ulResult = OctapiLlmAllocAlloc( pTsstListAlloc, &ulTsstListIndex );
409 if ( ulResult != cOCT6100_ERR_OK )
410 {
411 if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT )
412 ulResult = cOCT6100_ERR_TSST_ALL_TSSTS_ARE_OPENED;
413 else
414 ulResult = cOCT6100_ERR_FATAL_52;
415 }
416
417 *f_pusTsstListIndex = (UINT16)( ulTsstListIndex & 0xFFFF );
418 }
419 /*======================================================================*/
420
421
422 /*======================================================================*/
423 /* Check the result of the TSST list reservation. */
424
425 if ( ulResult != cOCT6100_ERR_OK )
426 {
427 /* Release the previously reserved TSST. */
428 if ( f_ulNumTsst == 2 )
429 {
430 /* Clear the entry. */
431 pulTsstAlloc[ ulTimeslot ] &= ~(0x1 << (ulStream - 1) );
432
433 }
434
435 /* Clear the entry. */
436 pulTsstAlloc[ ulTimeslot ] &= ~(0x1 << ulStream);
437 }
438
439 /*======================================================================*/
440
441 return ulResult;
442 }
443 #endif
444
445
446 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
447
448 Function: Oct6100ApiReleaseTsst
449
450 Description: Releases a TSST.
451
452 If f_usTsstListIndex is set to cOCT6100_INVALID_INDEX, the API
453 will assume that no TSST list entry was reserved for this TSST.
454
455 -------------------------------------------------------------------------------
456 | Argument | Description
457 -------------------------------------------------------------------------------
458 f_pApiInstance Pointer to API instance. This tsst is used to keep
459 the present state of the chip and all its resources.
460
461 f_ulNumTssts Number of TSSTs to be released.
462 f_ulStream Stream component of the TDM TSST.
463 f_ulTimeslot Timeslot component of the TDM TSST.
464 f_ulDirection Whether the TSST is an input TSST or output TSST.
465 f_usTsstListIndex Index in the TSST list of the current entry.
466
467 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
468 #if !SKIP_Oct6100ApiReleaseTsst
469 UINT32 Oct6100ApiReleaseTsst(
470 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
471 IN UINT32 f_ulTimeslot,
472 IN UINT32 f_ulStream,
473 IN UINT32 f_ulNumTsst,
474 IN UINT32 f_ulDirection,
475 IN UINT16 f_usTsstListIndex)
476 {
477 tPOCT6100_SHARED_INFO pSharedInfo;
478 PUINT32 pulTsstAlloc;
479 PVOID pTsstListAlloc;
480 UINT32 ulResult;
481 UINT32 ulStream;
482 UINT32 ulTimeslot;
483
484 /* Get local pointer to shared portion of API instance structure. */
485 pSharedInfo = f_pApiInstance->pSharedInfo;
486
487 if ( f_usTsstListIndex != cOCT6100_INVALID_INDEX )
488 {
489 mOCT6100_GET_TSST_LIST_ALLOC_PNT( pSharedInfo, pTsstListAlloc )
490
491 ulResult = OctapiLlmAllocDealloc( pTsstListAlloc, f_usTsstListIndex );
492 if ( ulResult != cOCT6100_ERR_OK )
493 {
494 return cOCT6100_ERR_FATAL_53;
495 }
496 }
497
498 mOCT6100_GET_TSST_ALLOC_PNT( f_pApiInstance->pSharedInfo, pulTsstAlloc );
499
500 /*==================================================================================*/
501 /* Now make the proper conversion to obtain the TSST value. */
502
503 /* Save the timeslot and stream value received. */
504 ulStream = f_ulStream;
505 ulTimeslot = f_ulTimeslot;
506
507 /* Set the TSST index associated to this stream, timeslot combination. */
508 if ( pSharedInfo->ChipConfig.aulTdmStreamFreqs[ f_ulStream / 4 ] == cOCT6100_TDM_STREAM_FREQ_16MHZ )
509 {
510 if ( f_ulDirection == cOCT6100_INPUT_TSST )
511 {
512 ulStream = f_ulStream + ( f_ulTimeslot % 2 ) * 16;
513 ulTimeslot = f_ulTimeslot / 2;
514 }
515 else /* f_ulDirection == cOCT6100_OUTPUT_TSST */
516 {
517 ulStream = ( f_ulStream - 16 ) + ( f_ulTimeslot % 2 ) * 16;
518
519 if ( f_ulStream < 28 && ((f_ulTimeslot % 2) == 1) )
520 {
521 ulTimeslot = ((f_ulTimeslot / 2) + 4) % 128;
522 }
523 else
524 {
525 ulTimeslot = f_ulTimeslot / 2 ;
526 }
527 }
528 }
529
530 /* Get local pointer to TSST's entry in allocation table. */
531 switch ( pSharedInfo->ChipConfig.aulTdmStreamFreqs[ ulStream / 4 ] )
532 {
533 case cOCT6100_TDM_STREAM_FREQ_2MHZ:
534 ulTimeslot *= 4;
535 break;
536 case cOCT6100_TDM_STREAM_FREQ_4MHZ:
537 ulTimeslot *= 2;
538 break;
539 case cOCT6100_TDM_STREAM_FREQ_8MHZ:
540 ulTimeslot *= 1;
541 break;
542 case cOCT6100_TDM_STREAM_FREQ_16MHZ:
543 ulTimeslot *= 1;
544 break;
545 default:
546 return cOCT6100_ERR_FATAL_DE;
547 }
548
549 /* Check if entry is actualy reserved. */
550 if ( ((pulTsstAlloc[ ulTimeslot ] >> ulStream) & 0x1) != 0x1 )
551 return cOCT6100_ERR_FATAL_55;
552
553 /*==================================================================================*/
554
555 /* Clear the entry. */
556 pulTsstAlloc[ ulTimeslot ] &= ~(0x1 << ulStream);
557
558 /* Check and release the associated TSST if required. */
559 if ( f_ulNumTsst == 2 )
560 {
561 /* Check if entry is actualy reserved. */
562 if ( ((pulTsstAlloc[ ulTimeslot ] >> ( ulStream - 1)) & 0x1) != 0x1 )
563 return cOCT6100_ERR_FATAL_54;
564
565 /* Clear the entry. */
566 pulTsstAlloc[ ulTimeslot ] &= ~(0x1 << (ulStream - 1));
567
568 }
569
570 return cOCT6100_ERR_OK;
571 }
572 #endif