Debian Codegraph @

drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.c

raw symbols SCIP
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 PUINT32 pulTsstAlloc;
179
180 /* Obtain local pointer to shared portion of instance. */
181 pSharedInfo = f_pApiInstance->pSharedInfo;
182
183 mOCT6100_GET_TSST_ALLOC_PNT( f_pApiInstance->pSharedInfo, pulTsstAlloc );
184
185 /* Obtain local pointer to chip configuration. */
186 pChipConfig = &pSharedInfo->ChipConfig;
187
188 /* Check the TDM streams, timeslots component for errors. */
189 if ( f_ulTimeslot == cOCT6100_UNASSIGNED &&
190 f_ulStream != cOCT6100_UNASSIGNED )
191 return cOCT6100_ERR_TSST_TIMESLOT;
192
193 if ( f_ulTimeslot != cOCT6100_UNASSIGNED &&
194 f_ulStream == cOCT6100_UNASSIGNED )
195 return cOCT6100_ERR_TSST_STREAM;
196
197 if ( f_ulStream >= pChipConfig->byMaxTdmStreams )
198 return cOCT6100_ERR_TSST_STREAM;
199
200 /* Check timeslot value based on the frequenccy of the selected stream. */
201 switch ( pChipConfig->aulTdmStreamFreqs[ f_ulStream / 4 ] )
202 {
203 case cOCT6100_TDM_STREAM_FREQ_2MHZ:
204 if ( f_ulTimeslot >= 32 )
205 return cOCT6100_ERR_TSST_TIMESLOT;
206 break;
207 case cOCT6100_TDM_STREAM_FREQ_4MHZ:
208 if ( f_ulTimeslot >= 64 )
209 return cOCT6100_ERR_TSST_TIMESLOT;
210 break;
211 case cOCT6100_TDM_STREAM_FREQ_8MHZ:
212 if ( f_ulTimeslot >= 128 )
213 return cOCT6100_ERR_TSST_TIMESLOT;
214 break;
215 case cOCT6100_TDM_STREAM_FREQ_16MHZ:
216 if ( f_ulTimeslot >= 256 )
217 return cOCT6100_ERR_TSST_TIMESLOT;
218
219 /* Check the stream value based on the direction. */
220 if ( f_ulDirection == cOCT6100_INPUT_TSST && f_ulStream >= 16 )
221 {
222 return cOCT6100_ERR_TSST_STREAM;
223 }
224 else if( f_ulDirection == cOCT6100_OUTPUT_TSST && f_ulStream < 16 )
225 {
226 return cOCT6100_ERR_TSST_STREAM;
227 }
228
229 break;
230 default:
231 return cOCT6100_ERR_FATAL_DC;
232 }
233
234 /* Stream must be odd if two TSSTs are required. */
235 if ( f_ulNumTssts == 2 && ( ( f_ulStream & 0x1) != 0x1 ) )
236 return cOCT6100_ERR_TSST_STREAM;
237
238 return cOCT6100_ERR_OK;
239 }
240 #endif
241
242
243 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
244
245 Function: Oct6100ApiReserveTsst
246
247 Description: Reserves a TSST, only one TSI entry can access a TSST at any one
248 time.
249 If the pointer f_pulTsstListIndex is set to NULL, no TSST list
250 entry will be reserved.
251
252 The index in TSST control memory returned is based on the frequency
253 of the streams where the TSST is located and on the direction of
254 the TSST ( input or output ).
255
256 -------------------------------------------------------------------------------
257 | Argument | Description
258 -------------------------------------------------------------------------------
259 f_pApiInstance Pointer to API instance. This tsst is used to keep
260 the present state of the chip and all its resources.
261
262 f_ulTimeslot Timeslot component of the TDM TSST.
263 f_ulNumTssts Number of TSSTs required.
264 f_ulStream Stream component of the TDM TSST.
265 f_ulDirection Whether the TSST in and input TSST or output TSST.
266 f_pusTsstMemIndex Index of the resulting TSST in the TSST control memory.
267 f_pusTsstListIndex Index in the TSST list of the current entry.
268 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
269 #if !SKIP_Oct6100ApiReserveTsst
270 UINT32 Oct6100ApiReserveTsst(
271 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
272 IN UINT32 f_ulTimeslot,
273 IN UINT32 f_ulStream,
274 IN UINT32 f_ulNumTsst,
275 IN UINT32 f_ulDirection,
276 OUT PUINT16 f_pusTsstMemIndex,
277 OUT PUINT16 f_pusTsstListIndex )
278 {
279 tPOCT6100_SHARED_INFO pSharedInfo;
280 PVOID pTsstListAlloc;
281 PUINT32 pulTsstAlloc;
282 UINT32 ulResult = cOCT6100_ERR_OK;
283 UINT32 ulStream;
284 UINT32 ulTimeslot;
285
286 /* Get local pointer to shared portion of API instance structure. */
287 pSharedInfo = f_pApiInstance->pSharedInfo;
288
289 mOCT6100_GET_TSST_ALLOC_PNT( f_pApiInstance->pSharedInfo, pulTsstAlloc );
290
291 /*==================================================================================*/
292 /* Now make the proper conversion to obtain the TSST value. */
293
294 /* Save the timeslot and stream value received. */
295 ulStream = f_ulStream;
296 ulTimeslot = f_ulTimeslot;
297
298 /* Set the TSST index associated to this stream, timeslot combination. */
299 switch ( f_pApiInstance->pSharedInfo->ChipConfig.aulTdmStreamFreqs[ f_ulStream / 4 ] )
300 {
301 case cOCT6100_TDM_STREAM_FREQ_16MHZ:
302 if ( f_ulDirection == cOCT6100_INPUT_TSST )
303 {
304 ulStream = f_ulStream + ( f_ulTimeslot % 2 ) * 16;
305 ulTimeslot = f_ulTimeslot / 2;
306 }
307 else /* f_ulDirection == cOCT6100_OUTPUT_TSST */
308 {
309 ulStream = ( f_ulStream - 16 ) + ( f_ulTimeslot % 2 ) * 16;
310
311 if ( f_ulStream < 28 && ((f_ulTimeslot % 2) == 1) )
312 {
313 ulTimeslot = ((f_ulTimeslot / 2) + 4) % 128;
314 }
315 else
316 {
317 ulTimeslot = f_ulTimeslot / 2 ;
318 }
319 }
320
321 *f_pusTsstMemIndex = (UINT16)( ulTimeslot * 32 + ulStream );
322 break;
323
324 case cOCT6100_TDM_STREAM_FREQ_8MHZ:
325 *f_pusTsstMemIndex = (UINT16)( ulTimeslot * 32 + ulStream );
326 break;
327
328 case cOCT6100_TDM_STREAM_FREQ_4MHZ:
329 *f_pusTsstMemIndex = (UINT16)( ulTimeslot * 32 * 2 );
330 if ( f_ulDirection == cOCT6100_OUTPUT_TSST )
331 {
332 *f_pusTsstMemIndex = (UINT16)( *f_pusTsstMemIndex + ulStream );
333 }
334 else /* if ( f_ulDirection == cOCT6100_INPUT_TSST ) */
335 {
336 *f_pusTsstMemIndex = (UINT16)( ( 1 * 32 + ulStream ) + *f_pusTsstMemIndex );
337 }
338 break;
339
340 case cOCT6100_TDM_STREAM_FREQ_2MHZ:
341 *f_pusTsstMemIndex = (UINT16)( ulTimeslot * 32 * 4 );
342 if ( f_ulDirection == cOCT6100_OUTPUT_TSST )
343 {
344 *f_pusTsstMemIndex = (UINT16)( ulStream + *f_pusTsstMemIndex );
345 }
346 else /* if ( f_ulDirection == cOCT6100_INPUT_TSST ) */
347 {
348 *f_pusTsstMemIndex = (UINT16)( ( 3 * 32 + ulStream ) + *f_pusTsstMemIndex );
349 }
350 break;
351
352 default:
353 ulResult = cOCT6100_ERR_FATAL_8B;
354 }
355 /*======================================================================*/
356
357
358 /*======================================================================*/
359 /* First reserve the TSST. */
360
361 /* Get local pointer to TSST's entry in allocation table. */
362 switch ( pSharedInfo->ChipConfig.aulTdmStreamFreqs[ ulStream / 4 ] )
363 {
364 case cOCT6100_TDM_STREAM_FREQ_2MHZ:
365 ulTimeslot *= 4;
366 break;
367 case cOCT6100_TDM_STREAM_FREQ_4MHZ:
368 ulTimeslot *= 2;
369 break;
370 case cOCT6100_TDM_STREAM_FREQ_8MHZ:
371 ulTimeslot *= 1;
372 break;
373 case cOCT6100_TDM_STREAM_FREQ_16MHZ:
374 ulTimeslot *= 1;
375 break;
376 default:
377 return cOCT6100_ERR_FATAL_DD;
378 }
379
380 /* Check if entry is already reserved. */
381 if ( ((pulTsstAlloc[ ulTimeslot ] >> ulStream) & 0x1) == 0x1 )
382 return cOCT6100_ERR_TSST_TSST_RESERVED;
383
384 /* Check and reserve the associated TSST if required. */
385 if ( f_ulNumTsst == 2 )
386 {
387 /* Check if entry is already reserved. */
388 if ( ((pulTsstAlloc[ ulTimeslot ] >> (ulStream - 1) ) & 0x1) == 0x1 )
389 return cOCT6100_ERR_TSST_ASSOCIATED_TSST_RESERVED;
390
391 /* The entry is free, it won't anymore. */
392 pulTsstAlloc[ ulTimeslot ] |= (0x1 << (ulStream - 1));
393 }
394
395 /* The entry is free, it won't anymore.*/
396 pulTsstAlloc[ ulTimeslot ] |= (0x1 << ulStream);
397
398 /*======================================================================*/
399
400
401 /*======================================================================*/
402 /* Now reserve a TSST entry if requested. */
403
404 if ( f_pusTsstListIndex != NULL && ulResult == cOCT6100_ERR_OK )
405 {
406 UINT32 ulTsstListIndex;
407
408 /* Reserve a TSST entry in the API TSST list. */
409 mOCT6100_GET_TSST_LIST_ALLOC_PNT( f_pApiInstance->pSharedInfo, pTsstListAlloc );
410
411 ulResult = OctapiLlmAllocAlloc( pTsstListAlloc, &ulTsstListIndex );
412 if ( ulResult != cOCT6100_ERR_OK )
413 {
414 if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT )
415 ulResult = cOCT6100_ERR_TSST_ALL_TSSTS_ARE_OPENED;
416 else
417 ulResult = cOCT6100_ERR_FATAL_52;
418 }
419
420 *f_pusTsstListIndex = (UINT16)( ulTsstListIndex & 0xFFFF );
421 }
422 /*======================================================================*/
423
424
425 /*======================================================================*/
426 /* Check the result of the TSST list reservation. */
427
428 if ( ulResult != cOCT6100_ERR_OK )
429 {
430 /* Release the previously reserved TSST. */
431 if ( f_ulNumTsst == 2 )
432 {
433 /* Clear the entry. */
434 pulTsstAlloc[ ulTimeslot ] &= ~(0x1 << (ulStream - 1) );
435
436 }
437
438 /* Clear the entry. */
439 pulTsstAlloc[ ulTimeslot ] &= ~(0x1 << ulStream);
440 }
441
442 /*======================================================================*/
443
444 return ulResult;
445 }
446 #endif
447
448
449 /*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
450
451 Function: Oct6100ApiReleaseTsst
452
453 Description: Releases a TSST.
454
455 If f_usTsstListIndex is set to cOCT6100_INVALID_INDEX, the API
456 will assume that no TSST list entry was reserved for this TSST.
457
458 -------------------------------------------------------------------------------
459 | Argument | Description
460 -------------------------------------------------------------------------------
461 f_pApiInstance Pointer to API instance. This tsst is used to keep
462 the present state of the chip and all its resources.
463
464 f_ulNumTssts Number of TSSTs to be released.
465 f_ulStream Stream component of the TDM TSST.
466 f_ulTimeslot Timeslot component of the TDM TSST.
467 f_ulDirection Whether the TSST is an input TSST or output TSST.
468 f_usTsstListIndex Index in the TSST list of the current entry.
469
470 \*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
471 #if !SKIP_Oct6100ApiReleaseTsst
472 UINT32 Oct6100ApiReleaseTsst(
473 IN OUT tPOCT6100_INSTANCE_API f_pApiInstance,
474 IN UINT32 f_ulTimeslot,
475 IN UINT32 f_ulStream,
476 IN UINT32 f_ulNumTsst,
477 IN UINT32 f_ulDirection,
478 IN UINT16 f_usTsstListIndex)
479 {
480 tPOCT6100_SHARED_INFO pSharedInfo;
481 PUINT32 pulTsstAlloc;
482 PVOID pTsstListAlloc;
483 UINT32 ulResult;
484 UINT32 ulStream;
485 UINT32 ulTimeslot;
486
487 /* Get local pointer to shared portion of API instance structure. */
488 pSharedInfo = f_pApiInstance->pSharedInfo;
489
490 if ( f_usTsstListIndex != cOCT6100_INVALID_INDEX )
491 {
492 mOCT6100_GET_TSST_LIST_ALLOC_PNT( pSharedInfo, pTsstListAlloc )
493
494 ulResult = OctapiLlmAllocDealloc( pTsstListAlloc, f_usTsstListIndex );
495 if ( ulResult != cOCT6100_ERR_OK )
496 {
497 return cOCT6100_ERR_FATAL_53;
498 }
499 }
500
501 mOCT6100_GET_TSST_ALLOC_PNT( f_pApiInstance->pSharedInfo, pulTsstAlloc );
502
503 /*==================================================================================*/
504 /* Now make the proper conversion to obtain the TSST value. */
505
506 /* Save the timeslot and stream value received. */
507 ulStream = f_ulStream;
508 ulTimeslot = f_ulTimeslot;
509
510 /* Set the TSST index associated to this stream, timeslot combination. */
511 if ( pSharedInfo->ChipConfig.aulTdmStreamFreqs[ f_ulStream / 4 ] == cOCT6100_TDM_STREAM_FREQ_16MHZ )
512 {
513 if ( f_ulDirection == cOCT6100_INPUT_TSST )
514 {
515 ulStream = f_ulStream + ( f_ulTimeslot % 2 ) * 16;
516 ulTimeslot = f_ulTimeslot / 2;
517 }
518 else /* f_ulDirection == cOCT6100_OUTPUT_TSST */
519 {
520 ulStream = ( f_ulStream - 16 ) + ( f_ulTimeslot % 2 ) * 16;
521
522 if ( f_ulStream < 28 && ((f_ulTimeslot % 2) == 1) )
523 {
524 ulTimeslot = ((f_ulTimeslot / 2) + 4) % 128;
525 }
526 else
527 {
528 ulTimeslot = f_ulTimeslot / 2 ;
529 }
530 }
531 }
532
533 /* Get local pointer to TSST's entry in allocation table. */
534 switch ( pSharedInfo->ChipConfig.aulTdmStreamFreqs[ ulStream / 4 ] )
535 {
536 case cOCT6100_TDM_STREAM_FREQ_2MHZ:
537 ulTimeslot *= 4;
538 break;
539 case cOCT6100_TDM_STREAM_FREQ_4MHZ:
540 ulTimeslot *= 2;
541 break;
542 case cOCT6100_TDM_STREAM_FREQ_8MHZ:
543 ulTimeslot *= 1;
544 break;
545 case cOCT6100_TDM_STREAM_FREQ_16MHZ:
546 ulTimeslot *= 1;
547 break;
548 default:
549 return cOCT6100_ERR_FATAL_DE;
550 }
551
552 /* Check if entry is actualy reserved. */
553 if ( ((pulTsstAlloc[ ulTimeslot ] >> ulStream) & 0x1) != 0x1 )
554 return cOCT6100_ERR_FATAL_55;
555
556 /*==================================================================================*/
557
558 /* Clear the entry. */
559 pulTsstAlloc[ ulTimeslot ] &= ~(0x1 << ulStream);
560
561 /* Check and release the associated TSST if required. */
562 if ( f_ulNumTsst == 2 )
563 {
564 /* Check if entry is actualy reserved. */
565 if ( ((pulTsstAlloc[ ulTimeslot ] >> ( ulStream - 1)) & 0x1) != 0x1 )
566 return cOCT6100_ERR_FATAL_54;
567
568 /* Clear the entry. */
569 pulTsstAlloc[ ulTimeslot ] &= ~(0x1 << (ulStream - 1));
570
571 }
572
573 return cOCT6100_ERR_OK;
574 }
575 #endif