| 1 |
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ |
| 2 |
|
| 3 |
File: oct6100_phasing_tsst.c |
| 4 |
|
| 5 |
Copyright (c) 2001-2007 Octasic Inc. |
| 6 |
|
| 7 |
Description: |
| 8 |
|
| 9 |
This file contains functions used to open and close phasing TSSTs. |
| 10 |
|
| 11 |
This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is |
| 12 |
free software; you can redistribute it and/or modify it under the terms of |
| 13 |
the GNU General Public License as published by the Free Software Foundation; |
| 14 |
either version 2 of the License, or (at your option) any later version. |
| 15 |
|
| 16 |
The OCT6100 GPL API is distributed in the hope that it will be useful, but |
| 17 |
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 18 |
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 19 |
for more details. |
| 20 |
|
| 21 |
You should have received a copy of the GNU General Public License |
| 22 |
along with the OCT6100 GPL API; if not, write to the Free Software |
| 23 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 24 |
|
| 25 |
$Octasic_Release: OCT612xAPI-01.00-PR49 $ |
| 26 |
|
| 27 |
$Octasic_Revision: 46 $ |
| 28 |
|
| 29 |
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ |
| 30 |
|
| 31 |
|
| 32 |
/***************************** INCLUDE FILES *******************************/ |
| 33 |
|
| 34 |
#include "octdef.h" |
| 35 |
|
| 36 |
#include "oct6100api/oct6100_defines.h" |
| 37 |
#include "oct6100api/oct6100_errors.h" |
| 38 |
#include "oct6100api/oct6100_apiud.h" |
| 39 |
|
| 40 |
#include "apilib/octapi_llman.h" |
| 41 |
|
| 42 |
#include "oct6100api/oct6100_tlv_inst.h" |
| 43 |
#include "oct6100api/oct6100_chip_open_inst.h" |
| 44 |
#include "oct6100api/oct6100_chip_stats_inst.h" |
| 45 |
#include "oct6100api/oct6100_interrupts_inst.h" |
| 46 |
#include "oct6100api/oct6100_remote_debug_inst.h" |
| 47 |
#include "oct6100api/oct6100_debug_inst.h" |
| 48 |
#include "oct6100api/oct6100_api_inst.h" |
| 49 |
#include "oct6100api/oct6100_phasing_tsst_inst.h" |
| 50 |
|
| 51 |
#include "oct6100api/oct6100_interrupts_pub.h" |
| 52 |
#include "oct6100api/oct6100_chip_open_pub.h" |
| 53 |
#include "oct6100api/oct6100_channel_pub.h" |
| 54 |
#include "oct6100api/oct6100_phasing_tsst_pub.h" |
| 55 |
#include "oct6100api/oct6100_channel_inst.h" |
| 56 |
|
| 57 |
#include "oct6100_chip_open_priv.h" |
| 58 |
#include "oct6100_miscellaneous_priv.h" |
| 59 |
#include "oct6100_memory_priv.h" |
| 60 |
#include "oct6100_tsst_priv.h" |
| 61 |
#include "oct6100_phasing_tsst_priv.h" |
| 62 |
|
| 63 |
/**************************** PUBLIC FUNCTIONS ****************************/ |
| 64 |
|
| 65 |
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ |
| 66 |
|
| 67 |
Function: Oct6100PhasingTsstOpen |
| 68 |
|
| 69 |
Description: This function opens a phasing TSST. |
| 70 |
|
| 71 |
------------------------------------------------------------------------------- |
| 72 |
| Argument | Description |
| 73 |
------------------------------------------------------------------------------- |
| 74 |
f_pApiInstance Pointer to API instance. This memory is used to keep the |
| 75 |
present state of the chip and all its resources. |
| 76 |
|
| 77 |
f_pPhasingTsstOpen Pointer to phasing TSST open structure. |
| 78 |
|
| 79 |
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ |
| 80 |
#if !SKIP_Oct6100PhasingTsstOpenDef |
| 81 |
UINT32 Oct6100PhasingTsstOpenDef( |
| 82 |
tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen ) |
| 83 |
{ |
| 84 |
f_pPhasingTsstOpen->pulPhasingTsstHndl = NULL; |
| 85 |
|
| 86 |
f_pPhasingTsstOpen->ulTimeslot = cOCT6100_INVALID_TIMESLOT; |
| 87 |
f_pPhasingTsstOpen->ulStream = cOCT6100_INVALID_STREAM; |
| 88 |
|
| 89 |
f_pPhasingTsstOpen->ulPhasingLength = 88; |
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
return cOCT6100_ERR_OK; |
| 94 |
} |
| 95 |
#endif |
| 96 |
|
| 97 |
|
| 98 |
#if !SKIP_Oct6100PhasingTsstOpen |
| 99 |
UINT32 Oct6100PhasingTsstOpen( |
| 100 |
tPOCT6100_INSTANCE_API f_pApiInstance, |
| 101 |
tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen ) |
| 102 |
{ |
| 103 |
tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; |
| 104 |
tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; |
| 105 |
UINT32 ulSerRes = cOCT6100_ERR_OK; |
| 106 |
UINT32 ulFncRes = cOCT6100_ERR_OK; |
| 107 |
|
| 108 |
/* Set the process context of the serialize structure. */ |
| 109 |
SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; |
| 110 |
ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; |
| 111 |
|
| 112 |
/* Seize all list semaphores needed by this function. */ |
| 113 |
SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; |
| 114 |
SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; |
| 115 |
ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); |
| 116 |
if ( ulSerRes == cOCT6100_ERR_OK ) |
| 117 |
{ |
| 118 |
/* Call the serialized function. */ |
| 119 |
ulFncRes = Oct6100PhasingTsstOpenSer( f_pApiInstance, f_pPhasingTsstOpen ); |
| 120 |
} |
| 121 |
else |
| 122 |
{ |
| 123 |
return ulSerRes; |
| 124 |
} |
| 125 |
|
| 126 |
/* Release the seized semaphores. */ |
| 127 |
ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; |
| 128 |
ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); |
| 129 |
|
| 130 |
/* If an error occured then return the error code. */ |
| 131 |
if ( ulSerRes != cOCT6100_ERR_OK ) |
| 132 |
return ulSerRes; |
| 133 |
if ( ulFncRes != cOCT6100_ERR_OK ) |
| 134 |
return ulFncRes; |
| 135 |
|
| 136 |
return cOCT6100_ERR_OK; |
| 137 |
} |
| 138 |
#endif |
| 139 |
|
| 140 |
|
| 141 |
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ |
| 142 |
|
| 143 |
Function: Oct6100PhasingTsstClose |
| 144 |
|
| 145 |
Description: This function closes a phasing TSST |
| 146 |
|
| 147 |
------------------------------------------------------------------------------- |
| 148 |
| Argument | Description |
| 149 |
------------------------------------------------------------------------------- |
| 150 |
f_pApiInstance Pointer to API instance. This memory is used to keep the |
| 151 |
present state of the chip and all its resources. |
| 152 |
|
| 153 |
f_pPhasingTsstClose Pointer to phasing TSST close structure. |
| 154 |
|
| 155 |
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ |
| 156 |
#if !SKIP_Oct6100PhasingTsstCloseDef |
| 157 |
UINT32 Oct6100PhasingTsstCloseDef( |
| 158 |
tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose ) |
| 159 |
{ |
| 160 |
f_pPhasingTsstClose->ulPhasingTsstHndl = cOCT6100_INVALID_HANDLE; |
| 161 |
|
| 162 |
return cOCT6100_ERR_OK; |
| 163 |
} |
| 164 |
#endif |
| 165 |
|
| 166 |
|
| 167 |
#if !SKIP_Oct6100PhasingTsstClose |
| 168 |
UINT32 Oct6100PhasingTsstClose( |
| 169 |
tPOCT6100_INSTANCE_API f_pApiInstance, |
| 170 |
tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose ) |
| 171 |
{ |
| 172 |
tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; |
| 173 |
tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; |
| 174 |
UINT32 ulSerRes = cOCT6100_ERR_OK; |
| 175 |
UINT32 ulFncRes = cOCT6100_ERR_OK; |
| 176 |
|
| 177 |
/* Set the process context of the serialize structure. */ |
| 178 |
SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; |
| 179 |
ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; |
| 180 |
|
| 181 |
/* Seize all list semaphores needed by this function. */ |
| 182 |
SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; |
| 183 |
SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; |
| 184 |
ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); |
| 185 |
if ( ulSerRes == cOCT6100_ERR_OK ) |
| 186 |
{ |
| 187 |
/* Call the serialized function. */ |
| 188 |
ulFncRes = Oct6100PhasingTsstCloseSer( f_pApiInstance, f_pPhasingTsstClose ); |
| 189 |
} |
| 190 |
else |
| 191 |
{ |
| 192 |
return ulSerRes; |
| 193 |
} |
| 194 |
|
| 195 |
/* Release the seized semaphores. */ |
| 196 |
ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; |
| 197 |
ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); |
| 198 |
|
| 199 |
/* If an error occured then return the error code. */ |
| 200 |
if ( ulSerRes != cOCT6100_ERR_OK ) |
| 201 |
return ulSerRes; |
| 202 |
if ( ulFncRes != cOCT6100_ERR_OK ) |
| 203 |
return ulFncRes; |
| 204 |
|
| 205 |
return cOCT6100_ERR_OK; |
| 206 |
} |
| 207 |
#endif |
| 208 |
|
| 209 |
|
| 210 |
/**************************** PRIVATE FUNCTIONS ****************************/ |
| 211 |
|
| 212 |
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ |
| 213 |
|
| 214 |
Function: Oct6100ApiGetPhasingTsstSwSizes |
| 215 |
|
| 216 |
Description: Gets the sizes of all portions of the API instance pertinent |
| 217 |
to the management of Phasing TSSTs. |
| 218 |
|
| 219 |
------------------------------------------------------------------------------- |
| 220 |
| Argument | Description |
| 221 |
------------------------------------------------------------------------------- |
| 222 |
f_pOpenChip Pointer to chip configuration struct. |
| 223 |
f_pInstSizes Pointer to struct containing instance sizes. |
| 224 |
|
| 225 |
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ |
| 226 |
#if !SKIP_Oct6100ApiGetPhasingTsstSwSizes |
| 227 |
UINT32 Oct6100ApiGetPhasingTsstSwSizes( |
| 228 |
IN tPOCT6100_CHIP_OPEN f_pOpenChip, |
| 229 |
OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) |
| 230 |
{ |
| 231 |
UINT32 ulTempVar; |
| 232 |
UINT32 ulResult; |
| 233 |
|
| 234 |
/* Determine the amount of memory required for the API phasing TSST list. */ |
| 235 |
f_pInstSizes->ulPhasingTsstList = f_pOpenChip->ulMaxPhasingTssts * sizeof( tOCT6100_API_PHASING_TSST ); |
| 236 |
|
| 237 |
if ( f_pOpenChip->ulMaxPhasingTssts > 0 ) |
| 238 |
{ |
| 239 |
/* Calculate memory needed for Phasing TSST API memory allocation */ |
| 240 |
ulResult = OctapiLlmAllocGetSize( f_pOpenChip->ulMaxPhasingTssts, &f_pInstSizes->ulPhasingTsstAlloc ); |
| 241 |
if ( ulResult != cOCT6100_ERR_OK ) |
| 242 |
return cOCT6100_ERR_FATAL_38; |
| 243 |
} |
| 244 |
else |
| 245 |
{ |
| 246 |
f_pInstSizes->ulPhasingTsstAlloc = 0; |
| 247 |
} |
| 248 |
|
| 249 |
mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulPhasingTsstList, ulTempVar ) |
| 250 |
mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulPhasingTsstAlloc, ulTempVar ) |
| 251 |
|
| 252 |
return cOCT6100_ERR_OK; |
| 253 |
} |
| 254 |
#endif |
| 255 |
|
| 256 |
|
| 257 |
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ |
| 258 |
|
| 259 |
Function: Oct6100ApiPhasingTsstSwInit |
| 260 |
|
| 261 |
Description: Initializes all elements of the instance structure associated |
| 262 |
to phasing TSST. |
| 263 |
|
| 264 |
------------------------------------------------------------------------------- |
| 265 |
| Argument | Description |
| 266 |
------------------------------------------------------------------------------- |
| 267 |
f_pApiInstance Pointer to API instance. This memory is used to keep |
| 268 |
the present state of the chip and all its resources. |
| 269 |
|
| 270 |
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ |
| 271 |
#if !SKIP_Oct6100ApiPhasingTsstSwInit |
| 272 |
UINT32 Oct6100ApiPhasingTsstSwInit( |
| 273 |
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) |
| 274 |
{ |
| 275 |
tPOCT6100_API_PHASING_TSST pPhasingTsstList; |
| 276 |
tPOCT6100_SHARED_INFO pSharedInfo; |
| 277 |
UINT32 ulMaxPhasingTssts; |
| 278 |
PVOID pPhasingTsstAlloc; |
| 279 |
UINT32 ulResult; |
| 280 |
|
| 281 |
/* Get local pointer to shared portion of instance. */ |
| 282 |
pSharedInfo = f_pApiInstance->pSharedInfo; |
| 283 |
|
| 284 |
/* Initialize the phasing TSST API list. */ |
| 285 |
ulMaxPhasingTssts = pSharedInfo->ChipConfig.usMaxPhasingTssts; |
| 286 |
|
| 287 |
/* Set all entries in the phasing TSST list to unused. */ |
| 288 |
mOCT6100_GET_PHASING_TSST_LIST_PNT( pSharedInfo, pPhasingTsstList ) |
| 289 |
|
| 290 |
/* Clear the memory */ |
| 291 |
Oct6100UserMemSet( pPhasingTsstList, 0x00, sizeof(tOCT6100_API_PHASING_TSST) * ulMaxPhasingTssts ); |
| 292 |
|
| 293 |
/* Initialize the phasing TSST allocation software to "all free". */ |
| 294 |
if ( ulMaxPhasingTssts > 0 ) |
| 295 |
{ |
| 296 |
mOCT6100_GET_PHASING_TSST_ALLOC_PNT( pSharedInfo, pPhasingTsstAlloc ) |
| 297 |
|
| 298 |
ulResult = OctapiLlmAllocInit( &pPhasingTsstAlloc, ulMaxPhasingTssts ); |
| 299 |
if ( ulResult != cOCT6100_ERR_OK ) |
| 300 |
return cOCT6100_ERR_FATAL_39; |
| 301 |
} |
| 302 |
|
| 303 |
return cOCT6100_ERR_OK; |
| 304 |
} |
| 305 |
#endif |
| 306 |
|
| 307 |
|
| 308 |
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ |
| 309 |
|
| 310 |
Function: Oct6100PhasingTsstOpenSer |
| 311 |
|
| 312 |
Description: Opens a phasing TSST. |
| 313 |
|
| 314 |
------------------------------------------------------------------------------- |
| 315 |
| Argument | Description |
| 316 |
------------------------------------------------------------------------------- |
| 317 |
f_pApiInstance Pointer to API instance. This memory is used to keep the |
| 318 |
present state of the chip and all its resources. |
| 319 |
|
| 320 |
f_pPhasingTsstOpen Pointer to phasing TSST open configuration structure. |
| 321 |
|
| 322 |
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ |
| 323 |
#if !SKIP_Oct6100PhasingTsstOpenSer |
| 324 |
UINT32 Oct6100PhasingTsstOpenSer( |
| 325 |
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, |
| 326 |
IN OUT tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen ) |
| 327 |
{ |
| 328 |
UINT16 usPhasingIndex; |
| 329 |
UINT16 usTsstIndex; |
| 330 |
UINT32 ulResult; |
| 331 |
|
| 332 |
/* Check the user's configuration of the phasing TSST for errors. */ |
| 333 |
ulResult = Oct6100ApiCheckPhasingParams( f_pApiInstance, f_pPhasingTsstOpen ); |
| 334 |
if ( ulResult != cOCT6100_ERR_OK ) |
| 335 |
return ulResult; |
| 336 |
|
| 337 |
/* Reserve all resources needed by the phasing TSST. */ |
| 338 |
ulResult = Oct6100ApiReservePhasingResources( f_pApiInstance, f_pPhasingTsstOpen, &usPhasingIndex, &usTsstIndex ); |
| 339 |
if ( ulResult != cOCT6100_ERR_OK ) |
| 340 |
return ulResult; |
| 341 |
|
| 342 |
/* Write all necessary structures to activate the phasing TSST. */ |
| 343 |
ulResult = Oct6100ApiWritePhasingStructs( f_pApiInstance, f_pPhasingTsstOpen, usPhasingIndex, usTsstIndex ); |
| 344 |
if ( ulResult != cOCT6100_ERR_OK ) |
| 345 |
return ulResult; |
| 346 |
|
| 347 |
/* Update the new phasing TSST entry in the API list. */ |
| 348 |
ulResult = Oct6100ApiUpdatePhasingEntry( f_pApiInstance, f_pPhasingTsstOpen, usPhasingIndex, usTsstIndex ); |
| 349 |
if ( ulResult != cOCT6100_ERR_OK ) |
| 350 |
return ulResult; |
| 351 |
|
| 352 |
return cOCT6100_ERR_OK; |
| 353 |
} |
| 354 |
#endif |
| 355 |
|
| 356 |
|
| 357 |
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ |
| 358 |
|
| 359 |
Function: Oct6100ApiCheckPhasingParams |
| 360 |
|
| 361 |
Description: Checks the user's phasing TSST open configuration for errors. |
| 362 |
|
| 363 |
------------------------------------------------------------------------------- |
| 364 |
| Argument | Description |
| 365 |
------------------------------------------------------------------------------- |
| 366 |
f_pApiInstance Pointer to API instance. This memory is used to keep the |
| 367 |
present state of the chip and all its resources. |
| 368 |
|
| 369 |
f_pPhasingTsstOpen Pointer to phasing TSST open configuration structure. |
| 370 |
|
| 371 |
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ |
| 372 |
#if !SKIP_Oct6100ApiCheckPhasingParams |
| 373 |
UINT32 Oct6100ApiCheckPhasingParams( |
| 374 |
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, |
| 375 |
IN tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen ) |
| 376 |
{ |
| 377 |
UINT32 ulResult; |
| 378 |
|
| 379 |
/* Check for errors. */ |
| 380 |
if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxPhasingTssts == 0 ) |
| 381 |
return cOCT6100_ERR_PHASING_TSST_DISABLED; |
| 382 |
|
| 383 |
if ( f_pPhasingTsstOpen->pulPhasingTsstHndl == NULL ) |
| 384 |
return cOCT6100_ERR_PHASING_TSST_INVALID_HANDLE; |
| 385 |
|
| 386 |
/* Check the phasing length. */ |
| 387 |
if ( f_pPhasingTsstOpen->ulPhasingLength > 240 || |
| 388 |
f_pPhasingTsstOpen->ulPhasingLength < 2 ) |
| 389 |
return cOCT6100_ERR_PHASING_TSST_PHASING_LENGTH; |
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
/* Check the input TDM streams, timeslots component for errors. */ |
| 394 |
ulResult = Oct6100ApiValidateTsst( f_pApiInstance, |
| 395 |
cOCT6100_NUMBER_TSSTS_1, |
| 396 |
f_pPhasingTsstOpen->ulTimeslot, |
| 397 |
f_pPhasingTsstOpen->ulStream, |
| 398 |
cOCT6100_INPUT_TSST ); |
| 399 |
if ( ulResult != cOCT6100_ERR_OK ) |
| 400 |
{ |
| 401 |
if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) |
| 402 |
{ |
| 403 |
return cOCT6100_ERR_PHASING_TSST_TIMESLOT; |
| 404 |
} |
| 405 |
else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) |
| 406 |
{ |
| 407 |
return cOCT6100_ERR_PHASING_TSST_STREAM; |
| 408 |
} |
| 409 |
else |
| 410 |
{ |
| 411 |
return ulResult; |
| 412 |
} |
| 413 |
} |
| 414 |
|
| 415 |
return cOCT6100_ERR_OK; |
| 416 |
} |
| 417 |
#endif |
| 418 |
|
| 419 |
|
| 420 |
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ |
| 421 |
|
| 422 |
Function: Oct6100ApiReservePhasingResources |
| 423 |
|
| 424 |
Description: Reserves all resources needed for the new phasing TSST. |
| 425 |
|
| 426 |
------------------------------------------------------------------------------- |
| 427 |
| Argument | Description |
| 428 |
------------------------------------------------------------------------------- |
| 429 |
f_pApiInstance Pointer to API instance. This memory is used to keep the |
| 430 |
present state of the chip and all its resources. |
| 431 |
|
| 432 |
f_pPhasingTsstOpen Pointer to phasing TSST configuration structure. |
| 433 |
f_pusPhasingIndex Allocated entry in Phasing TSST API list. |
| 434 |
f_pusTsstIndex TSST memory index of the counter. |
| 435 |
|
| 436 |
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ |
| 437 |
#if !SKIP_Oct6100ApiReservePhasingResources |
| 438 |
UINT32 Oct6100ApiReservePhasingResources( |
| 439 |
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, |
| 440 |
IN tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen, |
| 441 |
OUT PUINT16 f_pusPhasingIndex, |
| 442 |
OUT PUINT16 f_pusTsstIndex ) |
| 443 |
{ |
| 444 |
tPOCT6100_SHARED_INFO pSharedInfo; |
| 445 |
UINT32 ulResult; |
| 446 |
UINT32 ulTempVar; |
| 447 |
|
| 448 |
/* Obtain local pointer to shared portion of instance. */ |
| 449 |
pSharedInfo = f_pApiInstance->pSharedInfo; |
| 450 |
|
| 451 |
/* Reserve an entry in the phasing TSST list. */ |
| 452 |
ulResult = Oct6100ApiReservePhasingEntry( f_pApiInstance, |
| 453 |
f_pusPhasingIndex ); |
| 454 |
if ( ulResult == cOCT6100_ERR_OK ) |
| 455 |
{ |
| 456 |
/* Reserve the input TSST entry. */ |
| 457 |
ulResult = Oct6100ApiReserveTsst( f_pApiInstance, |
| 458 |
f_pPhasingTsstOpen->ulTimeslot, |
| 459 |
f_pPhasingTsstOpen->ulStream, |
| 460 |
cOCT6100_NUMBER_TSSTS_1, |
| 461 |
cOCT6100_INPUT_TSST, |
| 462 |
f_pusTsstIndex, |
| 463 |
NULL ); |
| 464 |
if ( ulResult != cOCT6100_ERR_OK ) |
| 465 |
{ |
| 466 |
/* Release the previously reserved entries. */ |
| 467 |
ulTempVar = Oct6100ApiReleasePhasingEntry( f_pApiInstance, *f_pusPhasingIndex ); |
| 468 |
if ( ulTempVar != cOCT6100_ERR_OK ) |
| 469 |
return ulTempVar; |
| 470 |
|
| 471 |
return ulResult; |
| 472 |
} |
| 473 |
} |
| 474 |
else |
| 475 |
{ |
| 476 |
return ulResult; |
| 477 |
} |
| 478 |
|
| 479 |
return cOCT6100_ERR_OK; |
| 480 |
} |
| 481 |
#endif |
| 482 |
|
| 483 |
|
| 484 |
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ |
| 485 |
|
| 486 |
Function: Oct6100ApiWritePhasingStructs |
| 487 |
|
| 488 |
Description: Performs all the required structure writes to configure the |
| 489 |
new phasing TSST. |
| 490 |
|
| 491 |
------------------------------------------------------------------------------- |
| 492 |
| Argument | Description |
| 493 |
------------------------------------------------------------------------------- |
| 494 |
f_pApiInstance Pointer to API instance. This memory is used to keep the |
| 495 |
present state of the chip and all its resources. |
| 496 |
|
| 497 |
f_pPhasingTsstOpen Pointer to phasing TSST configuration structure. |
| 498 |
f_usPhasingIndex Allocated entry in phasing TSST API list. |
| 499 |
f_usTsstIndex TSST memory index of the counter. |
| 500 |
|
| 501 |
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ |
| 502 |
#if !SKIP_Oct6100ApiWritePhasingStructs |
| 503 |
UINT32 Oct6100ApiWritePhasingStructs( |
| 504 |
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, |
| 505 |
IN tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen, |
| 506 |
IN UINT16 f_usPhasingIndex, |
| 507 |
IN UINT16 f_usTsstIndex ) |
| 508 |
{ |
| 509 |
tPOCT6100_SHARED_INFO pSharedInfo; |
| 510 |
tOCT6100_WRITE_PARAMS WriteParams; |
| 511 |
UINT32 ulPhasingTsstChariotMemIndex; |
| 512 |
UINT32 ulResult; |
| 513 |
|
| 514 |
/* Obtain local pointer to shared portion of instance. */ |
| 515 |
pSharedInfo = f_pApiInstance->pSharedInfo; |
| 516 |
|
| 517 |
WriteParams.pProcessContext = f_pApiInstance->pProcessContext; |
| 518 |
|
| 519 |
WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; |
| 520 |
|
| 521 |
/*------------------------------------------------------------------------------*/ |
| 522 |
/* Configure the TSST control memory of the phasing TSST. */ |
| 523 |
|
| 524 |
/* Find the asociated entry in the chariot memory for the phasing TSST. */ |
| 525 |
ulPhasingTsstChariotMemIndex = cOCT6100_TSST_CONTROL_PHASING_TSST_BASE_ENTRY + f_usPhasingIndex; |
| 526 |
|
| 527 |
WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( f_usTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); |
| 528 |
|
| 529 |
WriteParams.usWriteData = cOCT6100_TSST_CONTROL_MEM_INPUT_TSST; |
| 530 |
WriteParams.usWriteData |= ulPhasingTsstChariotMemIndex & cOCT6100_TSST_CONTROL_MEM_TSI_MEM_MASK; |
| 531 |
mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); |
| 532 |
if ( ulResult != cOCT6100_ERR_OK ) |
| 533 |
return ulResult; |
| 534 |
|
| 535 |
/*------------------------------------------------------------------------------*/ |
| 536 |
|
| 537 |
/*------------------------------------------------------------------------------*/ |
| 538 |
/* Write the phasing length of the TSST in the ADPCM / MIXER memory. */ |
| 539 |
|
| 540 |
WriteParams.ulWriteAddress = cOCT6100_CONVERSION_CONTROL_PHASE_SIZE_BASE_ADD + ( f_usPhasingIndex * 2 ); |
| 541 |
WriteParams.usWriteData = (UINT16)( f_pPhasingTsstOpen->ulPhasingLength ); |
| 542 |
|
| 543 |
mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); |
| 544 |
if ( ulResult != cOCT6100_ERR_OK ) |
| 545 |
return ulResult; |
| 546 |
|
| 547 |
/*------------------------------------------------------------------------------*/ |
| 548 |
|
| 549 |
return cOCT6100_ERR_OK; |
| 550 |
} |
| 551 |
#endif |
| 552 |
|
| 553 |
|
| 554 |
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ |
| 555 |
|
| 556 |
Function: Oct6100ApiUpdatePhasingEntry |
| 557 |
|
| 558 |
Description: Updates the new phasing TSST in the API phasing TSST list. |
| 559 |
|
| 560 |
------------------------------------------------------------------------------- |
| 561 |
| Argument | Description |
| 562 |
------------------------------------------------------------------------------- |
| 563 |
f_pApiInstance Pointer to API instance. This memory is used to keep |
| 564 |
the present state of the chip and all its resources. |
| 565 |
|
| 566 |
f_pPhasingTsstOpen Pointer to phasing TSST open structure. |
| 567 |
f_usPhasingIndex Allocated entry in phasing TSST API list. |
| 568 |
f_usTsstIndex TSST memory index of the counter. |
| 569 |
|
| 570 |
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ |
| 571 |
#if !SKIP_Oct6100ApiUpdatePhasingEntry |
| 572 |
UINT32 Oct6100ApiUpdatePhasingEntry( |
| 573 |
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, |
| 574 |
IN OUT tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen, |
| 575 |
IN UINT16 f_usPhasingIndex, |
| 576 |
IN UINT16 f_usTsstIndex ) |
| 577 |
{ |
| 578 |
tPOCT6100_API_PHASING_TSST pPhasingTsstEntry; |
| 579 |
|
| 580 |
/*================================================================================*/ |
| 581 |
/* Obtain a pointer to the new buffer's list entry. */ |
| 582 |
mOCT6100_GET_PHASING_TSST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pPhasingTsstEntry, f_usPhasingIndex ) |
| 583 |
|
| 584 |
/* Copy the phasing TSST's configuration and allocated resources. */ |
| 585 |
pPhasingTsstEntry->usTimeslot = (UINT16)( f_pPhasingTsstOpen->ulTimeslot & 0xFFFF ); |
| 586 |
pPhasingTsstEntry->usStream = (UINT16)( f_pPhasingTsstOpen->ulStream & 0xFFFF ); |
| 587 |
|
| 588 |
pPhasingTsstEntry->usPhasingLength = (UINT16)( f_pPhasingTsstOpen->ulPhasingLength & 0xFFFF ); |
| 589 |
|
| 590 |
/* Store hardware related information. */ |
| 591 |
pPhasingTsstEntry->usPhasingTsstIndex = f_usTsstIndex; |
| 592 |
|
| 593 |
/* Form handle returned to user. */ |
| 594 |
*f_pPhasingTsstOpen->pulPhasingTsstHndl = cOCT6100_HNDL_TAG_PHASING_TSST | (pPhasingTsstEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_usPhasingIndex; |
| 595 |
pPhasingTsstEntry->usDependencyCnt = 0; /* Nobody is using the phasing TSST.*/ |
| 596 |
|
| 597 |
/* Finally, mark the phasing TSST as open. */ |
| 598 |
pPhasingTsstEntry->fReserved = TRUE; |
| 599 |
|
| 600 |
/* Increment the number of phasing TSSTs opened. */ |
| 601 |
f_pApiInstance->pSharedInfo->ChipStats.usNumberPhasingTssts++; |
| 602 |
|
| 603 |
/*================================================================================*/ |
| 604 |
|
| 605 |
return cOCT6100_ERR_OK; |
| 606 |
} |
| 607 |
#endif |
| 608 |
|
| 609 |
|
| 610 |
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ |
| 611 |
|
| 612 |
Function: Oct6100PhasingTsstCloseSer |
| 613 |
|
| 614 |
Description: Closes a phasing TSST. |
| 615 |
|
| 616 |
------------------------------------------------------------------------------- |
| 617 |
| Argument | Description |
| 618 |
------------------------------------------------------------------------------- |
| 619 |
f_pApiInstance Pointer to API instance. This memory is used to keep the |
| 620 |
present state of the chip and all its resources. |
| 621 |
|
| 622 |
f_pPhasingTsstClose Pointer to phasing TSST close structure. |
| 623 |
|
| 624 |
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ |
| 625 |
#if !SKIP_Oct6100PhasingTsstCloseSer |
| 626 |
UINT32 Oct6100PhasingTsstCloseSer( |
| 627 |
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, |
| 628 |
IN OUT tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose ) |
| 629 |
{ |
| 630 |
UINT16 usPhasingIndex; |
| 631 |
UINT16 usTsstIndex; |
| 632 |
UINT32 ulResult; |
| 633 |
|
| 634 |
/* Verify that all the parameters given match the state of the API. */ |
| 635 |
ulResult = Oct6100ApiAssertPhasingParams( f_pApiInstance, f_pPhasingTsstClose, &usPhasingIndex, &usTsstIndex ); |
| 636 |
if ( ulResult != cOCT6100_ERR_OK ) |
| 637 |
return ulResult; |
| 638 |
|
| 639 |
/* Release all resources associated to the phasing TSST. */ |
| 640 |
ulResult = Oct6100ApiInvalidatePhasingStructs( f_pApiInstance, usTsstIndex ); |
| 641 |
if ( ulResult != cOCT6100_ERR_OK ) |
| 642 |
return ulResult; |
| 643 |
|
| 644 |
/* Release all resources associated to the phasing TSST. */ |
| 645 |
ulResult = Oct6100ApiReleasePhasingResources( f_pApiInstance, usPhasingIndex ); |
| 646 |
if ( ulResult != cOCT6100_ERR_OK ) |
| 647 |
return ulResult; |
| 648 |
|
| 649 |
f_pPhasingTsstClose->ulPhasingTsstHndl = cOCT6100_INVALID_VALUE; |
| 650 |
|
| 651 |
return cOCT6100_ERR_OK; |
| 652 |
} |
| 653 |
#endif |
| 654 |
|
| 655 |
|
| 656 |
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ |
| 657 |
|
| 658 |
Function: Oct6100ApiAssertPhasingParams |
| 659 |
|
| 660 |
Description: Validate the handle given by the user and verify the state of |
| 661 |
the phasing TSST about to be closed. Also returns all |
| 662 |
required information to deactivate the phasing TSST. |
| 663 |
|
| 664 |
------------------------------------------------------------------------------- |
| 665 |
| Argument | Description |
| 666 |
------------------------------------------------------------------------------- |
| 667 |
f_pApiInstance Pointer to API instance. This memory is used to keep the |
| 668 |
present state of the chip and all its resources. |
| 669 |
|
| 670 |
f_pPhasingTsstClose Pointer to phasing TSST close structure. |
| 671 |
f_pusPhasingIndex Index of the phasing TSST structure in the API list. |
| 672 |
f_pusTsstIndex Index of the entry in the TSST control memory. |
| 673 |
|
| 674 |
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ |
| 675 |
#if !SKIP_Oct6100ApiAssertPhasingParams |
| 676 |
UINT32 Oct6100ApiAssertPhasingParams( |
| 677 |
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, |
| 678 |
IN tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose, |
| 679 |
OUT PUINT16 f_pusPhasingIndex, |
| 680 |
OUT PUINT16 f_pusTsstIndex ) |
| 681 |
{ |
| 682 |
tPOCT6100_SHARED_INFO pSharedInfo; |
| 683 |
tPOCT6100_API_PHASING_TSST pPhasingEntry; |
| 684 |
UINT32 ulEntryOpenCnt; |
| 685 |
|
| 686 |
/* Get local pointer(s). */ |
| 687 |
pSharedInfo = f_pApiInstance->pSharedInfo; |
| 688 |
|
| 689 |
/* Check the provided handle. */ |
| 690 |
if ( (f_pPhasingTsstClose->ulPhasingTsstHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_PHASING_TSST ) |
| 691 |
return cOCT6100_ERR_PHASING_TSST_INVALID_HANDLE; |
| 692 |
|
| 693 |
*f_pusPhasingIndex = (UINT16)( f_pPhasingTsstClose->ulPhasingTsstHndl & cOCT6100_HNDL_INDEX_MASK ); |
| 694 |
if ( *f_pusPhasingIndex >= pSharedInfo->ChipConfig.usMaxPhasingTssts ) |
| 695 |
return cOCT6100_ERR_PHASING_TSST_INVALID_HANDLE; |
| 696 |
|
| 697 |
/*=======================================================================*/ |
| 698 |
/* Get a pointer to the phasing TSST's list entry. */ |
| 699 |
|
| 700 |
mOCT6100_GET_PHASING_TSST_ENTRY_PNT( pSharedInfo, pPhasingEntry, *f_pusPhasingIndex ) |
| 701 |
|
| 702 |
/* Extract the entry open count from the provided handle. */ |
| 703 |
ulEntryOpenCnt = (f_pPhasingTsstClose->ulPhasingTsstHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; |
| 704 |
|
| 705 |
/* Check for errors. */ |
| 706 |
if ( pPhasingEntry->fReserved != TRUE ) |
| 707 |
return cOCT6100_ERR_PHASING_TSST_NOT_OPEN; |
| 708 |
if ( pPhasingEntry->usDependencyCnt != 0 ) |
| 709 |
return cOCT6100_ERR_PHASING_TSST_ACTIVE_DEPENDENCIES; |
| 710 |
if ( ulEntryOpenCnt != pPhasingEntry->byEntryOpenCnt ) |
| 711 |
return cOCT6100_ERR_PHASING_TSST_INVALID_HANDLE; |
| 712 |
|
| 713 |
/* Return info needed to close the phasing TSST and release all resources. */ |
| 714 |
*f_pusTsstIndex = pPhasingEntry->usPhasingTsstIndex; |
| 715 |
|
| 716 |
/*=======================================================================*/ |
| 717 |
|
| 718 |
return cOCT6100_ERR_OK; |
| 719 |
} |
| 720 |
#endif |
| 721 |
|
| 722 |
|
| 723 |
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ |
| 724 |
|
| 725 |
Function: Oct6100ApiInvalidatePhasingStructs |
| 726 |
|
| 727 |
Description: Closes a phasing TSST. |
| 728 |
|
| 729 |
------------------------------------------------------------------------------- |
| 730 |
| Argument | Description |
| 731 |
------------------------------------------------------------------------------- |
| 732 |
f_pApiInstance Pointer to API instance. This memory is used to keep the |
| 733 |
present state of the chip and all its resources. |
| 734 |
|
| 735 |
f_usTsstIndex Index of the entry in the TSST control memory. |
| 736 |
|
| 737 |
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ |
| 738 |
#if !SKIP_Oct6100ApiInvalidatePhasingStructs |
| 739 |
UINT32 Oct6100ApiInvalidatePhasingStructs( |
| 740 |
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, |
| 741 |
IN UINT16 f_usTsstIndex ) |
| 742 |
{ |
| 743 |
tPOCT6100_SHARED_INFO pSharedInfo; |
| 744 |
tOCT6100_WRITE_PARAMS WriteParams; |
| 745 |
UINT32 ulResult; |
| 746 |
|
| 747 |
/* Obtain local pointer to shared portion of instance. */ |
| 748 |
pSharedInfo = f_pApiInstance->pSharedInfo; |
| 749 |
|
| 750 |
WriteParams.pProcessContext = f_pApiInstance->pProcessContext; |
| 751 |
|
| 752 |
WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; |
| 753 |
|
| 754 |
/*------------------------------------------------------------------------------*/ |
| 755 |
/* Deactivate the TSST control memory. */ |
| 756 |
|
| 757 |
/* Set the input TSST control entry to unused. */ |
| 758 |
WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( f_usTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); |
| 759 |
|
| 760 |
WriteParams.usWriteData = 0x0000; |
| 761 |
mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); |
| 762 |
if ( ulResult != cOCT6100_ERR_OK ) |
| 763 |
return ulResult; |
| 764 |
|
| 765 |
/*------------------------------------------------------------------------------*/ |
| 766 |
|
| 767 |
return cOCT6100_ERR_OK; |
| 768 |
} |
| 769 |
#endif |
| 770 |
|
| 771 |
|
| 772 |
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ |
| 773 |
|
| 774 |
Function: Oct6100ApiReleasePhasingResources |
| 775 |
|
| 776 |
Description: Release and clear the API entry associated to the phasing TSST. |
| 777 |
|
| 778 |
------------------------------------------------------------------------------- |
| 779 |
| Argument | Description |
| 780 |
------------------------------------------------------------------------------- |
| 781 |
f_pApiInstance Pointer to API instance. This memory is used to keep the |
| 782 |
present state of the chip and all its resources. |
| 783 |
|
| 784 |
f_usPhasingIndex Index of the phasing TSST in the API list. |
| 785 |
|
| 786 |
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ |
| 787 |
#if !SKIP_Oct6100ApiReleasePhasingResources |
| 788 |
UINT32 Oct6100ApiReleasePhasingResources( |
| 789 |
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, |
| 790 |
IN UINT16 f_usPhasingIndex ) |
| 791 |
{ |
| 792 |
tPOCT6100_SHARED_INFO pSharedInfo; |
| 793 |
tPOCT6100_API_PHASING_TSST pPhasingEntry; |
| 794 |
UINT32 ulResult; |
| 795 |
|
| 796 |
/* Obtain local pointer to shared portion of instance. */ |
| 797 |
pSharedInfo = f_pApiInstance->pSharedInfo; |
| 798 |
|
| 799 |
mOCT6100_GET_PHASING_TSST_ENTRY_PNT( pSharedInfo, pPhasingEntry, f_usPhasingIndex ); |
| 800 |
|
| 801 |
/* Release the entry in the phasing TSST list. */ |
| 802 |
ulResult = Oct6100ApiReleasePhasingEntry( f_pApiInstance, f_usPhasingIndex ); |
| 803 |
if ( ulResult == cOCT6100_ERR_OK ) |
| 804 |
{ |
| 805 |
/* Release the entry. */ |
| 806 |
ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, |
| 807 |
pPhasingEntry->usTimeslot, |
| 808 |
pPhasingEntry->usStream, |
| 809 |
cOCT6100_NUMBER_TSSTS_1, |
| 810 |
cOCT6100_INPUT_TSST, |
| 811 |
cOCT6100_INVALID_INDEX ); /* Release the TSST entry */ |
| 812 |
if ( ulResult != cOCT6100_ERR_OK ) |
| 813 |
{ |
| 814 |
return cOCT6100_ERR_FATAL; |
| 815 |
} |
| 816 |
} |
| 817 |
else |
| 818 |
{ |
| 819 |
return ulResult; |
| 820 |
} |
| 821 |
|
| 822 |
/*=============================================================*/ |
| 823 |
/* Update the phasing TSST's list entry. */ |
| 824 |
|
| 825 |
/* Mark the entry as closed. */ |
| 826 |
pPhasingEntry->fReserved = FALSE; |
| 827 |
pPhasingEntry->byEntryOpenCnt++; |
| 828 |
|
| 829 |
/* Decrement the number of phasing TSSTs opened. */ |
| 830 |
f_pApiInstance->pSharedInfo->ChipStats.usNumberPhasingTssts--; |
| 831 |
|
| 832 |
/*=============================================================*/ |
| 833 |
|
| 834 |
return cOCT6100_ERR_OK; |
| 835 |
} |
| 836 |
#endif |
| 837 |
|
| 838 |
|
| 839 |
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ |
| 840 |
|
| 841 |
Function: Oct6100ApiReservePhasingEntry |
| 842 |
|
| 843 |
Description: Reserves a phasing TSST API entry. |
| 844 |
|
| 845 |
------------------------------------------------------------------------------- |
| 846 |
| Argument | Description |
| 847 |
------------------------------------------------------------------------------- |
| 848 |
f_pApiInstance Pointer to API instance. This memory is used to keep |
| 849 |
the present state of the chip and all its resources. |
| 850 |
|
| 851 |
f_pusPhasingIndex Resulting index reserved in the phasing TSST list. |
| 852 |
|
| 853 |
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ |
| 854 |
#if !SKIP_Oct6100ApiReservePhasingEntry |
| 855 |
UINT32 Oct6100ApiReservePhasingEntry( |
| 856 |
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, |
| 857 |
OUT PUINT16 f_pusPhasingIndex ) |
| 858 |
{ |
| 859 |
tPOCT6100_SHARED_INFO pSharedInfo; |
| 860 |
PVOID pPhasingAlloc; |
| 861 |
UINT32 ulResult; |
| 862 |
UINT32 ulPhasingIndex; |
| 863 |
|
| 864 |
/* Get local pointer to shared portion of instance. */ |
| 865 |
pSharedInfo = f_pApiInstance->pSharedInfo; |
| 866 |
|
| 867 |
mOCT6100_GET_PHASING_TSST_ALLOC_PNT( pSharedInfo, pPhasingAlloc ) |
| 868 |
|
| 869 |
ulResult = OctapiLlmAllocAlloc( pPhasingAlloc, &ulPhasingIndex ); |
| 870 |
if ( ulResult != cOCT6100_ERR_OK ) |
| 871 |
{ |
| 872 |
if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) |
| 873 |
return cOCT6100_ERR_PHASING_TSST_ALL_ENTRIES_ARE_OPENED; |
| 874 |
else |
| 875 |
return cOCT6100_ERR_FATAL_3A; |
| 876 |
} |
| 877 |
|
| 878 |
*f_pusPhasingIndex = (UINT16)( ulPhasingIndex & 0xFFFF ); |
| 879 |
|
| 880 |
return cOCT6100_ERR_OK; |
| 881 |
} |
| 882 |
#endif |
| 883 |
|
| 884 |
|
| 885 |
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ |
| 886 |
|
| 887 |
Function: Oct6100ApiReleasePhasingEntry |
| 888 |
|
| 889 |
Description: Releases the specified phasing TSST API entry. |
| 890 |
|
| 891 |
------------------------------------------------------------------------------- |
| 892 |
| Argument | Description |
| 893 |
------------------------------------------------------------------------------- |
| 894 |
f_pApiInstance Pointer to API instance. This memory is used to keep |
| 895 |
the present state of the chip and all its resources. |
| 896 |
|
| 897 |
f_usPhasingIndex Index reserved in the phasing TSST API list. |
| 898 |
|
| 899 |
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ |
| 900 |
#if !SKIP_Oct6100ApiReleasePhasingEntry |
| 901 |
UINT32 Oct6100ApiReleasePhasingEntry( |
| 902 |
IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, |
| 903 |
IN UINT16 f_usPhasingIndex ) |
| 904 |
{ |
| 905 |
tPOCT6100_SHARED_INFO pSharedInfo; |
| 906 |
PVOID pPhasingAlloc; |
| 907 |
UINT32 ulResult; |
| 908 |
|
| 909 |
/* Get local pointer to shared portion of instance. */ |
| 910 |
pSharedInfo = f_pApiInstance->pSharedInfo; |
| 911 |
|
| 912 |
mOCT6100_GET_PHASING_TSST_ALLOC_PNT( pSharedInfo, pPhasingAlloc ) |
| 913 |
|
| 914 |
ulResult = OctapiLlmAllocDealloc( pPhasingAlloc, f_usPhasingIndex ); |
| 915 |
if ( ulResult != cOCT6100_ERR_OK ) |
| 916 |
{ |
| 917 |
return cOCT6100_ERR_FATAL_3B; |
| 918 |
} |
| 919 |
|
| 920 |
return cOCT6100_ERR_OK; |
| 921 |
} |
| 922 |
#endif |