diff options
author | Shaun Ruffell <sruffell@digium.com> | 2014-09-03 17:35:52 +0000 |
---|---|---|
committer | Shaun Ruffell <sruffell@digium.com> | 2014-09-03 17:35:52 +0000 |
commit | 19e5621b53930e912b17d4a81e943ee6cf49f9ad (patch) | |
tree | 40a5a2294c4deb8baa63111402a3ac703a8b2602 /drivers/dahdi/oct612x/octdeviceapi/oct6100api | |
parent | 9df2805ef9a14d731fcaa1325b6b1054c1f2c101 (diff) |
Point people to where active development is taking placesvn_trunk
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@10748 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'drivers/dahdi/oct612x/octdeviceapi/oct6100api')
39 files changed, 0 insertions, 52620 deletions
diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_adpcm_chan_priv.h b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_adpcm_chan_priv.h deleted file mode 100644 index a078070..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_adpcm_chan_priv.h +++ /dev/null @@ -1,131 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_adpcm_chan_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_adpcm_chan.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_adpcm_chan_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 7 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_ADPCM_CHAN_PRIV_H__ -#define __OCT6100_ADPCM_CHAN_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - -/***************************** DEFINES *************************************/ - -/* ADPCM channel list pointer macros. */ -#define mOCT6100_GET_ADPCM_CHAN_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_ADPCM_CHAN )(( PUINT8 )pSharedInfo + pSharedInfo->ulAdpcmChanListOfst ); - -#define mOCT6100_GET_ADPCM_CHAN_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_ADPCM_CHAN )(( PUINT8 )pSharedInfo + pSharedInfo->ulAdpcmChanListOfst)) + ulIndex; - -#define mOCT6100_GET_ADPCM_CHAN_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulAdpcmChanAllocOfst); - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetAdpcmChanSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100ApiAdpcmChanSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - - -UINT32 Oct6100AdpcmChanOpenSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen ); - -UINT32 Oct6100ApiCheckAdpcmChanParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen ); - -UINT32 Oct6100ApiReserveAdpcmChanResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen, - OUT PUINT16 f_pusTsiChanIndex, - OUT PUINT16 f_pusAdpcmMemIndex, - OUT PUINT16 f_pusTsiMemIndex, - OUT PUINT16 f_pusInputTsstIndex, - OUT PUINT16 f_pusOutputTsstIndex ); - -UINT32 Oct6100ApiWriteAdpcmChanStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen, - IN UINT16 f_usAdpcmMemIndex, - IN UINT16 f_usTsiMemIndex, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ); - -UINT32 Oct6100ApiUpdateAdpcmChanEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen, - IN UINT16 f_usTsiChanIndex, - IN UINT16 f_usAdpcmMemIndex, - IN UINT16 f_usTsiMemIndex, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ); - -UINT32 Oct6100AdpcmChanCloseSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_ADPCM_CHAN_CLOSE f_pAdpcmChanClose ); - -UINT32 Oct6100ApiAssertAdpcmChanParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_ADPCM_CHAN_CLOSE f_pAdpcmChanClose, - OUT PUINT16 f_pusTsiChanIndex, - OUT PUINT16 f_pusAdpcmMemIndex, - OUT PUINT16 f_pusTsiMemIndex, - OUT PUINT16 f_pusInputTsstIndex, - OUT PUINT16 f_pusOutputTsstIndex ); - -UINT32 Oct6100ApiInvalidateAdpcmChanStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usAdpcmChanIndex, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ); - -UINT32 Oct6100ApiReleaseAdpcmChanResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsiChanIndex, - IN UINT16 f_usAdpcmMemIndex, - IN UINT16 f_usTsiMemIndex ); - -UINT32 Oct6100ApiReserveAdpcmChanEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusAdpcmChanIndex ); - -UINT32 Oct6100ApiReleaseAdpcmChanEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usAdpcmChanIndex ); - -#endif /* __OCT6100_ADPCM_CHAN_PRIV_H__ */ diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.c b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.c deleted file mode 100644 index aec4c5e..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_adpcm_chan.c +++ /dev/null @@ -1,1237 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_adpcm_chan.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains functions used to open and close ADPCM channels. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 16 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_channel_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_adpcm_chan_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_adpcm_chan_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_memory_priv.h" -#include "oct6100_tsst_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_adpcm_chan_priv.h" - -/**************************** PUBLIC FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100AdpcmChanOpen - -Description: This function opens an ADPCM channel between two TDM timeslots. - This channel will perform ADPCM compression or decompression - depending on the channel mode. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pAdpcmChanOpen Pointer to ADPCM channel open structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100AdpcmChanOpenDef -UINT32 Oct6100AdpcmChanOpenDef( - tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen ) -{ - f_pAdpcmChanOpen->pulChanHndl = NULL; - - f_pAdpcmChanOpen->ulInputTimeslot = cOCT6100_INVALID_TIMESLOT; - f_pAdpcmChanOpen->ulInputStream = cOCT6100_INVALID_STREAM; - f_pAdpcmChanOpen->ulInputNumTssts = 1; - f_pAdpcmChanOpen->ulInputPcmLaw = cOCT6100_PCM_U_LAW; - - f_pAdpcmChanOpen->ulOutputTimeslot = cOCT6100_INVALID_TIMESLOT; - f_pAdpcmChanOpen->ulOutputStream = cOCT6100_INVALID_STREAM; - f_pAdpcmChanOpen->ulOutputPcmLaw = cOCT6100_PCM_U_LAW; - f_pAdpcmChanOpen->ulOutputNumTssts = 1; - - f_pAdpcmChanOpen->ulChanMode = cOCT6100_ADPCM_ENCODING; - f_pAdpcmChanOpen->ulEncodingRate = cOCT6100_G726_32KBPS; - f_pAdpcmChanOpen->ulDecodingRate = cOCT6100_G726_32KBPS; - - f_pAdpcmChanOpen->ulAdpcmNibblePosition = cOCT6100_ADPCM_IN_LOW_BITS; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100AdpcmChanOpen -UINT32 Oct6100AdpcmChanOpen( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100AdpcmChanOpenSer( f_pApiInstance, f_pAdpcmChanOpen ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100AdpcmChanClose - -Description: This function closes an opened ADPCM channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pAdpcmChanClose Pointer to ADPCM channel close structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100AdpcmChanCloseDef -UINT32 Oct6100AdpcmChanCloseDef( - tPOCT6100_ADPCM_CHAN_CLOSE f_pAdpcmChanClose ) -{ - f_pAdpcmChanClose->ulChanHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100AdpcmChanClose -UINT32 Oct6100AdpcmChanClose( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_ADPCM_CHAN_CLOSE f_pAdpcmChanClose ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100AdpcmChanCloseSer( f_pApiInstance, f_pAdpcmChanClose ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetAdpcmChanSwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management of the ADPCM memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pOpenChip Pointer to chip configuration struct. -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetAdpcmChanSwSizes -UINT32 Oct6100ApiGetAdpcmChanSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulTempVar; - UINT32 ulResult; - - /* Determine the amount of memory required for the API ADPCM channel list.*/ - f_pInstSizes->ulAdpcmChannelList = f_pOpenChip->ulMaxAdpcmChannels * sizeof( tOCT6100_API_ADPCM_CHAN ); - - if ( f_pOpenChip->ulMaxAdpcmChannels > 0 ) - { - /* Calculate memory needed for ADPCM memory allocation */ - ulResult = OctapiLlmAllocGetSize( f_pOpenChip->ulMaxAdpcmChannels, &f_pInstSizes->ulAdpcmChannelAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_48; - } - else - { - f_pInstSizes->ulAdpcmChannelAlloc = 0; - } - - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulAdpcmChannelList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulAdpcmChannelAlloc, ulTempVar ) - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAdpcmChanSwInit - -Description: Initializes all elements of the instance structure associated - to the ADPCM memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAdpcmChanSwInit -UINT32 Oct6100ApiAdpcmChanSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_API_ADPCM_CHAN pChannelsTsiList; - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulMaxAdpcmChannels; - PVOID pAdpcmChannelsAlloc; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Initialize the ADPCM channel API list.*/ - ulMaxAdpcmChannels = pSharedInfo->ChipConfig.usMaxAdpcmChannels; - - /* Set all entries in the ADPCM channel list to unused. */ - mOCT6100_GET_ADPCM_CHAN_LIST_PNT( pSharedInfo, pChannelsTsiList ) - - /* Clear the memory */ - Oct6100UserMemSet( pChannelsTsiList, 0x00, sizeof(tOCT6100_API_ADPCM_CHAN) * ulMaxAdpcmChannels ); - - /* Initialize the ADPCM channel allocation structures to "all free". */ - if ( ulMaxAdpcmChannels > 0 ) - { - mOCT6100_GET_ADPCM_CHAN_ALLOC_PNT( pSharedInfo, pAdpcmChannelsAlloc ) - - ulResult = OctapiLlmAllocInit( &pAdpcmChannelsAlloc, ulMaxAdpcmChannels ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_BD; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100AdpcmChanOpenSer - -Description: Opens an ADPCM channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pAdpcmChanOpen Pointer to an ADPCM channel open structure - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100AdpcmChanOpenSer -UINT32 Oct6100AdpcmChanOpenSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen ) -{ - UINT16 usAdpcmChanIndex; - UINT16 usTsiMemIndex; - UINT16 usAdpcmMemIndex; - UINT16 usInputTsstIndex; - UINT16 usOutputTsstIndex; - UINT32 ulResult; - - /* Check the user's configuration of the ADPCM channel open structure for errors. */ - ulResult = Oct6100ApiCheckAdpcmChanParams( f_pApiInstance, f_pAdpcmChanOpen ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reserve all resources needed by the ADPCM channel. */ - ulResult = Oct6100ApiReserveAdpcmChanResources( f_pApiInstance, f_pAdpcmChanOpen, &usAdpcmChanIndex, &usAdpcmMemIndex, &usTsiMemIndex, &usInputTsstIndex, &usOutputTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write all necessary structures to activate the ADPCM channel. */ - ulResult = Oct6100ApiWriteAdpcmChanStructs( f_pApiInstance, f_pAdpcmChanOpen, usAdpcmMemIndex, usTsiMemIndex, usInputTsstIndex, usOutputTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the ADPCM channel entry in the API list. */ - ulResult = Oct6100ApiUpdateAdpcmChanEntry( f_pApiInstance, f_pAdpcmChanOpen, usAdpcmChanIndex, usAdpcmMemIndex, usTsiMemIndex, usInputTsstIndex, usOutputTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckAdpcmChanParams - -Description: Checks the user's ADPCM channel open configuration for errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pAdpcmChanOpen Pointer to ADPCM channel open configuration structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckAdpcmChanParams -UINT32 Oct6100ApiCheckAdpcmChanParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen ) -{ - UINT32 ulResult; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxAdpcmChannels == 0 ) - return cOCT6100_ERR_ADPCM_CHAN_DISABLED; - - if ( f_pAdpcmChanOpen->pulChanHndl == NULL ) - return cOCT6100_ERR_ADPCM_CHAN_INVALID_HANDLE; - - /* Check the input TDM streams, timeslots component for errors. */ - if ( f_pAdpcmChanOpen->ulInputNumTssts != 1 && - f_pAdpcmChanOpen->ulInputNumTssts != 2 ) - return cOCT6100_ERR_ADPCM_CHAN_INPUT_NUM_TSSTS; - - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - f_pAdpcmChanOpen->ulInputNumTssts, - f_pAdpcmChanOpen->ulInputTimeslot, - f_pAdpcmChanOpen->ulInputStream, - cOCT6100_INPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_ADPCM_CHAN_INPUT_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_ADPCM_CHAN_INPUT_STREAM; - } - else - { - return ulResult; - } - } - - if( f_pAdpcmChanOpen->ulInputPcmLaw != cOCT6100_PCM_U_LAW && - f_pAdpcmChanOpen->ulInputPcmLaw != cOCT6100_PCM_A_LAW ) - return cOCT6100_ERR_ADPCM_CHAN_INPUT_PCM_LAW; - - /* Check the output TDM streams, timeslots component for errors. */ - if ( f_pAdpcmChanOpen->ulOutputNumTssts != 1 && - f_pAdpcmChanOpen->ulOutputNumTssts != 2 ) - return cOCT6100_ERR_ADPCM_CHAN_OUTPUT_NUM_TSSTS; - - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - f_pAdpcmChanOpen->ulOutputNumTssts, - f_pAdpcmChanOpen->ulOutputTimeslot, - f_pAdpcmChanOpen->ulOutputStream, - cOCT6100_OUTPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_ADPCM_CHAN_OUTPUT_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_ADPCM_CHAN_OUTPUT_STREAM; - } - else - { - return ulResult; - } - } - if( f_pAdpcmChanOpen->ulOutputPcmLaw != cOCT6100_PCM_U_LAW && - f_pAdpcmChanOpen->ulOutputPcmLaw != cOCT6100_PCM_A_LAW ) - return cOCT6100_ERR_ADPCM_CHAN_OUTPUT_PCM_LAW; - - /* Now, check the channel mode. */ - if ( f_pAdpcmChanOpen->ulChanMode != cOCT6100_ADPCM_ENCODING && - f_pAdpcmChanOpen->ulChanMode != cOCT6100_ADPCM_DECODING ) - return cOCT6100_ERR_ADPCM_CHAN_MODE; - - if ( f_pAdpcmChanOpen->ulChanMode == cOCT6100_ADPCM_ENCODING ) - { - /* Check the encoding rate. */ - if ( ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G711_64KBPS ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G726_40KBPS ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G726_32KBPS ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G726_24KBPS ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G726_16KBPS ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G727_40KBPS_4_1 ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G727_40KBPS_3_2 ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G727_40KBPS_2_3 ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G727_32KBPS_4_0 ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G727_32KBPS_3_1 ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G727_32KBPS_2_2 ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G727_24KBPS_3_0 ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G727_24KBPS_2_1 ) && - ( f_pAdpcmChanOpen->ulEncodingRate != cOCT6100_G727_16KBPS_2_0 ) ) - return cOCT6100_ERR_ADPCM_CHAN_ENCODING_RATE; - } - else /* if ( f_pAdpcmChanOpen->ulChanMode != cOCT6100_ADPCM_DECODING ) */ - { - /* Check the decoding rate. */ - if ( f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G711_64KBPS && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G726_40KBPS && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G726_32KBPS && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G726_24KBPS && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G726_16KBPS && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G726_ENCODED && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G711_G726_ENCODED && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G727_2C_ENCODED && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G727_3C_ENCODED && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G727_4C_ENCODED && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G711_G727_2C_ENCODED && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G711_G727_3C_ENCODED && - f_pAdpcmChanOpen->ulDecodingRate != cOCT6100_G711_G727_4C_ENCODED ) - return cOCT6100_ERR_ADPCM_CHAN_DECODING_RATE; - - /* Make sure that two timeslots are allocated if PCM-ECHO encoded is selected. */ - if ( (f_pAdpcmChanOpen->ulDecodingRate == cOCT6100_G711_G726_ENCODED || - f_pAdpcmChanOpen->ulDecodingRate == cOCT6100_G711_G727_2C_ENCODED || - f_pAdpcmChanOpen->ulDecodingRate == cOCT6100_G711_G727_3C_ENCODED || - f_pAdpcmChanOpen->ulDecodingRate == cOCT6100_G711_G727_4C_ENCODED ) && - f_pAdpcmChanOpen->ulInputNumTssts != 2 ) - return cOCT6100_ERR_ADPCM_CHAN_INCOMPATIBLE_NUM_TSSTS; - } - - /* Check the nibble position. */ - if ( f_pAdpcmChanOpen->ulAdpcmNibblePosition != cOCT6100_ADPCM_IN_LOW_BITS && - f_pAdpcmChanOpen->ulAdpcmNibblePosition != cOCT6100_ADPCM_IN_HIGH_BITS ) - return cOCT6100_ERR_ADPCM_CHAN_ADPCM_NIBBLE_POSITION; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveAdpcmChanResources - -Description: Reserves all resources needed for the new ADPCM channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pAdpcmChanOpen Pointer to ADPCM channel configuration structure. -f_pusAdpcmChanIndex Allocated entry in ADPCM channel list. -f_pusAdpcmMemIndex Allocated entry in the ADPCM control memory. -f_pusTsiMemIndex Allocated entry in the TSI chariot memory. -f_pusInputTsstIndex TSST memory index of the input samples. -f_pusOutputTsstIndex TSST memory index of the output samples. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveAdpcmChanResources -UINT32 Oct6100ApiReserveAdpcmChanResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen, - OUT PUINT16 f_pusAdpcmChanIndex, - OUT PUINT16 f_pusAdpcmMemIndex, - OUT PUINT16 f_pusTsiMemIndex, - OUT PUINT16 f_pusInputTsstIndex, - OUT PUINT16 f_pusOutputTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult; - UINT32 ulTempVar; - BOOL fAdpcmChanEntry = FALSE; - BOOL fAdpcmMemEntry = FALSE; - BOOL fTsiMemEntry = FALSE; - BOOL fInputTsst = FALSE; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Reserve an entry in the ADPCM channel list. */ - ulResult = Oct6100ApiReserveAdpcmChanEntry( f_pApiInstance, f_pusAdpcmChanIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fAdpcmChanEntry = TRUE; - - /* Find a TSI memory entry.*/ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, f_pusTsiMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fTsiMemEntry = TRUE; - - /* Find a conversion memory entry. */ - ulResult = Oct6100ApiReserveConversionMemEntry( f_pApiInstance, f_pusAdpcmMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fAdpcmMemEntry = TRUE; - - /* Reserve the input TSST entry. */ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - f_pAdpcmChanOpen->ulInputTimeslot, - f_pAdpcmChanOpen->ulInputStream, - f_pAdpcmChanOpen->ulInputNumTssts, - cOCT6100_INPUT_TSST, - f_pusInputTsstIndex, - NULL ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fInputTsst = TRUE; - - /* Reserve the output TSST entry. */ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - f_pAdpcmChanOpen->ulOutputTimeslot, - f_pAdpcmChanOpen->ulOutputStream, - f_pAdpcmChanOpen->ulOutputNumTssts, - cOCT6100_OUTPUT_TSST, - f_pusOutputTsstIndex, - NULL ); - } - } - } - else - { - /* Return an error other than a fatal error. */ - ulResult = cOCT6100_ERR_ADPCM_CHAN_NO_MORE_TSI_AVAILABLE; - } - } - - if ( ulResult != cOCT6100_ERR_OK ) - { - if( fAdpcmChanEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseAdpcmChanEntry( f_pApiInstance, *f_pusAdpcmChanIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fTsiMemEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, *f_pusTsiMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fAdpcmMemEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseConversionMemEntry( f_pApiInstance, *f_pusAdpcmMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fInputTsst == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsst( f_pApiInstance, - f_pAdpcmChanOpen->ulInputTimeslot, - f_pAdpcmChanOpen->ulInputStream, - f_pAdpcmChanOpen->ulInputNumTssts, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteAdpcmChanStructs - -Description: Performs all the required structure writes to configure the - new ADPCM channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pAdpcmChanOpen Pointer to ADPCM channel configuration structure. -f_pusAdpcmChanIndex Allocated entry in ADPCM channel list. -f_pusAdpcmMemIndex Allocated entry in the ADPCM control memory. -f_pusTsiMemIndex Allocated entry in the TSI chariot memory. -f_pusInputTsstIndex TSST memory index of the input samples. -f_pusOutputTsstIndex TSST memory index of the output samples. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteAdpcmChanStructs -UINT32 Oct6100ApiWriteAdpcmChanStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen, - IN UINT16 f_usAdpcmMemIndex, - IN UINT16 f_usTsiMemIndex, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - UINT32 ulCompType = 0; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*------------------------------------------------------------------------------*/ - /* Configure the TSST control memory. */ - - /* Set the input TSST control entry. */ - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - f_usInputTsstIndex, - f_usTsiMemIndex, - f_pAdpcmChanOpen->ulInputPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the output TSST control entry. */ - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - f_usOutputTsstIndex, - f_pAdpcmChanOpen->ulAdpcmNibblePosition, - f_pAdpcmChanOpen->ulOutputNumTssts, - f_usTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - - - /*------------------------------------------------------------------------------*/ - /* Configure the ADPCM memory. */ - - if ( f_pAdpcmChanOpen->ulChanMode == cOCT6100_ADPCM_ENCODING ) - { - switch( f_pAdpcmChanOpen->ulEncodingRate ) - { - case cOCT6100_G711_64KBPS: - - if ( f_pAdpcmChanOpen->ulOutputPcmLaw == cOCT6100_PCM_U_LAW ) - ulCompType = 0x4; - else /* if ( f_pAdpcmChanOpen->ulOutputPcmLaw != cOCT6100_PCM_U_LAW ) */ - ulCompType = 0x5; - break; - case cOCT6100_G726_40KBPS: ulCompType = 0x3; break; - case cOCT6100_G726_32KBPS: ulCompType = 0x2; break; - case cOCT6100_G726_24KBPS: ulCompType = 0x1; break; - case cOCT6100_G726_16KBPS: ulCompType = 0x0; break; - case cOCT6100_G727_40KBPS_4_1: ulCompType = 0xD; break; - case cOCT6100_G727_40KBPS_3_2: ulCompType = 0xA; break; - case cOCT6100_G727_40KBPS_2_3: ulCompType = 0x6; break; - case cOCT6100_G727_32KBPS_4_0: ulCompType = 0xE; break; - case cOCT6100_G727_32KBPS_3_1: ulCompType = 0xB; break; - case cOCT6100_G727_32KBPS_2_2: ulCompType = 0x7; break; - case cOCT6100_G727_24KBPS_3_0: ulCompType = 0xC; break; - case cOCT6100_G727_24KBPS_2_1: ulCompType = 0x8; break; - case cOCT6100_G727_16KBPS_2_0: ulCompType = 0x9; break; - } - - ulResult = Oct6100ApiWriteEncoderMemory( f_pApiInstance, - f_usAdpcmMemIndex, - ulCompType, - f_usTsiMemIndex, - FALSE, - f_pAdpcmChanOpen->ulAdpcmNibblePosition, - cOCT6100_INVALID_INDEX, - cOCT6100_INVALID_VALUE, - cOCT6100_INVALID_VALUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else /* if ( f_pAdpcmChanOpen->ulChanMode != cOCT6100_ADPCM_DECODING ) */ - { - switch( f_pAdpcmChanOpen->ulDecodingRate ) - { - case cOCT6100_G711_64KBPS: ulCompType = 0x8; break; - case cOCT6100_G726_40KBPS: ulCompType = 0x3; break; - case cOCT6100_G726_32KBPS: ulCompType = 0x2; break; - case cOCT6100_G726_24KBPS: ulCompType = 0x1; break; - case cOCT6100_G726_16KBPS: ulCompType = 0x0; break; - case cOCT6100_G727_2C_ENCODED: ulCompType = 0x4; break; - case cOCT6100_G727_3C_ENCODED: ulCompType = 0x5; break; - case cOCT6100_G727_4C_ENCODED: ulCompType = 0x6; break; - case cOCT6100_G726_ENCODED: ulCompType = 0x9; break; - case cOCT6100_G711_G726_ENCODED: ulCompType = 0xA; break; - case cOCT6100_G711_G727_2C_ENCODED: ulCompType = 0xC; break; - case cOCT6100_G711_G727_3C_ENCODED: ulCompType = 0xD; break; - case cOCT6100_G711_G727_4C_ENCODED: ulCompType = 0xE; break; - } - - ulResult = Oct6100ApiWriteDecoderMemory( f_pApiInstance, - f_usAdpcmMemIndex, - ulCompType, - f_usTsiMemIndex, - f_pAdpcmChanOpen->ulOutputPcmLaw, - f_pAdpcmChanOpen->ulAdpcmNibblePosition ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*------------------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateAdpcmChanEntry - -Description: Updates the new ADPCM channel in the ADPCM channel list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pAdpcmChanOpen Pointer to ADPCM channel open configuration structure. -f_usAdpcmChanIndex Allocated entry in the ADPCM channel list. -f_usAdpcmMemIndex Allocated entry in ADPCM memory. -f_usTsiMemIndex Allocated entry in TSI chariot memory. -f_usInputTsstIndex TSST control memory index of the input TSST. -f_usOutputTsstIndex TSST control memory index of the output TSST. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateAdpcmChanEntry -UINT32 Oct6100ApiUpdateAdpcmChanEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_ADPCM_CHAN_OPEN f_pAdpcmChanOpen, - IN UINT16 f_usAdpcmChanIndex, - IN UINT16 f_usAdpcmMemIndex, - IN UINT16 f_usTsiMemIndex, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ) -{ - tPOCT6100_API_ADPCM_CHAN pAdpcmChanEntry; - - /*------------------------------------------------------------------------------*/ - /* Obtain a pointer to the new ADPCM channel's list entry. */ - - mOCT6100_GET_ADPCM_CHAN_ENTRY_PNT( f_pApiInstance->pSharedInfo, pAdpcmChanEntry, f_usAdpcmChanIndex ) - - /* Copy the buffer's configuration and allocated resources. */ - pAdpcmChanEntry->usInputTimeslot = (UINT16)( f_pAdpcmChanOpen->ulInputTimeslot & 0xFFFF ); - pAdpcmChanEntry->usInputStream = (UINT16)( f_pAdpcmChanOpen->ulInputStream & 0xFFFF ); - pAdpcmChanEntry->byInputNumTssts = (UINT8)( f_pAdpcmChanOpen->ulInputNumTssts & 0xFF ); - pAdpcmChanEntry->byInputPcmLaw = (UINT8)( f_pAdpcmChanOpen->ulInputPcmLaw & 0xFF ); - - pAdpcmChanEntry->usOutputTimeslot = (UINT16)( f_pAdpcmChanOpen->ulOutputTimeslot & 0xFFFF ); - pAdpcmChanEntry->usOutputStream = (UINT16)( f_pAdpcmChanOpen->ulOutputStream & 0xFFFF ); - pAdpcmChanEntry->byOutputNumTssts = (UINT8)( f_pAdpcmChanOpen->ulOutputNumTssts & 0xFF ); - pAdpcmChanEntry->byOutputPcmLaw = (UINT8)( f_pAdpcmChanOpen->ulOutputPcmLaw & 0xFF ); - - /* Store hardware related information. */ - pAdpcmChanEntry->usTsiMemIndex = f_usTsiMemIndex; - pAdpcmChanEntry->usAdpcmMemIndex = f_usAdpcmMemIndex; - pAdpcmChanEntry->usInputTsstIndex = f_usInputTsstIndex; - pAdpcmChanEntry->usOutputTsstIndex = f_usOutputTsstIndex; - - /* Form handle returned to user. */ - *f_pAdpcmChanOpen->pulChanHndl = cOCT6100_HNDL_TAG_ADPCM_CHANNEL | (pAdpcmChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_usAdpcmChanIndex; - - /* Finally, mark the ADPCM channel as opened. */ - pAdpcmChanEntry->fReserved = TRUE; - - /* Increment the number of ADPCM channel opened. */ - f_pApiInstance->pSharedInfo->ChipStats.usNumberAdpcmChans++; - - /*------------------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100AdpcmChanCloseSer - -Description: Closes an ADPCM channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pAdpcmChanClose Pointer to ADPCM channel close structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100AdpcmChanCloseSer -UINT32 Oct6100AdpcmChanCloseSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_ADPCM_CHAN_CLOSE f_pAdpcmChanClose ) -{ - UINT16 usAdpcmChanIndex; - UINT16 usTsiMemIndex; - UINT16 usAdpcmMemIndex; - UINT16 usInputTsstIndex; - UINT16 usOutputTsstIndex; - UINT32 ulResult; - - /* Verify that all the parameters given match the state of the API. */ - ulResult = Oct6100ApiAssertAdpcmChanParams( f_pApiInstance, f_pAdpcmChanClose, &usAdpcmChanIndex, &usAdpcmMemIndex, &usTsiMemIndex, &usInputTsstIndex, &usOutputTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the ADPCM channel. */ - ulResult = Oct6100ApiInvalidateAdpcmChanStructs( f_pApiInstance, usAdpcmMemIndex, usInputTsstIndex, usOutputTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the ADPCM channel. */ - ulResult = Oct6100ApiReleaseAdpcmChanResources( f_pApiInstance, usAdpcmChanIndex, usAdpcmMemIndex, usTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Invalidate the handle. */ - f_pAdpcmChanClose->ulChanHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertAdpcmChanParams - -Description: Validate the handle given by the user and verify the state of - the ADPCM channel about to be closed. - Also return all required information to deactivate the channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_pAdpcmChanClose Pointer to ADPCM channel close structure. -f_pusAdpcmChanIndex Index of the ADPCM channel structure in the API list. -f_pusAdpcmMemIndex Index of the ADPCM memory structure in the API list. -f_pusTsiMemIndex Index of the TSI chariot memory used for this channel. -f_pusInputTsstIndex Index of the input entry in the TSST control memory. -f_pusOutputTsstIndex Index of the output entry in the TSST control memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertAdpcmChanParams -UINT32 Oct6100ApiAssertAdpcmChanParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_ADPCM_CHAN_CLOSE f_pAdpcmChanClose, - OUT PUINT16 f_pusAdpcmChanIndex, - OUT PUINT16 f_pusAdpcmMemIndex, - OUT PUINT16 f_pusTsiMemIndex, - OUT PUINT16 f_pusInputTsstIndex, - OUT PUINT16 f_pusOutputTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_ADPCM_CHAN pAdpcmChanEntry; - UINT32 ulEntryOpenCnt; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check the provided handle. */ - if ( (f_pAdpcmChanClose->ulChanHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_ADPCM_CHANNEL ) - return cOCT6100_ERR_ADPCM_CHAN_INVALID_HANDLE; - - *f_pusAdpcmChanIndex = (UINT16)( f_pAdpcmChanClose->ulChanHndl & cOCT6100_HNDL_INDEX_MASK ); - - if ( *f_pusAdpcmChanIndex >= pSharedInfo->ChipConfig.usMaxAdpcmChannels ) - return cOCT6100_ERR_ADPCM_CHAN_INVALID_HANDLE; - - /*------------------------------------------------------------------------------*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_ADPCM_CHAN_ENTRY_PNT( pSharedInfo, pAdpcmChanEntry, *f_pusAdpcmChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pAdpcmChanClose->ulChanHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pAdpcmChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_ADPCM_CHAN_NOT_OPEN; - if ( ulEntryOpenCnt != pAdpcmChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_ADPCM_CHAN_INVALID_HANDLE; - - /* Return info needed to close the channel and release all resources. */ - *f_pusInputTsstIndex = pAdpcmChanEntry->usInputTsstIndex; - *f_pusOutputTsstIndex = pAdpcmChanEntry->usOutputTsstIndex; - *f_pusTsiMemIndex = pAdpcmChanEntry->usTsiMemIndex; - *f_pusAdpcmMemIndex = pAdpcmChanEntry->usAdpcmMemIndex; - - /*------------------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInvalidateAdpcmChanStructs - -Description: Closes an ADPCM channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usAdpcmMemIndex Index of the ADPCM memory. -f_usInputTsstIndex Index of the input entry in the TSST control memory. -f_usOutputTsstIndex Index of the output entry in the TSST control memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInvalidateAdpcmChanStructs -UINT32 Oct6100ApiInvalidateAdpcmChanStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usAdpcmMemIndex, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*------------------------------------------------------------------------------*/ - /* Deactivate the TSST control memory. */ - - /* Set the input TSST control entry to unused. */ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( f_usInputTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = 0x0000; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the output TSST control entry to unused. */ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( f_usOutputTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = 0x0000; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - - - /*------------------------------------------------------------------------------*/ - /* Clear the ADPCM memory. */ - - ulResult = Oct6100ApiClearConversionMemory( f_pApiInstance, f_usAdpcmMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseAdpcmChanResources - -Description: Release and clear the API entry associated to the ADPCM channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_ulAdpcmChanIndex Index of the ADPCM channel in the API list. -f_usAdpcmMemIndex Index of the ADPCM memory used. -f_usTsiMemIndex Index of the TSI memory used. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseAdpcmChanResources -UINT32 Oct6100ApiReleaseAdpcmChanResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usAdpcmChanIndex, - IN UINT16 f_usAdpcmMemIndex, - IN UINT16 f_usTsiMemIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_ADPCM_CHAN pAdpcmChanEntry; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_ADPCM_CHAN_ENTRY_PNT( pSharedInfo, pAdpcmChanEntry, f_usAdpcmChanIndex ); - - /*------------------------------------------------------------------------------*/ - /* Release all resources associated with ADPCM channel. */ - - /* Release the entry in the ADPCM channel list. */ - ulResult = Oct6100ApiReleaseAdpcmChanEntry( f_pApiInstance, f_usAdpcmChanIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReleaseConversionMemEntry( f_pApiInstance, f_usAdpcmMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, f_usTsiMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Release the input TSST entry. */ - ulResult = Oct6100ApiReleaseTsst( - f_pApiInstance, - pAdpcmChanEntry->usInputTimeslot, - pAdpcmChanEntry->usInputStream, - pAdpcmChanEntry->byInputNumTssts, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Release the output TSST entry. */ - ulResult = Oct6100ApiReleaseTsst( - f_pApiInstance, - pAdpcmChanEntry->usOutputTimeslot, - pAdpcmChanEntry->usOutputStream, - pAdpcmChanEntry->byOutputNumTssts, - cOCT6100_OUTPUT_TSST, - cOCT6100_INVALID_INDEX ); - } - } - } - } - - /* Check if an error occured while releasing the reserved resources. */ - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult >= cOCT6100_ERR_FATAL ) - return ulResult; - else - return cOCT6100_ERR_FATAL_4A; - } - - /*------------------------------------------------------------------------------*/ - - - /*------------------------------------------------------------------------------*/ - /* Update the ADPCM channel's list entry. */ - - /* Mark the channel as closed. */ - pAdpcmChanEntry->fReserved = FALSE; - pAdpcmChanEntry->byEntryOpenCnt++; - - /* Decrement the number of ADPCM channels opened. */ - f_pApiInstance->pSharedInfo->ChipStats.usNumberAdpcmChans--; - - /*------------------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveAdpcmChanEntry - -Description: Reserves one of the ADPCM channel API entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pusAdpcmChanIndex Resulting index reserved in the ADPCM channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveAdpcmChanEntry -UINT32 Oct6100ApiReserveAdpcmChanEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusAdpcmChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pAdpcmChanAlloc; - UINT32 ulResult; - UINT32 ulAdpcmChanIndex; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_ADPCM_CHAN_ALLOC_PNT( pSharedInfo, pAdpcmChanAlloc ) - - ulResult = OctapiLlmAllocAlloc( pAdpcmChanAlloc, &ulAdpcmChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_ADPCM_CHAN_ALL_ADPCM_CHAN_ARE_OPENED; - else - return cOCT6100_ERR_FATAL_BE; - } - - *f_pusAdpcmChanIndex = (UINT16)( ulAdpcmChanIndex & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseAdpcmChanEntry - -Description: Releases the specified ADPCM channel API entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_usAdpcmChanIndex Index reserved in the ADPCM channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseAdpcmChanEntry -UINT32 Oct6100ApiReleaseAdpcmChanEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usAdpcmChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pAdpcmChanAlloc; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_ADPCM_CHAN_ALLOC_PNT( pSharedInfo, pAdpcmChanAlloc ) - - ulResult = OctapiLlmAllocDealloc( pAdpcmChanAlloc, f_usAdpcmChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_BF; - } - - return cOCT6100_ERR_OK; -} -#endif diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c deleted file mode 100644 index caefd6e..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c +++ /dev/null @@ -1,13933 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_channel.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains functions used to open, modify and close echo - cancellation channels. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 492 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#if defined(__FreeBSD__) -#include <sys/types.h> -#include <dahdi/compat/bsd.h> -#else -#ifndef __KERNEL__ -#include <stdlib.h> -#include <stdio.h> -#define kmalloc(size, type) malloc(size) -#define kfree(ptr) free(ptr) -#define GFP_ATOMIC 0 /* Dummy */ -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) -#else -#include <linux/slab.h> -#include <linux/kernel.h> -#endif -#endif - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_mixer_inst.h" -#include "oct6100api/oct6100_tsi_cnct_inst.h" -#include "oct6100api/oct6100_conf_bridge_inst.h" -#include "oct6100api/oct6100_tone_detection_inst.h" -#include "oct6100api/oct6100_phasing_tsst_inst.h" -#include "oct6100api/oct6100_tsst_inst.h" -#include "oct6100api/oct6100_channel_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_tsi_cnct_pub.h" -#include "oct6100api/oct6100_playout_buf_pub.h" -#include "oct6100api/oct6100_phasing_tsst_pub.h" -#include "oct6100api/oct6100_mixer_pub.h" -#include "oct6100api/oct6100_conf_bridge_pub.h" -#include "oct6100api/oct6100_tone_detection_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_debug_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_memory_priv.h" -#include "oct6100_tsst_priv.h" -#include "oct6100_mixer_priv.h" -#include "oct6100_phasing_tsst_priv.h" -#include "oct6100_tsi_cnct_priv.h" -#include "oct6100_playout_buf_priv.h" -#include "oct6100_conf_bridge_priv.h" -#include "oct6100_tone_detection_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_debug_priv.h" - - -/**************************** PUBLIC FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelOpen - -Description: This function opens a echo cancellation channel. An echo cancellation - channel is constituted of two voice stream (RIN/ROUT and SIN/SOUT), and - an echo cancelling core. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelOpen Pointer to echo channel open structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelOpenDef -UINT32 Oct6100ChannelOpenDef( - IN OUT tPOCT6100_CHANNEL_OPEN f_pChannelOpen ) -{ - f_pChannelOpen->pulChannelHndl = NULL; - f_pChannelOpen->ulUserChanId = cOCT6100_INVALID_VALUE; - f_pChannelOpen->ulEchoOperationMode = cOCT6100_ECHO_OP_MODE_POWER_DOWN; - f_pChannelOpen->fEnableToneDisabler = FALSE; - f_pChannelOpen->fEnableExtToneDetection = FALSE; - - /* VQE configuration.*/ - f_pChannelOpen->VqeConfig.fSinDcOffsetRemoval = TRUE; - f_pChannelOpen->VqeConfig.fRinDcOffsetRemoval = TRUE; - f_pChannelOpen->VqeConfig.fRinLevelControl = FALSE; - f_pChannelOpen->VqeConfig.lRinLevelControlGainDb = 0; - f_pChannelOpen->VqeConfig.fSoutLevelControl = FALSE; - f_pChannelOpen->VqeConfig.lSoutLevelControlGainDb = 0; - f_pChannelOpen->VqeConfig.fRinAutomaticLevelControl = FALSE; - f_pChannelOpen->VqeConfig.lRinAutomaticLevelControlTargetDb = -20; - f_pChannelOpen->VqeConfig.fSoutAutomaticLevelControl = FALSE; - f_pChannelOpen->VqeConfig.lSoutAutomaticLevelControlTargetDb = -20; - f_pChannelOpen->VqeConfig.fRinHighLevelCompensation = FALSE; - f_pChannelOpen->VqeConfig.lRinHighLevelCompensationThresholdDb = -10; - f_pChannelOpen->VqeConfig.fSoutAdaptiveNoiseReduction = FALSE; - f_pChannelOpen->VqeConfig.fSoutNoiseBleaching = FALSE; - f_pChannelOpen->VqeConfig.fSoutConferencingNoiseReduction = FALSE; - f_pChannelOpen->VqeConfig.ulComfortNoiseMode = cOCT6100_COMFORT_NOISE_NORMAL; - f_pChannelOpen->VqeConfig.fEnableNlp = TRUE; - f_pChannelOpen->VqeConfig.fEnableTailDisplacement = FALSE; - f_pChannelOpen->VqeConfig.ulTailDisplacement = cOCT6100_AUTO_SELECT_TAIL; - f_pChannelOpen->VqeConfig.ulTailLength = cOCT6100_AUTO_SELECT_TAIL; - - f_pChannelOpen->VqeConfig.fDtmfToneRemoval = FALSE; - - f_pChannelOpen->VqeConfig.fAcousticEcho = FALSE; - f_pChannelOpen->VqeConfig.lDefaultErlDb = -6; - f_pChannelOpen->VqeConfig.ulAecTailLength = 128; - f_pChannelOpen->VqeConfig.lAecDefaultErlDb = 0; - f_pChannelOpen->VqeConfig.ulNonLinearityBehaviorA = 1; - f_pChannelOpen->VqeConfig.ulNonLinearityBehaviorB = 0; - f_pChannelOpen->VqeConfig.ulDoubleTalkBehavior = cOCT6100_DOUBLE_TALK_BEH_NORMAL; - f_pChannelOpen->VqeConfig.ulSoutAutomaticListenerEnhancementGainDb = 0; - f_pChannelOpen->VqeConfig.ulSoutNaturalListenerEnhancementGainDb = 0; - f_pChannelOpen->VqeConfig.fSoutNaturalListenerEnhancement = FALSE; - f_pChannelOpen->VqeConfig.fRoutNoiseReduction = FALSE; - f_pChannelOpen->VqeConfig.lRoutNoiseReductionLevelGainDb = -18; - f_pChannelOpen->VqeConfig.lAnrSnrEnhancementDb = -18; - f_pChannelOpen->VqeConfig.ulAnrVoiceNoiseSegregation = 6; - f_pChannelOpen->VqeConfig.ulToneDisablerVqeActivationDelay = 300; - f_pChannelOpen->VqeConfig.fEnableMusicProtection = FALSE; - /* Older images have idle code detection hard-coded to enabled. */ - f_pChannelOpen->VqeConfig.fIdleCodeDetection = TRUE; - - /* TDM configuration.*/ - f_pChannelOpen->TdmConfig.ulRinNumTssts = 1; - f_pChannelOpen->TdmConfig.ulSinNumTssts = 1; - f_pChannelOpen->TdmConfig.ulRoutNumTssts = 1; - f_pChannelOpen->TdmConfig.ulSoutNumTssts = 1; - - f_pChannelOpen->TdmConfig.ulRinTimeslot = cOCT6100_UNASSIGNED; - f_pChannelOpen->TdmConfig.ulRinStream = cOCT6100_UNASSIGNED; - f_pChannelOpen->TdmConfig.ulRinPcmLaw = cOCT6100_PCM_U_LAW; - - f_pChannelOpen->TdmConfig.ulSinTimeslot = cOCT6100_UNASSIGNED; - f_pChannelOpen->TdmConfig.ulSinStream = cOCT6100_UNASSIGNED; - f_pChannelOpen->TdmConfig.ulSinPcmLaw = cOCT6100_PCM_U_LAW; - - f_pChannelOpen->TdmConfig.ulRoutTimeslot = cOCT6100_UNASSIGNED; - f_pChannelOpen->TdmConfig.ulRoutStream = cOCT6100_UNASSIGNED; - f_pChannelOpen->TdmConfig.ulRoutPcmLaw = cOCT6100_PCM_U_LAW; - - f_pChannelOpen->TdmConfig.ulSoutTimeslot = cOCT6100_UNASSIGNED; - f_pChannelOpen->TdmConfig.ulSoutStream = cOCT6100_UNASSIGNED; - f_pChannelOpen->TdmConfig.ulSoutPcmLaw = cOCT6100_PCM_U_LAW; - - /* CODEC configuration.*/ - f_pChannelOpen->CodecConfig.ulAdpcmNibblePosition = cOCT6100_ADPCM_IN_LOW_BITS; - - f_pChannelOpen->CodecConfig.ulEncoderPort = cOCT6100_CHANNEL_PORT_SOUT; - f_pChannelOpen->CodecConfig.ulEncodingRate = cOCT6100_G711_64KBPS; - f_pChannelOpen->CodecConfig.ulDecoderPort = cOCT6100_CHANNEL_PORT_RIN; - f_pChannelOpen->CodecConfig.ulDecodingRate = cOCT6100_G711_64KBPS; - - f_pChannelOpen->CodecConfig.fEnableSilenceSuppression = FALSE; - f_pChannelOpen->CodecConfig.ulPhasingTsstHndl = cOCT6100_INVALID_HANDLE; - f_pChannelOpen->CodecConfig.ulPhase = 1; - f_pChannelOpen->CodecConfig.ulPhasingType = cOCT6100_NO_PHASING; - - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ChannelOpen -UINT32 Oct6100ChannelOpen( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_OPEN f_pChannelOpen ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ChannelOpenSer( f_pApiInstance, f_pChannelOpen ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelClose - -Description: This function closes an echo canceller channel - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelClose Pointer to channel close structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelCloseDef -UINT32 Oct6100ChannelCloseDef( - IN OUT tPOCT6100_CHANNEL_CLOSE f_pChannelClose ) -{ - f_pChannelClose->ulChannelHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ChannelClose -UINT32 Oct6100ChannelClose( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_CLOSE f_pChannelClose ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ChannelCloseSer( f_pApiInstance, f_pChannelClose ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelModify - -Description: This function will modify the parameter of an echo channel. If - the call to this channel allows the channel to go from power down - to enable, the API will activate it. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelModify Pointer to echo channel change structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelModifyDef -UINT32 Oct6100ChannelModifyDef( - IN OUT tPOCT6100_CHANNEL_MODIFY f_pChannelModify ) -{ - f_pChannelModify->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pChannelModify->ulUserChanId = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->ulEchoOperationMode = cOCT6100_KEEP_PREVIOUS_SETTING; - - f_pChannelModify->fEnableToneDisabler = cOCT6100_KEEP_PREVIOUS_SETTING; - - f_pChannelModify->fApplyToAllChannels = FALSE; - - f_pChannelModify->fDisableToneDetection = FALSE; - f_pChannelModify->fStopBufferPlayout = FALSE; - f_pChannelModify->fRemoveConfBridgeParticipant = FALSE; - f_pChannelModify->fRemoveBroadcastTssts = FALSE; - - f_pChannelModify->fTdmConfigModified = FALSE; - f_pChannelModify->fVqeConfigModified = FALSE; - f_pChannelModify->fCodecConfigModified = FALSE; - - /* VQE config. */ - f_pChannelModify->VqeConfig.fSinDcOffsetRemoval = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fRinDcOffsetRemoval = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fRinLevelControl = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.lRinLevelControlGainDb = (INT32)cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fSoutLevelControl = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.lSoutLevelControlGainDb = (INT32)cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fRinAutomaticLevelControl = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.lRinAutomaticLevelControlTargetDb = (INT32)cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fSoutAutomaticLevelControl = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.lSoutAutomaticLevelControlTargetDb = (INT32)cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fRinHighLevelCompensation = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.lRinHighLevelCompensationThresholdDb = (INT32)cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fSoutAdaptiveNoiseReduction = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fSoutNoiseBleaching = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fSoutConferencingNoiseReduction = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.ulComfortNoiseMode = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fEnableNlp = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fEnableTailDisplacement = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.ulTailDisplacement = cOCT6100_KEEP_PREVIOUS_SETTING; - - f_pChannelModify->VqeConfig.fDtmfToneRemoval = cOCT6100_KEEP_PREVIOUS_SETTING; - - f_pChannelModify->VqeConfig.fAcousticEcho = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.lDefaultErlDb = (INT32)cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.ulAecTailLength = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.lAecDefaultErlDb = (INT32)cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.ulNonLinearityBehaviorA = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.ulNonLinearityBehaviorB = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.ulDoubleTalkBehavior = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.ulSoutAutomaticListenerEnhancementGainDb = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.ulSoutNaturalListenerEnhancementGainDb = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fSoutNaturalListenerEnhancement = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fRoutNoiseReduction = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.lRoutNoiseReductionLevelGainDb = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.lAnrSnrEnhancementDb = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.ulAnrVoiceNoiseSegregation = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.ulToneDisablerVqeActivationDelay = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fEnableMusicProtection = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->VqeConfig.fIdleCodeDetection = cOCT6100_KEEP_PREVIOUS_SETTING; - - /* TDM config. */ - f_pChannelModify->TdmConfig.ulRinNumTssts = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulSinNumTssts = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulRoutNumTssts = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulSoutNumTssts = cOCT6100_KEEP_PREVIOUS_SETTING; - - f_pChannelModify->TdmConfig.ulRinTimeslot = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulRinStream = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulRinPcmLaw = cOCT6100_KEEP_PREVIOUS_SETTING; - - f_pChannelModify->TdmConfig.ulSinTimeslot = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulSinStream = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulSinPcmLaw = cOCT6100_KEEP_PREVIOUS_SETTING; - - f_pChannelModify->TdmConfig.ulRoutTimeslot = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulRoutStream = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulRoutPcmLaw = cOCT6100_KEEP_PREVIOUS_SETTING; - - f_pChannelModify->TdmConfig.ulSoutTimeslot = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulSoutStream = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->TdmConfig.ulSoutPcmLaw = cOCT6100_KEEP_PREVIOUS_SETTING; - - /* CODEC config. */ - f_pChannelModify->CodecConfig.ulEncoderPort = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->CodecConfig.ulEncodingRate = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->CodecConfig.ulDecoderPort = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->CodecConfig.ulDecodingRate = cOCT6100_KEEP_PREVIOUS_SETTING; - - f_pChannelModify->CodecConfig.fEnableSilenceSuppression = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->CodecConfig.ulPhasingTsstHndl = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->CodecConfig.ulPhase = cOCT6100_KEEP_PREVIOUS_SETTING; - f_pChannelModify->CodecConfig.ulPhasingType = cOCT6100_KEEP_PREVIOUS_SETTING; - - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ChannelModify -UINT32 Oct6100ChannelModify( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_MODIFY f_pChannelModify ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Check the apply to all channels flag first. */ - if ( f_pChannelModify->fApplyToAllChannels != TRUE && - f_pChannelModify->fApplyToAllChannels != FALSE ) - return cOCT6100_ERR_CHANNEL_APPLY_TO_ALL_CHANNELS; - - /* Check if must apply modification to all channels. */ - if ( f_pChannelModify->fApplyToAllChannels == TRUE ) - { - tPOCT6100_API_CHANNEL pChanEntry; - UINT16 usChanIndex; - - /* Loop through all channels and look for the opened ones. */ - for ( usChanIndex = 0; usChanIndex < f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels; usChanIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, usChanIndex ); - - /* Check if this one is opened. */ - if ( pChanEntry->fReserved == TRUE ) - { - /* Channel is opened. Form handle and call actual modify function. */ - f_pChannelModify->ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | ( pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT ) | usChanIndex; - - /* Call the serialized function. */ - ulFncRes = Oct6100ChannelModifySer( f_pApiInstance, f_pChannelModify ); - if ( ulFncRes != cOCT6100_ERR_OK ) - break; - } - } - } - else /* if ( f_pChannelModify->fApplyToAllChannels == FALSE ) */ - { - /* Call the serialized function. */ - ulFncRes = Oct6100ChannelModifySer( f_pApiInstance, f_pChannelModify ); - } - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelCreateBiDir - -Description: This function creates a bidirectional channel using two standard - echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelCreateBiDir Pointer to channel create BiDir structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelCreateBiDirDef -UINT32 Oct6100ChannelCreateBiDirDef( - IN OUT tPOCT6100_CHANNEL_CREATE_BIDIR f_pChannelCreateBiDir ) -{ - f_pChannelCreateBiDir->pulBiDirChannelHndl = NULL; - - f_pChannelCreateBiDir->ulFirstChannelHndl = cOCT6100_INVALID_HANDLE; - f_pChannelCreateBiDir->ulSecondChannelHndl = cOCT6100_INVALID_HANDLE; - - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ChannelCreateBiDir -UINT32 Oct6100ChannelCreateBiDir( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_CREATE_BIDIR f_pChannelCreateBiDir ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ChannelCreateBiDirSer( f_pApiInstance, f_pChannelCreateBiDir ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelDestroyBiDir - -Description: This function destroys a bidirectional channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelDestroyBiDir Pointer to channel destroy BiDir structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelDestroyBiDirDef -UINT32 Oct6100ChannelDestroyBiDirDef( - IN OUT tPOCT6100_CHANNEL_DESTROY_BIDIR f_pChannelDestroyBiDir ) -{ - f_pChannelDestroyBiDir->ulBiDirChannelHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ChannelDestroyBiDir -UINT32 Oct6100ChannelDestroyBiDir( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_DESTROY_BIDIR f_pChannelDestroyBiDir ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ChannelDestroyBiDirSer( f_pApiInstance, f_pChannelDestroyBiDir ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelBroadcastTsstAdd - -Description: This function adds a TSST to one of the two output ports of a channel. - This TSST can never be modified by a call to Oct6100ChannelModify. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pChannelBroadcastTsstAdd Pointer to the an Add Broadcast TSST structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelBroadcastTsstAddDef -UINT32 Oct6100ChannelBroadcastTsstAddDef( - tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelBroadcastTsstAdd ) -{ - f_pChannelBroadcastTsstAdd->ulChannelHndl = cOCT6100_INVALID_HANDLE; - - f_pChannelBroadcastTsstAdd->ulPort = cOCT6100_INVALID_PORT; - f_pChannelBroadcastTsstAdd->ulTimeslot = cOCT6100_INVALID_TIMESLOT; - f_pChannelBroadcastTsstAdd->ulStream = cOCT6100_INVALID_STREAM; - - return cOCT6100_ERR_OK; - -} -#endif - -#if !SKIP_Oct6100ChannelBroadcastTsstAdd -UINT32 Oct6100ChannelBroadcastTsstAdd( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelBroadcastTsstAdd ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ChannelBroadcastTsstAddSer( f_pApiInstance, f_pChannelBroadcastTsstAdd ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelBroadcastTsstRemove - -Description: This function removes a TSST from one of the two output ports of a channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pChannelBroadcastTsstRemove Pointer to the a Remove Broadcast TSST structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelBroadcastTsstRemoveDef -UINT32 Oct6100ChannelBroadcastTsstRemoveDef( - tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelBroadcastTsstRemove ) -{ - f_pChannelBroadcastTsstRemove->ulChannelHndl = cOCT6100_INVALID_HANDLE; - - f_pChannelBroadcastTsstRemove->ulPort = cOCT6100_INVALID_PORT; - f_pChannelBroadcastTsstRemove->ulTimeslot = cOCT6100_INVALID_TIMESLOT; - f_pChannelBroadcastTsstRemove->ulStream = cOCT6100_INVALID_STREAM; - - f_pChannelBroadcastTsstRemove->fRemoveAll = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ChannelBroadcastTsstRemove -UINT32 Oct6100ChannelBroadcastTsstRemove( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelBroadcastTsstRemove ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ChannelBroadcastTsstRemoveSer( f_pApiInstance, f_pChannelBroadcastTsstRemove ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelGetStats - -Description: This function retrieves all the config and stats related to the channel - designated by ulChannelHndl. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelStats Pointer to a tOCT6100_CHANNEL_STATS structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelGetStatsDef -UINT32 Oct6100ChannelGetStatsDef( - IN OUT tPOCT6100_CHANNEL_STATS f_pChannelStats ) -{ - f_pChannelStats->fResetStats = FALSE; - - f_pChannelStats->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pChannelStats->ulUserChanId = cOCT6100_INVALID_STAT; - f_pChannelStats->ulEchoOperationMode = cOCT6100_INVALID_STAT; - f_pChannelStats->fEnableToneDisabler = FALSE; - f_pChannelStats->ulMutePortsMask = cOCT6100_CHANNEL_MUTE_PORT_NONE; - f_pChannelStats->fEnableExtToneDetection = FALSE; - - /* VQE configuration.*/ - f_pChannelStats->VqeConfig.fEnableNlp = FALSE; - f_pChannelStats->VqeConfig.fEnableTailDisplacement = FALSE; - f_pChannelStats->VqeConfig.ulTailDisplacement = cOCT6100_INVALID_STAT; - f_pChannelStats->VqeConfig.ulTailLength = cOCT6100_INVALID_STAT; - - f_pChannelStats->VqeConfig.fSinDcOffsetRemoval = FALSE; - f_pChannelStats->VqeConfig.fRinDcOffsetRemoval = FALSE; - f_pChannelStats->VqeConfig.fRinLevelControl = FALSE; - f_pChannelStats->VqeConfig.fSoutLevelControl = FALSE; - f_pChannelStats->VqeConfig.fRinAutomaticLevelControl = FALSE; - f_pChannelStats->VqeConfig.fSoutAutomaticLevelControl = FALSE; - f_pChannelStats->VqeConfig.fRinHighLevelCompensation = FALSE; - f_pChannelStats->VqeConfig.fAcousticEcho = FALSE; - f_pChannelStats->VqeConfig.fSoutAdaptiveNoiseReduction = FALSE; - f_pChannelStats->VqeConfig.fDtmfToneRemoval = FALSE; - - f_pChannelStats->VqeConfig.fSoutNoiseBleaching = FALSE; - f_pChannelStats->VqeConfig.fSoutConferencingNoiseReduction = FALSE; - - f_pChannelStats->VqeConfig.ulComfortNoiseMode = cOCT6100_INVALID_STAT; - f_pChannelStats->VqeConfig.ulNonLinearityBehaviorA = cOCT6100_INVALID_STAT; - f_pChannelStats->VqeConfig.ulNonLinearityBehaviorB = cOCT6100_INVALID_STAT; - f_pChannelStats->VqeConfig.ulDoubleTalkBehavior = cOCT6100_INVALID_STAT; - f_pChannelStats->VqeConfig.lRinLevelControlGainDb = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->VqeConfig.lSoutLevelControlGainDb = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->VqeConfig.lRinAutomaticLevelControlTargetDb = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->VqeConfig.lSoutAutomaticLevelControlTargetDb = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->VqeConfig.lRinHighLevelCompensationThresholdDb = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->VqeConfig.lDefaultErlDb = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->VqeConfig.lAecDefaultErlDb = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->VqeConfig.ulAecTailLength = cOCT6100_INVALID_STAT; - f_pChannelStats->VqeConfig.ulSoutAutomaticListenerEnhancementGainDb = cOCT6100_INVALID_STAT; - f_pChannelStats->VqeConfig.ulSoutNaturalListenerEnhancementGainDb = cOCT6100_INVALID_STAT; - f_pChannelStats->VqeConfig.fSoutNaturalListenerEnhancement = FALSE; - f_pChannelStats->VqeConfig.fRoutNoiseReduction = FALSE; - f_pChannelStats->VqeConfig.lRoutNoiseReductionLevelGainDb = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->VqeConfig.lAnrSnrEnhancementDb = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->VqeConfig.ulAnrVoiceNoiseSegregation = cOCT6100_INVALID_STAT; - f_pChannelStats->VqeConfig.ulToneDisablerVqeActivationDelay = cOCT6100_INVALID_STAT; - f_pChannelStats->VqeConfig.fEnableMusicProtection = FALSE; - f_pChannelStats->VqeConfig.fIdleCodeDetection = FALSE; - - - - /* TDM configuration.*/ - f_pChannelStats->TdmConfig.ulMaxBroadcastTssts = 0; - f_pChannelStats->TdmConfig.fMoreRoutBroadcastTssts = FALSE; - f_pChannelStats->TdmConfig.fMoreSoutBroadcastTssts = FALSE; - - f_pChannelStats->TdmConfig.ulNumRoutBroadcastTssts = 0; - f_pChannelStats->TdmConfig.ulNumSoutBroadcastTssts = 0; - - f_pChannelStats->TdmConfig.ulRinNumTssts = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulSinNumTssts = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulRoutNumTssts = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulSoutNumTssts = cOCT6100_INVALID_STAT; - - f_pChannelStats->TdmConfig.ulRinTimeslot = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulRinStream = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulRinPcmLaw = cOCT6100_INVALID_STAT; - - f_pChannelStats->TdmConfig.ulSinTimeslot = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulSinStream = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulSinPcmLaw = cOCT6100_INVALID_STAT; - - f_pChannelStats->TdmConfig.ulRoutTimeslot = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulRoutStream = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulRoutPcmLaw = cOCT6100_INVALID_STAT; - - f_pChannelStats->TdmConfig.pulRoutBroadcastTimeslot = NULL; - f_pChannelStats->TdmConfig.pulRoutBroadcastStream = NULL; - - f_pChannelStats->TdmConfig.ulSoutTimeslot = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulSoutStream = cOCT6100_INVALID_STAT; - f_pChannelStats->TdmConfig.ulSoutPcmLaw = cOCT6100_INVALID_STAT; - - f_pChannelStats->TdmConfig.pulSoutBroadcastTimeslot = NULL; - f_pChannelStats->TdmConfig.pulSoutBroadcastStream = NULL; - - - /* CODEC configuration.*/ - f_pChannelStats->CodecConfig.ulAdpcmNibblePosition = cOCT6100_INVALID_STAT; - - f_pChannelStats->CodecConfig.ulEncoderPort = cOCT6100_INVALID_STAT; - f_pChannelStats->CodecConfig.ulEncodingRate = cOCT6100_INVALID_STAT; - f_pChannelStats->CodecConfig.ulDecoderPort = cOCT6100_INVALID_STAT; - f_pChannelStats->CodecConfig.ulDecodingRate = cOCT6100_INVALID_STAT; - - f_pChannelStats->CodecConfig.fEnableSilenceSuppression = FALSE; - f_pChannelStats->CodecConfig.ulPhasingTsstHndl = cOCT6100_INVALID_STAT; - f_pChannelStats->CodecConfig.ulPhase = cOCT6100_INVALID_STAT; - f_pChannelStats->CodecConfig.ulPhasingType = cOCT6100_INVALID_STAT; - - f_pChannelStats->ulNumEchoPathChanges = cOCT6100_INVALID_STAT; - f_pChannelStats->ulToneDisablerStatus = cOCT6100_INVALID_STAT; - f_pChannelStats->fEchoCancellerConverged = FALSE; - f_pChannelStats->fSinVoiceDetected = FALSE; - f_pChannelStats->lCurrentERL = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->lCurrentERLE = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->ulCurrentEchoDelay = cOCT6100_INVALID_STAT; - - f_pChannelStats->lMaxERL = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->lMaxERLE = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->ulMaxEchoDelay = cOCT6100_INVALID_STAT; - - f_pChannelStats->lRinLevel = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->lSinLevel = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->lRinAppliedGain = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->lSoutAppliedGain = cOCT6100_INVALID_SIGNED_STAT; - f_pChannelStats->lComfortNoiseLevel = cOCT6100_INVALID_SIGNED_STAT; - - - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ChannelGetStats -UINT32 Oct6100ChannelGetStats( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_STATS f_pChannelStats ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ApiChannelGetStatsSer( f_pApiInstance, f_pChannelStats ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelMute - -Description: This function mutes some or all of the ports designated by - ulChannelHndl. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelMute Pointer to a tPOCT6100_CHANNEL_MUTE structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelMuteDef -UINT32 Oct6100ChannelMuteDef( - IN OUT tPOCT6100_CHANNEL_MUTE f_pChannelMute ) -{ - f_pChannelMute->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pChannelMute->ulPortMask = cOCT6100_CHANNEL_MUTE_PORT_NONE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ChannelMute -UINT32 Oct6100ChannelMute( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_MUTE f_pChannelMute ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ChannelMuteSer( f_pApiInstance, f_pChannelMute ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelUnMute - -Description: This function unmutes some or all of the ports designated by - ulChannelHndl. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelUnMute Pointer to a tPOCT6100_CHANNEL_UNMUTE structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelUnMuteDef -UINT32 Oct6100ChannelUnMuteDef( - IN OUT tPOCT6100_CHANNEL_UNMUTE f_pChannelUnMute ) -{ - f_pChannelUnMute->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pChannelUnMute->ulPortMask = cOCT6100_CHANNEL_MUTE_PORT_NONE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ChannelUnMute -UINT32 Oct6100ChannelUnMute( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_UNMUTE f_pChannelUnMute ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ChannelUnMuteSer( f_pApiInstance, f_pChannelUnMute ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - -/**************************** PRIVATE FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetChannelsEchoSwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management of the ECHO memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pOpenChip Pointer to chip configuration struct. -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetChannelsEchoSwSizes -UINT32 Oct6100ApiGetChannelsEchoSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulTempVar; - UINT32 ulResult; - UINT32 ulMaxChannels; - - ulMaxChannels = f_pOpenChip->ulMaxChannels; - - if ( f_pOpenChip->fEnableChannelRecording == TRUE && ulMaxChannels != 672 ) - ulMaxChannels++; - - /* Determine the amount of memory required for the API echo channel list.*/ - f_pInstSizes->ulChannelList = ulMaxChannels * sizeof( tOCT6100_API_CHANNEL ); /* Add one for the record channel.*/ - f_pInstSizes->ulBiDirChannelList = f_pOpenChip->ulMaxBiDirChannels * sizeof( tOCT6100_API_BIDIR_CHANNEL ); - if ( ulMaxChannels > 0 ) - { - /* Calculate memory needed for ECHO memory allocation */ - ulResult = OctapiLlmAllocGetSize( ulMaxChannels, &f_pInstSizes->ulChannelAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_0; - } - else - { - f_pInstSizes->ulChannelAlloc = 0; - } - if ( f_pOpenChip->ulMaxBiDirChannels > 0 ) - { - /* Calculate memory needed for ECHO memory allocation */ - ulResult = OctapiLlmAllocGetSize( f_pOpenChip->ulMaxBiDirChannels, &f_pInstSizes->ulBiDirChannelAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_0; - } - else - { - f_pInstSizes->ulBiDirChannelAlloc = 0; - } - - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulChannelList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulChannelAlloc, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulBiDirChannelList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulBiDirChannelAlloc, ulTempVar ) - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiChannelsEchoSwInit - -Description: Initializes all elements of the instance structure associated - to the ECHO memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiChannelsEchoSwInit -UINT32 Oct6100ApiChannelsEchoSwInit( - IN tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_API_CHANNEL pChannelsEchoList; - tPOCT6100_API_BIDIR_CHANNEL pBiDirChannelsList; - tPOCT6100_SHARED_INFO pSharedInfo; - UINT16 usMaxChannels; - PVOID pEchoChanAlloc; - PVOID pBiDirChanAlloc; - UINT32 ulResult; - - /* Get local pointer to shared portion of the API instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Initialize the ECHO channel API list.*/ - usMaxChannels = pSharedInfo->ChipConfig.usMaxChannels; - - /* add a channel to initialize if the recording is activated. */ - if ( pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE ) - usMaxChannels++; - - /* Set all entries in the ADCPM channel list to unused. */ - mOCT6100_GET_CHANNEL_LIST_PNT( pSharedInfo, pChannelsEchoList ); - - /* Initialize the API ECHO channels allocation software to "all free". */ - if ( usMaxChannels > 0 ) - { - /* Clear the memory */ - Oct6100UserMemSet( pChannelsEchoList, 0x00, sizeof(tOCT6100_API_CHANNEL) * usMaxChannels ); - - mOCT6100_GET_CHANNEL_ALLOC_PNT( pSharedInfo, pEchoChanAlloc ) - - ulResult = OctapiLlmAllocInit( &pEchoChanAlloc, usMaxChannels ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_1; - } - - mOCT6100_GET_BIDIR_CHANNEL_LIST_PNT( pSharedInfo, pBiDirChannelsList ); - - if ( pSharedInfo->ChipConfig.usMaxBiDirChannels > 0 ) - { - /* Clear the memory */ - Oct6100UserMemSet( pBiDirChannelsList, 0x00, sizeof(tOCT6100_API_BIDIR_CHANNEL) * pSharedInfo->ChipConfig.usMaxBiDirChannels ); - - mOCT6100_GET_BIDIR_CHANNEL_ALLOC_PNT( pSharedInfo, pBiDirChanAlloc ) - - ulResult = OctapiLlmAllocInit( &pBiDirChanAlloc, pSharedInfo->ChipConfig.usMaxBiDirChannels ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_A9; - - } - - return cOCT6100_ERR_OK; -} -#endif - - - - - - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelOpenSer - -Description: Opens a echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelOpen Pointer to channel configuration structure. Then handle - identifying the buffer in all future function calls is - returned in this structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelOpenSer -UINT32 Oct6100ChannelOpenSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_OPEN f_pChannelOpen ) -{ - tOCT6100_API_ECHO_CHAN_INDEX *ChannelIndexConf; - UINT32 ulResult; - - ChannelIndexConf = kmalloc(sizeof(*ChannelIndexConf), GFP_ATOMIC); - - if (!ChannelIndexConf) - return cOCT6100_ERR_FATAL_0; - - /* Check the user's configuration of the echo cancellation channel for errors. */ - ulResult = Oct6100ApiCheckChannelParams( f_pApiInstance, f_pChannelOpen, ChannelIndexConf ); - if ( ulResult != cOCT6100_ERR_OK ) - goto out; - - /* Reserve all resources needed by the echo cancellation channel. */ - ulResult = Oct6100ApiReserveChannelResources( f_pApiInstance, f_pChannelOpen, ChannelIndexConf ); - if ( ulResult != cOCT6100_ERR_OK ) - goto out; - - /* Write all necessary structures to activate the echo cancellation channel. */ - ulResult = Oct6100ApiWriteChannelStructs( f_pApiInstance, f_pChannelOpen, ChannelIndexConf ); - if ( ulResult != cOCT6100_ERR_OK ) - goto out; - - /* Update the new echo cancellation channels's entry in the ECHO channel list. */ - ulResult = Oct6100ApiUpdateChannelEntry( f_pApiInstance, f_pChannelOpen, ChannelIndexConf ); - if ( ulResult != cOCT6100_ERR_OK ) - goto out; - - kfree(ChannelIndexConf); - return cOCT6100_ERR_OK; - -out: - kfree(ChannelIndexConf); - return ulResult; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckChannelParams - -Description: Checks the user's echo cancellation channel open configuration for errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelOpen Pointer to echo cancellation channel open configuration structure. -f_pChanIndexConf Pointer to a structure used to store the multiple resources indexes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckChannelParams -UINT32 Oct6100ApiCheckChannelParams( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - OUT tPOCT6100_API_ECHO_CHAN_INDEX f_pChanIndexConf ) -{ - tPOCT6100_CHANNEL_OPEN_TDM pTdmConfig; - tPOCT6100_CHANNEL_OPEN_VQE pVqeConfig; - tPOCT6100_CHANNEL_OPEN_CODEC pCodecConfig; - UINT32 ulDecoderNumTssts; - UINT32 ulResult; - - /* Dereference the configuration structure for clearer code and faster access.*/ - pTdmConfig = &f_pChannelOpen->TdmConfig; - pVqeConfig = &f_pChannelOpen->VqeConfig; - pCodecConfig = &f_pChannelOpen->CodecConfig; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels == 0 ) - return cOCT6100_ERR_CHANNEL_DISABLED; - - if ( f_pChannelOpen->pulChannelHndl == NULL ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - if ( f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_NORMAL && - f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_HT_FREEZE && - f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_HT_RESET && - f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_POWER_DOWN && - f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_EXTERNAL && - f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION && - f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_NO_ECHO ) - return cOCT6100_ERR_CHANNEL_ECHO_OP_MODE; - - /* Check the 2100Hz echo disabling configuration.*/ - if ( f_pChannelOpen->fEnableToneDisabler != TRUE && - f_pChannelOpen->fEnableToneDisabler != FALSE ) - return cOCT6100_ERR_CHANNEL_TONE_DISABLER_ENABLE; - - /* Check the extended Tone Detection flag value.*/ - if ( f_pChannelOpen->fEnableExtToneDetection != TRUE && - f_pChannelOpen->fEnableExtToneDetection != FALSE ) - return cOCT6100_ERR_CHANNEL_ENABLE_EXT_TONE_DETECTION; - - /* Check that extented tone detection is actually enabled by the user. */ - if ( ( f_pChannelOpen->fEnableExtToneDetection == TRUE ) && - ( f_pApiInstance->pSharedInfo->ChipConfig.fEnableExtToneDetection == FALSE ) ) - return cOCT6100_ERR_CHANNEL_EXT_TONE_DETECTION_DISABLED; - - - - /*==============================================================================*/ - /* Check the TDM configuration parameters.*/ - - ulResult = Oct6100ApiCheckTdmConfig( f_pApiInstance, pTdmConfig ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Now validate the VQE parameters */ - - ulResult = Oct6100ApiCheckVqeConfig( f_pApiInstance, pVqeConfig, f_pChannelOpen->fEnableToneDisabler ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Verify if the echo operation mode selected can be applied. */ - if ( ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_NO_ECHO ) - && ( pVqeConfig->fEnableNlp == FALSE ) ) - return cOCT6100_ERR_CHANNEL_ECHO_OP_MODE_NLP_REQUIRED; - - if ( ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION ) - && ( pVqeConfig->fEnableNlp == FALSE ) ) - return cOCT6100_ERR_CHANNEL_ECHO_OP_MODE_NLP_REQUIRED; - - /* Comfort noise must be activated for speech recognition mode to work. */ - if ( ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION ) - && ( pVqeConfig->ulComfortNoiseMode == cOCT6100_COMFORT_NOISE_OFF ) ) - return cOCT6100_ERR_CHANNEL_COMFORT_NOISE_REQUIRED; - - /*==============================================================================*/ - - /*==============================================================================*/ - /* Finally, validate the CODEC configuration.*/ - - if ( pCodecConfig->ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - ulDecoderNumTssts = pTdmConfig->ulRinNumTssts; - else /* pCodecConfig->ulDecoderPort == cOCT6100_CHANNEL_PORT_SIN */ - ulDecoderNumTssts = pTdmConfig->ulSinNumTssts; - - ulResult = Oct6100ApiCheckCodecConfig( f_pApiInstance, pCodecConfig, ulDecoderNumTssts, &f_pChanIndexConf->usPhasingTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - - - /* make sure that if silence suppression is activated, the NLP is enabled.*/ - if ( pCodecConfig->fEnableSilenceSuppression == TRUE && pVqeConfig->fEnableNlp == FALSE ) - return cOCT6100_ERR_CHANNEL_SIL_SUP_NLP_MUST_BE_ENABLED; - - /* Verify if law conversion is allowed. */ - if ( pCodecConfig->ulEncoderPort == cOCT6100_NO_ENCODING || - pCodecConfig->ulDecoderPort == cOCT6100_NO_DECODING ) - { - /* No law conversion can occurs if one ADPCM memory is not reserved.*/ - if ( pTdmConfig->ulRinPcmLaw != pTdmConfig->ulRoutPcmLaw ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_LAW_TRANSLATION; - - if ( pTdmConfig->ulSinPcmLaw != pTdmConfig->ulSoutPcmLaw ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_LAW_TRANSLATION; - } - - /* Verify if the config supports extended tone detection.*/ - if ( f_pChannelOpen->fEnableExtToneDetection == TRUE ) - { - if ( pCodecConfig->ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - return cOCT6100_ERR_CHANNEL_EXT_TONE_DETECTION_DECODER_PORT; - } - /*==============================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveChannelResources - -Description: Reserves all resources needed for the new channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelOpen Pointer to echo cancellation channel configuration structure. -f_pulChannelIndex Allocated entry in ECHO channel list. -f_pChanIndexConf Pointer to a structure used to store the multiple resources indexes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveChannelResources -UINT32 Oct6100ApiReserveChannelResources( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - OUT tPOCT6100_API_ECHO_CHAN_INDEX f_pChanIndexConf ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_CHANNEL_OPEN_TDM pTdmConfig; - tPOCT6100_CHANNEL_OPEN_CODEC pCodecConfig; - - UINT32 ulResult; - UINT32 ulTempVar; - UINT32 ulFreeMixerEventCnt; - - BOOL fRinTsstEntry = FALSE; - BOOL fSinTsstEntry = FALSE; - BOOL fRoutTsstEntry = FALSE; - BOOL fSoutTsstEntry = FALSE; - - BOOL fRinRoutTsiMemEntry = FALSE; - BOOL fSinSoutTsiMemEntry = FALSE; - - BOOL fEchoChanEntry = FALSE; - - PUINT16 pusRinRoutConversionMemIndex = NULL; - PUINT16 pusSinSoutConversionMemIndex = NULL; - BOOL fRinRoutConversionMemEntry = FALSE; - BOOL fSinSoutConversionMemEntry = FALSE; - - BOOL fExtToneChanEntry = FALSE; - BOOL fExtToneTsiEntry = FALSE; - BOOL fExtToneMixerEntry = FALSE; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain a local pointer to the configuration structures.*/ - pTdmConfig = &f_pChannelOpen->TdmConfig; - pCodecConfig = &f_pChannelOpen->CodecConfig; - - /*===============================================================================*/ - /* Reserve Echo and TSI entries. */ - - ulResult = Oct6100ApiReserveEchoEntry( f_pApiInstance, - &f_pChanIndexConf->usEchoChanIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fEchoChanEntry = TRUE; - - /* Set the echo, encoder and decoder memory indexes.*/ - f_pChanIndexConf->usEchoMemIndex = f_pChanIndexConf->usEchoChanIndex; - - /* Reserve an entry for the RIN/ROUT tsi chariot memory. */ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, - &f_pChanIndexConf->usRinRoutTsiMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fRinRoutTsiMemEntry = TRUE; - - /* Reserve an entry for the SIN/SOUT tsi chariot memory. */ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, - &f_pChanIndexConf->usSinSoutTsiMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fSinSoutTsiMemEntry = TRUE; - - /* Reserve an ADPCM memory block for compression if required.*/ - if ( pCodecConfig->ulEncoderPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - pusRinRoutConversionMemIndex = &f_pChanIndexConf->usRinRoutConversionMemIndex; - } - else if ( pCodecConfig->ulEncoderPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - pusSinSoutConversionMemIndex = &f_pChanIndexConf->usSinSoutConversionMemIndex; - } - - /* Reserve an ADPCM memory block for decompression if required.*/ - if ( pCodecConfig->ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - { - pusRinRoutConversionMemIndex = &f_pChanIndexConf->usRinRoutConversionMemIndex; - } - else if ( pCodecConfig->ulDecoderPort == cOCT6100_CHANNEL_PORT_SIN ) - { - pusSinSoutConversionMemIndex = &f_pChanIndexConf->usSinSoutConversionMemIndex; - } - - - /* Reserve the conversion memories. */ - if ( pusRinRoutConversionMemIndex != NULL ) - { - /* Reserve a conversion memory for the Rin/Rout stream. */ - ulResult = Oct6100ApiReserveConversionMemEntry( f_pApiInstance, - pusRinRoutConversionMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fRinRoutConversionMemEntry = TRUE; - } - } - else - { - /* No conversion memory reserved.*/ - f_pChanIndexConf->usRinRoutConversionMemIndex = cOCT6100_INVALID_INDEX; - } - - if ( ( pusSinSoutConversionMemIndex != NULL ) && - ( ulResult == cOCT6100_ERR_OK ) ) - { - /* Reserve a conversion memory for the Sin/Sout stream. */ - ulResult = Oct6100ApiReserveConversionMemEntry( f_pApiInstance, - pusSinSoutConversionMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fSinSoutConversionMemEntry = TRUE; - } - } - else - { - /* No conversion memory reserved.*/ - f_pChanIndexConf->usSinSoutConversionMemIndex = cOCT6100_INVALID_INDEX; - } - - /* Reserve any resources required if the extended Tone detection is enabled.*/ - if ( f_pChannelOpen->fEnableExtToneDetection == TRUE ) - { - ulResult = Oct6100ApiReserveEchoEntry( f_pApiInstance, - &f_pChanIndexConf->usExtToneChanIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fExtToneChanEntry = TRUE; - - /* Reserve an entry for the TSI chariot memory for the additionnal channel. */ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, - &f_pChanIndexConf->usExtToneTsiIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fExtToneTsiEntry = TRUE; - - /* Reserve an entry for the TSI chariot memory for the additionnal channel. */ - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, - &f_pChanIndexConf->usExtToneMixerIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - fExtToneMixerEntry = TRUE; - } - } - } - else - { - f_pChanIndexConf->usExtToneChanIndex = cOCT6100_INVALID_INDEX; - f_pChanIndexConf->usExtToneMixerIndex = cOCT6100_INVALID_INDEX; - f_pChanIndexConf->usExtToneTsiIndex = cOCT6100_INVALID_INDEX; - } - } - else - { - /* Return an error other then a Fatal.*/ - ulResult = cOCT6100_ERR_CHANNEL_OUT_OF_TSI_MEMORY; - } - } - else - { - /* Return an error other then a Fatal.*/ - ulResult = cOCT6100_ERR_CHANNEL_OUT_OF_TSI_MEMORY; - } - } - - /*===============================================================================*/ - - /*===============================================================================*/ - /* Now reserve the TSST entries if required.*/ - - /* Reserve the Rin TSST entry */ - if ( (ulResult == cOCT6100_ERR_OK ) && - (pTdmConfig->ulRinTimeslot != cOCT6100_UNASSIGNED && - pTdmConfig->ulRinStream != cOCT6100_UNASSIGNED) ) - { - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pTdmConfig->ulRinTimeslot, - pTdmConfig->ulRinStream, - pTdmConfig->ulRinNumTssts, - cOCT6100_INPUT_TSST, - &f_pChanIndexConf->usRinTsstIndex, - NULL ); - if ( ulResult == cOCT6100_ERR_OK ) - fRinTsstEntry = TRUE; - } - else - { - f_pChanIndexConf->usRinTsstIndex = cOCT6100_INVALID_INDEX; - } - - - if ( (ulResult == cOCT6100_ERR_OK ) && - (pTdmConfig->ulSinTimeslot != cOCT6100_UNASSIGNED && - pTdmConfig->ulSinStream != cOCT6100_UNASSIGNED) ) - { - /* Reserve the Sin TSST entry.*/ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pTdmConfig->ulSinTimeslot, - pTdmConfig->ulSinStream, - pTdmConfig->ulSinNumTssts, - cOCT6100_INPUT_TSST, - &f_pChanIndexConf->usSinTsstIndex, - NULL ); - if ( ulResult == cOCT6100_ERR_OK ) - fSinTsstEntry = TRUE; - } - else - { - f_pChanIndexConf->usSinTsstIndex = cOCT6100_INVALID_INDEX; - } - - if ( (ulResult == cOCT6100_ERR_OK ) && - (pTdmConfig->ulRoutTimeslot != cOCT6100_UNASSIGNED && - pTdmConfig->ulRoutStream != cOCT6100_UNASSIGNED) ) - { - /* Reserve the Rout TSST entry.*/ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pTdmConfig->ulRoutTimeslot, - pTdmConfig->ulRoutStream, - pTdmConfig->ulRoutNumTssts, - cOCT6100_OUTPUT_TSST, - &f_pChanIndexConf->usRoutTsstIndex, - NULL ); - if ( ulResult == cOCT6100_ERR_OK ) - fRoutTsstEntry = TRUE; - } - else - { - f_pChanIndexConf->usRoutTsstIndex = cOCT6100_INVALID_INDEX; - } - - - if ( (ulResult == cOCT6100_ERR_OK ) && - (pTdmConfig->ulSoutTimeslot != cOCT6100_UNASSIGNED && - pTdmConfig->ulSoutStream != cOCT6100_UNASSIGNED) ) - { - /* Reserve the Sout TSST entry.*/ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pTdmConfig->ulSoutTimeslot, - pTdmConfig->ulSoutStream, - pTdmConfig->ulSoutNumTssts, - cOCT6100_OUTPUT_TSST, - &f_pChanIndexConf->usSoutTsstIndex, - NULL ); - if ( ulResult == cOCT6100_ERR_OK ) - fSoutTsstEntry = TRUE; - } - else - { - f_pChanIndexConf->usSoutTsstIndex = cOCT6100_INVALID_INDEX; - } - - /*===============================================================================*/ - - - /*===============================================================================*/ - /* Check if there are a couple of mixer events available for us. */ - - if ( ulResult == cOCT6100_ERR_OK ) - { - UINT32 ulMixerEventCntNeeded = 0; - - /* Calculate how many mixer events are needed. */ - if ( f_pChanIndexConf->usRinTsstIndex == cOCT6100_INVALID_INDEX ) - ulMixerEventCntNeeded++; - - if ( f_pChanIndexConf->usSinTsstIndex == cOCT6100_INVALID_INDEX ) - ulMixerEventCntNeeded++; - - /* If at least 1 mixer event is needed, check if those are available. */ - if ( ulMixerEventCntNeeded != 0 ) - { - ulResult = Oct6100ApiGetFreeMixerEventCnt( f_pApiInstance, &ulFreeMixerEventCnt ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* The API might need more mixer events if the ports have to be muted. */ - /* Check if these are available. */ - if ( ulFreeMixerEventCnt < ulMixerEventCntNeeded ) - { - ulResult = cOCT6100_ERR_CHANNEL_OUT_OF_MIXER_EVENTS; - } - } - } - } - - /*===============================================================================*/ - - - /*===============================================================================*/ - /* Release the resources if something went wrong */ - if ( ulResult != cOCT6100_ERR_OK ) - { - /*===============================================================================*/ - /* Release the previously reserved resources .*/ - if( fRinTsstEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsst( f_pApiInstance, - pTdmConfig->ulRinTimeslot, - pTdmConfig->ulRinStream, - pTdmConfig->ulRinNumTssts, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fSinTsstEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsst( f_pApiInstance, - pTdmConfig->ulSinTimeslot, - pTdmConfig->ulSinStream, - pTdmConfig->ulSinNumTssts, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fRoutTsstEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsst( f_pApiInstance, - pTdmConfig->ulRoutTimeslot, - pTdmConfig->ulRoutStream, - pTdmConfig->ulRoutNumTssts, - cOCT6100_OUTPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fSoutTsstEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsst( f_pApiInstance, - pTdmConfig->ulSoutTimeslot, - pTdmConfig->ulSoutStream, - pTdmConfig->ulSoutNumTssts, - cOCT6100_OUTPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fRinRoutTsiMemEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, - f_pChanIndexConf->usRinRoutTsiMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fSinSoutTsiMemEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, - f_pChanIndexConf->usSinSoutTsiMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /*===============================================================================*/ - - /*===============================================================================*/ - /* Release the previously reserved echo resources .*/ - if( fEchoChanEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseEchoEntry( f_pApiInstance, - f_pChanIndexConf->usEchoChanIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /*===============================================================================*/ - - /*===============================================================================*/ - /* Release the previously reserved resources for the extended tone detection.*/ - if( fExtToneChanEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseEchoEntry( f_pApiInstance, - f_pChanIndexConf->usExtToneChanIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fExtToneTsiEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, - f_pChanIndexConf->usExtToneTsiIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fExtToneMixerEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, - f_pChanIndexConf->usExtToneMixerIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - /*===============================================================================*/ - - /*===============================================================================*/ - /* Release the conversion resources. */ - if( fRinRoutConversionMemEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseConversionMemEntry( f_pApiInstance, - f_pChanIndexConf->usRinRoutConversionMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fSinSoutConversionMemEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseConversionMemEntry( f_pApiInstance, - f_pChanIndexConf->usSinSoutConversionMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /*===============================================================================*/ - - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteChannelStructs - -Description: Performs all the required structure writes to configure the - new echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelOpen Pointer to echo cancellation channel configuration structure. -f_pChanIndexConf Pointer to a structure used to store the multiple resources indexes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteChannelStructs -UINT32 Oct6100ApiWriteChannelStructs( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - OUT tPOCT6100_API_ECHO_CHAN_INDEX f_pChanIndexConf ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_CHANNEL_OPEN_TDM pTdmConfig; - tOCT6100_WRITE_PARAMS WriteParams; - tPOCT6100_API_CHANNEL pChanEntry; - UINT32 ulResult; - UINT32 ulDwordAddress; - UINT32 ulDwordData; - BOOL fConversionEnabled = FALSE; - BOOL fProgramAdpcmMem; - UINT32 ulCompType = 0; - UINT32 ulPcmLaw; - UINT16 usTempTsiMemIndex; - UINT16 usConversionMemIndex; - UINT32 ulToneEventNumber; - BOOL fSSTone; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain a local pointer to the TDM configuration structure.*/ - pTdmConfig = &f_pChannelOpen->TdmConfig; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, f_pChanIndexConf->usEchoChanIndex ); - - /*==============================================================================*/ - /* Configure the Input Tsst control memory.*/ - - /* Set the RIN Tsst control entry.*/ - if ( f_pChanIndexConf->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - f_pChanIndexConf->usRinTsstIndex, - f_pChanIndexConf->usRinRoutTsiMemIndex, - pTdmConfig->ulRinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Set the SIN Tsst control entry.*/ - if ( f_pChanIndexConf->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - f_pChanIndexConf->usSinTsstIndex, - f_pChanIndexConf->usSinSoutTsiMemIndex, - pTdmConfig->ulSinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*==============================================================================*/ - - /*==============================================================================*/ - /* Configure the ADPCM control memory for the Decoder.*/ - - /* Set the codec state flags.*/ - f_pChanIndexConf->fRinRoutCodecActive = FALSE; - f_pChanIndexConf->fSinSoutCodecActive = FALSE; - - if ( f_pChannelOpen->CodecConfig.ulDecoderPort != cOCT6100_NO_DECODING ) - { - fProgramAdpcmMem = TRUE; - - switch( f_pChannelOpen->CodecConfig.ulDecodingRate ) - { - case cOCT6100_G711_64KBPS: - ulCompType = 0x8; - if ( f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - { - if ( pTdmConfig->ulRinPcmLaw == pTdmConfig->ulRoutPcmLaw ) - fProgramAdpcmMem = FALSE; - - /* Check if both ports are assigned. If not, no law conversion needed here.. */ - if ( ( pTdmConfig->ulRinStream == cOCT6100_UNASSIGNED ) - || ( pTdmConfig->ulRoutStream == cOCT6100_UNASSIGNED ) ) - fProgramAdpcmMem = FALSE; - } - else /* f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_SIN */ - { - if ( pTdmConfig->ulSinPcmLaw == pTdmConfig->ulSoutPcmLaw ) - fProgramAdpcmMem = FALSE; - - if ( ( pTdmConfig->ulSinStream == cOCT6100_UNASSIGNED ) - || ( pTdmConfig->ulSoutStream == cOCT6100_UNASSIGNED ) ) - fProgramAdpcmMem = FALSE; - } - break; - case cOCT6100_G726_40KBPS: - ulCompType = 0x3; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_32KBPS: - ulCompType = 0x2; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_24KBPS: - ulCompType = 0x1; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_16KBPS: - ulCompType = 0x0; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_2C_ENCODED: - ulCompType = 0x4; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_3C_ENCODED: - ulCompType = 0x5; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_4C_ENCODED: - ulCompType = 0x6; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_ENCODED: - ulCompType = 0x9; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G711_G726_ENCODED: - ulCompType = 0xA; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G711_G727_2C_ENCODED: - ulCompType = 0xC; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G711_G727_3C_ENCODED: - ulCompType = 0xD; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G711_G727_4C_ENCODED: - ulCompType = 0xE; - fConversionEnabled = TRUE; - break; - default: - return cOCT6100_ERR_FATAL_D4; - } - - if ( fProgramAdpcmMem == TRUE ) - { - /* Set the chariot memory based on the selected port.*/ - if ( f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - { - usTempTsiMemIndex = f_pChanIndexConf->usRinRoutTsiMemIndex; - ulPcmLaw = pTdmConfig->ulRoutPcmLaw; /* Set the law for later use */ - - /* Set the codec state flags.*/ - f_pChanIndexConf->fRinRoutCodecActive = TRUE; - - /* Set the conversion memory index to use for decompression */ - usConversionMemIndex = f_pChanIndexConf->usRinRoutConversionMemIndex; - } - else /* f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_SIN */ - { - usTempTsiMemIndex = f_pChanIndexConf->usSinSoutTsiMemIndex; - ulPcmLaw = pTdmConfig->ulSoutPcmLaw; /* Set the law for later use */ - - /* Set the codec state flags.*/ - f_pChanIndexConf->fSinSoutCodecActive = TRUE; - - /* Set the conversion memory index to use for decompression */ - usConversionMemIndex = f_pChanIndexConf->usSinSoutConversionMemIndex; - } - - ulResult = Oct6100ApiWriteDecoderMemory( f_pApiInstance, - usConversionMemIndex, - ulCompType, - usTempTsiMemIndex, - ulPcmLaw, - f_pChannelOpen->CodecConfig.ulAdpcmNibblePosition ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Configure the ADPCM control memory for the Encoder */ - - if ( f_pChannelOpen->CodecConfig.ulEncoderPort != cOCT6100_NO_ENCODING ) - { - fProgramAdpcmMem = TRUE; - - switch( f_pChannelOpen->CodecConfig.ulEncodingRate ) - { - case cOCT6100_G711_64KBPS: - if ( f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - if ( pTdmConfig->ulRoutPcmLaw == cOCT6100_PCM_U_LAW ) - ulCompType = 0x4; - else - ulCompType = 0x5; - - /* Check for law conversion.*/ - if ( pTdmConfig->ulRinPcmLaw == pTdmConfig->ulRoutPcmLaw ) - fProgramAdpcmMem = FALSE; - - /* Check if both ports are assigned. If not, no law conversion needed here.. */ - if ( ( pTdmConfig->ulRinStream == cOCT6100_UNASSIGNED ) - || ( pTdmConfig->ulRoutStream == cOCT6100_UNASSIGNED ) ) - fProgramAdpcmMem = FALSE; - } - else /* f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - if ( pTdmConfig->ulSoutPcmLaw == cOCT6100_PCM_U_LAW ) - ulCompType = 0x4; - else - ulCompType = 0x5; - - /* Check for law conversion.*/ - if ( pTdmConfig->ulSinPcmLaw == pTdmConfig->ulSoutPcmLaw ) - fProgramAdpcmMem = FALSE; - - /* Check if both ports are assigned. If not, no law conversion needed here.. */ - if ( ( pTdmConfig->ulSinStream == cOCT6100_UNASSIGNED ) - || ( pTdmConfig->ulSoutStream == cOCT6100_UNASSIGNED ) ) - fProgramAdpcmMem = FALSE; - } - - break; - case cOCT6100_G726_40KBPS: - ulCompType = 0x3; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_32KBPS: - ulCompType = 0x2; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_24KBPS: - ulCompType = 0x1; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_16KBPS: - ulCompType = 0x0; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_40KBPS_4_1: - ulCompType = 0xD; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_40KBPS_3_2: - ulCompType = 0xA; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_40KBPS_2_3: - ulCompType = 0x6; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_32KBPS_4_0: - ulCompType = 0xE; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_32KBPS_3_1: - ulCompType = 0xB; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_32KBPS_2_2: - ulCompType = 0x7; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_24KBPS_3_0: - ulCompType = 0xC; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_24KBPS_2_1: - ulCompType = 0x8; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_16KBPS_2_0: - ulCompType = 0x9; - fConversionEnabled = TRUE; - break; - - default: - return cOCT6100_ERR_FATAL_D5; - } - - /* Program the APDCM memory only if ADPCM is requried.*/ - if ( fProgramAdpcmMem == TRUE || f_pChanIndexConf->usPhasingTsstIndex != cOCT6100_INVALID_INDEX ) - { - /* Set the chariot memory based on the selected port.*/ - if ( f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - usTempTsiMemIndex = f_pChanIndexConf->usRinRoutTsiMemIndex; - - /* Set the codec state flags.*/ - f_pChanIndexConf->fRinRoutCodecActive = TRUE; - - /* Set the conversion memory index to use for compression */ - usConversionMemIndex = f_pChanIndexConf->usRinRoutConversionMemIndex; - } - - else /* f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - usTempTsiMemIndex = f_pChanIndexConf->usSinSoutTsiMemIndex; - - /* Set the codec state flags.*/ - f_pChanIndexConf->fSinSoutCodecActive = TRUE; - - /* Set the conversion memory index to use for compression */ - usConversionMemIndex = f_pChanIndexConf->usSinSoutConversionMemIndex; - } - - ulResult = Oct6100ApiWriteEncoderMemory( f_pApiInstance, - usConversionMemIndex, - ulCompType, - usTempTsiMemIndex, - f_pChannelOpen->CodecConfig.fEnableSilenceSuppression, - f_pChannelOpen->CodecConfig.ulAdpcmNibblePosition, - f_pChanIndexConf->usPhasingTsstIndex, - f_pChannelOpen->CodecConfig.ulPhasingType, - f_pChannelOpen->CodecConfig.ulPhase ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Clearing the tone events bit vector */ - - ulDwordAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_pChanIndexConf->usEchoChanIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ); - ulDwordAddress += cOCT6100_CH_MAIN_TONE_EVENT_OFFSET; - ulDwordData = 0x00000000; - - ulResult = Oct6100ApiWriteDword( f_pApiInstance, ulDwordAddress, ulDwordData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulDwordAddress += 4; - - ulResult = Oct6100ApiWriteDword( f_pApiInstance, ulDwordAddress, ulDwordData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Write the VQE memory */ - - ulResult = Oct6100ApiWriteVqeMemory( f_pApiInstance, - &f_pChannelOpen->VqeConfig, - f_pChannelOpen, - f_pChanIndexConf->usEchoChanIndex, - f_pChanIndexConf->usEchoMemIndex, - TRUE, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - /*==============================================================================*/ - /* Write the echo memory */ - - ulResult = Oct6100ApiWriteEchoMemory( f_pApiInstance, - pTdmConfig, - f_pChannelOpen, - f_pChanIndexConf->usEchoMemIndex, - f_pChanIndexConf->usRinRoutTsiMemIndex, - f_pChanIndexConf->usSinSoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - - - /*==============================================================================*/ - /* Mute channel if required, this is done on a port basis */ - - /* Initialize the silence indexes to invalid for now. */ - pChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX; - pChanEntry->usSinSilenceEventIndex = cOCT6100_INVALID_INDEX; - - /* Set the TSI memory indexes. */ - pChanEntry->usRinRoutTsiMemIndex = f_pChanIndexConf->usRinRoutTsiMemIndex; - pChanEntry->usSinSoutTsiMemIndex = f_pChanIndexConf->usSinSoutTsiMemIndex; - - ulResult = Oct6100ApiMutePorts( f_pApiInstance, - f_pChanIndexConf->usEchoChanIndex, - f_pChanIndexConf->usRinTsstIndex, - f_pChanIndexConf->usSinTsstIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Set the dominant speaker to unassigned, if required. */ - - if ( f_pApiInstance->pSharedInfo->ImageInfo.fDominantSpeakerEnabled == TRUE ) - { - ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, f_pChanIndexConf->usEchoChanIndex, cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*==============================================================================*/ - - - /*==============================================================================*/ - /* If necessary, configure the extended tone detection channel.*/ - - if ( f_pChannelOpen->fEnableExtToneDetection == TRUE ) - { - UINT32 ulTempSinLaw; - UINT32 ulTempSoutLaw; - UINT32 ulTempEchoOpMode; - - /* save the original law.*/ - ulTempSinLaw = pTdmConfig->ulSinPcmLaw; - ulTempSoutLaw = pTdmConfig->ulSoutPcmLaw; - ulTempEchoOpMode = f_pChannelOpen->ulEchoOperationMode; - - /* Now, make sure the Sin and Sout law are the same as the Rin law.*/ - - pTdmConfig->ulSinPcmLaw = pTdmConfig->ulRinPcmLaw; - pTdmConfig->ulSoutPcmLaw = pTdmConfig->ulRinPcmLaw; - - f_pChannelOpen->ulEchoOperationMode = cOCT6100_ECHO_OP_MODE_NORMAL; - - /* Write the Echo and VQE memory of the extended channel.*/ - - ulResult = Oct6100ApiWriteDebugChanMemory( f_pApiInstance, - pTdmConfig, - &f_pChannelOpen->VqeConfig, - f_pChannelOpen, - f_pChanIndexConf->usExtToneChanIndex, - f_pChanIndexConf->usExtToneChanIndex, - cOCT6100_API_EXT_TONE_EXTRA_TSI, - f_pChanIndexConf->usExtToneTsiIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now, write the mixer event used to copy the RIN signal of the original channel - into the SIN signal of the exteded channel. */ - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_pChanIndexConf->usExtToneMixerIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - WriteParams.usWriteData |= f_pChanIndexConf->usRinRoutTsiMemIndex; - WriteParams.usWriteData |= pTdmConfig->ulRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = f_pChanIndexConf->usExtToneTsiIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Now insert the Sin copy event into the list.*/ - - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - f_pChanIndexConf->usExtToneMixerIndex, - cOCT6100_EVENT_TYPE_SIN_COPY, - f_pChanIndexConf->usEchoChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*=======================================================================*/ - - /*==============================================================================*/ - /* Clearing the tone events bit vector */ - - ulDwordAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_pChanIndexConf->usExtToneChanIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ); - ulDwordAddress += cOCT6100_CH_MAIN_TONE_EVENT_OFFSET; - ulDwordData = 0x00000000; - - ulResult = Oct6100ApiWriteDword( f_pApiInstance, ulDwordAddress, ulDwordData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulDwordAddress += 4; - - ulResult = Oct6100ApiWriteDword( f_pApiInstance, ulDwordAddress, ulDwordData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - /* Write back the original values in the channel open structure.*/ - - pTdmConfig->ulSinPcmLaw = ulTempSinLaw; - pTdmConfig->ulSoutPcmLaw = ulTempSoutLaw; - - f_pChannelOpen->ulEchoOperationMode = ulTempEchoOpMode; - } - - /*==============================================================================*/ - - - /*==============================================================================*/ - /* If necessary, configure the SS tone detection. */ - - for ( ulToneEventNumber = 0; ulToneEventNumber < cOCT6100_MAX_TONE_EVENT; ulToneEventNumber++ ) - { - /* Check if the current tone is a SS tone. */ - ulResult = Oct6100ApiIsSSTone( - f_pApiInstance, - f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ ulToneEventNumber ].ulToneID, - &fSSTone ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( fSSTone == TRUE ) - { - /* Write to all resources needed to activate tone detection on this SS tone. */ - ulResult = Oct6100ApiWriteToneDetectEvent( - f_pApiInstance, - f_pChanIndexConf->usEchoChanIndex, - ulToneEventNumber, - - cOCT6100_INVALID_INDEX ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Configure the Output Tsst control memory.*/ - - /* Set the ROUT Tsst control entry.*/ - if ( f_pChanIndexConf->usRoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - f_pChanIndexConf->usRoutTsstIndex, - f_pChannelOpen->CodecConfig.ulAdpcmNibblePosition, - pTdmConfig->ulRoutNumTssts, - f_pChanIndexConf->usRinRoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Set the SOUT Tsst control entry.*/ - if ( f_pChanIndexConf->usSoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - f_pChanIndexConf->usSoutTsstIndex, - f_pChannelOpen->CodecConfig.ulAdpcmNibblePosition, - pTdmConfig->ulSoutNumTssts, - f_pChanIndexConf->usSinSoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*==============================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateChannelEntry - -Description: Updates the new channel in the ECHO channel list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pChannelOpen Pointer to echo cancellation channel configuration structure. -f_pChanIndexConf Pointer to a structure used to store the multiple resources indexes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateChannelEntry -UINT32 Oct6100ApiUpdateChannelEntry( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - OUT tPOCT6100_API_ECHO_CHAN_INDEX f_pChanIndexConf ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_CHANNEL_OPEN_TDM pTdmConfig; - tPOCT6100_CHANNEL_OPEN_VQE pVqeConfig; - tPOCT6100_CHANNEL_OPEN_CODEC pCodecConfig; - - /* Obtain a pointer to the config structures of the tPOCT6100_CHANNEL_OPEN structure. */ - pTdmConfig = &f_pChannelOpen->TdmConfig; - pVqeConfig = &f_pChannelOpen->VqeConfig; - pCodecConfig = &f_pChannelOpen->CodecConfig; - - /* Obtain a pointer to the new buffer's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, f_pChanIndexConf->usEchoChanIndex ) - - /*=======================================================================*/ - /* Copy the channel's configuration and allocated resources. */ - pChanEntry->ulUserChanId = f_pChannelOpen->ulUserChanId; - pChanEntry->byEchoOperationMode = (UINT8)( f_pChannelOpen->ulEchoOperationMode & 0xFF ); - pChanEntry->fEnableToneDisabler = (UINT8)( f_pChannelOpen->fEnableToneDisabler & 0xFF ); - pChanEntry->fEnableExtToneDetection = (UINT8)( f_pChannelOpen->fEnableExtToneDetection & 0xFF ); - - /* Save the VQE configuration.*/ - pChanEntry->VqeConfig.byComfortNoiseMode = (UINT8)( pVqeConfig->ulComfortNoiseMode & 0xFF ); - pChanEntry->VqeConfig.fEnableNlp = (UINT8)( pVqeConfig->fEnableNlp & 0xFF ); - pChanEntry->VqeConfig.fEnableTailDisplacement = (UINT8)( pVqeConfig->fEnableTailDisplacement ); - pChanEntry->VqeConfig.usTailDisplacement = (UINT16)( pVqeConfig->ulTailDisplacement & 0xFFFF ); - pChanEntry->VqeConfig.usTailLength = (UINT16)( pVqeConfig->ulTailLength & 0xFFFF ); - - pChanEntry->VqeConfig.fSinDcOffsetRemoval = (UINT8)( pVqeConfig->fSinDcOffsetRemoval & 0xFF ); - pChanEntry->VqeConfig.fRinDcOffsetRemoval = (UINT8)( pVqeConfig->fRinDcOffsetRemoval & 0xFF ); - pChanEntry->VqeConfig.fRinLevelControl = (UINT8)( pVqeConfig->fRinLevelControl & 0xFF ); - pChanEntry->VqeConfig.chRinLevelControlGainDb = (OCT_INT8)( pVqeConfig->lRinLevelControlGainDb & 0xFF ); - pChanEntry->VqeConfig.fSoutLevelControl = (UINT8)( pVqeConfig->fSoutLevelControl & 0xFF ); - pChanEntry->VqeConfig.chSoutLevelControlGainDb = (OCT_INT8)( pVqeConfig->lSoutLevelControlGainDb & 0xFF ); - pChanEntry->VqeConfig.fRinAutomaticLevelControl = (UINT8)( pVqeConfig->fRinAutomaticLevelControl & 0xFF ); - pChanEntry->VqeConfig.chRinAutomaticLevelControlTargetDb = (OCT_INT8)( pVqeConfig->lRinAutomaticLevelControlTargetDb & 0xFF ); - pChanEntry->VqeConfig.fSoutAutomaticLevelControl = (UINT8)( pVqeConfig->fSoutAutomaticLevelControl & 0xFF ); - pChanEntry->VqeConfig.chSoutAutomaticLevelControlTargetDb = (OCT_INT8)( pVqeConfig->lSoutAutomaticLevelControlTargetDb & 0xFF ); - pChanEntry->VqeConfig.fRinHighLevelCompensation = (UINT8)( pVqeConfig->fRinHighLevelCompensation & 0xFF ); - pChanEntry->VqeConfig.chRinHighLevelCompensationThresholdDb = (OCT_INT8)( pVqeConfig->lRinHighLevelCompensationThresholdDb & 0xFF ); - pChanEntry->VqeConfig.fSoutAdaptiveNoiseReduction = (UINT8)( pVqeConfig->fSoutAdaptiveNoiseReduction & 0xFF ); - pChanEntry->VqeConfig.fSoutNoiseBleaching = (UINT8)( pVqeConfig->fSoutNoiseBleaching & 0xFF ); - pChanEntry->VqeConfig.fSoutConferencingNoiseReduction = (UINT8)( pVqeConfig->fSoutConferencingNoiseReduction & 0xFF ); - - pChanEntry->VqeConfig.fAcousticEcho = (UINT8)( pVqeConfig->fAcousticEcho & 0xFF ); - - pChanEntry->VqeConfig.fDtmfToneRemoval = (UINT8)( pVqeConfig->fDtmfToneRemoval & 0xFF ); - - pChanEntry->VqeConfig.chDefaultErlDb = (OCT_INT8)( pVqeConfig->lDefaultErlDb & 0xFF ); - pChanEntry->VqeConfig.chAecDefaultErlDb = (OCT_INT8)( pVqeConfig->lAecDefaultErlDb & 0xFF ); - pChanEntry->VqeConfig.usAecTailLength = (UINT16)( pVqeConfig->ulAecTailLength & 0xFFFF ); - pChanEntry->VqeConfig.byNonLinearityBehaviorA = (UINT8)( pVqeConfig->ulNonLinearityBehaviorA & 0xFF ); - pChanEntry->VqeConfig.byNonLinearityBehaviorB = (UINT8)( pVqeConfig->ulNonLinearityBehaviorB & 0xFF ); - pChanEntry->VqeConfig.byDoubleTalkBehavior = (UINT8)( pVqeConfig->ulDoubleTalkBehavior & 0xFF ); - pChanEntry->VqeConfig.chAnrSnrEnhancementDb = (OCT_INT8)( pVqeConfig->lAnrSnrEnhancementDb & 0xFF ); - pChanEntry->VqeConfig.byAnrVoiceNoiseSegregation = (UINT8)( pVqeConfig->ulAnrVoiceNoiseSegregation & 0xFF ); - pChanEntry->VqeConfig.usToneDisablerVqeActivationDelay = (UINT16)( pVqeConfig->ulToneDisablerVqeActivationDelay & 0xFFFF ); - - pChanEntry->VqeConfig.bySoutAutomaticListenerEnhancementGainDb = (UINT8)( pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb & 0xFF ); - pChanEntry->VqeConfig.bySoutNaturalListenerEnhancementGainDb = (UINT8)( pVqeConfig->ulSoutNaturalListenerEnhancementGainDb & 0xFF ); - pChanEntry->VqeConfig.fSoutNaturalListenerEnhancement = (UINT8)( pVqeConfig->fSoutNaturalListenerEnhancement & 0xFF ); - pChanEntry->VqeConfig.fRoutNoiseReduction = (UINT8)( pVqeConfig->fRoutNoiseReduction & 0xFF ); - pChanEntry->VqeConfig.chRoutNoiseReductionLevelGainDb = (OCT_INT8) (pVqeConfig->lRoutNoiseReductionLevelGainDb & 0xFF); - pChanEntry->VqeConfig.fEnableMusicProtection = (UINT8)( pVqeConfig->fEnableMusicProtection & 0xFF ); - pChanEntry->VqeConfig.fIdleCodeDetection = (UINT8)( pVqeConfig->fIdleCodeDetection & 0xFF ); - - /* Save the codec information.*/ - pChanEntry->CodecConfig.byAdpcmNibblePosition = (UINT8)( pCodecConfig->ulAdpcmNibblePosition & 0xFF ); - - pChanEntry->CodecConfig.byDecoderPort = (UINT8)( pCodecConfig->ulDecoderPort & 0xFF ); - pChanEntry->CodecConfig.byDecodingRate = (UINT8)( pCodecConfig->ulDecodingRate & 0xFF ); - pChanEntry->CodecConfig.byEncoderPort = (UINT8)( pCodecConfig->ulEncoderPort & 0xFF ); - pChanEntry->CodecConfig.byEncodingRate = (UINT8)( pCodecConfig->ulEncodingRate & 0xFF ); - - pChanEntry->CodecConfig.fEnableSilenceSuppression = (UINT8)( pCodecConfig->fEnableSilenceSuppression & 0xFF ); - pChanEntry->CodecConfig.byPhase = (UINT8)( pCodecConfig->ulPhase & 0xFF ); - pChanEntry->CodecConfig.byPhasingType = (UINT8)( pCodecConfig->ulPhasingType & 0xFF ); - - /* Save the RIN settings.*/ - pChanEntry->TdmConfig.byRinPcmLaw = (UINT8)( pTdmConfig->ulRinPcmLaw & 0xFF ); - pChanEntry->TdmConfig.usRinTimeslot = (UINT16)( pTdmConfig->ulRinTimeslot & 0xFFFF ); - pChanEntry->TdmConfig.usRinStream = (UINT16)( pTdmConfig->ulRinStream & 0xFFFF ); - - /* Save the SIN settings.*/ - pChanEntry->TdmConfig.bySinPcmLaw = (UINT8)( pTdmConfig->ulSinPcmLaw & 0xFF ); - pChanEntry->TdmConfig.usSinTimeslot = (UINT16)( pTdmConfig->ulSinTimeslot & 0xFFFF ); - pChanEntry->TdmConfig.usSinStream = (UINT16)( pTdmConfig->ulSinStream & 0xFFFF ); - - /* Save the ROUT settings.*/ - pChanEntry->TdmConfig.byRoutPcmLaw = (UINT8)( pTdmConfig->ulRoutPcmLaw & 0xFF ); - pChanEntry->TdmConfig.usRoutTimeslot = (UINT16)( pTdmConfig->ulRoutTimeslot & 0xFFFF ); - pChanEntry->TdmConfig.usRoutStream = (UINT16)( pTdmConfig->ulRoutStream & 0xFFFF ); - - pChanEntry->TdmConfig.usRoutBrdcastTsstFirstEntry = cOCT6100_INVALID_INDEX; - pChanEntry->TdmConfig.usRoutBrdcastTsstNumEntry = 0; - - /* Save the SOUT settings.*/ - pChanEntry->TdmConfig.bySoutPcmLaw = (UINT8)( pTdmConfig->ulSoutPcmLaw & 0xFF ); - pChanEntry->TdmConfig.usSoutTimeslot = (UINT16)( pTdmConfig->ulSoutTimeslot & 0xFFFF ); - pChanEntry->TdmConfig.usSoutStream = (UINT16)( pTdmConfig->ulSoutStream & 0xFFFF ); - - pChanEntry->TdmConfig.byRinNumTssts = (UINT8)( pTdmConfig->ulRinNumTssts & 0xFF ); - pChanEntry->TdmConfig.bySinNumTssts = (UINT8)( pTdmConfig->ulSinNumTssts & 0xFF ); - pChanEntry->TdmConfig.byRoutNumTssts = (UINT8)( pTdmConfig->ulRoutNumTssts & 0xFF ); - pChanEntry->TdmConfig.bySoutNumTssts = (UINT8)( pTdmConfig->ulSoutNumTssts & 0xFF ); - pChanEntry->TdmConfig.usSoutBrdcastTsstFirstEntry = cOCT6100_INVALID_INDEX; - pChanEntry->TdmConfig.usSoutBrdcastTsstNumEntry = 0; - - /* Save the extended Tone detection information.*/ - pChanEntry->usExtToneChanIndex = f_pChanIndexConf->usExtToneChanIndex; - pChanEntry->usExtToneMixerIndex = f_pChanIndexConf->usExtToneMixerIndex; - pChanEntry->usExtToneTsiIndex = f_pChanIndexConf->usExtToneTsiIndex; - - if ( f_pChannelOpen->fEnableExtToneDetection == TRUE ) - { - tPOCT6100_API_CHANNEL pExtToneChanEntry; - - /* Set the mode of the original channel. He is the channel performing detection on the - SIN port. The extended channel will perform detection on the RIN port.*/ - pChanEntry->ulExtToneChanMode = cOCT6100_API_EXT_TONE_SIN_PORT_MODE; - - /* Now, program the associated channel.*/ - - /* Obtain a pointer to the extended tone detection channel entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pExtToneChanEntry, f_pChanIndexConf->usExtToneChanIndex ); - - pExtToneChanEntry->fReserved = TRUE; - pExtToneChanEntry->ulExtToneChanMode = cOCT6100_API_EXT_TONE_RIN_PORT_MODE; /* Detect on RIN port.*/ - pExtToneChanEntry->usExtToneChanIndex = f_pChanIndexConf->usEchoChanIndex; - - pExtToneChanEntry->aulToneConf[ 0 ] = 0; - pExtToneChanEntry->aulToneConf[ 1 ] = 0; - - } - else - { - /* No extended tone detection supported.*/ - pChanEntry->ulExtToneChanMode = cOCT6100_API_EXT_TONE_DISABLED; - } - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Store hardware related information.*/ - pChanEntry->usRinRoutTsiMemIndex = f_pChanIndexConf->usRinRoutTsiMemIndex; - pChanEntry->usSinSoutTsiMemIndex = f_pChanIndexConf->usSinSoutTsiMemIndex; - pChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX; - pChanEntry->usExtraRinTsiMemIndex = cOCT6100_INVALID_INDEX; - - /* We are not being tapped for now. */ - pChanEntry->fBeingTapped = FALSE; - - pChanEntry->usTapChanIndex = cOCT6100_INVALID_INDEX; - pChanEntry->usTapBridgeIndex = cOCT6100_INVALID_INDEX; - - /* The copy event has not yet been created. */ - pChanEntry->fCopyEventCreated = FALSE; - - pChanEntry->usRinRoutConversionMemIndex = f_pChanIndexConf->usRinRoutConversionMemIndex; - pChanEntry->usSinSoutConversionMemIndex = f_pChanIndexConf->usSinSoutConversionMemIndex; - - pChanEntry->usPhasingTsstIndex = f_pChanIndexConf->usPhasingTsstIndex; - - pChanEntry->fSinSoutCodecActive = f_pChanIndexConf->fSinSoutCodecActive; - pChanEntry->fRinRoutCodecActive = f_pChanIndexConf->fRinRoutCodecActive; - - - - pChanEntry->usEchoMemIndex = f_pChanIndexConf->usEchoMemIndex; - - pChanEntry->usRinTsstIndex = f_pChanIndexConf->usRinTsstIndex; - pChanEntry->usSinTsstIndex = f_pChanIndexConf->usSinTsstIndex; - pChanEntry->usRoutTsstIndex = f_pChanIndexConf->usRoutTsstIndex; - pChanEntry->usSoutTsstIndex = f_pChanIndexConf->usSoutTsstIndex; - - pChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX; - pChanEntry->usSoutCopyEventIndex = cOCT6100_INVALID_INDEX; - - /* Nothing muted for now. */ - pChanEntry->usMutedPorts = cOCT6100_CHANNEL_MUTE_PORT_NONE; - - /* Set all the GW feature initial value.*/ - /* Bridge info */ - pChanEntry->usBridgeIndex = cOCT6100_INVALID_INDEX; - pChanEntry->fMute = FALSE; - - pChanEntry->usLoadEventIndex = cOCT6100_INVALID_INDEX; - pChanEntry->usSubStoreEventIndex = cOCT6100_INVALID_INDEX; - - /* Buffer playout info.*/ - pChanEntry->fRinBufPlaying = FALSE; - pChanEntry->fSoutBufPlaying = FALSE; - - /* Tone detection state. */ - /* This array is configured as follow.*/ - /* Index 0 contain event 0 to 31 (msb = event 31) and Index 1 contain index 32 - 55 */ - pChanEntry->aulToneConf[ 0 ] = 0; - pChanEntry->aulToneConf[ 1 ] = 0; - pChanEntry->ulLastSSToneDetected = (PTR_TYPE)cOCT6100_INVALID_VALUE; - pChanEntry->ulLastSSToneTimestamp = (PTR_TYPE)cOCT6100_INVALID_VALUE; - - /* Initialize the bidirectional flag.*/ - pChanEntry->fBiDirChannel = FALSE; - - /*=======================================================================*/ - /* Init some of the stats.*/ - - pChanEntry->sMaxERL = cOCT6100_INVALID_SIGNED_STAT_W; - pChanEntry->sMaxERLE = cOCT6100_INVALID_SIGNED_STAT_W; - pChanEntry->usMaxEchoDelay = cOCT6100_INVALID_STAT_W; - pChanEntry->usNumEchoPathChangesOfst = 0; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Update the dependency of the phasing TSST if one is associated to the chanel.*/ - - if ( f_pChanIndexConf->usPhasingTsstIndex != cOCT6100_INVALID_INDEX ) - { - tPOCT6100_API_PHASING_TSST pPhasingEntry; - - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pPhasingEntry, f_pChanIndexConf->usPhasingTsstIndex ); - - pPhasingEntry->usDependencyCnt++; - } - /*=======================================================================*/ - - /*=======================================================================*/ - - /* Form handle returned to user. */ - *f_pChannelOpen->pulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | (pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_pChanIndexConf->usEchoChanIndex; - - /* Finally, mark the channel as open. */ - pChanEntry->fReserved = TRUE; - pChanEntry->usExtraSinTsiDependencyCnt = 0; - - /* Increment the number of channel open.*/ - f_pApiInstance->pSharedInfo->ChipStats.usNumberChannels++; - - /*=======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelCloseSer - -Description: Closes a echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelClose Pointer to echo cancellation channel close structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelCloseSer -UINT32 Oct6100ChannelCloseSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_CLOSE f_pChannelClose ) -{ - UINT16 usChannelIndex; - - - UINT32 ulResult; - - /* Verify that all the parameters given match the state of the API. */ - ulResult = Oct6100ApiAssertChannelParams( f_pApiInstance, - f_pChannelClose, - - &usChannelIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the echo cancellation channel. */ - ulResult = Oct6100ApiInvalidateChannelStructs( f_pApiInstance, - - usChannelIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the echo cancellation channel. */ - ulResult = Oct6100ApiReleaseChannelResources( f_pApiInstance, usChannelIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Invalidate the handle.*/ - f_pChannelClose->ulChannelHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertChannelParams - -Description: Validate the handle given by the user and verify the state of - the channel about to be closed. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelClose Pointer to echo cancellation channel close structure. -f_pulFpgaChanIndex Pointer to the FPGA channel index associated to this channel. -f_pusChanIndex Pointer to the index of the channel within the API instance. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertChannelParams -UINT32 Oct6100ApiAssertChannelParams( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_CLOSE f_pChannelClose, - - IN OUT PUINT16 f_pusChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry; - UINT32 ulEntryOpenCnt; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check the provided handle. */ - if ( (f_pChannelClose->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - *f_pusChanIndex = (UINT16)( f_pChannelClose->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChanIndex >= pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, *f_pusChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pChannelClose->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - if ( pChanEntry->fBiDirChannel == TRUE ) - return cOCT6100_ERR_CHANNEL_PART_OF_BIDIR_CHANNEL; - - /*=======================================================================*/ - - /* Check if the channel is bound to a bridge. */ - if ( pChanEntry->usBridgeIndex != cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CHANNEL_ACTIVE_DEPENDENCIES; - - - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInvalidateChannelStructs - -Description: Closes a echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulFpgaChanIndex Index of the channel within the SCN_PLC FPGA. -f_usChanIndex Index of the channel within the API instance. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInvalidateChannelStructs -UINT32 Oct6100ApiInvalidateChannelStructs( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - - IN UINT16 f_usChanIndex ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_API_CHANNEL_TDM pTdmConfig; - tPOCT6100_API_TSST_ENTRY pTsstEntry; - tOCT6100_BUFFER_PLAYOUT_STOP BufferPlayoutStop; - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_WRITE_SMEAR_PARAMS SmearParams; - UINT32 ulResult; - UINT16 usCurrentEntry; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ); - - /* Obtain local pointer to the TDM configuration of the channel */ - pTdmConfig = &pChanEntry->TdmConfig; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - SmearParams.pProcessContext = f_pApiInstance->pProcessContext; - - SmearParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* If this channel is currently debugged, automatically close the debug channel. */ - if ( ( pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE ) - && ( pSharedInfo->DebugInfo.usCurrentDebugChanIndex == f_usChanIndex ) ) - { - tOCT6100_DEBUG_SELECT_CHANNEL SelectDebugChan; - - /* Ensure forward compatibility. */ - Oct6100DebugSelectChannelDef( &SelectDebugChan ); - - /* Set the hot channel to an invalid handle to disable recording. */ - SelectDebugChan.ulChannelHndl = cOCT6100_INVALID_HANDLE; - - /* Call the serialized fonction. */ - ulResult = Oct6100DebugSelectChannelSer( f_pApiInstance, &SelectDebugChan, FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Deactivate the TSST control memory if used. */ - - /* RIN port.*/ - if ( pTdmConfig->usRinTimeslot != cOCT6100_UNASSIGNED ) - { - /* Deactivate the TSST entry.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( pChanEntry->usRinTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* SIN port.*/ - if ( pTdmConfig->usSinTimeslot != cOCT6100_UNASSIGNED ) - { - /* Deactivate the TSST entry.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( pChanEntry->usSinTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*=======================================================================*/ - /* ROUT port.*/ - - if ( pTdmConfig->usRoutTimeslot != cOCT6100_UNASSIGNED ) - { - /* Deactivate the TSST entry.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( pChanEntry->usRoutTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Now the broadcast TSST.*/ - usCurrentEntry = pTdmConfig->usRoutBrdcastTsstFirstEntry; - while( usCurrentEntry != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_TSST_LIST_ENTRY_PNT( pSharedInfo, pTsstEntry, usCurrentEntry ); - - /* Deactivate the TSST entry.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( (pTsstEntry->usTsstMemoryIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move to the next entry.*/ - usCurrentEntry = pTsstEntry->usNextEntry; - } - /*=======================================================================*/ - - /*=======================================================================*/ - /* SOUT port.*/ - - if ( pTdmConfig->usSoutTimeslot != cOCT6100_UNASSIGNED ) - { - /* Deactivate the TSST entry.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( pChanEntry->usSoutTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Now the broadcast TSST.*/ - usCurrentEntry = pTdmConfig->usSoutBrdcastTsstFirstEntry; - while( usCurrentEntry != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_TSST_LIST_ENTRY_PNT( pSharedInfo, pTsstEntry, usCurrentEntry ); - - /* Deactivate the TSST entry.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( (pTsstEntry->usTsstMemoryIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move to the next entry.*/ - usCurrentEntry = pTsstEntry->usNextEntry; - } - /*=======================================================================*/ - - - /*------------------------------------------------------------------------------*/ - /* Deactivate the ECHO control memory entry.*/ - - /* Set the input Echo control entry to unused.*/ - WriteParams.ulWriteAddress = cOCT6100_ECHO_CONTROL_MEM_BASE + ( pChanEntry->usEchoMemIndex * cOCT6100_ECHO_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x85FF; /* TSI index 1535 reserved for power-down mode */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = 0xC5FF; /* TSI index 1535 reserved for power-down mode */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*------------------------------------------------------------------------------*/ - - /*------------------------------------------------------------------------------*/ - /* Deactivate the conversion control memories if used. */ - - if ( pChanEntry->usRinRoutConversionMemIndex != cOCT6100_INVALID_INDEX ) - { - /* Rin/Rout stream conversion memory was used */ - ulResult = Oct6100ApiClearConversionMemory( f_pApiInstance, pChanEntry->usRinRoutConversionMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - if ( pChanEntry->usSinSoutConversionMemIndex != cOCT6100_INVALID_INDEX ) - { - /* Sin/Sout stream conversion memory was used */ - ulResult = Oct6100ApiClearConversionMemory( f_pApiInstance, pChanEntry->usSinSoutConversionMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*------------------------------------------------------------------------------*/ - - - /*------------------------------------------------------------------------------*/ - /* Clear the silence copy events if they were created. */ - - /* Unmute the Rin port if it was muted. */ - if ( pChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pChanEntry->usRinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pChanEntry->usRinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_DF; - - pChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - - /* Unmute the Sin port if it was muted. */ - if ( pChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pChanEntry->usSinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pChanEntry->usSinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_E0; - - pChanEntry->usSinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - - /*------------------------------------------------------------------------------*/ - - /* Synch all the buffer playout field.*/ - if ( pSharedInfo->ImageInfo.fBufferPlayout == TRUE ) - { - Oct6100BufferPlayoutStopDef( &BufferPlayoutStop ); - - BufferPlayoutStop.ulChannelHndl = cOCT6100_INVALID_HANDLE; - BufferPlayoutStop.fStopCleanly = FALSE; - - BufferPlayoutStop.ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; - ulResult = Oct6100ApiInvalidateChanPlayoutStructs( - f_pApiInstance, - &BufferPlayoutStop, - f_usChanIndex, - pChanEntry->usEchoMemIndex - - ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - BufferPlayoutStop.ulPlayoutPort = cOCT6100_CHANNEL_PORT_SOUT; - ulResult = Oct6100ApiInvalidateChanPlayoutStructs( - f_pApiInstance, - &BufferPlayoutStop, - f_usChanIndex, - pChanEntry->usEchoMemIndex - - ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - - - - - /* Free all resources reserved for extended tone detection.*/ - if ( pChanEntry->fEnableExtToneDetection == TRUE ) - { - /*------------------------------------------------------------------------------*/ - /* Deactivate the ECHO control memory entry of the extended channel.*/ - - /* Set the input Echo control entry to unused.*/ - WriteParams.ulWriteAddress = cOCT6100_ECHO_CONTROL_MEM_BASE + ( pChanEntry->usExtToneChanIndex * cOCT6100_ECHO_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x85FF; /* TSI index 1535 reserved for power-down mode */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = 0xC5FF; /* TSI index 1535 reserved for power-down mode */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*------------------------------------------------------------------------------*/ - - /*------------------------------------------------------------------------------*/ - /* Remove the mixer event used to copy the RIN signal to the SIN port of the extended - channel.*/ - - /* Clear the Copy event.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pChanEntry->usExtToneMixerIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pChanEntry->usExtToneMixerIndex, - cOCT6100_EVENT_TYPE_SIN_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - - } - - /*------------------------------------------------------------------------------*/ - /* Reset PGSP */ - - WriteParams.ulWriteAddress = cOCT6100_CHANNEL_ROOT_BASE + ( pChanEntry->usEchoMemIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst; - WriteParams.usWriteData = 0x0800; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - - /*------------------------------------------------------------------------------*/ - /* Clear the mute with feature bit. */ - - if ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) != 0x0 ) - { - ulResult = Oct6100ApiMuteSinWithFeatures( f_pApiInstance, f_usChanIndex, FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*------------------------------------------------------------------------------*/ - - /*------------------------------------------------------------------------------*/ - /* Clear the VQE memory. */ - - SmearParams.ulWriteAddress = cOCT6100_CHANNEL_ROOT_BASE + ( pChanEntry->usEchoMemIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst + 0x20; - SmearParams.usWriteData = 0x0000; - SmearParams.ulWriteLength = 2; - - mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - /*------------------------------------------------------------------------------*/ - /* Clear the NLP memory. */ - - SmearParams.ulWriteAddress = cOCT6100_CHANNEL_ROOT_BASE + ( pChanEntry->usEchoMemIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst + 0x28; - SmearParams.usWriteData = 0x0000; - SmearParams.ulWriteLength = 2; - - mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - /* Clear the AF information memory. */ - - SmearParams.ulWriteAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( pChanEntry->usEchoMemIndex * f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemSize ) + f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoMemOfst; - SmearParams.usWriteData = 0x0000; - SmearParams.ulWriteLength = 12; - - mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*Reset ALC status*/ - WriteParams.ulWriteAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( pChanEntry->usEchoMemIndex * f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemSize ) + f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoMemOfst + 0x3A; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseChannelResources - -Description: Release and clear the API entry associated to the echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usChannelIndex Index of the echo cancellation channel in the API list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseChannelResources -UINT32 Oct6100ApiReleaseChannelResources( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChannelIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_API_CHANNEL_TDM pTdmConfig; - tPOCT6100_API_TSST_ENTRY pTsstEntry; - UINT32 ulResult; - UINT16 usCurrentEntry; - UINT32 ulTimeslot; - UINT32 ulStream; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChannelIndex ); - - /* Obtain local pointer to the TDM configurationof the channel */ - pTdmConfig = &pChanEntry->TdmConfig; - - /* Release the two TSI chariot memory entries.*/ - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pChanEntry->usRinRoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_2; - - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pChanEntry->usSinSoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_3; - - /* Now release the ECHO channel and control memory entries.*/ - ulResult = Oct6100ApiReleaseEchoEntry( f_pApiInstance, f_usChannelIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_4; - - /* Release the conversion resources.*/ - if ( pChanEntry->usRinRoutConversionMemIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiReleaseConversionMemEntry( f_pApiInstance, pChanEntry->usRinRoutConversionMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_B9; - - pChanEntry->usRinRoutConversionMemIndex = cOCT6100_INVALID_INDEX; - } - - if ( pChanEntry->usSinSoutConversionMemIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiReleaseConversionMemEntry( f_pApiInstance, pChanEntry->usSinSoutConversionMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_BA; - - pChanEntry->usSinSoutConversionMemIndex = cOCT6100_INVALID_INDEX; - } - - /*=========================================================================*/ - /* Release the TSST control memory entries if any were reserved.*/ - if ( pTdmConfig->usRinTimeslot != cOCT6100_UNASSIGNED) - { - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pTdmConfig->usRinTimeslot, - pTdmConfig->usRinStream, - pTdmConfig->byRinNumTssts, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_5; - } - - if ( pTdmConfig->usSinTimeslot != cOCT6100_UNASSIGNED) - { - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pTdmConfig->usSinTimeslot, - pTdmConfig->usSinStream, - pTdmConfig->bySinNumTssts, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_6; - } - - /*=======================================================================*/ - /* Release all the TSSTs associated to the ROUT port of this channel. */ - if ( pTdmConfig->usRoutTimeslot != cOCT6100_UNASSIGNED) - { - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pTdmConfig->usRoutTimeslot, - pTdmConfig->usRoutStream, - pTdmConfig->byRoutNumTssts, - cOCT6100_OUTPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_7; - } - - /* Now release the Broadcast TSSTs. */ - usCurrentEntry = pTdmConfig->usRoutBrdcastTsstFirstEntry; - while( usCurrentEntry != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_TSST_LIST_ENTRY_PNT( pSharedInfo, pTsstEntry, usCurrentEntry ); - - ulTimeslot = pTsstEntry->usTsstValue >> 5; - ulStream = pTsstEntry->usTsstValue & 0x1F; - - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - ulTimeslot, - ulStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_OUTPUT_TSST, - usCurrentEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_8; - - /* Move to the next entry.*/ - usCurrentEntry = pTsstEntry->usNextEntry; - - /* Invalidate the current entry.*/ - pTsstEntry->usTsstMemoryIndex = 0xFFFF; - pTsstEntry->usTsstValue = 0xFFFF; - pTsstEntry->usNextEntry = cOCT6100_INVALID_INDEX; - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Release all the TSSTs associated to the SOUT port of this channel. */ - if ( pTdmConfig->usSoutTimeslot != cOCT6100_UNASSIGNED) - { - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pTdmConfig->usSoutTimeslot, - pTdmConfig->usSoutStream, - pTdmConfig->bySoutNumTssts, - cOCT6100_OUTPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_9; - } - - /* Now release the Broadcast TSSTs. */ - usCurrentEntry = pTdmConfig->usSoutBrdcastTsstFirstEntry; - while( usCurrentEntry != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_TSST_LIST_ENTRY_PNT( pSharedInfo, pTsstEntry, usCurrentEntry ); - - ulTimeslot = pTsstEntry->usTsstValue >> 5; - ulStream = pTsstEntry->usTsstValue & 0x1F; - - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - ulTimeslot, - ulStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_OUTPUT_TSST, - usCurrentEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_A; - - /* Move to the next entry.*/ - usCurrentEntry = pTsstEntry->usNextEntry; - - /* Invalidate the current entry.*/ - pTsstEntry->usTsstMemoryIndex = 0xFFFF; - pTsstEntry->usTsstValue = 0xFFFF; - pTsstEntry->usNextEntry = cOCT6100_INVALID_INDEX; - } - /*=======================================================================*/ - - /*=======================================================================*/ - /* Update the dependency of the phasing TSST if one is associated to the chanel.*/ - - if ( pChanEntry->usPhasingTsstIndex != cOCT6100_INVALID_INDEX ) - { - tPOCT6100_API_PHASING_TSST pPhasingEntry; - - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pPhasingEntry, pChanEntry->usPhasingTsstIndex ); - - pPhasingEntry->usDependencyCnt--; - } - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Release any resources reserved for the extended tone detection.*/ - - if ( pChanEntry->fEnableExtToneDetection == TRUE ) - { - tPOCT6100_API_CHANNEL pExtToneChanEntry; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pExtToneChanEntry, pChanEntry->usExtToneChanIndex ); - - /* Release the ECHO channel and control memory entries.*/ - ulResult = Oct6100ApiReleaseEchoEntry( f_pApiInstance, pChanEntry->usExtToneChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_C1; - - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pChanEntry->usExtToneTsiIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_C2; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pChanEntry->usExtToneMixerIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_C3; - - /* Now release the channel entry */ - pExtToneChanEntry->ulExtToneChanMode = cOCT6100_API_EXT_TONE_DISABLED; - pExtToneChanEntry->fReserved = FALSE; - - /* Set the current entry to disable, just in case.*/ - pChanEntry->ulExtToneChanMode = cOCT6100_API_EXT_TONE_DISABLED; - } - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Update the channel's list entry. */ - - /* Clear the NLP dword array. */ - Oct6100UserMemSet( pChanEntry->aulNlpConfDword, 0, sizeof( pChanEntry->aulNlpConfDword ) ); - - /* Clear the echo operation mode. */ - pChanEntry->byEchoOperationMode = cOCT6100_ECHO_OP_MODE_POWER_DOWN; - - /* Mark the channel as closed. */ - pChanEntry->fReserved = FALSE; - pChanEntry->byEntryOpenCnt++; - - /* Reset the port, the bridge and BidirInfo */ - pChanEntry->usMutedPorts = cOCT6100_CHANNEL_MUTE_PORT_NONE; - pChanEntry->fBiDirChannel = FALSE; - pChanEntry->usBridgeIndex = cOCT6100_INVALID_INDEX; - - /* Decrement the number of channel open.*/ - f_pApiInstance->pSharedInfo->ChipStats.usNumberChannels--; - - /*=======================================================================*/ - - return cOCT6100_ERR_OK; - -} -#endif - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelModifySer - -Description: Modify an echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelModify Pointer to channel configuration structure. The handle - identifying the buffer in all future function calls is - returned in this structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelModifySer -UINT32 Oct6100ChannelModifySer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_MODIFY f_pChannelModify ) -{ - UINT16 usChanIndex; - UINT32 ulResult; - UINT16 usNewRinTsstIndex; - UINT16 usNewSinTsstIndex; - UINT16 usNewRoutTsstIndex; - UINT16 usNewSoutTsstIndex; - UINT8 fSinSoutCodecActive = FALSE; - UINT8 fRinRoutCodecActive = FALSE; - UINT16 usNewPhasingTsstIndex; - tOCT6100_CHANNEL_OPEN *pTempChanOpen; - - /* We don't want this 290 byte structure on the stack */ - pTempChanOpen = kmalloc(sizeof(*pTempChanOpen), GFP_ATOMIC); - if (!pTempChanOpen) - return cOCT6100_ERR_FATAL_0; - - /* Check the user's configuration of the echo cancellation channel for errors. */ - ulResult = Oct6100ApiCheckChannelModify( f_pApiInstance, - f_pChannelModify, - pTempChanOpen, - &usNewPhasingTsstIndex, - &usChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - goto out; - - /* Reserve all resources needed by the echo cancellation channel. */ - ulResult = Oct6100ApiModifyChannelResources( f_pApiInstance, - f_pChannelModify, - usChanIndex, - &usNewRinTsstIndex, - &usNewSinTsstIndex, - &usNewRoutTsstIndex, - &usNewSoutTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - goto out; - - /* Write all necessary structures to activate the echo cancellation channel. */ - ulResult = Oct6100ApiModifyChannelStructs( f_pApiInstance, - f_pChannelModify, - pTempChanOpen, - usChanIndex, - usNewPhasingTsstIndex, - &fSinSoutCodecActive, - &fRinRoutCodecActive, - usNewRinTsstIndex, - usNewSinTsstIndex, - usNewRoutTsstIndex, - usNewSoutTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - goto out; - - /* Update the new echo cancellation channels's entry in the ECHO channel list. */ - ulResult = Oct6100ApiModifyChannelEntry( f_pApiInstance, - f_pChannelModify, - pTempChanOpen, - usChanIndex, - usNewPhasingTsstIndex, - fSinSoutCodecActive, - fRinRoutCodecActive, - usNewRinTsstIndex, - usNewSinTsstIndex, - usNewRoutTsstIndex, - usNewSoutTsstIndex ); -out: - kfree(pTempChanOpen); - - return ulResult; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckChannelModify - -Description: Checks the user's echo cancellation channel modify structure for errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelModify Pointer to echo cancellation channel modify structure. -f_pTempChanOpen Pointer to a channel open structure. -f_pusNewPhasingTsstIndex Pointer to a new phasing TSST index within the API instance. -f_pusChanIndex Pointer to the channel index within the API instance channel list - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckChannelModify -UINT32 Oct6100ApiCheckChannelModify( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_MODIFY f_pChannelModify, - IN tPOCT6100_CHANNEL_OPEN f_pTempChanOpen, - OUT PUINT16 f_pusNewPhasingTsstIndex, - OUT PUINT16 f_pusChanIndex ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - UINT32 ulResult; - UINT32 ulEntryOpenCnt; - UINT32 ulDecoderNumTssts; - - /* Check the provided handle. */ - if ( (f_pChannelModify->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - *f_pusChanIndex = (UINT16)( f_pChannelModify->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChanIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, *f_pusChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pChannelModify->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Check the general modify parameters. */ - - if ( f_pChannelModify->ulEchoOperationMode != cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_NORMAL && - f_pChannelModify->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_HT_FREEZE && - f_pChannelModify->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_HT_RESET && - f_pChannelModify->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_POWER_DOWN && - f_pChannelModify->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_EXTERNAL && - f_pChannelModify->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION && - f_pChannelModify->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_NO_ECHO ) - return cOCT6100_ERR_CHANNEL_ECHO_OP_MODE; - - /* Check the 2100Hz echo disabling configuration.*/ - if ( f_pChannelModify->fEnableToneDisabler != cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->fEnableToneDisabler != TRUE && - f_pChannelModify->fEnableToneDisabler != FALSE ) - return cOCT6100_ERR_CHANNEL_TONE_DISABLER_ENABLE; - - /* Check the disable tone detection flag. */ - if ( f_pChannelModify->fDisableToneDetection != TRUE && - f_pChannelModify->fDisableToneDetection != FALSE ) - return cOCT6100_ERR_CHANNEL_DISABLE_TONE_DETECTION; - - /* Check the stop buffer playout flag. */ - if ( f_pChannelModify->fStopBufferPlayout != TRUE && - f_pChannelModify->fStopBufferPlayout != FALSE ) - return cOCT6100_ERR_CHANNEL_STOP_BUFFER_PLAYOUT; - - /* Check the remove conference bridge participant flag. */ - if ( f_pChannelModify->fRemoveConfBridgeParticipant != TRUE && - f_pChannelModify->fRemoveConfBridgeParticipant != FALSE ) - return cOCT6100_ERR_CHANNEL_REMOVE_CONF_BRIDGE_PARTICIPANT; - - /* Check the remove broadcast timeslots flag. */ - if ( f_pChannelModify->fRemoveBroadcastTssts != TRUE && - f_pChannelModify->fRemoveBroadcastTssts != FALSE ) - return cOCT6100_ERR_CHANNEL_REMOVE_BROADCAST_TSSTS; - - if ( f_pChannelModify->fCodecConfigModified != TRUE && - f_pChannelModify->fCodecConfigModified != FALSE ) - return cOCT6100_ERR_CHANNEL_MODIFY_CODEC_CONFIG; - - if ( f_pChannelModify->fVqeConfigModified != TRUE && - f_pChannelModify->fVqeConfigModified != FALSE ) - return cOCT6100_ERR_CHANNEL_MODIFY_VQE_CONFIG; - - if ( f_pChannelModify->fTdmConfigModified != TRUE && - f_pChannelModify->fTdmConfigModified != FALSE ) - return cOCT6100_ERR_CHANNEL_MODIFY_TDM_CONFIG; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Verify if any law change was requested. If so reprogram all structures.*/ - - if (( f_pChannelModify->fTdmConfigModified == TRUE ) && - ( f_pChannelModify->TdmConfig.ulRinPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING || - f_pChannelModify->TdmConfig.ulSinPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING || - f_pChannelModify->TdmConfig.ulRoutPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING || - f_pChannelModify->TdmConfig.ulSoutPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING )) - { - f_pChannelModify->fVqeConfigModified = TRUE; - f_pChannelModify->fCodecConfigModified = TRUE; - } - /*=======================================================================*/ - - ulResult = Oct6100ApiUpdateOpenStruct( f_pApiInstance, f_pChannelModify, f_pTempChanOpen, pChanEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* All further check will now be performed using the TempOpenChan structure in order - to reuse the checks written for the open channel structure.*/ - - - - /* Check the TDM config.*/ - if ( f_pChannelModify->fTdmConfigModified == TRUE ) - { - tPOCT6100_CHANNEL_MODIFY_TDM pModifyTdm; - tPOCT6100_CHANNEL_OPEN_TDM pOpenTdm; - - pModifyTdm = &f_pChannelModify->TdmConfig; - pOpenTdm = &f_pTempChanOpen->TdmConfig; - - ulResult = Oct6100ApiCheckTdmConfig( f_pApiInstance, - pOpenTdm ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if that Stream and Timeslot values are valid.*/ - - /* Check the RIN port.*/ - if ( f_pChannelModify->TdmConfig.ulRinStream == cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulRinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - return cOCT6100_ERR_CHANNEL_RIN_TIMESLOT; - - if ( f_pChannelModify->TdmConfig.ulRinStream != cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulRinTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - return cOCT6100_ERR_CHANNEL_RIN_STREAM; - - if ( pChanEntry->fBeingTapped == TRUE ) - { - /* Check that the Rin stream + timeslot are not being assigned. */ - if ( f_pChannelModify->TdmConfig.ulRinStream != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( f_pChannelModify->TdmConfig.ulRinStream != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_RIN_STREAM; - - if ( f_pChannelModify->TdmConfig.ulRinTimeslot != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_RIN_TIMESLOT; - } - } - - /* Check the SIN port.*/ - if ( f_pChannelModify->TdmConfig.ulSinStream == cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulSinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - return cOCT6100_ERR_CHANNEL_SIN_TIMESLOT; - - if ( f_pChannelModify->TdmConfig.ulSinStream != cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulSinTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - return cOCT6100_ERR_CHANNEL_SIN_STREAM; - - /* Check the ROUT port.*/ - if ( f_pChannelModify->TdmConfig.ulRoutStream == cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulRoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - return cOCT6100_ERR_CHANNEL_ROUT_TIMESLOT; - - if ( f_pChannelModify->TdmConfig.ulRoutStream != cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulRoutTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - return cOCT6100_ERR_CHANNEL_ROUT_STREAM; - - /* Check the SOUT port.*/ - if ( f_pChannelModify->TdmConfig.ulSoutStream == cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulSoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - return cOCT6100_ERR_CHANNEL_SOUT_TIMESLOT; - - if ( f_pChannelModify->TdmConfig.ulSoutStream != cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulSoutTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - return cOCT6100_ERR_CHANNEL_SOUT_STREAM; - - /* Verify if the channel is currently part of a bidirectional channel, and if */ - /* so perform the required checks. */ - if ( pChanEntry->fBiDirChannel == TRUE ) - { - /* Check the ports that must remain unassigned.*/ - if ( f_pTempChanOpen->TdmConfig.ulRinTimeslot != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_RIN_TIMESLOT; - if ( f_pTempChanOpen->TdmConfig.ulSoutTimeslot != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_SOUT_TIMESLOT; - - /* Check that no PCM law change is requested.*/ - if ( f_pTempChanOpen->TdmConfig.ulRinPcmLaw != f_pTempChanOpen->TdmConfig.ulRoutPcmLaw ) - return cOCT6100_ERR_CHANNEL_RIN_ROUT_LAW_CONVERSION; - if ( f_pTempChanOpen->TdmConfig.ulSinPcmLaw != f_pTempChanOpen->TdmConfig.ulSoutPcmLaw ) - return cOCT6100_ERR_CHANNEL_SIN_SOUT_LAW_CONVERSION; - } - - /* If this channel is on a conference bridge, a few more things must be checked. */ - if ( pChanEntry->usBridgeIndex != cOCT6100_INVALID_INDEX ) - { - /* If conferencing, law conversion cannot be applied. */ - /* This check is done only if both input and output ports are assigned. */ - if ( ( f_pTempChanOpen->TdmConfig.ulRinTimeslot != cOCT6100_UNASSIGNED ) - && ( f_pTempChanOpen->TdmConfig.ulRoutTimeslot != cOCT6100_UNASSIGNED ) ) - { - /* Laws must be the same! */ - if ( f_pTempChanOpen->TdmConfig.ulRinPcmLaw != f_pTempChanOpen->TdmConfig.ulRoutPcmLaw ) - return cOCT6100_ERR_CHANNEL_RIN_ROUT_LAW_CONVERSION; - } - - /* Check for Sin. */ - if ( ( f_pTempChanOpen->TdmConfig.ulSinTimeslot != cOCT6100_UNASSIGNED ) - && ( f_pTempChanOpen->TdmConfig.ulSoutTimeslot != cOCT6100_UNASSIGNED ) ) - { - /* Laws must be the same! */ - if ( f_pTempChanOpen->TdmConfig.ulSinPcmLaw != f_pTempChanOpen->TdmConfig.ulSoutPcmLaw ) - return cOCT6100_ERR_CHANNEL_SIN_SOUT_LAW_CONVERSION; - } - - /* Check if ADPCM is requested. */ - if ( f_pTempChanOpen->CodecConfig.ulEncoderPort != cOCT6100_NO_ENCODING && - f_pTempChanOpen->CodecConfig.ulEncodingRate != cOCT6100_G711_64KBPS ) - { - /* No ADPCM in a conference bridge! */ - return cOCT6100_ERR_CHANNEL_ENCODING_RATE; - } - - if ( f_pTempChanOpen->CodecConfig.ulDecoderPort != cOCT6100_NO_DECODING && - f_pTempChanOpen->CodecConfig.ulDecodingRate != cOCT6100_G711_64KBPS ) - { - /* No ADPCM in a conference bridge! */ - return cOCT6100_ERR_CHANNEL_DECODING_RATE; - } - } - - if ( f_pTempChanOpen->CodecConfig.ulEncoderPort == cOCT6100_NO_ENCODING || - f_pTempChanOpen->CodecConfig.ulDecoderPort == cOCT6100_NO_DECODING ) - { - /* Make sure no law conversion is attempted since it is not supported by the device.*/ - if ( f_pTempChanOpen->TdmConfig.ulRinPcmLaw != f_pTempChanOpen->TdmConfig.ulRoutPcmLaw ) - return cOCT6100_ERR_CHANNEL_RIN_ROUT_LAW_CONVERSION; - if ( f_pTempChanOpen->TdmConfig.ulSinPcmLaw != f_pTempChanOpen->TdmConfig.ulSoutPcmLaw ) - return cOCT6100_ERR_CHANNEL_SIN_SOUT_LAW_CONVERSION; - } - - if ( pChanEntry->fEnableExtToneDetection == TRUE && - f_pTempChanOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - return cOCT6100_ERR_CHANNEL_EXT_TONE_DETECTION_DECODER_PORT; - - /* A few special checks must be done if the configuration is to be applied */ - /* to all opened channels. */ - if ( f_pChannelModify->fApplyToAllChannels == TRUE ) - { - /* When the configuration to be applied is for all channels, */ - /* check that the stream and timeslot parameters are not being assigned. */ - - /* Check the Rout port. */ - if ( f_pChannelModify->TdmConfig.ulRoutStream != cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulRoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - /* Check that the Rout ports is being unassigned. */ - if ( f_pTempChanOpen->TdmConfig.ulRoutStream != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_ROUT_STREAM_UNASSIGN; - if ( f_pTempChanOpen->TdmConfig.ulRoutTimeslot != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_ROUT_TIMESLOT_UNASSIGN; - } - - /* Check the Rin port. */ - if ( f_pChannelModify->TdmConfig.ulRinStream != cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulRinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - /* Check that the Rin ports is being unassigned. */ - if ( f_pTempChanOpen->TdmConfig.ulRinStream != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_RIN_STREAM_UNASSIGN; - if ( f_pTempChanOpen->TdmConfig.ulRinTimeslot != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_RIN_TIMESLOT_UNASSIGN; - } - - /* Check the Sout port. */ - if ( f_pChannelModify->TdmConfig.ulSoutStream != cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulSoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - /* Check that the Sout ports is being unassigned. */ - if ( f_pTempChanOpen->TdmConfig.ulSoutStream != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_SOUT_STREAM_UNASSIGN; - if ( f_pTempChanOpen->TdmConfig.ulSoutTimeslot != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_SOUT_TIMESLOT_UNASSIGN; - } - - /* Check the Sin port. */ - if ( f_pChannelModify->TdmConfig.ulSinStream != cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulSinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - /* Check that the Sin ports is being unassigned. */ - if ( f_pTempChanOpen->TdmConfig.ulSinStream != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_SIN_STREAM_UNASSIGN; - if ( f_pTempChanOpen->TdmConfig.ulSinTimeslot != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_CHANNEL_SIN_TIMESLOT_UNASSIGN; - } - } - } - - /* Check the VQE config.*/ - if ( f_pChannelModify->fVqeConfigModified == TRUE ) - { - ulResult = Oct6100ApiCheckVqeConfig( f_pApiInstance, - &f_pTempChanOpen->VqeConfig, - f_pTempChanOpen->fEnableToneDisabler ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Verify if the echo operation mode selected can be applied. */ - if ( ( f_pTempChanOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_NO_ECHO ) - && ( f_pTempChanOpen->VqeConfig.fEnableNlp == FALSE ) ) - return cOCT6100_ERR_CHANNEL_ECHO_OP_MODE_NLP_REQUIRED; - - if ( ( f_pTempChanOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION ) - && ( f_pTempChanOpen->VqeConfig.fEnableNlp == FALSE ) ) - return cOCT6100_ERR_CHANNEL_ECHO_OP_MODE_NLP_REQUIRED; - - /* Comfort noise must be activated for speech recognition mode to work. */ - if ( ( f_pTempChanOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION ) - && ( f_pTempChanOpen->VqeConfig.ulComfortNoiseMode == cOCT6100_COMFORT_NOISE_OFF ) ) - return cOCT6100_ERR_CHANNEL_COMFORT_NOISE_REQUIRED; - - /* Check the Codec config.*/ - if ( f_pChannelModify->fCodecConfigModified == TRUE ) - { - if ( f_pTempChanOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - ulDecoderNumTssts = f_pTempChanOpen->TdmConfig.ulRinNumTssts; - else /* f_pTempChanOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_SIN */ - ulDecoderNumTssts = f_pTempChanOpen->TdmConfig.ulSinNumTssts; - - ulResult = Oct6100ApiCheckCodecConfig( f_pApiInstance, - &f_pTempChanOpen->CodecConfig, - ulDecoderNumTssts, - f_pusNewPhasingTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - - - /* make sure that if silence suppression is activated, the NLP is enabled.*/ - if ( f_pTempChanOpen->CodecConfig.fEnableSilenceSuppression == TRUE && f_pTempChanOpen->VqeConfig.fEnableNlp == FALSE ) - return cOCT6100_ERR_CHANNEL_SIL_SUP_NLP_MUST_BE_ENABLED; - - /* Verify if the channel is currently part of a bidirectional channel, and if so perform - the required checks.*/ - if ( pChanEntry->fBiDirChannel == TRUE ) - { - /* Check the ports that must remain unassigned.*/ - if ( f_pTempChanOpen->CodecConfig.ulEncoderPort != cOCT6100_NO_ENCODING && - f_pTempChanOpen->CodecConfig.ulEncodingRate != cOCT6100_G711_64KBPS ) - return cOCT6100_ERR_CHANNEL_ENCODING_RATE; - - if ( f_pTempChanOpen->CodecConfig.ulDecoderPort != cOCT6100_NO_DECODING && - f_pTempChanOpen->CodecConfig.ulDecodingRate != cOCT6100_G711_64KBPS ) - return cOCT6100_ERR_CHANNEL_DECODING_RATE; - } - - } - /*=======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiModifyChannelResources - -Description: Reserves any new resources needed for the channel -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelModify Pointer to echo cancellation channel configuration structure. -f_usChanIndex Allocated entry in ECHO channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiModifyChannelResources -UINT32 Oct6100ApiModifyChannelResources( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MODIFY f_pChannelModify, - IN UINT16 f_usChanIndex, - OUT PUINT16 f_pusNewRinTsstIndex, - OUT PUINT16 f_pusNewSinTsstIndex, - OUT PUINT16 f_pusNewRoutTsstIndex, - OUT PUINT16 f_pusNewSoutTsstIndex ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - - tPOCT6100_API_CHANNEL_TDM pApiTdmConf; - tPOCT6100_CHANNEL_MODIFY_TDM pModifyTdmConf; - - UINT32 ulResult = cOCT6100_ERR_OK; - UINT32 ulTempVar = cOCT6100_ERR_OK; - UINT32 ulFreeMixerEventCnt; - - BOOL fRinReleased = FALSE; - BOOL fSinReleased = FALSE; - BOOL fRoutReleased = FALSE; - BOOL fSoutReleased = FALSE; - - BOOL fRinReserved = FALSE; - BOOL fSinReserved = FALSE; - BOOL fRoutReserved = FALSE; - BOOL fSoutReserved = FALSE; - - BOOL fReserveRin = FALSE; - BOOL fReserveSin = FALSE; - BOOL fReserveRout = FALSE; - BOOL fReserveSout = FALSE; - - BOOL fRinRoutConversionMemReserved = FALSE; - BOOL fSinSoutConversionMemReserved = FALSE; - - - UINT32 ulRinNumTssts = 1; - UINT32 ulSinNumTssts = 1; - UINT32 ulRoutNumTssts = 1; - UINT32 ulSoutNumTssts = 1; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain local pointer to the TDM configuration structure of the tPOCT6100_CHANNEL_MODIFY structure. */ - pModifyTdmConf = &f_pChannelModify->TdmConfig; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ) - - /* Obtain local pointer to the TDM configuration structure of the tPOCT6100_API_CHANNEL structure. */ - pApiTdmConf = &pChanEntry->TdmConfig; - - /*===============================================================================*/ - /* Modify TSST resources if required.*/ - if ( f_pChannelModify->fTdmConfigModified == TRUE ) - { - /* First release any entry that need to be released.*/ - if ( ( pModifyTdmConf->ulRinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - || ( pModifyTdmConf->ulRinNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) - ) - { - if ( pChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - /* Release the previously reserved entry.*/ - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pChanEntry->TdmConfig.usRinTimeslot, - pChanEntry->TdmConfig.usRinStream, - pChanEntry->TdmConfig.byRinNumTssts, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fRinReleased = TRUE; - } - } - - fReserveRin = TRUE; - } - - /* Release SIN port.*/ - if ( ( ulResult == cOCT6100_ERR_OK ) - && ( ( pModifyTdmConf->ulSinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - || ( pModifyTdmConf->ulSinNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) - ) ) - { - if ( pChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - /* Release the previously reserved entry.*/ - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pChanEntry->TdmConfig.usSinTimeslot, - pChanEntry->TdmConfig.usSinStream, - pChanEntry->TdmConfig.bySinNumTssts, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fSinReleased = TRUE; - } - } - - fReserveSin = TRUE; - } - - /* Release ROUT port.*/ - if ( ( ulResult == cOCT6100_ERR_OK ) - && ( ( pModifyTdmConf->ulRoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - || ( pModifyTdmConf->ulRoutNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) - ) ) - { - if ( pChanEntry->usRoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - /* Release the previously reserved entry.*/ - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pChanEntry->TdmConfig.usRoutTimeslot, - pChanEntry->TdmConfig.usRoutStream, - pChanEntry->TdmConfig.byRoutNumTssts, - cOCT6100_OUTPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fRoutReleased = TRUE; - } - } - - fReserveRout = TRUE; - } - - /* Release the SOUT port.*/ - if ( ( ulResult == cOCT6100_ERR_OK ) - && ( ( pModifyTdmConf->ulSoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - || ( pModifyTdmConf->ulSoutNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) - ) ) - { - if ( pChanEntry->usSoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - /* Release the previously reserved entry.*/ - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pChanEntry->TdmConfig.usSoutTimeslot, - pChanEntry->TdmConfig.usSoutStream, - pChanEntry->TdmConfig.bySoutNumTssts, - cOCT6100_OUTPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fSoutReleased = TRUE; - } - } - - fReserveSout = TRUE; - } - - /* Now reserve any new entry required.*/ - - /* Modify RIN port.*/ - if ( ( fReserveRin == TRUE ) && ( ulResult == cOCT6100_ERR_OK ) ) - { - if ( pModifyTdmConf->ulRinTimeslot != cOCT6100_UNASSIGNED ) - { - /* Check what number of TSSTs should be reserved this time. */ - if ( pModifyTdmConf->ulRinNumTssts == cOCT6100_KEEP_PREVIOUS_SETTING ) - { - ulRinNumTssts = pApiTdmConf->byRinNumTssts; - } - else /* if ( pModifyTdmConf->ulRinNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) */ - { - /* New number of TSSTs. */ - ulRinNumTssts = pModifyTdmConf->ulRinNumTssts; - } - - if ( pModifyTdmConf->ulRinTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - { - /* Reserve the new number of TSSTs. */ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pApiTdmConf->usRinTimeslot, - pApiTdmConf->usRinStream, - ulRinNumTssts, - cOCT6100_INPUT_TSST, - f_pusNewRinTsstIndex, - NULL ); - } - else /* if ( pModifyTdmConf->ulRinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) */ - { - /* Reserve the new TSST.*/ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pModifyTdmConf->ulRinTimeslot, - pModifyTdmConf->ulRinStream, - ulRinNumTssts, - cOCT6100_INPUT_TSST, - f_pusNewRinTsstIndex, - NULL ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fRinReserved = TRUE; - } - } - } - else - { - *f_pusNewRinTsstIndex = cOCT6100_INVALID_INDEX; - } - } - else - { - *f_pusNewRinTsstIndex = cOCT6100_INVALID_INDEX; - } - - /* Modify SIN port.*/ - if ( ( fReserveSin == TRUE ) && ( ulResult == cOCT6100_ERR_OK ) ) - { - if ( pModifyTdmConf->ulSinTimeslot != cOCT6100_UNASSIGNED ) - { - /* Check what number of TSSTs should be reserved this time. */ - if ( pModifyTdmConf->ulSinNumTssts == cOCT6100_KEEP_PREVIOUS_SETTING ) - { - ulSinNumTssts = pApiTdmConf->bySinNumTssts; - } - else /* if ( pModifyTdmConf->ulSinNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) */ - { - /* New number of TSSTs. */ - ulSinNumTssts = pModifyTdmConf->ulSinNumTssts; - } - - if ( pModifyTdmConf->ulSinTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - { - /* Reserve the new number of TSSTs. */ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pApiTdmConf->usSinTimeslot, - pApiTdmConf->usSinStream, - ulSinNumTssts, - cOCT6100_INPUT_TSST, - f_pusNewSinTsstIndex, - NULL ); - } - else /* if ( pModifyTdmConf->ulSinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) */ - { - /* Reserve the new TSST.*/ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pModifyTdmConf->ulSinTimeslot, - pModifyTdmConf->ulSinStream, - ulSinNumTssts, - cOCT6100_INPUT_TSST, - f_pusNewSinTsstIndex, - NULL ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fSinReserved = TRUE; - } - } - } - else - { - *f_pusNewSinTsstIndex = cOCT6100_INVALID_INDEX; - } - } - else - { - *f_pusNewSinTsstIndex = cOCT6100_INVALID_INDEX; - } - - /* Modify ROUT port.*/ - if ( ( fReserveRout == TRUE ) && ( ulResult == cOCT6100_ERR_OK ) ) - { - if ( pModifyTdmConf->ulRoutTimeslot != cOCT6100_UNASSIGNED ) - { - /* Check what number of TSSTs should be reserved this time. */ - if ( pModifyTdmConf->ulRoutNumTssts == cOCT6100_KEEP_PREVIOUS_SETTING ) - { - ulRoutNumTssts = pApiTdmConf->byRoutNumTssts; - } - else /* if ( pModifyTdmConf->ulRoutNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) */ - { - /* New number of TSSTs. */ - ulRoutNumTssts = pModifyTdmConf->ulRoutNumTssts; - } - - if ( pModifyTdmConf->ulRoutTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - { - /* Reserve the new number of TSSTs. */ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pApiTdmConf->usRoutTimeslot, - pApiTdmConf->usRoutStream, - ulRoutNumTssts, - cOCT6100_OUTPUT_TSST, - f_pusNewRoutTsstIndex, - NULL ); - } - else /* if ( pModifyTdmConf->ulRoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) */ - { - /* Reserve the new TSST.*/ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pModifyTdmConf->ulRoutTimeslot, - pModifyTdmConf->ulRoutStream, - ulRoutNumTssts, - cOCT6100_OUTPUT_TSST, - f_pusNewRoutTsstIndex, - NULL ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fRoutReserved = TRUE; - } - } - } - else - { - *f_pusNewRoutTsstIndex = cOCT6100_INVALID_INDEX; - } - } - else - { - *f_pusNewRoutTsstIndex = cOCT6100_INVALID_INDEX; - } - - /* Modify SOUT port.*/ - if ( ( fReserveSout == TRUE ) && ( ulResult == cOCT6100_ERR_OK ) ) - { - if ( pModifyTdmConf->ulSoutTimeslot != cOCT6100_UNASSIGNED ) - { - /* Check what number of TSSTs should be reserved this time. */ - if ( pModifyTdmConf->ulSoutNumTssts == cOCT6100_KEEP_PREVIOUS_SETTING ) - { - ulSoutNumTssts = pApiTdmConf->bySoutNumTssts; - } - else /* if ( pModifyTdmConf->ulSoutNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) */ - { - /* New number of TSSTs. */ - ulSoutNumTssts = pModifyTdmConf->ulSoutNumTssts; - } - - if ( pModifyTdmConf->ulSoutTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - { - /* Reserve the new number of TSSTs. */ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pApiTdmConf->usSoutTimeslot, - pApiTdmConf->usSoutStream, - ulSoutNumTssts, - cOCT6100_OUTPUT_TSST, - f_pusNewSoutTsstIndex, - NULL ); - } - else /* if ( pModifyTdmConf->ulSoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) */ - { - /* Reserve the new TSST.*/ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - pModifyTdmConf->ulSoutTimeslot, - pModifyTdmConf->ulSoutStream, - ulSoutNumTssts, - cOCT6100_OUTPUT_TSST, - f_pusNewSoutTsstIndex, - NULL ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fSoutReserved = TRUE; - } - } - } - else - { - *f_pusNewSoutTsstIndex = cOCT6100_INVALID_INDEX; - } - } - else - { - *f_pusNewSoutTsstIndex = cOCT6100_INVALID_INDEX; - } - - - } - - if ( f_pChannelModify->fCodecConfigModified == TRUE ) - { - if ( ulResult == cOCT6100_ERR_OK && - pChanEntry->usRinRoutConversionMemIndex == cOCT6100_INVALID_INDEX && - ( f_pChannelModify->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_ROUT || - f_pChannelModify->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) ) - { - /* Reserve an ADPCM memory block.*/ - ulResult = Oct6100ApiReserveConversionMemEntry( f_pApiInstance, &pChanEntry->usRinRoutConversionMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fRinRoutConversionMemReserved = TRUE; - } - } - - if ( ulResult == cOCT6100_ERR_OK && - pChanEntry->usSinSoutConversionMemIndex == cOCT6100_INVALID_INDEX && - ( f_pChannelModify->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_SOUT || - f_pChannelModify->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_SIN ) ) - { - /* Reserve an ADPCM memory block.*/ - ulResult = Oct6100ApiReserveConversionMemEntry( f_pApiInstance, &pChanEntry->usSinSoutConversionMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fSinSoutConversionMemReserved = TRUE; - } - } - } - - - /*===============================================================================*/ - /* Check if there are a couple of mixer events available for us. */ - - if ( ulResult == cOCT6100_ERR_OK ) - { - UINT32 ulMixerEventCntNeeded = 0; - - /* Calculate how many mixer events are needed. */ - if ( pChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX ) - { - /* If the channel is in bidir mode, do not create the Rin silence event!!! */ - if ( pChanEntry->fBiDirChannel == FALSE ) - { - if ( ( *f_pusNewRinTsstIndex == cOCT6100_INVALID_INDEX ) - && ( pChanEntry->usRinSilenceEventIndex == cOCT6100_INVALID_INDEX ) ) - ulMixerEventCntNeeded++; - } - } - - if ( ( *f_pusNewSinTsstIndex == cOCT6100_INVALID_INDEX ) - && ( pChanEntry->usSinSilenceEventIndex == cOCT6100_INVALID_INDEX ) ) - { - ulMixerEventCntNeeded++; - } - - /* If at least 1 mixer event is needed, check if those are available. */ - if ( ulMixerEventCntNeeded != 0 ) - { - ulResult = Oct6100ApiGetFreeMixerEventCnt( f_pApiInstance, &ulFreeMixerEventCnt ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* The API might need more mixer events if the ports have to be muted. */ - /* Check if these are available. */ - if ( ulFreeMixerEventCnt < ulMixerEventCntNeeded ) - { - ulResult = cOCT6100_ERR_CHANNEL_OUT_OF_MIXER_EVENTS; - } - } - } - } - - /*===============================================================================*/ - - /* Verify if an error occured. */ - if ( ulResult != cOCT6100_ERR_OK ) - { - /* Release any resources newly reserved.*/ - if ( fRinReserved == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsst( f_pApiInstance, - pModifyTdmConf->ulRinTimeslot, - pModifyTdmConf->ulRinStream, - ulRinNumTssts, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /* For the SIN port.*/ - if ( fSinReserved == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsst( f_pApiInstance, - pModifyTdmConf->ulSinTimeslot, - pModifyTdmConf->ulSinStream, - ulSinNumTssts, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /* For the ROUT port.*/ - if ( fRoutReserved == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsst( f_pApiInstance, - pModifyTdmConf->ulRoutTimeslot, - pModifyTdmConf->ulRoutStream, - ulRoutNumTssts, - cOCT6100_OUTPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /* For the SOUT port.*/ - if ( fSoutReserved == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsst( f_pApiInstance, - pModifyTdmConf->ulSoutTimeslot, - pModifyTdmConf->ulSoutStream, - ulSoutNumTssts, - cOCT6100_OUTPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /* Now make sure any resources released gets reserved back again.*/ - - /* For the RIN port.*/ - if ( fRinReleased == TRUE ) - { - /* Reserve the new TSST.*/ - ulTempVar = Oct6100ApiReserveTsst( f_pApiInstance, - pChanEntry->TdmConfig.usRinTimeslot, - pChanEntry->TdmConfig.usRinStream, - pChanEntry->TdmConfig.byRinNumTssts, - cOCT6100_INPUT_TSST, - &pChanEntry->usRinTsstIndex, - NULL ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /* For the SIN port.*/ - if ( fSinReleased == TRUE ) - { - /* Reserve the new TSST.*/ - ulTempVar = Oct6100ApiReserveTsst( f_pApiInstance, - pChanEntry->TdmConfig.usSinTimeslot, - pChanEntry->TdmConfig.usSinStream, - pChanEntry->TdmConfig.bySinNumTssts, - cOCT6100_INPUT_TSST, - &pChanEntry->usSinTsstIndex, - NULL ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /* For the ROUT port.*/ - if ( fRoutReleased == TRUE ) - { - /* Reserve the new TSST.*/ - ulTempVar = Oct6100ApiReserveTsst( f_pApiInstance, - pChanEntry->TdmConfig.usRoutTimeslot, - pChanEntry->TdmConfig.usRoutStream, - pChanEntry->TdmConfig.byRoutNumTssts, - cOCT6100_OUTPUT_TSST, - &pChanEntry->usRoutTsstIndex, - NULL ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /* For the SOUT port.*/ - if ( fSoutReleased == TRUE ) - { - /* Reserve the new TSST.*/ - ulTempVar = Oct6100ApiReserveTsst( f_pApiInstance, - pChanEntry->TdmConfig.usSoutTimeslot, - pChanEntry->TdmConfig.usSoutStream, - pChanEntry->TdmConfig.bySoutNumTssts, - cOCT6100_OUTPUT_TSST, - &pChanEntry->usSoutTsstIndex, - NULL ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /* Release the conversion memories if they were reserved.*/ - if ( fRinRoutConversionMemReserved == TRUE ) - { - ulTempVar = Oct6100ApiReleaseConversionMemEntry( f_pApiInstance, - pChanEntry->usRinRoutConversionMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if ( fSinSoutConversionMemReserved == TRUE ) - { - ulTempVar = Oct6100ApiReleaseConversionMemEntry( f_pApiInstance, - pChanEntry->usSinSoutConversionMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /* Now return the error.*/ - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiModifyChannelStructs - -Description: Performs all the required structure writes to configure the - echo cancellation channel based on the new modifications. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelModify Pointer to echo cancellation channel configuration structure. -f_pChannelOpen Pointer to a structure used to store the multiple resources indexes. -f_usChanIndex Index of the channel within the API's channel list. -f_usNewPhasingTsstIndex Index of the new phasing TSST. -f_pfSinSoutCodecActive Pointer to the state of the SIN/SOUT codec. -f_pfRinRoutCodecActive Pointer to the state of the RIN/ROUT codec. -f_usNewRinTsstIndex New RIN TSST memory index. -f_usNewSinTsstIndex New SIN TSST memory index. -f_usNewRoutTsstIndex New ROUT TSST memory index. -f_usNewSoutTsstIndex New SOUT TSST memory index. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiModifyChannelStructs -UINT32 Oct6100ApiModifyChannelStructs( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MODIFY f_pChannelModify, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usNewPhasingTsstIndex, - OUT PUINT8 f_pfSinSoutCodecActive, - OUT PUINT8 f_pfRinRoutCodecActive, - IN UINT16 f_usNewRinTsstIndex, - IN UINT16 f_usNewSinTsstIndex, - IN UINT16 f_usNewRoutTsstIndex, - IN UINT16 f_usNewSoutTsstIndex ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_WRITE_PARAMS WriteParams; - tPOCT6100_API_CHANNEL_CODEC pApiCodecConf; - tPOCT6100_API_CHANNEL_TDM pApiTdmConf; - tPOCT6100_API_CHANNEL_VQE pApiVqeConf; - - UINT32 ulResult; - UINT16 usReadData; - - UINT16 usSinTsstIndex; - UINT16 usRinTsstIndex; - - UINT32 ulToneConfIndex; - BOOL fClearPlayoutPointers = FALSE; - - BOOL fConversionEnabled = FALSE; - - - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ) - - /* Obtain local pointer to the configuration structures of the tPOCT6100_API_CHANNEL structure. */ - pApiCodecConf = &pChanEntry->CodecConfig; - pApiTdmConf = &pChanEntry->TdmConfig; - pApiVqeConf = &pChanEntry->VqeConfig; - - /*=======================================================================*/ - /* Init the RIN and SIN TSST index */ - - usRinTsstIndex = pChanEntry->usRinTsstIndex; - usSinTsstIndex = pChanEntry->usSinTsstIndex; - - - /*==============================================================================*/ - /* Clear the TSST that will be release.*/ - - if ( f_pChannelModify->fTdmConfigModified == TRUE ) - { - /* Modify RIN port.*/ - if ( f_pChannelModify->TdmConfig.ulRinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( pChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - /* Clear the previous entry */ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( (pChanEntry->usRinTsstIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Modify SIN port.*/ - if ( f_pChannelModify->TdmConfig.ulSinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( pChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - /* Clear the previous entry */ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( (pChanEntry->usSinTsstIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Modify ROUT port.*/ - if ( f_pChannelModify->TdmConfig.ulRoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( pChanEntry->usRoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - /* Clear the previous entry */ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( (pChanEntry->usRoutTsstIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Modify SOUT port.*/ - if ( f_pChannelModify->TdmConfig.ulSoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING) - { - if ( pChanEntry->usSoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - /* Clear the previous entry */ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( (pChanEntry->usSoutTsstIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Now, Configure the Tsst control memory.*/ - - if ( f_pChannelModify->fTdmConfigModified == TRUE ) - { - /* Modify RIN port.*/ - if ( f_pChannelModify->TdmConfig.ulRinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - usRinTsstIndex = f_usNewRinTsstIndex; - - if ( f_usNewRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - if ( pChanEntry->usExtraRinTsiMemIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - f_usNewRinTsstIndex, - pChanEntry->usExtraRinTsiMemIndex, - f_pChannelOpen->TdmConfig.ulRinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - f_usNewRinTsstIndex, - pChanEntry->usRinRoutTsiMemIndex, - f_pChannelOpen->TdmConfig.ulRinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - if ( f_pChannelModify->TdmConfig.ulRinTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulRinPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( pChanEntry->usExtraRinTsiMemIndex != cOCT6100_INVALID_INDEX ) - { - if ( pChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pChanEntry->usRinTsstIndex, - pChanEntry->usExtraRinTsiMemIndex, - f_pChannelOpen->TdmConfig.ulRinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else - { - if ( pChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pChanEntry->usRinTsstIndex, - pChanEntry->usRinRoutTsiMemIndex, - f_pChannelOpen->TdmConfig.ulRinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - - /* Modify SIN port.*/ - if ( f_pChannelModify->TdmConfig.ulSinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - usSinTsstIndex = f_usNewSinTsstIndex; - - if ( f_usNewSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - if ( pChanEntry->usExtraSinTsiMemIndex != cOCT6100_INVALID_INDEX ) - { - /* Write the new entry now.*/ - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - f_usNewSinTsstIndex, - pChanEntry->usExtraSinTsiMemIndex, - f_pChannelOpen->TdmConfig.ulSinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else - { - /* Write the new entry now.*/ - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - f_usNewSinTsstIndex, - pChanEntry->usSinSoutTsiMemIndex, - f_pChannelOpen->TdmConfig.ulSinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - if ( f_pChannelModify->TdmConfig.ulSinTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING && - f_pChannelModify->TdmConfig.ulSinPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( pChanEntry->usExtraSinTsiMemIndex != cOCT6100_INVALID_INDEX ) - { - if ( pChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pChanEntry->usSinTsstIndex , - pChanEntry->usExtraSinTsiMemIndex, - f_pChannelOpen->TdmConfig.ulSinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else - { - if ( pChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pChanEntry->usSinTsstIndex , - pChanEntry->usSinSoutTsiMemIndex, - f_pChannelOpen->TdmConfig.ulSinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - - /* Modify ROUT port.*/ - if ( ( f_pChannelModify->TdmConfig.ulRoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - || ( f_pChannelModify->TdmConfig.ulRoutNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) - ) - { - if ( f_usNewRoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - if ( f_pChannelModify->TdmConfig.ulRoutNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - /* If this output port is not muted. */ - if ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_ROUT ) == 0x0 ) - { - /* Write the new entry now.*/ - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - f_usNewRoutTsstIndex, - pApiCodecConf->byAdpcmNibblePosition, - f_pChannelModify->TdmConfig.ulRoutNumTssts, - pChanEntry->usRinRoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else - { - /* If this output port is not muted. */ - if ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_ROUT ) == 0x0 ) - { - /* Write the new entry now.*/ - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - f_usNewRoutTsstIndex, - pApiCodecConf->byAdpcmNibblePosition, - pApiTdmConf->byRoutNumTssts, - pChanEntry->usRinRoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - } - - /* Modify SOUT port.*/ - if ( ( f_pChannelModify->TdmConfig.ulSoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - || ( f_pChannelModify->TdmConfig.ulSoutNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) - ) - { - if ( f_usNewSoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - if ( f_pChannelModify->TdmConfig.ulSoutNumTssts != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - /* If this output port is not muted. */ - if ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SOUT ) == 0x0 ) - { - /* Write the new entry now.*/ - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - f_usNewSoutTsstIndex, - pApiCodecConf->byAdpcmNibblePosition, - f_pChannelModify->TdmConfig.ulSoutNumTssts, - pChanEntry->usSinSoutTsiMemIndex ); - - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else - { - /* If this output port is not muted. */ - if ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SOUT ) == 0x0 ) - { - /* Write the new entry now.*/ - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - f_usNewSoutTsstIndex, - pApiCodecConf->byAdpcmNibblePosition, - pApiTdmConf->bySoutNumTssts, - pChanEntry->usSinSoutTsiMemIndex ); - - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - } - - - - } - - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Modify the Encoder/Decoder memory if required.*/ - - if ( f_pChannelModify->fCodecConfigModified == TRUE ) - { - UINT32 ulCompType = 0; - UINT16 usTempTsiMemIndex; - UINT16 usDecoderMemIndex; - UINT16 usEncoderMemIndex; - UINT32 ulPcmLaw; - UINT16 usPhasingIndex; - BOOL fModifyAdpcmMem = TRUE; - - /*==============================================================================*/ - /* Reprogram the Decoder memory.*/ - - if ( pChanEntry->CodecConfig.byDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - { - usDecoderMemIndex = pChanEntry->usRinRoutConversionMemIndex; - } - else - { - usDecoderMemIndex = pChanEntry->usSinSoutConversionMemIndex; - } - - if ( pChanEntry->CodecConfig.byEncoderPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - usEncoderMemIndex = pChanEntry->usRinRoutConversionMemIndex; - } - else - { - usEncoderMemIndex = pChanEntry->usSinSoutConversionMemIndex; - } - - if ( usDecoderMemIndex != cOCT6100_INVALID_INDEX ) - { - switch( f_pChannelOpen->CodecConfig.ulDecodingRate ) - { - case cOCT6100_G711_64KBPS: - ulCompType = 0x8; - - if ( f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - { - if ( f_pChannelOpen->TdmConfig.ulRinPcmLaw == f_pChannelOpen->TdmConfig.ulRoutPcmLaw ) - fModifyAdpcmMem = FALSE; - - /* Check if both ports are assigned. If not, no law conversion needed here.. */ - if ( ( f_pChannelOpen->TdmConfig.ulRinStream == cOCT6100_UNASSIGNED ) - || ( f_pChannelOpen->TdmConfig.ulRoutStream == cOCT6100_UNASSIGNED ) ) - fModifyAdpcmMem = FALSE; - } - else /* f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_SIN */ - { - if ( f_pChannelOpen->TdmConfig.ulSinPcmLaw == f_pChannelOpen->TdmConfig.ulSoutPcmLaw ) - fModifyAdpcmMem = FALSE; - - /* Check if both ports are assigned. If not, no law conversion needed here.. */ - if ( ( f_pChannelOpen->TdmConfig.ulSinStream == cOCT6100_UNASSIGNED ) - || ( f_pChannelOpen->TdmConfig.ulSoutStream == cOCT6100_UNASSIGNED ) ) - fModifyAdpcmMem = FALSE; - } - - break; - case cOCT6100_G726_40KBPS: - ulCompType = 0x3; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_32KBPS: - ulCompType = 0x2; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_24KBPS: - ulCompType = 0x1; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_16KBPS: - ulCompType = 0x0; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_2C_ENCODED: - ulCompType = 0x4; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_3C_ENCODED: - ulCompType = 0x5; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_4C_ENCODED: - ulCompType = 0x6; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_ENCODED: - ulCompType = 0x9; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G711_G726_ENCODED: - ulCompType = 0xA; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G711_G727_2C_ENCODED: - ulCompType = 0xC; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G711_G727_3C_ENCODED: - ulCompType = 0xD; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G711_G727_4C_ENCODED: - ulCompType = 0xE; - fConversionEnabled = TRUE; - break; - - default: - return cOCT6100_ERR_FATAL_D6; - } - - if ( fModifyAdpcmMem == TRUE ) - { - /* Set the chariot memory based on the selected port.*/ - if ( f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - { - usTempTsiMemIndex = pChanEntry->usRinRoutTsiMemIndex; - ulPcmLaw = f_pChannelOpen->TdmConfig.ulRoutPcmLaw; /* Set the law for later use */ - - /* Flag the entry as active.*/ - *f_pfRinRoutCodecActive = TRUE; - } - else /* f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_SIN */ - { - usTempTsiMemIndex = pChanEntry->usSinSoutTsiMemIndex; - ulPcmLaw = f_pChannelOpen->TdmConfig.ulSoutPcmLaw; /* Set the law for later use */ - - /* Flag the entry as active.*/ - *f_pfSinSoutCodecActive = TRUE; - } - - ulResult = Oct6100ApiWriteDecoderMemory( f_pApiInstance, - usDecoderMemIndex, - ulCompType, - usTempTsiMemIndex, - ulPcmLaw, - pApiCodecConf->byAdpcmNibblePosition ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else - { - ulResult = Oct6100ApiClearConversionMemory( f_pApiInstance, - usDecoderMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Flag the entry as deactivated.*/ - if ( f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - { - *f_pfRinRoutCodecActive = FALSE; - } - else - { - *f_pfSinSoutCodecActive = FALSE; - } - } - } - - /*==============================================================================*/ - - - - - /*==============================================================================*/ - /* Reprogram the Encoder memory.*/ - - if ( usEncoderMemIndex != cOCT6100_INVALID_INDEX ) - { - - fModifyAdpcmMem = TRUE; - - /* Set the chariot memory based on the selected port.*/ - if ( f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - usTempTsiMemIndex = pChanEntry->usRinRoutTsiMemIndex; - ulPcmLaw = f_pChannelOpen->TdmConfig.ulRoutPcmLaw; /* Set the law for later use */ - } - else /* f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - usTempTsiMemIndex = pChanEntry->usSinSoutTsiMemIndex; - ulPcmLaw = f_pChannelOpen->TdmConfig.ulSoutPcmLaw; /* Set the law for later use */ - } - - /* Set the phasing index .*/ - if ( f_usNewPhasingTsstIndex != cOCT6100_INVALID_INDEX ) - usPhasingIndex = f_usNewPhasingTsstIndex; - else - usPhasingIndex = pChanEntry->usPhasingTsstIndex; - - switch( f_pChannelOpen->CodecConfig.ulEncodingRate ) - { - case cOCT6100_G711_64KBPS: - if ( ulPcmLaw == cOCT6100_PCM_U_LAW ) - ulCompType = 0x4; - else /* ulPcmLaw == cOCT6100_PCM_A_LAW */ - ulCompType = 0x5; - - if ( f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - if ( f_pChannelOpen->TdmConfig.ulRinPcmLaw == f_pChannelOpen->TdmConfig.ulRoutPcmLaw ) - fModifyAdpcmMem = FALSE; - - /* Check if both ports are assigned. If not, no law conversion needed here.. */ - if ( ( f_pChannelOpen->TdmConfig.ulRinStream == cOCT6100_UNASSIGNED ) - || ( f_pChannelOpen->TdmConfig.ulRoutStream == cOCT6100_UNASSIGNED ) ) - fModifyAdpcmMem = FALSE; - } - else /* f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - if ( f_pChannelOpen->TdmConfig.ulSinPcmLaw == f_pChannelOpen->TdmConfig.ulSoutPcmLaw ) - fModifyAdpcmMem = FALSE; - - /* Check if both ports are assigned. If not, no law conversion needed here.. */ - if ( ( f_pChannelOpen->TdmConfig.ulSinStream == cOCT6100_UNASSIGNED ) - || ( f_pChannelOpen->TdmConfig.ulSoutStream == cOCT6100_UNASSIGNED ) ) - fModifyAdpcmMem = FALSE; - } - break; - case cOCT6100_G726_40KBPS: - ulCompType = 0x3; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_32KBPS: - ulCompType = 0x2; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_24KBPS: - ulCompType = 0x1; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G726_16KBPS: - ulCompType = 0x0; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_40KBPS_4_1: - ulCompType = 0xD; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_40KBPS_3_2: - ulCompType = 0xA; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_40KBPS_2_3: - ulCompType = 0x6; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_32KBPS_4_0: - ulCompType = 0xE; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_32KBPS_3_1: - ulCompType = 0xB; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_32KBPS_2_2: - ulCompType = 0x7; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_24KBPS_3_0: - ulCompType = 0xC; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_24KBPS_2_1: - ulCompType = 0x8; - fConversionEnabled = TRUE; - break; - - case cOCT6100_G727_16KBPS_2_0: - ulCompType = 0x9; - fConversionEnabled = TRUE; - break; - - default: - return cOCT6100_ERR_FATAL_D7; - } - - if ( fModifyAdpcmMem == TRUE ) - { - if ( f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - *f_pfRinRoutCodecActive = TRUE; - } - else /* f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - *f_pfSinSoutCodecActive = TRUE; - } - - ulResult = Oct6100ApiWriteEncoderMemory( f_pApiInstance, - usEncoderMemIndex, - ulCompType, - usTempTsiMemIndex, - f_pChannelOpen->CodecConfig.fEnableSilenceSuppression, - pApiCodecConf->byAdpcmNibblePosition, - usPhasingIndex, - f_pChannelOpen->CodecConfig.ulPhasingType, - f_pChannelOpen->CodecConfig.ulPhase ); - - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else - { - ulResult = Oct6100ApiClearConversionMemory( f_pApiInstance, - usEncoderMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - *f_pfRinRoutCodecActive = FALSE; - } - else /* f_pChannelOpen->CodecConfig.ulEncoderPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - *f_pfSinSoutCodecActive = FALSE; - } - } - } - - /*==============================================================================*/ - } - - - - - /*==============================================================================*/ - /* Modify the VQE parameter if required.*/ - - if ( ( f_pChannelModify->fVqeConfigModified == TRUE ) - || ( (UINT8)f_pChannelOpen->ulEchoOperationMode != pChanEntry->byEchoOperationMode ) - || ( f_pChannelOpen->fEnableToneDisabler != pChanEntry->fEnableToneDisabler ) ) - { - ulResult = Oct6100ApiWriteVqeMemory( f_pApiInstance, - &f_pChannelOpen->VqeConfig, - f_pChannelOpen, - f_usChanIndex, - pChanEntry->usEchoMemIndex, - FALSE, - TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*==============================================================================*/ - /* Modify the Echo memory if required.*/ - if ( f_pChannelModify->fEnableToneDisabler != cOCT6100_KEEP_PREVIOUS_SETTING || - f_pChannelModify->ulEchoOperationMode != cOCT6100_KEEP_PREVIOUS_SETTING || - f_pChannelModify->TdmConfig.ulRinPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING || - f_pChannelModify->TdmConfig.ulSinPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING || - f_pChannelModify->TdmConfig.ulRoutPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING || - f_pChannelModify->TdmConfig.ulSoutPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - ulResult = Oct6100ApiWriteEchoMemory( f_pApiInstance, - &f_pChannelOpen->TdmConfig, - f_pChannelOpen, - pChanEntry->usEchoMemIndex, - pChanEntry->usRinRoutTsiMemIndex, - pChanEntry->usSinSoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Synch all the buffer playout field if needed by echo operation mode. */ - /* Note that Oct6100ApiWriteVqeMemory does not clear the playout pointers */ - /* since the flag is set to FALSE. */ - if ( ( pSharedInfo->ImageInfo.fBufferPlayout == TRUE ) - && ( ( f_pChannelModify->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_HT_FREEZE ) - || ( f_pChannelModify->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_POWER_DOWN ) ) ) - { - /* Buffer playout must be stopped. */ - fClearPlayoutPointers = TRUE; - } - } - - /*==============================================================================*/ - /* Modify the Mixer events if law changes are requested. */ - - if ( pChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX && - f_pChannelModify->TdmConfig.ulSinPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - ReadParams.ulReadAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Modify the value according to the new law.*/ - if ( f_pChannelModify->TdmConfig.ulSinPcmLaw == cOCT6100_PCM_A_LAW ) - WriteParams.usWriteData = (UINT16)( usReadData | ( f_pChannelModify->TdmConfig.ulSinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET )); - else - WriteParams.usWriteData = (UINT16)( usReadData & (~( f_pChannelModify->TdmConfig.ulSinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET ))); - - /* Write back the new value.*/ - WriteParams.ulWriteAddress = ReadParams.ulReadAddress; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - if ( pChanEntry->usSoutCopyEventIndex != cOCT6100_INVALID_INDEX && - f_pChannelModify->TdmConfig.ulSoutPcmLaw != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - ReadParams.ulReadAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pChanEntry->usSoutCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Modify the value according to the new law.*/ - if ( f_pChannelModify->TdmConfig.ulSoutPcmLaw == cOCT6100_PCM_A_LAW ) - WriteParams.usWriteData = (UINT16)( usReadData | ( f_pChannelModify->TdmConfig.ulSoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET )); - else - WriteParams.usWriteData = (UINT16)( usReadData & (~( f_pChannelModify->TdmConfig.ulSoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET ))); - - /* Write back the new value.*/ - WriteParams.ulWriteAddress = ReadParams.ulReadAddress; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*==============================================================================*/ - /* Mute channel if required, this is done on a port basis */ - - ulResult = Oct6100ApiMutePorts( f_pApiInstance, - f_usChanIndex, - usRinTsstIndex, - usSinTsstIndex, - TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - /* Completely disable tone detection? */ - if ( f_pChannelModify->fDisableToneDetection == TRUE ) - { - /* Check if tone detection has been enabled on this channel. */ - for (ulToneConfIndex = 0; ulToneConfIndex < ARRAY_SIZE(pChanEntry->aulToneConf); ulToneConfIndex++) - { - /* Check if some tone has been activated on this channel. */ - if ( pChanEntry->aulToneConf[ ulToneConfIndex ] != 0 ) - { - tOCT6100_TONE_DETECTION_DISABLE ToneDetectDisable; - - /* Call the default function to make sure all parameters are assigned default values. */ - ulResult = Oct6100ToneDetectionDisableDef( &ToneDetectDisable ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Form channel handle. */ - ToneDetectDisable.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | ( pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT ) | f_usChanIndex; - - /* Disable all tones activated on this channel. */ - ToneDetectDisable.fDisableAll = TRUE; - - /* Call tone detection serialized function. */ - ulResult = Oct6100ToneDetectionDisableSer( f_pApiInstance, &ToneDetectDisable ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Get out of the loop, tone detection has been disabled! */ - break; - } - } - } - - /* Hard-stop buffer playout? */ - if ( f_pChannelModify->fStopBufferPlayout == TRUE ) - { - /* Check if playout has been started on the Rout port. */ - if ( ( pChanEntry->fRinBufPlaying == TRUE ) || ( pChanEntry->fRinBufAdded == TRUE ) ) - { - tOCT6100_BUFFER_PLAYOUT_STOP PlayoutStop; - - /* Call the default function to make sure all parameters are assigned default values. */ - ulResult = Oct6100BufferPlayoutStopDef( &PlayoutStop ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Hard stop request. */ - PlayoutStop.fStopCleanly = FALSE; - - /* Form channel handle. */ - PlayoutStop.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | ( pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT ) | f_usChanIndex; - - /* For the Rout port. */ - PlayoutStop.ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; - - /* Call buffer playout stop serialized function. */ - ulResult = Oct6100BufferPlayoutStopSer( f_pApiInstance, &PlayoutStop ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else - { - /* The chip might still be playing a last buffer. Make sure it hard-stops! */ - fClearPlayoutPointers = TRUE; - } - - /* Check if playout has been started on the Sout port. */ - if ( ( pChanEntry->fSoutBufPlaying == TRUE ) || ( pChanEntry->fSoutBufAdded == TRUE ) ) - { - tOCT6100_BUFFER_PLAYOUT_STOP PlayoutStop; - - /* Call the default function to make sure all parameters are assigned default values. */ - ulResult = Oct6100BufferPlayoutStopDef( &PlayoutStop ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Hard stop request. */ - PlayoutStop.fStopCleanly = FALSE; - - /* Form channel handle. */ - PlayoutStop.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | ( pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT ) | f_usChanIndex; - - /* For the Rout port. */ - PlayoutStop.ulPlayoutPort = cOCT6100_CHANNEL_PORT_SOUT; - - /* Call buffer playout stop serialized function. */ - ulResult = Oct6100BufferPlayoutStopSer( f_pApiInstance, &PlayoutStop ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else - { - /* The chip might still be playing a last buffer. Make sure it hard-stops! */ - fClearPlayoutPointers = TRUE; - } - } - - /* Remove participant from bridge? */ - if ( f_pChannelModify->fRemoveConfBridgeParticipant == TRUE ) - { - /* Check if this channel is on a bridge. */ - if ( pChanEntry->usBridgeIndex != cOCT6100_INVALID_INDEX ) - { - /* Channel is on a bridge, remove it. */ - tOCT6100_CONF_BRIDGE_CHAN_REMOVE BridgeChanRemove; - - /* Call the default function to make sure all parameters are assigned default values. */ - ulResult = Oct6100ConfBridgeChanRemoveDef( &BridgeChanRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Form channel handle. */ - BridgeChanRemove.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | ( pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT ) | f_usChanIndex; - - /* Do not remove all channels, only the one specified. */ - BridgeChanRemove.fRemoveAll = FALSE; - - /* No need to assign conference bridge handle, the remove function will figure it out. */ - - /* Call conference bridge channel remove serialized function. */ - ulResult = Oct6100ConfBridgeChanRemoveSer( f_pApiInstance, &BridgeChanRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_DEPENDENCY ) - { - tPOCT6100_API_CHANNEL pTapChanEntry; - - /* Get a pointer to the tap channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTapChanEntry, pChanEntry->usTapChanIndex ) - - /* Form tap channel handle. */ - BridgeChanRemove.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | ( pTapChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT ) | pChanEntry->usTapChanIndex; - - ulResult = Oct6100ConfBridgeChanRemoveSer( f_pApiInstance, &BridgeChanRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Re-form original channel handle. */ - BridgeChanRemove.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | ( pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT ) | f_usChanIndex; - - ulResult = Oct6100ConfBridgeChanRemoveSer( f_pApiInstance, &BridgeChanRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else - { - return ulResult; - } - } - } - } - - /* Remove all broadcast TSSTs? */ - if ( f_pChannelModify->fRemoveBroadcastTssts == TRUE ) - { - /* Check if broadcast TSSTs were used on the Rout port. */ - if ( pChanEntry->TdmConfig.usRoutBrdcastTsstFirstEntry != cOCT6100_INVALID_INDEX ) - { - tOCT6100_CHANNEL_BROADCAST_TSST_REMOVE BroadcastTsstRemove; - - ulResult = Oct6100ChannelBroadcastTsstRemoveDef( &BroadcastTsstRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Form channel handle. */ - BroadcastTsstRemove.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | ( pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT ) | f_usChanIndex; - - /* Remove all broadcast TSSTs associated to the current channel. */ - BroadcastTsstRemove.fRemoveAll = TRUE; - - /* On the Rout port. */ - BroadcastTsstRemove.ulPort = cOCT6100_CHANNEL_PORT_ROUT; - - ulResult = Oct6100ChannelBroadcastTsstRemoveSer( f_pApiInstance, &BroadcastTsstRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - - /* Check if broadcast TSSTs were used on the Sout port. */ - if ( pChanEntry->TdmConfig.usSoutBrdcastTsstFirstEntry != cOCT6100_INVALID_INDEX ) - { - tOCT6100_CHANNEL_BROADCAST_TSST_REMOVE BroadcastTsstRemove; - - ulResult = Oct6100ChannelBroadcastTsstRemoveDef( &BroadcastTsstRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Form channel handle. */ - BroadcastTsstRemove.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | ( pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT ) | f_usChanIndex; - - /* Remove all broadcast TSSTs associated to the current channel. */ - BroadcastTsstRemove.fRemoveAll = TRUE; - - /* On the Sout port. */ - BroadcastTsstRemove.ulPort = cOCT6100_CHANNEL_PORT_SOUT; - - ulResult = Oct6100ChannelBroadcastTsstRemoveSer( f_pApiInstance, &BroadcastTsstRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Check if have to make sure buffer playout is stopped. */ - if ( fClearPlayoutPointers == TRUE ) - { - tOCT6100_BUFFER_PLAYOUT_STOP BufferPlayoutStop; - - Oct6100BufferPlayoutStopDef( &BufferPlayoutStop ); - - BufferPlayoutStop.fStopCleanly = FALSE; - BufferPlayoutStop.ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; - - ulResult = Oct6100ApiInvalidateChanPlayoutStructs( - f_pApiInstance, - &BufferPlayoutStop, - f_usChanIndex, - pChanEntry->usEchoMemIndex - - ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - BufferPlayoutStop.ulPlayoutPort = cOCT6100_CHANNEL_PORT_SOUT; - ulResult = Oct6100ApiInvalidateChanPlayoutStructs( - f_pApiInstance, - &BufferPlayoutStop, - f_usChanIndex, - pChanEntry->usEchoMemIndex - - ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiModifyChannelEntry - -Description: Updates the channel structure in the ECHO channel list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pChannelModify Pointer to echo cancellation channel modify structure. -f_pChannelOpen Pointer to echo cancellation channel configuration structure. -f_usChanIndex Index of the channel within the API's channel list. -f_usNewPhasingTsstIndex Index of the new phasing TSST. -f_fSinSoutCodecActive State of the SIN/SOUT codec. -f_fRinRoutCodecActive State of the RIN/ROUT codec. -f_usNewRinTsstIndex New RIN TSST memory index. -f_usNewSinTsstIndex New SIN TSST memory index. -f_usNewRoutTsstIndex New ROUT TSST memory index. -f_usNewSoutTsstIndex New SOUT TSST memory index. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiModifyChannelEntry -UINT32 Oct6100ApiModifyChannelEntry( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MODIFY f_pChannelModify, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usNewPhasingTsstIndex, - IN UINT8 f_fSinSoutCodecActive, - IN UINT8 f_fRinRoutCodecActive, - IN UINT16 f_usNewRinTsstIndex, - IN UINT16 f_usNewSinTsstIndex, - IN UINT16 f_usNewRoutTsstIndex, - IN UINT16 f_usNewSoutTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_API_CHANNEL_CODEC pApiCodecConf; - tPOCT6100_API_CHANNEL_TDM pApiTdmConf; - tPOCT6100_API_CHANNEL_VQE pApiVqeConf; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ) - - /* Obtain local pointer to the configuration structures of the tPOCT6100_API_CHANNEL structure. */ - pApiCodecConf = &pChanEntry->CodecConfig; - pApiTdmConf = &pChanEntry->TdmConfig; - pApiVqeConf = &pChanEntry->VqeConfig; - - /*=======================================================================*/ - /* Copy the channel's general configuration. */ - - pChanEntry->ulUserChanId = f_pChannelOpen->ulUserChanId; - pChanEntry->byEchoOperationMode = (UINT8)( f_pChannelOpen->ulEchoOperationMode & 0xFF ); - pChanEntry->fEnableToneDisabler = (UINT8)( f_pChannelOpen->fEnableToneDisabler & 0xFF ); - - /* Save the codec state.*/ - pChanEntry->fSinSoutCodecActive = (UINT8)( f_fSinSoutCodecActive & 0xFF ); - pChanEntry->fRinRoutCodecActive = (UINT8)( f_fRinRoutCodecActive & 0xFF ); - - /*=======================================================================*/ - /* Copy the channel's TDM configuration of all the modified fields. */ - - if ( f_pChannelModify->fTdmConfigModified == TRUE ) - { - pApiTdmConf->byRinPcmLaw = (UINT8)( f_pChannelOpen->TdmConfig.ulRinPcmLaw & 0xFF ); - pApiTdmConf->bySinPcmLaw = (UINT8)( f_pChannelOpen->TdmConfig.ulSinPcmLaw & 0xFF ); - pApiTdmConf->byRoutPcmLaw = (UINT8)( f_pChannelOpen->TdmConfig.ulRoutPcmLaw & 0xFF ); - pApiTdmConf->bySoutPcmLaw = (UINT8)( f_pChannelOpen->TdmConfig.ulSoutPcmLaw & 0xFF ); - - pApiTdmConf->byRinNumTssts = (UINT8)( f_pChannelOpen->TdmConfig.ulRinNumTssts & 0xFF ); - pApiTdmConf->bySinNumTssts = (UINT8)( f_pChannelOpen->TdmConfig.ulSinNumTssts & 0xFF ); - pApiTdmConf->byRoutNumTssts = (UINT8)( f_pChannelOpen->TdmConfig.ulRoutNumTssts & 0xFF ); - pApiTdmConf->bySoutNumTssts = (UINT8)( f_pChannelOpen->TdmConfig.ulSoutNumTssts & 0xFF ); - - if ( f_pChannelModify->TdmConfig.ulRinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( f_usNewRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - pApiTdmConf->usRinStream = (UINT16)( f_pChannelOpen->TdmConfig.ulRinStream & 0xFFFF ); - pApiTdmConf->usRinTimeslot = (UINT16)( f_pChannelOpen->TdmConfig.ulRinTimeslot & 0xFFFF ); - pChanEntry->usRinTsstIndex = f_usNewRinTsstIndex; - } - else /* f_ulNewRinTsstIndex != cOCT6100_INVALID_INDEX */ - { - pApiTdmConf->usRinStream = cOCT6100_UNASSIGNED; - pApiTdmConf->usRinTimeslot = cOCT6100_UNASSIGNED; - pChanEntry->usRinTsstIndex = cOCT6100_INVALID_INDEX; - } - } - - if ( f_pChannelModify->TdmConfig.ulSinTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( f_usNewSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - pApiTdmConf->usSinStream = (UINT16)( f_pChannelOpen->TdmConfig.ulSinStream & 0xFFFF ); - pApiTdmConf->usSinTimeslot = (UINT16)( f_pChannelOpen->TdmConfig.ulSinTimeslot & 0xFFFF ); - pChanEntry->usSinTsstIndex = f_usNewSinTsstIndex; - } - else /* f_ulNewSinTsstIndex != cOCT6100_INVALID_INDEX */ - { - pApiTdmConf->usSinStream = cOCT6100_UNASSIGNED; - pApiTdmConf->usSinTimeslot = cOCT6100_UNASSIGNED; - pChanEntry->usSinTsstIndex = cOCT6100_INVALID_INDEX; - } - } - - if ( f_pChannelModify->TdmConfig.ulRoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( f_usNewRoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - pApiTdmConf->usRoutStream = (UINT16)( f_pChannelOpen->TdmConfig.ulRoutStream & 0xFFFF ); - pApiTdmConf->usRoutTimeslot = (UINT16)( f_pChannelOpen->TdmConfig.ulRoutTimeslot & 0xFFFF ); - pChanEntry->usRoutTsstIndex = f_usNewRoutTsstIndex; - } - else /* f_ulNewRoutTsstIndex != cOCT6100_INVALID_INDEX */ - { - pApiTdmConf->usRoutStream = cOCT6100_UNASSIGNED; - pApiTdmConf->usRoutTimeslot = cOCT6100_UNASSIGNED; - pChanEntry->usRoutTsstIndex = cOCT6100_INVALID_INDEX; - } - } - - if ( f_pChannelModify->TdmConfig.ulSoutTimeslot != cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( f_usNewSoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - pApiTdmConf->usSoutStream = (UINT16)( f_pChannelOpen->TdmConfig.ulSoutStream & 0xFFFF ); - pApiTdmConf->usSoutTimeslot = (UINT16)( f_pChannelOpen->TdmConfig.ulSoutTimeslot & 0xFFFF ); - pChanEntry->usSoutTsstIndex = f_usNewSoutTsstIndex; - } - else /* f_ulNewSoutTsstIndex != cOCT6100_INVALID_INDEX */ - { - pApiTdmConf->usSoutStream = cOCT6100_UNASSIGNED; - pApiTdmConf->usSoutTimeslot = cOCT6100_UNASSIGNED; - pChanEntry->usSoutTsstIndex = cOCT6100_INVALID_INDEX; - } - } - } - - /*=======================================================================*/ - /* Copy the channel's VQE configuration of all the modified fields. */ - - if ( f_pChannelModify->fVqeConfigModified == TRUE ) - { - pApiVqeConf->fEnableNlp = (UINT8)( f_pChannelOpen->VqeConfig.fEnableNlp & 0xFF ); - pApiVqeConf->byComfortNoiseMode = (UINT8)( f_pChannelOpen->VqeConfig.ulComfortNoiseMode & 0xFF ); - pApiVqeConf->fSinDcOffsetRemoval = (UINT8)( f_pChannelOpen->VqeConfig.fSinDcOffsetRemoval & 0xFF ); - pApiVqeConf->fRinDcOffsetRemoval = (UINT8)( f_pChannelOpen->VqeConfig.fRinDcOffsetRemoval & 0xFF ); - pApiVqeConf->fRinLevelControl = (UINT8)( f_pChannelOpen->VqeConfig.fRinLevelControl & 0xFF ); - pApiVqeConf->fSoutLevelControl = (UINT8)( f_pChannelOpen->VqeConfig.fSoutLevelControl & 0xFF ); - pApiVqeConf->fRinAutomaticLevelControl = (UINT8)( f_pChannelOpen->VqeConfig.fRinAutomaticLevelControl & 0xFF ); - pApiVqeConf->fSoutAutomaticLevelControl = (UINT8)( f_pChannelOpen->VqeConfig.fSoutAutomaticLevelControl & 0xFF ); - pApiVqeConf->fRinHighLevelCompensation = (UINT8)( f_pChannelOpen->VqeConfig.fRinHighLevelCompensation & 0xFF ); - - pApiVqeConf->fSoutAdaptiveNoiseReduction = (UINT8)( f_pChannelOpen->VqeConfig.fSoutAdaptiveNoiseReduction & 0xFF ); - pApiVqeConf->fSoutNoiseBleaching = (UINT8)( f_pChannelOpen->VqeConfig.fSoutNoiseBleaching & 0xFF ); - pApiVqeConf->fSoutConferencingNoiseReduction = (UINT8)( f_pChannelOpen->VqeConfig.fSoutConferencingNoiseReduction & 0xFF ); - pApiVqeConf->chRinLevelControlGainDb = (OCT_INT8)( f_pChannelOpen->VqeConfig.lRinLevelControlGainDb & 0xFF ); - pApiVqeConf->chSoutLevelControlGainDb = (OCT_INT8)( f_pChannelOpen->VqeConfig.lSoutLevelControlGainDb & 0xFF ); - pApiVqeConf->chRinAutomaticLevelControlTargetDb = (OCT_INT8)( f_pChannelOpen->VqeConfig.lRinAutomaticLevelControlTargetDb & 0xFF ); - pApiVqeConf->chSoutAutomaticLevelControlTargetDb = (OCT_INT8)( f_pChannelOpen->VqeConfig.lSoutAutomaticLevelControlTargetDb & 0xFF ); - pApiVqeConf->chRinHighLevelCompensationThresholdDb = (OCT_INT8)( f_pChannelOpen->VqeConfig.lRinHighLevelCompensationThresholdDb & 0xFF ); - pApiVqeConf->fEnableTailDisplacement = (UINT8)( f_pChannelOpen->VqeConfig.fEnableTailDisplacement & 0xFF ); - pApiVqeConf->usTailDisplacement = (UINT16)( f_pChannelOpen->VqeConfig.ulTailDisplacement & 0xFFFF ); - pApiVqeConf->usTailLength = (UINT16)( f_pChannelOpen->VqeConfig.ulTailLength & 0xFFFF ); - pApiVqeConf->fAcousticEcho = (UINT8)( f_pChannelOpen->VqeConfig.fAcousticEcho & 0xFF ); - pApiVqeConf->fDtmfToneRemoval = (UINT8)( f_pChannelOpen->VqeConfig.fDtmfToneRemoval & 0xFF ); - - pApiVqeConf->chDefaultErlDb = (OCT_INT8)( f_pChannelOpen->VqeConfig.lDefaultErlDb & 0xFF ); - pApiVqeConf->chAecDefaultErlDb = (OCT_INT8)( f_pChannelOpen->VqeConfig.lAecDefaultErlDb & 0xFF ); - pApiVqeConf->usAecTailLength = (UINT16)( f_pChannelOpen->VqeConfig.ulAecTailLength & 0xFFFF ); - pApiVqeConf->chAnrSnrEnhancementDb = (OCT_INT8)( f_pChannelOpen->VqeConfig.lAnrSnrEnhancementDb & 0xFF ); - pApiVqeConf->byAnrVoiceNoiseSegregation = (UINT8)( f_pChannelOpen->VqeConfig.ulAnrVoiceNoiseSegregation & 0xFF ); - pApiVqeConf->usToneDisablerVqeActivationDelay = (UINT16)( f_pChannelOpen->VqeConfig.ulToneDisablerVqeActivationDelay & 0xFFFF ); - pApiVqeConf->byNonLinearityBehaviorA = (UINT8)( f_pChannelOpen->VqeConfig.ulNonLinearityBehaviorA & 0xFF ); - pApiVqeConf->byNonLinearityBehaviorB = (UINT8)( f_pChannelOpen->VqeConfig.ulNonLinearityBehaviorB & 0xFF ); - pApiVqeConf->byDoubleTalkBehavior = (UINT8)( f_pChannelOpen->VqeConfig.ulDoubleTalkBehavior & 0xFF ); - pApiVqeConf->bySoutAutomaticListenerEnhancementGainDb = (UINT8)( f_pChannelOpen->VqeConfig.ulSoutAutomaticListenerEnhancementGainDb & 0xFF ); - pApiVqeConf->bySoutNaturalListenerEnhancementGainDb = (UINT8)( f_pChannelOpen->VqeConfig.ulSoutNaturalListenerEnhancementGainDb & 0xFF ); - pApiVqeConf->fSoutNaturalListenerEnhancement = (UINT8)( f_pChannelOpen->VqeConfig.fSoutNaturalListenerEnhancement & 0xFF ); - pApiVqeConf->fRoutNoiseReduction = (UINT8)( f_pChannelOpen->VqeConfig.fRoutNoiseReduction & 0xFF ); - pApiVqeConf->chRoutNoiseReductionLevelGainDb = (OCT_INT8)( f_pChannelOpen->VqeConfig.lRoutNoiseReductionLevelGainDb & 0xFF ); - pApiVqeConf->fEnableMusicProtection = (UINT8)( f_pChannelOpen->VqeConfig.fEnableMusicProtection & 0xFF ); - pApiVqeConf->fIdleCodeDetection = (UINT8)( f_pChannelOpen->VqeConfig.fIdleCodeDetection & 0xFF ); - } - - /*=======================================================================*/ - /* Copy the channel's CODEC configuration of all the modified fields. */ - if ( f_pChannelModify->fCodecConfigModified == TRUE ) - { - pApiCodecConf->byAdpcmNibblePosition = (UINT8)( f_pChannelOpen->CodecConfig.ulAdpcmNibblePosition & 0xFF ); - pApiCodecConf->byEncoderPort = (UINT8)( f_pChannelOpen->CodecConfig.ulEncoderPort & 0xFF ); - pApiCodecConf->byEncodingRate = (UINT8)( f_pChannelOpen->CodecConfig.ulEncodingRate & 0xFF ); - pApiCodecConf->byDecoderPort = (UINT8)( f_pChannelOpen->CodecConfig.ulDecoderPort & 0xFF ); - pApiCodecConf->byDecodingRate = (UINT8)( f_pChannelOpen->CodecConfig.ulDecodingRate & 0xFF ); - pApiCodecConf->fEnableSilenceSuppression = (UINT8)( f_pChannelOpen->CodecConfig.fEnableSilenceSuppression & 0xFF ); - pApiCodecConf->byPhase = (UINT8)( f_pChannelOpen->CodecConfig.ulPhase & 0xFF ); - pApiCodecConf->byPhasingType = (UINT8)( f_pChannelOpen->CodecConfig.ulPhasingType & 0xFF ); - - /* Update the API phasing TSST structure */ - if ( f_usNewPhasingTsstIndex != cOCT6100_INVALID_INDEX ) - { - tPOCT6100_API_PHASING_TSST pPhasingTsst; - - /* Release the previous phasing TSST if the channel was already bound to one.*/ - if ( pChanEntry->usPhasingTsstIndex != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( pSharedInfo, pPhasingTsst, pChanEntry->usPhasingTsstIndex ); - - pPhasingTsst->usDependencyCnt--; - } - - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( pSharedInfo, pPhasingTsst, f_usNewPhasingTsstIndex ); - - pPhasingTsst->usDependencyCnt++; - pChanEntry->usPhasingTsstIndex = f_usNewPhasingTsstIndex; - - } - } - - - - return cOCT6100_ERR_OK; -} -#endif - - - - - - - - - - - - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelBroadcastTsstAddSer - -Description: Assign a TSST to one of the port of an echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelTsstAdd Pointer to TSST assign structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelBroadcastTsstAddSer -UINT32 Oct6100ChannelBroadcastTsstAddSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstAdd ) -{ - UINT16 usChanIndex; - UINT16 usNewTsstIndex; - UINT16 usNewTsstEntry; - UINT32 ulResult; - - ulResult = Oct6100ApiCheckChanTsstAddParams( f_pApiInstance, f_pChannelTsstAdd, &usChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReserveTsstAddResources( f_pApiInstance, f_pChannelTsstAdd, usChanIndex, &usNewTsstIndex, &usNewTsstEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiWriteTsstAddStructs( f_pApiInstance, f_pChannelTsstAdd, usChanIndex, usNewTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiUpdateTsstAddChanEntry( f_pApiInstance, f_pChannelTsstAdd, usChanIndex, usNewTsstIndex, usNewTsstEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckChanTsstAddParams - -Description: Verify the validity of the tPOCT6100_CHANNEL_BROADCAST_TSST_ADD - structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelTsstAdd Pointer to echo cancellation channel open configuration structure. -f_pusChanIndex Pointer to a structure used to store the multiple resources indexes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckChanTsstAddParams -UINT32 Oct6100ApiCheckChanTsstAddParams( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstAdd, - OUT PUINT16 f_pusChanIndex ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - UINT32 ulResult; - UINT32 ulNumTssts = 1; - UINT32 ulEntryOpenCnt; - - /* Check the provided handle. */ - if ( (f_pChannelTsstAdd->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - *f_pusChanIndex = (UINT16)( f_pChannelTsstAdd->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChanIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, *f_pusChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pChannelTsstAdd->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - - /* validate the port parameter.*/ - if ( f_pChannelTsstAdd->ulPort != cOCT6100_CHANNEL_PORT_ROUT && - f_pChannelTsstAdd->ulPort != cOCT6100_CHANNEL_PORT_SOUT ) - return cOCT6100_ERR_CHANNEL_TSST_ADD_PORT; - - /* Get the required number of TSST based on the port.*/ - switch( f_pChannelTsstAdd->ulPort ) - { - case cOCT6100_CHANNEL_PORT_ROUT: - ulNumTssts = pChanEntry->TdmConfig.byRoutNumTssts; - break; - case cOCT6100_CHANNEL_PORT_SOUT: - ulNumTssts = pChanEntry->TdmConfig.bySoutNumTssts; - break; - default: - return cOCT6100_ERR_FATAL_B; - } - - /* Check the validity of the timeslot and stream. */ - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - ulNumTssts, - f_pChannelTsstAdd->ulTimeslot, - f_pChannelTsstAdd->ulStream, - cOCT6100_OUTPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_CHANNEL_TSST_ADD_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_CHANNEL_TSST_ADD_STREAM; - } - else - { - return ulResult; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveTsstAddResources - -Description: Reserve the entry for the new broadcast TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelTsstAdd Pointer to echo cancellation channel open configuration structure. -f_usChanIndex Channel index within the API's channel list. -f_pusNewTsstIndex Pointer to the new TSST index within the API's TSST memory. -f_pusNewTsstEntry Pointer to the new TSST entry within the API's TSST list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveTsstAddResources -UINT32 Oct6100ApiReserveTsstAddResources( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstAdd, - IN UINT16 f_usChanIndex, - OUT PUINT16 f_pusNewTsstIndex, - OUT PUINT16 f_pusNewTsstEntry ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - UINT32 ulResult; - UINT32 ulNumTssts = 1; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, f_usChanIndex ); - - switch( f_pChannelTsstAdd->ulPort ) - { - case cOCT6100_CHANNEL_PORT_ROUT: - ulNumTssts = pChanEntry->TdmConfig.byRoutNumTssts; - break; - case cOCT6100_CHANNEL_PORT_SOUT: - ulNumTssts = pChanEntry->TdmConfig.bySoutNumTssts; - break; - default: - return cOCT6100_ERR_FATAL_C; - } - - /* Reserve the new entry.*/ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - f_pChannelTsstAdd->ulTimeslot, - f_pChannelTsstAdd->ulStream, - ulNumTssts, - cOCT6100_OUTPUT_TSST, - f_pusNewTsstIndex, - f_pusNewTsstEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteTsstAddStructs - -Description: Configure the TSST control memory for the new TSST entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelTsstAdd Pointer to echo cancellation channel open configuration structure. -f_usChanIndex Channel index. -f_usNewTsstIndex Tsst index in the TSST control memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteTsstAddStructs -UINT32 Oct6100ApiWriteTsstAddStructs( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstAdd, - IN UINT16 f_usChanIndex, - IN UINT16 f_usNewTsstIndex ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult = cOCT6100_ERR_OK; - UINT16 usTsiMemIndex; - UINT32 ulNumTssts = 1; - - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, f_usChanIndex ); - - switch( f_pChannelTsstAdd->ulPort ) - { - case cOCT6100_CHANNEL_PORT_ROUT: - usTsiMemIndex = pChanEntry->usRinRoutTsiMemIndex; - ulNumTssts = pChanEntry->TdmConfig.byRoutNumTssts; - break; - case cOCT6100_CHANNEL_PORT_SOUT: - usTsiMemIndex = pChanEntry->usSinSoutTsiMemIndex; - ulNumTssts = pChanEntry->TdmConfig.bySoutNumTssts; - break; - default: - return cOCT6100_ERR_FATAL_D; - } - - - /* Write the new entry now.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( (f_usNewTsstIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_TSST_CONTROL_MEM_OUTPUT_TSST; - WriteParams.usWriteData |= (UINT16)( pChanEntry->CodecConfig.byAdpcmNibblePosition << cOCT6100_TSST_CONTROL_MEM_NIBBLE_POS_OFFSET ); - WriteParams.usWriteData |= (UINT16)( (ulNumTssts - 1) << cOCT6100_TSST_CONTROL_MEM_TSST_NUM_OFFSET ); - WriteParams.usWriteData |= (UINT16)( usTsiMemIndex & cOCT6100_TSST_CONTROL_MEM_TSI_MEM_MASK ); - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateTsstAddChanEntry - -Description: Update the associated channel API entry to add the new broacast TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelTsstAdd Pointer to echo cancellation channel open configuration structure. -f_usChanIndex Channel index. -f_usNewTsstIndex TSST index within the TSST control memory. -f_usNewTsstEntry TSST entry within the API TSST list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateTsstAddChanEntry -UINT32 Oct6100ApiUpdateTsstAddChanEntry( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstAdd, - IN UINT16 f_usChanIndex, - IN UINT16 f_usNewTsstIndex, - IN UINT16 f_usNewTsstEntry ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_API_TSST_ENTRY pTsstEntry; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, f_usChanIndex ); - mOCT6100_GET_TSST_LIST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTsstEntry, f_usNewTsstEntry ); - - /* Update the channel entry.*/ - if ( f_pChannelTsstAdd->ulPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - /* Add the new TSST entry to the broadcast list.*/ - pTsstEntry->usNextEntry = pChanEntry->TdmConfig.usRoutBrdcastTsstFirstEntry; - pTsstEntry->usTsstMemoryIndex = (UINT16)f_usNewTsstIndex; - pTsstEntry->usTsstValue = (UINT16)( (f_pChannelTsstAdd->ulTimeslot << 5) | f_pChannelTsstAdd->ulStream ); - - /* Modify the first entry pointer.*/ - pChanEntry->TdmConfig.usRoutBrdcastTsstFirstEntry = f_usNewTsstEntry; - - /* Increment the number of broadcast TSST. */ - pChanEntry->TdmConfig.usRoutBrdcastTsstNumEntry++; - - } - else /* f_pChannelTsstAdd->ulPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - /* Add the new TSST entry to the broadcast list.*/ - pTsstEntry->usNextEntry = pChanEntry->TdmConfig.usSoutBrdcastTsstFirstEntry; - pTsstEntry->usTsstMemoryIndex = (UINT16)f_usNewTsstIndex; - pTsstEntry->usTsstValue = (UINT16)( (f_pChannelTsstAdd->ulTimeslot << 5) | f_pChannelTsstAdd->ulStream ); - - /* Modify the first entry pointer.*/ - pChanEntry->TdmConfig.usSoutBrdcastTsstFirstEntry = f_usNewTsstEntry; - - /* Increment the number of broadcast TSST. */ - pChanEntry->TdmConfig.usSoutBrdcastTsstNumEntry++; - } - - return cOCT6100_ERR_OK; -} -#endif - - - - - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelBroadcastTsstRemoveSer - -Description: Removes a broadcast TSST from one of the output port of an - echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelTsstRemove Pointer to TSST remove structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelBroadcastTsstRemoveSer -UINT32 Oct6100ChannelBroadcastTsstRemoveSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelTsstRemove) -{ - UINT16 usChanIndex; - UINT16 usTsstIndex; - UINT16 usTsstEntry; - UINT16 usPrevTsstEntry; - UINT32 ulResult; - - ulResult = Oct6100ApiAssertChanTsstRemoveParams( f_pApiInstance, f_pChannelTsstRemove, &usChanIndex, &usTsstIndex, &usTsstEntry, &usPrevTsstEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiInvalidateTsstRemoveStructs( f_pApiInstance, usChanIndex, usTsstIndex, f_pChannelTsstRemove->ulPort, f_pChannelTsstRemove->fRemoveAll ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseTsstRemoveResources( f_pApiInstance, f_pChannelTsstRemove, usChanIndex, usTsstIndex, usTsstEntry, usPrevTsstEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertChanTsstRemoveParams - -Description: Verify the validity of the tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE - structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelTsstRemove Pointer to echo cancellation channel open configuration structure. -f_pulChanIndex Pointer to a channel index. -f_pulNewTsstIndex Pointer to a TSST index within the TSST control memory. -f_pulNewTsstEntry Pointer to a TSST entry within the API TSST list. -f_pulPrevTsstEntry Pointer to the previous TSST entry. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertChanTsstRemoveParams -UINT32 Oct6100ApiAssertChanTsstRemoveParams( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelTsstRemove, - OUT PUINT16 f_pusChanIndex, - OUT PUINT16 f_pusTsstIndex, - OUT PUINT16 f_pusTsstEntry, - OUT PUINT16 f_pusPrevTsstEntry ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_API_TSST_ENTRY pTsstEntry; - UINT32 ulResult; - UINT32 ulNumTssts = 1; - UINT32 ulEntryOpenCnt; - UINT16 usCurrentEntry; - UINT16 usTsstValue; - UINT16 usNumEntry; - - /* Check the provided handle. */ - if ( (f_pChannelTsstRemove->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - *f_pusChanIndex = (UINT16)( f_pChannelTsstRemove->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChanIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, *f_pusChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pChannelTsstRemove->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - - /* validate the port parameter.*/ - if ( f_pChannelTsstRemove->ulPort != cOCT6100_CHANNEL_PORT_ROUT && - f_pChannelTsstRemove->ulPort != cOCT6100_CHANNEL_PORT_SOUT ) - return cOCT6100_ERR_CHANNEL_TSST_REMOVE_PORT; - - /* Verify that the requested entry is present in the channel's port broadcast TSST.*/ - if ( f_pChannelTsstRemove->ulPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - usCurrentEntry = pChanEntry->TdmConfig.usRoutBrdcastTsstFirstEntry; - usNumEntry = pChanEntry->TdmConfig.usRoutBrdcastTsstNumEntry; - } - else /* f_pChannelTsstRemove->ulPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - usCurrentEntry = pChanEntry->TdmConfig.usSoutBrdcastTsstFirstEntry; - usNumEntry = pChanEntry->TdmConfig.usSoutBrdcastTsstNumEntry; - } - - /* Verify if at least one TSST is present on the channel port.*/ - if ( usNumEntry == 0 ) - return cOCT6100_ERR_CHANNEL_TSST_REMOVE_NO_BROADCAST_TSST; - - /* Get the required number of TSST based on the port.*/ - switch( f_pChannelTsstRemove->ulPort ) - { - case cOCT6100_CHANNEL_PORT_ROUT: - ulNumTssts = pChanEntry->TdmConfig.byRoutNumTssts; - break; - case cOCT6100_CHANNEL_PORT_SOUT: - ulNumTssts = pChanEntry->TdmConfig.bySoutNumTssts; - break; - default: - return cOCT6100_ERR_FATAL_E; - } - - /* Initialize the TSST entry to invalid.*/ - *f_pusTsstEntry = cOCT6100_INVALID_INDEX; - *f_pusPrevTsstEntry = cOCT6100_INVALID_INDEX; - *f_pusTsstIndex = cOCT6100_INVALID_INDEX; - - if ( f_pChannelTsstRemove->fRemoveAll != TRUE ) - { - /* Check the validity of the timeslot and Stream.*/ - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - ulNumTssts, - f_pChannelTsstRemove->ulTimeslot, - f_pChannelTsstRemove->ulStream, - cOCT6100_OUTPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_CHANNEL_TSST_REMOVE_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_CHANNEL_TSST_REMOVE_STREAM; - } - else - { - return ulResult; - } - } - - /* Set the TSST value based on the timeslot and stream value.*/ - usTsstValue = (UINT16)( (f_pChannelTsstRemove->ulTimeslot << 5) | f_pChannelTsstRemove->ulStream ); - - while( usCurrentEntry != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_TSST_LIST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTsstEntry, usCurrentEntry ); - - if ( usTsstValue == pTsstEntry->usTsstValue ) - { - /* A match was found.*/ - *f_pusTsstEntry = usCurrentEntry; - *f_pusTsstIndex = pTsstEntry->usTsstMemoryIndex; - break; - } - - /* Move on to the next entry.*/ - *f_pusPrevTsstEntry = usCurrentEntry; - usCurrentEntry = pTsstEntry->usNextEntry; - } - - if ( *f_pusTsstEntry == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CHANNEL_TSST_REMOVE_INVALID_TSST; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInvalidateTsstRemoveStructs - -Description: Invalidate the entry of the broadcast TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usChanIndex Channel index. -f_usTsstIndex TSST index within the TSST control memory. -f_ulPort Channel port where the TSST are removed from. (only used if remove all == TRUE) -f_fRemoveAll Remove all flag. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInvalidateTsstRemoveStructs -UINT32 Oct6100ApiInvalidateTsstRemoveStructs( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChanIndex, - IN UINT16 f_usTsstIndex, - IN UINT32 f_ulPort, - IN BOOL f_fRemoveAll ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - if ( f_fRemoveAll == FALSE ) - { - /* Deactivate the entry now.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( (f_usTsstIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else /* f_fRemoveAll == TRUE */ - { - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_API_TSST_ENTRY pTsstEntry; - UINT16 usTsstEntry; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, f_usChanIndex ); - - /* Clear all entry associated to the selected port.*/ - if ( f_ulPort == cOCT6100_CHANNEL_PORT_ROUT ) - usTsstEntry = pChanEntry->TdmConfig.usRoutBrdcastTsstFirstEntry; - else - usTsstEntry = pChanEntry->TdmConfig.usSoutBrdcastTsstFirstEntry; - - do - { - mOCT6100_GET_TSST_LIST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTsstEntry, usTsstEntry ); - - /* Deactivate the entry now.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( ( pTsstEntry->usTsstMemoryIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usTsstEntry = pTsstEntry->usNextEntry; - - } while ( usTsstEntry != cOCT6100_INVALID_INDEX ); - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseTsstRemoveResources - -Description: Release all API resources associated to the Removed TSST and - update the channel entry accordingly. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelTsstRemove Pointer to echo cancellation channel open configuration structure. -f_usChanIndex Channel index. -f_usTsstIndex TSST index within the TSST control memory. -f_usTsstEntry TSST entry within the API's TSST list. -f_usPrevTsstEntry Previous TSST entry within the API's TSST list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseTsstRemoveResources -UINT32 Oct6100ApiReleaseTsstRemoveResources( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelTsstRemove, - IN UINT16 f_usChanIndex, - IN UINT16 f_usTsstIndex, - IN UINT16 f_usTsstEntry, - IN UINT16 f_usPrevTsstEntry ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_API_TSST_ENTRY pTsstEntry; - tPOCT6100_API_TSST_ENTRY pPrevTsstEntry; - UINT16 usCurrentEntry; - UINT32 ulResult; - UINT32 ulTimeslot; - UINT32 ulStream; - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, f_usChanIndex ); - - if ( f_pChannelTsstRemove->fRemoveAll == FALSE ) - { - mOCT6100_GET_TSST_LIST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTsstEntry, f_usTsstEntry ); - - /* Update the channel entry.*/ - if ( f_pChannelTsstRemove->ulPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - /* Check if the entry was the first in the list.*/ - if ( f_usPrevTsstEntry == cOCT6100_INVALID_INDEX ) - { - pChanEntry->TdmConfig.usRoutBrdcastTsstFirstEntry = pTsstEntry->usNextEntry; - } - else /* f_ulPrevTsstEntry != cOCT6100_INVALID_INDEX */ - { - /* Get a pointer to the previous entry.*/ - mOCT6100_GET_TSST_LIST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pPrevTsstEntry, f_usPrevTsstEntry ); - pPrevTsstEntry->usNextEntry = pTsstEntry->usNextEntry; - } - - /* Decrement the number of entry.*/ - pChanEntry->TdmConfig.usRoutBrdcastTsstNumEntry--; - } - else /* f_pChannelTsstRemove->ulPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - /* Check if the entry was the first in the list.*/ - if ( f_usPrevTsstEntry == cOCT6100_INVALID_INDEX ) - { - pChanEntry->TdmConfig.usSoutBrdcastTsstFirstEntry = pTsstEntry->usNextEntry; - } - else /* f_ulPrevTsstEntry != cOCT6100_INVALID_INDEX */ - { - /* Get a pointer to the previous entry.*/ - mOCT6100_GET_TSST_LIST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pPrevTsstEntry, f_usPrevTsstEntry ); - pPrevTsstEntry->usNextEntry = pTsstEntry->usNextEntry; - } - - /* Decrement the number of entry.*/ - pChanEntry->TdmConfig.usSoutBrdcastTsstNumEntry--; - } - - ulTimeslot = pTsstEntry->usTsstValue >> 5; - ulStream = pTsstEntry->usTsstValue & 0x1F; - - /* Release the entry.*/ - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - ulTimeslot, - ulStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_OUTPUT_TSST, - f_usTsstEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else /* f_pChannelTsstRemove->fRemoveAll == TRUE */ - { - - /* Update the channel entry.*/ - if ( f_pChannelTsstRemove->ulPort == cOCT6100_CHANNEL_PORT_ROUT ) - usCurrentEntry = pChanEntry->TdmConfig.usRoutBrdcastTsstFirstEntry; - else - usCurrentEntry = pChanEntry->TdmConfig.usSoutBrdcastTsstFirstEntry; - - do - { - mOCT6100_GET_TSST_LIST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTsstEntry, usCurrentEntry ); - - ulTimeslot = pTsstEntry->usTsstValue >> 5; - ulStream = pTsstEntry->usTsstValue & 0x1F; - - /* Release the entry.*/ - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - ulTimeslot, - ulStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_OUTPUT_TSST, - usCurrentEntry ); /* Release the entry.*/ - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usCurrentEntry = pTsstEntry->usNextEntry; - - /* Clear the previous node.*/ - pTsstEntry->usTsstMemoryIndex = 0xFFFF; - pTsstEntry->usTsstValue = 0xFFFF; - pTsstEntry->usNextEntry = cOCT6100_INVALID_INDEX; - - } while ( usCurrentEntry != cOCT6100_INVALID_INDEX ); - - /* Reset the channel status.*/ - if ( f_pChannelTsstRemove->ulPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - pChanEntry->TdmConfig.usRoutBrdcastTsstFirstEntry = cOCT6100_INVALID_INDEX; - pChanEntry->TdmConfig.usRoutBrdcastTsstNumEntry = 0; - } - else - { - pChanEntry->TdmConfig.usSoutBrdcastTsstFirstEntry = cOCT6100_INVALID_INDEX; - pChanEntry->TdmConfig.usSoutBrdcastTsstNumEntry = 0; - } - } - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiChannelGetStatsSer - -Description: Serialized function that returns all the stats of the specified - channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelStats Pointer to a channel stats structure. -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiChannelGetStatsSer -UINT32 Oct6100ApiChannelGetStatsSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_STATS f_pChannelStats ) -{ - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_READ_BURST_PARAMS BurstParams; - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_TSST_ENTRY pTsstEntry; - UINT32 ulEntryOpenCnt; - UINT16 usCurrentEntry; - UINT16 usTsstCount; - UINT32 ulBaseAddress; - UINT32 ulFeatureBytesOffset; - UINT32 ulFeatureBitOffset; - UINT32 ulFeatureFieldLength; - UINT32 ulTempData; - UINT32 ulMask; - UINT16 usChanIndex; - UINT16 ausReadData[ 32 ]; - - BYTE byRinEnergyRaw; - BYTE bySinEnergyRaw; - BYTE bySoutEnergyRaw; - INT32 lSoutEnergyIndB; - BYTE byCnEnergyRaw; - UINT16 usEchoDelayInFrames; - UINT16 usErlRaw; - - UINT32 ulResult; - UINT16 usReadData; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - BurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - BurstParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - BurstParams.pusReadData = ausReadData; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* Check the reset stats flag.*/ - if ( f_pChannelStats->fResetStats != TRUE && f_pChannelStats->fResetStats != FALSE ) - return cOCT6100_ERR_CHANNEL_STATS_RESET; - - /* Check the provided handle. */ - if ( cOCT6100_HNDL_TAG_CHANNEL != (f_pChannelStats->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - usChanIndex = (UINT16)( f_pChannelStats->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( usChanIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, usChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pChannelStats->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - - /* Check the value of the max broadcast tsst.*/ - if ( f_pChannelStats->TdmConfig.ulMaxBroadcastTssts > cOCT6100_MAX_TSSTS ) - return cOCT6100_ERR_CHANNEL_GET_STATS_MAX_BROADCAST_TSST; - - if ( f_pChannelStats->TdmConfig.ulMaxBroadcastTssts != 0 ) - { - /* Check if memory was allocated by the user for the stream and timeslot values.*/ - if ( f_pChannelStats->TdmConfig.pulRoutBroadcastTimeslot == NULL ) - return cOCT6100_ERR_CHANNEL_ROUT_BROADCAST_TIMESLOT; - - if ( f_pChannelStats->TdmConfig.pulRoutBroadcastStream == NULL ) - return cOCT6100_ERR_CHANNEL_ROUT_BROADCAST_STREAM; - - if ( f_pChannelStats->TdmConfig.pulSoutBroadcastTimeslot == NULL ) - return cOCT6100_ERR_CHANNEL_SOUT_BROADCAST_TIMESLOT; - - if ( f_pChannelStats->TdmConfig.pulSoutBroadcastStream == NULL ) - return cOCT6100_ERR_CHANNEL_SOUT_BROADCAST_STREAM; - } - - /* Copy the general configuration.*/ - f_pChannelStats->ulUserChanId = pChanEntry->ulUserChanId; - f_pChannelStats->ulEchoOperationMode = pChanEntry->byEchoOperationMode; - f_pChannelStats->fEnableToneDisabler = pChanEntry->fEnableToneDisabler; - f_pChannelStats->ulMutePortsMask = pChanEntry->usMutedPorts; - f_pChannelStats->fEnableExtToneDetection = pChanEntry->fEnableExtToneDetection; - - - - /* Copy the TDM configuration.*/ - f_pChannelStats->TdmConfig.ulNumRoutBroadcastTssts = pChanEntry->TdmConfig.usRoutBrdcastTsstNumEntry; - f_pChannelStats->TdmConfig.ulNumSoutBroadcastTssts = pChanEntry->TdmConfig.usSoutBrdcastTsstNumEntry; - - f_pChannelStats->TdmConfig.ulSinNumTssts = pChanEntry->TdmConfig.bySinNumTssts; - f_pChannelStats->TdmConfig.ulSinTimeslot = pChanEntry->TdmConfig.usSinTimeslot; - f_pChannelStats->TdmConfig.ulSinStream = pChanEntry->TdmConfig.usSinStream; - f_pChannelStats->TdmConfig.ulSinPcmLaw = pChanEntry->TdmConfig.bySinPcmLaw; - - f_pChannelStats->TdmConfig.ulSoutNumTssts = pChanEntry->TdmConfig.bySoutNumTssts; - f_pChannelStats->TdmConfig.ulSoutTimeslot = pChanEntry->TdmConfig.usSoutTimeslot; - f_pChannelStats->TdmConfig.ulSoutStream = pChanEntry->TdmConfig.usSoutStream; - f_pChannelStats->TdmConfig.ulSoutPcmLaw = pChanEntry->TdmConfig.bySoutPcmLaw; - - /* Copy the SOUT Broadcast TSST into the Stream and timeslot array.*/ - usCurrentEntry = pChanEntry->TdmConfig.usSoutBrdcastTsstFirstEntry; - for( usTsstCount = 0; (usTsstCount < pChanEntry->TdmConfig.usSoutBrdcastTsstNumEntry) && (usTsstCount < f_pChannelStats->TdmConfig.ulMaxBroadcastTssts); usTsstCount++ ) - { - if ( usCurrentEntry == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_FATAL_F; - - mOCT6100_GET_TSST_LIST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTsstEntry, usCurrentEntry ); - - f_pChannelStats->TdmConfig.pulSoutBroadcastStream[ usTsstCount ] = pTsstEntry->usTsstValue & 0x1F; - f_pChannelStats->TdmConfig.pulSoutBroadcastStream[ usTsstCount ] = pTsstEntry->usTsstValue >> 5; - - /* Obtain the index of the next entry.*/ - usCurrentEntry = pTsstEntry->usNextEntry; - } - - /* Check if all Sout Broadcast TSST were returned.*/ - if ( usTsstCount < pChanEntry->TdmConfig.usSoutBrdcastTsstNumEntry ) - { - f_pChannelStats->TdmConfig.fMoreSoutBroadcastTssts = TRUE; - } - else /* usTsstCount >= pChanEntry->TdmConfig.usSoutBrdcastTsstNumEntry */ - { - f_pChannelStats->TdmConfig.fMoreSoutBroadcastTssts = FALSE; - } - - f_pChannelStats->TdmConfig.ulRinNumTssts = pChanEntry->TdmConfig.byRinNumTssts; - f_pChannelStats->TdmConfig.ulRinTimeslot = pChanEntry->TdmConfig.usRinTimeslot; - f_pChannelStats->TdmConfig.ulRinStream = pChanEntry->TdmConfig.usRinStream; - f_pChannelStats->TdmConfig.ulRinPcmLaw = pChanEntry->TdmConfig.byRinPcmLaw; - - f_pChannelStats->TdmConfig.ulRoutNumTssts = pChanEntry->TdmConfig.byRoutNumTssts; - f_pChannelStats->TdmConfig.ulRoutTimeslot = pChanEntry->TdmConfig.usRoutTimeslot; - f_pChannelStats->TdmConfig.ulRoutStream = pChanEntry->TdmConfig.usRoutStream; - f_pChannelStats->TdmConfig.ulRoutPcmLaw = pChanEntry->TdmConfig.byRoutPcmLaw; - - - /* Copy the ROUT Broadcast TSST into the Stream and timeslot array.*/ - usCurrentEntry = pChanEntry->TdmConfig.usRoutBrdcastTsstFirstEntry; - for( usTsstCount = 0; (usTsstCount < pChanEntry->TdmConfig.usRoutBrdcastTsstNumEntry) && (usTsstCount < f_pChannelStats->TdmConfig.ulMaxBroadcastTssts); usTsstCount++ ) - { - if ( usCurrentEntry == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_FATAL_10; - - mOCT6100_GET_TSST_LIST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTsstEntry, usCurrentEntry ); - - f_pChannelStats->TdmConfig.pulRoutBroadcastStream[ usTsstCount ] = pTsstEntry->usTsstValue & 0x1F; - f_pChannelStats->TdmConfig.pulRoutBroadcastStream[ usTsstCount ] = pTsstEntry->usTsstValue >> 5; - - /* Obtain the index of the next entry.*/ - usCurrentEntry = pTsstEntry->usNextEntry; - } - - /* Check if all Rout Broadcast TSST were returned.*/ - if ( usTsstCount < pChanEntry->TdmConfig.usRoutBrdcastTsstNumEntry ) - { - f_pChannelStats->TdmConfig.fMoreRoutBroadcastTssts = TRUE; - } - else /* usTsstCount >= pChanEntry->TdmConfig.usRoutBrdcastTsstNumEntry */ - { - f_pChannelStats->TdmConfig.fMoreRoutBroadcastTssts = FALSE; - } - - /* Copy the VQE configuration.*/ - f_pChannelStats->VqeConfig.fEnableNlp = pChanEntry->VqeConfig.fEnableNlp; - f_pChannelStats->VqeConfig.ulComfortNoiseMode = pChanEntry->VqeConfig.byComfortNoiseMode; - f_pChannelStats->VqeConfig.fEnableTailDisplacement = pChanEntry->VqeConfig.fEnableTailDisplacement; - if ( pChanEntry->VqeConfig.usTailDisplacement != cOCT6100_AUTO_SELECT_TAIL ) - f_pChannelStats->VqeConfig.ulTailDisplacement = pChanEntry->VqeConfig.usTailDisplacement; - else - f_pChannelStats->VqeConfig.ulTailDisplacement = f_pApiInstance->pSharedInfo->ChipConfig.usTailDisplacement; - - if ( pChanEntry->VqeConfig.usTailLength != cOCT6100_AUTO_SELECT_TAIL ) - f_pChannelStats->VqeConfig.ulTailLength = pChanEntry->VqeConfig.usTailLength; - else - f_pChannelStats->VqeConfig.ulTailLength = f_pApiInstance->pSharedInfo->ImageInfo.usMaxTailLength; - - - - f_pChannelStats->VqeConfig.fSinDcOffsetRemoval = pChanEntry->VqeConfig.fSinDcOffsetRemoval; - f_pChannelStats->VqeConfig.fRinDcOffsetRemoval = pChanEntry->VqeConfig.fRinDcOffsetRemoval; - f_pChannelStats->VqeConfig.fRinLevelControl = pChanEntry->VqeConfig.fRinLevelControl; - f_pChannelStats->VqeConfig.fSoutLevelControl = pChanEntry->VqeConfig.fSoutLevelControl; - f_pChannelStats->VqeConfig.fRinAutomaticLevelControl = pChanEntry->VqeConfig.fRinAutomaticLevelControl; - f_pChannelStats->VqeConfig.fSoutAutomaticLevelControl = pChanEntry->VqeConfig.fSoutAutomaticLevelControl; - f_pChannelStats->VqeConfig.fRinHighLevelCompensation = pChanEntry->VqeConfig.fRinHighLevelCompensation; - f_pChannelStats->VqeConfig.fSoutAdaptiveNoiseReduction = pChanEntry->VqeConfig.fSoutAdaptiveNoiseReduction; - f_pChannelStats->VqeConfig.fSoutNoiseBleaching = pChanEntry->VqeConfig.fSoutNoiseBleaching; - f_pChannelStats->VqeConfig.fSoutConferencingNoiseReduction = pChanEntry->VqeConfig.fSoutConferencingNoiseReduction; - f_pChannelStats->VqeConfig.lRinLevelControlGainDb = pChanEntry->VqeConfig.chRinLevelControlGainDb; - f_pChannelStats->VqeConfig.lSoutLevelControlGainDb = pChanEntry->VqeConfig.chSoutLevelControlGainDb; - f_pChannelStats->VqeConfig.lRinAutomaticLevelControlTargetDb = pChanEntry->VqeConfig.chRinAutomaticLevelControlTargetDb; - f_pChannelStats->VqeConfig.lSoutAutomaticLevelControlTargetDb = pChanEntry->VqeConfig.chSoutAutomaticLevelControlTargetDb; - f_pChannelStats->VqeConfig.lRinHighLevelCompensationThresholdDb = pChanEntry->VqeConfig.chRinHighLevelCompensationThresholdDb; - f_pChannelStats->VqeConfig.fAcousticEcho = pChanEntry->VqeConfig.fAcousticEcho; - f_pChannelStats->VqeConfig.fDtmfToneRemoval = pChanEntry->VqeConfig.fDtmfToneRemoval; - - f_pChannelStats->VqeConfig.lDefaultErlDb = pChanEntry->VqeConfig.chDefaultErlDb; - f_pChannelStats->VqeConfig.lAecDefaultErlDb = pChanEntry->VqeConfig.chAecDefaultErlDb; - f_pChannelStats->VqeConfig.ulAecTailLength = pChanEntry->VqeConfig.usAecTailLength; - f_pChannelStats->VqeConfig.lAnrSnrEnhancementDb = pChanEntry->VqeConfig.chAnrSnrEnhancementDb; - f_pChannelStats->VqeConfig.ulAnrVoiceNoiseSegregation = pChanEntry->VqeConfig.byAnrVoiceNoiseSegregation; - f_pChannelStats->VqeConfig.ulToneDisablerVqeActivationDelay = pChanEntry->VqeConfig.usToneDisablerVqeActivationDelay; - f_pChannelStats->VqeConfig.ulNonLinearityBehaviorA = pChanEntry->VqeConfig.byNonLinearityBehaviorA; - f_pChannelStats->VqeConfig.ulNonLinearityBehaviorB = pChanEntry->VqeConfig.byNonLinearityBehaviorB; - f_pChannelStats->VqeConfig.ulDoubleTalkBehavior = pChanEntry->VqeConfig.byDoubleTalkBehavior; - f_pChannelStats->VqeConfig.ulSoutAutomaticListenerEnhancementGainDb = pChanEntry->VqeConfig.bySoutAutomaticListenerEnhancementGainDb; - f_pChannelStats->VqeConfig.ulSoutNaturalListenerEnhancementGainDb = pChanEntry->VqeConfig.bySoutNaturalListenerEnhancementGainDb; - f_pChannelStats->VqeConfig.fSoutNaturalListenerEnhancement = pChanEntry->VqeConfig.fSoutNaturalListenerEnhancement; - f_pChannelStats->VqeConfig.fRoutNoiseReduction = pChanEntry->VqeConfig.fRoutNoiseReduction; - f_pChannelStats->VqeConfig.lRoutNoiseReductionLevelGainDb = pChanEntry->VqeConfig.chRoutNoiseReductionLevelGainDb; - f_pChannelStats->VqeConfig.fEnableMusicProtection = pChanEntry->VqeConfig.fEnableMusicProtection; - f_pChannelStats->VqeConfig.fIdleCodeDetection = pChanEntry->VqeConfig.fIdleCodeDetection; - - /* Copy the CODEC configuration.*/ - f_pChannelStats->CodecConfig.ulAdpcmNibblePosition = pChanEntry->CodecConfig.byAdpcmNibblePosition; - - f_pChannelStats->CodecConfig.ulEncoderPort = pChanEntry->CodecConfig.byEncoderPort; - f_pChannelStats->CodecConfig.ulEncodingRate = pChanEntry->CodecConfig.byEncodingRate; - - f_pChannelStats->CodecConfig.ulDecoderPort = pChanEntry->CodecConfig.byDecoderPort; - f_pChannelStats->CodecConfig.ulDecodingRate = pChanEntry->CodecConfig.byDecodingRate; - - f_pChannelStats->CodecConfig.fEnableSilenceSuppression = pChanEntry->CodecConfig.fEnableSilenceSuppression; - f_pChannelStats->CodecConfig.ulPhase = pChanEntry->CodecConfig.byPhase; - f_pChannelStats->CodecConfig.ulPhasingType = pChanEntry->CodecConfig.byPhasingType; - - if ( pChanEntry->usPhasingTsstIndex != cOCT6100_INVALID_INDEX ) - { - tPOCT6100_API_PHASING_TSST pPhasingTsstEntry; - - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pPhasingTsstEntry, pChanEntry->usPhasingTsstIndex ); - - f_pChannelStats->CodecConfig.ulPhasingTsstHndl = cOCT6100_HNDL_TAG_PHASING_TSST | (pPhasingTsstEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | pChanEntry->usPhasingTsstIndex; - } - else - { - f_pChannelStats->CodecConfig.ulPhasingTsstHndl = cOCT6100_INVALID_HANDLE; - } - - - /* Reset the stats and exit if the reset flag is set.*/ - if ( f_pChannelStats->fResetStats == TRUE ) - { - pChanEntry->sMaxERLE = cOCT6100_INVALID_SIGNED_STAT_W; - pChanEntry->sMaxERL = cOCT6100_INVALID_SIGNED_STAT_W; - pChanEntry->usMaxEchoDelay = cOCT6100_INVALID_STAT_W; - } - - /*---------------------------------------------------------------------*/ - /* Update the API internal stats.*/ - - BurstParams.ulReadAddress = f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemBase + (usChanIndex * f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemSize ); - BurstParams.ulReadAddress += f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoMemOfst + f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoStatsOfst; - BurstParams.ulReadLength = f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoStatsSize / 2; /* Length in words.*/ - - mOCT6100_DRIVER_READ_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the energy stat are found in the new memory location. */ - if ( ( pSharedInfo->ImageInfo.fRinEnergyStat == TRUE ) - && ( pSharedInfo->ImageInfo.fSoutEnergyStat == TRUE ) ) - { - ulFeatureBytesOffset = f_pApiInstance->pSharedInfo->MemoryMap.RinEnergyStatFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = f_pApiInstance->pSharedInfo->MemoryMap.RinEnergyStatFieldOfst.byBitOffset; - ulFeatureFieldLength = f_pApiInstance->pSharedInfo->MemoryMap.RinEnergyStatFieldOfst.byFieldSize; - - ReadParams.ulReadAddress = f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemBase + (usChanIndex * f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemSize ); - ReadParams.ulReadAddress += f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoMemOfst + ulFeatureBytesOffset; - - /* Optimize this access by only reading the word we are interested in. */ - if ( ulFeatureBitOffset < 16 ) - ReadParams.ulReadAddress += 2; - - /* Must read in memory directly since this value is changed by hardware */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move data at correct position according to what was read. */ - if ( ulFeatureBitOffset < 16 ) - ulTempData = usReadData; - else - ulTempData = usReadData << 16; - - /* Clear previous value set in the feature field. */ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= ulMask; - - /* Shift to get value. */ - ulTempData = ulTempData >> ulFeatureBitOffset; - - /* Overwrite value read the old way. */ - ausReadData[ 0 ] &= 0x00FF; - ausReadData[ 0 ] |= (UINT16)( ( ulTempData << 8 ) & 0xFF00 ); - - ulFeatureBytesOffset = f_pApiInstance->pSharedInfo->MemoryMap.SoutEnergyStatFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = f_pApiInstance->pSharedInfo->MemoryMap.SoutEnergyStatFieldOfst.byBitOffset; - ulFeatureFieldLength = f_pApiInstance->pSharedInfo->MemoryMap.SoutEnergyStatFieldOfst.byFieldSize; - - ReadParams.ulReadAddress = f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemBase + (usChanIndex * f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemSize ); - ReadParams.ulReadAddress += f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoMemOfst + ulFeatureBytesOffset; - - /* Optimize this access by only reading the word we are interested in. */ - if ( ulFeatureBitOffset < 16 ) - ReadParams.ulReadAddress += 2; - - /* Must read in memory directly since this value is changed by hardware */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move data at correct position according to what was read. */ - if ( ulFeatureBitOffset < 16 ) - ulTempData = usReadData; - else - ulTempData = usReadData << 16; - - /* Clear previous value set in the feature field. */ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= ulMask; - - /* Shift to get value. */ - ulTempData = ulTempData >> ulFeatureBitOffset; - - /* Overwrite value read the old way. */ - ausReadData[ 1 ] &= 0x00FF; - ausReadData[ 1 ] |= (UINT16)( ( ulTempData << 8 ) & 0xFF00 ); - } - - byRinEnergyRaw = (BYTE)(( ausReadData[ 0 ] >> 8 ) & 0xFF); - bySinEnergyRaw = (BYTE)(( ausReadData[ 0 ] >> 0 ) & 0xFF); - bySoutEnergyRaw = (BYTE)(( ausReadData[ 1 ] >> 8 ) & 0xFF); - byCnEnergyRaw = (BYTE)(( ausReadData[ 5 ] >> 8 ) & 0xFF); - - usEchoDelayInFrames = (UINT16)(ausReadData[ 4 ]); - usErlRaw = ausReadData[ 2 ]; - - pChanEntry->byToneDisablerStatus = (UINT8)(( ausReadData[ 5 ] >> 0 ) & 0xFF); - if ( f_pChannelStats->fResetStats == TRUE ) - { - pChanEntry->usNumEchoPathChangesOfst = (UINT16)(ausReadData[ 3 ]); - pChanEntry->usNumEchoPathChanges = 0; - } - else /* if ( f_pChannelStats->fResetStats == FALSE ) */ - { - pChanEntry->usNumEchoPathChanges = (UINT16)( ausReadData[ 3 ] - pChanEntry->usNumEchoPathChangesOfst ); - } - - pChanEntry->sComfortNoiseLevel = (INT16)( Oct6100ApiOctFloatToDbEnergyByte( byCnEnergyRaw ) & 0xFFFF ); - pChanEntry->sComfortNoiseLevel -= 12; - pChanEntry->sRinLevel = (INT16)( Oct6100ApiOctFloatToDbEnergyByte( byRinEnergyRaw ) & 0xFFFF ); - pChanEntry->sRinLevel -= 12; - pChanEntry->sSinLevel = (INT16)( Oct6100ApiOctFloatToDbEnergyByte( bySinEnergyRaw ) & 0xFFFF ); - pChanEntry->sSinLevel -= 12; - lSoutEnergyIndB = Oct6100ApiOctFloatToDbEnergyByte( bySoutEnergyRaw ); - lSoutEnergyIndB -= 12; - - /* Process some stats only if the channel is converged.*/ - if ( ( usEchoDelayInFrames != cOCT6100_INVALID_ECHO_DELAY ) - && ( pChanEntry->byEchoOperationMode != cOCT6100_ECHO_OP_MODE_POWER_DOWN ) - && ( pChanEntry->byEchoOperationMode != cOCT6100_ECHO_OP_MODE_HT_RESET ) ) - { - /* Update the current ERL. */ - pChanEntry->sCurrentERL = (INT16)( Oct6100ApiOctFloatToDbEnergyHalf( usErlRaw ) & 0xFFFF ); - pChanEntry->sCurrentERLE = (INT16)( ( lSoutEnergyIndB - pChanEntry->sSinLevel ) & 0xFFFF ); - pChanEntry->usCurrentEchoDelay = (UINT16)( usEchoDelayInFrames / 8 ); /* To convert in msec.*/ - - /* Update the max value if required.*/ - if ( pChanEntry->usCurrentEchoDelay > pChanEntry->usMaxEchoDelay || - pChanEntry->usMaxEchoDelay == cOCT6100_INVALID_STAT_W ) - { - pChanEntry->usMaxEchoDelay = pChanEntry->usCurrentEchoDelay; - } - - if ( pChanEntry->sCurrentERL > pChanEntry->sMaxERL || - pChanEntry->sMaxERL == cOCT6100_INVALID_SIGNED_STAT_W ) - { - pChanEntry->sMaxERL = pChanEntry->sCurrentERL; - } - - if ( pChanEntry->sCurrentERLE > pChanEntry->sMaxERLE || - pChanEntry->sMaxERLE == cOCT6100_INVALID_SIGNED_STAT_W ) - { - pChanEntry->sMaxERLE = pChanEntry->sCurrentERLE; - } - } - else - { - pChanEntry->sCurrentERLE = cOCT6100_INVALID_SIGNED_STAT_W; - pChanEntry->sCurrentERL = cOCT6100_INVALID_SIGNED_STAT_W; - pChanEntry->usCurrentEchoDelay = cOCT6100_INVALID_STAT_W; - } - - if ( f_pApiInstance->pSharedInfo->ImageInfo.fRinAppliedGainStat == TRUE ) - { - /* Calculate base address for auto level control + high level compensation configuration. */ - ulBaseAddress = f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemBase + ( usChanIndex * f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemSize ) + f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoMemOfst; - - ulFeatureBytesOffset = f_pApiInstance->pSharedInfo->MemoryMap.RinAppliedGainStatOfst.usDwordOffset * 4; - ulFeatureBitOffset = f_pApiInstance->pSharedInfo->MemoryMap.RinAppliedGainStatOfst.byBitOffset; - ulFeatureFieldLength = f_pApiInstance->pSharedInfo->MemoryMap.RinAppliedGainStatOfst.byFieldSize; - - ReadParams.ulReadAddress = ulBaseAddress + ulFeatureBytesOffset; - - /* Optimize this access by only reading the word we are interested in. */ - if ( ulFeatureBitOffset < 16 ) - ReadParams.ulReadAddress += 2; - - /* Must read in memory directly since this value is changed by hardware */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move data at correct position according to what was read. */ - if ( ulFeatureBitOffset < 16 ) - ulTempData = usReadData; - else - ulTempData = usReadData << 16; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= ulMask; - - /* Shift to get value. */ - ulTempData = ulTempData >> ulFeatureBitOffset; - - pChanEntry->sRinAppliedGain = (INT16)( 2 * (INT16)( Oct6100ApiOctFloatToDbEnergyHalf( (UINT16)( ulTempData & 0xFFFF ) ) & 0xFFFF ) ); - } - - if ( f_pApiInstance->pSharedInfo->ImageInfo.fSoutAppliedGainStat == TRUE ) - { - /* Calculate base address for auto level control + high level compensation configuration. */ - ulBaseAddress = f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemBase + ( usChanIndex * f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemSize ) + f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoMemOfst; - - ulFeatureBytesOffset = f_pApiInstance->pSharedInfo->MemoryMap.SoutAppliedGainStatOfst.usDwordOffset * 4; - ulFeatureBitOffset = f_pApiInstance->pSharedInfo->MemoryMap.SoutAppliedGainStatOfst.byBitOffset; - ulFeatureFieldLength = f_pApiInstance->pSharedInfo->MemoryMap.SoutAppliedGainStatOfst.byFieldSize; - - ReadParams.ulReadAddress = ulBaseAddress + ulFeatureBytesOffset; - - /* Optimize this access by only reading the word we are interested in. */ - if ( ulFeatureBitOffset < 16 ) - ReadParams.ulReadAddress += 2; - - /* Must read in memory directly since this value is changed by hardware */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move data at correct position according to what was read. */ - if ( ulFeatureBitOffset < 16 ) - ulTempData = usReadData; - else - ulTempData = usReadData << 16; - - /* Clear previous value set in the feature field. */ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= ulMask; - - /* Shift to get value. */ - ulTempData = ulTempData >> ulFeatureBitOffset; - - pChanEntry->sSoutAppliedGain = (INT16)( 2 * (INT16)( Oct6100ApiOctFloatToDbEnergyHalf( (UINT16)( ulTempData & 0xFFFF ) ) & 0xFFFF ) ); - } - - /*---------------------------------------------------------------------*/ - /* Return the real stats.*/ - - f_pChannelStats->ulNumEchoPathChanges = pChanEntry->usNumEchoPathChanges; - if ( usEchoDelayInFrames != cOCT6100_INVALID_ECHO_DELAY ) - { - f_pChannelStats->fEchoCancellerConverged = TRUE; - } - else - { - f_pChannelStats->fEchoCancellerConverged = FALSE; - } - if ( pChanEntry->sCurrentERL == cOCT6100_INVALID_SIGNED_STAT_W ) - f_pChannelStats->lCurrentERL = cOCT6100_INVALID_SIGNED_STAT; - else - f_pChannelStats->lCurrentERL = pChanEntry->sCurrentERL; - - if ( pChanEntry->sMaxERL == cOCT6100_INVALID_SIGNED_STAT_W ) - f_pChannelStats->lMaxERL = cOCT6100_INVALID_SIGNED_STAT; - else - f_pChannelStats->lMaxERL = pChanEntry->sMaxERL; - - if ( pChanEntry->usMaxEchoDelay == cOCT6100_INVALID_STAT_W ) - f_pChannelStats->ulMaxEchoDelay = cOCT6100_INVALID_STAT; - else - f_pChannelStats->ulMaxEchoDelay = pChanEntry->usMaxEchoDelay; - - if ( pChanEntry->sRinLevel == cOCT6100_INVALID_SIGNED_STAT_W ) - f_pChannelStats->lRinLevel = cOCT6100_INVALID_SIGNED_STAT; - else - f_pChannelStats->lRinLevel = pChanEntry->sRinLevel; - - if ( pSharedInfo->ImageInfo.fSinLevel == TRUE ) - { - if ( pChanEntry->sSinLevel == cOCT6100_INVALID_SIGNED_STAT_W ) - f_pChannelStats->lSinLevel = cOCT6100_INVALID_SIGNED_STAT; - else - f_pChannelStats->lSinLevel = pChanEntry->sSinLevel; - } - else /* if ( pSharedInfo->ImageInfo.fSinLevel != TRUE ) */ - { - /* SIN level is not supported in this image. */ - f_pChannelStats->lSinLevel = cOCT6100_INVALID_SIGNED_STAT; - } - - f_pChannelStats->lRinAppliedGain = pChanEntry->VqeConfig.chRinLevelControlGainDb; - if ( ( f_pApiInstance->pSharedInfo->ImageInfo.fRinAppliedGainStat == TRUE ) - && ( ( pChanEntry->VqeConfig.fRinAutomaticLevelControl == TRUE ) - || ( pChanEntry->VqeConfig.fRinHighLevelCompensation == TRUE ) ) ) - { - f_pChannelStats->lRinAppliedGain = pChanEntry->sRinAppliedGain; - } - - f_pChannelStats->lSoutAppliedGain = pChanEntry->VqeConfig.chSoutLevelControlGainDb; - if ( ( f_pApiInstance->pSharedInfo->ImageInfo.fSoutAppliedGainStat == TRUE ) - && ( pChanEntry->VqeConfig.fSoutAutomaticLevelControl == TRUE ) ) - { - f_pChannelStats->lSoutAppliedGain = pChanEntry->sSoutAppliedGain; - } - - if ( pChanEntry->usCurrentEchoDelay == cOCT6100_INVALID_STAT_W ) - f_pChannelStats->ulCurrentEchoDelay = cOCT6100_INVALID_STAT; - else - f_pChannelStats->ulCurrentEchoDelay = pChanEntry->usCurrentEchoDelay; - - if ( pSharedInfo->ImageInfo.fSinLevel == TRUE ) - { - if ( pChanEntry->sCurrentERLE == cOCT6100_INVALID_SIGNED_STAT_W ) - f_pChannelStats->lCurrentERLE = cOCT6100_INVALID_SIGNED_STAT; - else - f_pChannelStats->lCurrentERLE = pChanEntry->sCurrentERLE; - } - else /* if ( pSharedInfo->ImageInfo.fSinLevel != TRUE ) */ - { - f_pChannelStats->lCurrentERLE = cOCT6100_INVALID_SIGNED_STAT; - } - - if ( pSharedInfo->ImageInfo.fSinLevel == TRUE ) - { - if ( pChanEntry->sMaxERLE == cOCT6100_INVALID_SIGNED_STAT_W ) - f_pChannelStats->lMaxERLE = cOCT6100_INVALID_SIGNED_STAT; - else - f_pChannelStats->lMaxERLE = pChanEntry->sMaxERLE; - } - else /* if ( pSharedInfo->ImageInfo.fSinLevel != TRUE ) */ - { - f_pChannelStats->lMaxERLE = cOCT6100_INVALID_SIGNED_STAT; - } - - f_pChannelStats->lComfortNoiseLevel = pChanEntry->sComfortNoiseLevel; - f_pChannelStats->ulToneDisablerStatus = pChanEntry->byToneDisablerStatus; - - if ( f_pApiInstance->pSharedInfo->ImageInfo.fSinVoiceDetectedStat == TRUE ) - { - UINT32 ulVoiceDetectedBytesOfst = f_pApiInstance->pSharedInfo->MemoryMap.SinVoiceDetectedStatOfst.usDwordOffset * 4; - UINT32 ulVoiceDetectedBitOfst = f_pApiInstance->pSharedInfo->MemoryMap.SinVoiceDetectedStatOfst.byBitOffset; - UINT32 ulVoiceDetectedFieldSize = f_pApiInstance->pSharedInfo->MemoryMap.SinVoiceDetectedStatOfst.byFieldSize; - - /* Set the channel root base address.*/ - UINT32 ulChannelRootBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( usChanIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + f_pApiInstance->pSharedInfo->MemoryMap.ulChanRootConfOfst; - - ReadParams.ulReadAddress = ulChannelRootBaseAddress + ulVoiceDetectedBytesOfst; - - /* Optimize this access by only reading the word we are interested in. */ - if ( ulVoiceDetectedBitOfst < 16 ) - ReadParams.ulReadAddress += 2; - - /* Must read in memory directly since this value is changed by hardware */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move data at correct position according to what was read. */ - if ( ulVoiceDetectedBitOfst < 16 ) - ulTempData = usReadData; - else - ulTempData = usReadData << 16; - - mOCT6100_CREATE_FEATURE_MASK( ulVoiceDetectedFieldSize, ulVoiceDetectedBitOfst, &ulMask ); - - if ( ( ulTempData & ulMask ) != 0x0 ) - f_pChannelStats->fSinVoiceDetected = TRUE; - else - f_pChannelStats->fSinVoiceDetected = FALSE; - } - - /*---------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveEchoEntry - -Description: Reserves one of the echo channel API entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pusEchoIndex Resulting index reserved in the echo channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveEchoEntry -UINT32 Oct6100ApiReserveEchoEntry( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusEchoIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pEchoAlloc; - UINT32 ulResult; - UINT32 ulEchoIndex; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_CHANNEL_ALLOC_PNT( pSharedInfo, pEchoAlloc ) - - ulResult = OctapiLlmAllocAlloc( pEchoAlloc, &ulEchoIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_CHANNEL_ALL_CHANNELS_ARE_OPENED; - else - return cOCT6100_ERR_FATAL_11; - } - - *f_pusEchoIndex = (UINT16)( ulEchoIndex & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseEchoEntry - -Description: Releases the specified ECHO channel API entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_usEchoIndex Index reserved in the echo channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseEchoEntry -UINT32 Oct6100ApiReleaseEchoEntry( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEchoIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pEchoAlloc; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_CHANNEL_ALLOC_PNT( pSharedInfo, pEchoAlloc ) - - ulResult = OctapiLlmAllocDealloc( pEchoAlloc, f_usEchoIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_12; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveBiDirChanEntry - -Description: Reserves one of the bidirectional channel API entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pusBiDirChanIndex Resulting index reserved in the bidir channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveBiDirChanEntry -UINT32 Oct6100ApiReserveBiDirChanEntry( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusBiDirChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pChanAlloc; - UINT32 ulResult; - UINT32 ulBiDirChanIndex; - - /* Get local pointer to shared portion of the API instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_BIDIR_CHANNEL_ALLOC_PNT( pSharedInfo, pChanAlloc ) - - ulResult = OctapiLlmAllocAlloc( pChanAlloc, &ulBiDirChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_CHANNEL_ALL_BIDIR_CHANNELS_ARE_OPENED; - else - return cOCT6100_ERR_FATAL_9F; - } - - *f_pusBiDirChanIndex = (UINT16)( ulBiDirChanIndex & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseBiDirChanEntry - -Description: Releases the specified bidirectional channel API entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulBiDirChanIndex Bidirectional channel index within the API's Bidir channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseBiDirChanEntry -UINT32 Oct6100ApiReleaseBiDirChanEntry( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulBiDirChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pChanAlloc; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_BIDIR_CHANNEL_ALLOC_PNT( pSharedInfo, pChanAlloc ) - - ulResult = OctapiLlmAllocDealloc( pChanAlloc, f_ulBiDirChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_A0; - } - - return cOCT6100_ERR_OK; -} -#endif - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckTdmConfig - -Description: This function will check the validity of the TDM config parameter - of an Open TDM config structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pTdmConfig TDM config of the channel. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckTdmConfig -UINT32 Oct6100ApiCheckTdmConfig( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_TDM f_pTdmConfig ) -{ - UINT32 ulResult; - - /*==============================================================================*/ - /* Check the TDM configuration parameters.*/ - - /* Check the validity of the timeslot and Stream only if it is defined.*/ - if ( f_pTdmConfig->ulRinTimeslot != cOCT6100_UNASSIGNED || - f_pTdmConfig->ulRinStream != cOCT6100_UNASSIGNED ) - { - if ( f_pTdmConfig->ulRinNumTssts != 1 && - f_pTdmConfig->ulRinNumTssts != 2 ) - return cOCT6100_ERR_CHANNEL_RIN_NUM_TSSTS; - - /* Check the RIN TDM streams, timeslots component for errors.*/ - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - f_pTdmConfig->ulRinNumTssts, - f_pTdmConfig->ulRinTimeslot, - f_pTdmConfig->ulRinStream, - cOCT6100_INPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_CHANNEL_RIN_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_CHANNEL_RIN_STREAM; - } - else - { - return ulResult; - } - } - } - - /* Check the validity of the timeslot and Stream only if it is defined.*/ - if ( f_pTdmConfig->ulRoutTimeslot != cOCT6100_UNASSIGNED || - f_pTdmConfig->ulRoutStream != cOCT6100_UNASSIGNED ) - { - if ( f_pTdmConfig->ulRoutNumTssts != 1 && - f_pTdmConfig->ulRoutNumTssts != 2 ) - return cOCT6100_ERR_CHANNEL_ROUT_NUM_TSSTS; - - /* Check the ROUT TDM streams, timeslots component for errors.*/ - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - f_pTdmConfig->ulRoutNumTssts, - f_pTdmConfig->ulRoutTimeslot, - f_pTdmConfig->ulRoutStream, - cOCT6100_OUTPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_CHANNEL_ROUT_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_CHANNEL_ROUT_STREAM; - } - else - { - return ulResult; - } - } - } - - /* Check the validity of the timeslot and Stream only if it is defined.*/ - if ( f_pTdmConfig->ulSinTimeslot != cOCT6100_UNASSIGNED || - f_pTdmConfig->ulSinStream != cOCT6100_UNASSIGNED ) - { - if ( f_pTdmConfig->ulSinNumTssts != 1 && - f_pTdmConfig->ulSinNumTssts != 2 ) - return cOCT6100_ERR_CHANNEL_SIN_NUM_TSSTS; - - /* Check the SIN TDM streams, timeslots component for errors.*/ - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - f_pTdmConfig->ulSinNumTssts, - f_pTdmConfig->ulSinTimeslot, - f_pTdmConfig->ulSinStream, - cOCT6100_INPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_CHANNEL_SIN_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_CHANNEL_SIN_STREAM; - } - else - { - return ulResult; - } - } - } - - /* Check the validity of the timeslot and Stream only if it is defined.*/ - if ( f_pTdmConfig->ulSoutTimeslot != cOCT6100_UNASSIGNED || - f_pTdmConfig->ulSoutStream != cOCT6100_UNASSIGNED ) - { - if ( f_pTdmConfig->ulSoutNumTssts != 1 && - f_pTdmConfig->ulSoutNumTssts != 2 ) - return cOCT6100_ERR_CHANNEL_SOUT_NUM_TSSTS; - - /* Check the ROUT TDM streams, timeslots component for errors.*/ - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - f_pTdmConfig->ulSoutNumTssts, - f_pTdmConfig->ulSoutTimeslot, - f_pTdmConfig->ulSoutStream, - cOCT6100_OUTPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_CHANNEL_SOUT_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_CHANNEL_SOUT_STREAM; - } - else - { - return ulResult; - } - } - } - - /* Check the PCM law parameters.*/ - if ( f_pTdmConfig->ulRinPcmLaw != cOCT6100_PCM_U_LAW && - f_pTdmConfig->ulRinPcmLaw != cOCT6100_PCM_A_LAW ) - return cOCT6100_ERR_CHANNEL_RIN_PCM_LAW; - - if ( f_pTdmConfig->ulSinPcmLaw != cOCT6100_PCM_U_LAW && - f_pTdmConfig->ulSinPcmLaw != cOCT6100_PCM_A_LAW ) - return cOCT6100_ERR_CHANNEL_SIN_PCM_LAW; - - if ( f_pTdmConfig->ulRoutPcmLaw != cOCT6100_PCM_U_LAW && - f_pTdmConfig->ulRoutPcmLaw != cOCT6100_PCM_A_LAW ) - return cOCT6100_ERR_CHANNEL_ROUT_PCM_LAW; - - if ( f_pTdmConfig->ulSoutPcmLaw != cOCT6100_PCM_U_LAW && - f_pTdmConfig->ulSoutPcmLaw != cOCT6100_PCM_A_LAW ) - return cOCT6100_ERR_CHANNEL_SOUT_PCM_LAW; - - /*==============================================================================*/ - - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckVqeConfig - -Description: This function will check the validity of the VQE config parameter - of an Open VQE config structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pVqeConfig VQE config of the channel. -f_fEnableToneDisabler Whether the tone disabler is active or not. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckVqeConfig -UINT32 Oct6100ApiCheckVqeConfig( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN BOOL f_fEnableToneDisabler ) -{ - tPOCT6100_API_IMAGE_INFO pImageInfo; - - pImageInfo = &f_pApiInstance->pSharedInfo->ImageInfo; - - if ( f_pVqeConfig->fEnableNlp != TRUE && f_pVqeConfig->fEnableNlp != FALSE ) - return cOCT6100_ERR_CHANNEL_ENABLE_NLP; - - if ( f_pVqeConfig->fEnableNlp == TRUE && pImageInfo->fNlpControl == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_NLP_CONTROL; - - - - /* Check the comfort noise mode.*/ - if ( f_pVqeConfig->ulComfortNoiseMode != cOCT6100_COMFORT_NOISE_OFF && pImageInfo->fComfortNoise == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_BKG_NOISE_FREEZE; - - if ( f_pVqeConfig->ulComfortNoiseMode != cOCT6100_COMFORT_NOISE_NORMAL && - f_pVqeConfig->ulComfortNoiseMode != cOCT6100_COMFORT_NOISE_EXTENDED && - f_pVqeConfig->ulComfortNoiseMode != cOCT6100_COMFORT_NOISE_FAST_LATCH && - f_pVqeConfig->ulComfortNoiseMode != cOCT6100_COMFORT_NOISE_OFF ) - return cOCT6100_ERR_CHANNEL_COMFORT_NOISE_MODE; - - /* Check the DC offset removal.*/ - if ( f_pVqeConfig->fSinDcOffsetRemoval != TRUE && f_pVqeConfig->fSinDcOffsetRemoval != FALSE ) - return cOCT6100_ERR_CHANNEL_SIN_DC_OFFSET_REM; - - if ( f_pVqeConfig->fSinDcOffsetRemoval == TRUE && pImageInfo->fSinDcOffsetRemoval == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_SIN_DC_OFFSET_REM; - - if ( f_pVqeConfig->fRinDcOffsetRemoval != TRUE && f_pVqeConfig->fRinDcOffsetRemoval != FALSE ) - return cOCT6100_ERR_CHANNEL_RIN_DC_OFFSET_REM; - - if ( f_pVqeConfig->fRinDcOffsetRemoval == TRUE && pImageInfo->fRinDcOffsetRemoval == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_RIN_DC_OFFSET_REM; - - /* Check the Level control.*/ - if ( f_pVqeConfig->fRinLevelControl != TRUE && f_pVqeConfig->fRinLevelControl != FALSE ) - return cOCT6100_ERR_CHANNEL_RIN_LEVEL_CONTROL; - - if ( f_pVqeConfig->fSoutLevelControl != TRUE && f_pVqeConfig->fSoutLevelControl != FALSE ) - return cOCT6100_ERR_CHANNEL_SOUT_LEVEL_CONTROL; - - if ( ( f_pVqeConfig->lRinLevelControlGainDb < -24 ) || ( f_pVqeConfig->lRinLevelControlGainDb > 24 ) ) - return cOCT6100_ERR_CHANNEL_RIN_LEVEL_CONTROL_GAIN; - - if ( ( f_pVqeConfig->lSoutLevelControlGainDb < -24 ) || ( f_pVqeConfig->lSoutLevelControlGainDb > 24 ) ) - return cOCT6100_ERR_CHANNEL_SOUT_LEVEL_CONTROL_GAIN; - - if ( ( f_pVqeConfig->fRinAutomaticLevelControl != TRUE ) && ( f_pVqeConfig->fRinAutomaticLevelControl != FALSE ) ) - return cOCT6100_ERR_CHANNEL_RIN_AUTO_LEVEL_CONTROL; - - if ( ( f_pVqeConfig->fRinHighLevelCompensation != TRUE ) && ( f_pVqeConfig->fRinHighLevelCompensation != FALSE ) ) - return cOCT6100_ERR_CHANNEL_RIN_HIGH_LEVEL_COMP; - - if ( ( f_pVqeConfig->fRinAutomaticLevelControl == TRUE ) && ( pImageInfo->fRinAutoLevelControl == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_RIN_AUTO_LC; - - if ( ( f_pVqeConfig->fRinHighLevelCompensation == TRUE ) && ( pImageInfo->fRinHighLevelCompensation == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_RIN_HIGH_LEVEL_COMP; - - if ( f_pVqeConfig->fRinAutomaticLevelControl == TRUE ) - { - if ( f_pVqeConfig->fRinLevelControl == TRUE ) - return cOCT6100_ERR_CHANNEL_RIN_AUTO_LEVEL_MANUAL; - - if ( f_pVqeConfig->fRinHighLevelCompensation == TRUE ) - return cOCT6100_ERR_CHANNEL_RIN_AUTO_LEVEL_HIGH_LEVEL_COMP; - - if ( ( f_pVqeConfig->lRinAutomaticLevelControlTargetDb < -40 || f_pVqeConfig->lRinAutomaticLevelControlTargetDb > 0 ) ) - return cOCT6100_ERR_CHANNEL_RIN_AUTO_LEVEL_CONTROL_TARGET; - } - - if ( f_pVqeConfig->fRinHighLevelCompensation == TRUE ) - { - if ( f_pVqeConfig->fRinLevelControl == TRUE ) - return cOCT6100_ERR_CHANNEL_RIN_HIGH_LEVEL_COMP_MANUAL; - - if ( ( f_pVqeConfig->lRinHighLevelCompensationThresholdDb < -40 || f_pVqeConfig->lRinHighLevelCompensationThresholdDb > 0 ) ) - return cOCT6100_ERR_CHANNEL_RIN_HIGH_LEVEL_COMP_THRESHOLD; - } - - if ( f_pVqeConfig->fSoutAutomaticLevelControl != TRUE && f_pVqeConfig->fSoutAutomaticLevelControl != FALSE ) - return cOCT6100_ERR_CHANNEL_SOUT_AUTO_LEVEL_CONTROL; - - if ( ( f_pVqeConfig->fSoutAutomaticLevelControl == TRUE ) && ( pImageInfo->fSoutAutoLevelControl == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_SOUT_AUTO_LC; - - if ( f_pVqeConfig->fSoutAutomaticLevelControl == TRUE ) - { - if ( f_pVqeConfig->fSoutLevelControl == TRUE ) - return cOCT6100_ERR_CHANNEL_SOUT_AUTO_LEVEL_MANUAL; - - if ( ( f_pVqeConfig->lSoutAutomaticLevelControlTargetDb < -40 || f_pVqeConfig->lSoutAutomaticLevelControlTargetDb > 0 ) ) - return cOCT6100_ERR_CHANNEL_SOUT_AUTO_LEVEL_CONTROL_TARGET; - } - - if ( f_pVqeConfig->fSoutAdaptiveNoiseReduction != TRUE && - f_pVqeConfig->fSoutAdaptiveNoiseReduction != FALSE ) - return cOCT6100_ERR_CHANNEL_SOUT_ADAPT_NOISE_REDUCTION; - - if ( f_pVqeConfig->fSoutAdaptiveNoiseReduction == TRUE && pImageInfo->fAdaptiveNoiseReduction == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ANR; - - if ( f_pVqeConfig->fSoutConferencingNoiseReduction != TRUE && - f_pVqeConfig->fSoutConferencingNoiseReduction != FALSE ) - return cOCT6100_ERR_CHANNEL_SOUT_CONFERENCE_NOISE_REDUCTION; - - if ( f_pVqeConfig->fSoutConferencingNoiseReduction == TRUE && pImageInfo->fConferencingNoiseReduction == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_CNR; - - /* Validate Sout noise bleaching parameter. */ - if ( f_pVqeConfig->fSoutNoiseBleaching != TRUE && - f_pVqeConfig->fSoutNoiseBleaching != FALSE ) - return cOCT6100_ERR_CHANNEL_SOUT_NOISE_BLEACHING; - - /* Check if firmware supports Sout noise bleaching. */ - if ( f_pVqeConfig->fSoutNoiseBleaching == TRUE && pImageInfo->fSoutNoiseBleaching == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_NOISE_BLEACHING; - - /* If Sout noise bleaching is requested, no ANR or CNR shall be activated. */ - if ( f_pVqeConfig->fSoutNoiseBleaching == TRUE ) - { - /* No xNR! */ - if ( ( f_pVqeConfig->fSoutConferencingNoiseReduction == TRUE ) - || ( f_pVqeConfig->fSoutAdaptiveNoiseReduction == TRUE ) ) - return cOCT6100_ERR_CHANNEL_SOUT_NOISE_BLEACHING_NR; - } - - /* Cannot activate both ANR and CNR when noise bleaching is present */ - if ( pImageInfo->fSoutNoiseBleaching == TRUE ) - { - if ( f_pVqeConfig->fSoutAdaptiveNoiseReduction == TRUE && - f_pVqeConfig->fSoutConferencingNoiseReduction == TRUE ) - return cOCT6100_ERR_CHANNEL_ANR_CNR_SIMULTANEOUSLY; - } - - /* Validate the DTMF tone removal parameter.*/ - if ( f_pVqeConfig->fDtmfToneRemoval != TRUE && f_pVqeConfig->fDtmfToneRemoval != FALSE ) - return cOCT6100_ERR_CHANNEL_TONE_REMOVAL; - - if ( f_pVqeConfig->fDtmfToneRemoval == TRUE && pImageInfo->fToneRemoval == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_TONE_REMOVAL; - - - - /* Check the Tail displacement enable.*/ - if ( f_pVqeConfig->fEnableTailDisplacement != TRUE && f_pVqeConfig->fEnableTailDisplacement != FALSE ) - return cOCT6100_ERR_CHANNEL_ENABLE_TAIL_DISPLACEMENT; - - if ( f_pVqeConfig->fEnableTailDisplacement == TRUE && pImageInfo->fTailDisplacement == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_TAIL_DISPLACEMENT; - - /* Check the Tail displacement value.*/ - if ( f_pVqeConfig->fEnableTailDisplacement == TRUE ) - { - if ( f_pVqeConfig->ulTailDisplacement != cOCT6100_AUTO_SELECT_TAIL ) - { - /* Check if this feature is supported by the image. */ - if ( pImageInfo->fPerChannelTailDisplacement == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_PER_CHAN_TAIL; - - /* Check that this value is not greater then what the image supports. */ - if ( f_pVqeConfig->ulTailDisplacement > pImageInfo->usMaxTailDisplacement ) - return cOCT6100_ERR_CHANNEL_TAIL_DISPLACEMENT_INVALID; - } - } - - /* Check the tail length value. */ - if ( f_pVqeConfig->ulTailLength != cOCT6100_AUTO_SELECT_TAIL ) - { - /* Check if this feature is supported by the image. */ - if ( ( pImageInfo->fPerChannelTailLength == FALSE ) - && ( (UINT16)( f_pVqeConfig->ulTailLength & 0xFFFF ) != pImageInfo->usMaxTailLength ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_TAIL_LENGTH; - - if ( ( f_pVqeConfig->ulTailLength < 32 ) || ( f_pVqeConfig->ulTailLength > 128 ) - || ( ( f_pVqeConfig->ulTailLength % 4 ) != 0x0 ) ) - return cOCT6100_ERR_CHANNEL_TAIL_LENGTH; - - /* Check if the requested tail length is supported by the chip. */ - if ( f_pVqeConfig->ulTailLength > pImageInfo->usMaxTailLength ) - return cOCT6100_ERR_CHANNEL_TAIL_LENGTH_INVALID; - } - - /* Validate the acoustic echo cancellation parameter.*/ - if ( f_pVqeConfig->fAcousticEcho != TRUE && f_pVqeConfig->fAcousticEcho != FALSE ) - return cOCT6100_ERR_CHANNEL_ACOUSTIC_ECHO; - - if ( f_pVqeConfig->fAcousticEcho == TRUE && pImageInfo->fAcousticEcho == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ACOUSTIC_ECHO; - - if ( f_pVqeConfig->fAcousticEcho == TRUE ) - { - /* Check if acoustic echo tail length configuration is supported in the image. */ - if ( ( f_pVqeConfig->ulAecTailLength != 128 ) && ( pImageInfo->fAecTailLength == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ACOUSTIC_ECHO_TAIL_LENGTH; - - /* Check the requested acoustic echo tail length. */ - if ( ( f_pVqeConfig->ulAecTailLength != 128 ) - && ( f_pVqeConfig->ulAecTailLength != 256 ) - && ( f_pVqeConfig->ulAecTailLength != 512 ) - && ( f_pVqeConfig->ulAecTailLength != 1024 ) ) - return cOCT6100_ERR_CHANNEL_ACOUSTIC_ECHO_TAIL_LENGTH; - - if ( f_pVqeConfig->fEnableTailDisplacement == TRUE ) - { - UINT32 ulTailSum; - - /* Start with requested tail displacement. */ - if ( f_pVqeConfig->ulTailDisplacement == cOCT6100_AUTO_SELECT_TAIL ) - { - ulTailSum = f_pApiInstance->pSharedInfo->ChipConfig.usTailDisplacement; - } - else - { - ulTailSum = f_pVqeConfig->ulTailDisplacement; - } - - /* Add requested tail length. */ - if ( f_pVqeConfig->ulTailLength == cOCT6100_AUTO_SELECT_TAIL ) - { - ulTailSum += f_pApiInstance->pSharedInfo->ImageInfo.usMaxTailLength; - } - else - { - ulTailSum += f_pVqeConfig->ulTailLength; - } - - /* The tail sum must be smaller then the requested AEC tail length. */ - if ( ulTailSum > f_pVqeConfig->ulAecTailLength ) - return cOCT6100_ERR_CHANNEL_ACOUSTIC_ECHO_TAIL_SUM; - } - } - - /* Validate the Default ERL parameter.*/ - if ( f_pVqeConfig->lDefaultErlDb != -6 && pImageInfo->fDefaultErl == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_DEFAULT_ERL; - - if ( ( f_pVqeConfig->lDefaultErlDb != 0 ) && - ( f_pVqeConfig->lDefaultErlDb != -3 ) && - ( f_pVqeConfig->lDefaultErlDb != -6 ) && - ( f_pVqeConfig->lDefaultErlDb != -9 ) && - ( f_pVqeConfig->lDefaultErlDb != -12 ) ) - return cOCT6100_ERR_CHANNEL_DEFAULT_ERL; - - /* Validate the Default AEC ERL parameter.*/ - if ( f_pVqeConfig->lAecDefaultErlDb != 0 && pImageInfo->fAecDefaultErl == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_AEC_DEFAULT_ERL; - - if ( f_pVqeConfig->lAecDefaultErlDb != 0 && f_pVqeConfig->lAecDefaultErlDb != -3 && f_pVqeConfig->lAecDefaultErlDb != -6 ) - return cOCT6100_ERR_CHANNEL_AEC_DEFAULT_ERL; - - /* Validate the non-linearity A parameter.*/ - if ( f_pVqeConfig->ulNonLinearityBehaviorA != 1 && pImageInfo->fNonLinearityBehaviorA == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_DOUBLE_TALK; - - if ( f_pVqeConfig->ulNonLinearityBehaviorA >= 14 ) - return cOCT6100_ERR_CHANNEL_DOUBLE_TALK; - - /* Validate the non-linearity B parameter.*/ - if ( f_pVqeConfig->ulNonLinearityBehaviorB != 0 && pImageInfo->fNonLinearityBehaviorB == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_NON_LINEARITY_B; - - if ( f_pVqeConfig->ulNonLinearityBehaviorB >= 9 ) - return cOCT6100_ERR_CHANNEL_NON_LINEARITY_B; - - /* Check if configuring the double talk behavior is supported in the firmware. */ - if ( f_pVqeConfig->ulDoubleTalkBehavior != cOCT6100_DOUBLE_TALK_BEH_NORMAL && pImageInfo->fDoubleTalkBehavior == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_DOUBLE_TALK_BEHAVIOR_MODE; - - /* Validate the double talk behavior mode parameter. */ - if ( f_pVqeConfig->ulDoubleTalkBehavior != cOCT6100_DOUBLE_TALK_BEH_NORMAL && f_pVqeConfig->ulDoubleTalkBehavior != cOCT6100_DOUBLE_TALK_BEH_LESS_AGGRESSIVE ) - return cOCT6100_ERR_CHANNEL_DOUBLE_TALK_MODE; - - /* Validate the Sout automatic listener enhancement ratio. */ - if ( f_pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb != 0 && pImageInfo->fListenerEnhancement == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ALE; - - if ( f_pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb > 30 ) - return cOCT6100_ERR_CHANNEL_ALE_RATIO; - - /* Validate the Sout natural listener enhancement ratio. */ - if ( f_pVqeConfig->fSoutNaturalListenerEnhancement != TRUE && f_pVqeConfig->fSoutNaturalListenerEnhancement != FALSE ) - return cOCT6100_ERR_CHANNEL_NLE_FLAG; - - if ( f_pVqeConfig->fSoutNaturalListenerEnhancement == TRUE && pImageInfo->fListenerEnhancement == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_NLE; - - if ( f_pVqeConfig->fSoutNaturalListenerEnhancement == TRUE ) - { - if ( f_pVqeConfig->ulSoutNaturalListenerEnhancementGainDb > 30 ) - return cOCT6100_ERR_CHANNEL_NLE_RATIO; - } - - /* Both ALE and NLE cannot be activated simultaneously. */ - if ( ( f_pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb != 0 ) - && ( f_pVqeConfig->fSoutNaturalListenerEnhancement == TRUE ) ) - return cOCT6100_ERR_CHANNEL_ALE_NLE_SIMULTANEOUSLY; - - /* Validate Rout noise reduction. */ - if ( f_pVqeConfig->fRoutNoiseReduction != TRUE && f_pVqeConfig->fRoutNoiseReduction != FALSE ) - return cOCT6100_ERR_CHANNEL_ROUT_NOISE_REDUCTION; - - /* Check if Rout noise reduction is supported. */ - if ( f_pVqeConfig->fRoutNoiseReduction == TRUE && pImageInfo->fRoutNoiseReduction == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ROUT_NR; - - /*Check if noise reduction level gain is supported*/ - if ( ( pImageInfo->fRoutNoiseReductionLevel == FALSE ) && ( f_pVqeConfig->lRoutNoiseReductionLevelGainDb != -18 ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ROUT_NOISE_REDUCTION_GAIN; - - if ( ( f_pVqeConfig->lRoutNoiseReductionLevelGainDb != 0 ) && - ( f_pVqeConfig->lRoutNoiseReductionLevelGainDb != -6 ) && - ( f_pVqeConfig->lRoutNoiseReductionLevelGainDb != -12 ) && - ( f_pVqeConfig->lRoutNoiseReductionLevelGainDb != -18 ) ) - - return cOCT6100_ERR_CHANNEL_ROUT_NOISE_REDUCTION_GAIN; - - /* Check if ANR SNRE is supported. */ - if ( ( f_pVqeConfig->lAnrSnrEnhancementDb != -18 ) && ( pImageInfo->fAnrSnrEnhancement == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ANR_SNR_ENHANCEMENT; - - /* Validate Sout ANR SNR enhancement. */ - if ( ( f_pVqeConfig->lAnrSnrEnhancementDb != -9 ) - && ( f_pVqeConfig->lAnrSnrEnhancementDb != -12 ) - && ( f_pVqeConfig->lAnrSnrEnhancementDb != -15 ) - && ( f_pVqeConfig->lAnrSnrEnhancementDb != -18 ) - && ( f_pVqeConfig->lAnrSnrEnhancementDb != -21 ) - && ( f_pVqeConfig->lAnrSnrEnhancementDb != -24 ) - && ( f_pVqeConfig->lAnrSnrEnhancementDb != -27 ) - && ( f_pVqeConfig->lAnrSnrEnhancementDb != -30 ) ) - return cOCT6100_ERR_CHANNEL_ANR_SNR_ENHANCEMENT; - - /* Validate ANR voice-noise segregation. */ - if ( f_pVqeConfig->ulAnrVoiceNoiseSegregation > 15 ) - return cOCT6100_ERR_CHANNEL_ANR_SEGREGATION; - - /* Check if ANR VN segregation is supported. */ - if ( ( f_pVqeConfig->ulAnrVoiceNoiseSegregation != 6 ) && ( pImageInfo->fAnrVoiceNoiseSegregation == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ANR_SEGREGATION; - - /* Check if the loaded image supports tone disabler VQE activation delay. */ - if ( ( f_pVqeConfig->ulToneDisablerVqeActivationDelay != 300 ) - && ( pImageInfo->fToneDisablerVqeActivationDelay == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_TONE_DISABLER_ACTIVATION_DELAY; - - /* Check if the specified tone disabler VQE activation delay is correct. */ - if ( ( f_pVqeConfig->ulToneDisablerVqeActivationDelay < 300 ) - || ( ( ( f_pVqeConfig->ulToneDisablerVqeActivationDelay - 300 ) % 512 ) != 0 ) ) - return cOCT6100_ERR_CHANNEL_TONE_DISABLER_ACTIVATION_DELAY; - - /* Check the enable music protection flag. */ - if ( ( f_pVqeConfig->fEnableMusicProtection != TRUE ) && ( f_pVqeConfig->fEnableMusicProtection != FALSE ) ) - return cOCT6100_ERR_CHANNEL_ENABLE_MUSIC_PROTECTION; - - /* The music protection module can only be activated if the image supports it. */ - if ( ( f_pVqeConfig->fEnableMusicProtection == TRUE ) && - ( pImageInfo->fMusicProtection == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_MUSIC_PROTECTION; - - /* Check the enable idle code detection flag. */ - if ( ( f_pVqeConfig->fIdleCodeDetection != TRUE ) && ( f_pVqeConfig->fIdleCodeDetection != FALSE ) ) - return cOCT6100_ERR_CHANNEL_IDLE_CODE_DETECTION; - - /* The idle code detection module can only be activated if the image supports it. */ - if ( ( f_pVqeConfig->fIdleCodeDetection == TRUE ) && ( pImageInfo->fIdleCodeDetection == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_IDLE_CODE_DETECTION; - - /* The idle code detection module can be disabled only if idle code detection configuration */ - /* is supported in the image. */ - if ( pImageInfo->fIdleCodeDetection == TRUE ) - { - if ( ( f_pVqeConfig->fIdleCodeDetection == FALSE ) && ( pImageInfo->fIdleCodeDetectionConfiguration == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_IDLE_CODE_DETECTION_CONFIG; - } - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckCodecConfig - -Description: This function will check the validity of the Codec config parameter - of an Open Codec config structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pCodecConfig Codec config of the channel. -f_ulDecoderNumTssts Number of TSST for the decoder. -f_pusPhasingTsstIndex Pointer to the Phasing TSST index within the API's phasing TSST list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckCodecConfig -UINT32 Oct6100ApiCheckCodecConfig( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_CODEC f_pCodecConfig, - IN UINT32 f_ulDecoderNumTssts, - OUT PUINT16 f_pusPhasingTsstIndex ) -{ - - /* Verify the ADPCM nibble value.*/ - if ( f_pCodecConfig->ulAdpcmNibblePosition != cOCT6100_ADPCM_IN_LOW_BITS && - f_pCodecConfig->ulAdpcmNibblePosition != cOCT6100_ADPCM_IN_HIGH_BITS ) - return cOCT6100_ERR_CHANNEL_ADPCM_NIBBLE; - - /* Verify the Encoder port.*/ - if ( f_pCodecConfig->ulEncoderPort != cOCT6100_CHANNEL_PORT_ROUT && - f_pCodecConfig->ulEncoderPort != cOCT6100_CHANNEL_PORT_SOUT && - f_pCodecConfig->ulEncoderPort != cOCT6100_NO_ENCODING ) - return cOCT6100_ERR_CHANNEL_ENCODER_PORT; - - /* Verify the Decoder port.*/ - if ( f_pCodecConfig->ulDecoderPort != cOCT6100_CHANNEL_PORT_RIN && - f_pCodecConfig->ulDecoderPort != cOCT6100_CHANNEL_PORT_SIN && - f_pCodecConfig->ulDecoderPort != cOCT6100_NO_DECODING ) - return cOCT6100_ERR_CHANNEL_DECODER_PORT; - - /* The codec cannot be on the same stream.*/ - if ( f_pCodecConfig->ulEncoderPort == cOCT6100_CHANNEL_PORT_ROUT && - f_pCodecConfig->ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - return cOCT6100_ERR_CHANNEL_INVALID_CODEC_POSITION; - - if ( f_pCodecConfig->ulEncoderPort == cOCT6100_CHANNEL_PORT_SOUT && - f_pCodecConfig->ulDecoderPort == cOCT6100_CHANNEL_PORT_SIN ) - return cOCT6100_ERR_CHANNEL_INVALID_CODEC_POSITION; - - /* Verify if the requested functions are supported by the chip.*/ - if ( f_pApiInstance->pSharedInfo->ImageInfo.fAdpcm == FALSE && - f_pCodecConfig->ulEncoderPort != cOCT6100_NO_ENCODING ) - { - if ( f_pCodecConfig->ulEncodingRate != cOCT6100_G711_64KBPS ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_ENCODING; - } - - if ( f_pApiInstance->pSharedInfo->ImageInfo.fAdpcm == FALSE && - f_pCodecConfig->ulDecoderPort != cOCT6100_NO_DECODING ) - { - if ( f_pCodecConfig->ulDecodingRate != cOCT6100_G711_64KBPS ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_DECODING; - } - - /* Check if encoder port has been specified when a rate has been set. */ - if ( f_pCodecConfig->ulEncoderPort == cOCT6100_NO_ENCODING && - f_pCodecConfig->ulEncodingRate != cOCT6100_G711_64KBPS ) - return cOCT6100_ERR_CHANNEL_ENCODER_PORT; - - /* Check if decoder port has been specified when a rate has been set. */ - if ( f_pCodecConfig->ulDecoderPort == cOCT6100_NO_DECODING && - f_pCodecConfig->ulDecodingRate != cOCT6100_G711_64KBPS ) - return cOCT6100_ERR_CHANNEL_DECODER_PORT; - - /* Check Encoder related parameter if one is used.*/ - if ( f_pCodecConfig->ulEncoderPort != cOCT6100_NO_ENCODING ) - { - /* Check the Encoder compression rate.*/ - if ( ( f_pCodecConfig->ulEncodingRate != cOCT6100_G711_64KBPS ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G726_40KBPS ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G726_32KBPS ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G726_24KBPS ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G726_16KBPS ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G727_40KBPS_4_1 ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G727_40KBPS_3_2 ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G727_40KBPS_2_3 ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G727_32KBPS_4_0 ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G727_32KBPS_3_1 ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G727_32KBPS_2_2 ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G727_24KBPS_3_0 ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G727_24KBPS_2_1 ) && - ( f_pCodecConfig->ulEncodingRate != cOCT6100_G727_16KBPS_2_0 ) ) - return cOCT6100_ERR_CHANNEL_ENCODING_RATE; - - /* Verify phasing information.*/ - if ( f_pCodecConfig->ulPhasingType != cOCT6100_SINGLE_PHASING && - f_pCodecConfig->ulPhasingType != cOCT6100_DUAL_PHASING && - f_pCodecConfig->ulPhasingType != cOCT6100_NO_PHASING ) - return cOCT6100_ERR_CHANNEL_PHASING_TYPE; - - /* Verify the silence suppression parameters.*/ - if ( f_pCodecConfig->fEnableSilenceSuppression != TRUE && - f_pCodecConfig->fEnableSilenceSuppression != FALSE ) - return cOCT6100_ERR_CHANNEL_SIL_SUP_ENABLE; - - if ( f_pCodecConfig->fEnableSilenceSuppression == TRUE && - f_pApiInstance->pSharedInfo->ImageInfo.fSilenceSuppression == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_SIL_SUP; - - if ( f_pCodecConfig->fEnableSilenceSuppression == TRUE && - f_pCodecConfig->ulPhasingType == cOCT6100_NO_PHASING ) - return cOCT6100_ERR_CHANNEL_PHASE_TYPE_REQUIRED; - - if ( f_pCodecConfig->fEnableSilenceSuppression == TRUE && - f_pCodecConfig->ulPhasingTsstHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_CHANNEL_PHASING_TSST_REQUIRED; - - if ( f_pCodecConfig->ulPhasingTsstHndl == cOCT6100_INVALID_HANDLE && - f_pCodecConfig->ulPhasingType != cOCT6100_NO_PHASING ) - return cOCT6100_ERR_CHANNEL_PHASING_TSST_REQUIRED; - - /* Silence suppression can only be performed if the encoder is using the SOUT port.*/ - if ( f_pCodecConfig->fEnableSilenceSuppression == TRUE && - f_pCodecConfig->ulEncoderPort != cOCT6100_CHANNEL_PORT_SOUT ) - return cOCT6100_ERR_CHANNEL_SIL_SUP_INVALID_ENCODER_PORT; - - /* Check phasing TSST info if phasing is required.*/ - if ( f_pCodecConfig->ulPhasingTsstHndl != cOCT6100_INVALID_HANDLE ) - { - tPOCT6100_API_PHASING_TSST pPhasingEntry; - UINT32 ulEntryOpenCnt; - - /* Check the provided handle. */ - if ( (f_pCodecConfig->ulPhasingTsstHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_PHASING_TSST ) - return cOCT6100_ERR_CHANNEL_INVALID_PHASING_HANDLE; - - *f_pusPhasingTsstIndex = (UINT16)( f_pCodecConfig->ulPhasingTsstHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusPhasingTsstIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxPhasingTssts ) - return cOCT6100_ERR_CHANNEL_INVALID_PHASING_HANDLE; - - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pPhasingEntry, *f_pusPhasingTsstIndex ); - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pCodecConfig->ulPhasingTsstHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Verify if the state of the phasing TSST.*/ - if ( pPhasingEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_PHASING_TSST_NOT_OPEN; - if ( ulEntryOpenCnt != pPhasingEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_INVALID_PHASING_HANDLE; - - /* Check the specified phase value against the phasing length of the phasing TSST.*/ - if ( ( f_pCodecConfig->ulPhase == 0 ) - || ( f_pCodecConfig->ulPhase >= pPhasingEntry->usPhasingLength ) ) - return cOCT6100_ERR_CHANNEL_PHASING_INVALID_PHASE; - } - else - { - *f_pusPhasingTsstIndex = cOCT6100_INVALID_INDEX; - } - } - else - { - *f_pusPhasingTsstIndex = cOCT6100_INVALID_INDEX; - } - - - /* Check Decoder related parameter if one is used.*/ - if ( f_pCodecConfig->ulDecoderPort != cOCT6100_NO_DECODING ) - { - /* Check the Decoding rate.*/ - if ( f_pCodecConfig->ulDecodingRate != cOCT6100_G711_64KBPS && - f_pCodecConfig->ulDecodingRate != cOCT6100_G726_40KBPS && - f_pCodecConfig->ulDecodingRate != cOCT6100_G726_32KBPS && - f_pCodecConfig->ulDecodingRate != cOCT6100_G726_24KBPS && - f_pCodecConfig->ulDecodingRate != cOCT6100_G726_16KBPS && - f_pCodecConfig->ulDecodingRate != cOCT6100_G726_ENCODED && - f_pCodecConfig->ulDecodingRate != cOCT6100_G711_G726_ENCODED && - f_pCodecConfig->ulDecodingRate != cOCT6100_G727_2C_ENCODED && - f_pCodecConfig->ulDecodingRate != cOCT6100_G727_3C_ENCODED && - f_pCodecConfig->ulDecodingRate != cOCT6100_G727_4C_ENCODED && - f_pCodecConfig->ulDecodingRate != cOCT6100_G711_G727_2C_ENCODED && - f_pCodecConfig->ulDecodingRate != cOCT6100_G711_G727_3C_ENCODED && - f_pCodecConfig->ulDecodingRate != cOCT6100_G711_G727_4C_ENCODED ) - return cOCT6100_ERR_CHANNEL_DECODING_RATE; - - /* Make sure that two timeslot are allocated if PCM-ECHO encoded is selected.*/ - if ( (f_pCodecConfig->ulDecodingRate == cOCT6100_G711_G726_ENCODED || - f_pCodecConfig->ulDecodingRate == cOCT6100_G711_G727_2C_ENCODED || - f_pCodecConfig->ulDecodingRate == cOCT6100_G711_G727_3C_ENCODED || - f_pCodecConfig->ulDecodingRate == cOCT6100_G711_G727_4C_ENCODED ) && - f_ulDecoderNumTssts != 2 ) - return cOCT6100_ERR_CHANNEL_MISSING_TSST; - } - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteInputTsstControlMemory - -Description: This function configure a TSST control memory entry in internal memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_usTsstIndex TSST index within the TSST control memory. -f_usTsiMemIndex TSI index within the TSI chariot memory. -f_ulTsstInputLaw PCM law of the input TSST. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteInputTsstControlMemory -UINT32 Oct6100ApiWriteInputTsstControlMemory( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsstIndex, - IN UINT16 f_usTsiMemIndex, - IN UINT32 f_ulTsstInputLaw ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( (f_usTsstIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_TSST_CONTROL_MEM_INPUT_TSST; - WriteParams.usWriteData |= f_usTsiMemIndex & cOCT6100_TSST_CONTROL_MEM_TSI_MEM_MASK; - - /* Set the PCM law.*/ - WriteParams.usWriteData |= f_ulTsstInputLaw << cOCT6100_TSST_CONTROL_MEM_PCM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteOutputTsstControlMemory - -Description: This function configure a TSST control memory entry in internal memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteOutputTsstControlMemory -UINT32 Oct6100ApiWriteOutputTsstControlMemory( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsstIndex, - IN UINT32 f_ulAdpcmNibblePosition, - IN UINT32 f_ulNumTssts, - IN UINT16 f_usTsiMemIndex ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( (f_usTsstIndex & cOCT6100_TSST_INDEX_MASK) * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_TSST_CONTROL_MEM_OUTPUT_TSST; - WriteParams.usWriteData |= f_ulAdpcmNibblePosition << cOCT6100_TSST_CONTROL_MEM_NIBBLE_POS_OFFSET; - WriteParams.usWriteData |= (f_ulNumTssts - 1) << cOCT6100_TSST_CONTROL_MEM_TSST_NUM_OFFSET; - WriteParams.usWriteData |= f_usTsiMemIndex & cOCT6100_TSST_CONTROL_MEM_TSI_MEM_MASK; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteEncoderMemory - -Description: This function configure a Encoded memory entry in internal memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulEncoderIndex Index of the encoder block within the ADPCM context memory. -f_ulCompType Compression rate of the encoder. -f_usTsiMemIndex TSI index within the TSI chariot memory used by the encoder. -f_ulEnableSilenceSuppression Silence suppression enable flag. -f_ulAdpcmNibblePosition ADPCM nibble position. -f_usPhasingTsstIndex Phasing TSST index within the API's Phassing TSST list. -f_ulPhasingType Type of the Phasing TSST. -f_ulPhase Phase used with this encoder. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteEncoderMemory -UINT32 Oct6100ApiWriteEncoderMemory( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulEncoderIndex, - IN UINT32 f_ulCompType, - IN UINT16 f_usTsiMemIndex, - IN UINT32 f_ulEnableSilenceSuppression, - IN UINT32 f_ulAdpcmNibblePosition, - IN UINT16 f_usPhasingTsstIndex, - IN UINT32 f_ulPhasingType, - IN UINT32 f_ulPhase ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /*==============================================================================*/ - /* Conversion Control Base */ - WriteParams.ulWriteAddress = cOCT6100_CONVERSION_CONTROL_MEM_BASE + ( f_ulEncoderIndex * cOCT6100_CONVERSION_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_CONVERSION_CONTROL_MEM_ENCODER; - WriteParams.usWriteData |= f_ulCompType << cOCT6100_CONVERSION_CONTROL_MEM_COMP_OFFSET; - WriteParams.usWriteData |= f_usTsiMemIndex & cOCT6100_TSST_CONTROL_MEM_TSI_MEM_MASK; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - /* Conversion Control Base + 2 */ - WriteParams.ulWriteAddress += 2; - - /* Set the phasing TSST number.*/ - if ( f_usPhasingTsstIndex != cOCT6100_INVALID_INDEX ) - WriteParams.usWriteData = (UINT16)( f_usPhasingTsstIndex << cOCT6100_CONVERSION_CONTROL_MEM_PHASE_OFFSET ); - else - WriteParams.usWriteData = 0; - - /* Set the phasing type and the phase value if required.*/ - switch( f_ulPhasingType ) - { - case cOCT6100_NO_PHASING: - WriteParams.usWriteData |= 0x1 << 10; - break; - case cOCT6100_SINGLE_PHASING: - WriteParams.usWriteData |= f_ulPhase; - break; - case cOCT6100_DUAL_PHASING: - WriteParams.usWriteData |= 0x1 << 11; - WriteParams.usWriteData |= f_ulPhase; - break; - default: - /* No problem. */ - break; - } - - /* Set the silence suppression flag.*/ - WriteParams.usWriteData |= f_ulEnableSilenceSuppression << cOCT6100_CONVERSION_CONTROL_MEM_SIL_SUP_OFFSET; - - /* Set the nibble position.*/ - WriteParams.usWriteData |= f_ulAdpcmNibblePosition << cOCT6100_CONVERSION_CONTROL_MEM_NIBBLE_POS_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - /* Conversion Control Base + 4 */ - WriteParams.ulWriteAddress += 2; - - /* Set the reset mode */ - WriteParams.usWriteData = cOCT6100_CONVERSION_CONTROL_MEM_RST_ON_NEXT_FR; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - /* Conversion Control Base + 6 */ - WriteParams.ulWriteAddress += 2; - - /* Set the reset mode */ - WriteParams.usWriteData = cOCT6100_CONVERSION_CONTROL_MEM_ACTIVATE_ENTRY; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteDecoderMemory - -Description: This function configure a Decoder memory entry in internal memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_usDecoderIndex Index of the decoder block within the ADPCM context memory. -f_ulCompType Decompression rate of the decoder. -f_usTsiMemIndex TSI index within the TSI chariot memory. -f_ulPcmLaw PCM law of the decoded samples. -f_ulAdpcmNibblePosition ADPCM nibble position. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteDecoderMemory -UINT32 Oct6100ApiWriteDecoderMemory( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usDecoderIndex, - IN UINT32 f_ulCompType, - IN UINT16 f_usTsiMemIndex, - IN UINT32 f_ulPcmLaw, - IN UINT32 f_ulAdpcmNibblePosition ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - - /*==============================================================================*/ - /* Conversion Control Base */ - WriteParams.ulWriteAddress = cOCT6100_CONVERSION_CONTROL_MEM_BASE + ( f_usDecoderIndex * cOCT6100_CONVERSION_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_CONVERSION_CONTROL_MEM_DECODER; - WriteParams.usWriteData |= f_ulCompType << cOCT6100_CONVERSION_CONTROL_MEM_COMP_OFFSET; - WriteParams.usWriteData |= f_usTsiMemIndex & cOCT6100_TSST_CONTROL_MEM_TSI_MEM_MASK; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - /* Conversion Control Base + 2 */ - WriteParams.ulWriteAddress += 2; - - /* Set the nibble position.*/ - WriteParams.usWriteData = (UINT16)( f_ulAdpcmNibblePosition << cOCT6100_CONVERSION_CONTROL_MEM_NIBBLE_POS_OFFSET ); - - /* Set the law.*/ - WriteParams.usWriteData |= f_ulPcmLaw << cOCT6100_CONVERSION_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - /* Conversion Control Base + 4 */ - WriteParams.ulWriteAddress += 2; - - /* Set the reset mode */ - WriteParams.usWriteData = cOCT6100_CONVERSION_CONTROL_MEM_RST_ON_NEXT_FR; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - /* Conversion Control Base + 6 */ - WriteParams.ulWriteAddress += 2; - - /* Set the reset mode */ - WriteParams.usWriteData = cOCT6100_CONVERSION_CONTROL_MEM_ACTIVATE_ENTRY; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiClearConversionMemory - -Description: This function clears a conversion memory entry in internal - memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_usConversionMemIndex Index of the block within the conversion memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiClearConversionMemory -UINT32 Oct6100ApiClearConversionMemory( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usConversionMemIndex ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT32 ulBaseAddress; - UINT16 usReadData; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - WriteParams.usWriteData = 0; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /*==============================================================================*/ - /* Clear the entry */ - ulBaseAddress = cOCT6100_CONVERSION_CONTROL_MEM_BASE + ( f_usConversionMemIndex * cOCT6100_CONVERSION_CONTROL_MEM_ENTRY_SIZE ); - /* The "activate" bit at offset +6 must be cleared first. */ - WriteParams.ulWriteAddress = ulBaseAddress + 6; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Read at 0x200 to make sure there is no corruption on channel 0. */ - ReadParams.ulReadAddress = 0x200; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Then clear the rest of the structure. */ - WriteParams.ulWriteAddress = ulBaseAddress + 4; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = ulBaseAddress + 2; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = ulBaseAddress; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteVqeMemory - -Description: This function configure an echo memory entry in internal memory and - external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pVqeConfig Pointer to a VQE config structure. -f_pChannelOpen Pointer to a channel configuration structure. -f_usChanIndex Index of the echo channel in the API instance. -f_usEchoMemIndex Index of the echo channel within the SSPX memory. -f_fClearPlayoutPointers Flag indicating if the playout pointer should be cleared. -f_fModifyOnly Flag indicating if the configuration should be - modified only. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteVqeMemory -UINT32 Oct6100ApiWriteVqeMemory( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN BOOL f_fClearPlayoutPointers, - IN BOOL f_fModifyOnly ) -{ - UINT32 ulResult; - - /* Write the NLP software configuration structure. */ - ulResult = Oct6100ApiWriteVqeNlpMemory( - f_pApiInstance, - f_pVqeConfig, - f_pChannelOpen, - f_usChanIndex, - f_usEchoMemIndex, - f_fClearPlayoutPointers, - f_fModifyOnly ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write the AF software configuration structure. */ - ulResult = Oct6100ApiWriteVqeAfMemory( - f_pApiInstance, - f_pVqeConfig, - f_pChannelOpen, - f_usChanIndex, - f_usEchoMemIndex, - f_fClearPlayoutPointers, - f_fModifyOnly ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - -UINT32 oct6100_retrieve_nlp_conf_dword(tPOCT6100_INSTANCE_API f_pApiInst, - tPOCT6100_API_CHANNEL f_pChanEntry, - UINT32 f_ulAddress, - UINT32 *f_pulConfigDword) -{ - tOCT6100_READ_PARAMS _ReadParams; - UINT16 _usReadData; - UINT32 ulResult = cOCT6100_ERR_FATAL_8E; - (*f_pulConfigDword) = cOCT6100_INVALID_VALUE; - - _ReadParams.pProcessContext = f_pApiInst->pProcessContext; - mOCT6100_ASSIGN_USER_READ_WRITE_OBJ(f_pApiInst, _ReadParams); - _ReadParams.ulUserChipId = f_pApiInst->pSharedInfo->ChipConfig.ulUserChipId; - _ReadParams.pusReadData = &_usReadData; - - /* Read the first 16 bits.*/ - _ReadParams.ulReadAddress = f_ulAddress; - mOCT6100_DRIVER_READ_API(_ReadParams, ulResult); - if (ulResult == cOCT6100_ERR_OK) { - /* Save data.*/ - (*f_pulConfigDword) = _usReadData << 16; - - /* Read the last 16 bits .*/ - _ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API(_ReadParams, ulResult); - if (ulResult == cOCT6100_ERR_OK) { - /* Save data.*/ - (*f_pulConfigDword) |= _usReadData; - ulResult = cOCT6100_ERR_OK; - } - } - return ulResult; -} - -UINT32 oct6100_save_nlp_conf_dword(tPOCT6100_INSTANCE_API f_pApiInst, - tPOCT6100_API_CHANNEL f_pChanEntry, - UINT32 f_ulAddress, - UINT32 f_ulConfigDword) -{ - UINT32 ulResult; - - /* Write the config DWORD. */ - tOCT6100_WRITE_PARAMS _WriteParams; - - _WriteParams.pProcessContext = f_pApiInst->pProcessContext; - mOCT6100_ASSIGN_USER_READ_WRITE_OBJ(f_pApiInst, _WriteParams) - _WriteParams.ulUserChipId = f_pApiInst->pSharedInfo->ChipConfig.ulUserChipId; - - /* Write the first 16 bits. */ - _WriteParams.ulWriteAddress = f_ulAddress; - _WriteParams.usWriteData = (UINT16)((f_ulConfigDword >> 16) & 0xFFFF); - mOCT6100_DRIVER_WRITE_API(_WriteParams, ulResult); - - if (ulResult == cOCT6100_ERR_OK) { - /* Write the last word. */ - _WriteParams.ulWriteAddress = f_ulAddress + 2; - _WriteParams.usWriteData = (UINT16)(f_ulConfigDword & 0xFFFF); - mOCT6100_DRIVER_WRITE_API(_WriteParams, ulResult); - } - return ulResult; -} - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteVqeNlpMemory - -Description: This function configures the NLP related VQE features of an - echo channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pVqeConfig Pointer to a VQE config structure. -f_pChannelOpen Pointer to a channel configuration structure. -f_usChanIndex Index of the echo channel in the API instance. -f_usEchoMemIndex Index of the echo channel within the SSPX memory. -f_fClearPlayoutPointers Flag indicating if the playout pointer should be cleared. -f_fModifyOnly Flag indicating if the configuration should be - modified only. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteVqeNlpMemory -UINT32 Oct6100ApiWriteVqeNlpMemory( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN BOOL f_fClearPlayoutPointers, - IN BOOL f_fModifyOnly ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_BUFFER_PLAYOUT_STOP BufferPlayoutStop; - UINT32 ulResult; - UINT32 ulTempData; - UINT32 ulNlpConfigBaseAddress; - UINT32 ulFeatureBytesOffset; - UINT32 ulFeatureBitOffset; - UINT32 ulFeatureFieldLength; - UINT32 ulMask; - UINT16 usTempData; - BOOL fEchoOperationModeChanged; - - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Obtain a pointer to the new buffer's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ); - - /*==============================================================================*/ - /* Configure the CPU NLP configuration of the channel feature by feature.*/ - - ulNlpConfigBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_usEchoMemIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst; - - /* Set initial value to zero.*/ - ulTempData = 0; - - /* Configure Adaptive Noise Reduction.*/ - if (pSharedInfo->ImageInfo.fAdaptiveNoiseReduction == TRUE) { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( ( f_pVqeConfig->fSoutAdaptiveNoiseReduction != pChanEntry->VqeConfig.fSoutAdaptiveNoiseReduction ) - || ( f_pVqeConfig->fSoutNoiseBleaching != pChanEntry->VqeConfig.fSoutNoiseBleaching ) - ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.AdaptiveNoiseReductionOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.AdaptiveNoiseReductionOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.AdaptiveNoiseReductionOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set adaptive noise reduction on the SOUT port.*/ - ulTempData |= ( ( (UINT32)f_pVqeConfig->fSoutAdaptiveNoiseReduction ) << ulFeatureBitOffset ); - - /* If SOUT noise bleaching is requested, ANR must be activated. */ - ulTempData |= ( ( (UINT32)f_pVqeConfig->fSoutNoiseBleaching ) << ulFeatureBitOffset ); - - /* First read the DWORD where the field is located. */ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Configure Rout Noise Reduction. */ - if (pSharedInfo->ImageInfo.fRoutNoiseReduction == TRUE) { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->fRoutNoiseReduction != pChanEntry->VqeConfig.fRoutNoiseReduction ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.RinAnrOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.RinAnrOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.RinAnrOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set noise reduction on the Rout port. */ - ulTempData |= ( ( (UINT32)f_pVqeConfig->fRoutNoiseReduction ) << ulFeatureBitOffset ); - - /* Write the new DWORD where the field is located. */ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - if (pSharedInfo->ImageInfo.fRoutNoiseReductionLevel == TRUE) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( (f_pVqeConfig->lRoutNoiseReductionLevelGainDb != pChanEntry->VqeConfig.chRoutNoiseReductionLevelGainDb ) - ||( f_pVqeConfig->fRoutNoiseReduction != pChanEntry->VqeConfig.fRoutNoiseReduction ) ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.RinAnrValOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.RinAnrValOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.RinAnrValOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if (f_pVqeConfig->fRoutNoiseReduction == TRUE) - { - switch( f_pVqeConfig->lRoutNoiseReductionLevelGainDb) - { - case 0: ulTempData |= ( 0 << ulFeatureBitOffset ); - break; - case -6: ulTempData |= ( 1 << ulFeatureBitOffset ); - break; - case -12: ulTempData |= ( 2 << ulFeatureBitOffset ); - break; - case -18: ulTempData |= ( 3 << ulFeatureBitOffset ); - break; - default: ulTempData |= ( 0 << ulFeatureBitOffset ); - break; - } - } - else - ulTempData |= ( 0 << ulFeatureBitOffset ); - - /* Write the new DWORD where the field is located. */ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - } - - /* Configure Sout ANR SNR enhancement. */ - if ( pSharedInfo->ImageInfo.fAnrSnrEnhancement == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->lAnrSnrEnhancementDb != pChanEntry->VqeConfig.chAnrSnrEnhancementDb ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.AnrSnrEnhancementOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.AnrSnrEnhancementOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.AnrSnrEnhancementOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set ANR SNR enhancement on the Sout port. */ - switch( f_pVqeConfig->lAnrSnrEnhancementDb ) - { - case -9: ulTempData |= ( 7 << ulFeatureBitOffset ); - break; - case -12: ulTempData |= ( 6 << ulFeatureBitOffset ); - break; - case -15: ulTempData |= ( 5 << ulFeatureBitOffset ); - break; - case -21: ulTempData |= ( 3 << ulFeatureBitOffset ); - break; - case -24: ulTempData |= ( 2 << ulFeatureBitOffset ); - break; - case -27: ulTempData |= ( 1 << ulFeatureBitOffset ); - break; - case -30: ulTempData |= ( 0 << ulFeatureBitOffset ); - break; - default: ulTempData |= ( 4 << ulFeatureBitOffset ); - /* -18 */ - break; - } - - /* Write the new DWORD where the field is located. */ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Configure Sout ANR voice-noise segregation. */ - if ( pSharedInfo->ImageInfo.fAnrVoiceNoiseSegregation == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->ulAnrVoiceNoiseSegregation != pChanEntry->VqeConfig.byAnrVoiceNoiseSegregation ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.AnrVoiceNoiseSegregationOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.AnrVoiceNoiseSegregationOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.AnrVoiceNoiseSegregationOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set ANR voice-noise segregation on the Sout port. */ - ulTempData |= ( ( (UINT32)f_pVqeConfig->ulAnrVoiceNoiseSegregation ) << ulFeatureBitOffset ); - - /* Write the new DWORD where the field is located. */ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Configure the tone disabler VQE activation delay. */ - if ( pSharedInfo->ImageInfo.fToneDisablerVqeActivationDelay == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( ( f_pVqeConfig->ulToneDisablerVqeActivationDelay != pChanEntry->VqeConfig.usToneDisablerVqeActivationDelay ) - || ( f_pChannelOpen->fEnableToneDisabler != pChanEntry->fEnableToneDisabler ) ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.ToneDisablerVqeActivationDelayOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.ToneDisablerVqeActivationDelayOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.ToneDisablerVqeActivationDelayOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set the tone disabler VQE activation delay. The VQE activation delay */ - /* is only set if the tone disabler is activated. */ - if ( f_pChannelOpen->fEnableToneDisabler == TRUE ) - ulTempData |= ( ( (UINT32)( ( f_pVqeConfig->ulToneDisablerVqeActivationDelay - 300 ) / 512 ) ) << ulFeatureBitOffset ); - else - ulTempData |= ( 0 ) << ulFeatureBitOffset; - - /* Write the new DWORD where the field is located. */ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Configure Conferencing Noise Reduction.*/ - if ( pSharedInfo->ImageInfo.fConferencingNoiseReduction == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( ( f_pVqeConfig->fSoutConferencingNoiseReduction != pChanEntry->VqeConfig.fSoutConferencingNoiseReduction ) - || ( f_pVqeConfig->fSoutNoiseBleaching != pChanEntry->VqeConfig.fSoutNoiseBleaching ) ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.ConferencingNoiseReductionOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.ConferencingNoiseReductionOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.ConferencingNoiseReductionOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set conferencing noise reduction on the SOUT port. */ - ulTempData |= (f_pVqeConfig->fSoutConferencingNoiseReduction << ulFeatureBitOffset ); - - /* If SOUT noise bleaching is requested, CNR must be activated. */ - ulTempData |= (f_pVqeConfig->fSoutNoiseBleaching << ulFeatureBitOffset ); - - /* Save the DWORD where the field is located. */ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the DC removal on RIN ports.*/ - if ( pSharedInfo->ImageInfo.fRinDcOffsetRemoval == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->fRinDcOffsetRemoval != pChanEntry->VqeConfig.fRinDcOffsetRemoval ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.RinDcOffsetRemovalOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.RinDcOffsetRemovalOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.RinDcOffsetRemovalOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set adaptive noise reduction on the SOUT port.*/ - ulTempData |= ( ( (UINT32)f_pVqeConfig->fRinDcOffsetRemoval ) << ulFeatureBitOffset ); - - /* The write the new DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the DC removal on SIN ports.*/ - if ( pSharedInfo->ImageInfo.fSinDcOffsetRemoval == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->fSinDcOffsetRemoval != pChanEntry->VqeConfig.fSinDcOffsetRemoval ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.SinDcOffsetRemovalOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.SinDcOffsetRemovalOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.SinDcOffsetRemovalOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set adaptive noise reduction on the SOUT port.*/ - ulTempData |= ( ( (UINT32)f_pVqeConfig->fSinDcOffsetRemoval ) << ulFeatureBitOffset ); - - /* Save the DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the level control. */ - if ( ( pChanEntry->byEchoOperationMode != f_pChannelOpen->ulEchoOperationMode ) - && ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_NORMAL ) ) - fEchoOperationModeChanged = TRUE; - else - fEchoOperationModeChanged = FALSE; - - /* If opening the channel, all level control configuration must be written. */ - if ( f_fModifyOnly == FALSE ) - fEchoOperationModeChanged = TRUE; - ulResult = Oct6100ApiSetChannelLevelControl( f_pApiInstance, - f_pVqeConfig, - f_usChanIndex, - f_usEchoMemIndex, - fEchoOperationModeChanged ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the background noise freeze.*/ - if ( pSharedInfo->ImageInfo.fComfortNoise == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->ulComfortNoiseMode != pChanEntry->VqeConfig.byComfortNoiseMode ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.ComfortNoiseModeOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.ComfortNoiseModeOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.ComfortNoiseModeOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - ulTempData |= ( f_pVqeConfig->ulComfortNoiseMode << ulFeatureBitOffset ); - - /* Save the new DWORD where the field is located. */ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the state of the NLP */ - if ( pSharedInfo->ImageInfo.fNlpControl == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->fEnableNlp != pChanEntry->VqeConfig.fEnableNlp ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.NlpControlFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.NlpControlFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.NlpControlFieldOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if ( f_pVqeConfig->fEnableNlp == FALSE ) - ulTempData |= 0x1 << ulFeatureBitOffset; - - /* Save the new DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the tail configuration. */ - ulResult = Oct6100ApiSetChannelTailConfiguration( - f_pApiInstance, - f_pVqeConfig, - f_usChanIndex, - f_usEchoMemIndex, - f_fModifyOnly ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the Default ERL. */ - if ( ( pSharedInfo->ImageInfo.fDefaultErl == TRUE ) && ( f_pVqeConfig->fAcousticEcho == FALSE ) ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( ( f_pVqeConfig->lDefaultErlDb != pChanEntry->VqeConfig.chDefaultErlDb ) - || ( f_pChannelOpen->ulEchoOperationMode != pChanEntry->byEchoOperationMode ) - || ( f_pVqeConfig->fAcousticEcho != pChanEntry->VqeConfig.fAcousticEcho ) ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.DefaultErlFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.DefaultErlFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.DefaultErlFieldOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Convert the DB value to octasic's float format. (In energy) */ - if ( ( f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_NO_ECHO ) - && ( f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION ) ) - { - usTempData = Oct6100ApiDbAmpHalfToOctFloat( 2 * f_pVqeConfig->lDefaultErlDb ); - } - else - { - /* Clear the defautl ERL when using the no echo cancellation operation mode. */ - usTempData = 0x0; - } - - if ( ulFeatureFieldLength < 16 ) - usTempData = (UINT16)( usTempData >> ( 16 - ulFeatureFieldLength ) ); - - ulTempData |= ( usTempData << ulFeatureBitOffset ); - - /* Save the new DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the Acoustic echo control.*/ - if ( pSharedInfo->ImageInfo.fAcousticEcho == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->fAcousticEcho != pChanEntry->VqeConfig.fAcousticEcho ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.AecFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.AecFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.AecFieldOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field. */ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - ulTempData |= ( ( (UINT32)f_pVqeConfig->fAcousticEcho ) << ulFeatureBitOffset ); - - /* Then save the new DWORD where the field is located. */ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the Acoustic Echo Default ERL. */ - if ( ( pSharedInfo->ImageInfo.fAecDefaultErl == TRUE ) && ( f_pVqeConfig->fAcousticEcho == TRUE ) ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( ( f_pVqeConfig->lAecDefaultErlDb != pChanEntry->VqeConfig.chAecDefaultErlDb ) - || ( f_pVqeConfig->fAcousticEcho != pChanEntry->VqeConfig.fAcousticEcho ) ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.AecDefaultErlFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.AecDefaultErlFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.AecDefaultErlFieldOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field. */ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if ( ( f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_NO_ECHO ) - && ( f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION ) ) - { - /* Convert the DB value to octasic's float format. (In energy) */ - usTempData = Oct6100ApiDbAmpHalfToOctFloat( 2 * f_pVqeConfig->lAecDefaultErlDb ); - } - else - { - /* Clear the AEC defautl ERL when using the no echo cancellation operation mode. */ - usTempData = 0x0; - } - - if ( ulFeatureFieldLength < 16 ) - usTempData = (UINT16)( usTempData >> ( 16 - ulFeatureFieldLength ) ); - - ulTempData |= ( usTempData << ulFeatureBitOffset ); - - /* Then save the DWORD where the field is located. */ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the DTMF tone removal bit.*/ - if ( pSharedInfo->ImageInfo.fToneRemoval == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->fDtmfToneRemoval != pChanEntry->VqeConfig.fDtmfToneRemoval ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.ToneRemovalFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.ToneRemovalFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.ToneRemovalFieldOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - ulTempData |= ( ( (UINT32)f_pVqeConfig->fDtmfToneRemoval ) << ulFeatureBitOffset ); - - /* First read the DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - - - /* Set the non-linear behavior A.*/ - if ( pSharedInfo->ImageInfo.fNonLinearityBehaviorA == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( ( f_pVqeConfig->ulNonLinearityBehaviorA != pChanEntry->VqeConfig.byNonLinearityBehaviorA ) - || ( f_pChannelOpen->ulEchoOperationMode != pChanEntry->byEchoOperationMode ) ) ) ) - { - UINT16 ausLookupTable[ 14 ] = { 0x3663, 0x3906, 0x399C, 0x3A47, 0x3B06, 0x3B99, 0x3C47, 0x3D02, 0x3D99, 0x3E47, 0x3F00, 0x3F99, 0x4042, 0x4100 }; - - ulFeatureBytesOffset = pSharedInfo->MemoryMap.PcmLeakFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.PcmLeakFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.PcmLeakFieldOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /*If we support ANR level the TLV is shared over 2 bits*/ - if (ulFeatureBitOffset == 18) - { - ulFeatureBitOffset -= 2; - ausLookupTable[ f_pVqeConfig->ulNonLinearityBehaviorA ] &= 0xFFFC; - } - - if ( ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_NO_ECHO ) - || ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION ) ) - ulTempData |= ( 0x0 << ulFeatureBitOffset ); - else - ulTempData |= ( ausLookupTable[ f_pVqeConfig->ulNonLinearityBehaviorA ] << ulFeatureBitOffset ); - - /* Then save the DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Synch all the buffer playout field.*/ - if ( pSharedInfo->ImageInfo.fBufferPlayout == TRUE && f_fClearPlayoutPointers == TRUE ) - { - Oct6100BufferPlayoutStopDef( &BufferPlayoutStop ); - - BufferPlayoutStop.ulChannelHndl = cOCT6100_INVALID_HANDLE; - BufferPlayoutStop.fStopCleanly = TRUE; - - BufferPlayoutStop.ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; - ulResult = Oct6100ApiInvalidateChanPlayoutStructs( - f_pApiInstance, - &BufferPlayoutStop, - f_usChanIndex, - f_usEchoMemIndex - - ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - BufferPlayoutStop.ulPlayoutPort = cOCT6100_CHANNEL_PORT_SOUT; - ulResult = Oct6100ApiInvalidateChanPlayoutStructs( - f_pApiInstance, - &BufferPlayoutStop, - f_usChanIndex, - f_usEchoMemIndex - - ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*==============================================================================*/ - /* Write the 2100 Hz Echo Disabling mode */ - - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pChannelOpen->fEnableToneDisabler != pChanEntry->fEnableToneDisabler ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.ToneDisablerControlOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.ToneDisablerControlOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.ToneDisablerControlOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* This is a disable bit, so it must be set only if the enable flag is set to false. */ - if ( f_pChannelOpen->fEnableToneDisabler == FALSE ) - ulTempData |= 0x1 << ulFeatureBitOffset; - - /* Save the DWORD where the field is located. */ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Write the Nlp Trivial enable flag. */ - - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( - - ( f_pChannelOpen->ulEchoOperationMode != pChanEntry->byEchoOperationMode ) ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.NlpTrivialFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.NlpTrivialFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.NlpTrivialFieldOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - if ( ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_NO_ECHO ) - || ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION ) ) - { - ulTempData |= TRUE << ulFeatureBitOffset; - } - - - /* Then write the DWORD where the field is located. */ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Set the double talk behavior mode. */ - if ( pSharedInfo->ImageInfo.fDoubleTalkBehaviorFieldOfst == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->ulDoubleTalkBehavior != pChanEntry->VqeConfig.byDoubleTalkBehavior ) ) ) - { - /* The field is located in the CPURO structure. */ - ulFeatureBytesOffset = pSharedInfo->MemoryMap.DoubleTalkBehaviorFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.DoubleTalkBehaviorFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.DoubleTalkBehaviorFieldOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - ulTempData |= (f_pVqeConfig->ulDoubleTalkBehavior << ulFeatureBitOffset ); - - /* Then save the DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Set the music protection enable. */ - if ( ( pSharedInfo->ImageInfo.fMusicProtection == TRUE ) - && ( pSharedInfo->ImageInfo.fMusicProtectionConfiguration == TRUE ) ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->fEnableMusicProtection != pChanEntry->VqeConfig.fEnableMusicProtection ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.MusicProtectionFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.MusicProtectionFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.MusicProtectionFieldOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - if ( f_pVqeConfig->fEnableMusicProtection == TRUE ) - ulTempData |= ( 1 << ulFeatureBitOffset ); - - /* Then save the DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /*==============================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteVqeAfMemory - -Description: This function configures the AF related VQE features of an - echo channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pVqeConfig Pointer to a VQE config structure. -f_pChannelOpen Pointer to a channel configuration structure. -f_usChanIndex Index of the echo channel in the API instance. -f_usEchoMemIndex Index of the echo channel within the SSPX memory. -f_fClearPlayoutPointers Flag indicating if the playout pointer should be cleared. -f_fModifyOnly Flag indicating if the configuration should be - modified only. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteVqeAfMemory -UINT32 Oct6100ApiWriteVqeAfMemory( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN BOOL f_fClearPlayoutPointers, - IN BOOL f_fModifyOnly ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - UINT32 ulTempData; - UINT32 ulAfConfigBaseAddress; - UINT32 ulFeatureBytesOffset; - UINT32 ulFeatureBitOffset; - UINT32 ulFeatureFieldLength; - UINT32 ulMask; - UINT16 usTempData; - - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Obtain a pointer to the new buffer's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ); - - /*==============================================================================*/ - /* Write the AF CPU configuration of the channel feature by feature.*/ - - /* Calculate AF CPU configuration base address. */ - ulAfConfigBaseAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_usEchoMemIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoMemOfst; - - /* Set initial value to zero.*/ - ulTempData = 0; - - /*==============================================================================*/ - /* Program the Maximum echo point within the Main channel memory.*/ - if ( pSharedInfo->ImageInfo.fMaxEchoPoint == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( ( f_pVqeConfig->lDefaultErlDb != pChanEntry->VqeConfig.chDefaultErlDb ) - || ( f_pChannelOpen->ulEchoOperationMode != pChanEntry->byEchoOperationMode ) ) ) ) - { - /* Write the echo tail length */ - ulFeatureBytesOffset = pSharedInfo->MemoryMap.ChanMainIoMaxEchoPointOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.ChanMainIoMaxEchoPointOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.ChanMainIoMaxEchoPointOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulAfConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Convert the DB value to octasic's float format.*/ - if ( f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_NO_ECHO ) - { - usTempData = Oct6100ApiDbAmpHalfToOctFloat( 2 * f_pVqeConfig->lDefaultErlDb ); - } - else - { - /* Clear max echo point. No echo cancellation here. */ - usTempData = 0x0; - } - - if ( ulFeatureFieldLength < 16 ) - usTempData = (UINT16)( usTempData >> ( 16 - ulFeatureFieldLength ) ); - - ulTempData |= usTempData << ulFeatureBitOffset; - - /* First read the DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulAfConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Set the non-linear behavior B.*/ - if ( pSharedInfo->ImageInfo.fNonLinearityBehaviorB == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->ulNonLinearityBehaviorB != pChanEntry->VqeConfig.byNonLinearityBehaviorB ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.NlpConvCapFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.NlpConvCapFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.NlpConvCapFieldOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulAfConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - ulTempData |= (f_pVqeConfig->ulNonLinearityBehaviorB << ulFeatureBitOffset ); - - /* Then save the DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulAfConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Set the listener enhancement feature. */ - if ( pSharedInfo->ImageInfo.fListenerEnhancement == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( ( f_pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb != pChanEntry->VqeConfig.bySoutAutomaticListenerEnhancementGainDb ) - || ( f_pVqeConfig->fSoutNaturalListenerEnhancement != pChanEntry->VqeConfig.fSoutNaturalListenerEnhancement ) - || ( f_pVqeConfig->ulSoutNaturalListenerEnhancementGainDb != pChanEntry->VqeConfig.bySoutNaturalListenerEnhancementGainDb ) ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.AdaptiveAleOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.AdaptiveAleOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.AdaptiveAleOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulAfConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if ( f_pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb != 0 ) - { - UINT32 ulGainDb; - - ulGainDb = f_pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb / 3; - - /* Round up. */ - if ( ( f_pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb % 3 ) != 0x0 ) - ulGainDb ++; - - ulTempData |= ( ulGainDb << ulFeatureBitOffset ); - } - else if ( f_pVqeConfig->fSoutNaturalListenerEnhancement != 0 ) - { - UINT32 ulGainDb; - - ulGainDb = f_pVqeConfig->ulSoutNaturalListenerEnhancementGainDb / 3; - - /* Round up. */ - if ( ( f_pVqeConfig->ulSoutNaturalListenerEnhancementGainDb % 3 ) != 0x0 ) - ulGainDb ++; - - ulTempData |= ( ( 0x80 | ulGainDb ) << ulFeatureBitOffset ); - } - - /* Now write the DWORD where the field is located containing the new configuration. */ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulAfConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Set the idle code detection enable. */ - if ( ( pSharedInfo->ImageInfo.fIdleCodeDetection == TRUE ) - && ( pSharedInfo->ImageInfo.fIdleCodeDetectionConfiguration == TRUE ) ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->fIdleCodeDetection != pChanEntry->VqeConfig.fIdleCodeDetection ) ) ) - { - /* Calculate base address in the AF software configuration. */ - ulFeatureBytesOffset = pSharedInfo->MemoryMap.IdleCodeDetectionFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.IdleCodeDetectionFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.IdleCodeDetectionFieldOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulAfConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - if ( f_pVqeConfig->fIdleCodeDetection == FALSE ) - ulTempData |= ( 1 << ulFeatureBitOffset ); - - /* Then save the DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulAfConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Set the AFT control field. */ - if ( pSharedInfo->ImageInfo.fAftControl == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pChannelOpen->ulEchoOperationMode != pChanEntry->byEchoOperationMode ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.AftControlOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.AftControlOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.AftControlOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulAfConfigBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* If the operation mode is no echo, set the field such that echo cancellation is disabled. */ - if ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_NO_ECHO ) - { - ulTempData |= ( 0x1234 << ulFeatureBitOffset ); - } - else if ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION ) - { - /* For clarity. */ - ulTempData |= ( 0x0 << ulFeatureBitOffset ); - } - - /* Then save the DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulAfConfigBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /*==============================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteEchoMemory - -Description: This function configure an echo memory entry in internal memory.and - external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pTdmConfig Pointer to a TDM config structure. -f_pChannelOpen Pointer to a channel configuration structure. -f_usEchoIndex Echo channel index within the SSPX memory. -f_usRinRoutTsiIndex RIN/ROUT TSI index within the TSI chariot memory -f_usSinSoutTsiIndex SIN/SOUT TSI index within the TSI chariot memory - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteEchoMemory -UINT32 Oct6100ApiWriteEchoMemory( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_TDM f_pTdmConfig, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usEchoIndex, - IN UINT16 f_usRinRoutTsiIndex, - IN UINT16 f_usSinSoutTsiIndex ) - -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - UINT32 ulTempData; - UINT32 ulBaseAddress; - UINT32 ulRinPcmLaw; - UINT32 ulRoutPcmLaw; - UINT32 ulSinPcmLaw; - UINT32 ulSoutPcmLaw; - - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Set immediately the PCM law to be programmed in the SSPX and NLP memory.*/ - if ( f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_RIN ) - { - ulRinPcmLaw = f_pChannelOpen->TdmConfig.ulRoutPcmLaw; - ulRoutPcmLaw = f_pChannelOpen->TdmConfig.ulRoutPcmLaw; - ulSinPcmLaw = f_pChannelOpen->TdmConfig.ulSinPcmLaw; - ulSoutPcmLaw = f_pChannelOpen->TdmConfig.ulSinPcmLaw; - } - else /* f_pChannelOpen->CodecConfig.ulDecoderPort == cOCT6100_CHANNEL_PORT_SIN */ - { - ulRinPcmLaw = f_pChannelOpen->TdmConfig.ulRinPcmLaw; - ulRoutPcmLaw = f_pChannelOpen->TdmConfig.ulRinPcmLaw; - ulSinPcmLaw = f_pChannelOpen->TdmConfig.ulSoutPcmLaw; - ulSoutPcmLaw = f_pChannelOpen->TdmConfig.ulSoutPcmLaw; - } - - /*==============================================================================*/ - /* Configure the Global Static Configuration of the channel.*/ - - ulBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_usEchoIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + cOCT6100_CHANNEL_ROOT_GLOBAL_CONF_OFFSET; - - /* Set the PGSP context base address. */ - ulTempData = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_usEchoIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + cOCT6100_CH_MAIN_PGSP_CONTEXT_OFFSET; - - WriteParams.ulWriteAddress = ulBaseAddress + cOCT6100_GSC_PGSP_CONTEXT_BASE_ADD_OFFSET; - WriteParams.usWriteData = (UINT16)( ulTempData >> 16 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( ulTempData & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the PGSP init context base address. */ - ulTempData = ( cOCT6100_IMAGE_FILE_BASE + 0x200 ) & 0x07FFFFFF; - - WriteParams.ulWriteAddress = ulBaseAddress + cOCT6100_GSC_PGSP_INIT_CONTEXT_BASE_ADD_OFFSET; - WriteParams.usWriteData = (UINT16)( ulTempData >> 16 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( ulTempData & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the RIN circular buffer base address. */ - ulTempData = ( pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_usEchoIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + pSharedInfo->MemoryMap.ulChanMainRinCBMemOfst) & 0x07FFFF00; - ulTempData |= ( ulRoutPcmLaw << cOCT6100_GSC_BUFFER_LAW_OFFSET ); - - /* Set the circular buffer size.*/ - if (( pSharedInfo->MemoryMap.ulChanMainRinCBMemSize & 0xFFFF00FF ) != 0 ) - return cOCT6100_ERR_CHANNEL_INVALID_RIN_CB_SIZE; - ulTempData |= pSharedInfo->MemoryMap.ulChanMainRinCBMemSize >> 8; - - WriteParams.ulWriteAddress = ulBaseAddress + cOCT6100_GSC_RIN_CIRC_BUFFER_BASE_ADD_OFFSET; - WriteParams.usWriteData = (UINT16)( ulTempData >> 16 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( ulTempData & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the SIN circular buffer base address. */ - ulTempData = ( pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_usEchoIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + pSharedInfo->MemoryMap.ulChanMainSinCBMemOfst) & 0x07FFFF00; - ulTempData |= ( ulSinPcmLaw << cOCT6100_GSC_BUFFER_LAW_OFFSET ); - - WriteParams.ulWriteAddress = ulBaseAddress + cOCT6100_GSC_SIN_CIRC_BUFFER_BASE_ADD_OFFSET; - WriteParams.usWriteData = (UINT16)( ulTempData >> 16 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( ulTempData & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the SOUT circular buffer base address. */ - ulTempData = ( pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_usEchoIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + pSharedInfo->MemoryMap.ulChanMainSoutCBMemOfst ) & 0x07FFFF00; - ulTempData |= ( ulSoutPcmLaw << cOCT6100_GSC_BUFFER_LAW_OFFSET ); - - WriteParams.ulWriteAddress = ulBaseAddress + cOCT6100_GSC_SOUT_CIRC_BUFFER_BASE_ADD_OFFSET; - WriteParams.usWriteData = (UINT16)( ulTempData >> 16 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( ulTempData & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - - /*==============================================================================*/ - /* ECHO SSPX Memory configuration.*/ - - WriteParams.ulWriteAddress = cOCT6100_ECHO_CONTROL_MEM_BASE + ( f_usEchoIndex * cOCT6100_ECHO_CONTROL_MEM_ENTRY_SIZE ); - - /* ECHO memory BASE + 2 */ - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = 0x0000; - - /* Set the echo control field.*/ - if ( ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_NO_ECHO ) - || ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_SPEECH_RECOGNITION ) ) - { - WriteParams.usWriteData |= cOCT6100_ECHO_OP_MODE_NORMAL << cOCT6100_ECHO_CONTROL_MEM_AF_CONTROL; - } - else if ( f_pChannelOpen->ulEchoOperationMode != cOCT6100_ECHO_OP_MODE_EXTERNAL ) - { - WriteParams.usWriteData |= f_pChannelOpen->ulEchoOperationMode << cOCT6100_ECHO_CONTROL_MEM_AF_CONTROL; - } - - /* Set the SIN/SOUT law.*/ - WriteParams.usWriteData |= ulSinPcmLaw << cOCT6100_ECHO_CONTROL_MEM_INPUT_LAW_OFFSET; - WriteParams.usWriteData |= ulSoutPcmLaw << cOCT6100_ECHO_CONTROL_MEM_OUTPUT_LAW_OFFSET; - - /* Set the TSI chariot memory field.*/ - WriteParams.usWriteData |= f_usSinSoutTsiIndex & cOCT6100_ECHO_CONTROL_MEM_TSI_MEM_MASK; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* ECHO memory BASE */ - WriteParams.ulWriteAddress -= 2; - WriteParams.usWriteData = cOCT6100_ECHO_CONTROL_MEM_ACTIVATE_ENTRY; - - /* Set the RIN/ROUT law.*/ - WriteParams.usWriteData |= ulRinPcmLaw << cOCT6100_ECHO_CONTROL_MEM_INPUT_LAW_OFFSET; - WriteParams.usWriteData |= ulRoutPcmLaw << cOCT6100_ECHO_CONTROL_MEM_OUTPUT_LAW_OFFSET; - - /* Set the RIN external echo control bit.*/ - if ( f_pChannelOpen->ulEchoOperationMode == cOCT6100_ECHO_OP_MODE_EXTERNAL ) - WriteParams.usWriteData |= cOCT6100_ECHO_CONTROL_MEM_EXTERNAL_AF_CTRL; - - /* Set the TSI chariot memory field.*/ - WriteParams.usWriteData |= f_usRinRoutTsiIndex & cOCT6100_ECHO_CONTROL_MEM_TSI_MEM_MASK; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateOpenStruct - -Description: This function will copy the new parameter from the modify structure - into a channel open structure to be processed later by the same path - as the channel open function. - If a parameter is set to keep previous, it's current value will be - extracted from the channel entry in the API. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -IN f_pApiInstance Pointer to an API instance structure. -IN f_pChanModify Pointer to a channel modify structure. -IN OUT f_pChanOpen Pointer to a channel open structure. -IN f_pChanEntry Pointer to an API channel structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateOpenStruct -UINT32 Oct6100ApiUpdateOpenStruct( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MODIFY f_pChanModify, - IN OUT tPOCT6100_CHANNEL_OPEN f_pChanOpen, - IN tPOCT6100_API_CHANNEL f_pChanEntry ) -{ - - /* Check the generic Echo parameters.*/ - if ( f_pChanModify->ulEchoOperationMode == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->ulEchoOperationMode = f_pChanEntry->byEchoOperationMode; - else - f_pChanOpen->ulEchoOperationMode = f_pChanModify->ulEchoOperationMode; - - - if ( f_pChanModify->fEnableToneDisabler == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->fEnableToneDisabler = f_pChanEntry->fEnableToneDisabler; - else - f_pChanOpen->fEnableToneDisabler = f_pChanModify->fEnableToneDisabler; - - - if ( f_pChanModify->ulUserChanId == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->ulUserChanId = f_pChanEntry->ulUserChanId; - else - f_pChanOpen->ulUserChanId = f_pChanModify->ulUserChanId; - - - - /*======================================================================*/ - /* Now update the TDM config.*/ - /* Rin PCM LAW */ - if ( f_pChanModify->TdmConfig.ulRinPcmLaw == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulRinPcmLaw = f_pChanEntry->TdmConfig.byRinPcmLaw; - else - f_pChanOpen->TdmConfig.ulRinPcmLaw = f_pChanModify->TdmConfig.ulRinPcmLaw; - - /* Sin PCM LAW */ - if ( f_pChanModify->TdmConfig.ulSinPcmLaw == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulSinPcmLaw = f_pChanEntry->TdmConfig.bySinPcmLaw; - else - f_pChanOpen->TdmConfig.ulSinPcmLaw = f_pChanModify->TdmConfig.ulSinPcmLaw; - - /* Rout PCM LAW */ - if ( f_pChanModify->TdmConfig.ulRoutPcmLaw == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulRoutPcmLaw = f_pChanEntry->TdmConfig.byRoutPcmLaw; - else - f_pChanOpen->TdmConfig.ulRoutPcmLaw = f_pChanModify->TdmConfig.ulRoutPcmLaw; - - /* Sout PCM LAW */ - if ( f_pChanModify->TdmConfig.ulSoutPcmLaw == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulSoutPcmLaw = f_pChanEntry->TdmConfig.bySoutPcmLaw; - else - f_pChanOpen->TdmConfig.ulSoutPcmLaw = f_pChanModify->TdmConfig.ulSoutPcmLaw; - - - /* Rin Timeslot */ - if ( f_pChanModify->TdmConfig.ulRinTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulRinTimeslot = f_pChanEntry->TdmConfig.usRinTimeslot; - else - f_pChanOpen->TdmConfig.ulRinTimeslot = f_pChanModify->TdmConfig.ulRinTimeslot; - - /* Rin Stream */ - if ( f_pChanModify->TdmConfig.ulRinStream == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulRinStream = f_pChanEntry->TdmConfig.usRinStream; - else - f_pChanOpen->TdmConfig.ulRinStream = f_pChanModify->TdmConfig.ulRinStream; - - /* Rin Num TSSTs */ - if ( f_pChanModify->TdmConfig.ulRinNumTssts == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulRinNumTssts = f_pChanEntry->TdmConfig.byRinNumTssts; - else - f_pChanOpen->TdmConfig.ulRinNumTssts = f_pChanModify->TdmConfig.ulRinNumTssts; - - - /* Sin Timeslot */ - if ( f_pChanModify->TdmConfig.ulSinTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulSinTimeslot = f_pChanEntry->TdmConfig.usSinTimeslot; - else - f_pChanOpen->TdmConfig.ulSinTimeslot = f_pChanModify->TdmConfig.ulSinTimeslot; - - /* Sin Stream */ - if ( f_pChanModify->TdmConfig.ulSinStream == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulSinStream = f_pChanEntry->TdmConfig.usSinStream; - else - f_pChanOpen->TdmConfig.ulSinStream = f_pChanModify->TdmConfig.ulSinStream; - - /* Sin Num TSSTs */ - if ( f_pChanModify->TdmConfig.ulSinNumTssts == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulSinNumTssts = f_pChanEntry->TdmConfig.bySinNumTssts; - else - f_pChanOpen->TdmConfig.ulSinNumTssts = f_pChanModify->TdmConfig.ulSinNumTssts; - - - /* Rout Timeslot */ - if ( f_pChanModify->TdmConfig.ulRoutTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulRoutTimeslot = f_pChanEntry->TdmConfig.usRoutTimeslot; - else - f_pChanOpen->TdmConfig.ulRoutTimeslot = f_pChanModify->TdmConfig.ulRoutTimeslot; - - /* Rout Stream */ - if ( f_pChanModify->TdmConfig.ulRoutStream == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulRoutStream = f_pChanEntry->TdmConfig.usRoutStream; - else - f_pChanOpen->TdmConfig.ulRoutStream = f_pChanModify->TdmConfig.ulRoutStream; - - /* Rout Num TSSTs */ - if ( f_pChanModify->TdmConfig.ulRoutNumTssts == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulRoutNumTssts = f_pChanEntry->TdmConfig.byRoutNumTssts; - else - f_pChanOpen->TdmConfig.ulRoutNumTssts = f_pChanModify->TdmConfig.ulRoutNumTssts; - - - /* Sout Timeslot */ - if ( f_pChanModify->TdmConfig.ulSoutTimeslot == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulSoutTimeslot = f_pChanEntry->TdmConfig.usSoutTimeslot; - else - f_pChanOpen->TdmConfig.ulSoutTimeslot = f_pChanModify->TdmConfig.ulSoutTimeslot; - - /* Sout Stream */ - if ( f_pChanModify->TdmConfig.ulSoutStream == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulSoutStream = f_pChanEntry->TdmConfig.usSoutStream; - else - f_pChanOpen->TdmConfig.ulSoutStream = f_pChanModify->TdmConfig.ulSoutStream; - - /* Sout Num TSSTs */ - if ( f_pChanModify->TdmConfig.ulSoutNumTssts == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->TdmConfig.ulSoutNumTssts = f_pChanEntry->TdmConfig.bySoutNumTssts; - else - f_pChanOpen->TdmConfig.ulSoutNumTssts = f_pChanModify->TdmConfig.ulSoutNumTssts; - - /*======================================================================*/ - - /*======================================================================*/ - /* Now update the VQE config.*/ - - if ( f_pChanModify->VqeConfig.ulComfortNoiseMode == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.ulComfortNoiseMode = f_pChanEntry->VqeConfig.byComfortNoiseMode; - else - f_pChanOpen->VqeConfig.ulComfortNoiseMode = f_pChanModify->VqeConfig.ulComfortNoiseMode; - - if ( f_pChanModify->VqeConfig.fEnableNlp == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fEnableNlp = f_pChanEntry->VqeConfig.fEnableNlp; - else - f_pChanOpen->VqeConfig.fEnableNlp = f_pChanModify->VqeConfig.fEnableNlp; - - if ( f_pChanModify->VqeConfig.fEnableTailDisplacement == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fEnableTailDisplacement = f_pChanEntry->VqeConfig.fEnableTailDisplacement; - else - f_pChanOpen->VqeConfig.fEnableTailDisplacement = f_pChanModify->VqeConfig.fEnableTailDisplacement; - - if ( f_pChanModify->VqeConfig.ulTailDisplacement == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.ulTailDisplacement = f_pChanEntry->VqeConfig.usTailDisplacement; - else - f_pChanOpen->VqeConfig.ulTailDisplacement = f_pChanModify->VqeConfig.ulTailDisplacement; - - /* Tail length cannot be modifed. */ - f_pChanOpen->VqeConfig.ulTailLength = f_pChanEntry->VqeConfig.usTailLength; - - - - if ( f_pChanModify->VqeConfig.fRinDcOffsetRemoval == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fRinDcOffsetRemoval = f_pChanEntry->VqeConfig.fRinDcOffsetRemoval; - else - f_pChanOpen->VqeConfig.fRinDcOffsetRemoval = f_pChanModify->VqeConfig.fRinDcOffsetRemoval; - - - if ( f_pChanModify->VqeConfig.fRinLevelControl == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fRinLevelControl = f_pChanEntry->VqeConfig.fRinLevelControl; - else - f_pChanOpen->VqeConfig.fRinLevelControl = f_pChanModify->VqeConfig.fRinLevelControl; - - - if ( f_pChanModify->VqeConfig.fRinAutomaticLevelControl == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fRinAutomaticLevelControl = f_pChanEntry->VqeConfig.fRinAutomaticLevelControl; - else - f_pChanOpen->VqeConfig.fRinAutomaticLevelControl = f_pChanModify->VqeConfig.fRinAutomaticLevelControl; - - - if ( f_pChanModify->VqeConfig.fRinHighLevelCompensation == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fRinHighLevelCompensation = f_pChanEntry->VqeConfig.fRinHighLevelCompensation; - else - f_pChanOpen->VqeConfig.fRinHighLevelCompensation = f_pChanModify->VqeConfig.fRinHighLevelCompensation; - - - if ( f_pChanModify->VqeConfig.lRinHighLevelCompensationThresholdDb == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.lRinHighLevelCompensationThresholdDb = f_pChanEntry->VqeConfig.chRinHighLevelCompensationThresholdDb; - else - f_pChanOpen->VqeConfig.lRinHighLevelCompensationThresholdDb = f_pChanModify->VqeConfig.lRinHighLevelCompensationThresholdDb; - - - if ( f_pChanModify->VqeConfig.fSinDcOffsetRemoval == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fSinDcOffsetRemoval = f_pChanEntry->VqeConfig.fSinDcOffsetRemoval; - else - f_pChanOpen->VqeConfig.fSinDcOffsetRemoval = f_pChanModify->VqeConfig.fSinDcOffsetRemoval; - - - if ( f_pChanModify->VqeConfig.fSoutAdaptiveNoiseReduction == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fSoutAdaptiveNoiseReduction = f_pChanEntry->VqeConfig.fSoutAdaptiveNoiseReduction; - else - f_pChanOpen->VqeConfig.fSoutAdaptiveNoiseReduction = f_pChanModify->VqeConfig.fSoutAdaptiveNoiseReduction; - - - if ( f_pChanModify->VqeConfig.fSoutConferencingNoiseReduction == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fSoutConferencingNoiseReduction = f_pChanEntry->VqeConfig.fSoutConferencingNoiseReduction; - else - f_pChanOpen->VqeConfig.fSoutConferencingNoiseReduction = f_pChanModify->VqeConfig.fSoutConferencingNoiseReduction; - - - if ( f_pChanModify->VqeConfig.fSoutNoiseBleaching == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fSoutNoiseBleaching = f_pChanEntry->VqeConfig.fSoutNoiseBleaching; - else - f_pChanOpen->VqeConfig.fSoutNoiseBleaching = f_pChanModify->VqeConfig.fSoutNoiseBleaching; - - - if ( f_pChanModify->VqeConfig.fSoutLevelControl == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fSoutLevelControl = f_pChanEntry->VqeConfig.fSoutLevelControl; - else - f_pChanOpen->VqeConfig.fSoutLevelControl = f_pChanModify->VqeConfig.fSoutLevelControl; - - - if ( f_pChanModify->VqeConfig.fSoutAutomaticLevelControl == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fSoutAutomaticLevelControl = f_pChanEntry->VqeConfig.fSoutAutomaticLevelControl; - else - f_pChanOpen->VqeConfig.fSoutAutomaticLevelControl = f_pChanModify->VqeConfig.fSoutAutomaticLevelControl; - - - if ( f_pChanModify->VqeConfig.lRinLevelControlGainDb == ( (INT32)cOCT6100_KEEP_PREVIOUS_SETTING ) ) - f_pChanOpen->VqeConfig.lRinLevelControlGainDb = f_pChanEntry->VqeConfig.chRinLevelControlGainDb; - else - f_pChanOpen->VqeConfig.lRinLevelControlGainDb = f_pChanModify->VqeConfig.lRinLevelControlGainDb; - - - if ( f_pChanModify->VqeConfig.lSoutLevelControlGainDb == ( (INT32)cOCT6100_KEEP_PREVIOUS_SETTING ) ) - f_pChanOpen->VqeConfig.lSoutLevelControlGainDb = f_pChanEntry->VqeConfig.chSoutLevelControlGainDb; - else - f_pChanOpen->VqeConfig.lSoutLevelControlGainDb = f_pChanModify->VqeConfig.lSoutLevelControlGainDb; - - - if ( f_pChanModify->VqeConfig.lRinAutomaticLevelControlTargetDb == ( (INT32)cOCT6100_KEEP_PREVIOUS_SETTING ) ) - f_pChanOpen->VqeConfig.lRinAutomaticLevelControlTargetDb = f_pChanEntry->VqeConfig.chRinAutomaticLevelControlTargetDb; - else - f_pChanOpen->VqeConfig.lRinAutomaticLevelControlTargetDb = f_pChanModify->VqeConfig.lRinAutomaticLevelControlTargetDb; - - - if ( f_pChanModify->VqeConfig.lSoutAutomaticLevelControlTargetDb == ( (INT32)cOCT6100_KEEP_PREVIOUS_SETTING ) ) - f_pChanOpen->VqeConfig.lSoutAutomaticLevelControlTargetDb = f_pChanEntry->VqeConfig.chSoutAutomaticLevelControlTargetDb; - else - f_pChanOpen->VqeConfig.lSoutAutomaticLevelControlTargetDb = f_pChanModify->VqeConfig.lSoutAutomaticLevelControlTargetDb; - - - if ( f_pChanModify->VqeConfig.lDefaultErlDb == ( (INT32)cOCT6100_KEEP_PREVIOUS_SETTING ) ) - f_pChanOpen->VqeConfig.lDefaultErlDb = f_pChanEntry->VqeConfig.chDefaultErlDb; - else - f_pChanOpen->VqeConfig.lDefaultErlDb = f_pChanModify->VqeConfig.lDefaultErlDb; - - - if ( f_pChanModify->VqeConfig.lAecDefaultErlDb == ( (INT32)cOCT6100_KEEP_PREVIOUS_SETTING ) ) - f_pChanOpen->VqeConfig.lAecDefaultErlDb = f_pChanEntry->VqeConfig.chAecDefaultErlDb; - else - f_pChanOpen->VqeConfig.lAecDefaultErlDb = f_pChanModify->VqeConfig.lAecDefaultErlDb; - - - if ( f_pChanModify->VqeConfig.ulAecTailLength == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.ulAecTailLength = f_pChanEntry->VqeConfig.usAecTailLength; - else - f_pChanOpen->VqeConfig.ulAecTailLength = f_pChanModify->VqeConfig.ulAecTailLength; - - - if ( f_pChanModify->VqeConfig.fAcousticEcho == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fAcousticEcho = f_pChanEntry->VqeConfig.fAcousticEcho; - else - f_pChanOpen->VqeConfig.fAcousticEcho = f_pChanModify->VqeConfig.fAcousticEcho; - - - if ( f_pChanModify->VqeConfig.fDtmfToneRemoval == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fDtmfToneRemoval = f_pChanEntry->VqeConfig.fDtmfToneRemoval; - else - f_pChanOpen->VqeConfig.fDtmfToneRemoval = f_pChanModify->VqeConfig.fDtmfToneRemoval; - - - - - - if ( f_pChanModify->VqeConfig.ulNonLinearityBehaviorA == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.ulNonLinearityBehaviorA = f_pChanEntry->VqeConfig.byNonLinearityBehaviorA; - else - f_pChanOpen->VqeConfig.ulNonLinearityBehaviorA = f_pChanModify->VqeConfig.ulNonLinearityBehaviorA; - - - if ( f_pChanModify->VqeConfig.ulNonLinearityBehaviorB == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.ulNonLinearityBehaviorB = f_pChanEntry->VqeConfig.byNonLinearityBehaviorB; - else - f_pChanOpen->VqeConfig.ulNonLinearityBehaviorB = f_pChanModify->VqeConfig.ulNonLinearityBehaviorB; - - - if ( f_pChanModify->VqeConfig.ulDoubleTalkBehavior == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.ulDoubleTalkBehavior = f_pChanEntry->VqeConfig.byDoubleTalkBehavior; - else - f_pChanOpen->VqeConfig.ulDoubleTalkBehavior = f_pChanModify->VqeConfig.ulDoubleTalkBehavior; - - - if ( f_pChanModify->VqeConfig.ulSoutAutomaticListenerEnhancementGainDb == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.ulSoutAutomaticListenerEnhancementGainDb = f_pChanEntry->VqeConfig.bySoutAutomaticListenerEnhancementGainDb; - else - f_pChanOpen->VqeConfig.ulSoutAutomaticListenerEnhancementGainDb = f_pChanModify->VqeConfig.ulSoutAutomaticListenerEnhancementGainDb; - - - if ( f_pChanModify->VqeConfig.ulSoutNaturalListenerEnhancementGainDb == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.ulSoutNaturalListenerEnhancementGainDb = f_pChanEntry->VqeConfig.bySoutNaturalListenerEnhancementGainDb; - else - f_pChanOpen->VqeConfig.ulSoutNaturalListenerEnhancementGainDb = f_pChanModify->VqeConfig.ulSoutNaturalListenerEnhancementGainDb; - - - if ( f_pChanModify->VqeConfig.fSoutNaturalListenerEnhancement == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fSoutNaturalListenerEnhancement = f_pChanEntry->VqeConfig.fSoutNaturalListenerEnhancement; - else - f_pChanOpen->VqeConfig.fSoutNaturalListenerEnhancement = f_pChanModify->VqeConfig.fSoutNaturalListenerEnhancement; - - - if ( f_pChanModify->VqeConfig.fRoutNoiseReduction == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fRoutNoiseReduction = f_pChanEntry->VqeConfig.fRoutNoiseReduction; - else - f_pChanOpen->VqeConfig.fRoutNoiseReduction = f_pChanModify->VqeConfig.fRoutNoiseReduction; - - if ( f_pChanModify->VqeConfig.lRoutNoiseReductionLevelGainDb == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.lRoutNoiseReductionLevelGainDb = f_pChanEntry->VqeConfig.chRoutNoiseReductionLevelGainDb; - else - f_pChanOpen->VqeConfig.lRoutNoiseReductionLevelGainDb = f_pChanModify->VqeConfig.lRoutNoiseReductionLevelGainDb; - - - if ( f_pChanModify->VqeConfig.lAnrSnrEnhancementDb == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.lAnrSnrEnhancementDb = f_pChanEntry->VqeConfig.chAnrSnrEnhancementDb; - else - f_pChanOpen->VqeConfig.lAnrSnrEnhancementDb = f_pChanModify->VqeConfig.lAnrSnrEnhancementDb; - - - if ( f_pChanModify->VqeConfig.ulAnrVoiceNoiseSegregation == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.ulAnrVoiceNoiseSegregation = f_pChanEntry->VqeConfig.byAnrVoiceNoiseSegregation; - else - f_pChanOpen->VqeConfig.ulAnrVoiceNoiseSegregation = f_pChanModify->VqeConfig.ulAnrVoiceNoiseSegregation; - - - if ( f_pChanModify->VqeConfig.ulToneDisablerVqeActivationDelay == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.ulToneDisablerVqeActivationDelay = f_pChanEntry->VqeConfig.usToneDisablerVqeActivationDelay; - else - f_pChanOpen->VqeConfig.ulToneDisablerVqeActivationDelay = f_pChanModify->VqeConfig.ulToneDisablerVqeActivationDelay; - - - if ( f_pChanModify->VqeConfig.fEnableMusicProtection == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fEnableMusicProtection = f_pChanEntry->VqeConfig.fEnableMusicProtection; - else - f_pChanOpen->VqeConfig.fEnableMusicProtection = f_pChanModify->VqeConfig.fEnableMusicProtection; - - - if ( f_pChanModify->VqeConfig.fIdleCodeDetection == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->VqeConfig.fIdleCodeDetection = f_pChanEntry->VqeConfig.fIdleCodeDetection; - else - f_pChanOpen->VqeConfig.fIdleCodeDetection = f_pChanModify->VqeConfig.fIdleCodeDetection; - - /*======================================================================*/ - - - /*======================================================================*/ - /* Finaly the codec config.*/ - - if ( f_pChanModify->CodecConfig.ulDecoderPort == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->CodecConfig.ulDecoderPort = f_pChanEntry->CodecConfig.byDecoderPort; - else - f_pChanOpen->CodecConfig.ulDecoderPort = f_pChanModify->CodecConfig.ulDecoderPort; - - - if ( f_pChanModify->CodecConfig.ulDecodingRate == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->CodecConfig.ulDecodingRate = f_pChanEntry->CodecConfig.byDecodingRate; - else - f_pChanOpen->CodecConfig.ulDecodingRate = f_pChanModify->CodecConfig.ulDecodingRate; - - - if ( f_pChanModify->CodecConfig.ulEncoderPort == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->CodecConfig.ulEncoderPort = f_pChanEntry->CodecConfig.byEncoderPort; - else - f_pChanOpen->CodecConfig.ulEncoderPort = f_pChanModify->CodecConfig.ulEncoderPort; - - - if ( f_pChanModify->CodecConfig.ulEncodingRate == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->CodecConfig.ulEncodingRate = f_pChanEntry->CodecConfig.byEncodingRate; - else - f_pChanOpen->CodecConfig.ulEncodingRate = f_pChanModify->CodecConfig.ulEncodingRate; - - if ( f_pChanModify->CodecConfig.fEnableSilenceSuppression == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->CodecConfig.fEnableSilenceSuppression = f_pChanEntry->CodecConfig.fEnableSilenceSuppression; - else - f_pChanOpen->CodecConfig.fEnableSilenceSuppression = f_pChanModify->CodecConfig.fEnableSilenceSuppression; - - if ( f_pChanModify->CodecConfig.ulPhasingType == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->CodecConfig.ulPhasingType = f_pChanEntry->CodecConfig.byPhasingType; - else - f_pChanOpen->CodecConfig.ulPhasingType = f_pChanModify->CodecConfig.ulPhasingType; - - if ( f_pChanModify->CodecConfig.ulPhase == cOCT6100_KEEP_PREVIOUS_SETTING ) - f_pChanOpen->CodecConfig.ulPhase = f_pChanEntry->CodecConfig.byPhase; - else - f_pChanOpen->CodecConfig.ulPhase = f_pChanModify->CodecConfig.ulPhase; - - if ( f_pChanModify->CodecConfig.ulPhasingTsstHndl == cOCT6100_KEEP_PREVIOUS_SETTING ) - { - if ( f_pChanEntry->usPhasingTsstIndex != cOCT6100_INVALID_INDEX ) - { - tPOCT6100_API_PHASING_TSST pPhasingEntry; - - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pPhasingEntry, f_pChanEntry->usPhasingTsstIndex ); - - /* Now recreate the Phasing TSST handle.*/ - f_pChanOpen->CodecConfig.ulPhasingTsstHndl = cOCT6100_HNDL_TAG_PHASING_TSST | (pPhasingEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_pChanEntry->usPhasingTsstIndex; - } - else - { - f_pChanOpen->CodecConfig.ulPhasingTsstHndl = cOCT6100_INVALID_HANDLE; - } - } - else - { - f_pChanOpen->CodecConfig.ulPhasingTsstHndl = f_pChanModify->CodecConfig.ulPhasingTsstHndl; - } - - f_pChanOpen->CodecConfig.ulAdpcmNibblePosition = f_pChanEntry->CodecConfig.byAdpcmNibblePosition; - /*======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - - - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRetrieveNlpConfDword - -Description: This function is used by the API to store on a per channel basis - the various confguration DWORD from the device. The API performs - less read to the chip that way since it is always in synch with the - chip. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pChanEntry Pointer to an API channel structure.. -f_ulAddress Address that needs to be modified.. -f_pulConfigDword Pointer to the content stored in the API located at the - desired address. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRetrieveNlpConfDword -UINT32 Oct6100ApiRetrieveNlpConfDword( - - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_CHANNEL f_pChanEntry, - IN UINT32 f_ulAddress, - OUT PUINT32 f_pulConfigDword ) -{ - UINT32 ulResult; - UINT32 ulFirstEmptyIndex = 0xFFFFFFFF; - UINT32 i; - - /* Search for the Dword.*/ - for ( i = 0; i < cOCT6100_MAX_NLP_CONF_DWORD; i++ ) - { - if ( ( ulFirstEmptyIndex == 0xFFFFFFFF ) && ( f_pChanEntry->aulNlpConfDword[ i ][ 0 ] == 0x0 ) ) - ulFirstEmptyIndex = i; - - if ( f_pChanEntry->aulNlpConfDword[ i ][ 0 ] == f_ulAddress ) - { - /* We found the matching Dword.*/ - *f_pulConfigDword = f_pChanEntry->aulNlpConfDword[ i ][ 1 ]; - return cOCT6100_ERR_OK; - } - } - - if ( i == cOCT6100_MAX_NLP_CONF_DWORD && ulFirstEmptyIndex == 0xFFFFFFFF ) - return cOCT6100_ERR_FATAL_8E; - - /* We did not found any entry, let's create a new entry.*/ - f_pChanEntry->aulNlpConfDword[ ulFirstEmptyIndex ][ 0 ] = f_ulAddress; - - - /* Read the DWORD where the field is located.*/ - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulAddress, - f_pulConfigDword ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiSaveNlpConfDword - -Description: This function stores a configuration Dword within an API channel - structure and then writes it into the chip. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pChanEntry Pointer to an API channel structure.. -f_ulAddress Address that needs to be modified.. -f_pulConfigDword content to be stored in the API located at the - desired address. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiSaveNlpConfDword -UINT32 Oct6100ApiSaveNlpConfDword( - - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_CHANNEL f_pChanEntry, - IN UINT32 f_ulAddress, - IN UINT32 f_ulConfigDword ) -{ - UINT32 ulResult; - UINT32 i; - - /* Search for the Dword.*/ - for ( i = 0; i < cOCT6100_MAX_NLP_CONF_DWORD; i++ ) - { - - if ( f_pChanEntry->aulNlpConfDword[ i ][ 0 ] == f_ulAddress ) - { - /* We found the matching Dword.*/ - f_pChanEntry->aulNlpConfDword[ i ][ 1 ] = f_ulConfigDword; - break; - } - } - - if ( i == cOCT6100_MAX_NLP_CONF_DWORD ) - return cOCT6100_ERR_FATAL_8F; - - - /* Write the config DWORD.*/ - ulResult = Oct6100ApiWriteDword( f_pApiInstance, - f_ulAddress, - f_ulConfigDword ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelCreateBiDirSer - -Description: Creates a bidirectional echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelCreateBiDir Pointer to a create bidirectionnal channel structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelCreateBiDirSer -UINT32 Oct6100ChannelCreateBiDirSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_CREATE_BIDIR f_pChannelCreateBiDir ) -{ - UINT16 usFirstChanIndex; - UINT16 usFirstChanExtraTsiIndex; - UINT16 usFirstChanSinCopyEventIndex; - UINT16 usFirstChanSoutCopyEventIndex; - UINT16 usSecondChanIndex; - UINT16 usSecondChanExtraTsiIndex; - UINT16 usSecondChanSinCopyEventIndex; - UINT16 usSecondChanSoutCopyEventIndex; - UINT16 usBiDirChanIndex; - UINT32 ulResult; - - - /* Check the user's configuration of the bidir channel for errors. */ - ulResult = Oct6100ApiCheckChannelCreateBiDirParams( f_pApiInstance, - f_pChannelCreateBiDir, - &usFirstChanIndex, - &usFirstChanExtraTsiIndex, - &usFirstChanSinCopyEventIndex, - &usSecondChanIndex, - &usSecondChanExtraTsiIndex, - &usSecondChanSinCopyEventIndex - - ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reserve all resources needed by the bidir channel. */ - ulResult = Oct6100ApiReserveChannelCreateBiDirResources(f_pApiInstance, - - &usBiDirChanIndex, - &usFirstChanExtraTsiIndex, - &usFirstChanSinCopyEventIndex, - &usFirstChanSoutCopyEventIndex, - &usSecondChanExtraTsiIndex, - &usSecondChanSinCopyEventIndex, - &usSecondChanSoutCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write all necessary structures to activate the echo cancellation channel. */ - ulResult = Oct6100ApiWriteChannelCreateBiDirStructs( f_pApiInstance, - - usFirstChanIndex, - usFirstChanExtraTsiIndex, - usFirstChanSinCopyEventIndex, - usFirstChanSoutCopyEventIndex, - usSecondChanIndex, - usSecondChanExtraTsiIndex, - usSecondChanSinCopyEventIndex, - usSecondChanSoutCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the new echo cancellation channels's entry in the ECHO channel list. */ - ulResult = Oct6100ApiUpdateBiDirChannelEntry( f_pApiInstance, - f_pChannelCreateBiDir, - usBiDirChanIndex, - usFirstChanIndex, - usFirstChanExtraTsiIndex, - usFirstChanSinCopyEventIndex, - usFirstChanSoutCopyEventIndex, - usSecondChanIndex, - usSecondChanExtraTsiIndex, - usSecondChanSinCopyEventIndex, - usSecondChanSoutCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckChannelCreateBiDirParams - -Description: Checks the user's parameter passed to the create bidirectional channel - function. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelCreateBiDir Pointer to a create bidirectionnal channel structure. -f_pusFirstChanIndex Pointer to the first channel index. -f_pusFirstChanExtraTsiIndex Pointer to the first channel extra TSI index. -f_pusFirstChanSinCopyEventIndex Pointer to the first channel Sin copy event index. -f_pusSecondChanIndex Pointer to the second channel index. -f_pusSecondChanExtraTsiIndex Pointer to the second channel extra TSI index. -f_pusSecondChanSinCopyEventIndex Pointer to the second channel Sin copy event index. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckChannelCreateBiDirParams -UINT32 Oct6100ApiCheckChannelCreateBiDirParams( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_CREATE_BIDIR f_pChannelCreateBiDir, - OUT PUINT16 f_pusFirstChanIndex, - OUT PUINT16 f_pusFirstChanExtraTsiIndex, - OUT PUINT16 f_pusFirstChanSinCopyEventIndex, - OUT PUINT16 f_pusSecondChanIndex, - OUT PUINT16 f_pusSecondChanExtraTsiIndex, - OUT PUINT16 f_pusSecondChanSinCopyEventIndex - - ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pFirstChanEntry; - tPOCT6100_API_CHANNEL pSecondChanEntry; - UINT32 ulEntryOpenCnt; - BOOL fCheckTssts = TRUE; - - /* Obtain shared resources pointer.*/ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* validate the bidirectional channel handle memory.*/ - if ( f_pChannelCreateBiDir->pulBiDirChannelHndl == NULL ) - return cOCT6100_ERR_CHANNEL_BIDIR_CHANNEL_HANDLE; - - - - /* Check if bi-dir channels are activated. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxBiDirChannels == 0 ) - return cOCT6100_ERR_CHANNEL_BIDIR_DISABLED; - - /*=======================================================================*/ - /* Verify the first channel handle. */ - - if ( (f_pChannelCreateBiDir->ulFirstChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CHANNEL_BIDIR_FIRST_CHANNEL_HANDLE; - - *f_pusFirstChanIndex = (UINT16)( f_pChannelCreateBiDir->ulFirstChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusFirstChanIndex >= pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CHANNEL_BIDIR_FIRST_CHANNEL_HANDLE; - - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pFirstChanEntry, *f_pusFirstChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pChannelCreateBiDir->ulFirstChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pFirstChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pFirstChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_BIDIR_FIRST_CHANNEL_HANDLE; - - /* Check the specific state of the channel.*/ - if ( pFirstChanEntry->fRinRoutCodecActive == TRUE && pFirstChanEntry->CodecConfig.byEncoderPort != cOCT6100_CHANNEL_PORT_ROUT) - return cOCT6100_ERR_CHANNEL_CODEC_ACTIVATED; - if ( pFirstChanEntry->fSinSoutCodecActive == TRUE && pFirstChanEntry->CodecConfig.byEncoderPort != cOCT6100_CHANNEL_PORT_SOUT) - return cOCT6100_ERR_CHANNEL_CODEC_ACTIVATED; - if ( pFirstChanEntry->fBiDirChannel == TRUE ) - return cOCT6100_ERR_CHANNEL_ALREADY_BIDIR; - - if ( pFirstChanEntry->usBridgeIndex != cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CHANNEL_FIRST_CHAN_IN_CONFERENCE; - - if ( fCheckTssts == TRUE ) - { - if ( pFirstChanEntry->usSoutTsstIndex != cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CHANNEL_FIRST_CHAN_SOUT_PORT; - if ( pFirstChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CHANNEL_FIRST_CHAN_RIN_PORT; - } - - /* Return the desired info.*/ - *f_pusFirstChanExtraTsiIndex = pFirstChanEntry->usExtraSinTsiMemIndex; - *f_pusFirstChanSinCopyEventIndex = pFirstChanEntry->usSinCopyEventIndex; - /*=======================================================================*/ - - /*=======================================================================*/ - /* Verify the second channel handle. */ - - if ( (f_pChannelCreateBiDir->ulSecondChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CHANNEL_BIDIR_SECOND_CHANNEL_HANDLE; - - *f_pusSecondChanIndex = (UINT16)( f_pChannelCreateBiDir->ulSecondChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusSecondChanIndex >= pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CHANNEL_BIDIR_SECOND_CHANNEL_HANDLE; - - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pSecondChanEntry, *f_pusSecondChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pChannelCreateBiDir->ulSecondChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pSecondChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pSecondChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_BIDIR_SECOND_CHANNEL_HANDLE; - - /* Check the specific state of the channel.*/ - if ( pSecondChanEntry->fRinRoutCodecActive == TRUE && pSecondChanEntry->CodecConfig.byEncoderPort != cOCT6100_CHANNEL_PORT_ROUT) - return cOCT6100_ERR_CHANNEL_CODEC_ACTIVATED; - if ( pSecondChanEntry->fSinSoutCodecActive == TRUE && pSecondChanEntry->CodecConfig.byEncoderPort != cOCT6100_CHANNEL_PORT_SOUT) - { - - return cOCT6100_ERR_CHANNEL_CODEC_ACTIVATED; - } - - if ( pSecondChanEntry->fBiDirChannel == TRUE ) - return cOCT6100_ERR_CHANNEL_ALREADY_BIDIR; - - if ( fCheckTssts == TRUE ) - { - if ( pSecondChanEntry->usSoutTsstIndex != cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CHANNEL_SECOND_CHAN_SOUT_PORT; - if ( pSecondChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CHANNEL_SECOND_CHAN_RIN_PORT; - } - - if ( pSecondChanEntry->usBridgeIndex != cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CHANNEL_SECOND_CHAN_IN_CONFERENCE; - - /* Return the desired info.*/ - *f_pusSecondChanExtraTsiIndex = pSecondChanEntry->usExtraSinTsiMemIndex; - *f_pusSecondChanSinCopyEventIndex = pSecondChanEntry->usSinCopyEventIndex; - /*=======================================================================*/ - - /* Check the law compatibility.*/ - if ( pFirstChanEntry->TdmConfig.bySoutPcmLaw != pSecondChanEntry->TdmConfig.byRinPcmLaw || - pFirstChanEntry->TdmConfig.byRinPcmLaw != pSecondChanEntry->TdmConfig.bySoutPcmLaw ) - return cOCT6100_ERR_CHANNEL_BIDIR_PCM_LAW; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveChannelCreateBiDirResources - -Description: Reserves all resources needed for the new bidirectional channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pusBiDirChanIndex Pointer to the index of the bidirectionnal channel within the API instance. -f_pusFirstChanExtraTsiIndex Pointer to the first channel extra TSI index. -f_pusFirstChanSinCopyEventIndex Pointer to the first channel Sin copy event index. -f_pusFirstChanSoutCopyEventIndex Pointer to the first channel Sout copy event index. -f_pusSecondChanExtraTsiIndex Pointer to the second channel extra TSI index. -f_pusSecondChanSinCopyEventIndex Pointer to the second channel Sin copy event index. -f_pusSecondChanSoutCopyEventIndex Pointer to the second channel Sout copy event index. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveChannelCreateBiDirResources -UINT32 Oct6100ApiReserveChannelCreateBiDirResources( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - - OUT PUINT16 f_pusBiDirChanIndex, - IN OUT PUINT16 f_pusFirstChanExtraTsiIndex, - IN OUT PUINT16 f_pusFirstChanSinCopyEventIndex, - OUT PUINT16 f_pusFirstChanSoutCopyEventIndex, - IN OUT PUINT16 f_pusSecondChanExtraTsiIndex, - IN OUT PUINT16 f_pusSecondChanSinCopyEventIndex, - OUT PUINT16 f_pusSecondChanSoutCopyEventIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult = cOCT6100_ERR_OK; - UINT32 ulTempVar; - - BOOL fBiDirChanIndex = FALSE; - BOOL fFirstExtraTsi = FALSE; - BOOL fSecondExtraTsi = FALSE; - BOOL fFirstSinCopyEvent = FALSE; - BOOL fSecondSinCopyEvent = FALSE; - BOOL fFirstSoutCopyEvent = FALSE; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /*===============================================================================*/ - /* Verify and reserve the resources that might already by allocated. */ - - - { - if ( *f_pusFirstChanExtraTsiIndex == cOCT6100_INVALID_INDEX ) - { - /* Reserve the first Extra TSI memory entry */ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, - f_pusFirstChanExtraTsiIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - fFirstExtraTsi = TRUE; - } - - if ( *f_pusFirstChanSinCopyEventIndex == cOCT6100_INVALID_INDEX && ulResult == cOCT6100_ERR_OK ) - { - /* Reserve the Sin copy event for the first channel.*/ - ulResult = Oct6100ApiReserveMixerEventEntry ( f_pApiInstance, - f_pusFirstChanSinCopyEventIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - fFirstSinCopyEvent = TRUE; - } - } - - if ( *f_pusSecondChanExtraTsiIndex == cOCT6100_INVALID_INDEX && ulResult == cOCT6100_ERR_OK ) - { - /* Reserve the second Extra TSI memory entry */ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, - f_pusSecondChanExtraTsiIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - fSecondExtraTsi = TRUE; - } - - if ( *f_pusSecondChanSinCopyEventIndex == cOCT6100_INVALID_INDEX && ulResult == cOCT6100_ERR_OK ) - { - /* Reserve the Sin copy event for the second channel.*/ - ulResult = Oct6100ApiReserveMixerEventEntry ( f_pApiInstance, - f_pusSecondChanSinCopyEventIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - fSecondSinCopyEvent = TRUE; - } - /*===============================================================================*/ - - - /*===============================================================================*/ - /* Now reserve all the resources specific to bidirectional channels */ - - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReserveBiDirChanEntry( f_pApiInstance, - f_pusBiDirChanIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fBiDirChanIndex = TRUE; - - - { - - /* Reserve the first channel Sout copy mixer event.*/ - ulResult = Oct6100ApiReserveMixerEventEntry ( f_pApiInstance, - f_pusFirstChanSoutCopyEventIndex ); - } - - if ( ulResult == cOCT6100_ERR_OK ) - { - fFirstSoutCopyEvent = TRUE; - - /* Reserve the second channel Sout copy mixer event.*/ - ulResult = Oct6100ApiReserveMixerEventEntry ( f_pApiInstance, - f_pusSecondChanSoutCopyEventIndex ); - } - } - } - - /*===============================================================================*/ - - - /*===============================================================================*/ - /* Release the resources if something went wrong */ - if ( ulResult != cOCT6100_ERR_OK ) - { - /*===============================================================================*/ - /* Release the previously reserved echo resources .*/ - if ( fBiDirChanIndex == TRUE ) - { - ulTempVar = Oct6100ApiReleaseBiDirChanEntry( f_pApiInstance, - *f_pusBiDirChanIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if ( fFirstExtraTsi == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, - *f_pusFirstChanExtraTsiIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if ( fSecondExtraTsi == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, - *f_pusSecondChanExtraTsiIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if ( fFirstSinCopyEvent == TRUE ) - { - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, - *f_pusFirstChanSinCopyEventIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if ( fSecondSinCopyEvent == TRUE ) - { - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, - *f_pusSecondChanSinCopyEventIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if ( ( fFirstSoutCopyEvent == TRUE ) - - ) - { - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, - *f_pusFirstChanSoutCopyEventIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - /*===============================================================================*/ - - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteChannelCreateBiDirStructs - -Description: Performs all the required structure writes to configure the - new echo cancellation channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usFirstChanIndex Pointer to the first channel index. -f_usFirstChanExtraTsiIndex Pointer to the first channel extra TSI index. -f_usFirstChanSinCopyEventIndex Pointer to the first channel Sin copy event index. -f_usFirstChanSoutCopyEventIndex Pointer to the first channel Sout copy event index. -f_usFirstChanIndex Pointer to the second channel index. -f_usSecondChanExtraTsiIndex Pointer to the second channel extra TSI index. -f_usSecondChanSinCopyEventIndex Pointer to the second channel Sin copy event index. -f_usSecondChanSoutCopyEventIndex Pointer to the second channel Sout copy event index. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteChannelCreateBiDirStructs -UINT32 Oct6100ApiWriteChannelCreateBiDirStructs( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - - IN UINT16 f_usFirstChanIndex, - IN UINT16 f_usFirstChanExtraTsiIndex, - IN UINT16 f_usFirstChanSinCopyEventIndex, - IN UINT16 f_usFirstChanSoutCopyEventIndex, - IN UINT16 f_usSecondChanIndex, - IN UINT16 f_usSecondChanExtraTsiIndex, - IN UINT16 f_usSecondChanSinCopyEventIndex, - IN UINT16 f_usSecondChanSoutCopyEventIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pFirstChanEntry; - tPOCT6100_API_CHANNEL pSecondChanEntry; - - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*==============================================================================*/ - /* Get a pointer to the two channel entry.*/ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pFirstChanEntry, f_usFirstChanIndex ); - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pSecondChanEntry, f_usSecondChanIndex ); - - - - - { - /*==============================================================================*/ - /* Configure the Tsst control memory and add the Sin copy event if necessary. */ - - /*=======================================================================*/ - /* Program the Sin Copy event.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usFirstChanSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - WriteParams.usWriteData |= f_usFirstChanExtraTsiIndex; - WriteParams.usWriteData |= pFirstChanEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( pFirstChanEntry->usSinSoutTsiMemIndex ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Configure the TSST memory.*/ - if ( pFirstChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pFirstChanEntry->usSinTsstIndex, - f_usFirstChanExtraTsiIndex, - pFirstChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Now insert the event into the event list.*/ - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - f_usFirstChanSinCopyEventIndex, - cOCT6100_EVENT_TYPE_SIN_COPY, - f_usFirstChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - } - - - - /*==============================================================================*/ - /* Configure the Tsst control memory and add the Sin copy event if necessary.*/ - - /*=======================================================================*/ - /* Program the Sin Copy event.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSecondChanSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - WriteParams.usWriteData |= f_usSecondChanExtraTsiIndex; - WriteParams.usWriteData |= pSecondChanEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( pSecondChanEntry->usSinSoutTsiMemIndex ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Configure the TSST memory.*/ - if ( pSecondChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pSecondChanEntry->usSinTsstIndex, - f_usSecondChanExtraTsiIndex, - pSecondChanEntry->TdmConfig.bySinPcmLaw ); - } - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Now insert the event into the event list.*/ - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - f_usSecondChanSinCopyEventIndex, - cOCT6100_EVENT_TYPE_SIN_COPY, - f_usSecondChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - - - /*==============================================================================*/ - /* Now, let's configure the two Sout copy events.*/ - - - /* First event.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usFirstChanSoutCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - WriteParams.usWriteData |= pFirstChanEntry->usSinSoutTsiMemIndex; - WriteParams.usWriteData |= pFirstChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pSecondChanEntry->usRinRoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - f_usFirstChanSoutCopyEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY, - f_usFirstChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - - /* Second event.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSecondChanSoutCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - WriteParams.usWriteData |= pSecondChanEntry->usSinSoutTsiMemIndex; - WriteParams.usWriteData |= pSecondChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pFirstChanEntry->usRinRoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - f_usSecondChanSoutCopyEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY, - f_usSecondChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - - /*==============================================================================*/ - /* Clear + release the silence events if they were created. */ - - if ( pFirstChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pFirstChanEntry->usRinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pFirstChanEntry->usRinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_E0; - - pFirstChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - - if ( ( pSecondChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - - ) - { - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pSecondChanEntry->usRinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pSecondChanEntry->usRinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_E0; - - pSecondChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - - /*==============================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateBiDirChannelEntry - -Description: Updates the new bidir channel and the channel used to create that channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateBiDirChannelEntry -UINT32 Oct6100ApiUpdateBiDirChannelEntry( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - OUT tPOCT6100_CHANNEL_CREATE_BIDIR f_pChannelCreateBiDir, - IN UINT16 f_usBiDirChanIndex, - IN UINT16 f_usFirstChanIndex, - IN UINT16 f_usFirstChanExtraTsiIndex, - IN UINT16 f_usFirstChanSinCopyEventIndex, - IN UINT16 f_usFirstChanSoutCopyEventIndex, - IN UINT16 f_usSecondChanIndex, - IN UINT16 f_usSecondChanExtraTsiIndex, - IN UINT16 f_usSecondChanSinCopyEventIndex, - IN UINT16 f_usSecondChanSoutCopyEventIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pFirstChanEntry; - tPOCT6100_API_CHANNEL pSecondChanEntry; - tPOCT6100_API_BIDIR_CHANNEL pBiDirChanEntry; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain a pointer to the new buffer's list entry. */ - mOCT6100_GET_BIDIR_CHANNEL_ENTRY_PNT( pSharedInfo, pBiDirChanEntry, f_usBiDirChanIndex ); - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pFirstChanEntry, f_usFirstChanIndex ); - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pSecondChanEntry, f_usSecondChanIndex ); - - /*=======================================================================*/ - /* Copy the channel's configuration and allocated resources. */ - - pFirstChanEntry->usExtraSinTsiMemIndex = f_usFirstChanExtraTsiIndex; - pFirstChanEntry->usSinCopyEventIndex = f_usFirstChanSinCopyEventIndex; - pFirstChanEntry->usSoutCopyEventIndex = f_usFirstChanSoutCopyEventIndex; - - pSecondChanEntry->usExtraSinTsiMemIndex = f_usSecondChanExtraTsiIndex; - pSecondChanEntry->usSinCopyEventIndex = f_usSecondChanSinCopyEventIndex; - pSecondChanEntry->usSoutCopyEventIndex = f_usSecondChanSoutCopyEventIndex; - - /* Save the channel info in the bidir channel.*/ - pBiDirChanEntry->usFirstChanIndex = f_usFirstChanIndex; - pBiDirChanEntry->usSecondChanIndex = f_usSecondChanIndex; - - - - /* Increment the extra TSI memory dependency count.*/ - - pFirstChanEntry->usExtraSinTsiDependencyCnt++; - pSecondChanEntry->usExtraSinTsiDependencyCnt++; - - /* Set the bidir flag in the channel structure.*/ - pFirstChanEntry->fBiDirChannel = TRUE; - pSecondChanEntry->fBiDirChannel = TRUE; - - /*=======================================================================*/ - - /* Form handle returned to user. */ - *f_pChannelCreateBiDir->pulBiDirChannelHndl = cOCT6100_HNDL_TAG_BIDIR_CHANNEL | (pBiDirChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_usBiDirChanIndex; - - /* Finally, mark the channel as open. */ - pBiDirChanEntry->fReserved = TRUE; - - /* Increment the number of channel open.*/ - f_pApiInstance->pSharedInfo->ChipStats.usNumberBiDirChannels++; - - /*=======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelDestroyBiDirSer - -Description: Closes a bidirectional channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelDestroyBiDir Pointer to a destroy bidirectionnal channel structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelDestroyBiDirSer -UINT32 Oct6100ChannelDestroyBiDirSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_DESTROY_BIDIR f_pChannelDestroyBiDir ) -{ - UINT16 usBiDirChanIndex; - UINT16 usFirstChanIndex; - UINT16 usSecondChanIndex; - - - UINT32 ulResult; - - /* Verify that all the parameters given match the state of the API. */ - ulResult = Oct6100ApiAssertDestroyBiDirChanParams( f_pApiInstance, - f_pChannelDestroyBiDir, - &usBiDirChanIndex, - - &usFirstChanIndex, - &usSecondChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the echo cancellation channel. */ - ulResult = Oct6100ApiInvalidateBiDirChannelStructs( f_pApiInstance, - - usFirstChanIndex, - usSecondChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the echo cancellation channel. */ - ulResult = Oct6100ApiReleaseBiDirChannelResources( f_pApiInstance, - usBiDirChanIndex, - - usFirstChanIndex, - usSecondChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Invalidate the handle.*/ - f_pChannelDestroyBiDir->ulBiDirChannelHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertDestroyBiDirChanParams - -Description: Validate the handle given by the user and verify the state of - the channel about to be closed. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChannelDestroyBiDir Pointer to a destroy bidirectional channel structure. -f_pusBiDirChanIndex Pointer to the bidir channel entry within the API's list. -f_pusFirstChanIndex Pointer to the first channel index part of the bidir channel. -f_pusFirstChanIndex Pointer to the second channel index part of the bidir channel. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertDestroyBiDirChanParams -UINT32 Oct6100ApiAssertDestroyBiDirChanParams( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_DESTROY_BIDIR f_pChannelDestroyBiDir, - IN OUT PUINT16 f_pusBiDirChanIndex, - - IN OUT PUINT16 f_pusFirstChanIndex, - IN OUT PUINT16 f_pusSecondChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BIDIR_CHANNEL pBiDirChanEntry; - UINT32 ulEntryOpenCnt; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check the provided handle. */ - if ( (f_pChannelDestroyBiDir->ulBiDirChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_BIDIR_CHANNEL ) - return cOCT6100_ERR_CHANNEL_BIDIR_CHANNEL_HANDLE; - - *f_pusBiDirChanIndex = (UINT16)( f_pChannelDestroyBiDir->ulBiDirChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusBiDirChanIndex >= pSharedInfo->ChipConfig.usMaxBiDirChannels ) - return cOCT6100_ERR_CHANNEL_BIDIR_CHANNEL_HANDLE; - - /*=======================================================================*/ - /* Get a pointer to the bidir channel's list entry. */ - - mOCT6100_GET_BIDIR_CHANNEL_ENTRY_PNT( pSharedInfo, pBiDirChanEntry, *f_pusBiDirChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pChannelDestroyBiDir->ulBiDirChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pBiDirChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_BIDIR_CHAN_NOT_OPEN; - if ( ulEntryOpenCnt != pBiDirChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_BIDIR_CHANNEL_HANDLE; - - /*=======================================================================*/ - - /* Return the index of the channel used to create this bidirectional channel.*/ - *f_pusFirstChanIndex = pBiDirChanEntry->usFirstChanIndex; - *f_pusSecondChanIndex = pBiDirChanEntry->usSecondChanIndex; - - - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInvalidateBiDirChannelStructs - -Description: Destroy the link between the two channels. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInvalidateBiDirChannelStructs -UINT32 Oct6100ApiInvalidateBiDirChannelStructs( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - - IN UINT16 f_usFirstChanIndex, - IN UINT16 f_usSecondChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pFirstChanEntry; - tPOCT6100_API_CHANNEL pSecondChanEntry; - - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Get pointers to the API entry of the two channel used to create the bidir channel.*/ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pFirstChanEntry, f_usFirstChanIndex ); - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pSecondChanEntry, f_usSecondChanIndex ); - - /* Clear the SIN copy event of the first channel and release the Extra TSI memory if - this feature was the only one using it. */ - - { - if ( pFirstChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - /*=======================================================================*/ - /* Clear the Sin Copy event.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pFirstChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Configure the TSST memory.*/ - if ( pFirstChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pFirstChanEntry->usSinTsstIndex, - pFirstChanEntry->usSinSoutTsiMemIndex, - pFirstChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pFirstChanEntry->usSinCopyEventIndex, - cOCT6100_EVENT_TYPE_SIN_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - } - } - - /* Clear the SIN copy event of the first channel and release the Extra TSI memory if - this feature was the only one using it. */ - if ( pSecondChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - /*=======================================================================*/ - /* Clear the Sin Copy event.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pSecondChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Configure the TSST memory.*/ - if ( pSecondChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pSecondChanEntry->usSinTsstIndex, - pSecondChanEntry->usSinSoutTsiMemIndex, - pSecondChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pSecondChanEntry->usSinCopyEventIndex, - cOCT6100_EVENT_TYPE_SIN_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - } - - /* Now remove the sout copy of the first channel.*/ - - - { - /*=======================================================================*/ - /* Clear the Sout Copy event of the first channel.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pFirstChanEntry->usSoutCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*=======================================================================*/ - - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pFirstChanEntry->usSoutCopyEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - - - /* Now remove the sout copy of the second channel.*/ - - /*=======================================================================*/ - /* Clear the Sout Copy event of the second channel.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pSecondChanEntry->usSoutCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*=======================================================================*/ - - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pSecondChanEntry->usSoutCopyEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseBiDirChannelResources - -Description: Release and clear the API entry associated to the bidirectional channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usBiDirChanIndex Index of the bidirectionnal channel in the API's bidir channel list. -f_usFirstChanIndex Index of the first channel used to create the bidir channel. -f_usSecondChanIndex Index of the second channel used to create the bidir channel. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseBiDirChannelResources -UINT32 Oct6100ApiReleaseBiDirChannelResources( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBiDirChanIndex, - - IN UINT16 f_usFirstChanIndex, - IN UINT16 f_usSecondChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BIDIR_CHANNEL pBiDirChanEntry; - tPOCT6100_API_CHANNEL pFirstChanEntry; - tPOCT6100_API_CHANNEL pSecondChanEntry; - tPOCT6100_API_MIXER_EVENT pTempEventEntry; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_BIDIR_CHANNEL_ENTRY_PNT( pSharedInfo, pBiDirChanEntry, f_usBiDirChanIndex ); - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pFirstChanEntry, f_usFirstChanIndex ); - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pSecondChanEntry, f_usSecondChanIndex ); - - /* Release the bidir entry.*/ - ulResult = Oct6100ApiReleaseBiDirChanEntry( f_pApiInstance, f_usBiDirChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_AC; - - /* Release the Extra TSI memory and the SIN copy event if required.*/ - - { - if ( pFirstChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - /* Release the two TSI chariot memory entries.*/ - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pFirstChanEntry->usExtraSinTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_A3; - - /* Relese the SIN copy event.*/ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pFirstChanEntry->usSinCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_A4; - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, pFirstChanEntry->usSinCopyEventIndex ); - - /* Invalidate the entry.*/ - pTempEventEntry->fReserved = FALSE; - pTempEventEntry->usEventType = cOCT6100_INVALID_EVENT; - pTempEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - - pFirstChanEntry->usExtraSinTsiDependencyCnt--; - pFirstChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX; - pFirstChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX; - } - else - { - pFirstChanEntry->usExtraSinTsiDependencyCnt--; - } - } - - if ( pSecondChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - /* Release the two TSI chariot memory entries.*/ - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pSecondChanEntry->usExtraSinTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_A5; - - /* Relese the SIN copy event.*/ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pSecondChanEntry->usSinCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_A6; - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, pSecondChanEntry->usSinCopyEventIndex ); - /* Invalidate the entry.*/ - pTempEventEntry->fReserved = FALSE; - pTempEventEntry->usEventType = cOCT6100_INVALID_EVENT; - pTempEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - - pSecondChanEntry->usExtraSinTsiDependencyCnt--; - pSecondChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX; - pSecondChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX; - } - else - { - pSecondChanEntry->usExtraSinTsiDependencyCnt--; - } - - - { - /* Release the SOUT copy event of the first channel.*/ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pFirstChanEntry->usSoutCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_A7; - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, pFirstChanEntry->usSoutCopyEventIndex ); - /* Invalidate the entry.*/ - pTempEventEntry->fReserved = FALSE; - pTempEventEntry->usEventType = cOCT6100_INVALID_EVENT; - pTempEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - } - - /* Release the SOUT copy event of the second channel.*/ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pSecondChanEntry->usSoutCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_A8; - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, pSecondChanEntry->usSoutCopyEventIndex ); - /* Invalidate the entry.*/ - pTempEventEntry->fReserved = FALSE; - pTempEventEntry->usEventType = cOCT6100_INVALID_EVENT; - pTempEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - - - /*=======================================================================*/ - /* Update the first channel's list entry. */ - - /* Mark the channel as closed. */ - pFirstChanEntry->usSoutCopyEventIndex = cOCT6100_INVALID_INDEX; - pFirstChanEntry->fBiDirChannel = FALSE; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Update the second channel's list entry. */ - - /* Mark the channel as closed. */ - - pSecondChanEntry->usSoutCopyEventIndex = cOCT6100_INVALID_INDEX; - pSecondChanEntry->fBiDirChannel = FALSE; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Update the bidirectional channel's list entry. */ - - /* Mark the channel as closed. */ - pBiDirChanEntry->fReserved = FALSE; - pBiDirChanEntry->byEntryOpenCnt++; - - pBiDirChanEntry->usFirstChanIndex = cOCT6100_INVALID_INDEX; - pBiDirChanEntry->usSecondChanIndex = cOCT6100_INVALID_INDEX; - - /* Decrement the number of channel open.*/ - f_pApiInstance->pSharedInfo->ChipStats.usNumberBiDirChannels--; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Check if some of the ports must be muted back. */ - - ulResult = Oct6100ApiMutePorts( f_pApiInstance, - f_usFirstChanIndex, - pFirstChanEntry->usRinTsstIndex, - pFirstChanEntry->usSinTsstIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiMutePorts( f_pApiInstance, - f_usSecondChanIndex, - pSecondChanEntry->usRinTsstIndex, - pSecondChanEntry->usSinTsstIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ApiOctFloatToDbEnergyByte -INT32 Oct6100ApiOctFloatToDbEnergyByte(UINT8 x) -{ - INT32 lResult; - - lResult = Oct6100ApiOctFloatToDbEnergyHalf( (UINT16)(x << 8) ); - return lResult; -} -#endif - -#if !SKIP_Oct6100ApiOctFloatToDbEnergyHalf -INT32 Oct6100ApiOctFloatToDbEnergyHalf(UINT16 x) -{ - INT32 y; - UINT16 m; - - y = (((x >> 8) & 0x7F) - 0x41) * 3; - - m = (UINT16)((x & 0x00E0) >> 5); - if (m < 2) y += 0; - else if (m < 5) y += 1; - else y += 2; - - return y; -} -#endif - -#if !SKIP_Oct6100ApiDbAmpHalfToOctFloat -UINT16 Oct6100ApiDbAmpHalfToOctFloat(INT32 x) -{ - INT32 db_div6; - INT32 db_mod6; - UINT16 rval; - INT32 x_unsigned; - - if(x < 0) - { - x_unsigned = -x; - } - else - { - x_unsigned = x; - } - - db_div6 = x_unsigned / 6; - db_mod6 = x_unsigned % 6; - - if(x < 0) - { - if(db_mod6 == 0) - { - /* Change nothing! */ - db_div6 = -db_div6; - } - else - { - /* When we are negative, round down, and then adjust modulo. For example, if - x is -1, then db_div6 is 0 and db_mod6 is 1. We adjust so db_div6 = -1 and - db_mod6 = 5, which gives the correct adjustment. */ - db_div6 = -db_div6-1; - db_mod6 = 6 - db_mod6; - } - } - - rval = (UINT16)(0x4100 + db_div6 * 0x100); - - if(db_mod6 == 0) - { - rval += 0x0000; - } - else if(db_mod6 == 1) - { - rval += 0x0020; - } - else if(db_mod6 == 2) - { - rval += 0x0040; - } - else if(db_mod6 == 3) - { - rval += 0x0070; - } - else if(db_mod6 == 4) - { - rval += 0x0090; - } - else /* if(db_mod6 == 5) */ - { - rval += 0x00D0; - } - - return rval; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteDebugChanMemory - -Description: This function configure a debug channel echo memory entry - in internal memory.and external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pTdmConfig Pointer to a TDM configuration structure. -f_pVqeConfig Pointer to a VQE configuration structure. -f_pChannelOpen Pointer to a channel configuration structure. -f_usChanIndex Index of the echo channel in the API instance. -f_usEchoMemIndex Index of the echo channel within the SSPX memory. -f_usRinRoutTsiIndex RIN/ROUT TSI index within the TSI chariot memory. -f_usSinSoutTsiIndex SIN/SOUT TSI index within the TSI chariot memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteDebugChanMemory -UINT32 Oct6100ApiWriteDebugChanMemory( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_TDM f_pTdmConfig, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN UINT16 f_usRinRoutTsiIndex, - IN UINT16 f_usSinSoutTsiIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult; - - /* Obtain pointer to local portion of the instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /*==============================================================================*/ - /* Write the VQE configuration of the debug channel. */ - - ulResult = Oct6100ApiWriteVqeMemory( - f_pApiInstance, - f_pVqeConfig, - f_pChannelOpen, - f_usChanIndex, - f_usEchoMemIndex, - TRUE, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - - /*==============================================================================*/ - - /* Write the echo memory configuration of the debug channel. */ - ulResult = Oct6100ApiWriteEchoMemory( - f_pApiInstance, - f_pTdmConfig, - f_pChannelOpen, - f_usEchoMemIndex, - f_usRinRoutTsiIndex, - f_usSinSoutTsiIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiDebugChannelOpen - -Description: Internal function used to open a debug channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiDebugChannelOpen -UINT32 Oct6100ApiDebugChannelOpen( - IN tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_CHANNEL_OPEN TempChanOpen; - - UINT32 ulResult; - UINT16 usChanIndex; - UINT16 usDummyEchoIndex; - - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Let's program the channel memory.*/ - Oct6100ChannelOpenDef( &TempChanOpen ); - - TempChanOpen.ulEchoOperationMode = cOCT6100_ECHO_OP_MODE_HT_RESET; /* Activate the channel in reset.*/ - TempChanOpen.VqeConfig.fEnableNlp = FALSE; - TempChanOpen.VqeConfig.ulComfortNoiseMode = cOCT6100_COMFORT_NOISE_NORMAL; - TempChanOpen.VqeConfig.fSinDcOffsetRemoval = FALSE; - TempChanOpen.VqeConfig.fRinDcOffsetRemoval = FALSE; - TempChanOpen.VqeConfig.lDefaultErlDb = 0; - - /* Loop to reserve the proper entry for the debug channel */ - for( usChanIndex = 0; usChanIndex < ( pSharedInfo->DebugInfo.usRecordChanIndex + 1 ); usChanIndex ++ ) - { - ulResult = Oct6100ApiReserveEchoEntry( f_pApiInstance, &usDummyEchoIndex ); - if( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Loop to free all entries except the one for the debug channel */ - for( usChanIndex = pSharedInfo->DebugInfo.usRecordChanIndex; usChanIndex > 0; ) - { - usChanIndex--; - ulResult = Oct6100ApiReleaseEchoEntry( f_pApiInstance, usChanIndex ); - if( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - ulResult = Oct6100ApiWriteDebugChanMemory( f_pApiInstance, - &TempChanOpen.TdmConfig, - &TempChanOpen.VqeConfig, - &TempChanOpen, - pSharedInfo->DebugInfo.usRecordChanIndex, - pSharedInfo->DebugInfo.usRecordMemIndex, - pSharedInfo->DebugInfo.usRecordRinRoutTsiMemIndex, - pSharedInfo->DebugInfo.usRecordSinSoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiMuteChannelPort - -Description: This function will verify if a input TSST is bound to the RIN and - SIN port. If not, the port will be muted. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiMutePorts -UINT32 Oct6100ApiMutePorts( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEchoIndex, - IN UINT16 f_usRinTsstIndex, - IN UINT16 f_usSinTsstIndex, - IN BOOL f_fCheckBridgeIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Obtain a pointer to the new buffer's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usEchoIndex ); - - /* Mute the Rin port. */ - if ( ( f_fCheckBridgeIndex == FALSE ) - || ( ( f_fCheckBridgeIndex == TRUE ) && ( pChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX ) ) ) - { - /* If the channel is in bidir mode, do not create the Rin silence event!!! */ - if ( pChanEntry->fBiDirChannel == FALSE ) - { - if ( ( ( f_usRinTsstIndex == cOCT6100_INVALID_INDEX ) || ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_RIN ) != 0x0 ) ) - && ( pChanEntry->usRinSilenceEventIndex == cOCT6100_INVALID_INDEX ) ) - { - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, - &pChanEntry->usRinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now, write the mixer event used to copy the RIN signal of the silence channel - into the RIN signal of the current channel. */ - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pChanEntry->usRinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - WriteParams.usWriteData |= 1534; - WriteParams.usWriteData |= cOCT6100_PCM_U_LAW << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pChanEntry->usRinRoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Now insert the Sin copy event into the list.*/ - - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - pChanEntry->usRinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY, - f_usEchoIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - - /* Mute the Sin port. */ - if ( ( ( f_usSinTsstIndex == cOCT6100_INVALID_INDEX ) || ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SIN ) != 0x0 ) ) - && ( pChanEntry->usSinSilenceEventIndex == cOCT6100_INVALID_INDEX ) ) - { - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, - &pChanEntry->usSinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now, write the mixer event used to copy the SIN signal of the silence channel - into the SIN signal of the current channel. */ - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - WriteParams.usWriteData |= 1534; - WriteParams.usWriteData |= cOCT6100_PCM_U_LAW << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pChanEntry->usSinSoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Now insert the Sin copy event into the list.*/ - - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - pChanEntry->usSinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY, - f_usEchoIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Unmute the Rin port if it was muted. */ - if ( ( ( f_usRinTsstIndex != cOCT6100_INVALID_INDEX ) && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_RIN ) == 0x0 ) ) - && ( pChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) ) - { - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pChanEntry->usRinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pChanEntry->usRinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_E1; - - pChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - - /* Unmute the Sin port if it was muted. */ - if ( ( ( f_usSinTsstIndex != cOCT6100_INVALID_INDEX ) && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SIN ) == 0x0 ) ) - && ( pChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX ) ) - { - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pChanEntry->usSinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pChanEntry->usSinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_E2; - - pChanEntry->usSinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiSetChannelLevelControl - -Description: This function will configure the level control on a given - channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pVqeConfig VQE config of the channel. -f_usChanIndex Index of the channel within the API instance. -f_usEchoMemIndex Index of the echo channel within the SSPX memory. -f_fClearAlcHlcStatusBit If this is set, the ALC-HLC status bit must be - incremented. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiSetChannelLevelControl -UINT32 Oct6100ApiSetChannelLevelControl( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN BOOL f_fClearAlcHlcStatusBit ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult; - UINT32 ulTempData; - UINT32 ulBaseAddress; - UINT32 ulFeatureBytesOffset; - UINT32 ulFeatureBitOffset; - UINT32 ulFeatureFieldLength; - UINT32 ulMask; - UINT32 i; - UINT16 usTempData; - UINT8 byLastStatus; - BOOL fDisableAlcFirst; - - /* Get local pointer to shared portion of the API instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain a pointer to the channel list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ); - - /* Before doing anything, check if the configuration has changed. */ - if ( ( f_fClearAlcHlcStatusBit == TRUE ) - || ( f_pVqeConfig->fRinLevelControl != pChanEntry->VqeConfig.fRinLevelControl ) - || ( f_pVqeConfig->lRinLevelControlGainDb != pChanEntry->VqeConfig.chRinLevelControlGainDb ) - || ( f_pVqeConfig->fRinAutomaticLevelControl != pChanEntry->VqeConfig.fRinAutomaticLevelControl ) - || ( f_pVqeConfig->lRinAutomaticLevelControlTargetDb != pChanEntry->VqeConfig.chRinAutomaticLevelControlTargetDb ) - || ( f_pVqeConfig->fRinHighLevelCompensation != pChanEntry->VqeConfig.fRinHighLevelCompensation ) - || ( f_pVqeConfig->lRinHighLevelCompensationThresholdDb != pChanEntry->VqeConfig.chRinHighLevelCompensationThresholdDb ) - || ( f_pVqeConfig->fSoutLevelControl != pChanEntry->VqeConfig.fSoutLevelControl ) - || ( f_pVqeConfig->lSoutLevelControlGainDb != pChanEntry->VqeConfig.chSoutLevelControlGainDb ) - || ( f_pVqeConfig->fSoutAutomaticLevelControl != pChanEntry->VqeConfig.fSoutAutomaticLevelControl ) - || ( f_pVqeConfig->lSoutAutomaticLevelControlTargetDb != pChanEntry->VqeConfig.chSoutAutomaticLevelControlTargetDb ) - || ( f_pVqeConfig->fSoutNaturalListenerEnhancement != pChanEntry->VqeConfig.fSoutNaturalListenerEnhancement ) - || ( f_pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb != pChanEntry->VqeConfig.bySoutAutomaticListenerEnhancementGainDb ) - || ( f_pVqeConfig->ulSoutNaturalListenerEnhancementGainDb != pChanEntry->VqeConfig.bySoutNaturalListenerEnhancementGainDb ) ) - { - /* Calculate base address for manual level control configuration. */ - ulBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_usEchoMemIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst; - - /* Set the Level control on RIN port.*/ - ulFeatureBytesOffset = pSharedInfo->MemoryMap.RinLevelControlOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.RinLevelControlOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.RinLevelControlOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if ( ( f_pVqeConfig->fRinLevelControl == TRUE ) - || ( f_pVqeConfig->fRinAutomaticLevelControl == TRUE ) - || ( f_pVqeConfig->fRinHighLevelCompensation == TRUE ) ) - { - /* Set the level control value.*/ - if ( ( f_pVqeConfig->fRinAutomaticLevelControl == TRUE ) - || ( f_pVqeConfig->fRinHighLevelCompensation == TRUE ) ) - ulTempData |= ( 0xFF << ulFeatureBitOffset ); - else - { - /* Convert the dB value into OctFloat format.*/ - usTempData = Oct6100ApiDbAmpHalfToOctFloat( f_pVqeConfig->lRinLevelControlGainDb ); - usTempData -= 0x3800; - usTempData &= 0x0FF0; - usTempData >>= 4; - - ulTempData |= ( usTempData << ulFeatureBitOffset ); - } - } - else /* ( ( f_pVqeConfig->fRinLevelControl == FALSE ) && ( f_pVqeConfig->fRinAutomaticLevelControl == FALSE ) && ( f_pVqeConfig->fRinHighLevelCompensation == FALSE ) ) */ - { - ulTempData |= ( cOCT6100_PASS_THROUGH_LEVEL_CONTROL << ulFeatureBitOffset ); - } - - /* Save the DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the Level control on SOUT port.*/ - ulFeatureBytesOffset = pSharedInfo->MemoryMap.SoutLevelControlOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.SoutLevelControlOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.SoutLevelControlOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if ( ( f_pVqeConfig->fSoutLevelControl == TRUE ) - || ( f_pVqeConfig->fSoutAutomaticLevelControl == TRUE ) - || ( f_pVqeConfig->fSoutNaturalListenerEnhancement == TRUE ) - || ( f_pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb != 0x0 ) ) - { - /* Set the level control value.*/ - if ( ( f_pVqeConfig->fSoutAutomaticLevelControl == TRUE ) - || ( f_pVqeConfig->fSoutNaturalListenerEnhancement == TRUE ) - || ( f_pVqeConfig->ulSoutAutomaticListenerEnhancementGainDb != 0x0 ) ) - ulTempData |= ( 0xFF << ulFeatureBitOffset ); - else - { - /* Convert the dB value into OctFloat format.*/ - usTempData = Oct6100ApiDbAmpHalfToOctFloat( f_pVqeConfig->lSoutLevelControlGainDb ); - usTempData -= 0x3800; - usTempData &= 0x0FF0; - usTempData >>= 4; - - ulTempData |= ( usTempData << ulFeatureBitOffset ); - } - } - else - { - ulTempData |= ( cOCT6100_PASS_THROUGH_LEVEL_CONTROL << ulFeatureBitOffset ); - } - - /* Save the DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Calculate base address for auto level control + high level compensation configuration. */ - ulBaseAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_usEchoMemIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoMemOfst; - - /* Check which one is to be disabled first. */ - if ( f_pVqeConfig->fRinAutomaticLevelControl == TRUE ) - fDisableAlcFirst = FALSE; - else - fDisableAlcFirst = TRUE; - - for ( i = 0; i < 2; i ++ ) - { - /* Set the auto level control target Db for the Rin port. */ - if ( ( ( i == 0 ) && ( fDisableAlcFirst == TRUE ) ) || ( ( i == 1 ) && ( fDisableAlcFirst == FALSE ) ) ) - { - if ( pSharedInfo->ImageInfo.fRinAutoLevelControl == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.RinAutoLevelControlTargetOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.RinAutoLevelControlTargetOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.RinAutoLevelControlTargetOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if ( f_pVqeConfig->fRinAutomaticLevelControl == TRUE ) - { - /* Convert the dB value into OctFloat format.*/ - usTempData = Oct6100ApiDbAmpHalfToOctFloat( 2 * f_pVqeConfig->lRinAutomaticLevelControlTargetDb ); - - /* Set auto level control target on the Rin port. */ - ulTempData |= ( usTempData << ulFeatureBitOffset ); - } - else /* if ( f_pVqeConfig->fRinAutomaticLevelControl == FALSE ) */ - { - /* Disable auto level control. */ - ulTempData |= ( 0xFFFF << ulFeatureBitOffset ); - } - - /* Save the DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else - { - /* Set the high level compensation threshold Db for the Rin port. */ - if ( pSharedInfo->ImageInfo.fRinHighLevelCompensation == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.RinHighLevelCompensationThresholdOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.RinHighLevelCompensationThresholdOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.RinHighLevelCompensationThresholdOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if ( f_pVqeConfig->fRinHighLevelCompensation == TRUE ) - { - /* Convert the dB value into OctFloat format.*/ - usTempData = Oct6100ApiDbAmpHalfToOctFloat( 2 * f_pVqeConfig->lRinHighLevelCompensationThresholdDb ); - - /* Set high level compensation threshold on the Rin port. */ - ulTempData |= ( usTempData << ulFeatureBitOffset ); - } - else /* if ( f_pVqeConfig->fRinHighLevelCompensation == FALSE ) */ - { - /* Disable high level compensation. */ - ulTempData |= ( 0xFFFF << ulFeatureBitOffset ); - } - - /* Save the DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - - /* Set the auto level control target Db for the Sout port. */ - if ( pSharedInfo->ImageInfo.fRinAutoLevelControl == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.SoutAutoLevelControlTargetOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.SoutAutoLevelControlTargetOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.SoutAutoLevelControlTargetOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if ( f_pVqeConfig->fSoutAutomaticLevelControl == TRUE ) - { - /* Convert the dB value into OctFloat format.*/ - usTempData = Oct6100ApiDbAmpHalfToOctFloat( 2 * f_pVqeConfig->lSoutAutomaticLevelControlTargetDb ); - - /* Set auto level control target on the Sout port. */ - ulTempData |= ( usTempData << ulFeatureBitOffset ); - } - else /* if ( f_pVqeConfig->fSoutAutomaticLevelControl == FALSE ) */ - { - /* Disable auto level control. */ - ulTempData |= ( 0xFFFF << ulFeatureBitOffset ); - } - - /* Save the DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Set the high level compensation threshold Db for the Sout port. */ - if ( pSharedInfo->ImageInfo.fSoutHighLevelCompensation == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.SoutHighLevelCompensationThresholdOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.SoutHighLevelCompensationThresholdOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.SoutHighLevelCompensationThresholdOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Disable high level compensation on Sout for now. */ - ulTempData |= ( 0xFFFF << ulFeatureBitOffset ); - - /* Save the DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Check if have to clear the ALC-HLC status. */ - if ( ( pSharedInfo->ImageInfo.fAlcHlcStatus == TRUE ) - && ( ( f_fClearAlcHlcStatusBit == TRUE ) - - ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.AlcHlcStatusOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.AlcHlcStatusOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.AlcHlcStatusOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Get previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - /* Retrieve last status. */ - byLastStatus = (UINT8)( ( ( ulTempData & ulMask ) >> ulFeatureBitOffset ) & 0xFF ); - - /* Increment to reset context. */ - byLastStatus ++; - - /* Just in case, not to overwrite some context in external memory. */ - byLastStatus &= ( 0x1 << ulFeatureFieldLength ) - 1; - - /* Clear last status. */ - ulTempData &= (~ulMask); - - /* Set new status. */ - ulTempData |= ( byLastStatus << ulFeatureBitOffset ); - - /* Save the DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiSetChannelTailConfiguration - -Description: This function will configure the tail displacement and length - on a given channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pVqeConfig VQE config of the channel. -f_usChanIndex Index of the channel within the API instance. -f_usEchoMemIndex Index of the echo channel within the SSPX memory. -f_fModifyOnly Function called from a modify or open? - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiSetChannelTailConfiguration -UINT32 Oct6100ApiSetChannelTailConfiguration( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN BOOL f_fModifyOnly ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult; - UINT32 ulTempData; - UINT32 ulNlpConfBaseAddress; - UINT32 ulAfConfBaseAddress; - UINT32 ulFeatureBytesOffset; - UINT32 ulFeatureBitOffset; - UINT32 ulFeatureFieldLength; - UINT32 ulMask; - UINT32 ulTailSum; - BOOL fTailDisplacementModified = FALSE; - - /* Get local pointer to shared portion of the API instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain a pointer to the channel list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ); - - /* Calculate base addresses of NLP + AF configuration structure for the specified channel. */ - ulNlpConfBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_usEchoMemIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst; - ulAfConfBaseAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_usEchoMemIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + pSharedInfo->MemoryMap.ulChanMainIoMemOfst; - - /* Set the tail displacement.*/ - if ( pSharedInfo->ImageInfo.fTailDisplacement == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( ( f_pVqeConfig->fEnableTailDisplacement != pChanEntry->VqeConfig.fEnableTailDisplacement ) - || ( f_pVqeConfig->ulTailDisplacement != pChanEntry->VqeConfig.usTailDisplacement ) - || ( f_pVqeConfig->fAcousticEcho != pChanEntry->VqeConfig.fAcousticEcho ) ) ) ) - { - /* Remember that the tail displacement parameters were changed. */ - fTailDisplacementModified = TRUE; - - /* Check if we must set the tail displacement value. */ - if ( ( f_pVqeConfig->fEnableTailDisplacement == TRUE ) - && ( pSharedInfo->ImageInfo.fPerChannelTailDisplacement == TRUE ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.PerChanTailDisplacementFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.PerChanTailDisplacementFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.PerChanTailDisplacementFieldOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - if ( ( f_pVqeConfig->fEnableTailDisplacement == TRUE ) - && ( f_pVqeConfig->ulTailDisplacement != 0x0 ) ) - { - if ( pSharedInfo->ImageInfo.fAfTailDisplacement == FALSE ) - { - if ( f_pVqeConfig->ulTailDisplacement == cOCT6100_AUTO_SELECT_TAIL ) - { - ulTempData |= ( ( ( pSharedInfo->ChipConfig.usTailDisplacement / 16 ) ) << ulFeatureBitOffset ); - } - else - { - ulTempData |= ( ( ( f_pVqeConfig->ulTailDisplacement / 16 ) ) << ulFeatureBitOffset ); - } - } - else /* if ( pSharedInfo->ImageInfo.fAfTailDisplacement == TRUE ) */ - { - /* If AEC is not activated, this must be set to the requested tail displacement. */ - if ( f_pVqeConfig->fAcousticEcho == FALSE ) - { - if ( f_pVqeConfig->ulTailDisplacement == cOCT6100_AUTO_SELECT_TAIL ) - { - ulTailSum = pSharedInfo->ChipConfig.usTailDisplacement; - } - else - { - ulTailSum = f_pVqeConfig->ulTailDisplacement; - } - - if ( ulTailSum == 0 ) - { - ulTempData |= ( ( 0 ) << ulFeatureBitOffset ); - } - else if ( ulTailSum <= 128 ) - { - ulTempData |= ( ( 1 ) << ulFeatureBitOffset ); - } - else if ( ulTailSum <= 384 ) - { - ulTempData |= ( ( 3 ) << ulFeatureBitOffset ); - } - else /* if ( ulTailSum <= 896 ) */ - { - ulTempData |= ( ( 7 ) << ulFeatureBitOffset ); - } - } - else /* if ( f_pVqeConfig->fAcousticEcho == FALSE ) */ - { - /* Otherwise, the tail displacement is configured differently. This field stays to 0. */ - ulTempData |= ( 0x0 << ulFeatureBitOffset ); - } - } - } - - /* Then save the new DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - if ( pSharedInfo->ImageInfo.fAfTailDisplacement == TRUE ) - { - /* Set the tail displacement offset in the AF. */ - ulFeatureBytesOffset = pSharedInfo->MemoryMap.AfTailDisplacementFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.AfTailDisplacementFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.AfTailDisplacementFieldOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulAfConfBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - if ( f_pVqeConfig->ulTailDisplacement == cOCT6100_AUTO_SELECT_TAIL ) - { - ulTempData |= ( ( ( pSharedInfo->ChipConfig.usTailDisplacement / 16 ) ) << ulFeatureBitOffset ); - } - else - { - ulTempData |= ( ( ( f_pVqeConfig->ulTailDisplacement / 16 ) ) << ulFeatureBitOffset ); - } - - /* Then save the DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulAfConfBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - ulFeatureBytesOffset = pSharedInfo->MemoryMap.TailDisplEnableOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.TailDisplEnableOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.TailDisplEnableOfst.byFieldSize; - - /* First read the DWORD where the field is located.*/ - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - ulTempData |= ( ( (UINT32)f_pVqeConfig->fEnableTailDisplacement ) << ulFeatureBitOffset ); - - /* Then save the DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the tail length. */ - if ( pSharedInfo->ImageInfo.fPerChannelTailLength == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( ( f_fModifyOnly == TRUE ) - && ( f_pVqeConfig->ulTailLength != pChanEntry->VqeConfig.usTailLength ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.PerChanTailLengthFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.PerChanTailLengthFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.PerChanTailLengthFieldOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulAfConfBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - /* Check if must automatically select maximum or if must use user specific value. */ - if ( f_pVqeConfig->ulTailLength == cOCT6100_AUTO_SELECT_TAIL ) - { - ulTempData |= ( ( ( pSharedInfo->ImageInfo.usMaxTailLength - 32 ) / 4 ) << ulFeatureBitOffset ); - } - else - { - ulTempData |= ( ( ( f_pVqeConfig->ulTailLength - 32 ) / 4 ) << ulFeatureBitOffset ); - } - - /* Then save the DWORD where the field is located.*/ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulAfConfBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Configure AEC tail length. */ - if ( pSharedInfo->ImageInfo.fAecTailLength == TRUE ) - { - /* Check if the configuration has been changed. */ - if ( ( f_fModifyOnly == FALSE ) - || ( fTailDisplacementModified == TRUE ) - || ( ( f_fModifyOnly == TRUE ) - && ( ( f_pVqeConfig->ulAecTailLength != pChanEntry->VqeConfig.usAecTailLength ) - || ( f_pVqeConfig->fAcousticEcho != pChanEntry->VqeConfig.fAcousticEcho ) ) ) ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.AecTailLengthFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.AecTailLengthFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.AecTailLengthFieldOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set acoustic echo tail length. */ - if ( f_pVqeConfig->fAcousticEcho == TRUE ) - { - switch( f_pVqeConfig->ulAecTailLength ) - { - case 1024: - ulTempData |= ( ( 3 ) << ulFeatureBitOffset ); - break; - case 512: - ulTempData |= ( ( 2 ) << ulFeatureBitOffset ); - break; - case 256: - ulTempData |= ( ( 1 ) << ulFeatureBitOffset ); - break; - case 128: - default: - ulTempData |= ( ( 0 ) << ulFeatureBitOffset ); - break; - } - } - else if ( f_pVqeConfig->fEnableTailDisplacement == TRUE ) - { - /* No acoustic echo case. */ - - /* Start with requested tail displacement. */ - if ( f_pVqeConfig->ulTailDisplacement == cOCT6100_AUTO_SELECT_TAIL ) - { - ulTailSum = pSharedInfo->ChipConfig.usTailDisplacement; - } - else - { - ulTailSum = f_pVqeConfig->ulTailDisplacement; - } - - /* Add requested tail length. */ - if ( f_pVqeConfig->ulTailLength == cOCT6100_AUTO_SELECT_TAIL ) - { - ulTailSum += pSharedInfo->ImageInfo.usMaxTailLength; - } - else - { - ulTailSum += f_pVqeConfig->ulTailLength; - } - - /* Round this value up. */ - if ( ulTailSum <= 128 ) - { - ulTempData |= ( ( 0 ) << ulFeatureBitOffset ); - } - else if ( ulTailSum <= 256 ) - { - ulTempData |= ( ( 1 ) << ulFeatureBitOffset ); - } - else if ( ulTailSum <= 512 ) - { - ulTempData |= ( ( 2 ) << ulFeatureBitOffset ); - } - else /* if ( ulTailSum <= 1024 ) */ - { - ulTempData |= ( ( 3 ) << ulFeatureBitOffset ); - } - } - else - { - /* Keep this to zero. */ - ulTempData |= ( ( 0 ) << ulFeatureBitOffset ); - } - - /* Write the new DWORD where the field is located. */ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulNlpConfBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelMuteSer - -Description: This function will mute some of the ports on a given - channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pChannelMute What channel/ports to mute. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelMuteSer -UINT32 Oct6100ChannelMuteSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MUTE f_pChannelMute ) -{ - UINT32 ulResult; - UINT16 usChanIndex; - UINT16 usPortMask; - - /* Verify that all the parameters given match the state of the API. */ - ulResult = Oct6100ApiAssertChannelMuteParams( f_pApiInstance, - f_pChannelMute, - &usChanIndex, - &usPortMask ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Call the actual channel mute ports function. */ - ulResult = Oct6100ApiMuteChannelPorts( f_pApiInstance, - usChanIndex, - usPortMask, - TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertChannelMuteParams - -Description: Check the user parameters passed to the channel mute function. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pChannelMute What channel/ports to mute. -f_pusChanIndex Resulting channel index where the muting should - be applied. -f_pusPorts Port mask on which to apply the muting. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertChannelMuteParams -UINT32 Oct6100ApiAssertChannelMuteParams( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MUTE f_pChannelMute, - OUT PUINT16 f_pusChanIndex, - OUT PUINT16 f_pusPorts ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry; - UINT32 ulEntryOpenCnt; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check the provided handle. */ - if ( (f_pChannelMute->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - *f_pusChanIndex = (UINT16)( f_pChannelMute->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChanIndex >= pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, *f_pusChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pChannelMute->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - if ( pChanEntry->fBiDirChannel == TRUE ) - return cOCT6100_ERR_CHANNEL_PART_OF_BIDIR_CHANNEL; - - /*=======================================================================*/ - - /* Check the provided port mask. */ - - if ( ( f_pChannelMute->ulPortMask & - ~( cOCT6100_CHANNEL_MUTE_PORT_NONE | - cOCT6100_CHANNEL_MUTE_PORT_RIN | - cOCT6100_CHANNEL_MUTE_PORT_ROUT | - cOCT6100_CHANNEL_MUTE_PORT_SIN | - cOCT6100_CHANNEL_MUTE_PORT_SOUT | - cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) ) != 0 ) - return cOCT6100_ERR_CHANNEL_MUTE_MASK; - - /* Sin + Sin with features cannot be muted simultaneously. */ - if ( ( ( f_pChannelMute->ulPortMask & cOCT6100_CHANNEL_MUTE_PORT_SIN ) != 0x0 ) - && ( ( f_pChannelMute->ulPortMask & cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) != 0x0 ) ) - return cOCT6100_ERR_CHANNEL_MUTE_MASK_SIN; - - /* Check if Sin mute with features is supported by the firmware. */ - if ( ( ( f_pChannelMute->ulPortMask & cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) != 0x0 ) - && ( pSharedInfo->ImageInfo.fSinMute == FALSE ) ) - return cOCT6100_ERR_NOT_SUPPORTED_CHANNEL_SIN_MUTE_FEATURES; - - /* Return the ports to the calling function. */ - *f_pusPorts = (UINT16)( f_pChannelMute->ulPortMask & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChannelUnMuteSer - -Description: This function will unmute some of the ports on a given - channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pChannelUnMute What channel/ports to unmute. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChannelUnMuteSer -UINT32 Oct6100ChannelUnMuteSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_UNMUTE f_pChannelUnMute ) -{ - UINT32 ulResult; - UINT16 usChanIndex; - UINT16 usPortMask; - - /* Verify that all the parameters given match the state of the API. */ - ulResult = Oct6100ApiAssertChannelUnMuteParams( f_pApiInstance, - f_pChannelUnMute, - &usChanIndex, - &usPortMask ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Call the actual channel mute ports function. */ - ulResult = Oct6100ApiMuteChannelPorts( f_pApiInstance, - usChanIndex, - usPortMask, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertChannelUnMuteParams - -Description: Check the user parameters passed to the channel unmute function. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pChannelUnMute What channel/ports to Unmute. -f_pusChanIndex Resulting channel index where the muting should - be applied. -f_pusPorts Port mask on which to apply the muting. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertChannelUnMuteParams -UINT32 Oct6100ApiAssertChannelUnMuteParams( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_UNMUTE f_pChannelUnMute, - OUT PUINT16 f_pusChanIndex, - OUT PUINT16 f_pusPorts ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry; - UINT32 ulEntryOpenCnt; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check the provided handle. */ - if ( (f_pChannelUnMute->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - *f_pusChanIndex = (UINT16)( f_pChannelUnMute->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChanIndex >= pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, *f_pusChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pChannelUnMute->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - if ( pChanEntry->fBiDirChannel == TRUE ) - return cOCT6100_ERR_CHANNEL_PART_OF_BIDIR_CHANNEL; - - /*=======================================================================*/ - - /* Check the provided port mask. */ - - if ( ( f_pChannelUnMute->ulPortMask & - ~( cOCT6100_CHANNEL_MUTE_PORT_NONE | - cOCT6100_CHANNEL_MUTE_PORT_RIN | - cOCT6100_CHANNEL_MUTE_PORT_ROUT | - cOCT6100_CHANNEL_MUTE_PORT_SIN | - cOCT6100_CHANNEL_MUTE_PORT_SOUT | - cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) ) != 0 ) - return cOCT6100_ERR_CHANNEL_MUTE_MASK; - - /* Return the ports to the calling function. */ - *f_pusPorts = (UINT16)( f_pChannelUnMute->ulPortMask & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiMuteSinWithFeatures - -Description: Mute or Unmute the sin with features port. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_usChanIndex Resulting channel index where the muting should - be applied. -f_fEnableSinWithFeatures Whether to enable the feature or not. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiMuteSinWithFeatures -UINT32 Oct6100ApiMuteSinWithFeatures( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChanIndex, - IN BOOL f_fEnableSinWithFeatures ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - UINT32 ulTempData; - UINT32 ulBaseAddress; - UINT32 ulFeatureBytesOffset; - UINT32 ulFeatureBitOffset; - UINT32 ulFeatureFieldLength; - UINT32 ulMask; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ) - - ulBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( pChanEntry->usEchoMemIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst; - - if ( pSharedInfo->ImageInfo.fSinMute == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.SinMuteOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.SinMuteOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.SinMuteOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - /* Clear the mute flag. */ - ulTempData &= (~ulMask); - - /* Set the mute flag on the Sin port.*/ - if ( f_fEnableSinWithFeatures == TRUE ) - ulTempData |= ( 0x1 << ulFeatureBitOffset ); - - /* Write the new DWORD where the field is located. */ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiMuteChannelPorts - -Description: Mute or Unmute the specified ports, according to the mask. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_usChanIndex Resulting channel index where the muting should - be applied. -f_usPortMask Port mask on which to apply the muting/unmuting. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiMuteChannelPorts -UINT32 Oct6100ApiMuteChannelPorts( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChanIndex, - IN UINT16 f_usPortMask, - IN BOOL f_fMute ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - BOOL fDisableSinWithFeatures = FALSE; - BOOL fEnableSinWithFeatures = FALSE; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ) - - /* Rin port. */ - if ( ( f_fMute == TRUE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_RIN ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_RIN ) == 0x0 ) ) - { - /* Mute this port. */ - pChanEntry->usMutedPorts |= cOCT6100_CHANNEL_MUTE_PORT_RIN; - - ulResult = Oct6100ApiMutePorts( f_pApiInstance, f_usChanIndex, pChanEntry->usRinTsstIndex, pChanEntry->usSinTsstIndex, TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - { - pChanEntry->usMutedPorts &= ~cOCT6100_CHANNEL_MUTE_PORT_RIN; - return ulResult; - } - } - else if ( ( f_fMute == FALSE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_RIN ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_RIN ) != 0x0 ) ) - { - /* Unmute this port. */ - pChanEntry->usMutedPorts &= ~cOCT6100_CHANNEL_MUTE_PORT_RIN; - - ulResult = Oct6100ApiMutePorts( f_pApiInstance, f_usChanIndex, pChanEntry->usRinTsstIndex, pChanEntry->usSinTsstIndex, TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Rout port. */ - if ( ( f_fMute == TRUE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_ROUT ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_ROUT ) == 0x0 ) ) - { - /* Mute this port. */ - - if ( pChanEntry->usRoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - pChanEntry->usRoutTsstIndex, - pChanEntry->CodecConfig.byAdpcmNibblePosition, - pChanEntry->TdmConfig.byRoutNumTssts, - 1534 ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - pChanEntry->usMutedPorts |= cOCT6100_CHANNEL_MUTE_PORT_ROUT; - } - else if ( ( f_fMute == FALSE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_ROUT ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_ROUT ) != 0x0 ) ) - { - /* Unmute this port. */ - - if ( pChanEntry->usRoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - pChanEntry->usRoutTsstIndex, - pChanEntry->CodecConfig.byAdpcmNibblePosition, - pChanEntry->TdmConfig.byRoutNumTssts, - pChanEntry->usRinRoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - pChanEntry->usMutedPorts &= ~cOCT6100_CHANNEL_MUTE_PORT_ROUT; - } - - /* Sin port. */ - if ( ( f_fMute == TRUE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_SIN ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SIN ) == 0x0 ) ) - { - /* Mute this port. */ - pChanEntry->usMutedPorts |= cOCT6100_CHANNEL_MUTE_PORT_SIN; - - ulResult = Oct6100ApiMutePorts( f_pApiInstance, f_usChanIndex, pChanEntry->usRinTsstIndex, pChanEntry->usSinTsstIndex, TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - { - pChanEntry->usMutedPorts &= ~cOCT6100_CHANNEL_MUTE_PORT_SIN; - return ulResult; - } - } - else if ( - ( ( f_fMute == FALSE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_SIN ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SIN ) != 0x0 ) ) - || - ( ( f_fMute == TRUE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SIN ) != 0x0 ) ) ) - { - /* Unmute this port. */ - pChanEntry->usMutedPorts &= ~cOCT6100_CHANNEL_MUTE_PORT_SIN; - - ulResult = Oct6100ApiMutePorts( f_pApiInstance, f_usChanIndex, pChanEntry->usRinTsstIndex, pChanEntry->usSinTsstIndex, TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Sout port. */ - if ( ( f_fMute == TRUE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_SOUT ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SOUT ) == 0x0 ) ) - { - /* Mute this port. */ - - if ( pChanEntry->usSoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - pChanEntry->usSoutTsstIndex, - pChanEntry->CodecConfig.byAdpcmNibblePosition, - pChanEntry->TdmConfig.bySoutNumTssts, - 1534 ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - pChanEntry->usMutedPorts |= cOCT6100_CHANNEL_MUTE_PORT_SOUT; - } - else if ( ( f_fMute == FALSE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_SOUT ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SOUT ) != 0x0 ) ) - { - /* Unmute this port. */ - - if ( pChanEntry->usSoutTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - pChanEntry->usSoutTsstIndex, - pChanEntry->CodecConfig.byAdpcmNibblePosition, - pChanEntry->TdmConfig.bySoutNumTssts, - pChanEntry->usSinSoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - pChanEntry->usMutedPorts &= ~cOCT6100_CHANNEL_MUTE_PORT_SOUT; - } - - /* Sin with features port. */ - if ( ( f_fMute == TRUE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) == 0x0 ) ) - { - /* Mute this port. */ - pChanEntry->usMutedPorts |= cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES; - fEnableSinWithFeatures = TRUE; - } - else if ( - ( ( f_fMute == FALSE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) != 0x0 ) ) - || - ( ( f_fMute == TRUE ) - && ( ( f_usPortMask & cOCT6100_CHANNEL_MUTE_PORT_SIN ) != 0x0 ) - && ( ( pChanEntry->usMutedPorts & cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES ) != 0x0 ) ) ) - { - /* Unmute this port. */ - pChanEntry->usMutedPorts &= ~cOCT6100_CHANNEL_MUTE_PORT_SIN_WITH_FEATURES; - - fDisableSinWithFeatures = TRUE; - } - - /* Check if must enable or disable SIN mute with features. */ - if ( fDisableSinWithFeatures == TRUE || fEnableSinWithFeatures == TRUE ) - { - ulResult = Oct6100ApiMuteSinWithFeatures( f_pApiInstance, f_usChanIndex, fEnableSinWithFeatures ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c deleted file mode 100644 index 819ac84..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c +++ /dev/null @@ -1,6917 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_chip_open.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains the functions used to power-up the chip according to the - user's configuration. Also, the API instance is initialized to reflect the - desired configuration. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 347 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#if defined(__FreeBSD__) -#include <sys/types.h> -#include <dahdi/compat/bsd.h> -#else -#ifndef __KERNEL__ -#include <stdlib.h> -#define kmalloc(size, type) malloc(size) -#define kfree(ptr) free(ptr) -#define GFP_ATOMIC 0 /*Dummy */ -#else -#include <linux/slab.h> -#include <linux/kernel.h> -#endif -#endif - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" - -#include "apilib/octapi_bt0.h" -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_apiud.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_tsi_cnct_inst.h" -#include "oct6100api/oct6100_events_inst.h" -#include "oct6100api/oct6100_conf_bridge_inst.h" -#include "oct6100api/oct6100_playout_buf_inst.h" - -#include "oct6100api/oct6100_mixer_inst.h" -#include "oct6100api/oct6100_channel_inst.h" -#include "oct6100api/oct6100_adpcm_chan_inst.h" -#include "oct6100api/oct6100_phasing_tsst_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_api_inst.h" - -#include "oct6100api/oct6100_chip_stats_pub.h" -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_tsi_cnct_pub.h" -#include "oct6100api/oct6100_events_pub.h" -#include "oct6100api/oct6100_conf_bridge_pub.h" -#include "oct6100api/oct6100_playout_buf_pub.h" - -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_adpcm_chan_pub.h" -#include "oct6100api/oct6100_phasing_tsst_pub.h" -#include "oct6100api/oct6100_remote_debug_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_mixer_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_debug_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_interrupts_priv.h" -#include "oct6100_chip_stats_priv.h" -#include "octrpc/rpc_protocol.h" -#include "oct6100_remote_debug_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_memory_priv.h" -#include "oct6100_tsst_priv.h" -#include "oct6100_tsi_cnct_priv.h" -#include "oct6100_mixer_priv.h" -#include "oct6100_events_priv.h" -#include "oct6100_conf_bridge_priv.h" -#include "oct6100_playout_buf_priv.h" - -#include "oct6100_channel_priv.h" -#include "oct6100_adpcm_chan_priv.h" -#include "oct6100_phasing_tsst_priv.h" -#include "oct6100_tlv_priv.h" -#include "oct6100_debug_priv.h" -#include "oct6100_version.h" - - -/**************************** PUBLIC FUNCTIONS *****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100GetInstanceSizeDef - -Description: Retrieves the size of the required API instance structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pGetSize Structure containing API instance size. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100GetInstanceSizeDef -UINT32 Oct6100GetInstanceSizeDef( - tPOCT6100_GET_INSTANCE_SIZE f_pGetSize ) -{ - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100GetInstanceSize -UINT32 Oct6100GetInstanceSize( - tPOCT6100_CHIP_OPEN f_pChipOpen, - tPOCT6100_GET_INSTANCE_SIZE f_pGetSize ) -{ - tOCT6100_API_INSTANCE_SIZES InstanceSizes; - UINT32 ulResult; - - /* Check user configuration for errors and conflicts. */ - ulResult = Oct6100ApiCheckChipConfiguration( f_pChipOpen ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Calculate the instance size required for user's configuration. */ - ulResult = Oct6100ApiCalculateInstanceSizes( f_pChipOpen, &InstanceSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Return required size to user. */ - f_pGetSize->ulApiInstanceSize = InstanceSizes.ulApiInstTotal; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChipOpenDef - -Description: Inserts default chip configuration parameters into the - structure pointed to by f_pChipOpen. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_pChipOpen Structure containing user chip configuration. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChipOpenDef -UINT32 Oct6100ChipOpenDef( - tPOCT6100_CHIP_OPEN f_pChipOpen ) -{ - UINT32 i; - - f_pChipOpen->ulUserChipId = 0; - f_pChipOpen->fMultiProcessSystem = FALSE; - f_pChipOpen->pProcessContext = NULL; - - f_pChipOpen->ulMaxRwAccesses = 8; - - f_pChipOpen->pbyImageFile = NULL; - f_pChipOpen->ulImageSize = 0; - - f_pChipOpen->ulMemClkFreq = 133000000; /* 133 Mhz */ - f_pChipOpen->ulUpclkFreq = cOCT6100_UPCLK_FREQ_33_33_MHZ; /* 33.33 Mhz */ - f_pChipOpen->fEnableMemClkOut = TRUE; - - f_pChipOpen->ulMemoryType = cOCT6100_MEM_TYPE_DDR; - f_pChipOpen->ulNumMemoryChips = 1; - f_pChipOpen->ulMemoryChipSize = cOCT6100_MEMORY_CHIP_SIZE_64MB; - - /* Set the tail displacement to zero. */ - f_pChipOpen->ulTailDisplacement = 0; - - /* Disable acoustic echo by default. */ - f_pChipOpen->fEnableAcousticEcho = FALSE; - - /* Resource allocation parameters. */ - f_pChipOpen->ulMaxChannels = 256; - f_pChipOpen->ulMaxTsiCncts = 0; - f_pChipOpen->ulMaxBiDirChannels = 0; - f_pChipOpen->ulMaxConfBridges = 0; - f_pChipOpen->ulMaxFlexibleConfParticipants = 0; - f_pChipOpen->ulMaxPlayoutBuffers = 0; - - f_pChipOpen->ulMaxPhasingTssts = 0; - f_pChipOpen->ulMaxAdpcmChannels = 0; - f_pChipOpen->ulMaxTdmStreams = 32; - f_pChipOpen->fUseSynchTimestamp = FALSE; - for ( i = 0; i < 4; i++ ) - { - f_pChipOpen->aulTimestampTimeslots[ i ] = cOCT6100_INVALID_TIMESLOT; - f_pChipOpen->aulTimestampStreams[ i ] = cOCT6100_INVALID_STREAM; - } - f_pChipOpen->fEnableFastH100Mode = FALSE; - - /* Configure the soft tone event buffer. */ - f_pChipOpen->ulSoftToneEventsBufSize = 128; - f_pChipOpen->fEnableExtToneDetection = FALSE; - f_pChipOpen->fEnable2100StopEvent = FALSE; - - /* Configure the soft playout event buffer. */ - f_pChipOpen->ulSoftBufferPlayoutEventsBufSize = cOCT6100_INVALID_VALUE; - - /* Interrupt configuration. */ - f_pChipOpen->ulInterruptPolarity = cOCT6100_ACTIVE_LOW_POLARITY; - - f_pChipOpen->InterruptConfig.ulErrorMemoryConfig = cOCT6100_INTERRUPT_NO_TIMEOUT; - f_pChipOpen->InterruptConfig.ulFatalGeneralConfig = cOCT6100_INTERRUPT_NO_TIMEOUT; - f_pChipOpen->InterruptConfig.ulFatalMemoryConfig = cOCT6100_INTERRUPT_NO_TIMEOUT; - f_pChipOpen->InterruptConfig.ulFatalMemoryConfig = cOCT6100_INTERRUPT_NO_TIMEOUT; - f_pChipOpen->InterruptConfig.ulErrorH100Config = cOCT6100_INTERRUPT_NO_TIMEOUT; - f_pChipOpen->InterruptConfig.ulErrorOverflowToneEventsConfig = cOCT6100_INTERRUPT_NO_TIMEOUT; - - f_pChipOpen->InterruptConfig.ulErrorMemoryTimeout = 100; - f_pChipOpen->InterruptConfig.ulFatalMemoryTimeout = 100; - f_pChipOpen->InterruptConfig.ulErrorH100Timeout = 100; - f_pChipOpen->InterruptConfig.ulErrorOverflowToneEventsTimeout = 100; - f_pChipOpen->ulMaxRemoteDebugSessions = 0; - f_pChipOpen->ulTdmSampling = cOCT6100_TDM_SAMPLE_AT_3_QUARTERS; - for ( i = 0; i < cOCT6100_TDM_STREAM_MAX_GROUPS; i++ ) - f_pChipOpen->aulTdmStreamFreqs[ i ] = cOCT6100_TDM_STREAM_FREQ_8MHZ; - - - - f_pChipOpen->fEnableChannelRecording = FALSE; - f_pChipOpen->fEnableProductionBist = FALSE; - f_pChipOpen->ulProductionBistMode = cOCT6100_PRODUCTION_BIST_STANDARD; - f_pChipOpen->ulNumProductionBistLoops = 1; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChipOpen - -Description: Configures the chip according to the user specified - configuration f_pChipOpen. This function will perform all I/O - accesses necessary and initialize the API instance to reflect - the configuration. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChipOpen Structure containing user chip configuration. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChipOpen -UINT32 Oct6100ChipOpen( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CHIP_OPEN f_pChipOpen ) -{ - tOCT6100_API_INSTANCE_SIZES *InstanceSizes; - UINT32 ulStructSize; - UINT32 ulResult; - UINT32 ulTempVar; - - /* Check user chip configuration parameters for errors. */ - ulResult = Oct6100ApiCheckChipConfiguration( f_pChipOpen ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the host system is multi-process or not and adjust instance accordingly. */ - if ( f_pChipOpen->fMultiProcessSystem != TRUE ) - { - /* Set pointer to tOCT6100_SHARED_INFO structure within instance. */ - ulStructSize = sizeof( tOCT6100_INSTANCE_API ); - mOCT6100_ROUND_MEMORY_SIZE( ulStructSize, ulTempVar ) - - f_pApiInstance->pSharedInfo = ( tPOCT6100_SHARED_INFO )(( PUINT8 )f_pApiInstance + ulStructSize); - - /* Save the process context specified by the user. */ - f_pApiInstance->pProcessContext = f_pChipOpen->pProcessContext; - - /* Create serialization object handles. */ - ulResult = Oct6100ApiCreateSerializeObjects( f_pApiInstance, f_pChipOpen->ulUserChipId ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Copy the configuration structure. */ - ulResult = Oct6100ApiCopyChipConfiguration( f_pApiInstance, f_pChipOpen ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Perform various calculations based on user chip configuration. */ - ulResult = Oct6100ApiInitializeMiscellaneousVariables( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - InstanceSizes = kmalloc(sizeof(tOCT6100_API_INSTANCE_SIZES), GFP_ATOMIC); - if (!InstanceSizes) - return cOCT6100_ERR_FATAL_0; - - /* Calculate the amount of memory needed for the API instance structure. */ - ulResult = Oct6100ApiCalculateInstanceSizes( f_pChipOpen, InstanceSizes ); - if ( ulResult != cOCT6100_ERR_OK ) { - kfree(InstanceSizes); - return ulResult; - } - - /* Allocate the memory for the API instance structure internal pointers. */ - ulResult = Oct6100ApiAllocateInstanceMemory( f_pApiInstance, InstanceSizes ); - kfree(InstanceSizes); - - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Initialize the allocated instance structure memory. */ - ulResult = Oct6100ApiInitializeInstanceMemory( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Initialize the tone information structure. */ - ulResult = Oct6100ApiInitToneInfo( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Test the CPU registers. */ - ulResult = Oct6100ApiCpuRegisterBist( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Boot the FC2 PLL. */ - ulResult = Oct6100ApiBootFc2Pll( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Program the FC1 PLL. */ - ulResult = Oct6100ApiProgramFc1Pll( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Decode the key and bist internal memories. */ - ulResult = Oct6100ApiDecodeKeyAndBist( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Boot the FC1 PLL. */ - ulResult = Oct6100ApiBootFc1Pll( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Boot the SDRAM. */ - ulResult = Oct6100ApiBootSdram( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Bist the external memory. */ - ulResult = Oct6100ApiExternalMemoryBist( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Initialize the external memory. */ - ulResult = Oct6100ApiExternalMemoryInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Load the image into the chip. */ - ulResult = Oct6100ApiLoadImage( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write the clock distribution registers. */ - ulResult = Oct6100ApiEnableClocks( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Program the NLP processor. */ - ulResult = Oct6100ApiProgramNLP( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_OPEN_EGO_TIMEOUT ) - ulResult = Oct6100ApiProgramNLP( f_pApiInstance ); - } - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( f_pChipOpen->fEnableProductionBist == FALSE ) - { - /* Read all TLV fields present in external memory. */ - ulResult = Oct6100ApiProcessTlvRegion( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Configure the H.100 interface. */ - ulResult = Oct6100ApiSetH100Register( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Write miscellaneous registers. */ - ulResult = Oct6100ApiWriteMiscellaneousRegisters( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Proceed with the rest only if the production BIST has not been requested. */ - if ( f_pChipOpen->fEnableProductionBist == FALSE ) - { - /* Initialize the errors counters. */ - ulResult = Oct6100ApiChipStatsSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Get revision number of chip. */ - ulResult = Oct6100ApiGetChipRevisionNum( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - - - - - /* Initialize the channels. */ - ulResult = Oct6100ApiInitChannels( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Initialize the mixer memory. */ - ulResult = Oct6100ApiInitMixer( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Initialize the mixer memory. */ - ulResult = Oct6100ApiInitRecordResources( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Initialize free external memory for buffer playout. */ - ulResult = Oct6100ApiBufferPlayoutMemorySwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - - - - /*Clear all interrupts that could have occured during startup*/ - ulResult = Oct6100ApiClearInterrupts( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Configure the interrupt registers. */ - ulResult = Oct6100ApiIsrHwInit( f_pApiInstance, &f_pChipOpen->InterruptConfig ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChipCloseDef - -Description: Puts the chip into soft reset. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChipClose Pointer to a tOCT6100_CHIP_CLOSE structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChipCloseDef -UINT32 Oct6100ChipCloseDef( - tPOCT6100_CHIP_CLOSE f_pChipClose ) -{ - f_pChipClose->ulDummyVariable = 0; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ChipClose -UINT32 Oct6100ChipClose( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CHIP_CLOSE f_pChipClose ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - WriteParams.ulWriteAddress = 0x100; - WriteParams.usWriteData = 0x0000; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Destroy the allocated ressources used for serialization. */ - ulResult = Oct6100ApiDestroySerializeObjects( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100CreateLocalInstance - -Description: Creates a local instance for a process in a multi-process - host system. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pCreateLocal Structure used to create process' local instance. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100CreateLocalInstanceDef -UINT32 Oct6100CreateLocalInstanceDef( - tPOCT6100_CREATE_LOCAL_INSTANCE f_pCreateLocal ) -{ - f_pCreateLocal->pApiInstShared = NULL; - f_pCreateLocal->pApiInstLocal = NULL; - f_pCreateLocal->pProcessContext = NULL; - f_pCreateLocal->ulUserChipId = 0; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100CreateLocalInstance -UINT32 Oct6100CreateLocalInstance( - tPOCT6100_CREATE_LOCAL_INSTANCE f_pCreateLocal ) -{ - tPOCT6100_INSTANCE_API pApiInstLocal; - UINT32 ulApiInstSize; - UINT32 ulTempVar; - UINT32 ulResult; - - /* Check user's structure for errors. */ - if ( f_pCreateLocal->pApiInstShared == NULL ) - return cOCT6100_ERR_MULTIPROC_API_INST_SHARED; - - if ( f_pCreateLocal->pApiInstLocal == NULL ) - return cOCT6100_ERR_MULTIPROC_API_INST_LOCAL; - - /* Get local pointer to local instance. */ - pApiInstLocal = f_pCreateLocal->pApiInstLocal; - - /* Assign pointers to local structure. */ - ulApiInstSize = sizeof( tOCT6100_INSTANCE_API ); - mOCT6100_ROUND_MEMORY_SIZE( ulApiInstSize, ulTempVar ) - - pApiInstLocal->pSharedInfo = ( tPOCT6100_SHARED_INFO )(( PUINT8 )f_pCreateLocal->pApiInstShared + ulApiInstSize); - pApiInstLocal->pProcessContext = f_pCreateLocal->pProcessContext; - - /* Create serialization object handles needed. */ - ulResult = Oct6100ApiCreateSerializeObjects( pApiInstLocal, f_pCreateLocal->ulUserChipId ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100DestroyLocalInstance - -Description: Release local instance for a process in a multi-process - host system. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pDestroyLocal Structure used to destroy the process' local instance. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100DestroyLocalInstanceDef -UINT32 Oct6100DestroyLocalInstanceDef( - tPOCT6100_DESTROY_LOCAL_INSTANCE f_pDestroyLocal ) -{ - f_pDestroyLocal->ulDummy = 0; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100DestroyLocalInstance -UINT32 Oct6100DestroyLocalInstance( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_DESTROY_LOCAL_INSTANCE f_pDestroyLocal ) -{ - UINT32 ulResult; - - /* Destroy the allocated ressources used for serialization. */ - ulResult = Oct6100ApiDestroySerializeObjects( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100GetHwRevision - -Description: Gets the hardware revision number of the chip. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pGetHwRev Pointer to user structure in which to return revision - number. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100GetHwRevisionDef -UINT32 Oct6100GetHwRevisionDef( - tPOCT6100_GET_HW_REVISION f_pGetHwRev ) -{ - f_pGetHwRev->ulUserChipId = cOCT6100_INVALID_CHIP_ID; - f_pGetHwRev->pProcessContext = NULL; - f_pGetHwRev->ulRevisionNum = cOCT6100_INVALID_VALUE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100GetHwRevision -UINT32 Oct6100GetHwRevision( - tPOCT6100_GET_HW_REVISION f_pGetHwRev ) -{ - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT16 usReadData; - - /* Read the hardware revision register. */ - ReadParams.pProcessContext = f_pGetHwRev->pProcessContext; - - ReadParams.ulUserChipId = f_pGetHwRev->ulUserChipId; - ReadParams.pusReadData = &usReadData; - ReadParams.ulReadAddress = 0x17E; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - f_pGetHwRev->ulRevisionNum = ( usReadData >> 8 ) & 0xFF; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100FreeResources - -Description: This function closes all opened channels and frees all - specified global resources used by the chip. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pFreeResources Pointer to user structure in which to choose what - to free. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100FreeResourcesDef -UINT32 Oct6100FreeResourcesDef( - tPOCT6100_FREE_RESOURCES f_pFreeResources ) -{ - f_pFreeResources->fFreeTsiConnections = FALSE; - f_pFreeResources->fFreeConferenceBridges = FALSE; - f_pFreeResources->fFreePlayoutBuffers = FALSE; - f_pFreeResources->fFreePhasingTssts = FALSE; - f_pFreeResources->fFreeAdpcmChannels = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100FreeResources -UINT32 Oct6100FreeResources( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_FREE_RESOURCES f_pFreeResources ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100FreeResourcesSer( f_pApiInstance, f_pFreeResources ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ProductionBist - -Description: This function retrieves the current BIST status of the - firmware. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pProductionBist Pointer to user structure where the bist information - will be returned. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ProductionBistDef -UINT32 Oct6100ProductionBistDef( - tPOCT6100_PRODUCTION_BIST f_pProductionBist ) -{ - f_pProductionBist->ulCurrentAddress = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulCurrentLoop = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulFailedAddress = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulReadValue = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulExpectedValue = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulBistStatus = cOCT6100_BIST_IN_PROGRESS; - f_pProductionBist->ulCurrentTest = cOCT6100_INVALID_VALUE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ProductionBist -UINT32 Oct6100ProductionBist( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_PRODUCTION_BIST f_pProductionBist ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ProductionBistSer( f_pApiInstance, f_pProductionBist ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetVersion - -Description: Retrieves the API version. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_pApiGetVersion Pointer to structure that will receive version information. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetVersionDef -UINT32 Oct6100ApiGetVersionDef( - tPOCT6100_API_GET_VERSION f_pApiGetVersion ) -{ - UINT32 i; - - /* Initialize the string. */ - for ( i = 0; i < cOCT6100_API_VERSION_STRING_LENGTH; i++ ) - f_pApiGetVersion->achApiVersion[ i ] = 0; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ApiGetVersion -UINT32 Oct6100ApiGetVersion( - tPOCT6100_API_GET_VERSION f_pApiGetVersion ) -{ - /* Copy API version information to user. */ - Oct6100UserMemCopy( f_pApiGetVersion->achApiVersion, cOCT6100_API_VERSION, sizeof(cOCT6100_API_VERSION) ); - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetCapacityPins - -Description: Retrieves the Capcity Pins value. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_pGetCapacityPins Pointer to the parameters structure needed - by GetCapacityPins(). - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetCapacityPinsDef -UINT32 Oct6100ApiGetCapacityPinsDef( - tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins) -{ - - f_pGetCapacityPins->pProcessContext = NULL; - f_pGetCapacityPins->ulUserChipId = 0; - f_pGetCapacityPins->ulMemoryType = cOCT6100_MEM_TYPE_DDR; - f_pGetCapacityPins->ulCapacityValue = cOCT6100_INVALID_VALUE; - f_pGetCapacityPins->fEnableMemClkOut = TRUE; - f_pGetCapacityPins->ulMemClkFreq = 133000000; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ApiGetCapacityPins -UINT32 Oct6100ApiGetCapacityPins( - tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins ) -{ - - UINT32 ulResult; - - tOCT6100_INSTANCE_API ApiInstance; - - Oct6100UserMemSet(&ApiInstance,0,sizeof(tOCT6100_INSTANCE_API)); - - /*Check parameters*/ - if ( f_pGetCapacityPins->ulMemClkFreq != cOCT6100_MCLK_FREQ_133_MHZ && - f_pGetCapacityPins->ulMemClkFreq != cOCT6100_MCLK_FREQ_125_MHZ && - f_pGetCapacityPins->ulMemClkFreq != cOCT6100_MCLK_FREQ_117_MHZ && - f_pGetCapacityPins->ulMemClkFreq != cOCT6100_MCLK_FREQ_108_MHZ && - f_pGetCapacityPins->ulMemClkFreq != cOCT6100_MCLK_FREQ_100_MHZ && - f_pGetCapacityPins->ulMemClkFreq != cOCT6100_MCLK_FREQ_92_MHZ && - f_pGetCapacityPins->ulMemClkFreq != cOCT6100_MCLK_FREQ_83_MHZ && - f_pGetCapacityPins->ulMemClkFreq != cOCT6100_MCLK_FREQ_75_MHZ ) - return cOCT6100_ERR_OPEN_MEM_CLK_FREQ; - - if ( f_pGetCapacityPins->fEnableMemClkOut != TRUE && - f_pGetCapacityPins->fEnableMemClkOut != FALSE ) - return cOCT6100_ERR_OPEN_ENABLE_MEM_CLK_OUT; - - if ( f_pGetCapacityPins->ulMemoryType != cOCT6100_MEM_TYPE_SDR && - f_pGetCapacityPins->ulMemoryType != cOCT6100_MEM_TYPE_DDR && - f_pGetCapacityPins->ulMemoryType != cOCT6100_MEM_TYPE_SDR_PLL_BYPASS ) - return cOCT6100_ERR_OPEN_MEMORY_TYPE; - - - - ApiInstance.pProcessContext = f_pGetCapacityPins->pProcessContext; - - - - ulResult = Oct6100ApiReadCapacity(&ApiInstance, f_pGetCapacityPins); - - - - return ulResult; -} -#endif - -/*************************** PRIVATE FUNCTIONS *****************************/ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReadCapacity - -Description: Read the capacity pins using modified functions from the openchip. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_pChipOpen Pointer to chip configuration structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_OCT6100ApiReadCapacity -UINT32 Oct6100ApiReadCapacity( IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins) -{ - UINT32 ulResult; - tOCT6100_READ_PARAMS ReadParams; - UINT16 usReadData; - - /*Read capacity Pins*/ - - - ReadParams.pProcessContext = f_pGetCapacityPins->pProcessContext; - ReadParams.ulUserChipId = f_pGetCapacityPins->ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /*Check the Reset register*/ - ReadParams.ulReadAddress = 0x100; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ((usReadData & 0xFFFF) != 0x0000) - return cOCT6100_ERR_CAP_PINS_INVALID_CHIP_STATE; - - /* Test the CPU registers. */ - ulResult = Oct6100ApiCpuRegisterBistReadCap( f_pApiInstance, f_pGetCapacityPins ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Boot the FC2 PLL. */ - ulResult = Oct6100ApiBootFc2PllReadCap( f_pApiInstance,f_pGetCapacityPins ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Program the FC1 PLL. */ - ulResult = Oct6100ApiProgramFc1PllReadCap( f_pApiInstance,f_pGetCapacityPins ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( (f_pGetCapacityPins->ulMemoryType == cOCT6100_MEM_TYPE_SDR) || - (f_pGetCapacityPins->ulMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS) ) - { - ReadParams.ulReadAddress = 0x168; - } - else - ReadParams.ulReadAddress = 0x166; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - switch (usReadData & 0xF) - { - case 0x9: - f_pGetCapacityPins->ulCapacityValue = 16; - break; - case 0x8: - f_pGetCapacityPins->ulCapacityValue = 32; - break; - case 0xE: - f_pGetCapacityPins->ulCapacityValue = 64; - break; - case 0x0: - f_pGetCapacityPins->ulCapacityValue = 128; - break; - case 0x2: - f_pGetCapacityPins->ulCapacityValue = 256; - break; - case 0x5: - f_pGetCapacityPins->ulCapacityValue = 512; - break; - case 0x6: - f_pGetCapacityPins->ulCapacityValue = 672; - break; - default: - f_pGetCapacityPins->ulCapacityValue = (usReadData & 0xF); - return cOCT6100_ERR_CAP_PINS_INVALID_CAPACITY_VALUE; - } - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckChipConfiguration - -Description: Checks the user chip configuration structure for errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_pChipOpen Pointer to chip configuration structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckChipConfiguration -UINT32 Oct6100ApiCheckChipConfiguration( - IN tPOCT6100_CHIP_OPEN f_pChipOpen ) -{ - UINT32 ulTempVar; - UINT32 i; - - /*-----------------------------------------------------------------------------*/ - /* Check general parameters. */ - if ( f_pChipOpen->fMultiProcessSystem != TRUE && - f_pChipOpen->fMultiProcessSystem != FALSE ) - return cOCT6100_ERR_OPEN_MULTI_PROCESS_SYSTEM; - - if ( f_pChipOpen->ulMaxRwAccesses < 1 || - f_pChipOpen->ulMaxRwAccesses > 1024) - return cOCT6100_ERR_OPEN_MAX_RW_ACCESSES; - - /* Check the clocks. */ - if ( f_pChipOpen->ulUpclkFreq != cOCT6100_UPCLK_FREQ_33_33_MHZ ) - return cOCT6100_ERR_OPEN_UP_CLK_FREQ; - - if ( f_pChipOpen->ulMemClkFreq != cOCT6100_MCLK_FREQ_133_MHZ ) - return cOCT6100_ERR_OPEN_MEM_CLK_FREQ; - - if ( f_pChipOpen->fEnableMemClkOut != TRUE && - f_pChipOpen->fEnableMemClkOut != FALSE ) - return cOCT6100_ERR_OPEN_ENABLE_MEM_CLK_OUT; - - /* Check the image file. */ - if ( f_pChipOpen->ulImageSize < cOCT6100_MIN_IMAGE_SIZE || - f_pChipOpen->ulImageSize > cOCT6100_MAX_IMAGE_SIZE ) - return cOCT6100_ERR_OPEN_IMAGE_SIZE; - - if ( f_pChipOpen->pbyImageFile == NULL ) - return cOCT6100_ERR_OPEN_IMAGE_FILE; - - ulTempVar = Oct6100ApiCheckImageFileHeader(f_pChipOpen); - if (ulTempVar != cOCT6100_ERR_OK) - return ulTempVar; - - /* Check the acoustic echo activation flag. */ - if ( f_pChipOpen->fEnableAcousticEcho != TRUE && - f_pChipOpen->fEnableAcousticEcho != FALSE ) - return cOCT6100_ERR_OPEN_ENABLE_ACOUSTIC_ECHO; - - /* Check the tail displacement parameter. */ - if ( f_pChipOpen->ulTailDisplacement > cOCT6100_MAX_TAIL_DISPLACEMENT ) - return cOCT6100_ERR_OPEN_TAIL_DISPLACEMENT; - - /*-----------------------------------------------------------------------------*/ - /* Check TDM bus configuration parameters. */ - for ( i = 0; i < 8; i++ ) - { - if ( f_pChipOpen->aulTdmStreamFreqs[ i ] != cOCT6100_TDM_STREAM_FREQ_2MHZ && - f_pChipOpen->aulTdmStreamFreqs[ i ] != cOCT6100_TDM_STREAM_FREQ_4MHZ && - f_pChipOpen->aulTdmStreamFreqs[ i ] != cOCT6100_TDM_STREAM_FREQ_8MHZ) - return cOCT6100_ERR_OPEN_TDM_STREAM_FREQS; - } - - if ( f_pChipOpen->ulTdmSampling != cOCT6100_TDM_SAMPLE_AT_3_QUARTERS && - f_pChipOpen->ulTdmSampling != cOCT6100_TDM_SAMPLE_AT_RISING_EDGE && - f_pChipOpen->ulTdmSampling != cOCT6100_TDM_SAMPLE_AT_FALLING_EDGE ) - return cOCT6100_ERR_OPEN_TDM_SAMPLING; - - if ( f_pChipOpen->fEnableFastH100Mode != TRUE && - f_pChipOpen->fEnableFastH100Mode != FALSE ) - return cOCT6100_ERR_OPEN_FAST_H100_MODE; - - /*-----------------------------------------------------------------------------*/ - /* Check external memory configuration parameters. */ - if ( f_pChipOpen->ulMemoryType != cOCT6100_MEM_TYPE_SDR && - f_pChipOpen->ulMemoryType != cOCT6100_MEM_TYPE_DDR && - f_pChipOpen->ulMemoryType != cOCT6100_MEM_TYPE_SDR_PLL_BYPASS ) - return cOCT6100_ERR_OPEN_MEMORY_TYPE; - - if ( f_pChipOpen->ulMemoryChipSize != cOCT6100_MEMORY_CHIP_SIZE_8MB && - f_pChipOpen->ulMemoryChipSize != cOCT6100_MEMORY_CHIP_SIZE_16MB && - f_pChipOpen->ulMemoryChipSize != cOCT6100_MEMORY_CHIP_SIZE_32MB && - f_pChipOpen->ulMemoryChipSize != cOCT6100_MEMORY_CHIP_SIZE_64MB && - f_pChipOpen->ulMemoryChipSize != cOCT6100_MEMORY_CHIP_SIZE_128MB ) - return cOCT6100_ERR_OPEN_MEMORY_CHIP_SIZE; - - if ( f_pChipOpen->ulMemoryChipSize == cOCT6100_MEMORY_CHIP_SIZE_8MB && - f_pChipOpen->ulMemoryType == cOCT6100_MEM_TYPE_DDR ) - return cOCT6100_ERR_OPEN_MEMORY_CHIP_SIZE; - - if ( f_pChipOpen->ulNumMemoryChips < 1 || - f_pChipOpen->ulNumMemoryChips > cOCT6100_MAX_NUM_MEMORY_CHIP ) - return cOCT6100_ERR_OPEN_MEMORY_CHIPS_NUMBER; - - /* Check the total memory size. */ - ulTempVar = f_pChipOpen->ulMemoryChipSize * f_pChipOpen->ulNumMemoryChips; - if ( ulTempVar < cOCT6100_MEMORY_CHIP_SIZE_16MB || - ulTempVar > cOCT6100_MEMORY_CHIP_SIZE_128MB ) - return cOCT6100_ERR_OPEN_TOTAL_MEMORY_SIZE; - - if ( f_pChipOpen->ulMaxTdmStreams != 4 && - f_pChipOpen->ulMaxTdmStreams != 8 && - f_pChipOpen->ulMaxTdmStreams != 16 && - f_pChipOpen->ulMaxTdmStreams != 32 ) - return cOCT6100_ERR_OPEN_MAX_TDM_STREAM; - - if ( f_pChipOpen->ulMaxTdmStreams > 8 && - f_pChipOpen->ulMemClkFreq == cOCT6100_MCLK_FREQ_75_MHZ ) - return cOCT6100_ERR_OPEN_MAX_TDM_STREAM; - - if ( f_pChipOpen->fUseSynchTimestamp != TRUE && - f_pChipOpen->fUseSynchTimestamp != FALSE ) - return cOCT6100_ERR_OPEN_USE_SYNCH_TIMESTAMP; - - if ( f_pChipOpen->fUseSynchTimestamp == TRUE ) - { - return cOCT6100_ERR_NOT_SUPPORTED_OPEN_USE_SYNCH_TIMESTAMP; - } - - /*-----------------------------------------------------------------------------*/ - /* Check soft buffer for tone events size. */ - if (f_pChipOpen->ulSoftToneEventsBufSize < 64 || - f_pChipOpen->ulSoftToneEventsBufSize > cOCT6100_ABSOLUTE_MAX_NUM_PGSP_EVENT_OUT ) - return cOCT6100_ERR_OPEN_SOFT_TONE_EVENT_SIZE; - - if ( f_pChipOpen->fEnableExtToneDetection != TRUE && - f_pChipOpen->fEnableExtToneDetection != FALSE ) - return cOCT6100_ERR_OPEN_ENABLE_EXT_TONE_DETECTION; - - if ( f_pChipOpen->fEnable2100StopEvent != TRUE && - f_pChipOpen->fEnable2100StopEvent != FALSE) - return cOCT6100_ERR_OPEN_ENABLE_2100_STOP_EVENT; - - /* Check soft buffer for playout events size. */ - if ( ( f_pChipOpen->ulSoftBufferPlayoutEventsBufSize != cOCT6100_INVALID_VALUE ) - && ( f_pChipOpen->ulSoftBufferPlayoutEventsBufSize < cOCT6100_MIN_BUFFER_PLAYOUT_EVENT || - f_pChipOpen->ulSoftBufferPlayoutEventsBufSize > cOCT6100_MAX_BUFFER_PLAYOUT_EVENT ) ) - return cOCT6100_ERR_OPEN_SOFT_PLAYOUT_STOP_EVENT_SIZE; - - /*-----------------------------------------------------------------------------*/ - /* Check interrupt configuration parameters. */ - if ( f_pChipOpen->ulInterruptPolarity != cOCT6100_ACTIVE_LOW_POLARITY && - f_pChipOpen->ulInterruptPolarity != cOCT6100_ACTIVE_HIGH_POLARITY ) - return cOCT6100_ERR_OPEN_INTERRUPT_POLARITY; - - if ( f_pChipOpen->InterruptConfig.ulFatalGeneralConfig != cOCT6100_INTERRUPT_NO_TIMEOUT && - f_pChipOpen->InterruptConfig.ulFatalGeneralConfig != cOCT6100_INTERRUPT_DISABLE ) - return cOCT6100_ERR_OPEN_FATAL_GENERAL_CONFIG; - - if ( f_pChipOpen->InterruptConfig.ulFatalMemoryConfig != cOCT6100_INTERRUPT_NO_TIMEOUT && - f_pChipOpen->InterruptConfig.ulFatalMemoryConfig != cOCT6100_INTERRUPT_TIMEOUT && - f_pChipOpen->InterruptConfig.ulFatalMemoryConfig != cOCT6100_INTERRUPT_DISABLE ) - return cOCT6100_ERR_OPEN_FATAL_MEMORY_CONFIG; - - if ( f_pChipOpen->InterruptConfig.ulErrorMemoryConfig != cOCT6100_INTERRUPT_NO_TIMEOUT && - f_pChipOpen->InterruptConfig.ulErrorMemoryConfig != cOCT6100_INTERRUPT_TIMEOUT && - f_pChipOpen->InterruptConfig.ulErrorMemoryConfig != cOCT6100_INTERRUPT_DISABLE ) - return cOCT6100_ERR_OPEN_ERROR_MEMORY_CONFIG; - - if ( f_pChipOpen->InterruptConfig.ulErrorOverflowToneEventsConfig != cOCT6100_INTERRUPT_NO_TIMEOUT && - f_pChipOpen->InterruptConfig.ulErrorOverflowToneEventsConfig != cOCT6100_INTERRUPT_TIMEOUT && - f_pChipOpen->InterruptConfig.ulErrorOverflowToneEventsConfig != cOCT6100_INTERRUPT_DISABLE ) - return cOCT6100_ERR_OPEN_ERROR_OVERFLOW_TONE_EVENTS_CONFIG; - - if ( f_pChipOpen->InterruptConfig.ulErrorH100Config != cOCT6100_INTERRUPT_NO_TIMEOUT && - f_pChipOpen->InterruptConfig.ulErrorH100Config != cOCT6100_INTERRUPT_TIMEOUT && - f_pChipOpen->InterruptConfig.ulErrorH100Config != cOCT6100_INTERRUPT_DISABLE ) - return cOCT6100_ERR_OPEN_ERROR_H100_CONFIG; - - /* Check the timeout value. */ - if ( f_pChipOpen->InterruptConfig.ulFatalMemoryTimeout < 10 || - f_pChipOpen->InterruptConfig.ulFatalMemoryTimeout > 10000 ) - return cOCT6100_ERR_OPEN_FATAL_MEMORY_TIMEOUT; - - if ( f_pChipOpen->InterruptConfig.ulErrorMemoryTimeout < 10 || - f_pChipOpen->InterruptConfig.ulErrorMemoryTimeout > 10000 ) - return cOCT6100_ERR_OPEN_ERROR_MEMORY_TIMEOUT; - - if ( f_pChipOpen->InterruptConfig.ulErrorOverflowToneEventsTimeout < 10 || - f_pChipOpen->InterruptConfig.ulErrorOverflowToneEventsTimeout > 10000 ) - return cOCT6100_ERR_OPEN_ERROR_OVERFLOW_TONE_EVENTS_TIMEOUT; - - if ( f_pChipOpen->InterruptConfig.ulErrorH100Timeout < 10 || - f_pChipOpen->InterruptConfig.ulErrorH100Timeout > 10000 ) - return cOCT6100_ERR_OPEN_ERROR_H100_TIMEOUT; - - /*-----------------------------------------------------------------------------*/ - /* Check maximum resources. */ - - switch ( f_pChipOpen->ulMemClkFreq ) - { - case 133000000: - ulTempVar = 672; - break; - case 125000000: - ulTempVar = 624; - break; - case 117000000: - ulTempVar = 576; - break; - case 108000000: - ulTempVar = 528; - break; - case 100000000: - ulTempVar = 480; - break; - case 92000000: - ulTempVar = 432; - break; - case 83000000: - ulTempVar = 384; - break; - case 75000000: - ulTempVar = 336; - break; - default: - return cOCT6100_ERR_FATAL_DA; - } - - if ( f_pChipOpen->ulMaxChannels > ulTempVar ) - return cOCT6100_ERR_OPEN_MAX_ECHO_CHANNELS; - - if ( f_pChipOpen->ulMaxTsiCncts > cOCT6100_MAX_TSI_CNCTS ) - return cOCT6100_ERR_OPEN_MAX_TSI_CNCTS; - - - if ( f_pChipOpen->ulMaxBiDirChannels > 255 ) - return cOCT6100_ERR_OPEN_MAX_BIDIR_CHANNELS; - - if ( f_pChipOpen->ulMaxBiDirChannels > (f_pChipOpen->ulMaxChannels / 2) ) - return cOCT6100_ERR_OPEN_MAX_BIDIR_CHANNELS; - - if ( f_pChipOpen->ulMaxConfBridges > cOCT6100_MAX_CONF_BRIDGE ) - return cOCT6100_ERR_OPEN_MAX_CONF_BRIDGES; - - if ( f_pChipOpen->ulMaxFlexibleConfParticipants > cOCT6100_MAX_FLEX_CONF_PARTICIPANTS ) - return cOCT6100_ERR_OPEN_MAX_FLEXIBLE_CONF_PARTICIPANTS; - - if ( f_pChipOpen->ulMaxPlayoutBuffers > cOCT6100_MAX_PLAYOUT_BUFFERS ) - return cOCT6100_ERR_OPEN_MAX_PLAYOUT_BUFFERS; - - - - if ( f_pChipOpen->ulMaxPhasingTssts > cOCT6100_MAX_PHASING_TSST ) - return cOCT6100_ERR_OPEN_MAX_PHASING_TSSTS; - - if ( f_pChipOpen->ulMaxAdpcmChannels > cOCT6100_MAX_ADPCM_CHANNELS ) - return cOCT6100_ERR_OPEN_MAX_ADPCM_CHANNELS; - - if ( f_pChipOpen->ulMaxRemoteDebugSessions > 256 ) - return cOCT6100_ERR_OPEN_MAX_REMOTE_DEBUG_SESSIONS; - - - - - - /* Check the channel recording flag. */ - if ( f_pChipOpen->fEnableChannelRecording != TRUE && - f_pChipOpen->fEnableChannelRecording != FALSE ) - return cOCT6100_ERR_OPEN_DEBUG_CHANNEL_RECORDING; - - /* Check the enable production BIST flag. */ - if ( ( f_pChipOpen->fEnableProductionBist != TRUE ) - && ( f_pChipOpen->fEnableProductionBist != FALSE ) ) - return cOCT6100_ERR_OPEN_ENABLE_PRODUCTION_BIST; - - /* Check number of loops for the production BIST. */ - if ( f_pChipOpen->fEnableProductionBist == TRUE ) - { - if ( f_pChipOpen->ulNumProductionBistLoops == 0 ) - return cOCT6100_ERR_OPEN_NUM_PRODUCTION_BIST_LOOPS; - - if ( (f_pChipOpen->ulProductionBistMode != cOCT6100_PRODUCTION_BIST_STANDARD) && - (f_pChipOpen->ulProductionBistMode != cOCT6100_PRODUCTION_BIST_SHORT) ) - return cOCT6100_ERR_OPEN_PRODUCTION_BIST_MODE; - } - - /* If the production BIST has been requested, make sure all */ - /* other resources are disabled. */ - if ( f_pChipOpen->fEnableProductionBist == TRUE ) - { - /* All must be disabled. */ - f_pChipOpen->ulMaxChannels = 0; - f_pChipOpen->ulMaxTsiCncts = 0; - f_pChipOpen->fEnableChannelRecording = FALSE; - f_pChipOpen->ulMaxBiDirChannels = 0; - f_pChipOpen->ulMaxConfBridges = 0; - f_pChipOpen->ulMaxPlayoutBuffers = 0; - f_pChipOpen->ulSoftBufferPlayoutEventsBufSize = cOCT6100_INVALID_VALUE; - f_pChipOpen->ulMaxPhasingTssts = 0; - f_pChipOpen->ulMaxAdpcmChannels = 0; - - - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCopyChipConfiguration - -Description: Copies the chip configuration from the user supplied config - structure to the instance structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChipOpen Pointer to chip configuration structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCopyChipConfiguration -UINT32 Oct6100ApiCopyChipConfiguration( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHIP_OPEN f_pChipOpen ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 i; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - pSharedInfo->ChipConfig.ulUserChipId = f_pChipOpen->ulUserChipId; - pSharedInfo->ChipConfig.fMultiProcessSystem = (UINT8)( f_pChipOpen->fMultiProcessSystem & 0xFF ); - - pSharedInfo->ChipConfig.usMaxRwAccesses = (UINT16)( f_pChipOpen->ulMaxRwAccesses & 0xFFFF ); - - pSharedInfo->ChipConfig.pbyImageFile = f_pChipOpen->pbyImageFile; - pSharedInfo->ChipConfig.ulImageSize = f_pChipOpen->ulImageSize; - - pSharedInfo->ChipConfig.ulMemClkFreq = f_pChipOpen->ulMemClkFreq; - pSharedInfo->ChipConfig.ulUpclkFreq = f_pChipOpen->ulUpclkFreq; - - pSharedInfo->ChipConfig.byMemoryType = (UINT8)( f_pChipOpen->ulMemoryType & 0xFF ); - pSharedInfo->ChipConfig.byNumMemoryChips = (UINT8)( f_pChipOpen->ulNumMemoryChips & 0xFF ); - pSharedInfo->ChipConfig.ulMemoryChipSize = f_pChipOpen->ulMemoryChipSize; - - pSharedInfo->ChipConfig.usTailDisplacement = (UINT16)( f_pChipOpen->ulTailDisplacement & 0xFFFF ); - pSharedInfo->ChipConfig.fEnableAcousticEcho = (UINT8)( f_pChipOpen->fEnableAcousticEcho & 0xFF ); - /* Resource allocation parameters. */ - if ( f_pChipOpen->fEnableChannelRecording == TRUE && f_pChipOpen->ulMaxChannels == 672 ) - pSharedInfo->ChipConfig.usMaxChannels = (UINT16)( ( f_pChipOpen->ulMaxChannels - 1 ) & 0xFFFF ); - else - pSharedInfo->ChipConfig.usMaxChannels = (UINT16)( f_pChipOpen->ulMaxChannels & 0xFFFF ); - pSharedInfo->ChipConfig.usMaxTsiCncts = (UINT16)( f_pChipOpen->ulMaxTsiCncts & 0xFFFF ); - pSharedInfo->ChipConfig.usMaxBiDirChannels = (UINT16)( f_pChipOpen->ulMaxBiDirChannels & 0xFFFF ); - pSharedInfo->ChipConfig.usMaxConfBridges = (UINT16)( f_pChipOpen->ulMaxConfBridges & 0xFFFF ); - pSharedInfo->ChipConfig.usMaxFlexibleConfParticipants = (UINT16)( f_pChipOpen->ulMaxFlexibleConfParticipants & 0xFFFF ); - pSharedInfo->ChipConfig.usMaxPlayoutBuffers = (UINT16)( f_pChipOpen->ulMaxPlayoutBuffers & 0xFFFF ); - - pSharedInfo->ChipConfig.usMaxPhasingTssts = (UINT16)( f_pChipOpen->ulMaxPhasingTssts & 0xFFFF ); - pSharedInfo->ChipConfig.usMaxAdpcmChannels = (UINT16)( f_pChipOpen->ulMaxAdpcmChannels & 0xFFFF ); - pSharedInfo->ChipConfig.byMaxTdmStreams = (UINT8)( f_pChipOpen->ulMaxTdmStreams & 0xFF ); - pSharedInfo->ChipConfig.fUseSynchTimestamp = (UINT8)( f_pChipOpen->fUseSynchTimestamp & 0xFF ); - for ( i = 0; i < 4; i++ ) - { - pSharedInfo->ChipConfig.ausTimestampTimeslots[ i ] = (UINT16)( f_pChipOpen->aulTimestampTimeslots[ i ] & 0xFFFF ); - pSharedInfo->ChipConfig.ausTimestampStreams[ i ] = (UINT16)( f_pChipOpen->aulTimestampStreams[ i ] & 0xFFFF ); - } - pSharedInfo->ChipConfig.byInterruptPolarity = (UINT8)( f_pChipOpen->ulInterruptPolarity & 0xFF ); - - pSharedInfo->ChipConfig.byTdmSampling = (UINT8)( f_pChipOpen->ulTdmSampling & 0xFF ); - pSharedInfo->ChipConfig.fEnableFastH100Mode = (UINT8)( f_pChipOpen->fEnableFastH100Mode & 0xFF ); - - for ( i = 0; i < cOCT6100_TDM_STREAM_MAX_GROUPS; i++ ) - { - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - pSharedInfo->ChipConfig.aulTdmStreamFreqs[ i ] = cOCT6100_TDM_STREAM_FREQ_16MHZ; - else - pSharedInfo->ChipConfig.aulTdmStreamFreqs[ i ] = f_pChipOpen->aulTdmStreamFreqs[ i ]; - } - - pSharedInfo->ChipConfig.fEnableFastH100Mode = (UINT8)( f_pChipOpen->fEnableFastH100Mode & 0xFF ); - pSharedInfo->ChipConfig.fEnableMemClkOut = (UINT8)( f_pChipOpen->fEnableMemClkOut & 0xFF ); - - /* Add 1 to the circular buffer such that all user requested events can fit in the circular queue. */ - pSharedInfo->ChipConfig.ulSoftToneEventsBufSize = f_pChipOpen->ulSoftToneEventsBufSize + 1; - pSharedInfo->ChipConfig.fEnableExtToneDetection = (UINT8)( f_pChipOpen->fEnableExtToneDetection & 0xFF ); - pSharedInfo->ChipConfig.fEnable2100StopEvent = (UINT8)( f_pChipOpen->fEnable2100StopEvent & 0xFF ); - - if ( f_pChipOpen->ulSoftBufferPlayoutEventsBufSize != cOCT6100_INVALID_VALUE ) - pSharedInfo->ChipConfig.ulSoftBufPlayoutEventsBufSize = f_pChipOpen->ulSoftBufferPlayoutEventsBufSize + 1; - else - pSharedInfo->ChipConfig.ulSoftBufPlayoutEventsBufSize = 0; - pSharedInfo->ChipConfig.usMaxRemoteDebugSessions = (UINT16)( f_pChipOpen->ulMaxRemoteDebugSessions & 0xFFFF ); - - pSharedInfo->ChipConfig.fEnableChannelRecording = (UINT8)( f_pChipOpen->fEnableChannelRecording & 0xFF ); - - - - pSharedInfo->ChipConfig.fEnableProductionBist = (UINT8)( f_pChipOpen->fEnableProductionBist & 0xFF ); - pSharedInfo->ChipConfig.ulProductionBistMode = f_pChipOpen->ulProductionBistMode; - pSharedInfo->ChipConfig.ulNumProductionBistLoops = f_pChipOpen->ulNumProductionBistLoops; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInitializeMiscellaneousVariables - -Description: Function where all the various parameters from the API instance - are set to their defaults value. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInitializeMiscellaneousVariables -UINT32 Oct6100ApiInitializeMiscellaneousVariables( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 i; - - /* Obtain pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Calculate the total memory available. */ - pSharedInfo->MiscVars.ulTotalMemSize = pSharedInfo->ChipConfig.ulMemoryChipSize * pSharedInfo->ChipConfig.byNumMemoryChips; - - /* Software buffers initialization. */ - - /* Tones */ - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; - pSharedInfo->SoftBufs.ulToneEventBufferReadPtr = 0; - pSharedInfo->SoftBufs.ulToneEventBufferSize = pSharedInfo->ChipConfig.ulSoftToneEventsBufSize; - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt = 0; - - /* Playout */ - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferWritePtr = 0; - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferReadPtr = 0; - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferSize = pSharedInfo->ChipConfig.ulSoftBufPlayoutEventsBufSize; - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferOverflowCnt = 0; - - /* Set the number of conference bridges opened to zero. */ - pSharedInfo->MiscVars.usNumBridgesOpened = 0; - pSharedInfo->MiscVars.usFirstBridge = cOCT6100_INVALID_INDEX; - - /* Set the H.100 slave mode. */ - pSharedInfo->MiscVars.ulH100SlaveMode = cOCT6100_H100_TRACKA; - - /* Save the Mclk value.*/ - pSharedInfo->MiscVars.ulMclkFreq = pSharedInfo->ChipConfig.ulMemClkFreq; - - /* Init the NLP params. */ - pSharedInfo->MiscVars.usCodepoint = 0; - pSharedInfo->MiscVars.usCpuLsuWritePtr = 0; - - /* Pouch counter not present until TLVs are read. */ - pSharedInfo->DebugInfo.fPouchCounter = FALSE; - pSharedInfo->DebugInfo.fIsIsrCalledField = FALSE; - - /* Initialize the image info parameters */ - pSharedInfo->ImageInfo.fAdaptiveNoiseReduction = FALSE; - pSharedInfo->ImageInfo.fSoutNoiseBleaching = FALSE; - pSharedInfo->ImageInfo.fComfortNoise = FALSE; - pSharedInfo->ImageInfo.fBufferPlayout = TRUE; - pSharedInfo->ImageInfo.fSoutBufferPlayoutHardSkip = FALSE; - pSharedInfo->ImageInfo.fRinBufferPlayoutHardSkip = FALSE; - pSharedInfo->ImageInfo.fNlpControl = FALSE; - pSharedInfo->ImageInfo.fRinAutoLevelControl = FALSE; - pSharedInfo->ImageInfo.fSoutAutoLevelControl = FALSE; - pSharedInfo->ImageInfo.fRinHighLevelCompensation = FALSE; - pSharedInfo->ImageInfo.fSoutHighLevelCompensation = FALSE; - pSharedInfo->ImageInfo.fAlcHlcStatus = FALSE; - pSharedInfo->ImageInfo.fRinDcOffsetRemoval = FALSE; - pSharedInfo->ImageInfo.fSilenceSuppression = FALSE; - pSharedInfo->ImageInfo.fSinDcOffsetRemoval = FALSE; - pSharedInfo->ImageInfo.fToneDisabler = FALSE; - pSharedInfo->ImageInfo.fAdpcm = FALSE; - pSharedInfo->ImageInfo.fTailDisplacement = FALSE; - pSharedInfo->ImageInfo.fConferencing = FALSE; - pSharedInfo->ImageInfo.fConferencingNoiseReduction = FALSE; - pSharedInfo->ImageInfo.fDominantSpeakerEnabled = FALSE; - pSharedInfo->ImageInfo.fAecEnabled = FALSE; - pSharedInfo->ImageInfo.fAcousticEcho = FALSE; - pSharedInfo->ImageInfo.fToneRemoval = FALSE; - - pSharedInfo->ImageInfo.fDefaultErl = FALSE; - pSharedInfo->ImageInfo.fMaxEchoPoint = FALSE; - pSharedInfo->ImageInfo.fNonLinearityBehaviorA = FALSE; - pSharedInfo->ImageInfo.fNonLinearityBehaviorB = FALSE; - pSharedInfo->ImageInfo.fPerChannelTailDisplacement = FALSE; - pSharedInfo->ImageInfo.fPerChannelTailLength = FALSE; - pSharedInfo->ImageInfo.fAfTailDisplacement = FALSE; - pSharedInfo->ImageInfo.fMusicProtection = FALSE; - pSharedInfo->ImageInfo.fAftControl = FALSE; - pSharedInfo->ImageInfo.fSinVoiceDetectedStat = FALSE; - pSharedInfo->ImageInfo.fRinAppliedGainStat = FALSE; - pSharedInfo->ImageInfo.fSoutAppliedGainStat = FALSE; - pSharedInfo->ImageInfo.fListenerEnhancement = FALSE; - pSharedInfo->ImageInfo.fRoutNoiseReduction = FALSE; - pSharedInfo->ImageInfo.fRoutNoiseReductionLevel = FALSE; - pSharedInfo->ImageInfo.fAnrSnrEnhancement = FALSE; - pSharedInfo->ImageInfo.fAnrVoiceNoiseSegregation = FALSE; - pSharedInfo->ImageInfo.fRinMute = FALSE; - pSharedInfo->ImageInfo.fSinMute = FALSE; - pSharedInfo->ImageInfo.fToneDisablerVqeActivationDelay = FALSE; - pSharedInfo->ImageInfo.fAecTailLength = FALSE; - pSharedInfo->ImageInfo.fMusicProtectionConfiguration= FALSE; - pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents = FALSE; - pSharedInfo->ImageInfo.fRinEnergyStat = FALSE; - pSharedInfo->ImageInfo.fSoutEnergyStat = FALSE; - pSharedInfo->ImageInfo.fDoubleTalkBehavior = FALSE; - pSharedInfo->ImageInfo.fDoubleTalkBehaviorFieldOfst = FALSE; - pSharedInfo->ImageInfo.fIdleCodeDetection = TRUE; - pSharedInfo->ImageInfo.fIdleCodeDetectionConfiguration = FALSE; - pSharedInfo->ImageInfo.fSinLevel = TRUE; - - pSharedInfo->ImageInfo.usMaxNumberOfChannels = 0; - pSharedInfo->ImageInfo.ulToneProfileNumber = cOCT6100_INVALID_VALUE; - pSharedInfo->ImageInfo.ulBuildId = cOCT6100_INVALID_VALUE; - pSharedInfo->ImageInfo.byImageType = cOCT6100_IMAGE_TYPE_WIRELINE; - pSharedInfo->ImageInfo.usMaxTailDisplacement = 0; - pSharedInfo->ImageInfo.usMaxTailLength = cOCT6100_TAIL_LENGTH_128MS; - pSharedInfo->DebugInfo.ulDebugEventSize = 0x100; - pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents = 32; - pSharedInfo->DebugInfo.ulMatrixBaseAddress = cOCT6100_MATRIX_DWORD_BASE; - pSharedInfo->DebugInfo.ulDebugChanStatsByteSize = cOCT6100_DEBUG_CHAN_STATS_EVENT_BYTE_SIZE; - pSharedInfo->DebugInfo.ulDebugChanLiteStatsByteSize = cOCT6100_DEBUG_CHAN_STATS_LITE_EVENT_BYTE_SIZE; - pSharedInfo->DebugInfo.ulHotChannelSelectBaseAddress= cOCT6100_MATRIX_CHAN_SELECT_DWORD_ADD; - pSharedInfo->DebugInfo.ulMatrixTimestampBaseAddress = cOCT6100_MATRIX_TIMESTAMP_DWORD_ADD; - pSharedInfo->DebugInfo.ulMatrixWpBaseAddress = cOCT6100_MATRIX_WRITE_PTR_DWORD_ADD; - pSharedInfo->DebugInfo.ulAfWritePtrByteOffset = 206; - pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize = 4096; - pSharedInfo->DebugInfo.ulAfEventCbByteSize = 0x100000; - - /* Set all tones to invalid. */ - pSharedInfo->ImageInfo.byNumToneDetectors = 0; - for ( i = 0; i < cOCT6100_MAX_TONE_EVENT; i++ ) - { - pSharedInfo->ImageInfo.aToneInfo[ i ].ulToneID = cOCT6100_INVALID_VALUE; - pSharedInfo->ImageInfo.aToneInfo[ i ].ulDetectionPort = cOCT6100_INVALID_PORT; - Oct6100UserMemSet( pSharedInfo->ImageInfo.aToneInfo[ i ].aszToneName, 0x00, cOCT6100_TLV_MAX_TONE_NAME_SIZE ); - } - /* Initialize the channel recording info. */ - pSharedInfo->DebugInfo.usRecordChanIndex = pSharedInfo->ChipConfig.usMaxChannels; - pSharedInfo->DebugInfo.usRecordMemIndex = cOCT6100_INVALID_INDEX; - - pSharedInfo->DebugInfo.usCurrentDebugChanIndex = cOCT6100_INVALID_INDEX; - /* Initialize the mixer information. */ - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usFirstSinCopyEventPtr = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usLastBridgeEventPtr = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usLastSinCopyEventPtr = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usLastSoutCopyEventPtr = cOCT6100_INVALID_INDEX; - - pSharedInfo->MixerInfo.usRecordCopyEventIndex = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usRecordSinEventIndex = cOCT6100_INVALID_INDEX; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCalculateInstanceSizes - -Description: Calculates the amount of memory needed for the instance - structure memory block based on the user's configuration. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pChipOpen Pointer to user chip configuration structure. - -f_pInstSizes Pointer to structure containing the size of memory needed - by all pointers internal to the API instance. The memory - is needed to keep track of the present state of all the - chip's resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCalculateInstanceSizes -UINT32 Oct6100ApiCalculateInstanceSizes( - IN OUT tPOCT6100_CHIP_OPEN f_pChipOpen, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulApiInstProcessSpecific; - UINT32 ulTempVar; - UINT32 ulResult; - - /* Start with all instance sizes set to 0. */ - Oct6100UserMemSet( f_pInstSizes, 0x00, sizeof( tOCT6100_API_INSTANCE_SIZES ) ); - - /* All memory sizes are rounded up to the next multiple of 64 bytes. */ - - /*-----------------------------------------------------------------------------*/ - /* Obtain size of static members of API instance. */ - f_pInstSizes->ulApiInstStatic = sizeof( tOCT6100_SHARED_INFO ); - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulApiInstStatic, ulTempVar ) - - /* Calculate memory needed by pointers internal to the API instance. */ - - /*-----------------------------------------------------------------------------*/ - /* Calculate memory needed for the EC channels. */ - ulResult = Oct6100ApiGetChannelsEchoSwSizes( f_pChipOpen, f_pInstSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*-----------------------------------------------------------------------------*/ - /* Memory needed by the TSI structures. */ - ulResult = Oct6100ApiGetTsiCnctSwSizes( f_pChipOpen, f_pInstSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*-----------------------------------------------------------------------------*/ - /* Calculate memory needed for the conference bridges. */ - ulResult = Oct6100ApiGetConfBridgeSwSizes( f_pChipOpen, f_pInstSizes ); - /* Calculate memory needed for list and allocation software serialization. */ - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Memory needed by the buffer playout structures. */ - ulResult = Oct6100ApiGetPlayoutBufferSwSizes( f_pChipOpen, f_pInstSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Memory needed by soft Rx Event buffers. */ - ulResult = Oct6100ApiGetEventsSwSizes( f_pChipOpen, f_pInstSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Calculate memory needed for phasing tssts. */ - ulResult = Oct6100ApiGetPhasingTsstSwSizes( f_pChipOpen, f_pInstSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*-----------------------------------------------------------------------------*/ - /* Calculate memory needed for the ADPCM channels. */ - ulResult = Oct6100ApiGetAdpcmChanSwSizes( f_pChipOpen, f_pInstSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Calculate memory needed for the management of TSSTs. */ - ulResult = Oct6100ApiGetTsstSwSizes( f_pInstSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Calculate memory needed for the management of the mixer. */ - ulResult = Oct6100ApiGetMixerSwSizes( f_pChipOpen, f_pInstSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Determine amount of memory needed for memory allocation softwares. These - pieces of software will be responsible for the allocation of the chip's - external memory and API memory. */ - ulResult = Oct6100ApiGetMemorySwSizes( f_pChipOpen, f_pInstSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Memory needed for remote debugging sessions. */ - ulResult = Oct6100ApiGetRemoteDebugSwSizes( f_pChipOpen, f_pInstSizes ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Calculate total memory needed by pointers internal to API instance. The - total contains both the process specific portion of the instance - (tOCT6100_INSTANCE_API) and the shared portion (tOCT6100_SHARED_INFO). The - process specific portion will be used only in the case where the host system - is a single-process one. */ - - ulApiInstProcessSpecific = sizeof( tOCT6100_INSTANCE_API ); - mOCT6100_ROUND_MEMORY_SIZE( ulApiInstProcessSpecific, ulTempVar ) - f_pInstSizes->ulApiInstTotal = - f_pInstSizes->ulChannelList + - f_pInstSizes->ulChannelAlloc + - f_pInstSizes->ulTsiCnctList + - f_pInstSizes->ulTsiCnctAlloc + - f_pInstSizes->ulSoftToneEventsBuffer + - f_pInstSizes->ulSoftBufPlayoutEventsBuffer + - f_pInstSizes->ulBiDirChannelList + - f_pInstSizes->ulBiDirChannelAlloc + - f_pInstSizes->ulConfBridgeList + - f_pInstSizes->ulConfBridgeAlloc + - f_pInstSizes->ulFlexConfParticipantsList + - f_pInstSizes->ulFlexConfParticipantsAlloc + - f_pInstSizes->ulPlayoutBufList + - f_pInstSizes->ulPlayoutBufAlloc + - f_pInstSizes->ulPlayoutBufMemoryNodeList + - - f_pInstSizes->ulCopyEventList + - f_pInstSizes->ulCopyEventAlloc + - f_pInstSizes->ulMixerEventList + - f_pInstSizes->ulMixerEventAlloc + - f_pInstSizes->ulPhasingTsstList + - f_pInstSizes->ulPhasingTsstAlloc + - f_pInstSizes->ulAdpcmChannelList + - f_pInstSizes->ulAdpcmChannelAlloc + - f_pInstSizes->ulConversionMemoryAlloc + - f_pInstSizes->ulTsiMemoryAlloc + - f_pInstSizes->ulRemoteDebugList + - f_pInstSizes->ulRemoteDebugTree + - f_pInstSizes->ulRemoteDebugPktCache + - f_pInstSizes->ulRemoteDebugDataBuf + - f_pInstSizes->ulTsstEntryList + - f_pInstSizes->ulTsstEntryAlloc + - f_pInstSizes->ulTsstAlloc + - f_pInstSizes->ulApiInstStatic + - ulApiInstProcessSpecific; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAllocateInstanceMemory - -Description: Allocates the API instance memory to the various members of - the structure f_pApiInstance according to the sizes contained - in f_pInstSizes. No initialization of this memory is - performed. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pInstSizes Pointer to structure containing the size of memory needed - by all pointers internal to the API instance. The memory - is needed to keep track of the present state of all the - chip's resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAllocateInstanceMemory -UINT32 Oct6100ApiAllocateInstanceMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulOffset; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get address of first UINT32 of memory in API instance structure following */ - /* the static members of the API instance structure. */ - ulOffset = f_pInstSizes->ulApiInstStatic; - - /*===================================================================*/ - /* Allocate memory for the echo channels.*/ - pSharedInfo->ulChannelListOfst = ulOffset; - ulOffset += f_pInstSizes->ulChannelList; - pSharedInfo->ulChannelAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulChannelAlloc; - - /*===================================================================*/ - /* Allocate memory for the TSI connections */ - pSharedInfo->ulTsiCnctListOfst = ulOffset; - ulOffset += f_pInstSizes->ulTsiCnctList; - pSharedInfo->ulTsiCnctAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulTsiCnctAlloc; - pSharedInfo->ulMixerEventListOfst = ulOffset; - ulOffset += f_pInstSizes->ulMixerEventList; - pSharedInfo->ulMixerEventAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulMixerEventAlloc; - - pSharedInfo->ulBiDirChannelListOfst = ulOffset; - ulOffset += f_pInstSizes->ulBiDirChannelList; - pSharedInfo->ulBiDirChannelAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulBiDirChannelAlloc; - pSharedInfo->ulCopyEventListOfst = ulOffset; - ulOffset += f_pInstSizes->ulCopyEventList; - pSharedInfo->ulCopyEventAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulCopyEventAlloc; - - /*===================================================================*/ - /* Allocate memory for the conference bridges */ - pSharedInfo->ulConfBridgeListOfst = ulOffset; - ulOffset += f_pInstSizes->ulConfBridgeList; - pSharedInfo->ulConfBridgeAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulConfBridgeAlloc; - - /*===================================================================*/ - /* Allocate memory for the flexible conferencing participants. */ - pSharedInfo->ulFlexConfParticipantListOfst = ulOffset; - ulOffset += f_pInstSizes->ulFlexConfParticipantsList; - pSharedInfo->ulFlexConfParticipantAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulFlexConfParticipantsAlloc; - - /*===================================================================*/ - /* Allocate memory for the play-out buffers */ - pSharedInfo->ulPlayoutBufListOfst = ulOffset; - ulOffset += f_pInstSizes->ulPlayoutBufList; - pSharedInfo->ulPlayoutBufAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulPlayoutBufAlloc; - pSharedInfo->ulPlayoutBufMemoryNodeListOfst = ulOffset; - ulOffset += f_pInstSizes->ulPlayoutBufMemoryNodeList; - - - - /*===================================================================*/ - /* Allocate memory for the phasing TSSTs */ - pSharedInfo->ulPhasingTsstListOfst = ulOffset; - ulOffset += f_pInstSizes->ulPhasingTsstList; - pSharedInfo->ulPhasingTsstAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulPhasingTsstAlloc; - - /*===================================================================*/ - /* Allocate memory for the ADPCM channel */ - pSharedInfo->ulAdpcmChanAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulAdpcmChannelAlloc; - pSharedInfo->ulAdpcmChanListOfst = ulOffset; - ulOffset += f_pInstSizes->ulAdpcmChannelList; - - /*===================================================================*/ - /* Allocate memory for the conversion memory */ - pSharedInfo->ulConversionMemoryAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulConversionMemoryAlloc; - - /*===================================================================*/ - /* Allocate memory for the TSI chariot memory */ - pSharedInfo->ulTsiMemoryAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulTsiMemoryAlloc; - - /*===================================================================*/ - /* Allocate memory for the TSST management */ - pSharedInfo->ulTsstAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulTsstAlloc; - pSharedInfo->ulTsstListOfst = ulOffset; - ulOffset += f_pInstSizes->ulTsstEntryList; - pSharedInfo->ulTsstListAllocOfst = ulOffset; - ulOffset += f_pInstSizes->ulTsstEntryAlloc; - - /*===================================================================*/ - pSharedInfo->SoftBufs.ulToneEventBufferMemOfst = ulOffset; - ulOffset += f_pInstSizes->ulSoftToneEventsBuffer; - - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferMemOfst = ulOffset; - ulOffset += f_pInstSizes->ulSoftBufPlayoutEventsBuffer; - /*===================================================================*/ - pSharedInfo->RemoteDebugInfo.ulSessionListOfst = ulOffset; - ulOffset += f_pInstSizes->ulRemoteDebugList; - - pSharedInfo->RemoteDebugInfo.ulSessionTreeOfst = ulOffset; - ulOffset += f_pInstSizes->ulRemoteDebugTree; - - pSharedInfo->RemoteDebugInfo.ulDataBufOfst = ulOffset; - ulOffset += f_pInstSizes->ulRemoteDebugDataBuf; - - pSharedInfo->RemoteDebugInfo.ulPktCacheOfst = ulOffset; - ulOffset += f_pInstSizes->ulRemoteDebugPktCache; - /*===================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInitializeInstanceMemory - -Description: Initializes the various members of the structure f_pApiInstance - to reflect the current state of the chip and its resources. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInitializeInstanceMemory -UINT32 Oct6100ApiInitializeInstanceMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - UINT32 ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Initialize API EC channels. */ - ulResult = Oct6100ApiChannelsEchoSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*-----------------------------------------------------------------------------*/ - /* Initialize the API TSI connection structures. */ - ulResult = Oct6100ApiTsiCnctSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*-----------------------------------------------------------------------------*/ - /* Initialize the API conference bridges. */ - ulResult = Oct6100ApiConfBridgeSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Initialize the API buffer playout structures. */ - ulResult = Oct6100ApiPlayoutBufferSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Initialize the API phasing tssts. */ - ulResult = Oct6100ApiPhasingTsstSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*-----------------------------------------------------------------------------*/ - /* Initialize the API ADPCM channels. */ - ulResult = Oct6100ApiAdpcmChanSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Initialize the external memory management structures. */ - ulResult = Oct6100ApiMemorySwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Initialize TSST management stuctures. */ - ulResult = Oct6100ApiTsstSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Initialize the mixer management stuctures. */ - ulResult = Oct6100ApiMixerSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Initialize the remote debugging session management variables. */ - ulResult = Oct6100ApiRemoteDebuggingSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*-----------------------------------------------------------------------------*/ - /* Configure the interrupt registers. */ - ulResult = Oct6100ApiIsrSwInit( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetChipRevisionNum - -Description: Reads the chip's revision number register. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetChipRevisionNum -UINT32 Oct6100ApiGetChipRevisionNum( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT16 usReadData; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get the chip revision number. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.ulReadAddress = cOCT6100_CHIP_ID_REVISION_REG; - ReadParams.pusReadData = &usReadData; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save the info in the API miscellaneous structure. */ - pSharedInfo->MiscVars.usChipId = (UINT16)( usReadData & 0xFF ); - pSharedInfo->MiscVars.usChipRevision = (UINT16)( usReadData >> 8 ); - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckImageFileHeader - -Description: This function check if the image loaded is valid - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckImageFileHeader -UINT32 Oct6100ApiCheckImageFileHeader( - IN tPOCT6100_CHIP_OPEN f_pChipOpen ) -{ - - PUINT8 pszImageInfoStart = NULL; - UINT32 ulStrLen; - - ulStrLen = Oct6100ApiStrLen( (PUINT8)cOCT6100_IMAGE_START_STRING ); - pszImageInfoStart = (PUINT8) Oct6100ApiStrStr(f_pChipOpen->pbyImageFile,(PUINT8)cOCT6100_IMAGE_START_STRING, - f_pChipOpen->pbyImageFile + ulStrLen); - if (pszImageInfoStart == NULL) - return cOCT6100_ERR_OPEN_IMAGE_FILE; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiDecodeKeyAndBist - -Description: This function decodes the key and runs the automatic BIST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiDecodeKeyAndBist -UINT32 Oct6100ApiDecodeKeyAndBist( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHIP_CONFIG pChipConfig; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT16 ausBistData[ 3 ]; - UINT16 usReadData; - UINT32 ulResult; - BOOL fBitEqual; - UINT32 i; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain a local pointer to the chip config structure */ - /* contained in the instance structure. */ - pChipConfig = &pSharedInfo->ChipConfig; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pChipConfig->ulUserChipId; - - /* Set the process context and user chip ID parameters once and for all. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pChipConfig->ulUserChipId; - - /* Write key in CPU internal memory. */ - for(i=0; i<8; i++) - { - WriteParams.ulWriteAddress = 0x150; - WriteParams.usWriteData = 0x0000; - if (( i % 2 ) == 0) - { - WriteParams.usWriteData |= ((UINT16)pChipConfig->pbyImageFile[0x100 + ((i/2)*4) + 2]) << 8; - WriteParams.usWriteData |= ((UINT16)pChipConfig->pbyImageFile[0x100 + ((i/2)*4) + 3]) << 0; - } - else - { - WriteParams.usWriteData |= ((UINT16)pChipConfig->pbyImageFile[0x100 + ((i/2)*4) + 0]) << 8; - WriteParams.usWriteData |= ((UINT16)pChipConfig->pbyImageFile[0x100 + ((i/2)*4) + 1]) << 0; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x152; - WriteParams.usWriteData = (UINT16)( 0x8000 | i ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Write one in CPU internal memory. */ - for(i=0; i<8; i++) - { - WriteParams.ulWriteAddress = 0x150; - if (i == 0) - { - WriteParams.usWriteData = 0x0001; - } - else - { - WriteParams.usWriteData = 0x0000; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x152; - WriteParams.usWriteData = (UINT16)( 0x8000 | ( i + 8 )); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Clear memory access registers: */ - WriteParams.ulWriteAddress = 0x150; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x152; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Run BISTs and key decode. */ - WriteParams.ulWriteAddress = 0x160; - WriteParams.usWriteData = 0x0081; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Wait for the key decode PC to clear. */ - ulResult = Oct6100ApiWaitForPcRegisterBit( f_pApiInstance, 0x160, 0, 0, 100000, &fBitEqual ); - if ( TRUE != fBitEqual ) - return cOCT6100_ERR_FATAL_13; - - /* Read the key valid bit to make sure everything is ok. */ - ReadParams.ulReadAddress = 0x160; - ReadParams.pusReadData = &usReadData; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Either the firmware image was not loaded correctly (from pointer given by user) */ - /* or the channel capacity pins of the chip do not match what the firmware is expecting. */ - if ( ( usReadData & 0x4 ) == 0 ) - return cOCT6100_ERR_OPEN_INVALID_FIRMWARE_OR_CAPACITY_PINS; - - /* Read the result of the internal memory bist. */ - ReadParams.ulReadAddress = 0x110; - ReadParams.pusReadData = &ausBistData[ 0 ]; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ReadParams.ulReadAddress = 0x114; - ReadParams.pusReadData = &ausBistData[ 1 ]; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ReadParams.ulReadAddress = 0x118; - ReadParams.pusReadData = &ausBistData[ 2 ]; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if an error was reported. */ - if (ausBistData[0] != 0x0000 || ausBistData[1] != 0x0000 || ausBistData[2] != 0x0000) - return cOCT6100_ERR_OPEN_INTERNAL_MEMORY_BIST; - - /* Put key decoder in powerdown. */ - WriteParams.ulWriteAddress = 0x160; - WriteParams.usWriteData = 0x008A; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBootFc2PllReadCap - -Description: Configures the chip's FC2 PLL. Special version for GetcapacityPins. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -UINT32 Oct6100ApiBootFc2PllReadCap( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 aulWaitTime[ 2 ]; - UINT32 ulResult; - UINT32 ulFc2PllDivisor = 0; - UINT32 ulMtDivisor = 0; - UINT32 ulFcDivisor = 0; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pGetCapacityPins->pProcessContext; - - WriteParams.ulUserChipId = f_pGetCapacityPins->ulUserChipId; - - /* First put the chip and main registers in soft-reset. */ - WriteParams.ulWriteAddress = 0x100; - WriteParams.usWriteData = 0x0; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulFc2PllDivisor = 0x1050; - ulMtDivisor = 0x4300; - ulFcDivisor = 0x4043; - - /* Setup delay chains. */ - if ( (f_pGetCapacityPins->ulMemoryType == cOCT6100_MEM_TYPE_SDR) || (f_pGetCapacityPins->ulMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS) ) - { - /* SDRAM */ - WriteParams.ulWriteAddress = 0x1B0; - WriteParams.usWriteData = 0x1003; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B2; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B4; - WriteParams.usWriteData = 0x4030; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B6; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else /* if ( cOCT6100_MEM_TYPE_DDR == pChipConfig->byMemoryType ) */ - { - /* DDR */ - WriteParams.ulWriteAddress = 0x1B0; - WriteParams.usWriteData = 0x201F; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B2; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B4; - WriteParams.usWriteData = 0x1000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B6; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* udqs */ - WriteParams.ulWriteAddress = 0x1B8; - WriteParams.usWriteData = 0x1003; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1BA; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* ldqs */ - WriteParams.ulWriteAddress = 0x1BC; - WriteParams.usWriteData = 0x1000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1BE; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x12C; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x12E; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Select fc2pll for fast_clk and mtsclk sources. Select mem_clk_i for afclk. */ - WriteParams.ulWriteAddress = 0x140; - WriteParams.usWriteData = (UINT16)ulMtDivisor; - - if ( f_pGetCapacityPins->ulMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS ) - WriteParams.usWriteData |= 0x0001; - else - WriteParams.usWriteData |= 0x0004; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x144; - WriteParams.usWriteData = (UINT16)ulFcDivisor; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x13E; - WriteParams.usWriteData = 0x0001; /* Remove reset from above divisors */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Select upclk directly as ref source for fc2pll. */ - WriteParams.ulWriteAddress = 0x134; - WriteParams.usWriteData = 0x0001; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Setup fc2pll. */ - WriteParams.ulWriteAddress = 0x132; - WriteParams.usWriteData = (UINT16)ulFc2PllDivisor; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.usWriteData |= 0x02; /* Raise fb divisor reset. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.usWriteData |= 0x80; /* Raise IDDTN signal.*/ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Wait for fc2pll to stabilize. */ - aulWaitTime[ 0 ] = 2000; - aulWaitTime[ 1 ] = 0; - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Drive mem_clk_o out on proper interface. */ - if ( TRUE == f_pGetCapacityPins->fEnableMemClkOut ) - { - if ( (f_pGetCapacityPins->ulMemoryType == cOCT6100_MEM_TYPE_SDR) || (f_pGetCapacityPins->ulMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS) ) - { - WriteParams.ulWriteAddress = 0x128; - WriteParams.usWriteData = 0x0301; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - if ( f_pGetCapacityPins->ulMemoryType == cOCT6100_MEM_TYPE_DDR || f_pGetCapacityPins->ulMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS ) - { - WriteParams.ulWriteAddress = 0x12A; - WriteParams.usWriteData = 0x000F; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - return cOCT6100_ERR_OK; -} -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBootFc2Pll - -Description: Configures the chip's FC2 PLL. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiBootFc2Pll -UINT32 Oct6100ApiBootFc2Pll( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHIP_CONFIG pChipConfig; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 aulWaitTime[ 2 ]; - UINT32 ulResult; - UINT32 ulFc2PllDivisor = 0; - UINT32 ulMtDivisor = 0; - UINT32 ulFcDivisor = 0; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain local pointer to chip configuration structure. */ - pChipConfig = &pSharedInfo->ChipConfig; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pChipConfig->ulUserChipId; - - /* First put the chip and main registers in soft-reset. */ - WriteParams.ulWriteAddress = 0x100; - WriteParams.usWriteData = 0x0; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Select register configuration based on the memory frequency. */ - switch ( f_pApiInstance->pSharedInfo->ChipConfig.ulMemClkFreq ) - { - case 133000000: - ulFc2PllDivisor = 0x1050; - ulMtDivisor = 0x4300; - ulFcDivisor = 0x4043; - pSharedInfo->MiscVars.usMaxNumberOfChannels = 672; - pSharedInfo->MiscVars.usMaxH100Speed = 124; - - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - pSharedInfo->MiscVars.usTdmClkBoundary = 0x050B; - else - pSharedInfo->MiscVars.usTdmClkBoundary = 0x0516; - - break; - case 125000000: - ulFc2PllDivisor = 0x0F50; - ulMtDivisor = 0x4300; - ulFcDivisor = 0x4043; - pSharedInfo->MiscVars.usMaxNumberOfChannels = 624; - pSharedInfo->MiscVars.usMaxH100Speed = 116; - - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - pSharedInfo->MiscVars.usTdmClkBoundary = 0x04CA; - else - pSharedInfo->MiscVars.usTdmClkBoundary = 0x04D4; - - break; - case 117000000: - ulFc2PllDivisor = 0x0E50; - ulMtDivisor = 0x4300; - ulFcDivisor = 0x4043; - pSharedInfo->MiscVars.usMaxNumberOfChannels = 576; - pSharedInfo->MiscVars.usMaxH100Speed = 108; - - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - pSharedInfo->MiscVars.usTdmClkBoundary = 0x0489; - else - pSharedInfo->MiscVars.usTdmClkBoundary = 0x0492; - - break; - case 108000000: - ulFc2PllDivisor = 0x0D50; - ulMtDivisor = 0x4300; - ulFcDivisor = 0x4043; - pSharedInfo->MiscVars.usMaxNumberOfChannels = 528; - pSharedInfo->MiscVars.usMaxH100Speed = 99; - - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - pSharedInfo->MiscVars.usTdmClkBoundary = 0x0408; - else - pSharedInfo->MiscVars.usTdmClkBoundary = 0x0410; - - break; - case 100000000: - ulFc2PllDivisor = 0x0C50; - ulMtDivisor = 0x4300; - ulFcDivisor = 0x4043; - pSharedInfo->MiscVars.usMaxNumberOfChannels = 480; - pSharedInfo->MiscVars.usMaxH100Speed = 91; - - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - pSharedInfo->MiscVars.usTdmClkBoundary = 0x03C8; - else - pSharedInfo->MiscVars.usTdmClkBoundary = 0x03D0; - - break; - case 92000000: - ulFc2PllDivisor = 0x0B50; - ulMtDivisor = 0x4300; - ulFcDivisor = 0x4043; - pSharedInfo->MiscVars.usMaxNumberOfChannels = 432; - pSharedInfo->MiscVars.usMaxH100Speed = 83; - - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - pSharedInfo->MiscVars.usTdmClkBoundary = 0x0387; - else - pSharedInfo->MiscVars.usTdmClkBoundary = 0x038E; - - break; - case 83000000: - ulFc2PllDivisor = 0x0A50; - ulMtDivisor = 0x4300; - ulFcDivisor = 0x4043; - pSharedInfo->MiscVars.usMaxNumberOfChannels = 384; - pSharedInfo->MiscVars.usMaxH100Speed = 74; - - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - pSharedInfo->MiscVars.usTdmClkBoundary = 0x0346; - else - pSharedInfo->MiscVars.usTdmClkBoundary = 0x034C; - - break; - case 75000000: - ulFc2PllDivisor = 0x0950; - ulMtDivisor = 0x4200; - ulFcDivisor = 0x4043; - pSharedInfo->MiscVars.usMaxNumberOfChannels = 336; - pSharedInfo->MiscVars.usMaxH100Speed = 64; - - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - pSharedInfo->MiscVars.usTdmClkBoundary = 0x0306; - else - pSharedInfo->MiscVars.usTdmClkBoundary = 0x030C; - - break; - default: - return cOCT6100_ERR_FATAL_DB; - } - - /* Verify that the max channel is not too big based on the chip frequency. */ - if ( pSharedInfo->ChipConfig.usMaxChannels > pSharedInfo->MiscVars.usMaxNumberOfChannels ) - return cOCT6100_ERR_OPEN_MAX_ECHO_CHANNELS; - - /* Setup delay chains. */ - if ( (pChipConfig->byMemoryType == cOCT6100_MEM_TYPE_SDR) || (pChipConfig->byMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS) ) - { - /* SDRAM */ - WriteParams.ulWriteAddress = 0x1B0; - WriteParams.usWriteData = 0x1003; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B2; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B4; - WriteParams.usWriteData = 0x4030; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B6; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else /* if ( cOCT6100_MEM_TYPE_DDR == pChipConfig->byMemoryType ) */ - { - /* DDR */ - WriteParams.ulWriteAddress = 0x1B0; - WriteParams.usWriteData = 0x201F; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B2; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B4; - WriteParams.usWriteData = 0x1000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1B6; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* udqs */ - WriteParams.ulWriteAddress = 0x1B8; - WriteParams.usWriteData = 0x1003; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1BA; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* ldqs */ - WriteParams.ulWriteAddress = 0x1BC; - WriteParams.usWriteData = 0x1000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x1BE; - WriteParams.usWriteData = 0x0021; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x12C; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x12E; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Select fc2pll for fast_clk and mtsclk sources. Select mem_clk_i for afclk. */ - WriteParams.ulWriteAddress = 0x140; - WriteParams.usWriteData = (UINT16)ulMtDivisor; - - if ( f_pApiInstance->pSharedInfo->ChipConfig.byMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS ) - WriteParams.usWriteData |= 0x0001; - else - WriteParams.usWriteData |= 0x0004; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x144; - WriteParams.usWriteData = (UINT16)ulFcDivisor; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x13E; - WriteParams.usWriteData = 0x0001; /* Remove reset from above divisors */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Select upclk directly as ref source for fc2pll. */ - WriteParams.ulWriteAddress = 0x134; - WriteParams.usWriteData = 0x0001; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Setup fc2pll. */ - WriteParams.ulWriteAddress = 0x132; - WriteParams.usWriteData = (UINT16)ulFc2PllDivisor; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.usWriteData |= 0x02; /* Raise fb divisor reset. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.usWriteData |= 0x80; /* Raise IDDTN signal.*/ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Wait for fc2pll to stabilize. */ - aulWaitTime[ 0 ] = 2000; - aulWaitTime[ 1 ] = 0; - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Drive mem_clk_o out on proper interface. */ - if ( TRUE == pChipConfig->fEnableMemClkOut ) - { - if ( (pChipConfig->byMemoryType == cOCT6100_MEM_TYPE_SDR) || (pChipConfig->byMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS) ) - { - WriteParams.ulWriteAddress = 0x128; - WriteParams.usWriteData = 0x0301; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - if ( pChipConfig->byMemoryType == cOCT6100_MEM_TYPE_DDR || pChipConfig->byMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS ) - { - WriteParams.ulWriteAddress = 0x12A; - WriteParams.usWriteData = 0x000F; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiProgramFc1PllReadCap - -Description: Configures the chip's FC1 PLL. Special version for getCapacityPins. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -UINT32 Oct6100ApiProgramFc1PllReadCap( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 aulWaitTime[ 2 ]; - UINT32 ulResult; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pGetCapacityPins->ulUserChipId; - - /* Programm P/Z bits. */ - WriteParams.ulWriteAddress = 0x130; - - if ( f_pGetCapacityPins->ulMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS ) - WriteParams.usWriteData = 0x0041; - else - WriteParams.usWriteData = 0x0040; - - WriteParams.usWriteData |= ( f_pGetCapacityPins->ulMemoryType << 8 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Raise FB divisor. */ - WriteParams.usWriteData |= 0x0002; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Raise IDDTN. */ - WriteParams.usWriteData |= 0x0080; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Wait for fc1pll to stabilize. */ - aulWaitTime[ 0 ] = 2000; - aulWaitTime[ 1 ] = 0; - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Enable all the clock domains to do reset procedure. */ - WriteParams.ulWriteAddress = 0x186; - WriteParams.usWriteData = 0x015F; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - aulWaitTime[ 0 ] = 15000; - aulWaitTime[ 1 ] = 0; - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiProgramFc1Pll - -Description: Configures the chip's FC1 PLL. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiProgramFc1Pll -UINT32 Oct6100ApiProgramFc1Pll( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHIP_CONFIG pChipConfig; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 aulWaitTime[ 2 ]; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain local pointer to chip configuration structure. */ - pChipConfig = &pSharedInfo->ChipConfig; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pChipConfig->ulUserChipId; - - /* Programm P/Z bits. */ - WriteParams.ulWriteAddress = 0x130; - - if ( f_pApiInstance->pSharedInfo->ChipConfig.byMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS ) - WriteParams.usWriteData = 0x0041; - else - WriteParams.usWriteData = 0x0040; - - WriteParams.usWriteData |= ( pChipConfig->byMemoryType << 8 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Raise FB divisor. */ - WriteParams.usWriteData |= 0x0002; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Raise IDDTN. */ - WriteParams.usWriteData |= 0x0080; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Wait for fc1pll to stabilize. */ - aulWaitTime[ 0 ] = 2000; - aulWaitTime[ 1 ] = 0; - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Enable all the clock domains to do reset procedure. */ - WriteParams.ulWriteAddress = 0x186; - WriteParams.usWriteData = 0x015F; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - aulWaitTime[ 0 ] = 15000; - aulWaitTime[ 1 ] = 0; - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBootFc1Pll - -Description: Boot the chip's FC1 PLL. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiBootFc1Pll -UINT32 Oct6100ApiBootFc1Pll( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHIP_CONFIG pChipConfig; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 aulWaitTime[ 2 ]; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain local pointer to chip configuration structure. */ - pChipConfig = &pSharedInfo->ChipConfig; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pChipConfig->ulUserChipId; - - /* Force bist_clk also (it too is used on resetable flops). */ - WriteParams.ulWriteAddress = 0x160; - WriteParams.usWriteData = 0x0188; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Force all cpu clocks on chariot controllers. */ - WriteParams.ulWriteAddress = 0x182; - WriteParams.usWriteData = 0x0002; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x184; - WriteParams.usWriteData = 0x0202; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - aulWaitTime[ 0 ] = 1000; - aulWaitTime[ 1 ] = 0; - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Remove the reset on the entire chip and disable CPU access caching. */ - WriteParams.ulWriteAddress = 0x100; - WriteParams.usWriteData = 0x2003; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Remove the bist_clk. It is no longer needed.*/ - WriteParams.ulWriteAddress = 0x160; - WriteParams.usWriteData = 0x0088; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Disable all clks to prepare for bist clock switchover. */ - WriteParams.ulWriteAddress = 0x182; - WriteParams.usWriteData = 0x0001; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x186; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x184; - WriteParams.usWriteData = 0x0101; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Deassert bist_active */ - WriteParams.ulWriteAddress = 0x160; - WriteParams.usWriteData = 0x0008; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Change CPU interface to normal mode (from boot mode). */ - WriteParams.ulWriteAddress = 0x154; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Give a couple of BIST clock cycles to turn off the BIST permanently. */ - WriteParams.ulWriteAddress = 0x160; - WriteParams.usWriteData = 0x0108; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Turn BIST clock off for the last time. */ - WriteParams.ulWriteAddress = 0x160; - WriteParams.usWriteData = 0x0008; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reset procedure done! */ - - /* Enable mclk for cpu interface and external memory controller. */ - WriteParams.ulWriteAddress = 0x186; - WriteParams.usWriteData = 0x0100; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiLoadImage - -Description: This function writes the firmware image in the external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiLoadImage -UINT32 Oct6100ApiLoadImage( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_BURST_PARAMS BurstParams; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT32 ulTempPtr; - UINT32 ulNumWrites; - PUINT16 pusSuperArray; - unsigned char const *pbyImageFile; - UINT32 ulByteCount = 0; - UINT16 usReadData; - UINT32 ulAddressOfst; - UINT32 i; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Set the process context and user chip ID parameters once and for all. */ - BurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - BurstParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* Breakdown image into subcomponents. */ - ulTempPtr = cOCT6100_IMAGE_FILE_BASE + cOCT6100_IMAGE_AF_CST_OFFSET; - - for(i=0;i<cOCT6100_MAX_IMAGE_REGION;i++) - { - pSharedInfo->ImageRegion[ i ].ulPart1Size = pSharedInfo->ChipConfig.pbyImageFile[ 0x110 + ( i * 4 ) + 0 ]; - pSharedInfo->ImageRegion[ i ].ulPart2Size = pSharedInfo->ChipConfig.pbyImageFile[ 0x110 + ( i * 4 ) + 1 ]; - pSharedInfo->ImageRegion[ i ].ulClockInfo = pSharedInfo->ChipConfig.pbyImageFile[ 0x110 + ( i * 4 ) + 2 ]; - pSharedInfo->ImageRegion[ i ].ulReserved = pSharedInfo->ChipConfig.pbyImageFile[ 0x110 + ( i * 4 ) + 3 ]; - - if (i == 0) /* AF constant. */ - { - pSharedInfo->ImageRegion[ i ].ulPart1BaseAddress = ulTempPtr & 0x07FFFFFF; - pSharedInfo->ImageRegion[ i ].ulPart2BaseAddress = 0; - - ulTempPtr += ( pSharedInfo->ImageRegion[ i ].ulPart1Size * 612 ); - } - else if (i == 1) /* NLP image */ - { - pSharedInfo->ImageRegion[ i ].ulPart1BaseAddress = ulTempPtr & 0x07FFFFFF; - pSharedInfo->ImageRegion[ i ].ulPart2BaseAddress = 0; - - ulTempPtr += ( pSharedInfo->ImageRegion[ i ].ulPart1Size * 2056 ); - } - else /* Others */ - { - pSharedInfo->ImageRegion[ i ].ulPart1BaseAddress = ulTempPtr & 0x07FFFFFF; - ulTempPtr += ( pSharedInfo->ImageRegion[ i ].ulPart1Size * 2064 ); - - pSharedInfo->ImageRegion[ i ].ulPart2BaseAddress = ulTempPtr & 0x07FFFFFF; - ulTempPtr += ( pSharedInfo->ImageRegion[ i ].ulPart2Size * 2448 ); - } - } - - /* Write the image in external memory. */ - ulNumWrites = pSharedInfo->ChipConfig.ulImageSize / 2; - - BurstParams.ulWriteAddress = cOCT6100_IMAGE_FILE_BASE; - BurstParams.pusWriteData = pSharedInfo->MiscVars.ausSuperArray; - - pusSuperArray = pSharedInfo->MiscVars.ausSuperArray; - pbyImageFile = pSharedInfo->ChipConfig.pbyImageFile; - - while ( ulNumWrites != 0 ) - { - if ( ulNumWrites >= pSharedInfo->ChipConfig.usMaxRwAccesses ) - BurstParams.ulWriteLength = pSharedInfo->ChipConfig.usMaxRwAccesses; - else - BurstParams.ulWriteLength = ulNumWrites; - - for ( i = 0; i < BurstParams.ulWriteLength; i++ ) - { - pusSuperArray[ i ] = ( UINT16 )(( pbyImageFile [ ulByteCount++ ]) << 8); - pusSuperArray[ i ] |= ( UINT16 )pbyImageFile [ ulByteCount++ ]; - } - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - BurstParams.ulWriteAddress += 2 * BurstParams.ulWriteLength; - ulNumWrites -= BurstParams.ulWriteLength; - } - - /* Perform a serie of reads to make sure the image was correclty written into memory. */ - ulAddressOfst = ( pSharedInfo->ChipConfig.ulImageSize / 2 ) & 0xFFFFFFFE; - while ( ulAddressOfst != 0 ) - { - ReadParams.ulReadAddress = cOCT6100_IMAGE_FILE_BASE + ulAddressOfst; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( (usReadData >> 8) != pbyImageFile[ ulAddressOfst ] ) - return cOCT6100_ERR_OPEN_IMAGE_WRITE_FAILED; - - ulAddressOfst = (ulAddressOfst / 2) & 0xFFFFFFFE; - } - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCpuRegisterBistReadCap - -Description: Tests the operation of the CPU registers. Special Version for - GetCapacityPins - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -UINT32 Oct6100ApiCpuRegisterBistReadCap( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins - ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT16 i; - UINT16 usReadData; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pGetCapacityPins->ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pGetCapacityPins->ulUserChipId; - - /* Assign read data pointer that will be used throughout the function. */ - ReadParams.pusReadData = &usReadData; - - /* Start with a walking bit test. */ - for ( i = 0; i < 16; i ++ ) - { - /* Write at address 0x150.*/ - WriteParams.ulWriteAddress = 0x150; - WriteParams.usWriteData = (UINT16)( 0x1 << i ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write at address 0x180.*/ - WriteParams.ulWriteAddress = 0x180; - WriteParams.usWriteData = (UINT16)( 0x1 << ( 15 - i ) ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now read back the two registers to make sure the acceses were successfull. */ - ReadParams.ulReadAddress = 0x150; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != ( 0x1 << i ) ) - return cOCT6100_ERR_OPEN_CPU_REG_BIST_ERROR; - - ReadParams.ulReadAddress = 0x180; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != ( 0x1 << ( 15 - i ) ) ) - return cOCT6100_ERR_OPEN_CPU_REG_BIST_ERROR; - } - - /* Write at address 0x150. */ - WriteParams.ulWriteAddress = 0x150; - WriteParams.usWriteData = 0xCAFE; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write at address 0x180. */ - WriteParams.ulWriteAddress = 0x180; - WriteParams.usWriteData = 0xDECA; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now read back the two registers to make sure the acceses were successfull. */ - ReadParams.ulReadAddress = 0x150; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != 0xCAFE ) - return cOCT6100_ERR_OPEN_CPU_REG_BIST_ERROR; - - ReadParams.ulReadAddress = 0x180; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != 0xDECA ) - return cOCT6100_ERR_OPEN_CPU_REG_BIST_ERROR; - - return cOCT6100_ERR_OK; -} -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCpuRegisterBist - -Description: Tests the operation of the CPU registers. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCpuRegisterBist -UINT32 Oct6100ApiCpuRegisterBist( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT16 i; - UINT16 usReadData; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Assign read data pointer that will be used throughout the function. */ - ReadParams.pusReadData = &usReadData; - - /* Start with a walking bit test. */ - for ( i = 0; i < 16; i ++ ) - { - /* Write at address 0x150.*/ - WriteParams.ulWriteAddress = 0x150; - WriteParams.usWriteData = (UINT16)( 0x1 << i ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write at address 0x180.*/ - WriteParams.ulWriteAddress = 0x180; - WriteParams.usWriteData = (UINT16)( 0x1 << ( 15 - i ) ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now read back the two registers to make sure the acceses were successfull. */ - ReadParams.ulReadAddress = 0x150; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != ( 0x1 << i ) ) - return cOCT6100_ERR_OPEN_CPU_REG_BIST_ERROR; - - ReadParams.ulReadAddress = 0x180; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != ( 0x1 << ( 15 - i ) ) ) - return cOCT6100_ERR_OPEN_CPU_REG_BIST_ERROR; - } - - /* Write at address 0x150. */ - WriteParams.ulWriteAddress = 0x150; - WriteParams.usWriteData = 0xCAFE; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write at address 0x180. */ - WriteParams.ulWriteAddress = 0x180; - WriteParams.usWriteData = 0xDECA; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now read back the two registers to make sure the acceses were successfull. */ - ReadParams.ulReadAddress = 0x150; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != 0xCAFE ) - return cOCT6100_ERR_OPEN_CPU_REG_BIST_ERROR; - - ReadParams.ulReadAddress = 0x180; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != 0xDECA ) - return cOCT6100_ERR_OPEN_CPU_REG_BIST_ERROR; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBootSdram - -Description: Configure and test the SDRAM. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiBootSdram -UINT32 Oct6100ApiBootSdram( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHIP_CONFIG pChipConfig; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT16 usReadData; - UINT16 usWriteData23E; - UINT16 usWriteData230; - UINT32 i; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get local pointer to the chip configuration structure.*/ - pChipConfig = &f_pApiInstance->pSharedInfo->ChipConfig; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - usWriteData23E = 0x0000; - usWriteData230 = 0x0000; - - if ( (pSharedInfo->ChipConfig.byMemoryType == cOCT6100_MEM_TYPE_SDR) || (pSharedInfo->ChipConfig.byMemoryType == cOCT6100_MEM_TYPE_SDR_PLL_BYPASS) ) - { - /* SDRAM: */ - switch( pChipConfig->ulMemoryChipSize ) - { - case cOCT6100_MEMORY_CHIP_SIZE_8MB: - usWriteData230 |= ( cOCT6100_16MB_MEMORY_BANKS << 2 ); - break; - case cOCT6100_MEMORY_CHIP_SIZE_16MB: - usWriteData230 |= ( cOCT6100_32MB_MEMORY_BANKS << 2 ); - break; - case cOCT6100_MEMORY_CHIP_SIZE_32MB: - usWriteData230 |= ( cOCT6100_64MB_MEMORY_BANKS << 2 ); - break; - case cOCT6100_MEMORY_CHIP_SIZE_64MB: - usWriteData230 |= ( cOCT6100_128MB_MEMORY_BANKS << 2 ); - break; - default: - return cOCT6100_ERR_FATAL_16; - } - - usWriteData230 |= 0x0002; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Precharge all banks. */ - usWriteData230 &= 0x000C; - usWriteData230 |= 0x0010; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 |= 0x0002; - - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Program the mode register. */ - usWriteData23E = 0x0030; - WriteParams.usWriteData = usWriteData23E; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 &= 0x000C; - usWriteData230 |= 0x0000; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 |= 0x0002; - - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Do CBR refresh (twice) */ - usWriteData230 &= 0x000C; - usWriteData230 |= 0x0040; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 |= 0x0002; - - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else - { - /* DDR: */ - switch( pChipConfig->ulMemoryChipSize ) - { - case cOCT6100_MEMORY_CHIP_SIZE_16MB: - usWriteData230 |= ( cOCT6100_16MB_MEMORY_BANKS << 2 ); - break; - case cOCT6100_MEMORY_CHIP_SIZE_32MB: - usWriteData230 |= ( cOCT6100_32MB_MEMORY_BANKS << 2 ); - break; - case cOCT6100_MEMORY_CHIP_SIZE_64MB: - usWriteData230 |= ( cOCT6100_64MB_MEMORY_BANKS << 2 ); - break; - case cOCT6100_MEMORY_CHIP_SIZE_128MB: - usWriteData230 |= ( cOCT6100_128MB_MEMORY_BANKS << 2 ); - break; - default: - return cOCT6100_ERR_FATAL_17; - } - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Precharge all banks. */ - usWriteData230 &= 0x000C; - usWriteData230 |= 0x0010; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 |= 0x0002; - - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Program DDR mode register. */ - usWriteData23E = 0x4000; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 &= 0x000C; - usWriteData230 |= 0x0000; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 |= 0x0002; - - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Program SDR mode register. */ - usWriteData23E = 0x0161; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 &= 0x000C; - usWriteData230 |= 0x0000; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 |= 0x0002; - - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Precharge all banks. */ - usWriteData23E = 0xFFFF; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 &= 0x000C; - usWriteData230 |= 0x0010; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 |= 0x0002; - - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Do CBR refresh (twice) */ - usWriteData230 &= 0x000C; - usWriteData230 |= 0x0040; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 |= 0x0002; - - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle.*/ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Program SDR mode register. */ - usWriteData23E = 0x0061; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 &= 0x000C; - usWriteData230 |= 0x0000; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - usWriteData230 |= 0x0002; - - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x23E; - WriteParams.usWriteData = usWriteData23E; - for ( i = 0; i < 5; i++ ) - { - /* Wait cycle. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the refresh frequency. */ - WriteParams.ulWriteAddress = 0x242; - WriteParams.usWriteData = 0x0400; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x244; - WriteParams.usWriteData = 0x0200; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x248; - WriteParams.usWriteData = 0x800; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x246; - WriteParams.usWriteData = 0x0012; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Enable the SDRAM and refreshes. */ - usWriteData230 &= 0x000C; - usWriteData230 |= 0x0001; - - WriteParams.ulWriteAddress = 0x230; - WriteParams.usWriteData = usWriteData230; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x246; - WriteParams.usWriteData = 0x0013; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiEnableClocks - -Description: This function will disable clock masking for all the modules - of the chip. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiEnableClocks -UINT32 Oct6100ApiEnableClocks( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Initialize the process context and user chip ID once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Enable tdmie / adpcm mclk clocks. */ - WriteParams.ulWriteAddress = 0x186; - WriteParams.usWriteData = 0x015F; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Configure the DQS register for the DDR memory */ - WriteParams.ulWriteAddress = 0x180; - WriteParams.usWriteData = 0xFF00; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Enable pgsp chariot clocks */ - WriteParams.ulWriteAddress = 0x182; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Enable af/mt chariot clocks */ - WriteParams.ulWriteAddress = 0x184; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiProgramNLP - -Description: This function will write image values to configure the NLP. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiProgramNLP -UINT32 Oct6100ApiProgramNLP( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHIP_CONFIG pChipConfig; - UINT32 ulResult; - UINT16 usReadData; - UINT16 usReadHighData; - BOOL fBitEqual; - UINT32 ulEgoEntry[4]; - UINT32 ulTempAddress; - UINT32 ulAfCpuUp = FALSE; - UINT32 i; - UINT32 ulLoopCounter = 0; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get local pointer to the chip configuration structure.*/ - pChipConfig = &f_pApiInstance->pSharedInfo->ChipConfig; - - /* Initialize the process context and user chip ID once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Initialize the process context and user chip ID once and for all. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - if ( pSharedInfo->ChipConfig.fEnableProductionBist == TRUE ) - { - UINT32 ulReadData; - UINT32 ulBitPattern; - UINT32 j, k; - - /* Since the pouch section (256 bytes) will not be tested by the firmware, */ - /* the API has to make sure this section is working correctly. */ - for ( k = 0; k < 2; k ++ ) - { - if ( k == 0 ) - ulBitPattern = 0x1; - else - ulBitPattern = 0xFFFFFFFE; - - for ( j = 0; j < 32; j ++ ) - { - /* Write the DWORDs. */ - for ( i = 0; i < 64; i ++ ) - { - ulResult = Oct6100ApiWriteDword( f_pApiInstance, cOCT6100_POUCH_BASE + i * 4, ulBitPattern << j ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Read the DWORDs. */ - for ( i = 0; i < 64; i ++ ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, cOCT6100_POUCH_BASE + i * 4, &ulReadData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the value matches. */ - if ( ( ulBitPattern << j ) != ulReadData ) - return cOCT6100_ERR_OPEN_PRODUCTION_BIST_POUCH_ERROR; - } - } - } - } - - /* Write the image info in the chip. */ - WriteParams.ulWriteAddress = cOCT6100_PART1_END_STATICS_BASE; - WriteParams.usWriteData = (UINT16)( ( pSharedInfo->ImageRegion[ 0 ].ulPart1BaseAddress >> 16 ) & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( pSharedInfo->ImageRegion[ 0 ].ulPart1BaseAddress & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - for( i = 0; i < 8; i++ ) - { - if ( pSharedInfo->ImageRegion[ i + 2 ].ulPart1Size != 0 ) - { - WriteParams.ulWriteAddress = cOCT6100_PART1_END_STATICS_BASE + 0x4 + ( i * 0xC ); - WriteParams.usWriteData = (UINT16)(( pSharedInfo->ImageRegion[ i + 2 ].ulPart1BaseAddress >> 16 ) & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( pSharedInfo->ImageRegion[ i + 2 ].ulPart1BaseAddress & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - if ( pSharedInfo->ImageRegion[ i + 2 ].ulPart2Size != 0 ) - { - WriteParams.ulWriteAddress = cOCT6100_PART1_END_STATICS_BASE + 0x4 + ( i * 0xC ) + 4; - WriteParams.usWriteData = (UINT16)(( pSharedInfo->ImageRegion[ i + 2 ].ulPart2BaseAddress >> 16 ) & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( pSharedInfo->ImageRegion[ i + 2 ].ulPart2BaseAddress & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - WriteParams.ulWriteAddress = cOCT6100_PART1_END_STATICS_BASE + 0x4 + ( i * 0xC ) + 8; - WriteParams.usWriteData = 0x0000; - WriteParams.usWriteData |= ( pSharedInfo->ImageRegion[ i + 2 ].ulPart1Size << 8 ); - WriteParams.usWriteData |= pSharedInfo->ImageRegion[ i + 2 ].ulPart2Size; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = 0x0000; - WriteParams.usWriteData |= ( pSharedInfo->ImageRegion[ i + 2 ].ulClockInfo << 8 ); - WriteParams.usWriteData |= pSharedInfo->ImageRegion[ i + 2 ].ulReserved; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Put NLP in config mode. */ - WriteParams.ulWriteAddress = 0x2C2; - WriteParams.usWriteData = 0x160E; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x692; - WriteParams.usWriteData = 0x010A; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Upload the up to 8 NLP pages + 1 AF page (for timing reasons). */ - for ( i = 0; i < pSharedInfo->ImageRegion[ 1 ].ulPart1Size; i++ ) - { - ulResult = Oct6100ApiCreateEgoEntry( cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + pSharedInfo->ImageRegion[ 1 ].ulPart1BaseAddress + 1028 * ( i * 2 ), 0x1280, 1024, &(ulEgoEntry[0])); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiCreateEgoEntry( cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + pSharedInfo->ImageRegion[ 1 ].ulPart1BaseAddress + 1028 * (( i * 2 ) + 1 ), 0x1680, 1024, &(ulEgoEntry[2])); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiRunEgo( f_pApiInstance, FALSE, 2, ulEgoEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Shift mt chariot memories. This process will complete by the time */ - /* the next LSU transfer is done. */ - WriteParams.ulWriteAddress = 0x692; - WriteParams.usWriteData = 0x010B; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiWaitForPcRegisterBit( f_pApiInstance, 0x692, 0, 0, 100000, &fBitEqual ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - if ( TRUE != fBitEqual ) - return cOCT6100_ERR_FATAL_1A; - } - - /* 1 AF page (for timing reasons). */ - ulResult = Oct6100ApiCreateEgoEntry( cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + pSharedInfo->ImageRegion[ 2 ].ulPart1BaseAddress + (516 * 0), 0x1280, 512, &(ulEgoEntry[0])); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiCreateEgoEntry( cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + pSharedInfo->ImageRegion[ 2 ].ulPart1BaseAddress + (516 * 1), 0x1480, 512, &(ulEgoEntry[2])); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiRunEgo( f_pApiInstance, FALSE, 2, ulEgoEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiCreateEgoEntry( cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + pSharedInfo->ImageRegion[ 2 ].ulPart1BaseAddress + (516 * 2), 0x1680, 512, &(ulEgoEntry[0])); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiCreateEgoEntry( cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + pSharedInfo->ImageRegion[ 2 ].ulPart1BaseAddress + (516 * 3), 0x1880, 512, &(ulEgoEntry[2])); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiRunEgo( f_pApiInstance, FALSE, 2, ulEgoEntry ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write constant memory init context position in channel "672" for pgsp. */ - WriteParams.ulWriteAddress = 0x71A; - WriteParams.usWriteData = 0x8000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set fixed PGSP event_in base address to 800 on a 2k boundary */ - WriteParams.ulWriteAddress = 0x716; - WriteParams.usWriteData = 0x800 >> 11; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set fixed PGSP event_out to 0x2C0000h on a 16k boundary */ - WriteParams.ulWriteAddress = 0x71C; - WriteParams.usWriteData = 0x2C0000 >> 14; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Give chariot control of the chip. */ - WriteParams.ulWriteAddress = 0x712; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + 0x2C0000 + 0xC; - ulTempAddress = 0x300000 + 0x0800; - WriteParams.usWriteData = (UINT16)( ( ulTempAddress >> 16 ) & 0x07FF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + 0x2C0000 + 0xE; - WriteParams.usWriteData = (UINT16)( ( ulTempAddress >> 0 ) & 0xFF00 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write the init PGSP event in place. */ - WriteParams.ulWriteAddress = cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + 0x800; - WriteParams.usWriteData = 0x0200; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + 0x802; - WriteParams.usWriteData = 0x02A0; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Also write the register 710, which tells PGSP how many tones are supported. */ - WriteParams.ulWriteAddress = 0x710; - WriteParams.usWriteData = 0x0000; - WriteParams.usWriteData |= pChipConfig->pbyImageFile[ 0x7FA ] << 8; - WriteParams.usWriteData |= pChipConfig->pbyImageFile[ 0x7FB ] << 0; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Start both processors in the NLP. */ - WriteParams.ulWriteAddress = 0x373FE; - WriteParams.usWriteData = 0x00FF; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x37BFE; - WriteParams.usWriteData = 0x00FE; /* Tell processor 1 to just go to sleep. */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x37FC6; - WriteParams.usWriteData = 0x8004; /* First PC.*/ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x37FD0; - WriteParams.usWriteData = 0x0002; /* Take out of reset. */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x37FD2; - WriteParams.usWriteData = 0x0002; /* Take out of reset. */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Start processor in the AF. */ - for ( i = 0; i < 16; i ++ ) - { - WriteParams.ulWriteAddress = cOCT6100_POUCH_BASE + ( i * 2 ); - if ( i == 9 ) - { - if ( pSharedInfo->ChipConfig.fEnableProductionBist == TRUE ) - { - if (pSharedInfo->ChipConfig.ulProductionBistMode == cOCT6100_PRODUCTION_BIST_SHORT) - WriteParams.usWriteData = cOCT6100_PRODUCTION_SHORT_BOOT_TYPE; - else - WriteParams.usWriteData = cOCT6100_PRODUCTION_BOOT_TYPE; - } - else - { - WriteParams.usWriteData = cOCT6100_AF_BOOT_TYPE; - } - } - else - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Check if the production BIST mode was requested. */ - if ( pSharedInfo->ChipConfig.fEnableProductionBist == TRUE ) - { - UINT32 ulTotalElements = 3; - UINT32 ulCrcKey; - UINT32 aulMessage[ 4 ]; - UINT32 ulWriteAddress = 0x20 + cOCT6100_EXTERNAL_MEM_BASE_ADDRESS; - - /* Magic key. */ - aulMessage[ 0 ] = 0xCAFECAFE; - /* Memory size. */ - aulMessage[ 1 ] = pSharedInfo->MiscVars.ulTotalMemSize; - /* Loop count. */ - aulMessage[ 2 ] = pSharedInfo->ChipConfig.ulNumProductionBistLoops; - /* CRC initialized. */ - aulMessage[ 3 ] = 0; - - ulResult = Oct6100ApiProductionCrc( f_pApiInstance, aulMessage, ulTotalElements, &ulCrcKey ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - aulMessage[ 3 ] = ulCrcKey; - - /* Write the message to the external memory. */ - for ( i = 0; i < ulTotalElements + 1; i ++ ) - { - ulResult = Oct6100ApiWriteDword( f_pApiInstance, ulWriteAddress + i * 4, aulMessage[ i ] ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - WriteParams.ulWriteAddress = 0xFFFC6; - WriteParams.usWriteData = 0x1284; /* First PC.*/ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0xFFFD0; - WriteParams.usWriteData = 0x0002; /* Take out of reset. */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - while ( ulAfCpuUp == FALSE ) - { - if ( ulAfCpuUp == FALSE ) - { - ReadParams.ulReadAddress = cOCT6100_POUCH_BASE; - ReadParams.pusReadData = &usReadHighData; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ReadParams.ulReadAddress += 2; - ReadParams.pusReadData = &usReadData; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( pSharedInfo->ChipConfig.fEnableProductionBist == TRUE ) - { - /* Should read 0x0007 when bisting. */ - if ( (( usReadHighData & 0xFFFF ) == cOCT6100_PRODUCTION_BOOT_TYPE) || - (( usReadHighData & 0xFFFF ) == cOCT6100_PRODUCTION_SHORT_BOOT_TYPE) ) - { - /* Verify if the bist has started successfully. */ - if ( ( usReadData & 0xFFFF ) == 0x0002 ) - return cOCT6100_ERR_OPEN_PRODUCTION_BIST_CONF_FAILED; - else if ( ( usReadData & 0xFFFF ) != 0xEEEE ) - return cOCT6100_ERR_OPEN_PRODUCTION_BOOT_FAILED; - - ulAfCpuUp = TRUE; - } - } - else /* if ( pSharedInfo->ChipConfig.fEnableProductionBist == FALSE ) */ - { - if ( ( usReadHighData & 0xFFFF ) == cOCT6100_AF_BOOT_TYPE ) - { - /* Verify if the bist succeeded. */ - if ( ( usReadData & 0xFFFF ) != 0x0000 ) - return cOCT6100_ERR_OPEN_FUNCTIONAL_BIST_FAILED; - - ulAfCpuUp = TRUE; - } - } - } - - ulLoopCounter++; - - if ( ulLoopCounter == cOCT6100_MAX_LOOP_CPU_TIMEOUT ) - return cOCT6100_ERR_OPEN_AF_CPU_TIMEOUT; - } - - /* Return NLP in operationnal mode. */ - WriteParams.ulWriteAddress = 0x2C2; - WriteParams.usWriteData = 0x060E; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x692; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiSetH100Register - -Description: This function will configure the H.100 registers. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiSetH100Register -UINT32 Oct6100ApiSetH100Register( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHIP_CONFIG pChipConfig; - UINT32 i; - UINT32 ulOffset; - BOOL fAllStreamAt2Mhz = TRUE; - const UINT16 ausAdpcmResetContext[32] = { 0x1100, 0x0220, 0x0000, 0x0000, 0x0000, 0x0020, 0x0000, 0x0000, 0x0008, 0x0000, 0x0000, 0x0100, 0x0000, 0x0020, 0x0000, 0x0000, 0x0000, 0x0002, 0x0000, 0x0000, 0x0040, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x0000, 0x0010, 0x0000, 0x0000, 0x0000}; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get local pointer to the chip configuration structure. */ - pChipConfig = &f_pApiInstance->pSharedInfo->ChipConfig; - - /* Initialize the process context and user chip ID once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Set the Global OE bit. */ - WriteParams.ulWriteAddress = 0x300; - WriteParams.usWriteData = 0x0004; - - /* Set the number of streams. */ - switch( pChipConfig->byMaxTdmStreams ) - { - case 32: - WriteParams.usWriteData |= ( 0 << 3 ); - break; - case 16: - WriteParams.usWriteData |= ( 1 << 3 ); - break; - case 8: - WriteParams.usWriteData |= ( 2 << 3 ); - break; - case 4: - WriteParams.usWriteData |= ( 3 << 3 ); - break; - default: - break; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Configure the stream frequency. */ - WriteParams.ulWriteAddress = 0x330; - WriteParams.usWriteData = 0x0000; - for ( i = 0; i < (UINT32)(pChipConfig->byMaxTdmStreams / 4); i++) - { - ulOffset = i*2; - switch( pChipConfig->aulTdmStreamFreqs[ i ] ) - { - case cOCT6100_TDM_STREAM_FREQ_2MHZ: - WriteParams.usWriteData |= ( 0x0 << ulOffset ); - break; - case cOCT6100_TDM_STREAM_FREQ_4MHZ: - WriteParams.usWriteData |= ( 0x1 << ulOffset ); - fAllStreamAt2Mhz = FALSE; - break; - case cOCT6100_TDM_STREAM_FREQ_8MHZ: - WriteParams.usWriteData |= ( 0x2 << ulOffset ); - fAllStreamAt2Mhz = FALSE; - break; - default: - break; - } - } - - /* Set the stream to 16 MHz if the fast H.100 mode is selected. */ - if ( pChipConfig->fEnableFastH100Mode == TRUE ) - { - fAllStreamAt2Mhz = FALSE; - WriteParams.usWriteData = 0xFFFF; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - { - /* Make the chip track both clock A and B to perform fast H.100 mode. */ - WriteParams.ulWriteAddress = 0x322; - WriteParams.usWriteData = 0x0004; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Enable the fast H.100 mode. */ - WriteParams.ulWriteAddress = 0x332; - WriteParams.usWriteData = 0x0003; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - WriteParams.ulWriteAddress = 0x376; - WriteParams.usWriteData = (UINT16)( pSharedInfo->MiscVars.usTdmClkBoundary ); - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Select delay for early clock (90 and 110). */ - WriteParams.ulWriteAddress = 0x378; - if ( pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - WriteParams.usWriteData = 0x000A; - else - { - /* Set the TDM sampling. */ - if ( pSharedInfo->ChipConfig.byTdmSampling == cOCT6100_TDM_SAMPLE_AT_RISING_EDGE ) - { - WriteParams.usWriteData = 0x0AF0; - } - else if ( pSharedInfo->ChipConfig.byTdmSampling == cOCT6100_TDM_SAMPLE_AT_FALLING_EDGE ) - { - WriteParams.usWriteData = 0x0A0F; - } - else /* pSharedInfo->ChipConfig.ulTdmSampling == cOCT6100_TDM_SAMPLE_AT_3_QUARTERS */ - { - WriteParams.usWriteData = 0x0A08; - } - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Protect chip by preventing too rapid timeslot arrival (mclk == 133 MHz). */ - WriteParams.ulWriteAddress = 0x37A; - WriteParams.usWriteData = (UINT16)pSharedInfo->MiscVars.usMaxH100Speed; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Allow H.100 TS to progress. */ - WriteParams.ulWriteAddress = 0x382; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set by-pass mode. */ - WriteParams.ulWriteAddress = 0x50E; - WriteParams.usWriteData = 0x0001; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* TDMIE bits. */ - WriteParams.ulWriteAddress = 0x500; - WriteParams.usWriteData = 0x0003; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write normal ADPCM reset values in ADPCM context 1344. */ - for(i=0;i<32;i++) - { - WriteParams.ulWriteAddress = 0x140000 + ( 0x40 * 1344 ) + ( i * 2 ); - WriteParams.usWriteData = ausAdpcmResetContext[i]; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Make sure delay flops are configured correctly if all streams are at 2 MHz. */ - if ( fAllStreamAt2Mhz == TRUE ) - { - /* Setup H.100 sampling to lowest value. */ - WriteParams.ulWriteAddress = 0x144; - WriteParams.usWriteData = 0x4041; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x378; - WriteParams.usWriteData = 0x0A00; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteMiscellaneousRegisters - -Description: This function will write to various registers to activate the chip. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteMiscellaneousRegisters -UINT32 Oct6100ApiWriteMiscellaneousRegisters( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Initialize the process context and user chip ID once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Free the interrupt pin of the chip (i.e. remove minimum time requirement between interrupts). */ - WriteParams.ulWriteAddress = 0x214; - WriteParams.usWriteData = 0x0000; - if ( f_pApiInstance->pSharedInfo->ChipConfig.byInterruptPolarity == cOCT6100_ACTIVE_HIGH_POLARITY ) - WriteParams.usWriteData |= 0x4000; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write MT chariot interval */ - WriteParams.ulWriteAddress = 0x2C2; - if ( f_pApiInstance->pSharedInfo->ImageInfo.usMaxNumberOfChannels > 640 ) - WriteParams.usWriteData = 0x05EA; - else if ( f_pApiInstance->pSharedInfo->ImageInfo.usMaxNumberOfChannels > 513 ) - WriteParams.usWriteData = 0x0672; - else /* if ( f_pApiInstance->pSharedInfo->ImageInfo.usMaxNumberOfChannels <= 513 ) */ - WriteParams.usWriteData = 0x0750; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write set second part5 time. */ - WriteParams.ulWriteAddress = 0x2C4; - WriteParams.usWriteData = 0x04A0; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write CPU bucket timer to guarantee 200 cycles between each CPU access. */ - WriteParams.ulWriteAddress = 0x234; - WriteParams.usWriteData = 0x0804; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x236; - WriteParams.usWriteData = 0x0100; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCreateSerializeObjects - -Description: Creates a handle to each serialization object used by the API. - - Note that in a multi-process system the user's process context - structure pointer is needed by this function. Thus, the - pointer must be valid. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulUserChipId User chip ID for this serialization object. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCreateSerializeObjects -UINT32 Oct6100ApiCreateSerializeObjects( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulUserChipId ) -{ - tOCT6100_CREATE_SERIALIZE_OBJECT CreateSerObj; - UINT32 ulResult; - CHAR szSerObjName[ 64 ] = "Oct6100ApiXXXXXXXXApiSerObj"; - - - /* Set some parameters of the create structure once and for all. */ - CreateSerObj.pProcessContext = f_pApiInstance->pProcessContext; - CreateSerObj.pszSerialObjName = szSerObjName; - - /*----------------------------------------------------------------------*/ - /* Set the chip ID in the semaphore name. */ - szSerObjName[ 10 ] = (CHAR) Oct6100ApiHexToAscii( (f_ulUserChipId >> 28 ) & 0xFF ); - szSerObjName[ 11 ] = (CHAR) Oct6100ApiHexToAscii( (f_ulUserChipId >> 24 ) & 0xFF ); - szSerObjName[ 12 ] = (CHAR) Oct6100ApiHexToAscii( (f_ulUserChipId >> 20 ) & 0xFF ); - szSerObjName[ 13 ] = (CHAR) Oct6100ApiHexToAscii( (f_ulUserChipId >> 16 ) & 0xFF ); - szSerObjName[ 14 ] = (CHAR) Oct6100ApiHexToAscii( (f_ulUserChipId >> 12 ) & 0xFF ); - szSerObjName[ 15 ] = (CHAR) Oct6100ApiHexToAscii( (f_ulUserChipId >> 8 ) & 0xFF ); - szSerObjName[ 16 ] = (CHAR) Oct6100ApiHexToAscii( (f_ulUserChipId >> 4 ) & 0xFF ); - szSerObjName[ 17 ] = (CHAR) Oct6100ApiHexToAscii( (f_ulUserChipId >> 0 ) & 0xFF ); - - ulResult = Oct6100UserCreateSerializeObject( &CreateSerObj ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - f_pApiInstance->ulApiSerObj = CreateSerObj.ulSerialObjHndl; - /*----------------------------------------------------------------------*/ - - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiDestroySerializeObjects - -Description: Destroy handles to each serialization object used by the API. - - Note that in a multi-process system the user's process context - structure pointer is needed by this function. Thus, the - pointer must be valid. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiDestroySerializeObjects -UINT32 Oct6100ApiDestroySerializeObjects( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tOCT6100_DESTROY_SERIALIZE_OBJECT DestroySerObj; - UINT32 ulResult; - - /* Set some parameters of the create structure once and for all. */ - DestroySerObj.pProcessContext = f_pApiInstance->pProcessContext; - DestroySerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - - ulResult = Oct6100UserDestroySerializeObject( &DestroySerObj ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRunEgo - -Description: Private function used to communicate with the internal processors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_fStoreFlag Type of access performed. (Load or Store) -f_ulNumEntry Number of access. -f_aulEntry Array of access to perform. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRunEgo -UINT32 Oct6100ApiRunEgo( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN BOOL f_fStoreFlag, - IN UINT32 f_ulNumEntry, - OUT PUINT32 f_aulEntry ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHIP_CONFIG pChipConfig; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT32 aulCpuLsuCmd[ 2 ]; - UINT16 usReadData; - UINT32 i; - BOOL fConditionFlag = TRUE; - UINT32 ulLoopCounter = 0; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get local pointer to the chip configuration structure. */ - pChipConfig = &f_pApiInstance->pSharedInfo->ChipConfig; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* No more than 2 entries may be requested. */ - if ( f_ulNumEntry > 2 ) - return cOCT6100_ERR_FATAL_1B; - - /* Write the requested entries at address reserved for CPU. */ - for( i = 0; i < f_ulNumEntry; i++ ) - { - WriteParams.ulWriteAddress = cOCT6100_PART1_API_SCRATCH_PAD + ( 0x8 * i ); - WriteParams.usWriteData = (UINT16)(( f_aulEntry[ i * 2 ] >> 16 ) & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( f_aulEntry[ i * 2 ] & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)(( f_aulEntry[ (i * 2) + 1] >> 16 ) & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( f_aulEntry[ (i * 2) + 1] & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Preincrement code point. */ - pSharedInfo->MiscVars.usCodepoint++; - - /* Create DWORD 0 of command. */ - aulCpuLsuCmd[0] = 0x00000000; - if ( f_fStoreFlag == FALSE ) - aulCpuLsuCmd[0] |= 0xC0000000; /* EGO load. */ - else - aulCpuLsuCmd[0] |= 0xE0000000; /* EGO store. */ - - aulCpuLsuCmd[0] |= (f_ulNumEntry - 1) << 19; - aulCpuLsuCmd[0] |= cOCT6100_PART1_API_SCRATCH_PAD; - - /* Create DWORD 1 of command. */ - aulCpuLsuCmd[1] = 0x00000000; - aulCpuLsuCmd[1] |= ( ( cOCT6100_PART1_API_SCRATCH_PAD + 0x10 ) & 0xFFFF ) << 16; - aulCpuLsuCmd[1] |= pSharedInfo->MiscVars.usCodepoint; - - /* Write the EGO command in the LSU CB. */ - WriteParams.ulWriteAddress = cOCT6100_PART1_CPU_LSU_CB_BASE + ((pSharedInfo->MiscVars.usCpuLsuWritePtr & 0x7) * 0x8 ); - WriteParams.usWriteData = (UINT16)(( aulCpuLsuCmd[ 0 ] >> 16 ) & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( aulCpuLsuCmd[ 0 ] & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)(( aulCpuLsuCmd[ 1 ] >> 16 ) & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( aulCpuLsuCmd[ 1 ] & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Post increment the write pointer. */ - pSharedInfo->MiscVars.usCpuLsuWritePtr++; - - /* Indicate new write pointer position to HW. */ - WriteParams.ulWriteAddress = cOCT6100_PART1_EGO_REG + 0x5A; - WriteParams.usWriteData = (UINT16)( pSharedInfo->MiscVars.usCpuLsuWritePtr & 0x7 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Wait for codepoint to be updated before returning. */ - while( fConditionFlag ) - { - ReadParams.ulReadAddress = cOCT6100_PART1_API_SCRATCH_PAD + 0x12; - usReadData = (UINT16)( pSharedInfo->MiscVars.usCodepoint ); - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData == pSharedInfo->MiscVars.usCodepoint ) - fConditionFlag = FALSE; - - ulLoopCounter++; - - if ( ulLoopCounter == cOCT6100_MAX_LOOP ) - return cOCT6100_ERR_OPEN_EGO_TIMEOUT; - } - - /* CRC error bit must be zero. */ - ReadParams.ulReadAddress = 0x202; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( ( usReadData & 0x0400 ) != 0 ) - return cOCT6100_ERR_OPEN_CORRUPTED_IMAGE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCreateEgoEntry - -Description: Private function used to create an access structure to be sent - to the internal processors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_ulExternalAddress External memory address for the access. -f_ulInternalAddress Which process should receive the command. -f_ulNumBytes Number of bytes associated to the access. -f_aulEntry Array of access to perform. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCreateEgoEntry -UINT32 Oct6100ApiCreateEgoEntry( - IN UINT32 f_ulExternalAddress, - IN UINT32 f_ulInternalAddress, - IN UINT32 f_ulNumBytes, - OUT UINT32 f_aulEntry[ 2 ] ) -{ - f_aulEntry[0] = 0x80000000; - f_aulEntry[0] |= f_ulExternalAddress & 0x07FFFFFC; - - f_aulEntry[1] = 0x0011C000; - f_aulEntry[1] |= (f_ulNumBytes / 8) << 23; - f_aulEntry[1] |= (f_ulInternalAddress >> 2) & 0x3FFF; - - return cOCT6100_ERR_OK; -} -#endif - - - - - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInitChannels - -Description: This function will initialize all the channels to power down. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInitChannels -UINT32 Oct6100ApiInitChannels( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 i; - UINT32 ulResult; - tOCT6100_WRITE_BURST_PARAMS BurstParams; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT16 usReadData; - UINT32 ulTempData; - UINT32 ulBaseAddress; - UINT32 ulFeatureBytesOffset; - UINT32 ulFeatureBitOffset; - UINT32 ulFeatureFieldLength; - UINT32 ulMask; - UINT16 ausWriteData[ 4 ]; - UINT16 usLoopCount = 0; - UINT16 usWriteData = 0; - UINT16 usMclkRead; - UINT16 usLastMclkRead; - UINT16 usMclkDiff; - UINT32 ulNumberOfCycleToWait; - UINT32 ulTimeoutCounter; - - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - BurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - BurstParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - BurstParams.pusWriteData = ausWriteData; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* Verify that the image has enough memory to work correctly. */ - if ( ( pSharedInfo->MiscVars.ulTotalMemSize + cOCT6100_EXTERNAL_MEM_BASE_ADDRESS ) < pSharedInfo->MemoryMap.ulFreeMemBaseAddress ) - return cOCT6100_ERR_OPEN_INSUFFICIENT_EXTERNAL_MEMORY; - - /* Verify that the tail length is supported by the device.*/ - if ( pSharedInfo->ChipConfig.usTailDisplacement > pSharedInfo->ImageInfo.usMaxTailDisplacement ) - return cOCT6100_ERR_NOT_SUPPORTED_OPEN_TAIL_DISPLACEMENT_VALUE; - - /* Verify that acoustic echo is supported by the device. */ - if ( pSharedInfo->ChipConfig.fEnableAcousticEcho == TRUE && pSharedInfo->ImageInfo.fAcousticEcho == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_OPEN_ACOUSTIC_ECHO; - - /* Verify that the image supports all the requested channels. */ - if ( pSharedInfo->ChipConfig.usMaxChannels > pSharedInfo->ImageInfo.usMaxNumberOfChannels ) - return cOCT6100_ERR_NOT_SUPPORTED_OPEN_MAX_ECHO_CHANNELS_VALUE; - - /* Max number of channels the image supports + 1 for channel recording, if requested */ - if ( ( pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE ) - && ( pSharedInfo->ImageInfo.usMaxNumberOfChannels < cOCT6100_MAX_ECHO_CHANNELS ) - && ( pSharedInfo->ChipConfig.usMaxChannels == pSharedInfo->ImageInfo.usMaxNumberOfChannels ) ) - return cOCT6100_ERR_NOT_SUPPORTED_OPEN_MAX_ECHO_CHANNELS_VALUE; - - /* Initialize the memory for all required channels. */ - for( i = 0; i < f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels; i++ ) - { - /*==============================================================================*/ - /* Configure the Global Static Configuration memory of the channel. */ - - ulBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( i * cOCT6100_CHANNEL_ROOT_SIZE ) + cOCT6100_CHANNEL_ROOT_GLOBAL_CONF_OFFSET; - - /* Set the PGSP context base address. */ - ulTempData = pSharedInfo->MemoryMap.ulChanMainMemBase + ( i * pSharedInfo->MemoryMap.ulChanMainMemSize ) + cOCT6100_CH_MAIN_PGSP_CONTEXT_OFFSET; - - WriteParams.ulWriteAddress = ulBaseAddress + cOCT6100_GSC_PGSP_CONTEXT_BASE_ADD_OFFSET; - WriteParams.usWriteData = (UINT16)( ulTempData >> 16 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( ulTempData & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the PGSP init context base address. */ - ulTempData = ( cOCT6100_IMAGE_FILE_BASE + 0x200 ) & 0x07FFFFFF; - - WriteParams.ulWriteAddress = ulBaseAddress + cOCT6100_GSC_PGSP_INIT_CONTEXT_BASE_ADD_OFFSET; - WriteParams.usWriteData = (UINT16)( ulTempData >> 16 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( ulTempData & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the RIN circular buffer base address. */ - ulTempData = pSharedInfo->MemoryMap.ulChanMainMemBase + ( i * pSharedInfo->MemoryMap.ulChanMainMemSize ) + pSharedInfo->MemoryMap.ulChanMainRinCBMemOfst; - - /* Set the circular buffer size. */ - ulTempData &= 0xFFFFFF00; - if (( pSharedInfo->MemoryMap.ulChanMainRinCBMemSize & 0xFFFF00FF ) != 0 ) - return cOCT6100_ERR_CHANNEL_INVALID_RIN_CB_SIZE; - ulTempData |= pSharedInfo->MemoryMap.ulChanMainRinCBMemSize >> 8; - - WriteParams.ulWriteAddress = ulBaseAddress + cOCT6100_GSC_RIN_CIRC_BUFFER_BASE_ADD_OFFSET; - WriteParams.usWriteData = (UINT16)( ulTempData >> 16 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( ulTempData & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the SIN circular buffer base address. */ - ulTempData = pSharedInfo->MemoryMap.ulChanMainMemBase + ( i * pSharedInfo->MemoryMap.ulChanMainMemSize ) + pSharedInfo->MemoryMap.ulChanMainSinCBMemOfst; - - WriteParams.ulWriteAddress = ulBaseAddress + cOCT6100_GSC_SIN_CIRC_BUFFER_BASE_ADD_OFFSET; - WriteParams.usWriteData = (UINT16)( ulTempData >> 16 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( ulTempData & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the SOUT circular buffer base address. */ - ulTempData = pSharedInfo->MemoryMap.ulChanMainMemBase + ( i * pSharedInfo->MemoryMap.ulChanMainMemSize ) + pSharedInfo->MemoryMap.ulChanMainSoutCBMemOfst;; - - WriteParams.ulWriteAddress = ulBaseAddress + cOCT6100_GSC_SOUT_CIRC_BUFFER_BASE_ADD_OFFSET; - WriteParams.usWriteData = (UINT16)( ulTempData >> 16 ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)( ulTempData & 0xFFFF ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==============================================================================*/ - } - - /* Put all channel in powerdown mode "3". */ - for( i = 0; i < f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels; i++ ) - { - WriteParams.ulWriteAddress = 0x014000 + (i*4) + 0; - WriteParams.usWriteData = 0x85FF; /* TSI index 1535 reserved for power-down mode */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x014000 + (i*4) + 2; - WriteParams.usWriteData = 0xC5FF; /* TSI index 1535 reserved for power-down mode */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Set the maximum number of channels. */ - WriteParams.ulWriteAddress = 0x690; - if ( pSharedInfo->ImageInfo.usMaxNumberOfChannels < 384 ) - WriteParams.usWriteData = 384; - else - WriteParams.usWriteData = (UINT16)pSharedInfo->ImageInfo.usMaxNumberOfChannels; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set power-dowm TSI chariot memory to silence. */ - for( i = 0; i < 6; i++ ) - { - WriteParams.ulWriteAddress = 0x20000 + ( i * 0x1000 ) + ( 1534 * 2 ); - WriteParams.usWriteData = 0x3EFF; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x20000 + ( i * 0x1000 ) + ( 1535 * 2 ); - WriteParams.usWriteData = 0x3EFF; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Remove chariot hold. */ - WriteParams.ulWriteAddress = 0x500; - WriteParams.usWriteData = 0x0001; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - for( usLoopCount = 0; usLoopCount < 4096; usLoopCount++ ) - { - if ( (usLoopCount % 16) < 8 ) - { - usWriteData = (UINT16)((usLoopCount / 16) << 7); - usWriteData |= (UINT16)((usLoopCount % 8)); - } - else - { - usWriteData = (UINT16)((usLoopCount / 16) << 7); - usWriteData |= (UINT16)((usLoopCount % 8)); - usWriteData |= 0x78; - } - - /* Set timeslot pointer. */ - WriteParams.ulWriteAddress = 0x50E; - WriteParams.usWriteData = 0x0003; - WriteParams.usWriteData |= usWriteData << 2; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now read the mclk counter. */ - ReadParams.ulReadAddress = 0x30A; - ReadParams.pusReadData = &usLastMclkRead; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reset loop timeout counter. */ - ulTimeoutCounter = 0x0; - - do { - ReadParams.pusReadData = &usMclkRead; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( ( usLoopCount % 16 ) != 15 ) - { - ulNumberOfCycleToWait = 133; - } - else - { - ulNumberOfCycleToWait = 20000; - } - - /* Evaluate the difference. */ - usMclkDiff = (UINT16)(( usMclkRead - usLastMclkRead ) & 0xFFFF); - - /* Check for loop timeout. Bad mclk? */ - ulTimeoutCounter++; - if ( ulTimeoutCounter == cOCT6100_MAX_LOOP_CPU_TIMEOUT ) - return cOCT6100_ERR_FATAL_EA; - - } while( usMclkDiff <= ulNumberOfCycleToWait ); - } - - /* Back to normal mode. */ - WriteParams.ulWriteAddress = 0x50E; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check for CRC errors. */ - ReadParams.pusReadData = &usReadData; - ReadParams.ulReadAddress = 0x202; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( (usReadData & 0x400) != 0x0000 ) - return cOCT6100_ERR_OPEN_CRC_ERROR; - - /* Clear the error rol raised by manually moving the clocks. */ - WriteParams.ulWriteAddress = 0x502; - WriteParams.usWriteData = 0x0002; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*======================================================================*/ - /* Write the tail displacement value in external memory. */ - - ulFeatureBytesOffset = pSharedInfo->MemoryMap.PouchTailDisplOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.PouchTailDisplOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.PouchTailDisplOfst.byFieldSize; - - ulResult = Oct6100ApiReadDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - &ulTempData ); - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set the tail displacement. */ - ulTempData |= (pSharedInfo->ChipConfig.usTailDisplacement << ulFeatureBitOffset ); - - /* Write the DWORD where the field is located. */ - ulResult = Oct6100ApiWriteDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - ulTempData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*======================================================================*/ - - - /*======================================================================*/ - /* Clear the pouch counter, if present. */ - - if ( pSharedInfo->DebugInfo.fPouchCounter == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.PouchCounterFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.PouchCounterFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.PouchCounterFieldOfst.byFieldSize; - - ulResult = Oct6100ApiReadDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - &ulTempData ); - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - /* Clear counter! */ - ulTempData &= (~ulMask); - - /* Write the DWORD where the field is located.*/ - ulResult = Oct6100ApiWriteDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - ulTempData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* The ISR has not yet been called. Set the appropriate bit in external memory. */ - if ( pSharedInfo->DebugInfo.fIsIsrCalledField == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.IsIsrCalledFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.IsIsrCalledFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.IsIsrCalledFieldOfst.byFieldSize; - - ulResult = Oct6100ApiReadDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - &ulTempData ); - - /* Read previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - /* Toggle the bit to '1'. */ - ulTempData |= 1 << ulFeatureBitOffset; - - /* Write the DWORD where the field is located.*/ - ulResult = Oct6100ApiWriteDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - ulTempData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInitToneInfo - -Description: This function will parse the software image and retrieve - the information about the tones that it supports. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInitToneInfo -UINT32 Oct6100ApiInitToneInfo( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - UINT32 ulResult; - - unsigned char const *pszToneInfoStart = NULL; - unsigned char const *pszToneInfoEnd = NULL; - - unsigned char const *pszCurrentInfo; - unsigned char const *pszNextInfo; - - UINT32 ulToneEventNumber; - UINT32 ulTempValue; - UINT32 ulNumCharForValue; - UINT32 ulUniqueToneId; - UINT32 ulToneNameSize; - UINT32 ulOffset = 0; - - UINT32 i; - - /* Init the tone detector parameter. */ - f_pApiInstance->pSharedInfo->ImageInfo.byNumToneDetectors = 0; - - /* Find the start and the end of the tone info section. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.ulImageSize > 4096 ) - { - /* For performance reasons, and since the tone detector information */ - /* is always located at the end of the image file, try to start from the end */ - /* of the buffer. */ - - ulOffset = f_pApiInstance->pSharedInfo->ChipConfig.ulImageSize - 2048; - pszToneInfoStart = Oct6100ApiStrStr( f_pApiInstance->pSharedInfo->ChipConfig.pbyImageFile + ulOffset, - (PUINT8)cOCT6100_TONE_INFO_START_STRING, - f_pApiInstance->pSharedInfo->ChipConfig.pbyImageFile + f_pApiInstance->pSharedInfo->ChipConfig.ulImageSize ); - - /* Check if the information was found. */ - if ( pszToneInfoStart == NULL ) - { - /* Try again, but giving a larger string to search. */ - ulOffset = f_pApiInstance->pSharedInfo->ChipConfig.ulImageSize - 4096; - pszToneInfoStart = Oct6100ApiStrStr( f_pApiInstance->pSharedInfo->ChipConfig.pbyImageFile + ulOffset, - (PUINT8)cOCT6100_TONE_INFO_START_STRING, - f_pApiInstance->pSharedInfo->ChipConfig.pbyImageFile + f_pApiInstance->pSharedInfo->ChipConfig.ulImageSize ); - - } - } - - if ( pszToneInfoStart == NULL ) - { - /* Travel through the whole file buffer. */ - pszToneInfoStart = Oct6100ApiStrStr( f_pApiInstance->pSharedInfo->ChipConfig.pbyImageFile, - (PUINT8)cOCT6100_TONE_INFO_START_STRING, - f_pApiInstance->pSharedInfo->ChipConfig.pbyImageFile + f_pApiInstance->pSharedInfo->ChipConfig.ulImageSize ); - } - /* We have to return immediatly if no tones are found. */ - if ( pszToneInfoStart == NULL ) - return cOCT6100_ERR_OK; - - /* The end of the tone detector information is after the beginning of the tone information. */ - pszToneInfoEnd = Oct6100ApiStrStr( pszToneInfoStart, - (PUINT8)cOCT6100_TONE_INFO_STOP_STRING, - f_pApiInstance->pSharedInfo->ChipConfig.pbyImageFile + f_pApiInstance->pSharedInfo->ChipConfig.ulImageSize ); - if ( pszToneInfoEnd == NULL ) - return cOCT6100_ERR_OPEN_TONE_INFO_STOP_TAG_NOT_FOUND; - - /* Find and process all tone events within the region. */ - pszCurrentInfo = Oct6100ApiStrStr( pszToneInfoStart, (PUINT8)cOCT6100_TONE_INFO_EVENT_STRING, pszToneInfoEnd ); - - while ( pszCurrentInfo != NULL ) - { - /* Skip the string. */ - pszCurrentInfo += ( Oct6100ApiStrLen( (PUINT8)cOCT6100_TONE_INFO_EVENT_STRING ) ); - - /* Extract the number of char used to represent the tone event number ( 1 or 2 ). */ - pszNextInfo = Oct6100ApiStrStr( pszCurrentInfo, (PUINT8)",", pszToneInfoEnd ); - ulNumCharForValue = (UINT32)( pszNextInfo - pszCurrentInfo ); - - /* Retreive the event number */ - ulToneEventNumber = 0; - for ( i = ulNumCharForValue; i > 0; i-- ) - { - ulResult = Oct6100ApiAsciiToHex( *pszCurrentInfo, &ulTempValue ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulToneEventNumber |= ( ulTempValue << (( i - 1) * 4 ) ); - pszCurrentInfo++; - } - - if ( ulToneEventNumber >= cOCT6100_MAX_TONE_EVENT ) - return cOCT6100_ERR_OPEN_INVALID_TONE_EVENT; - - /* Skip the comma and the 0x. */ - pszCurrentInfo += 3; - - /*======================================================================*/ - /* Retreive the unique tone id. */ - ulUniqueToneId = 0; - for ( i = 0; i < 8; i++ ) - { - ulResult = Oct6100ApiAsciiToHex( *pszCurrentInfo, &ulTempValue ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulOffset = 28 - ( i * 4 ); - ulUniqueToneId |= ( ulTempValue << ulOffset ); - pszCurrentInfo++; - } - - /*======================================================================*/ - - /* Skip the comma. */ - pszCurrentInfo++; - - /* Find out where the next event info starts */ - pszNextInfo = Oct6100ApiStrStr( pszCurrentInfo,(PUINT8) cOCT6100_TONE_INFO_EVENT_STRING, pszToneInfoEnd ); - if ( pszNextInfo == NULL ) - pszNextInfo = pszToneInfoEnd; - - /* Extract the name size. */ - ulToneNameSize = (UINT32)( pszNextInfo - pszCurrentInfo - 2 ); /* - 2 for 0x0D and 0x0A.*/ - - if ( ulToneNameSize > cOCT6100_TLV_MAX_TONE_NAME_SIZE ) - return cOCT6100_ERR_OPEN_INVALID_TONE_NAME; - - /* Copy the tone name into the image info structure. */ - ulResult = Oct6100UserMemCopy( f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ ulToneEventNumber ].aszToneName, - pszCurrentInfo, - ulToneNameSize ); - - - - /* Update the tone info into the image info structure. */ - f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ ulToneEventNumber ].ulToneID = ulUniqueToneId; - /* Find out the port on which this tone detector is associated. */ - switch( (ulUniqueToneId >> 28) & 0xF ) - { - case 1: - f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ ulToneEventNumber ].ulDetectionPort = cOCT6100_CHANNEL_PORT_ROUT; - break; - - case 2: - f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ ulToneEventNumber ].ulDetectionPort = cOCT6100_CHANNEL_PORT_SIN; - break; - - case 4: - f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ ulToneEventNumber ].ulDetectionPort = cOCT6100_CHANNEL_PORT_SOUT; - break; - - case 5: - f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ ulToneEventNumber ].ulDetectionPort = cOCT6100_CHANNEL_PORT_ROUT_SOUT; - break; - - default: - f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ ulToneEventNumber ].ulDetectionPort = cOCT6100_INVALID_PORT; - break; - } - - /* Find out where the next event info starts */ - pszNextInfo = Oct6100ApiStrStr( pszCurrentInfo,(PUINT8) cOCT6100_TONE_INFO_EVENT_STRING, pszToneInfoEnd ); - /* Update the current info pointer. */ - pszCurrentInfo = pszNextInfo; - - f_pApiInstance->pSharedInfo->ImageInfo.byNumToneDetectors++; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiExternalMemoryBist - -Description: Tests the functionality of the external memories. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiExternalMemoryBist -UINT32 Oct6100ApiExternalMemoryBist( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulMemSize = 0; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Test the external memory. */ - switch ( pSharedInfo->ChipConfig.ulMemoryChipSize ) - { - case cOCT6100_MEMORY_CHIP_SIZE_8MB: - ulMemSize = cOCT6100_SIZE_8M; - break; - case cOCT6100_MEMORY_CHIP_SIZE_16MB: - ulMemSize = cOCT6100_SIZE_16M; - break; - case cOCT6100_MEMORY_CHIP_SIZE_32MB: - ulMemSize = cOCT6100_SIZE_32M; - break; - case cOCT6100_MEMORY_CHIP_SIZE_64MB: - ulMemSize = cOCT6100_SIZE_64M; - break; - case cOCT6100_MEMORY_CHIP_SIZE_128MB: - ulMemSize = cOCT6100_SIZE_128M; - break; - default: - return cOCT6100_ERR_FATAL_D9; - } - - ulMemSize *= pSharedInfo->ChipConfig.byNumMemoryChips; - - ulResult = Oct6100ApiRandomMemoryWrite( f_pApiInstance, cOCT6100_EXTERNAL_MEM_BASE_ADDRESS, ulMemSize, 16, 1000, cOCT6100_ERR_OPEN_EXTERNAL_MEM_BIST_FAILED ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Make sure the user I/O functions are working as required. */ - ulResult = Oct6100ApiUserIoTest( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGenerateNumber - -Description: Generate a number using an index. Passing the same - index generates the same number. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_ulIndex Index used to generate the random number. -f_ulDataMask Data mask to apply to generated number. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGenerateNumber -UINT16 Oct6100ApiGenerateNumber( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulIndex, - IN UINT32 f_ulDataMask ) -{ - UINT16 usGeneratedNumber; - - usGeneratedNumber = (UINT16)( ( ( ~( f_ulIndex - 1 ) ) & 0xFF00 ) | ( ( f_ulIndex + 1 ) & 0xFF ) ); - - return (UINT16)( usGeneratedNumber & f_ulDataMask ); -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRandomMemoryWrite - -Description: Writes to f_ulNumAccesses random locations in the indicated - memory and read back to test the operation of that memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_ulMemBase Base address of the memory access. -f_ulMemSize Size of the memory to be tested. -f_ulNumDataBits Number of data bits. -f_ulNumAccesses Number of random access to be perform. -f_ulErrorCode Error code to be returned if the bist fails. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRandomMemoryWrite -UINT32 Oct6100ApiRandomMemoryWrite( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulMemBase, - IN UINT32 f_ulMemSize, - IN UINT32 f_ulNumDataBits, - IN UINT32 f_ulNumAccesses, - IN UINT32 f_ulErrorCode ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulDataMask; - UINT32 ulResult, i, j; - UINT32 ulBistAddress; - UINT16 usReadData; - UINT32 aulBistAddress[20]={0x00000000, 0x00000002, 0x00000004, 0x007FFFFE, - 0x00900000, 0x00900006, 0x00900008, 0x009FFFFE, - 0x01000000, 0x0100000A, 0x0200000C, 0x01FFFFFE, - 0x03000000, 0x03000002, 0x04000004, 0x03FFFFFE, - 0x04000000, 0x05000006, 0x06000008, 0x07FFFFFE}; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Determine mask for number of data bits. */ - ulDataMask = (1 << f_ulNumDataBits) - 1; - - /* Write specific data to specific address */ - WriteParams.ulWriteAddress = f_ulMemBase | 0x00001000; - WriteParams.usWriteData = 0xCAFE; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - for(j=0; j<20; j++) - { - /* Change address to test lower and higher part of the 32 bit bus */ - ulBistAddress = aulBistAddress[j]; - ulBistAddress &= f_ulMemSize - 2; - ulBistAddress |= f_ulMemBase; - - /* Bist 16 data pins of this address */ - for ( i = 0; i < 16; i ++) - { - WriteParams.ulWriteAddress = ulBistAddress; - WriteParams.usWriteData = (UINT16)(0x1 << i); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Read back the specific data to flush the data bus.*/ - ReadParams.ulReadAddress = f_ulMemBase | 0x00001000; - ReadParams.pusReadData = &usReadData; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != 0xCAFE ) - return f_ulErrorCode; - - /* Read back the data written.*/ - ReadParams.ulReadAddress = WriteParams.ulWriteAddress; - ReadParams.pusReadData = &usReadData; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != (UINT16)(0x1 << i) ) - return f_ulErrorCode; - } - } - - /* Perform the first write at address 0 + mem base */ - j = 0; - WriteParams.ulWriteAddress = f_ulMemBase; - WriteParams.usWriteData = Oct6100ApiGenerateNumber( f_pApiInstance, j, ulDataMask ); - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Try each address line of the memory. */ - for ( i = 2, j = 1; i < f_ulMemSize; i <<= 1, j++ ) - { - WriteParams.ulWriteAddress = ( f_ulMemBase + i ); - WriteParams.usWriteData = Oct6100ApiGenerateNumber( f_pApiInstance, j, ulDataMask ); - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - for ( i = 0; i < j; i++ ) - { - if ( i > 0 ) - ReadParams.ulReadAddress = ( f_ulMemBase + ( 0x1 << i ) ); - else - ReadParams.ulReadAddress = f_ulMemBase; - ReadParams.pusReadData = &usReadData; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData != Oct6100ApiGenerateNumber( f_pApiInstance, i, ulDataMask ) ) - return f_ulErrorCode; - } - - /* Write to random addresses of the memory. */ - for ( i = 0; i < f_ulNumAccesses; i++ ) - { - ulBistAddress = (UINT16)Oct6100ApiGenerateNumber( f_pApiInstance, i, 0xFFFF ) << 16; - ulBistAddress |= (UINT16)Oct6100ApiGenerateNumber( f_pApiInstance, i, 0xFFFF ); - ulBistAddress &= f_ulMemSize - 2; - ulBistAddress |= f_ulMemBase; - - WriteParams.ulWriteAddress = ulBistAddress; - WriteParams.usWriteData = Oct6100ApiGenerateNumber( f_pApiInstance, i, 0xFFFF ); - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - for ( i = 0; i < f_ulNumAccesses; i++ ) - { - ulBistAddress = (UINT16)Oct6100ApiGenerateNumber( f_pApiInstance, i, 0xFFFF ) << 16; - ulBistAddress |= (UINT16)Oct6100ApiGenerateNumber( f_pApiInstance, i, 0xFFFF ); - ulBistAddress &= f_ulMemSize - 2; - ulBistAddress |= f_ulMemBase; - - ReadParams.ulReadAddress = ulBistAddress; - ReadParams.pusReadData = &usReadData; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( ( usReadData & ulDataMask ) != ( Oct6100ApiGenerateNumber( f_pApiInstance, i, 0xFFFF ) & ulDataMask ) ) - return f_ulErrorCode; - } - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUserIoTest - -Description: This function will verify the correct functionality of - the following user functions: - - - Oct6100UserDriverWriteBurstApi - - Oct6100UserDriverWriteSmearApi - - Oct6100UserDriverReadBurstApi - - The Oct6100UserDriverWriteApi and Oct6100UserDriverReadApi - functions do not need to be tested here as this has be done in - the external memory bisting function above. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUserIoTest -UINT32 Oct6100ApiUserIoTest( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_BURST_PARAMS WriteBurstParams; - tOCT6100_WRITE_SMEAR_PARAMS WriteSmearParams; - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_READ_BURST_PARAMS ReadBurstParams; - UINT32 ulResult, i; - UINT16 usReadData; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteBurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteBurstParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - /* Test what the user has specified is the maximum that can be used for a burst. */ - WriteBurstParams.ulWriteLength = pSharedInfo->ChipConfig.usMaxRwAccesses; - WriteBurstParams.pusWriteData = pSharedInfo->MiscVars.ausSuperArray; - - WriteSmearParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteSmearParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - /* Test what the user has specified is the maximum that can be used for a smear. */ - WriteSmearParams.ulWriteLength = pSharedInfo->ChipConfig.usMaxRwAccesses; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - ReadBurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadBurstParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - /* Test what the user has specified is the maximum that can be used for a burst. */ - ReadBurstParams.ulReadLength = pSharedInfo->ChipConfig.usMaxRwAccesses; - ReadBurstParams.pusReadData = pSharedInfo->MiscVars.ausSuperArray; - - - /*======================================================================*/ - /* Write burst check. */ - - WriteBurstParams.ulWriteAddress = cOCT6100_EXTERNAL_MEM_BASE_ADDRESS; - /* Set the random data to be written. */ - for ( i = 0; i < WriteBurstParams.ulWriteLength; i++ ) - { - WriteBurstParams.pusWriteData[ i ] = Oct6100ApiGenerateNumber( f_pApiInstance, i, 0xFFFF ); - } - mOCT6100_DRIVER_WRITE_BURST_API( WriteBurstParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Read back pattern using simple read function and make sure we are reading what's expected. */ - ReadParams.ulReadAddress = WriteBurstParams.ulWriteAddress; - for ( i = 0; i < WriteBurstParams.ulWriteLength; i++ ) - { - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the data matches. */ - if ( usReadData != WriteBurstParams.pusWriteData[ i ] ) - { - /* The values do not match. Something seems to be wrong with the WriteBurst user function. */ - return cOCT6100_ERR_OPEN_USER_WRITE_BURST_FAILED; - } - - /* Next address to check. */ - ReadParams.ulReadAddress += 2; - } - - /*======================================================================*/ - - - /*======================================================================*/ - /* Write smear check. */ - - WriteSmearParams.ulWriteAddress = cOCT6100_EXTERNAL_MEM_BASE_ADDRESS + ( WriteBurstParams.ulWriteLength * 2 ); - /* Set the random data to be written. */ - WriteSmearParams.usWriteData = Oct6100ApiGenerateNumber( f_pApiInstance, Oct6100ApiRand( 0xFFFF ), 0xFFFF ); - mOCT6100_DRIVER_WRITE_SMEAR_API( WriteSmearParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Read back pattern using simple read function and make sure we are reading what's expected. */ - ReadParams.ulReadAddress = WriteSmearParams.ulWriteAddress; - for ( i = 0; i < WriteSmearParams.ulWriteLength; i++ ) - { - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the data matches. */ - if ( usReadData != WriteSmearParams.usWriteData ) - { - /* The values do not match. Something seems to be wrong with the WriteSmear user function. */ - return cOCT6100_ERR_OPEN_USER_WRITE_SMEAR_FAILED; - } - - /* Next address to check. */ - ReadParams.ulReadAddress += 2; - } - - /*======================================================================*/ - - - /*======================================================================*/ - /* Read burst check. */ - - /* First check with what the WriteBurst function wrote. */ - ReadBurstParams.ulReadAddress = WriteBurstParams.ulWriteAddress; - mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - for ( i = 0; i < ReadBurstParams.ulReadLength; i++ ) - { - /* Check if the data matches. */ - if ( ReadBurstParams.pusReadData[ i ] != Oct6100ApiGenerateNumber( f_pApiInstance, i, 0xFFFF ) ) - { - /* The values do not match. Something seems to be wrong with the ReadBurst user function. */ - return cOCT6100_ERR_OPEN_USER_READ_BURST_FAILED; - } - } - - /* Then check with what the WriteSmear function wrote. */ - ReadBurstParams.ulReadAddress = WriteSmearParams.ulWriteAddress; - mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - for ( i = 0; i < ReadBurstParams.ulReadLength; i++ ) - { - /* Check if the data matches. */ - if ( ReadBurstParams.pusReadData[ i ] != WriteSmearParams.usWriteData ) - { - /* The values do not match. Something seems to be wrong with the ReadBurst user function. */ - return cOCT6100_ERR_OPEN_USER_READ_BURST_FAILED; - } - } - - /*======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiExternalMemoryInit - -Description: Initialize the external memory before uploading the image. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiExternalMemoryInit -UINT32 Oct6100ApiExternalMemoryInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_SMEAR_PARAMS SmearParams; - UINT32 ulTotalWordToWrite; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - SmearParams.pProcessContext = f_pApiInstance->pProcessContext; - - SmearParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Clear the first part of the memory. */ - ulTotalWordToWrite = 0x400; - SmearParams.ulWriteAddress = cOCT6100_EXTERNAL_MEM_BASE_ADDRESS; - - while ( ulTotalWordToWrite != 0 ) - { - if ( ulTotalWordToWrite >= pSharedInfo->ChipConfig.usMaxRwAccesses ) - SmearParams.ulWriteLength = pSharedInfo->ChipConfig.usMaxRwAccesses; - else - SmearParams.ulWriteLength = ulTotalWordToWrite; - - SmearParams.usWriteData = 0x0; - - mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the number of words to write. */ - ulTotalWordToWrite -= SmearParams.ulWriteLength; - /* Update the address. */ - SmearParams.ulWriteAddress += ( SmearParams.ulWriteLength * 2 ); - } - - /* Clear the TLV flag.*/ - ulResult = Oct6100ApiWriteDword( f_pApiInstance, cOCT6100_TLV_BASE, 0x0 ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInitMixer - -Description: This function will initialize the mixer memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInitMixer -UINT32 Oct6100ApiInitMixer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_BURST_PARAMS BurstParams; - UINT16 ausWriteData[ 4 ]; - UINT32 ulResult; - - pSharedInfo = f_pApiInstance->pSharedInfo; - - BurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - BurstParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - BurstParams.pusWriteData = ausWriteData; - /*======================================================================*/ - /* Initialize the mixer memory if required. */ - if ( pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE ) - { - /* Modify the mixer pointer by adding the record event into the link list. */ - pSharedInfo->MixerInfo.usFirstSinCopyEventPtr = pSharedInfo->MixerInfo.usRecordSinEventIndex; - pSharedInfo->MixerInfo.usLastSinCopyEventPtr = pSharedInfo->MixerInfo.usRecordSinEventIndex; - pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr = pSharedInfo->MixerInfo.usRecordCopyEventIndex; - pSharedInfo->MixerInfo.usLastSoutCopyEventPtr = pSharedInfo->MixerInfo.usRecordCopyEventIndex; - - /* Program the Sin copy event. */ - BurstParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pSharedInfo->MixerInfo.usRecordSinEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - BurstParams.ulWriteLength = 4; - - ausWriteData[ 0 ] = 0x0000; - ausWriteData[ 1 ] = 0x0000; - ausWriteData[ 2 ] = (UINT16)(cOCT6100_MIXER_TAIL_NODE & 0x7FF); /* Head node.*/ - ausWriteData[ 3 ] = 0x0000; - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Program the Sout copy event. */ - BurstParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pSharedInfo->MixerInfo.usRecordCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - BurstParams.ulWriteLength = 4; - - ausWriteData[ 0 ] = 0x0000; - ausWriteData[ 1 ] = 0x0000; - ausWriteData[ 2 ] = (UINT16)(pSharedInfo->MixerInfo.usRecordSinEventIndex & 0x7FF); - ausWriteData[ 3 ] = 0x0000; - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Configure the head node. */ - BurstParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE; - BurstParams.ulWriteLength = 4; - - ausWriteData[ 0 ] = 0x0000; - ausWriteData[ 1 ] = 0x0000; - ausWriteData[ 2 ] = (UINT16)(pSharedInfo->MixerInfo.usRecordCopyEventIndex & 0x7FF); - ausWriteData[ 3 ] = 0x0000; - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Init the mixer pointer */ - pSharedInfo->MixerInfo.usFirstSinCopyEventPtr = pSharedInfo->MixerInfo.usRecordSinEventIndex; - } - else - { - /* Configure the head node. */ - BurstParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE; - BurstParams.ulWriteLength = 4; - - ausWriteData[ 0 ] = 0x0000; - ausWriteData[ 1 ] = 0x0000; - ausWriteData[ 2 ] = (UINT16)(cOCT6100_MIXER_TAIL_NODE & 0x7FF); /* Head node. */ - ausWriteData[ 3 ] = 0x0000; - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Configure the tail node. */ - BurstParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + 0x10; - BurstParams.ulWriteLength = 4; - - ausWriteData[ 0 ] = 0x0000; - ausWriteData[ 1 ] = 0x0000; - ausWriteData[ 2 ] = (UINT16)(cOCT6100_MIXER_HEAD_NODE & 0x7FF); /* Head node. */ - ausWriteData[ 3 ] = 0x0000; - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInitRecordResources - -Description: This function will initialize the resources required to - perform recording on a debug channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInitRecordResources -UINT32 Oct6100ApiInitRecordResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult; - - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check if recording is enabled. */ - if ( pSharedInfo->ChipConfig.fEnableChannelRecording == FALSE ) - return cOCT6100_ERR_OK; - - if ( pSharedInfo->DebugInfo.usRecordMemIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_NOT_SUPPORTED_OPEN_DEBUG_RECORD; - - /* Check the provided recording memory index within the SSPX. */ - if ( pSharedInfo->DebugInfo.usRecordMemIndex != ( pSharedInfo->ImageInfo.usMaxNumberOfChannels - 1 ) ) - return cOCT6100_ERR_OPEN_DEBUG_MEM_INDEX; - - /* Reserve the TSI entries for the channel. */ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, &pSharedInfo->DebugInfo.usRecordRinRoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, &pSharedInfo->DebugInfo.usRecordSinSoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Open the debug channel. */ - ulResult = Oct6100ApiDebugChannelOpen( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100FreeResourcesSer - -Description: This function closes all opened channels and frees all - specified global resources used by the chip. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pFreeResources Pointer to user structure in which to choose what - to free. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100FreeResourcesSer -UINT32 Oct6100FreeResourcesSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_FREE_RESOURCES f_pFreeResources ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry; - - UINT32 ulResult; - UINT32 i; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Close all bidirectional channels. */ - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxBiDirChannels; i ++ ) - { - tPOCT6100_API_BIDIR_CHANNEL pBiDirChanEntry; - - mOCT6100_GET_BIDIR_CHANNEL_ENTRY_PNT( pSharedInfo, pBiDirChanEntry, i ); - - if ( pBiDirChanEntry->fReserved == TRUE ) - { - tOCT6100_CHANNEL_DESTROY_BIDIR DestroyBidir; - - Oct6100ChannelDestroyBiDirDef( &DestroyBidir ); - - DestroyBidir.ulBiDirChannelHndl = cOCT6100_HNDL_TAG_BIDIR_CHANNEL | (pBiDirChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | i; - - ulResult = Oct6100ChannelDestroyBiDirSer( f_pApiInstance, &DestroyBidir ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Close all bridge participants. */ - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxChannels; i ++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, i ); - if ( pChanEntry->fReserved == TRUE && pChanEntry->usBridgeIndex != cOCT6100_INVALID_INDEX ) - { - /* This channel is on a bridge. */ - tOCT6100_CONF_BRIDGE_CHAN_REMOVE BridgeChanRemove; - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - - Oct6100ConfBridgeChanRemoveDef( &BridgeChanRemove ); - - /* Obtain a pointer to the conference bridge's list entry. */ - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, pChanEntry->usBridgeIndex ); - - BridgeChanRemove.fRemoveAll = TRUE; - BridgeChanRemove.ulConfBridgeHndl = cOCT6100_HNDL_TAG_CONF_BRIDGE | (pBridgeEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | pChanEntry->usBridgeIndex; - - ulResult = Oct6100ConfBridgeChanRemoveSer( f_pApiInstance, &BridgeChanRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Close all opened channels. This will bring the broadcast TSSTs with it. */ - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxChannels; i ++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, i ); - - if ( pChanEntry->fReserved == TRUE ) - { - tOCT6100_CHANNEL_CLOSE ChannelClose; - - /* Generate handle. */ - ChannelClose.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | (pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | i; - - /* Call serialized close channel function. */ - ulResult = Oct6100ChannelCloseSer( f_pApiInstance, &ChannelClose ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /* Close all TSI connections. */ - if ( f_pFreeResources->fFreeTsiConnections == TRUE ) - { - tPOCT6100_API_TSI_CNCT pTsiCnct; - tOCT6100_TSI_CNCT_CLOSE TsiCnctClose; - - Oct6100TsiCnctCloseDef( &TsiCnctClose ); - - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxTsiCncts; i ++ ) - { - /* Obtain a pointer to the TSI connection list entry. */ - mOCT6100_GET_TSI_CNCT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTsiCnct, i ); - - if ( pTsiCnct->fReserved == TRUE ) - { - TsiCnctClose.ulTsiCnctHndl = cOCT6100_HNDL_TAG_TSI_CNCT | (pTsiCnct->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | i; - - ulResult = Oct6100TsiCnctCloseSer( f_pApiInstance, &TsiCnctClose ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - /* Close all conference bridges. */ - if ( f_pFreeResources->fFreeConferenceBridges == TRUE ) - { - tPOCT6100_API_CONF_BRIDGE pConfBridge; - tOCT6100_CONF_BRIDGE_CLOSE ConfBridgeClose; - - Oct6100ConfBridgeCloseDef( &ConfBridgeClose ); - - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxConfBridges; i ++ ) - { - /* Obtain a pointer to the conference bridge's list entry. */ - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pConfBridge, i ); - - if ( pConfBridge->fReserved == TRUE ) - { - ConfBridgeClose.ulConfBridgeHndl = cOCT6100_HNDL_TAG_CONF_BRIDGE | (pConfBridge->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | i; - - ulResult = Oct6100ConfBridgeCloseSer( f_pApiInstance, &ConfBridgeClose ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - - /* Free all playout buffers loaded in external memory. */ - if ( f_pFreeResources->fFreePlayoutBuffers == TRUE ) - { - tPOCT6100_API_BUFFER pBuffer; - tOCT6100_BUFFER_UNLOAD BufferUnload; - - Oct6100BufferPlayoutUnloadDef( &BufferUnload ); - - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxPlayoutBuffers; i ++ ) - { - - - /* Obtain a pointer to the buffer list entry. */ - mOCT6100_GET_BUFFER_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBuffer, i ); - - if ( pBuffer->fReserved == TRUE ) - { - BufferUnload.ulBufferIndex = i; - ulResult = Oct6100BufferUnloadSer( f_pApiInstance, &BufferUnload, TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - - /* Close all phasing TSSTs. */ - if ( f_pFreeResources->fFreePhasingTssts == TRUE ) - { - tPOCT6100_API_PHASING_TSST pPhasingTsst; - tOCT6100_PHASING_TSST_CLOSE PhasingTsstClose; - - Oct6100PhasingTsstCloseDef( &PhasingTsstClose ); - - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxPhasingTssts; i ++ ) - { - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( pSharedInfo, pPhasingTsst, i ); - - if ( pPhasingTsst->fReserved == TRUE ) - { - PhasingTsstClose.ulPhasingTsstHndl = cOCT6100_HNDL_TAG_PHASING_TSST | (pPhasingTsst->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | i; - - ulResult = Oct6100PhasingTsstCloseSer( f_pApiInstance, &PhasingTsstClose ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - /* Close all ADPCM channels. */ - if ( f_pFreeResources->fFreeAdpcmChannels == TRUE ) - { - tPOCT6100_API_ADPCM_CHAN pAdpcmChannel; - tOCT6100_ADPCM_CHAN_CLOSE AdpcmChanClose; - - Oct6100AdpcmChanCloseDef( &AdpcmChanClose ); - - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxAdpcmChannels; i ++ ) - { - mOCT6100_GET_ADPCM_CHAN_ENTRY_PNT( pSharedInfo, pAdpcmChannel, i ); - if ( pAdpcmChannel->fReserved == TRUE ) - { - AdpcmChanClose.ulChanHndl = cOCT6100_HNDL_TAG_ADPCM_CHANNEL | (pAdpcmChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | i; - - ulResult = Oct6100AdpcmChanCloseSer( f_pApiInstance, &AdpcmChanClose ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ProductionBistSer - -Description: This function returns the instantaneous production BIST status. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pProductionBist Pointer to user structure in which BIST status will - be returned. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ProductionBistSer -UINT32 Oct6100ProductionBistSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_PRODUCTION_BIST f_pProductionBist ) -{ - UINT32 ulCalculatedCrc = cOCT6100_INVALID_VALUE; - UINT32 ulResult; - UINT32 ulLoopCnt = 0x0; - UINT32 i = 1; - UINT32 ulTotalElements = 4; - UINT32 ulReadAddress = cOCT6100_POUCH_BASE; - UINT32 aulMessage[ 5 ]; - - /* Check if the production bist has been activated. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.fEnableProductionBist == FALSE ) - return cOCT6100_ERR_PRODUCTION_BIST_DISABLED; - - f_pProductionBist->ulCurrentAddress = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulCurrentLoop = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulCurrentTest = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulFailedAddress = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulReadValue = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulExpectedValue = cOCT6100_INVALID_VALUE; - f_pProductionBist->ulBistStatus = cOCT6100_BIST_IN_PROGRESS; - - /* The API knows that the firmware might be writing a status event. */ - /* The firmware does write a status event every 200ms (approximately). */ - /* So the status is read a couple of times to make sure an event was not read while */ - /* it was written. */ - while ( ulLoopCnt != 2 ) - { - /* Read the BIST status in the external memory. */ - for ( i = 0; i < ulTotalElements + 1; i ++ ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, ulReadAddress + i * 4, &aulMessage[ i ] ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Calculate the CRC of this message. */ - ulResult = Oct6100ApiProductionCrc( f_pApiInstance, aulMessage, ulTotalElements, &ulCalculatedCrc ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* If the CRCs do match, break off the while. We have a valid status event. */ - if ( aulMessage[ i - 1 ] == ulCalculatedCrc ) - break; - - ulLoopCnt++; - } - - /* Check if the CRC matches */ - if ( aulMessage[ i - 1 ] != ulCalculatedCrc ) - { - /* Well, the exchange memory at the base of the external memory is corrupted. */ - /* Something very basic is not working correctly with this chip! */ - f_pProductionBist->ulBistStatus = cOCT6100_BIST_STATUS_CRC_FAILED; - } - else - { - /* Check for problems. */ - switch ( aulMessage[ 0 ] & 0xFFFF ) - { - case ( 0x2 ): - - /* The initial configuration failed. */ - f_pProductionBist->ulBistStatus = cOCT6100_BIST_CONFIGURATION_FAILED; - break; - - case ( 0x1 ): - - /* A memory location failed. Return useful information to the user. */ - f_pProductionBist->ulBistStatus = cOCT6100_BIST_MEMORY_FAILED; - - f_pProductionBist->ulFailedAddress = ( aulMessage[ 1 ] & ( ~0x80000000 ) ) + cOCT6100_EXTERNAL_MEM_BASE_ADDRESS; - f_pProductionBist->ulReadValue = aulMessage[ 2 ]; - f_pProductionBist->ulExpectedValue = aulMessage[ 3 ]; - break; - - case ( 0xFFFF ): - - /* Bist is completed! */ - f_pProductionBist->ulBistStatus = cOCT6100_BIST_SUCCESS; - break; - - default: - /* Bist is in progress. All seems to be working fine up to now. */ - - /* Return progress status. */ - f_pProductionBist->ulCurrentAddress = ( aulMessage[ 1 ] & ( ~0x80000000 ) ) + cOCT6100_EXTERNAL_MEM_BASE_ADDRESS; - f_pProductionBist->ulCurrentTest = aulMessage[ 2 ]; - f_pProductionBist->ulCurrentLoop = aulMessage[ 3 ]; - break; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiProductionCrc - -Description: This function calculates the crc for a production BIST - message. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pulMessage Message to be exchanged with the firmware. The CRC - will be calculated on this. -f_ulMessageLength Length of the message to be exchanged. This value - does not include the CRC value at the end -f_pulCrcResult Resulting calculated CRC value. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiProductionCrc -UINT32 Oct6100ApiProductionCrc( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN PUINT32 f_pulMessage, - IN UINT32 f_ulMessageLength, - OUT PUINT32 f_pulCrcResult ) -{ - UINT32 ulWidth = 32; - UINT32 ulKey, i, j; - UINT32 ulRemainder = 0; - - /* CRC the message. */ - ulRemainder = f_pulMessage[ f_ulMessageLength - 1 ]; - for ( j = f_ulMessageLength - 1; j != 0xFFFFFFFF ; j-- ) - { - for ( i = 0; i < ulWidth; i++ ) - { - if ( ( ( ulRemainder >> 0x1F ) & 0x1 ) == 0x1 ) - { - /* Division is by something meaningful */ - ulKey = 0x8765DCBA; - } - else - { - /* Remainder is less than our divisor */ - ulKey = 0; - } - ulRemainder = ulRemainder ^ ulKey; - - ulRemainder = ulRemainder << 1; - if ( j != 0 ) - { - ulRemainder = ulRemainder | ( ( f_pulMessage[ j - 1 ] ) >> ( 0x1F - i ) ); - } - } - } - - *f_pulCrcResult = ulRemainder; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiClearInterrupts - -Description: Called only by the Oct6100OpenChip function, this function - writes to all register ROLs to clear them. This is necessary - because some ROLs are set during the startup. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -IN f_pApiInst Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiClearInterrupts -UINT32 Oct6100ApiClearInterrupts( - IN tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - WriteParams.ulWriteAddress = 0x102; - WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_102H; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x202; - WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_202H; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x302; - WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_302H; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x502; - WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_502H; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x702; - WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_702H; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; - -} -#endif diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_stats.c b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_stats.c deleted file mode 100644 index 162c43e..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_stats.c +++ /dev/null @@ -1,441 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_chip_stats.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains functions used to retreive the OCT6100 chip stats. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 89 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_channel_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_chip_stats_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_chip_stats_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_chip_stats_priv.h" - -/**************************** PUBLIC FUNCTIONS *****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChipGetStats - -Description: Retreives the chip statistics and configuration. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChipStats Pointer to a tOCT6100_CHIP_STATS structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChipGetStatsDef -UINT32 Oct6100ChipGetStatsDef( - tPOCT6100_CHIP_STATS f_pChipStats ) -{ - f_pChipStats->fResetChipStats = FALSE; - - f_pChipStats->ulNumberChannels = cOCT6100_INVALID_STAT; - f_pChipStats->ulNumberTsiCncts = cOCT6100_INVALID_STAT; - f_pChipStats->ulNumberConfBridges = cOCT6100_INVALID_STAT; - f_pChipStats->ulNumberPlayoutBuffers = cOCT6100_INVALID_STAT; - f_pChipStats->ulPlayoutFreeMemSize = cOCT6100_INVALID_STAT; - - f_pChipStats->ulNumberPhasingTssts = cOCT6100_INVALID_STAT; - f_pChipStats->ulNumberAdpcmChannels = cOCT6100_INVALID_STAT; - - f_pChipStats->ulH100OutOfSynchCount = cOCT6100_INVALID_STAT; - f_pChipStats->ulH100ClockABadCount = cOCT6100_INVALID_STAT; - f_pChipStats->ulH100FrameABadCount = cOCT6100_INVALID_STAT; - f_pChipStats->ulH100ClockBBadCount = cOCT6100_INVALID_STAT; - f_pChipStats->ulInternalReadTimeoutCount = cOCT6100_INVALID_STAT; - f_pChipStats->ulSdramRefreshTooLateCount = cOCT6100_INVALID_STAT; - f_pChipStats->ulPllJitterErrorCount = cOCT6100_INVALID_STAT; - - f_pChipStats->ulOverflowToneEventsCount = cOCT6100_INVALID_STAT; - f_pChipStats->ulSoftOverflowToneEventsCount = cOCT6100_INVALID_STAT; - f_pChipStats->ulSoftOverflowBufferPlayoutEventsCount = cOCT6100_INVALID_STAT; - - - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ChipGetStats -UINT32 Oct6100ChipGetStats( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CHIP_STATS f_pChipStats ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ChipGetStatsSer( f_pApiInstance, f_pChipStats ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChipGetImageInfo - -Description: Retrieves the chip image information indicating the supported - features and tones. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChipImageInfo Pointer to a tPOCT6100_CHIP_IMAGE_INFO structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChipGetImageInfoDef -UINT32 Oct6100ChipGetImageInfoDef( - tPOCT6100_CHIP_IMAGE_INFO f_pChipImageInfo ) -{ - UINT32 i; - - Oct6100UserMemSet( f_pChipImageInfo->szVersionNumber, 0x0, cOCT6100_VERSION_NUMBER_MAX_SIZE ); - - f_pChipImageInfo->fBufferPlayout = FALSE; - f_pChipImageInfo->fAdaptiveNoiseReduction = FALSE; - f_pChipImageInfo->fSoutNoiseBleaching = FALSE; - f_pChipImageInfo->fConferencingNoiseReduction = FALSE; - f_pChipImageInfo->fAutoLevelControl = FALSE; - f_pChipImageInfo->fHighLevelCompensation = FALSE; - f_pChipImageInfo->fSilenceSuppression = FALSE; - - f_pChipImageInfo->fAdpcm = FALSE; - f_pChipImageInfo->fConferencing = FALSE; - f_pChipImageInfo->fDominantSpeaker = FALSE; - f_pChipImageInfo->ulMaxChannels = cOCT6100_INVALID_VALUE; - f_pChipImageInfo->ulNumTonesAvailable = cOCT6100_INVALID_VALUE; - f_pChipImageInfo->ulToneProfileNumber = cOCT6100_INVALID_VALUE; - f_pChipImageInfo->ulMaxTailDisplacement = cOCT6100_INVALID_VALUE; - f_pChipImageInfo->ulBuildId = cOCT6100_INVALID_VALUE; - f_pChipImageInfo->ulMaxTailLength = cOCT6100_INVALID_VALUE; - f_pChipImageInfo->ulDebugEventSize = cOCT6100_INVALID_VALUE; - f_pChipImageInfo->ulMaxPlayoutEvents = cOCT6100_INVALID_VALUE; - f_pChipImageInfo->ulImageType = cOCT6100_INVALID_VALUE; - - f_pChipImageInfo->fAcousticEcho = FALSE; - f_pChipImageInfo->fAecTailLength = FALSE; - f_pChipImageInfo->fToneRemoval = FALSE; - - f_pChipImageInfo->fDefaultErl = FALSE; - f_pChipImageInfo->fNonLinearityBehaviorA = FALSE; - f_pChipImageInfo->fNonLinearityBehaviorB = FALSE; - f_pChipImageInfo->fPerChannelTailDisplacement = FALSE; - f_pChipImageInfo->fPerChannelTailLength = FALSE; - f_pChipImageInfo->fListenerEnhancement = FALSE; - f_pChipImageInfo->fRoutNoiseReduction = FALSE; - f_pChipImageInfo->fRoutNoiseReductionLevel = FALSE; - f_pChipImageInfo->fAnrSnrEnhancement = FALSE; - f_pChipImageInfo->fAnrVoiceNoiseSegregation = FALSE; - f_pChipImageInfo->fToneDisablerVqeActivationDelay = FALSE; - f_pChipImageInfo->fMusicProtection = FALSE; - f_pChipImageInfo->fDoubleTalkBehavior = FALSE; - f_pChipImageInfo->fIdleCodeDetection = TRUE; - f_pChipImageInfo->fSinLevel = TRUE; - - for ( i = 0; i < cOCT6100_MAX_TONE_EVENT; i++ ) - { - Oct6100UserMemSet( f_pChipImageInfo->aToneInfo[ i ].aszToneName, 0x00, cOCT6100_TLV_MAX_TONE_NAME_SIZE ); - f_pChipImageInfo->aToneInfo[ i ].ulDetectionPort = cOCT6100_INVALID_PORT; - f_pChipImageInfo->aToneInfo[ i ].ulToneID = cOCT6100_INVALID_VALUE; - } - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ChipGetImageInfo -UINT32 Oct6100ChipGetImageInfo( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CHIP_IMAGE_INFO f_pChipImageInfo ) -{ - tPOCT6100_API_IMAGE_INFO pImageInfo; - UINT32 i; - - /* Get local pointer(s). */ - pImageInfo = &f_pApiInstance->pSharedInfo->ImageInfo; - - Oct6100UserMemCopy( f_pChipImageInfo->szVersionNumber, pImageInfo->szVersionNumber, cOCT6100_VERSION_NUMBER_MAX_SIZE ); - - /* Copy the customer info. */ - f_pChipImageInfo->ulBuildId = pImageInfo->ulBuildId; - - /* Copy the features list. */ - f_pChipImageInfo->fBufferPlayout = pImageInfo->fBufferPlayout; - f_pChipImageInfo->fAdaptiveNoiseReduction = pImageInfo->fAdaptiveNoiseReduction; - f_pChipImageInfo->fSoutNoiseBleaching = pImageInfo->fSoutNoiseBleaching; - f_pChipImageInfo->fSilenceSuppression = pImageInfo->fSilenceSuppression; - - f_pChipImageInfo->fAdpcm = pImageInfo->fAdpcm; - f_pChipImageInfo->fConferencing = pImageInfo->fConferencing; - f_pChipImageInfo->fDominantSpeaker = pImageInfo->fDominantSpeakerEnabled; - f_pChipImageInfo->fConferencingNoiseReduction = pImageInfo->fConferencingNoiseReduction; - f_pChipImageInfo->fAcousticEcho = pImageInfo->fAcousticEcho; - f_pChipImageInfo->fAecTailLength = pImageInfo->fAecTailLength; - f_pChipImageInfo->fDefaultErl = pImageInfo->fDefaultErl; - f_pChipImageInfo->fToneRemoval = pImageInfo->fToneRemoval; - - f_pChipImageInfo->fNonLinearityBehaviorA = pImageInfo->fNonLinearityBehaviorA; - f_pChipImageInfo->fNonLinearityBehaviorB = pImageInfo->fNonLinearityBehaviorB; - f_pChipImageInfo->fPerChannelTailDisplacement = pImageInfo->fPerChannelTailDisplacement; - f_pChipImageInfo->fListenerEnhancement = pImageInfo->fListenerEnhancement; - f_pChipImageInfo->fRoutNoiseReduction = pImageInfo->fRoutNoiseReduction; - f_pChipImageInfo->fRoutNoiseReductionLevel = pImageInfo->fRoutNoiseReductionLevel; - f_pChipImageInfo->fAnrSnrEnhancement = pImageInfo->fAnrSnrEnhancement; - f_pChipImageInfo->fAnrVoiceNoiseSegregation = pImageInfo->fAnrVoiceNoiseSegregation; - f_pChipImageInfo->fMusicProtection = pImageInfo->fMusicProtection; - f_pChipImageInfo->fIdleCodeDetection = pImageInfo->fIdleCodeDetection; - f_pChipImageInfo->fSinLevel = pImageInfo->fSinLevel; - f_pChipImageInfo->fDoubleTalkBehavior = pImageInfo->fDoubleTalkBehavior; - f_pChipImageInfo->fHighLevelCompensation = pImageInfo->fRinHighLevelCompensation; - - if ( ( pImageInfo->fRinAutoLevelControl == TRUE ) && ( pImageInfo->fSoutAutoLevelControl == TRUE ) ) - f_pChipImageInfo->fAutoLevelControl = TRUE; - else - f_pChipImageInfo->fAutoLevelControl = FALSE; - - f_pChipImageInfo->ulMaxChannels = pImageInfo->usMaxNumberOfChannels; - f_pChipImageInfo->ulNumTonesAvailable = pImageInfo->byNumToneDetectors; - f_pChipImageInfo->ulToneProfileNumber = pImageInfo->ulToneProfileNumber; - f_pChipImageInfo->ulMaxTailDisplacement = pImageInfo->usMaxTailDisplacement; - f_pChipImageInfo->ulMaxTailLength = pImageInfo->usMaxTailLength; - f_pChipImageInfo->fPerChannelTailLength = pImageInfo->fPerChannelTailLength; - f_pChipImageInfo->ulDebugEventSize = f_pApiInstance->pSharedInfo->DebugInfo.ulDebugEventSize; - f_pChipImageInfo->fToneDisablerVqeActivationDelay = pImageInfo->fToneDisablerVqeActivationDelay; - f_pChipImageInfo->ulMaxPlayoutEvents = pImageInfo->byMaxNumberPlayoutEvents - 1; /* 127 or 31 */ - f_pChipImageInfo->ulImageType = pImageInfo->byImageType; - - for ( i = 0; i < cOCT6100_MAX_TONE_EVENT; i++ ) - { - Oct6100UserMemCopy( f_pChipImageInfo->aToneInfo[ i ].aszToneName, pImageInfo->aToneInfo[ i ].aszToneName, cOCT6100_TLV_MAX_TONE_NAME_SIZE ); - f_pChipImageInfo->aToneInfo[ i ].ulDetectionPort = pImageInfo->aToneInfo[ i ].ulDetectionPort; - f_pChipImageInfo->aToneInfo[ i ].ulToneID = pImageInfo->aToneInfo[ i ].ulToneID; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiChipStatsSwInit - -Description: Initializes portions of API instance associated to chip stats. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiChipStatsSwInit -UINT32 Oct6100ApiChipStatsSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - - /* Get local pointer to shared portion of API instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Initialize chip stats. */ - pSharedInfo->ErrorStats.fFatalChipError = FALSE; - - pSharedInfo->ErrorStats.ulH100ClkABadCnt = 0; - pSharedInfo->ErrorStats.ulH100ClkBBadCnt = 0; - pSharedInfo->ErrorStats.ulH100FrameABadCnt = 0; - pSharedInfo->ErrorStats.ulH100OutOfSyncCnt = 0; - - pSharedInfo->ErrorStats.ulInternalReadTimeoutCnt = 0; - pSharedInfo->ErrorStats.ulSdramRefreshTooLateCnt = 0; - pSharedInfo->ErrorStats.ulPllJitterErrorCnt = 0; - pSharedInfo->ErrorStats.ulOverflowToneEventsCnt = 0; - - - - pSharedInfo->ErrorStats.ulToneDetectorErrorCnt = 0; - - /* Init the chip stats. */ - pSharedInfo->ChipStats.usNumberChannels = 0; - pSharedInfo->ChipStats.usNumberBiDirChannels = 0; - pSharedInfo->ChipStats.usNumberTsiCncts = 0; - pSharedInfo->ChipStats.usNumberConfBridges = 0; - pSharedInfo->ChipStats.usNumberPlayoutBuffers = 0; - pSharedInfo->ChipStats.usNumberActiveBufPlayoutPorts = 0; - pSharedInfo->ChipStats.ulPlayoutMemUsed = 0; - pSharedInfo->ChipStats.usNumEcChanUsingMixer = 0; - - pSharedInfo->ChipStats.usNumberPhasingTssts = 0; - pSharedInfo->ChipStats.usNumberAdpcmChans = 0; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ChipGetStatsSer - -Description: Serialized function retreiving the chip statistics. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pChipStats Pointer to master mode configuration structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ChipGetStatsSer -UINT32 Oct6100ChipGetStatsSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT tPOCT6100_CHIP_STATS f_pChipStats ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - f_pChipStats->ulNumberChannels = pSharedInfo->ChipStats.usNumberChannels; - f_pChipStats->ulNumberTsiCncts = pSharedInfo->ChipStats.usNumberTsiCncts; - f_pChipStats->ulNumberConfBridges = pSharedInfo->ChipStats.usNumberConfBridges; - f_pChipStats->ulNumberPlayoutBuffers = pSharedInfo->ChipStats.usNumberPlayoutBuffers; - f_pChipStats->ulPlayoutFreeMemSize = ( f_pApiInstance->pSharedInfo->MiscVars.ulTotalMemSize - ( f_pApiInstance->pSharedInfo->MemoryMap.ulFreeMemBaseAddress - cOCT6100_EXTERNAL_MEM_BASE_ADDRESS ) ) - ( pSharedInfo->ChipStats.ulPlayoutMemUsed ); - - f_pChipStats->ulNumberPhasingTssts = pSharedInfo->ChipStats.usNumberPhasingTssts; - f_pChipStats->ulNumberAdpcmChannels = pSharedInfo->ChipStats.usNumberAdpcmChans; - - /* Check the input parameters. */ - if ( f_pChipStats->fResetChipStats != TRUE && - f_pChipStats->fResetChipStats != FALSE ) - return cOCT6100_ERR_CHIP_STATS_RESET; - - if ( f_pChipStats->fResetChipStats == TRUE ) - { - pSharedInfo->ErrorStats.ulH100OutOfSyncCnt = 0; - pSharedInfo->ErrorStats.ulH100ClkABadCnt = 0; - pSharedInfo->ErrorStats.ulH100FrameABadCnt = 0; - pSharedInfo->ErrorStats.ulH100ClkBBadCnt = 0; - - pSharedInfo->ErrorStats.ulInternalReadTimeoutCnt = 0; - pSharedInfo->ErrorStats.ulPllJitterErrorCnt = 0; - pSharedInfo->ErrorStats.ulSdramRefreshTooLateCnt = 0; - - pSharedInfo->ErrorStats.ulOverflowToneEventsCnt = 0; - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt = 0; - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferOverflowCnt = 0; - - - } - - f_pChipStats->ulH100OutOfSynchCount = pSharedInfo->ErrorStats.ulH100OutOfSyncCnt; - f_pChipStats->ulH100ClockABadCount = pSharedInfo->ErrorStats.ulH100ClkABadCnt; - f_pChipStats->ulH100FrameABadCount = pSharedInfo->ErrorStats.ulH100FrameABadCnt; - f_pChipStats->ulH100ClockBBadCount = pSharedInfo->ErrorStats.ulH100ClkBBadCnt; - - f_pChipStats->ulInternalReadTimeoutCount = pSharedInfo->ErrorStats.ulInternalReadTimeoutCnt; - f_pChipStats->ulPllJitterErrorCount = pSharedInfo->ErrorStats.ulPllJitterErrorCnt; - f_pChipStats->ulSdramRefreshTooLateCount = pSharedInfo->ErrorStats.ulSdramRefreshTooLateCnt; - - f_pChipStats->ulOverflowToneEventsCount = pSharedInfo->ErrorStats.ulOverflowToneEventsCnt; - f_pChipStats->ulSoftOverflowToneEventsCount = pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt; - f_pChipStats->ulSoftOverflowBufferPlayoutEventsCount = pSharedInfo->SoftBufs.ulBufPlayoutEventBufferOverflowCnt; - - - - return cOCT6100_ERR_OK; -} -#endif - diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.c b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.c deleted file mode 100644 index 1fc539e..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_conf_bridge.c +++ /dev/null @@ -1,7683 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_conf_bridge.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains all functions related to a conference bridge. Procedures - needed to open/close a bridge, add/remove a participant to a conference - bridge, mute/unmute a participant, etc.. are all present in this source - file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 146 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_channel_inst.h" -#include "oct6100api/oct6100_mixer_inst.h" -#include "oct6100api/oct6100_conf_bridge_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_mixer_pub.h" -#include "oct6100api/oct6100_conf_bridge_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_memory_priv.h" -#include "oct6100_tsst_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_mixer_priv.h" -#include "oct6100_conf_bridge_priv.h" - - -/**************************** PUBLIC FUNCTIONS *****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeOpen - -Description: This function opens a conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeOpen Pointer to conference bridge open structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeOpenDef -UINT32 Oct6100ConfBridgeOpenDef( - tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen ) -{ - f_pConfBridgeOpen->pulConfBridgeHndl = NULL; - f_pConfBridgeOpen->fFlexibleConferencing = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ConfBridgeOpen -UINT32 Oct6100ConfBridgeOpen( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ConfBridgeOpenSer( f_pApiInstance, f_pConfBridgeOpen ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeClose - -Description: This function closes a conference bridge. A conference - bridge can only be closed if no participants are present on - the bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeClose Pointer to conference bridge close structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeCloseDef -UINT32 Oct6100ConfBridgeCloseDef( - tPOCT6100_CONF_BRIDGE_CLOSE f_pConfBridgeClose ) -{ - f_pConfBridgeClose->ulConfBridgeHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ConfBridgeClose -UINT32 Oct6100ConfBridgeClose( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CONF_BRIDGE_CLOSE f_pConfBridgeClose ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ConfBridgeCloseSer( f_pApiInstance, f_pConfBridgeClose ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeChanAdd - -Description: This function adds an echo channel (participant) to a - conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeAdd Pointer to conference bridge channel addition structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeChanAddDef -UINT32 Oct6100ConfBridgeChanAddDef( - tPOCT6100_CONF_BRIDGE_CHAN_ADD f_pConfBridgeAdd ) -{ - f_pConfBridgeAdd->ulConfBridgeHndl = cOCT6100_INVALID_HANDLE; - f_pConfBridgeAdd->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pConfBridgeAdd->ulInputPort = cOCT6100_CHANNEL_PORT_SOUT; - f_pConfBridgeAdd->ulListenerMaskIndex = cOCT6100_INVALID_VALUE; - f_pConfBridgeAdd->ulListenerMask = 0; - f_pConfBridgeAdd->fMute = FALSE; - f_pConfBridgeAdd->ulTappedChannelHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ConfBridgeChanAdd -UINT32 Oct6100ConfBridgeChanAdd( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CONF_BRIDGE_CHAN_ADD f_pConfBridgeAdd ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ConfBridgeChanAddSer( f_pApiInstance, f_pConfBridgeAdd ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeChanRemove - -Description: This function removes an echo channel (participant) from a - conference bridge. All participants can be removed from - the bridge if a special flag (fRemoveAll) is set to TRUE. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeRemove Pointer to conference bridge channel removal structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeChanRemoveDef -UINT32 Oct6100ConfBridgeChanRemoveDef( - tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove ) -{ - f_pConfBridgeRemove->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pConfBridgeRemove->ulConfBridgeHndl = cOCT6100_INVALID_HANDLE; - f_pConfBridgeRemove->fRemoveAll = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ConfBridgeChanRemove -UINT32 Oct6100ConfBridgeChanRemove( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ConfBridgeChanRemoveSer( f_pApiInstance, f_pConfBridgeRemove ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeChanMute - -Description: This function mutes a participant present on a conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeMute Pointer to conference bridge channel mute structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeChanMuteDef -UINT32 Oct6100ConfBridgeChanMuteDef( - tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute ) -{ - f_pConfBridgeMute->ulChannelHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ConfBridgeChanMute -UINT32 Oct6100ConfBridgeChanMute( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ConfBridgeChanMuteSer( f_pApiInstance, f_pConfBridgeMute ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeChanUnMute - -Description: This function unmutes a channel on a bridge. The other member - of the conference will start to hear this participant again. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeUnMute Pointer to conference bridge channel unmute structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeChanUnMuteDef -UINT32 Oct6100ConfBridgeChanUnMuteDef( - tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute ) -{ - f_pConfBridgeUnMute->ulChannelHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ConfBridgeChanUnMute -UINT32 Oct6100ConfBridgeChanUnMute( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ConfBridgeChanUnMuteSer( f_pApiInstance, f_pConfBridgeUnMute ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeDominantSpeakerSet - -Description: This function sets a participant present on a conference - bridge as the dominant speaker. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to - keep the present state of the chip and all its - resources. - -f_pConfBridgeDominant Pointer to conference bridge dominant speaker - structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeDominantSpeakerSetDef -UINT32 Oct6100ConfBridgeDominantSpeakerSetDef( - tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker ) -{ - f_pConfBridgeDominantSpeaker->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pConfBridgeDominantSpeaker->ulConfBridgeHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ConfBridgeDominantSpeakerSet -UINT32 Oct6100ConfBridgeDominantSpeakerSet( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ConfBridgeDominantSpeakerSetSer( f_pApiInstance, f_pConfBridgeDominantSpeaker ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeMaskChange - -Description: This function changes the mask of a flexible bridge participant. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to - keep the present state of the chip and all its - resources. - -f_pConfBridgeMaskChange Pointer to conference bridge change of mask - structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeMaskChangeDef -UINT32 Oct6100ConfBridgeMaskChangeDef( - tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange ) -{ - f_pConfBridgeMaskChange->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pConfBridgeMaskChange->ulNewListenerMask = 0x0; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ConfBridgeMaskChange -UINT32 Oct6100ConfBridgeMaskChange( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ConfBridgeMaskChangeSer( f_pApiInstance, f_pConfBridgeMaskChange ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeGetStats - -Description: This function returns the stats for a conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeStats Pointer to conference bridge channel stats structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeGetStatsDef -UINT32 Oct6100ConfBridgeGetStatsDef( - tPOCT6100_CONF_BRIDGE_STATS f_pConfBridgeStats ) -{ - f_pConfBridgeStats->ulConfBridgeHndl = cOCT6100_INVALID_HANDLE; - f_pConfBridgeStats->ulNumChannels = cOCT6100_INVALID_STAT; - f_pConfBridgeStats->ulNumTappedChannels = cOCT6100_INVALID_STAT; - f_pConfBridgeStats->fFlexibleConferencing = cOCT6100_INVALID_STAT; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ConfBridgeGetStats -UINT32 Oct6100ConfBridgeGetStats( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_CONF_BRIDGE_STATS f_pConfBridgeStats ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ConfBridgeGetStatsSer( f_pApiInstance, f_pConfBridgeStats ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - -/**************************** PRIVATE FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetConfBridgeSwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management of conference bridges. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pOpenChip Pointer to chip configuration struct. -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetConfBridgeSwSizes -UINT32 Oct6100ApiGetConfBridgeSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulTempVar; - UINT32 ulResult; - - /* Calculate memory needed for conference bridge list. */ - if ( f_pOpenChip->ulMaxConfBridges == 0 && f_pOpenChip->fEnableChannelRecording == TRUE ) - f_pOpenChip->ulMaxConfBridges = 1; - f_pInstSizes->ulConfBridgeList = f_pOpenChip->ulMaxConfBridges * sizeof( tOCT6100_API_CONF_BRIDGE ); - - /* Calculate memory needed for conference bridge allocation software. */ - if ( f_pOpenChip->ulMaxConfBridges > 0 ) - { - /* Get size of bridge allocation memory */ - ulResult = OctapiLlmAllocGetSize( f_pOpenChip->ulMaxConfBridges, &f_pInstSizes->ulConfBridgeAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_1C; - - /* Check if the user wants to build flexible conference bridges. */ - if ( f_pOpenChip->ulMaxFlexibleConfParticipants > 0 ) - { - /* Allocate the lowest quantity according to what the user requested. */ - if ( f_pOpenChip->ulMaxFlexibleConfParticipants < ( f_pOpenChip->ulMaxConfBridges * cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE ) ) - f_pInstSizes->ulFlexConfParticipantsList = f_pOpenChip->ulMaxFlexibleConfParticipants * sizeof( tOCT6100_API_FLEX_CONF_PARTICIPANT ); - else - { - f_pOpenChip->ulMaxFlexibleConfParticipants = f_pOpenChip->ulMaxConfBridges * cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; - f_pInstSizes->ulFlexConfParticipantsList = f_pOpenChip->ulMaxConfBridges * cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE * sizeof( tOCT6100_API_FLEX_CONF_PARTICIPANT ); - } - - /* Get size of flexible conferencing participants allocation memory */ - ulResult = OctapiLlmAllocGetSize( f_pOpenChip->ulMaxFlexibleConfParticipants, &f_pInstSizes->ulFlexConfParticipantsAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_1C; - } - else - { - f_pInstSizes->ulFlexConfParticipantsList = 0; - f_pInstSizes->ulFlexConfParticipantsAlloc = 0; - } - } - else - { - f_pInstSizes->ulMixerEventList = 0; - f_pInstSizes->ulMixerEventAlloc = 0; - f_pInstSizes->ulConfBridgeAlloc = 0; - - /* Make sure flexible conferencing is not used. */ - f_pInstSizes->ulFlexConfParticipantsList = 0; - f_pInstSizes->ulFlexConfParticipantsAlloc = 0; - } - - /* Calculate memory needed for list and allocation software serialization. */ - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulConfBridgeList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulConfBridgeAlloc, ulTempVar ) - - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulFlexConfParticipantsList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulFlexConfParticipantsAlloc, ulTempVar ) - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiConfBridgeSwInit - -Description: Initializes all elements of the instance structure associated - to conference bridges. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiConfBridgeSwInit -UINT32 Oct6100ApiConfBridgeSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CONF_BRIDGE pConfBridgeList; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pFlexConfParticipantList; - PVOID pFlexConfPartipantsAlloc; - UINT32 ulMaxFlexConfParicipants; - PVOID pConfBridgeAlloc; - UINT32 ulMaxConfBridges; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get the maximum number of conference bridges. */ - ulMaxConfBridges = pSharedInfo->ChipConfig.usMaxConfBridges; - - /*===================================================================*/ - /* Set all entries in the conference bridge list to unused. */ - - mOCT6100_GET_CONF_BRIDGE_LIST_PNT( pSharedInfo, pConfBridgeList ); - - /* Initialize the conference bridge allocation software to "all free". */ - if ( ulMaxConfBridges > 0 ) - { - /* Clear the bridge memory */ - Oct6100UserMemSet( pConfBridgeList, 0x00, ulMaxConfBridges * sizeof( tOCT6100_API_CONF_BRIDGE )); - - mOCT6100_GET_CONF_BRIDGE_ALLOC_PNT( pSharedInfo, pConfBridgeAlloc ) - - ulResult = OctapiLlmAllocInit( &pConfBridgeAlloc, ulMaxConfBridges ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_1E; - } - /*===================================================================*/ - - - /*===================================================================*/ - /* Set all entries in the flexible conferencing participant list to unused. */ - - /* Get the maximum number of flexible conferencing participants. */ - ulMaxFlexConfParicipants = pSharedInfo->ChipConfig.usMaxFlexibleConfParticipants; - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_LIST_PNT( pSharedInfo, pFlexConfParticipantList ); - - /* Initialize the flexible conferencing allocation software. */ - if ( ulMaxFlexConfParicipants > 0 ) - { - UINT32 i, ulEventIndex; - - /* Clear the participants memory */ - Oct6100UserMemSet( pFlexConfParticipantList, 0x00, ulMaxFlexConfParicipants * sizeof( tOCT6100_API_FLEX_CONF_PARTICIPANT )); - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ALLOC_PNT( pSharedInfo, pFlexConfPartipantsAlloc ) - - ulResult = OctapiLlmAllocInit( &pFlexConfPartipantsAlloc, ulMaxFlexConfParicipants ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_1E; - - /* Initialize the conferencing indexes. */ - for ( i = 0; i < ulMaxFlexConfParicipants; i ++ ) - { - for ( ulEventIndex = 0; ulEventIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulEventIndex ++ ) - pFlexConfParticipantList[ i ].ausLoadOrAccumulateEventIndex[ ulEventIndex ] = cOCT6100_INVALID_INDEX; - } - } - - /*===================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeOpenSer - -Description: Open a conference bridge. Note that no chip resources are - allocated until a channel is added to the bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeOpen Pointer to conference bridge configuration structure. - The handle identifying the conference bridge in all - future function calls is returned in this structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeOpenSer -UINT32 Oct6100ConfBridgeOpenSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen ) -{ - UINT16 usBridgeIndex; - UINT32 ulResult; - - /* Check the user's configuration of the conference bridge for errors. */ - ulResult = Oct6100ApiCheckBridgeParams( f_pApiInstance, f_pConfBridgeOpen ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reserve all resources needed by the conference bridge. */ - ulResult = Oct6100ApiReserveBridgeResources( f_pApiInstance, &usBridgeIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the new conference bridge's entry in the conference bridge list. */ - ulResult = Oct6100ApiUpdateBridgeEntry( f_pApiInstance, f_pConfBridgeOpen, usBridgeIndex); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckBridgeParams - -Description: Checks the user's conference bridge open configuration for errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeOpen Pointer to conference bridge configuration structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckBridgeParams -UINT32 Oct6100ApiCheckBridgeParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen ) -{ - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 ) - return cOCT6100_ERR_CONF_BRIDGE_DISABLED; - - if ( f_pConfBridgeOpen->pulConfBridgeHndl == NULL ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - if ( f_pApiInstance->pSharedInfo->ImageInfo.fConferencing == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_CONF_BRIDGE; - - if ( f_pConfBridgeOpen->fFlexibleConferencing != FALSE - && f_pConfBridgeOpen->fFlexibleConferencing != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveBridgeResources - -Description: Reserves all resources needed for the new conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pusBridgeIndex Allocated entry in the API conference bridge list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveBridgeResources -UINT32 Oct6100ApiReserveBridgeResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusBridgeIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Reserve an entry in the conference bridge list. */ - ulResult = Oct6100ApiReserveBridgeEntry( f_pApiInstance, f_pusBridgeIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateBridgeEntry - -Description: Updates the new conference bridge's entry in the conference - bridge list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pConfBridgeOpen Pointer to conference bridge configuration structure. -f_usBridgeIndex Allocated entry in API conference bridge list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateBridgeEntry -UINT32 Oct6100ApiUpdateBridgeEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen, - IN UINT16 f_usBridgeIndex ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - tPOCT6100_API_CONF_BRIDGE pTempBridgeEntry; - - /*================================================================================*/ - /* Obtain a pointer to the new conference bridge's list entry. */ - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex ) - - /* No clients are currently connected to the bridge. */ - pBridgeEntry->usNumClients = 0; - /* Nobody is tapped for now. */ - pBridgeEntry->usNumTappedClients = 0; - pBridgeEntry->usFirstLoadEventPtr = cOCT6100_INVALID_INDEX; - pBridgeEntry->usFirstSubStoreEventPtr = cOCT6100_INVALID_INDEX; - pBridgeEntry->usLastSubStoreEventPtr = cOCT6100_INVALID_INDEX; - - pBridgeEntry->usSilenceLoadEventPtr = cOCT6100_INVALID_INDEX; - - pBridgeEntry->usLoadIndex = cOCT6100_INVALID_INDEX; - - /* Now update the bridge pointer. */ - if ( f_pApiInstance->pSharedInfo->MiscVars.usNumBridgesOpened == 0 ) - { - pBridgeEntry->usNextBridgePtr = cOCT6100_INVALID_INDEX; - pBridgeEntry->usPrevBridgePtr = cOCT6100_INVALID_INDEX; - - /* Set the global first bridge to this bridge. */ - f_pApiInstance->pSharedInfo->MiscVars.usFirstBridge = f_usBridgeIndex; - } - else /* Insert this bridge at the head of the bridge list.*/ - { - if ( f_pApiInstance->pSharedInfo->MiscVars.usFirstBridge == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_FATAL_22; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTempBridgeEntry, f_pApiInstance->pSharedInfo->MiscVars.usFirstBridge ) - - if ( pTempBridgeEntry->fReserved != TRUE ) - return cOCT6100_ERR_FATAL_23; - - /* Modify the old first entry. */ - pTempBridgeEntry->usPrevBridgePtr = f_usBridgeIndex; - - /* Modify current pointer. */ - pBridgeEntry->usPrevBridgePtr = cOCT6100_INVALID_INDEX; - pBridgeEntry->usNextBridgePtr = f_pApiInstance->pSharedInfo->MiscVars.usFirstBridge; - - /* Set the new first bridge of the list. */ - f_pApiInstance->pSharedInfo->MiscVars.usFirstBridge = f_usBridgeIndex; - } - - /* Form handle returned to user. */ - *f_pConfBridgeOpen->pulConfBridgeHndl = cOCT6100_HNDL_TAG_CONF_BRIDGE | (pBridgeEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_usBridgeIndex; - - /* Remember whether or not we are a flexible conference bridge. */ - pBridgeEntry->fFlexibleConferencing = (UINT8)( f_pConfBridgeOpen->fFlexibleConferencing & 0xFF ); - - /* Finally, mark the conference bridge as opened. */ - pBridgeEntry->fReserved = TRUE; - - /* Increment the number of conference bridge opened. */ - f_pApiInstance->pSharedInfo->ChipStats.usNumberConfBridges++; - f_pApiInstance->pSharedInfo->MiscVars.usNumBridgesOpened++; - - /*================================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeCloseSer - -Description: Closes a conference bridge. Note that no client must be present - on the bridge for the bridge to be closed. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeClose Pointer to conference bridge close structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeCloseSer -UINT32 Oct6100ConfBridgeCloseSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CLOSE f_pConfBridgeClose ) -{ - UINT16 usBridgeIndex; - UINT32 ulResult; - - /* Verify that all the parameters given match the state of the API. */ - ulResult = Oct6100ApiAssertBridgeParams( f_pApiInstance, f_pConfBridgeClose, &usBridgeIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the conference bridge. */ - ulResult = Oct6100ApiReleaseBridgeResources( f_pApiInstance, usBridgeIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Invalidate the handle. */ - f_pConfBridgeClose->ulConfBridgeHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertBridgeParams - -Description: Checks the user's conference bridge close configuration for errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeClose Pointer to conference bridge close structure. -f_pusBridgeIndex Pointer to API instance conference bridge index. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertBridgeParams -UINT32 Oct6100ApiAssertBridgeParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CLOSE f_pConfBridgeClose, - OUT PUINT16 f_pusBridgeIndex ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - UINT32 ulEntryOpenCnt; - - /* Check the provided handle. */ - if ( (f_pConfBridgeClose->ulConfBridgeHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CONF_BRIDGE ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - *f_pusBridgeIndex = (UINT16)( f_pConfBridgeClose->ulConfBridgeHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeClose->ulConfBridgeHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pBridgeEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( pBridgeEntry->usNumClients != 0 ) - return cOCT6100_ERR_CONF_BRIDGE_ACTIVE_DEPENDENCIES; - if ( ulEntryOpenCnt != pBridgeEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseBridgeResources - -Description: Release all resources reserved for the conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usBridgeIndex Allocated external memory block for the conference bridge. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseBridgeResources -UINT32 Oct6100ApiReleaseBridgeResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBridgeIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - tPOCT6100_API_CONF_BRIDGE pTempBridgeEntry; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Release the entry from the conference bridge list. */ - ulResult = Oct6100ApiReleaseBridgeEntry( f_pApiInstance, f_usBridgeIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_24; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex ); - - /* Remove the bridge entry from the bridge list. */ - if ( pSharedInfo->MiscVars.usNumBridgesOpened == 1 ) - { - /* This bridge was the only one opened. */ - pSharedInfo->MiscVars.usFirstBridge = cOCT6100_INVALID_INDEX; - } - else if ( pSharedInfo->MiscVars.usNumBridgesOpened > 1 ) - { - /* There are more then one bridge open, must update the list. */ - if ( pBridgeEntry->usPrevBridgePtr != cOCT6100_INVALID_INDEX ) - { - /* There is a valid entry before this bridge, let's update this entry. */ - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTempBridgeEntry, pBridgeEntry->usPrevBridgePtr ); - - pTempBridgeEntry->usNextBridgePtr = pBridgeEntry->usNextBridgePtr; - } - - if ( pBridgeEntry->usNextBridgePtr != cOCT6100_INVALID_INDEX ) - { - /* There is a valid entry after this bridge, let's update this entry. */ - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTempBridgeEntry, pBridgeEntry->usNextBridgePtr ); - - pTempBridgeEntry->usPrevBridgePtr = pBridgeEntry->usPrevBridgePtr; - } - - if ( pSharedInfo->MiscVars.usFirstBridge == f_usBridgeIndex ) - { - /* This entry was the first of the list, make the next one be the first now. */ - pSharedInfo->MiscVars.usFirstBridge = pBridgeEntry->usNextBridgePtr; - } - } - else - { - /* Variable has become out of sync. */ - return cOCT6100_ERR_FATAL_25; - } - - /*=============================================================*/ - /* Update the conference bridge's list entry. */ - - /* Mark the bridge as closed. */ - pBridgeEntry->fFlexibleConferencing = FALSE; - pBridgeEntry->fReserved = FALSE; - pBridgeEntry->byEntryOpenCnt++; - - /* Decrement the number of conference bridges opened. */ - pSharedInfo->MiscVars.usNumBridgesOpened--; - pSharedInfo->ChipStats.usNumberConfBridges--; - - /*=============================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeChanAddSer - -Description: Adds an echo channel (participant) to a conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeAdd Pointer to conference bridge channel add structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeChanAddSer -UINT32 Oct6100ConfBridgeChanAddSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CHAN_ADD f_pConfBridgeAdd ) -{ - UINT16 usBridgeIndex; - UINT16 usChanIndex; - UINT16 usLoadEventIndex; - UINT16 usSubStoreEventIndex; - UINT16 usCopyEventIndex; - UINT32 ulInputPort; - UINT8 fFlexibleConfBridge; - UINT32 ulListenerMaskIndex; - UINT32 ulListenerMask; - UINT16 usTapChanIndex; - UINT16 usTapBridgeIndex; - UINT8 fMute; - UINT8 fTap; - UINT32 ulResult; - - /* Check the validity of the channel and conference bridge given. */ - ulResult = Oct6100ApiCheckBridgeAddParams( - f_pApiInstance, - f_pConfBridgeAdd, - &usBridgeIndex, - &usChanIndex, - &fMute, - &ulInputPort, - &fFlexibleConfBridge, - &ulListenerMaskIndex, - &ulListenerMask, - &fTap, - &usTapChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reserve all resources needed by the conference bridge. */ - ulResult = Oct6100ApiReserveBridgeAddResources( - f_pApiInstance, - usBridgeIndex, - usChanIndex, - ulInputPort, - fFlexibleConfBridge, - ulListenerMaskIndex, - ulListenerMask, - fTap, - &usLoadEventIndex, - &usSubStoreEventIndex, - &usCopyEventIndex, - &usTapBridgeIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reserve all resources needed by the conference bridge. */ - ulResult = Oct6100ApiBridgeEventAdd( - f_pApiInstance, - usBridgeIndex, - usChanIndex, - fFlexibleConfBridge, - usLoadEventIndex, - usSubStoreEventIndex, - usCopyEventIndex, - ulInputPort, - fMute, - ulListenerMaskIndex, - ulListenerMask, - fTap, - usTapBridgeIndex, - usTapChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckBridgeAddParams - -Description: Check the validity of the channel and conference bridge given. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_pConfBridgeAdd Pointer to conference bridge channenl add structure. -f_pusBridgeIndex Extracted bridge index where this channel should be - added. -f_pusChannelIndex Extracted channel index related to the channel handle - to be added to the bridge. -f_pfMute Whether to mute this channel in the bridge or not. -f_pulInputPort Input port where the channel signal should be - copied from. -f_pfFlexibleConfBridge If this is a flexible conference bridge. -f_pulListenerMaskIndex Index of the listener in this flexible conference bridge. -f_pulListenerMask Mask of listeners in this flexible conference bridge. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckBridgeAddParams -UINT32 Oct6100ApiCheckBridgeAddParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CHAN_ADD f_pConfBridgeAdd, - OUT PUINT16 f_pusBridgeIndex, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT8 f_pfMute, - OUT PUINT32 f_pulInputPort, - OUT PUINT8 f_pfFlexibleConfBridge, - OUT PUINT32 f_pulListenerMaskIndex, - OUT PUINT32 f_pulListenerMask, - OUT PUINT8 f_pfTap, - OUT PUINT16 f_pusTapChannelIndex ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - tPOCT6100_API_CHANNEL pEchoChanEntry; - UINT32 ulEntryOpenCnt; - UINT8 byTapChannelLaw; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 ) - return cOCT6100_ERR_CONF_BRIDGE_DISABLED; - - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 1 && - f_pApiInstance->pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_DISABLED; - - if ( f_pConfBridgeAdd->ulConfBridgeHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - if ( f_pConfBridgeAdd->ulChannelHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_HANDLE; - - if( f_pConfBridgeAdd->ulInputPort != cOCT6100_CHANNEL_PORT_SOUT - && f_pConfBridgeAdd->ulInputPort != cOCT6100_CHANNEL_PORT_RIN ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_INPUT_PORT; - - if ( f_pConfBridgeAdd->fMute != TRUE && f_pConfBridgeAdd->fMute != FALSE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_MUTE; - - /*=====================================================================*/ - /* Check the conference bridge handle. */ - - if ( (f_pConfBridgeAdd->ulConfBridgeHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CONF_BRIDGE ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - *f_pusBridgeIndex = (UINT16)( f_pConfBridgeAdd->ulConfBridgeHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeAdd->ulConfBridgeHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pBridgeEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( ulEntryOpenCnt != pBridgeEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - /* When we a flexible conference bridge, more things need to be checked. */ - if ( pBridgeEntry->fFlexibleConferencing == TRUE ) - { - /* Check if flexible conferencing has been activated. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxFlexibleConfParticipants == 0 ) - return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_DISABLED; - - /* Check the number of clients on the bridge. */ - if ( pBridgeEntry->usNumClients >= cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE ) - return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_PARTICIPANT_CNT; - - /* Check if the listener index in a flexible bridge is valid. */ - if ( f_pConfBridgeAdd->ulListenerMaskIndex == cOCT6100_INVALID_VALUE - || f_pConfBridgeAdd->ulListenerMaskIndex >= cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE ) - return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_LISTENER_MASK_INDEX; - } - - if ( f_pConfBridgeAdd->ulTappedChannelHndl != cOCT6100_INVALID_HANDLE ) - { - if ( pBridgeEntry->fFlexibleConferencing == TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_TAP_NOT_SUPPORTED; - } - - /*=====================================================================*/ - - - /*=====================================================================*/ - /* Check the channel handle. */ - - if ( (f_pConfBridgeAdd->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_HANDLE; - - *f_pusChannelIndex = (UINT16)( f_pConfBridgeAdd->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_HANDLE; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeAdd->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - if ( pEchoChanEntry->usBridgeIndex != cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ALREADY_ON_BRIDGE; - if ( pEchoChanEntry->fBiDirChannel == TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_BIDIR; - /* Law conversion is not allowed on a conference bridge. */ - if ( ( pEchoChanEntry->TdmConfig.usRinTimeslot != cOCT6100_UNASSIGNED ) - && ( pEchoChanEntry->TdmConfig.usRoutTimeslot != cOCT6100_UNASSIGNED ) ) - { - if ( pEchoChanEntry->TdmConfig.byRinPcmLaw != pEchoChanEntry->TdmConfig.byRoutPcmLaw ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_LAW_CONVERSION; - } - if ( ( pEchoChanEntry->TdmConfig.usSinTimeslot != cOCT6100_UNASSIGNED ) - && ( pEchoChanEntry->TdmConfig.usSoutTimeslot != cOCT6100_UNASSIGNED ) ) - { - if ( pEchoChanEntry->TdmConfig.bySinPcmLaw != pEchoChanEntry->TdmConfig.bySoutPcmLaw ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_LAW_CONVERSION; - } - if ( pEchoChanEntry->fRinRoutCodecActive == TRUE || pEchoChanEntry->fSinSoutCodecActive == TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_CODEC_ACTIVE; - if ( pEchoChanEntry->fEnableExtToneDetection == TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_EXT_TONE_ENABLED; - if ( pEchoChanEntry->usCopyEventCnt != 0x0 ) - return cOCT6100_ERR_CONF_BRIDGE_COPY_EVENTS; - - /* If the bridge is flexible, few more things need to be checked. */ - if ( pBridgeEntry->fFlexibleConferencing == TRUE ) - { - tPOCT6100_SHARED_INFO pSharedInfo; - UINT16 usChannelIndex; - UINT32 ulResult = cOCT6100_ERR_OK; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check if the listener index has been used by another channel in the specified bridge. */ - for ( usChannelIndex = 0; ( usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels ) && ( ulResult == cOCT6100_ERR_OK ) ; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, usChannelIndex ); - - /* Channel reserved? */ - if ( ( usChannelIndex != ( *f_pusChannelIndex ) ) && ( pEchoChanEntry->fReserved == TRUE ) ) - { - /* On current bridge? */ - if ( pEchoChanEntry->usBridgeIndex == ( *f_pusBridgeIndex ) ) - { - tPOCT6100_API_FLEX_CONF_PARTICIPANT pCurrentParticipant; - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pCurrentParticipant, pEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if this participant has the same listener index. */ - if ( f_pConfBridgeAdd->ulListenerMaskIndex == pCurrentParticipant->ulListenerMaskIndex ) - return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_LISTENER_INDEX_USED; - } - } - } - } - - if ( f_pConfBridgeAdd->ulTappedChannelHndl != cOCT6100_INVALID_HANDLE ) - { - /* For internal logic, make sure the mute flag is set to false. */ - f_pConfBridgeAdd->fMute = FALSE; - - /* Force input port to Sout for logic below. */ - f_pConfBridgeAdd->ulInputPort = cOCT6100_CHANNEL_PORT_SOUT; - - /* Keep law to check for conversion. */ - /* Check if the same law. */ - byTapChannelLaw = pEchoChanEntry->TdmConfig.bySoutPcmLaw; - - /* Check the tap handle. */ - if ( (f_pConfBridgeAdd->ulTappedChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_TAP_HANDLE; - - *f_pusTapChannelIndex = (UINT16)( f_pConfBridgeAdd->ulTappedChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusTapChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_TAP_HANDLE; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusTapChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeAdd->ulTappedChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_TAP_HANDLE; - if ( pEchoChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_NOT_ON_BRIDGE; - if ( pEchoChanEntry->usBridgeIndex != *f_pusBridgeIndex ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_NOT_ON_SAME_BRIDGE; - - /* We can only tap a channel added on the Sout port. */ - if ( pEchoChanEntry->usSinCopyEventIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_TAP_SOUT_ONLY; - - /* Check if already tapped. */ - if ( pEchoChanEntry->fBeingTapped == TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_ALREADY_TAPPED; - } - - /*=====================================================================*/ - - /* Return the tap flag. */ - if ( f_pConfBridgeAdd->ulTappedChannelHndl != cOCT6100_INVALID_HANDLE ) - { - *f_pfTap = TRUE; - } - else - { - *f_pfTap = FALSE; - } - - /* Return the mute config specified. */ - *f_pfMute = (UINT8)( f_pConfBridgeAdd->fMute & 0xFF ); - - /* Return the input port specified. */ - *f_pulInputPort = f_pConfBridgeAdd->ulInputPort; - - /* Return whether we are in the flexible conference bridge case. */ - *f_pfFlexibleConfBridge = pBridgeEntry->fFlexibleConferencing; - - /* Return the listener mask index as specified. */ - *f_pulListenerMaskIndex = f_pConfBridgeAdd->ulListenerMaskIndex; - - /* Return the listener mask as specified. */ - *f_pulListenerMask = f_pConfBridgeAdd->ulListenerMask; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveBridgeAddResources - -Description: Reserves all resources needed for the addition of a channel to - the conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_usBridgeIndex Bridge index of the bridge where this channel is added. -f_usChanIndex Channel index of the channel to be added to the bridge. -f_ulInputPort Input port where to copy samples from. -f_fFlexibleConfBridge If this is a flexible conference bridge. -f_ulListenerMaskIndex Index of the listener in this flexible conference bridge. -f_ulListenerMask Mask of listeners in this flexible conference bridge. -f_pusLoadEventIndex Load event index within the API's list of mixer event. -f_pusSubStoreEventIndex Sub-Store event index within the API's list of mixer event. -f_pusCopyEventIndex Copy event index within the API's list of mixer event. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveBridgeAddResources -UINT32 Oct6100ApiReserveBridgeAddResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChanIndex, - IN UINT32 f_ulInputPort, - IN UINT8 f_fFlexibleConfBridge, - IN UINT32 f_ulListenerMaskIndex, - IN UINT32 f_ulListenerMask, - IN UINT8 f_fTap, - OUT PUINT16 f_pusLoadEventIndex, - OUT PUINT16 f_pusSubStoreEventIndex, - OUT PUINT16 f_pusCopyEventIndex, - OUT PUINT16 f_pusTapBridgeIndex ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pTempEchoChanEntry; - UINT32 ulResult; - UINT32 ulTempVar; - UINT16 usChannelIndex; - BOOL fLoadEventReserved = FALSE; - BOOL fStoreEventReserved = FALSE; - BOOL fCopyEventReserved = FALSE; - BOOL fExtraSinTsiReserved = FALSE; - BOOL fExtraRinTsiReserved = FALSE; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ) - - /* Resources must be reserved according to the type of bridge we are adding to. */ - if ( f_fFlexibleConfBridge == TRUE ) - { - tPOCT6100_API_FLEX_CONF_PARTICIPANT pNewParticipant; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pCurrentParticipant; - - /*========================================================================*/ - /* If we are in the flexible conferencing case, things are a little */ - /* different. We create a mixer for every participant instead of the */ - /* usual same mixer for everyone. For example, if we have 3 participants */ - /* of type client - agent - coach, we build the mixers as follows: */ - /* */ - /* Client: - Load Agent */ - /* - Store */ - /* */ - /* Agent: - Load Client */ - /* - Accumulate Coach */ - /* - Store */ - /* */ - /* Coach: - Load Client */ - /* - Accumulate Agent */ - /* - Store */ - /* */ - /*========================================================================*/ - - /* First reserve a flexible conferencing participant entry. */ - ulResult = Oct6100ApiReserveFlexConfParticipantEntry( f_pApiInstance, &pChanEntry->usFlexConfParticipantIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pNewParticipant, pChanEntry->usFlexConfParticipantIndex ); - - /* Reserve an entry for the store event in the mixer memory. */ - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, f_pusSubStoreEventIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* If using the SOUT port, we must copy this entry */ - if( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - /* Reserve an entry for the copy event in the Mixer memory. */ - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, f_pusCopyEventIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fCopyEventReserved = TRUE; - - /* Reserve a SIN copy entry if none were reserved before.*/ - if ( pChanEntry->usExtraSinTsiMemIndex == cOCT6100_INVALID_INDEX ) - { - /* Reserve an entry for the extra tsi chariot memory. */ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, - &pChanEntry->usExtraSinTsiMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - fExtraSinTsiReserved = TRUE; - } - } - } - else /* if( f_ulInputPort == cOCT6100_CHANNEL_PORT_RIN ) */ - { - /* Reserve a RIN copy entry if none were reserved before.*/ - if ( pChanEntry->usExtraRinTsiMemIndex == cOCT6100_INVALID_INDEX ) - { - /* Reserve an entry for the extra tsi chariot memory. */ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, - &pChanEntry->usExtraRinTsiMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - fExtraRinTsiReserved = TRUE; - } - } - - /* Must travel all clients of this conference and reserve a load or accumulate event for */ - /* all participants which can hear us. */ - - /* Search through the list of API channel entry for the ones on to this bridge.*/ - for ( usChannelIndex = 0; ( usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels ) && ( ulResult == cOCT6100_ERR_OK ) ; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - /* Channel reserved? */ - if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) ) - { - /* On current bridge? */ - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pCurrentParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if we can hear this participant. */ - if ( ( f_ulListenerMask & ( 0x1 << pCurrentParticipant->ulListenerMaskIndex ) ) == 0x0 ) - { - /* Must reserve a load or accumulate entry mixer event here! */ - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, &pNewParticipant->ausLoadOrAccumulateEventIndex[ pCurrentParticipant->ulListenerMaskIndex ] ); - if ( ulResult != cOCT6100_ERR_OK ) - { - /* Most probably, the hardware is out of mixer events. */ - break; - } - } - - /* Check if this participant can hear us. */ - if ( ( pCurrentParticipant->ulListenerMask & ( 0x1 << f_ulListenerMaskIndex ) ) == 0x0 ) - { - /* Must reserve a load or accumulate entry mixer event here! */ - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, &pCurrentParticipant->ausLoadOrAccumulateEventIndex[ f_ulListenerMaskIndex ] ); - if ( ulResult != cOCT6100_ERR_OK ) - { - /* Most probably, the hardware is out of mixer events. */ - break; - } - } - } - } - } - - /* If an error is returned, make sure everything is cleaned up properly. */ - if ( ulResult != cOCT6100_ERR_OK ) - { - /* Release the flexible conferencing participant entry. */ - ulTempVar = Oct6100ApiReleaseFlexConfParticipantEntry( f_pApiInstance, pChanEntry->usFlexConfParticipantIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - - pChanEntry->usFlexConfParticipantIndex = cOCT6100_INVALID_INDEX; - - /* Release the substore event in the mixer memory. */ - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, *f_pusSubStoreEventIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - - if ( fCopyEventReserved == TRUE ) - { - /* Release the copy event in the mixer memory. */ - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, *f_pusCopyEventIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if ( fExtraSinTsiReserved == TRUE ) - { - /* Release the extra Sin TSI in TSI memory. */ - ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pChanEntry->usExtraSinTsiMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - - pChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX; - } - - if ( fExtraRinTsiReserved == TRUE ) - { - /* Release the extra Rin TSI in TSI memory. */ - ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pChanEntry->usExtraRinTsiMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - - pChanEntry->usExtraRinTsiMemIndex = cOCT6100_INVALID_INDEX; - } - - /* Search through the list of API channel entry for the ones on to this bridge. */ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - /* Channel reserved? */ - if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) ) - { - /* On current bridge? */ - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pCurrentParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if we can hear this participant. */ - if ( ( f_ulListenerMask & ( 0x1 << pCurrentParticipant->ulListenerMaskIndex ) ) == 0x0 ) - { - /* If the load or event entry in the mixer memory was reserved. */ - if ( pNewParticipant->ausLoadOrAccumulateEventIndex[ pCurrentParticipant->ulListenerMaskIndex ] != cOCT6100_INVALID_INDEX ) - { - /* Must release the load or accumulate entry mixer event. */ - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pNewParticipant->ausLoadOrAccumulateEventIndex[ pCurrentParticipant->ulListenerMaskIndex ] ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - - pNewParticipant->ausLoadOrAccumulateEventIndex[ pCurrentParticipant->ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX; - } - } - - /* Check this participant can hear us. */ - if ( ( pCurrentParticipant->ulListenerMask & ( 0x1 << f_ulListenerMaskIndex ) ) == 0x0 ) - { - /* If the load or event entry in the mixer memory was reserved. */ - if ( pCurrentParticipant->ausLoadOrAccumulateEventIndex[ f_ulListenerMaskIndex ] != cOCT6100_INVALID_INDEX ) - { - /* Must release the load or accumulate entry mixer event. */ - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pCurrentParticipant->ausLoadOrAccumulateEventIndex[ f_ulListenerMaskIndex ] ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - - pCurrentParticipant->ausLoadOrAccumulateEventIndex[ f_ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX; - } - } - } - } - } - - return ulResult; - } - } - else /* if ( ulResult != cOCT6100_ERR_OK ) */ - { - ulTempVar = Oct6100ApiReleaseFlexConfParticipantEntry( f_pApiInstance, pChanEntry->usFlexConfParticipantIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - - pChanEntry->usFlexConfParticipantIndex = cOCT6100_INVALID_INDEX; - - /* Return the error code to the user. The mixer event allocation failed. */ - return ulResult; - } - - /*=======================================================================*/ - } - else /* if ( f_fFlexibleConfBridge == FALSE ) */ - { - /*=======================================================================*/ - /* Normal conferencing. */ - - /* Reserve an entry for the load event in the mixer memory. */ - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, f_pusLoadEventIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fLoadEventReserved = TRUE; - /* Reserve an entry for the substract and store event in the mixer memory. */ - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, f_pusSubStoreEventIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fStoreEventReserved = TRUE; - - /* If using the SOUT port, we must copy this entry */ - if( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - /* Reserve an entry for the copy event in the mixer memory. */ - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, f_pusCopyEventIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fCopyEventReserved = TRUE; - - /* Reserve a SIN copy entry if none were reserved before. */ - if ( pChanEntry->usExtraSinTsiMemIndex == cOCT6100_INVALID_INDEX ) - { - /* Reserve an entry for the extra tsi chariot memory. */ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, - &pChanEntry->usExtraSinTsiMemIndex ); - - if ( ulResult == cOCT6100_ERR_OK ) - fExtraSinTsiReserved = TRUE; - } - } - } - } - } - - if ( ( ulResult == cOCT6100_ERR_OK ) && ( f_fTap == TRUE ) ) - { - /* Reserve a "tap" bridge. */ - tOCT6100_CONF_BRIDGE_OPEN ConfBridgeOpen; - UINT32 ulTapBridgeHndl = 0; - - Oct6100ConfBridgeOpenDef( &ConfBridgeOpen ); - - ConfBridgeOpen.pulConfBridgeHndl = &ulTapBridgeHndl; - - ulResult = Oct6100ConfBridgeOpenSer( f_pApiInstance, &ConfBridgeOpen ); - - *f_pusTapBridgeIndex = (UINT16)( ulTapBridgeHndl & cOCT6100_HNDL_INDEX_MASK ); - } - - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( fLoadEventReserved == TRUE ) - { - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, *f_pusLoadEventIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if ( fStoreEventReserved == TRUE ) - { - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, *f_pusSubStoreEventIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if ( fCopyEventReserved == TRUE ) - { - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, *f_pusCopyEventIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if ( fExtraSinTsiReserved == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pChanEntry->usExtraSinTsiMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - - pChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX; - } - - return ulResult; - } - - /*=======================================================================*/ - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBridgeEventAdd - -Description: Add the event into the global event list of the chip and update - the bridge and channel structures. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to - keep the present state of the chip and all its - resources. -f_usBridgeIndex Index of the current bridge in the API list. -f_usChanIndex Index of the current channel in the API list. -f_fFlexibleConfBridge If this is a flexible conference bridge. -f_usLoadEventIndex Allocated entry for the Load event of the - channel. -f_usSubStoreEventIndex Allocated entry for the substract and store - event of the channel. -f_usCopyEventIndex Allocated entry for the copy event of the - channel. -f_ulInputPort Input port where to copy samples from. -f_fMute Mute flag indicating if the channel is added in - a mute state. -f_ulListenerMaskIndex Index of the listener in this flexible conference bridge. -f_ulListenerMask Mask of listeners in this flexible conference bridge. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiBridgeEventAdd -UINT32 Oct6100ApiBridgeEventAdd( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChanIndex, - IN UINT8 f_fFlexibleConfBridge, - IN UINT16 f_usLoadEventIndex, - IN UINT16 f_usSubStoreEventIndex, - IN UINT16 f_usCopyEventIndex, - IN UINT32 f_ulInputPort, - IN UINT8 f_fMute, - IN UINT32 f_ulListenerMaskIndex, - IN UINT32 f_ulListenerMask, - IN UINT8 f_fTap, - IN UINT16 f_usTapBridgeIndex, - IN UINT16 f_usTapChanIndex ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - - tPOCT6100_API_MIXER_EVENT pLoadEventEntry; - tPOCT6100_API_MIXER_EVENT pSubStoreEventEntry; - tPOCT6100_API_MIXER_EVENT pTempEntry; - - tPOCT6100_API_CHANNEL pEchoChanEntry; - tPOCT6100_API_CHANNEL pTapEchoChanEntry = NULL; - tPOCT6100_API_CHANNEL pTempEchoChanEntry; - - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - - UINT32 ulResult; - UINT16 usChannelIndex; - UINT16 usLastSubStoreEventIndex; - UINT16 usLastLoadEventIndex; - - BOOL fAddSinCopy = FALSE; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Get the bridge and channel entries of interest. */ - if ( f_fTap == FALSE ) - { - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pBridgeEntry, f_usBridgeIndex ); - } - else - { - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pBridgeEntry, f_usTapBridgeIndex ); - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTapEchoChanEntry, f_usTapChanIndex ); - } - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex ); - - if ( f_fFlexibleConfBridge == TRUE ) - { - tPOCT6100_API_FLEX_CONF_PARTICIPANT pNewParticipant; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pCurrentParticipant; - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pNewParticipant, pEchoChanEntry->usFlexConfParticipantIndex ); - - /* Search through the list of API channel entry for the ones onto this bridge. */ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - /* Channel reserved? */ - if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) ) - { - /* On current bridge? */ - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pCurrentParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if we can hear this participant. */ - if ( ( pTempEchoChanEntry->fMute == FALSE ) && ( ( f_ulListenerMask & ( 0x1 << pCurrentParticipant->ulListenerMaskIndex ) ) == 0x0 ) ) - { - /* First create/update the current channel's mixer. */ - ulResult = Oct6100ApiBridgeAddParticipantToChannel( - f_pApiInstance, - f_usBridgeIndex, - usChannelIndex, - f_usChanIndex, - pNewParticipant->ausLoadOrAccumulateEventIndex[ pCurrentParticipant->ulListenerMaskIndex ], - f_usSubStoreEventIndex, - f_usCopyEventIndex, - pCurrentParticipant->ulInputPort, - f_ulInputPort ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Check if this participant can hear us. */ - if ( ( f_fMute == FALSE ) && ( ( pCurrentParticipant->ulListenerMask & ( 0x1 << f_ulListenerMaskIndex ) ) == 0x0 ) ) - { - /* Then create/update this channel's mixer. */ - ulResult = Oct6100ApiBridgeAddParticipantToChannel( - f_pApiInstance, - f_usBridgeIndex, - f_usChanIndex, - usChannelIndex, - pCurrentParticipant->ausLoadOrAccumulateEventIndex[ f_ulListenerMaskIndex ], - pTempEchoChanEntry->usSubStoreEventIndex, - pTempEchoChanEntry->usSinCopyEventIndex, - f_ulInputPort, - pCurrentParticipant->ulInputPort ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the Rin silence event can be cleared now that the */ - /* channel has been added to a conference. */ - if ( ( pCurrentParticipant->fFlexibleMixerCreated == TRUE ) - && ( pTempEchoChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) ) - { - /* Remove the event from the list. */ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pTempEchoChanEntry->usRinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pTempEchoChanEntry->usRinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_DF; - - pTempEchoChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - } - } - } - } - - /* Check if the mixer for the destination channel has been created. */ - if ( pNewParticipant->fFlexibleMixerCreated == FALSE ) - { - /* Save store event index that might be used for next channel added. */ - pEchoChanEntry->usSubStoreEventIndex = f_usSubStoreEventIndex; - } - else - { - /* Check if the Rin silence event can be cleared now that the */ - /* channel has been added to a conference. */ - if ( pEchoChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pEchoChanEntry->usRinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pEchoChanEntry->usRinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_DF; - - pEchoChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - } - - pNewParticipant->ulListenerMaskIndex = f_ulListenerMaskIndex; - pNewParticipant->ulListenerMask = f_ulListenerMask; - - /* Remember this channel's input port. */ - pNewParticipant->ulInputPort = f_ulInputPort; - - /*=======================================================================*/ - } - else /* if ( f_fFlexibleConfBridge == FALSE ) */ - { - /* Configure the SIN copy mixer entry and memory - if using the SOUT port. */ - if ( ( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) && ( f_fTap == FALSE ) ) - { - if ( pEchoChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pEchoChanEntry->usSinTsstIndex, - pEchoChanEntry->usExtraSinTsiMemIndex, - pEchoChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* If the silence TSI is loaded on this port, update with the extra sin TSI. */ - if ( pEchoChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pEchoChanEntry->usExtraSinTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, f_usLoadEventIndex ); - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, f_usSubStoreEventIndex ); - - /*=======================================================================*/ - /* Program the Load event.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - if ( ( f_fMute == FALSE ) || ( f_fTap == TRUE ) ) - { - if ( pBridgeEntry->usLoadIndex != cOCT6100_INVALID_INDEX ) - { - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE; - - /* Set the event type. */ - pLoadEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE; - - if ( f_fTap == TRUE ) - return cOCT6100_ERR_FATAL_D1; - } - else /* pBridgeEntry->usLoadIndex == cOCT6100_INVALID_INDEX */ - { - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_LOAD; - - /* Modify the bridge entry to show store the new load index.*/ - pBridgeEntry->usLoadIndex = f_usLoadEventIndex; - - /* Set the event type.*/ - pLoadEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD; - } - - /* Select the TSI memory index according to the source port. */ - if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - if ( f_fTap == FALSE ) - { - WriteParams.usWriteData |= pEchoChanEntry->usSinSoutTsiMemIndex; - } - else - { - tPOCT6100_API_CONF_BRIDGE pTempBridgeEntry; - UINT16 usTempWriteData; - UINT32 ulTempWriteAddress; - - /* Save temp write data before trying to clear the Rin TSST. */ - usTempWriteData = WriteParams.usWriteData; - ulTempWriteAddress = WriteParams.ulWriteAddress; - - /* Clear the Rin TSST if used. */ - if ( pTapEchoChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - /* Deactivate the TSST entry.*/ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( pTapEchoChanEntry->usRinTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Reassign write data that might have been cleared by write above. */ - WriteParams.usWriteData = usTempWriteData; - WriteParams.ulWriteAddress = ulTempWriteAddress; - WriteParams.usWriteData |= pTapEchoChanEntry->usRinRoutTsiMemIndex; - - /* Remember that this channel is being tapped by us. */ - pTapEchoChanEntry->fBeingTapped = TRUE; - pTapEchoChanEntry->usTapChanIndex = f_usChanIndex; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pTempBridgeEntry, f_usBridgeIndex ); - - pTempBridgeEntry->usNumTappedClients++; - } - } - else /* if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_RIN ) */ - { - WriteParams.usWriteData |= pEchoChanEntry->usRinRoutTsiMemIndex; - } - } - else /* f_fMute == TRUE */ - { - /* Do not load the sample if the channel is muted. */ - if ( pBridgeEntry->usNumClients == 0 ) - { - /* If the participant to be added is muted, and it would cause the conference to */ - /* be completely muted, load the silence TSI. */ - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_LOAD; - WriteParams.usWriteData |= 1534; /* TSI index 1534 reserved for silence */ - - /* We know for sure that the load of the bridge will be the silence one. */ - pBridgeEntry->usSilenceLoadEventPtr = f_usLoadEventIndex; - } - else - { - /* Do nothing! */ - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - } - - /* Set the event type. */ - pLoadEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Program the Substract and store event.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - if ( ( f_fMute == FALSE ) && ( f_fTap == FALSE ) ) - { - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_SUB_STORE; - /* Select the TSI memory index and PCM law according to the source port. */ - if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - WriteParams.usWriteData |= pEchoChanEntry->usSinSoutTsiMemIndex; - } - else /* if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_RIN ) */ - { - WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.byRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - WriteParams.usWriteData |= pEchoChanEntry->usRinRoutTsiMemIndex; - } - - /* Set the event type. */ - pSubStoreEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_SUB_STORE; - } - else /* f_fMute == TRUE */ - { - /* Do not substore the sample if the channel is muted. */ - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_STORE; - - /* Select the PCM law according to the source port. */ - if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - } - else /* if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_RIN ) */ - { - WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.byRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - } - /* Set the event type. */ - pSubStoreEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_STORE; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pEchoChanEntry->usRinRoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Program the Copy event - if using the SOUT port */ - if ( ( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) && ( f_fTap == FALSE ) ) - { - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - WriteParams.usWriteData |= pEchoChanEntry->usExtraSinTsiMemIndex; - WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pEchoChanEntry->usSinSoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set add copy event flag. */ - fAddSinCopy = TRUE; - - /* For sure. */ - pEchoChanEntry->fCopyEventCreated = TRUE; - } - else if ( f_fTap == TRUE ) - { - /* Accumulate the tapped channel's voice instead of building a copy event. */ - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE; - WriteParams.usWriteData |= pTapEchoChanEntry->usSinSoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Link to next operation. */ - WriteParams.ulWriteAddress += 4; - WriteParams.usWriteData = f_usSubStoreEventIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the software model. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, f_usCopyEventIndex ); - - pTempEntry->usSourceChanIndex = f_usTapChanIndex; - pTempEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE; - pTempEntry->usNextEventPtr = f_usSubStoreEventIndex; - pTempEntry->usDestinationChanIndex = cOCT6100_INVALID_INDEX; - pTempEntry->fReserved = TRUE; - } - /*=======================================================================*/ - - /*=======================================================================*/ - /* Now insert the event into the list.*/ - if ( pBridgeEntry->usNumClients == 0 ) - { - /* This is the first entry for this bridge. Insert the two events at the head - of the list just after the last sub-store event.*/ - if ( f_fTap == FALSE ) - { - ulResult = Oct6100ApiGetPrevLastSubStoreEvent( f_pApiInstance, f_usBridgeIndex, pBridgeEntry->usFirstLoadEventPtr, &usLastSubStoreEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND ) - { - if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX ) - { - usLastSubStoreEventIndex = cOCT6100_MIXER_HEAD_NODE; - } - else - { - usLastSubStoreEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr; - } - } - else - { - return cOCT6100_ERR_FATAL_26; - } - } - } - else - { - if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX ) - { - usLastSubStoreEventIndex = cOCT6100_MIXER_HEAD_NODE; - } - else - { - usLastSubStoreEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr; - } - } - - /* An Entry was found, now, modify it's value.*/ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usLastSubStoreEventIndex ); - - /* Set the Sub-Store event first.*/ - pSubStoreEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_SUB_STORE; - pSubStoreEventEntry->usNextEventPtr = pTempEntry->usNextEventPtr; - - /*=======================================================================*/ - /* Program the Sub-Store event. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - WriteParams.usWriteData = (UINT16)( pSubStoreEventEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Set the load/accumulate event now.*/ - if ( f_fTap == FALSE ) - { - pLoadEventEntry->usNextEventPtr = f_usSubStoreEventIndex; - } - else - { - /* This is a little tricky, we use the copy event index for accumulating the tapped channel's voice. */ - pLoadEventEntry->usNextEventPtr = f_usCopyEventIndex; - } - - /*=======================================================================*/ - /* Program the load/accumulate event. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pLoadEventEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Now modify the previous last Sub Store event from another bridge. */ - pTempEntry->usNextEventPtr = f_usLoadEventIndex; - - /*=======================================================================*/ - /* Modify the last node of the other bridge. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usLastSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Set the event pointer info in the bridge stucture. */ - pBridgeEntry->usFirstLoadEventPtr = f_usLoadEventIndex; - pBridgeEntry->usFirstSubStoreEventPtr = f_usSubStoreEventIndex; - pBridgeEntry->usLastSubStoreEventPtr = f_usSubStoreEventIndex; - - /* Update the global mixer pointers. */ - if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == cOCT6100_INVALID_INDEX ) - { - /* This bridge is the first to generate mixer event. */ - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = f_usLoadEventIndex; - pSharedInfo->MixerInfo.usLastBridgeEventPtr = f_usSubStoreEventIndex; - } - else if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == usLastSubStoreEventIndex ) - { - /* The two entries were added at the end of the bridge section, */ - /* change only the last pointer. */ - pSharedInfo->MixerInfo.usLastBridgeEventPtr = f_usSubStoreEventIndex; - } - else if ( usLastSubStoreEventIndex == cOCT6100_MIXER_HEAD_NODE || - usLastSubStoreEventIndex == pSharedInfo->MixerInfo.usLastSoutCopyEventPtr ) - { - /* The two entries were added at the start of the bridge section, */ - /* change only the first pointer. */ - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = f_usLoadEventIndex; - } - } - else /* pBridgeEntry->usNumClients != 0 */ - { - /* For sanity. */ - if ( f_fTap == TRUE ) - return cOCT6100_ERR_FATAL_D2; - - /*=======================================================================*/ - /* Program the Load event. */ - - /* Now find the last load entry of this bridge. */ - ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, pBridgeEntry->usFirstLoadEventPtr, pBridgeEntry->usFirstSubStoreEventPtr, 0, &usLastLoadEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Add the load/accumulate event to the list. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usLastLoadEventIndex ); - - /* Set the load event now. */ - pLoadEventEntry->usNextEventPtr = pTempEntry->usNextEventPtr; - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pLoadEventEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Modify the previous last load event. */ - - /* Now modify the previous last load event. */ - pTempEntry->usNextEventPtr = f_usLoadEventIndex; - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usLastLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Program the Sub-Store event. */ - - usLastSubStoreEventIndex = pBridgeEntry->usLastSubStoreEventPtr; - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usLastSubStoreEventIndex ); - - /* Set the Sub-Store event first. */ - pSubStoreEventEntry->usNextEventPtr = pTempEntry->usNextEventPtr; - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pSubStoreEventEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Modify the previous last sub store event of the bridge. */ - - /* Now modify the last Load event of the bridge. */ - pTempEntry->usNextEventPtr = f_usSubStoreEventIndex; - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usLastSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Update the bridge pointers. */ - pBridgeEntry->usLastSubStoreEventPtr = f_usSubStoreEventIndex; - - /* Check if modification to the global mixer pointer are required. */ - if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == usLastSubStoreEventIndex ) - { - /* We have a new last bridge pointer. */ - pSharedInfo->MixerInfo.usLastBridgeEventPtr = f_usSubStoreEventIndex; - } - } - - if ( f_fTap == TRUE ) - { - if ( pEchoChanEntry->usRinTsstIndex == cOCT6100_INVALID_INDEX ) - { - /* Remove the mute on the Rin port. */ - - UINT32 ulTempData; - UINT32 ulMask; - UINT32 ulBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_usChanIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst; - - /* Configure the level control. */ - - UINT32 ulFeatureBytesOffset = pSharedInfo->MemoryMap.RinLevelControlOfst.usDwordOffset * 4; - UINT32 ulFeatureBitOffset = pSharedInfo->MemoryMap.RinLevelControlOfst.byBitOffset; - UINT32 ulFeatureFieldLength = pSharedInfo->MemoryMap.RinLevelControlOfst.byFieldSize; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pEchoChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - - /* Set the DC filter to pass through.*/ - ulTempData |= ( cOCT6100_PASS_THROUGH_LEVEL_CONTROL << ulFeatureBitOffset ); - - /* First read the DWORD where the field is located. */ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pEchoChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Set the event entries as reserved. */ - pLoadEventEntry->fReserved = TRUE; - pSubStoreEventEntry->fReserved = TRUE; - - /* Store the event indexes into the channel structure. */ - pEchoChanEntry->usLoadEventIndex = f_usLoadEventIndex; - pEchoChanEntry->usSubStoreEventIndex = f_usSubStoreEventIndex; - - /* Check if must insert the Sin copy event in the list. */ - if ( fAddSinCopy == TRUE ) - { - /* Now insert the Sin copy event into the list. */ - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - f_usCopyEventIndex, - cOCT6100_EVENT_TYPE_SIN_COPY, - f_usChanIndex ); - } - - /* Check if the Rin silence event can be cleared now that the */ - /* channel has been added to a conference. */ - if ( ( f_fTap == FALSE ) && ( pEchoChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) ) - { - /* Remove the event from the list. */ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pEchoChanEntry->usRinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pEchoChanEntry->usRinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_DF; - - pEchoChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - } - - /* Configure the RIN copy mixer entry and memory - if using the RIN port. */ - if ( ( f_fFlexibleConfBridge == TRUE ) && ( f_ulInputPort == cOCT6100_CHANNEL_PORT_RIN ) ) - { - if ( pEchoChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pEchoChanEntry->usRinTsstIndex, - pEchoChanEntry->usExtraRinTsiMemIndex, - pEchoChanEntry->TdmConfig.byRinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - if ( pBridgeEntry->fDominantSpeakerSet == TRUE ) - { - /* Dominant speaker is another channel. Set accordingly for this new conference channel. */ - ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, f_usChanIndex, pBridgeEntry->usDominantSpeakerChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else - { - /* No dominant speaker set on this bridge yet. */ - ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, f_usChanIndex, cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Update the bridge entry. */ - pBridgeEntry->usNumClients++; - - /* Store the bridge index into the channel structure. */ - pEchoChanEntry->usBridgeIndex = f_usBridgeIndex; - - /* Store the copy event index into the channel structure. */ - if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - pEchoChanEntry->usSinCopyEventIndex = f_usCopyEventIndex; - } - else - { - pEchoChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX; - } - - /* Remember if the channel is muted in the conference. */ - pEchoChanEntry->fMute = f_fMute; - - /* Remember if the channel is a tap in a conference. */ - pEchoChanEntry->fTap = f_fTap; - - /* We start by not being tapped. */ - pEchoChanEntry->fBeingTapped = FALSE; - pEchoChanEntry->usTapChanIndex = cOCT6100_INVALID_INDEX; - - /* Remember the tap bridge index if necessary. */ - if ( pEchoChanEntry->fTap == TRUE ) - { - pEchoChanEntry->usTapBridgeIndex = f_usTapBridgeIndex; - } - else - { - pEchoChanEntry->usTapBridgeIndex = cOCT6100_INVALID_INDEX; - } - - /* Indicate that the extra SIN TSI is currently in used by the conference bridge. */ - if ( f_ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - pEchoChanEntry->usExtraSinTsiDependencyCnt++; - } - - /* Indicate that the extra RIN TSI is currently in used by the conference bridge. */ - if ( ( f_fFlexibleConfBridge == TRUE ) && ( f_ulInputPort == cOCT6100_CHANNEL_PORT_RIN ) ) - { - pEchoChanEntry->usExtraRinTsiDependencyCnt++; - } - - /* Update the chip stats structure. */ - pSharedInfo->ChipStats.usNumEcChanUsingMixer++; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBridgeAddParticipantToChannel - -Description: Used for the flexible conference bridges. Insert a participant - onto a channel that is on a conference. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_usBridgeIndex Bridge index where this channel is located. -f_usSourceChannelIndex Source channel to copy voice from. -f_usDestinationChannelIndex Destination channel to store resulting voice to. -f_usLoadOrAccumulateEventIndex Load or Accumulate allocated event index. -f_usStoreEventIndex Store allocated event index. -f_usCopyEventIndex Copy allocated event index. -f_ulSourceInputPort Source input port of the conference for this channel. -f_ulDestinationInputPort Destination input port of the conference for this channel. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiBridgeAddParticipantToChannel -UINT32 Oct6100ApiBridgeAddParticipantToChannel( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usSourceChannelIndex, - IN UINT16 f_usDestinationChannelIndex, - IN UINT16 f_usLoadOrAccumulateEventIndex, - IN UINT16 f_usStoreEventIndex, - IN UINT16 f_usCopyEventIndex, - IN UINT32 f_ulSourceInputPort, - IN UINT32 f_ulDestinationInputPort ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - - tPOCT6100_API_MIXER_EVENT pLoadEventEntry; - tPOCT6100_API_MIXER_EVENT pStoreEventEntry; - tPOCT6100_API_MIXER_EVENT pTempEntry; - - tPOCT6100_API_CHANNEL pSourceChanEntry; - tPOCT6100_API_CHANNEL pDestinationChanEntry; - - tPOCT6100_API_FLEX_CONF_PARTICIPANT pSourceParticipant; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pDestinationParticipant; - - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - - UINT32 ulResult; - UINT16 usLastSubStoreEventIndex; - UINT16 usLastLoadEventIndex; - BOOL fInsertCopy = FALSE; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex ); - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pSourceChanEntry, f_usSourceChannelIndex ); - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pSourceParticipant, pSourceChanEntry->usFlexConfParticipantIndex ); - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pDestinationChanEntry, f_usDestinationChannelIndex ); - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pDestinationParticipant, pDestinationChanEntry->usFlexConfParticipantIndex ); - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, f_usLoadOrAccumulateEventIndex ); - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pStoreEventEntry, f_usStoreEventIndex ); - - /* Check if we are creating the first event for this channel. */ - if ( pDestinationParticipant->fFlexibleMixerCreated == FALSE ) - { - /*=======================================================================*/ - /* Before creating the participant's flexible mixer, make sure the extra Sin */ - /* mixer event is programmed correctly for sending the voice stream to the right place. */ - - /* Configure the SIN copy mixer entry and memory - if using the SOUT port. */ - if ( f_ulDestinationInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - if ( pDestinationChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pDestinationChanEntry->usSinTsstIndex, - pDestinationChanEntry->usExtraSinTsiMemIndex, - pDestinationChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* If the silence TSI is loaded on this port, update with the extra sin TSI. */ - if ( pDestinationChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pDestinationChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pDestinationChanEntry->usExtraSinTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Program the load event. This is the first event for this new destination channel. */ - - /* First set the TSI buffer where the resulting stream should be written to. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadOrAccumulateEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - /* For sure, we are loading. */ - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_LOAD; - - /* Select the TSI memory index according to the source port. */ - if ( f_ulSourceInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - WriteParams.usWriteData |= pSourceChanEntry->usSinSoutTsiMemIndex; - } - else /* if ( f_ulSourceInputPort == cOCT6100_CHANNEL_PORT_RIN ) */ - { - WriteParams.usWriteData |= pSourceChanEntry->usExtraRinTsiMemIndex; - } - - /* Set the event type. */ - pLoadEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD; - - /* Set the source channel index. */ - pLoadEventEntry->usSourceChanIndex = f_usSourceChannelIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - - /*=======================================================================*/ - /* Program the store event. */ - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_STORE; - - /* Select the TSI memory index and PCM law according to the source port. */ - if ( f_ulDestinationInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - WriteParams.usWriteData |= pDestinationChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - WriteParams.usWriteData |= pDestinationChanEntry->usSinSoutTsiMemIndex; - } - else /* if ( f_ulDestinationInputPort == cOCT6100_CHANNEL_PORT_RIN ) */ - { - WriteParams.usWriteData |= pDestinationChanEntry->TdmConfig.byRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - WriteParams.usWriteData |= pDestinationChanEntry->usRinRoutTsiMemIndex; - } - - /* Set the event type. */ - pStoreEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_STORE; - - /* Set the destination channel index. */ - pStoreEventEntry->usDestinationChanIndex = f_usDestinationChannelIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pDestinationChanEntry->usRinRoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - - /*=======================================================================*/ - /* Program the Copy event - if using the SOUT port */ - - if ( ( f_ulDestinationInputPort == cOCT6100_CHANNEL_PORT_SOUT ) && ( pDestinationChanEntry->fCopyEventCreated == FALSE ) ) - { - /* The copy event has not been created, create it once for the life of the participant on the bridge. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - WriteParams.usWriteData |= pDestinationChanEntry->usExtraSinTsiMemIndex; - WriteParams.usWriteData |= pDestinationChanEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pDestinationChanEntry->usSinSoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - pDestinationChanEntry->fCopyEventCreated = TRUE; - - /* Set insert copy flag. */ - fInsertCopy = TRUE; - } - - /*=======================================================================*/ - - - - /*=======================================================================*/ - /*=======================================================================*/ - /* Now, insert the events into the current list. */ - /*=======================================================================*/ - /*=======================================================================*/ - - /* This is the first entry for this channel. Insert the two events at the head */ - /* of the list just after the last Sub-Store or Store event. */ - ulResult = Oct6100ApiGetPrevLastSubStoreEvent( f_pApiInstance, f_usBridgeIndex, f_usLoadOrAccumulateEventIndex, &usLastSubStoreEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND ) - { - if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX ) - { - usLastSubStoreEventIndex = cOCT6100_MIXER_HEAD_NODE; - } - else - { - usLastSubStoreEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr; - } - } - else - { - return cOCT6100_ERR_FATAL_26; - } - } - - /* An entry was found, now, modify it's value. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usLastSubStoreEventIndex ); - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Link the store event first. */ - - pStoreEventEntry->usNextEventPtr = pTempEntry->usNextEventPtr; - - /* Link the store event. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - WriteParams.usWriteData = (UINT16)( pStoreEventEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Link the load event now.*/ - - pLoadEventEntry->usNextEventPtr = f_usStoreEventIndex; - - /* Link the load event.*/ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadOrAccumulateEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pLoadEventEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Now modify the previous last Sub-Store or Store event from another bridge, */ - /* such that it links to us. */ - - pTempEntry->usNextEventPtr = f_usLoadOrAccumulateEventIndex; - - /* Modify the last node of the other bridge. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usLastSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Set the event pointer info in the bridge stucture. */ - - if ( pBridgeEntry->usFirstLoadEventPtr == cOCT6100_INVALID_INDEX ) - { - /* We only do this once in case of the flexible conference bridges. */ - pBridgeEntry->usFirstLoadEventPtr = f_usLoadOrAccumulateEventIndex; - pBridgeEntry->usFirstSubStoreEventPtr = f_usStoreEventIndex; - } - - pBridgeEntry->usLastSubStoreEventPtr = f_usStoreEventIndex; - - /* Update the global mixer pointers. */ - if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == cOCT6100_INVALID_INDEX ) - { - /* This bridge is the first to generate mixer event. */ - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = f_usLoadOrAccumulateEventIndex; - pSharedInfo->MixerInfo.usLastBridgeEventPtr = f_usStoreEventIndex; - } - else if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == usLastSubStoreEventIndex ) - { - /* The two entries were added at the end of the bridge section, */ - /* change only the last pointer. */ - pSharedInfo->MixerInfo.usLastBridgeEventPtr = f_usStoreEventIndex; - } - else if ( usLastSubStoreEventIndex == cOCT6100_MIXER_HEAD_NODE || - usLastSubStoreEventIndex == pSharedInfo->MixerInfo.usLastSoutCopyEventPtr ) - { - /* The two entries were added at the start of the bridge section, */ - /* change only the first pointer.*/ - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = f_usLoadOrAccumulateEventIndex; - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Insert the copy event if needed in the mixer's list. */ - - if ( fInsertCopy == TRUE ) - { - /* Now insert the Sin copy event into the list. */ - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - f_usCopyEventIndex, - cOCT6100_EVENT_TYPE_SIN_COPY, - f_usDestinationChannelIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Update the status of the instance structures. */ - - pDestinationParticipant->fFlexibleMixerCreated = TRUE; - - /* Set the event entries as reserved. */ - pLoadEventEntry->fReserved = TRUE; - pStoreEventEntry->fReserved = TRUE; - - /* Store the event indexes into the channel structure. */ - pDestinationChanEntry->usLoadEventIndex = f_usLoadOrAccumulateEventIndex; - pDestinationChanEntry->usSubStoreEventIndex = f_usStoreEventIndex; - - /*=======================================================================*/ - } - else /* if ( pDestinationChanEntry->fFlexibleMixerCreated == TRUE ) */ - { - /*=======================================================================*/ - /* Program the Accumulate event. */ - - /* First set the TSI buffer where the resulting stream should be written to. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadOrAccumulateEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - /* For sure, we are accumulating. */ - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE; - - /* Select the TSI memory index according to the source port. */ - if ( f_ulSourceInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - WriteParams.usWriteData |= pSourceChanEntry->usSinSoutTsiMemIndex; - } - else /* if ( f_ulSourceInputPort == cOCT6100_CHANNEL_PORT_RIN ) */ - { - WriteParams.usWriteData |= pSourceChanEntry->usExtraRinTsiMemIndex; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - - /*=======================================================================*/ - /*=======================================================================*/ - /* Now, insert the Accumulate event into the current list. */ - /*=======================================================================*/ - /*=======================================================================*/ - - /* Use the Load entry of this channel. */ - usLastLoadEventIndex = pDestinationChanEntry->usLoadEventIndex; - - /* Add the Accumulate event to the list. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usLastLoadEventIndex ); - - /* Set the accumulate event now. */ - pLoadEventEntry->usNextEventPtr = pTempEntry->usNextEventPtr; - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadOrAccumulateEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pLoadEventEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - - /*=======================================================================*/ - /* Modify the previous Load event. */ - - /* Now modify the previous Load event. */ - pTempEntry->usNextEventPtr = f_usLoadOrAccumulateEventIndex; - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usLastLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - - /*=======================================================================*/ - /* Update the status of the instance structures. */ - - /* Set the Accumulate event entry as reserved. */ - pLoadEventEntry->fReserved = TRUE; - /* Set the Event type. */ - pLoadEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE; - /* Set the source channel index. */ - pLoadEventEntry->usSourceChanIndex = f_usSourceChannelIndex; - - /*=======================================================================*/ - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeChanRemoveSer - -Description: Removes an echo channel from a conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeRemove Pointer to conference bridge channel remove structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeChanRemoveSer -UINT32 Oct6100ConfBridgeChanRemoveSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove ) -{ - UINT16 usBridgeIndex; - UINT16 usChanIndex = 0; - UINT16 usLoadEventIndex; - UINT16 usSubStoreEventIndex; - UINT16 usCopyEventIndex; - UINT32 ulResult; - UINT8 fFlexibleConfBridge; - UINT8 fTap; - - /* Check the validity of the channel and conference bridge given. */ - ulResult = Oct6100ApiCheckChanRemoveParams( - f_pApiInstance, - f_pConfBridgeRemove, - &usBridgeIndex, - &usChanIndex, - &fFlexibleConfBridge, - &fTap, - &usLoadEventIndex, - &usSubStoreEventIndex, - &usCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources reserved for the conference bridge. */ - ulResult = Oct6100ApiReleaseChanEventResources( - f_pApiInstance, - f_pConfBridgeRemove, - usBridgeIndex, - usChanIndex, - fFlexibleConfBridge, - usLoadEventIndex, - usSubStoreEventIndex, - usCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear the memory entry for this channel within the bridge. */ - ulResult = Oct6100ApiBridgeEventRemove( - f_pApiInstance, - f_pConfBridgeRemove, - usBridgeIndex, - usChanIndex, - fFlexibleConfBridge, - usLoadEventIndex, - usSubStoreEventIndex, - usCopyEventIndex, - fTap ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckChanRemoveParams - -Description: Check the validity of the channel and conference bridge given. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_pConfBridgeRemove Pointer to conference bridge channenl add structure. -f_pusBridgeIndex Pointer to the bridge index. -f_pfFlexibleConfBridge If this is a flexible conference bridge -f_pusChannelIndex Pointer to the channel index to be added to the bridge. -f_pusLoadEventIndex Pointer to the load mixer event. -f_pusSubStoreEventIndex Pointer to the sub-store mixer event. -f_pusCopyEventIndex Pointer to the copy mixer event. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckChanRemoveParams -UINT32 Oct6100ApiCheckChanRemoveParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove, - OUT PUINT16 f_pusBridgeIndex, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT8 f_pfFlexibleConfBridge, - OUT PUINT8 f_pfTap, - OUT PUINT16 f_pusLoadEventIndex, - OUT PUINT16 f_pusSubStoreEventIndex, - OUT PUINT16 f_pusCopyEventIndex ) -{ - UINT32 ulEntryOpenCnt; - tPOCT6100_API_CHANNEL pEchoChanEntry; - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - - /* Verify if the remove all flag is valid. */ - if ( f_pConfBridgeRemove->fRemoveAll != TRUE && - f_pConfBridgeRemove->fRemoveAll != FALSE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_REMOVE_ALL; - - /* Check the channel handle only if the remove all flag is set to FALSE. */ - if ( f_pConfBridgeRemove->fRemoveAll == FALSE ) - { - /*=====================================================================*/ - /* Check the channel handle. */ - - if ( (f_pConfBridgeRemove->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - *f_pusChannelIndex = (UINT16)( f_pConfBridgeRemove->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeRemove->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - if ( pEchoChanEntry->fBeingTapped == TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_DEPENDENCY; - - /*=====================================================================*/ - - *f_pusBridgeIndex = pEchoChanEntry->usBridgeIndex; - *f_pusLoadEventIndex = pEchoChanEntry->usLoadEventIndex; - *f_pusSubStoreEventIndex = pEchoChanEntry->usSubStoreEventIndex; - *f_pusCopyEventIndex = pEchoChanEntry->usSinCopyEventIndex; - - /* Check if the channel is really part of the bridge. */ - if ( *f_pusBridgeIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHAN_NOT_ON_BRIDGE; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex ) - - /* Return whether this is a flexible bridge or not. */ - *f_pfFlexibleConfBridge = pBridgeEntry->fFlexibleConferencing; - - /* Return whether this is a tap or not. */ - *f_pfTap = pEchoChanEntry->fTap; - } - else /* f_pConfBridgeRemove->fRemoveAll == TRUE */ - { - /* Check the provided handle. */ - if ( (f_pConfBridgeRemove->ulConfBridgeHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CONF_BRIDGE ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - *f_pusBridgeIndex = (UINT16)( f_pConfBridgeRemove->ulConfBridgeHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeRemove->ulConfBridgeHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pBridgeEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( ulEntryOpenCnt != pBridgeEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - /* This information is not currently available. */ - *f_pusLoadEventIndex = cOCT6100_INVALID_INDEX; - *f_pusSubStoreEventIndex = cOCT6100_INVALID_INDEX; - *f_pusCopyEventIndex = cOCT6100_INVALID_INDEX; - - /* Return whether this is a flexible bridge or not. */ - *f_pfFlexibleConfBridge = pBridgeEntry->fFlexibleConferencing; - - *f_pfTap = FALSE; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseChanEventResources - -Description: Release all resources reserved to the channel part of the - conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_pConfBridgeRemove Pointer to conference bridge channel add structure. -f_usBridgeIndex Index of the bridge structure within the API's bridge list. -f_usChanIndex Index of the channel structure within the API's channel list -f_fFlexibleConfBridge If this is a flexible conference bridge. -f_usLoadEventIndex Index of the load mixer event. -f_usSubStoreEventIndex Index of the sub-store mixer event. -f_usCopyEventIndex Index of the copy mixer event. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseChanEventResources -UINT32 Oct6100ApiReleaseChanEventResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChanIndex, - IN UINT8 f_fFlexibleConfBridge, - IN UINT16 f_usLoadEventIndex, - IN UINT16 f_usSubStoreEventIndex, - IN UINT16 f_usCopyEventIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pEchoChanEntry; - UINT32 ulResult; - UINT32 i; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - if ( f_fFlexibleConfBridge == TRUE ) - { - tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant; - - if ( f_pConfBridgeRemove->fRemoveAll == FALSE ) - { - tPOCT6100_API_CHANNEL pTempEchoChanEntry; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex ); - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex ); - - /* Release an entry for the store event in the mixer memory. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usSubStoreEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - /* Release an entry for the Sin copy event in the mixer memory. */ - /* This value can be invalid if the Rin port was used - no need to release. */ - if ( f_usCopyEventIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - } - - /* This value can be 0 if the Rin port was used - no need to release. */ - if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - /* Release the extra TSI entry.*/ - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraSinTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - } - - /* This value can be 0 if the Sout port was used - no need to release. */ - if ( pEchoChanEntry->usExtraRinTsiDependencyCnt == 1 ) - { - /* Release the extra TSI entry.*/ - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraRinTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - } - - /* Must travel all clients of this conference and release the load or accumulate events for */ - /* all participants which can hear us and vice versa. */ - - /* Search through the list of API channel entry for the ones on to this bridge. */ - for ( i = 0; ( i < pSharedInfo->ChipConfig.usMaxChannels ) && ( ulResult == cOCT6100_ERR_OK ); i++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, i ); - - /* Channel reserved? */ - if ( ( i != f_usChanIndex ) && pTempEchoChanEntry->fReserved == TRUE ) - { - /* On current bridge? */ - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if we can hear this participant. */ - if ( ( pParticipant->ulListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) - { - /* Must release the allocated mixer event. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX; - } - - /* Check if this participant can hear us. */ - if ( ( pTempParticipant->ulListenerMask & ( 0x1 << pParticipant->ulListenerMaskIndex ) ) == 0x0 ) - { - /* Must release the allocated mixer event. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pTempParticipant->ausLoadOrAccumulateEventIndex[ pParticipant->ulListenerMaskIndex ] ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - pTempParticipant->ausLoadOrAccumulateEventIndex[ pParticipant->ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX; - } - } - } - } - } - else /* f_pConfBridgeRemove->fRemoveAll == TRUE */ - { - UINT32 ulListenerMaskIndex; - - ulResult = cOCT6100_ERR_OK; - - /* Search through the list of API channel entry for the ones on to this bridge.*/ - for ( i = 0; ( i < pSharedInfo->ChipConfig.usMaxChannels ) && ( ulResult == cOCT6100_ERR_OK ); i++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, i ); - - /* Channel reserved? */ - if ( pEchoChanEntry->fReserved == TRUE ) - { - /* On current bridge? */ - if ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex ); - - /* Release an entry for the Store event in the Mixer memory. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pEchoChanEntry->usSubStoreEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - /* Release an entry for the Sin copy event in the Mixer memory. */ - /* This value can be invalid if the Rin port was used - no need to release. */ - if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pEchoChanEntry->usSinCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - } - - /* This value can be 0 if the Rin port was used - no need to release. */ - if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - /* Release the extra TSI entry.*/ - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraSinTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - } - - /* This value can be 0 if the Sout port was used - no need to release. */ - if ( pEchoChanEntry->usExtraRinTsiDependencyCnt == 1 ) - { - /* Release the extra TSI entry.*/ - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraRinTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - } - - /* Check if something can be freed. */ - for ( ulListenerMaskIndex = 0; ulListenerMaskIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulListenerMaskIndex ++ ) - { - if ( pParticipant->ausLoadOrAccumulateEventIndex[ ulListenerMaskIndex ] != cOCT6100_INVALID_INDEX ) - { - /* Must release the allocated mixer event. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pParticipant->ausLoadOrAccumulateEventIndex[ ulListenerMaskIndex ] ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - pParticipant->ausLoadOrAccumulateEventIndex[ ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX; - } - } - } - } - } - - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else /* if ( f_fFlexibleConfBridge == FALSE ) */ - { - if ( f_pConfBridgeRemove->fRemoveAll == FALSE ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex ); - - /* Release the entry for the load event in the mixer memory. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usLoadEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - /* Release an entry for the substract and store event in the mixer memory. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usSubStoreEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - /* Release an entry for the Sin copy event in the Mixer memory. */ - /* This value can be invalid if the Rin port was used - no need to release. */ - if ( f_usCopyEventIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - } - - /* This value can be 0 if the Rin port was used - no need to release. */ - if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - /* Release the extra TSI entry. */ - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraSinTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - } - } - else /* f_pConfBridgeRemove->fRemoveAll == TRUE */ - { - /* Search through the list of API channel entry for the ones on to the specified bridge.*/ - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxChannels; i++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, i ); - - if ( pEchoChanEntry->fReserved == TRUE ) - { - if ( ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) && ( pEchoChanEntry->fTap == FALSE ) ) - { - /* Release the entry for the load event in the mixer memory. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, - pEchoChanEntry->usLoadEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - /* Release an entry for the substract and store event in the Mixer memory. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, - pEchoChanEntry->usSubStoreEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - /* Release an entry for the Sin copy event in the Mixer memory. */ - /* This value can be invalid if the Rin port was used - no need to release. */ - if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, - pEchoChanEntry->usSinCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - } - - /* This value can be 0 if the Rin port was used - no need to release. */ - if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - /* Release the extra TSI entry.*/ - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pEchoChanEntry->usExtraSinTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - } - } - } - } - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBridgeEventRemove - -Description: Remove the event from the global event list of the chip and - update the bridge and channel structures. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_pConfBridgeRemove Pointer to a conference bridge channel remove structure. -f_usBridgeIndex Index of the current bridge in the API list. -f_usChanIndex Index of the current channel in the API list. -f_fFlexibleConfBridge If this is a flexible conference bridge. -f_usLoadEventIndex Allocated entry for the Load event of the channel. -f_usSubStoreEventIndex Allocated entry for the substract and store event of the channel. -f_usCopyEventIndex Allocated entry for the copy event of the channel. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiBridgeEventRemove -UINT32 Oct6100ApiBridgeEventRemove ( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChanIndex, - IN UINT8 f_fFlexibleConfBridge, - IN UINT16 f_usLoadEventIndex, - IN UINT16 f_usSubStoreEventIndex, - IN UINT16 f_usCopyEventIndex, - IN UINT8 f_fTap ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - - tPOCT6100_API_MIXER_EVENT pLoadEventEntry; - tPOCT6100_API_MIXER_EVENT pSubStoreEventEntry; - tPOCT6100_API_MIXER_EVENT pCopyEventEntry = NULL; - tPOCT6100_API_MIXER_EVENT pTempEntry; - - tPOCT6100_API_CHANNEL pEchoChanEntry; - tPOCT6100_API_CHANNEL pTempEchoChanEntry; - - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - - UINT32 ulResult; - UINT16 usPreviousEventIndex; - UINT16 usTempEventIndex; - UINT32 ulLoopCount = 0; - UINT16 usReadData; - UINT16 usChannelIndex; - UINT32 i; - - BOOL fRemoveSinCopy = FALSE; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pBridgeEntry, f_usBridgeIndex ); - - /* If no client on the bridge, and the remove all option is specified, return here. */ - if ( ( pBridgeEntry->usNumClients == 0 ) && ( f_pConfBridgeRemove->fRemoveAll == TRUE ) ) - return cOCT6100_ERR_OK; - - /* Make sure the dominant speaker feature is disabled first. */ - if ( pBridgeEntry->fDominantSpeakerSet == TRUE ) - { - /* If all channels are to be removed or if the dominant speaker is the current channel to be removed. */ - if ( ( f_pConfBridgeRemove->fRemoveAll == TRUE ) - || ( ( f_pConfBridgeRemove->fRemoveAll == FALSE ) && ( pBridgeEntry->usDominantSpeakerChanIndex == f_usChanIndex ) ) ) - { - /* Disable on all channels part of this conference. */ - - /* Search through the list of API channel entry for the ones on to this bridge. */ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - if ( pTempEchoChanEntry->fReserved == TRUE ) - { - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, usChannelIndex, cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - - /* Save this in the conference bridge structure. */ - pBridgeEntry->fDominantSpeakerSet = FALSE; - pBridgeEntry->usDominantSpeakerChanIndex = cOCT6100_INVALID_INDEX; - } - else - { - /* Only disable this current channel. */ - ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, f_usChanIndex, cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - if ( f_fFlexibleConfBridge == TRUE ) - { - tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant; - UINT16 ausMutePortChannelIndexes[ cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE ]; - UINT32 ulMutePortChannelIndex; - - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = cOCT6100_INVALID_INDEX; - - if ( f_pConfBridgeRemove->fRemoveAll == FALSE ) - { - /* The channel index is valid. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex ); - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex ); - - /* Search through the list of API channel entry for the ones on to this bridge. */ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) ) - { - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if we can hear this participant. */ - if ( ( ( pParticipant->ulListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) - && ( pParticipant->fFlexibleMixerCreated == TRUE ) - && ( pTempEchoChanEntry->fMute == FALSE ) ) - { - /* First update the current channel's mixer. */ - ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel( - f_pApiInstance, - f_usBridgeIndex, - usChannelIndex, - f_usChanIndex, - TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Check if this participant can hear us. */ - if ( ( ( pTempParticipant->ulListenerMask & ( 0x1 << pParticipant->ulListenerMaskIndex ) ) == 0x0 ) - && ( pTempParticipant->fFlexibleMixerCreated == TRUE ) - && ( pEchoChanEntry->fMute == FALSE ) ) - { - /* Then update this channel's mixer. */ - ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel( - f_pApiInstance, - f_usBridgeIndex, - f_usChanIndex, - usChannelIndex, - TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Remember to mute the port on this channel. */ - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - { - if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == usChannelIndex ) - { - break; - } - else if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) - { - ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = usChannelIndex; - break; - } - } - } - } - } - } - - /* Check if must manually clear the Sin copy event. */ - if ( ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) - && ( pEchoChanEntry->fCopyEventCreated == TRUE ) ) - { - /* Transform event into no-operation. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now remove the copy event from the event list. */ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, pEchoChanEntry->usSinCopyEventIndex, cOCT6100_EVENT_TYPE_SIN_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - pEchoChanEntry->fCopyEventCreated = FALSE; - } - - /* Release an entry for the participant. */ - ulResult = Oct6100ApiReleaseFlexConfParticipantEntry( f_pApiInstance, pEchoChanEntry->usFlexConfParticipantIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - /*=======================================================================*/ - /* Update the event and channel API structure */ - pEchoChanEntry->usFlexConfParticipantIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usBridgeIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usLoadEventIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usSubStoreEventIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX; - - /* Indicate that the extra SIN TSI is not needed anymore by the mixer. */ - if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - pEchoChanEntry->usExtraSinTsiDependencyCnt--; - pEchoChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX; - } - else - { - /* Decrement the dependency count, but do not clear the mem index. */ - pEchoChanEntry->usExtraSinTsiDependencyCnt--; - } - - /* Indicate that the extra RIN TSI is not needed anymore by the mixer. */ - if ( pEchoChanEntry->usExtraRinTsiDependencyCnt == 1 ) - { - pEchoChanEntry->usExtraRinTsiDependencyCnt--; - pEchoChanEntry->usExtraRinTsiMemIndex = cOCT6100_INVALID_INDEX; - } - - /* Update the chip stats structure. */ - pSharedInfo->ChipStats.usNumEcChanUsingMixer--; - - pBridgeEntry->usNumClients--; - - /* For sure we have to mute the ports of this channel to be removed. */ - ulResult = Oct6100ApiMutePorts( - f_pApiInstance, - f_usChanIndex, - pEchoChanEntry->usRinTsstIndex, - pEchoChanEntry->usSinTsstIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Travel through the channels that were heard by the participant removed and check if their Rin port must be muted. */ - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - { - if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, ausMutePortChannelIndexes[ ulMutePortChannelIndex ] ); - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - if ( pTempParticipant->fFlexibleMixerCreated == FALSE ) - { - /* Check if the Rin port must be muted on this channel. */ - ulResult = Oct6100ApiMutePorts( - f_pApiInstance, - ausMutePortChannelIndexes[ ulMutePortChannelIndex ], - pTempEchoChanEntry->usRinTsstIndex, - pTempEchoChanEntry->usSinTsstIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else /* if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) */ - { - /* No more channels to check for muting. */ - break; - } - } - } - else /* if ( f_pConfBridgeRemove->fRemoveAll == TRUE ) */ - { - UINT16 usMainChannelIndex; - - for ( usMainChannelIndex = 0 ; usMainChannelIndex < pSharedInfo->ChipConfig.usMaxChannels ; usMainChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, usMainChannelIndex ); - - /* If this channel is on the bridge we are closing all the channels. */ - if ( ( pEchoChanEntry->fReserved == TRUE ) && ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) ) - { - /* Remember to mute the port on this channel. */ - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - { - if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == usMainChannelIndex ) - { - break; - } - else if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) - { - ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = usMainChannelIndex; - break; - } - } - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex ); - - /* Search through the list of API channel entry for the ones on to this bridge. */ - for ( usChannelIndex = (UINT16)( usMainChannelIndex + 1 ); usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - if ( pTempEchoChanEntry->fReserved == TRUE ) - { - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Everyone that we can hear must be removed. */ - if ( ( ( pParticipant->ulListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) - && ( pParticipant->fFlexibleMixerCreated == TRUE ) - && ( pTempEchoChanEntry->fMute == FALSE ) ) - { - /* First update the current channel's mixer. */ - ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel( - f_pApiInstance, - f_usBridgeIndex, - usChannelIndex, - usMainChannelIndex, - TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Check if this participant can hear us. */ - if ( ( ( pTempParticipant->ulListenerMask & ( 0x1 << pParticipant->ulListenerMaskIndex ) ) == 0x0 ) - && ( pTempParticipant->fFlexibleMixerCreated == TRUE ) - && ( pEchoChanEntry->fMute == FALSE ) ) - { - /* Then update this channel's mixer. */ - ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel( - f_pApiInstance, - f_usBridgeIndex, - usMainChannelIndex, - usChannelIndex, - TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - } - - /* Check if must manually clear the Sin copy event. */ - if ( ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) - && ( pEchoChanEntry->fCopyEventCreated == TRUE ) ) - { - /* Transform event into no-operation. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now remove the copy event from the event list. */ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, pEchoChanEntry->usSinCopyEventIndex, cOCT6100_EVENT_TYPE_SIN_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - pEchoChanEntry->fCopyEventCreated = FALSE; - } - - /* Release an entry for the participant. */ - ulResult = Oct6100ApiReleaseFlexConfParticipantEntry( f_pApiInstance, pEchoChanEntry->usFlexConfParticipantIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - /*=======================================================================*/ - /* Update the event and channel API structure */ - - pEchoChanEntry->usBridgeIndex = cOCT6100_INVALID_INDEX; - - pEchoChanEntry->usLoadEventIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usSubStoreEventIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX; - - /* Indicate that the Extra SIN TSI is not needed anymore by the mixer. */ - if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - pEchoChanEntry->usExtraSinTsiDependencyCnt--; - pEchoChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX; - } - else - { - /* Decrement the dependency count, but do not clear the mem index. */ - pEchoChanEntry->usExtraSinTsiDependencyCnt--; - } - - /* Indicate that the Extra RIN TSI is not needed anymore by the mixer. */ - if ( pEchoChanEntry->usExtraRinTsiDependencyCnt == 1 ) - { - pEchoChanEntry->usExtraRinTsiDependencyCnt--; - pEchoChanEntry->usExtraRinTsiMemIndex = cOCT6100_INVALID_INDEX; - } - - /* Update the chip stats structure. */ - pSharedInfo->ChipStats.usNumEcChanUsingMixer--; - } - } - - /* Travel through the channels that were heard by the participant removed and check if their Rin port must be muted. */ - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - { - if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, ausMutePortChannelIndexes[ ulMutePortChannelIndex ] ); - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - if ( pTempParticipant->fFlexibleMixerCreated == FALSE ) - { - /* Check if the Rin port must be muted on this channel. */ - ulResult = Oct6100ApiMutePorts( - f_pApiInstance, - ausMutePortChannelIndexes[ ulMutePortChannelIndex ], - pTempEchoChanEntry->usRinTsstIndex, - pTempEchoChanEntry->usSinTsstIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else /* if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) */ - { - /* No more channels to check for muting. */ - break; - } - - /* Clear the flexible conf bridge participant index. */ - pTempEchoChanEntry->usFlexConfParticipantIndex = cOCT6100_INVALID_INDEX; - } - - /* No more clients on bridge. */ - pBridgeEntry->usNumClients = 0; - } - } - else /* if ( f_fFlexibleConfBridge == FALSE ) */ - { - if ( f_pConfBridgeRemove->fRemoveAll == FALSE ) - { - /* The channel index is valid. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex ); - - if ( f_fTap == TRUE ) - { - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pBridgeEntry, pEchoChanEntry->usTapBridgeIndex ); - } - - /* Get a pointer to the event entry. */ - if ( f_usCopyEventIndex != cOCT6100_INVALID_INDEX ) - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pCopyEventEntry, f_usCopyEventIndex ); - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, f_usSubStoreEventIndex ); - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, f_usLoadEventIndex ); - - /*=======================================================================*/ - /* Check if have to modify the silence load event. */ - - if ( pBridgeEntry->usNumClients != 1 ) - { - if ( pBridgeEntry->usSilenceLoadEventPtr != cOCT6100_INVALID_INDEX ) - { - if ( pBridgeEntry->usSilenceLoadEventPtr == f_usLoadEventIndex ) - { - /* Make sure the next event becomes the silence event. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pLoadEventEntry->usNextEventPtr * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_LOAD; - WriteParams.usWriteData |= 1534; /* TSI index 1534 reserved for silence */ - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the software model to remember the silence load. */ - pBridgeEntry->usSilenceLoadEventPtr = pLoadEventEntry->usNextEventPtr; - } - else - { - /* Somebody else is the silence event, no need to worry. */ - } - } - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Clear the Load event. */ - - /* First verify if the event to be removed was a load event. */ - if ( f_usLoadEventIndex == pBridgeEntry->usLoadIndex ) - { - /* Change the next entry if one is present to a load event to keep the bridge alive. */ - if ( pBridgeEntry->usNumClients == 1 ) - { - /* There is no other entry on the bridge, no need to search for an Accumulate event. */ - pBridgeEntry->usLoadIndex = cOCT6100_INVALID_INDEX; - - /* Clear the silence event, for sure it's invalid. */ - pBridgeEntry->usSilenceLoadEventPtr = cOCT6100_INVALID_INDEX; - } - else - { - /* Search for an accumulate event to tranform into a Load event. */ - usTempEventIndex = pLoadEventEntry->usNextEventPtr; - ulLoopCount = 0; - - /* Find the copy entry before the entry to remove. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex ); - - while( pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_SUB_STORE && - pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_STORE ) - { - if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE ) - { - /* Change this entry into a load event. */ - ReadParams.ulReadAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usTempEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = ReadParams.ulReadAddress; - WriteParams.usWriteData = (UINT16)(( usReadData & 0x1FFF ) | cOCT6100_MIXER_CONTROL_MEM_LOAD); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set this entry as the load index. */ - pBridgeEntry->usLoadIndex = usTempEventIndex; - - /* Update the software model. */ - pTempEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD; - - /* Stop searching. */ - break; - } - - /* Go to the next entry into the list. */ - usTempEventIndex = pTempEntry->usNextEventPtr; - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex ); - - ulLoopCount++; - if ( ulLoopCount == cOCT6100_MAX_LOOP ) - return cOCT6100_ERR_FATAL_9B; - } - } - } - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Clear the substract and store event. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Clear the Copy event - if needed. */ - - if ( f_usCopyEventIndex != cOCT6100_INVALID_INDEX ) - { - /* Transform event into no-operation. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( f_fTap == FALSE ) - { - /* Set remove Sin copy event flag to remove the event from the mixer's list. */ - fRemoveSinCopy = TRUE; - - /* Clear the copy event created flag. */ - pEchoChanEntry->fCopyEventCreated = FALSE; - } - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Now remove the event from the event list. */ - - /* Look for the entry that is pointing at the first entry of our bridge. */ - if ( f_fTap == FALSE ) - { - ulResult = Oct6100ApiGetPrevLastSubStoreEvent( f_pApiInstance, f_usBridgeIndex, pBridgeEntry->usFirstLoadEventPtr, &usPreviousEventIndex ); - } - else - { - ulResult = Oct6100ApiGetPrevLastSubStoreEvent( f_pApiInstance, pEchoChanEntry->usTapBridgeIndex, pBridgeEntry->usFirstLoadEventPtr, &usPreviousEventIndex ); - } - - if ( ulResult != cOCT6100_ERR_OK ) - { - /* If the entry was not found, we now check for the Sout copy event section/list. */ - if ( ulResult == cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND ) - { - if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX ) - { - /* No Sout copy, it has to be the head node. */ - usPreviousEventIndex = cOCT6100_MIXER_HEAD_NODE; - } - else - { - /* Use the last Sout copy event. */ - usPreviousEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr; - } - } - else - { - return cOCT6100_ERR_FATAL_27; - } - } - - if ( pBridgeEntry->usNumClients == 1 ) - { - /* An entry was found, now, modify it's value. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousEventIndex ); - - /* Now modify the previous last Sub Store event from another bridge. */ - pTempEntry->usNextEventPtr = pSubStoreEventEntry->usNextEventPtr; - - /*=======================================================================*/ - /* Modify the last node of the previous bridge to point to the next bridge. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Set the event pointer info in the bridge stucture. */ - pBridgeEntry->usFirstLoadEventPtr = cOCT6100_INVALID_INDEX; - pBridgeEntry->usFirstSubStoreEventPtr = cOCT6100_INVALID_INDEX; - pBridgeEntry->usLastSubStoreEventPtr = cOCT6100_INVALID_INDEX; - - /*=======================================================================*/ - /* Update the global mixer pointers. */ - if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == f_usLoadEventIndex && - pSharedInfo->MixerInfo.usLastBridgeEventPtr == f_usSubStoreEventIndex ) - { - /* There is no more bridge entry in the mixer link list. */ - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usLastBridgeEventPtr = cOCT6100_INVALID_INDEX; - } - else if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == f_usLoadEventIndex ) - { - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = pSubStoreEventEntry->usNextEventPtr; - } - else if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == f_usSubStoreEventIndex ) - { - pSharedInfo->MixerInfo.usLastBridgeEventPtr = usPreviousEventIndex; - } - /*=======================================================================*/ - - if ( f_fTap == TRUE ) - { - /* The channel being tapped is not tapped anymore. */ - /* There is no direct way of finding the tap, so loop through all channels and find the */ - /* tapped channel index. */ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - if ( pTempEchoChanEntry->usTapChanIndex == f_usChanIndex ) - { - tPOCT6100_API_CONF_BRIDGE pTempBridgeEntry; - - pTempEchoChanEntry->fBeingTapped = FALSE; - pTempEchoChanEntry->usTapChanIndex = cOCT6100_INVALID_INDEX; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pTempBridgeEntry, f_usBridgeIndex ); - - pTempBridgeEntry->usNumTappedClients--; - - /* Re-assign Rin TSST for tapped channel. */ - if ( pTempEchoChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pTempEchoChanEntry->usRinTsstIndex, - pTempEchoChanEntry->usRinRoutTsiMemIndex, - pTempEchoChanEntry->TdmConfig.byRinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - break; - } - } - - /* Check if our model is broken. */ - if ( usChannelIndex == pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_FATAL_D3; - } - } - else /* pBridgeEntry->usNumClients > 1 */ - { - if ( pBridgeEntry->usFirstLoadEventPtr != f_usLoadEventIndex ) - { - /* Now find the load entry of this bridge pointing at this load event */ - ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, pBridgeEntry->usFirstLoadEventPtr, f_usLoadEventIndex, 0, &usPreviousEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Remove the load event to the list. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousEventIndex ); - - /* Now modify the previous last Sub Store event from another bridge. */ - pTempEntry->usNextEventPtr = pLoadEventEntry->usNextEventPtr; - - /*=======================================================================*/ - /* Modify the previous node. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Now find the last load entry of this bridge ( the one pointing at the first sub-store event ). */ - if ( pBridgeEntry->usFirstSubStoreEventPtr == f_usSubStoreEventIndex ) - { - /* Must start with the first load to get the entry before the first sub store. */ - ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, pBridgeEntry->usFirstLoadEventPtr, f_usSubStoreEventIndex, 0, &usPreviousEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else - { - /* Must start with the first load to get the entry before the first sub store. */ - ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, pBridgeEntry->usFirstSubStoreEventPtr, f_usSubStoreEventIndex, 0, &usPreviousEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousEventIndex ); - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, f_usSubStoreEventIndex ); - - /* Now modify the last load event of the bridge. */ - pTempEntry->usNextEventPtr = pSubStoreEventEntry->usNextEventPtr; - - /*=======================================================================*/ - /* Modify the last node of the other bridge. */ - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = (UINT16)( pTempEntry->usNextEventPtr ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Update the bridge pointers. */ - - if ( pBridgeEntry->usFirstLoadEventPtr == f_usLoadEventIndex ) - pBridgeEntry->usFirstLoadEventPtr = pLoadEventEntry->usNextEventPtr; - - if ( pBridgeEntry->usFirstSubStoreEventPtr == f_usSubStoreEventIndex ) - pBridgeEntry->usFirstSubStoreEventPtr = pSubStoreEventEntry->usNextEventPtr; - - if ( pBridgeEntry->usLastSubStoreEventPtr == f_usSubStoreEventIndex ) - pBridgeEntry->usLastSubStoreEventPtr = usPreviousEventIndex; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Update the global mixer pointers. */ - - if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == f_usLoadEventIndex ) - { - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = pLoadEventEntry->usNextEventPtr; - } - - if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == f_usSubStoreEventIndex ) - { - pSharedInfo->MixerInfo.usLastBridgeEventPtr = usPreviousEventIndex; - } - /*=======================================================================*/ - - } - - /* Check if must remove the Sin copy event from the event list. */ - if ( fRemoveSinCopy == TRUE ) - { - /* Now remove the copy event from the event list. */ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, f_usCopyEventIndex, cOCT6100_EVENT_TYPE_SIN_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Get the channel. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex ); - - /* Reprogram the TSST entry correctly if the Extra SIN TSI entry was released. */ - if ( ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) && ( f_fTap == FALSE ) ) - { - if ( pEchoChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pEchoChanEntry->usSinTsstIndex, - pEchoChanEntry->usSinSoutTsiMemIndex, - pEchoChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* If the silence TSI is loaded on this port, update with the original sin TSI. */ - if ( pEchoChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pEchoChanEntry->usSinSoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - /* Set the event entries as free. */ - pLoadEventEntry->fReserved = FALSE; - pLoadEventEntry->usEventType = cOCT6100_INVALID_INDEX; - pLoadEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - - pSubStoreEventEntry->fReserved = FALSE; - pSubStoreEventEntry->usEventType = cOCT6100_INVALID_INDEX; - pSubStoreEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - - if ( pCopyEventEntry != NULL ) - { - pCopyEventEntry->fReserved = FALSE; - pCopyEventEntry->usEventType = cOCT6100_INVALID_INDEX; - pCopyEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - } - - pBridgeEntry->usNumClients--; - - /*=======================================================================*/ - /* Update the event and channel API structure */ - pEchoChanEntry->usBridgeIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usLoadEventIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usSubStoreEventIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX; - - /* Indicate that the Extra SIN TSI is not needed anymore by the mixer. */ - if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - pEchoChanEntry->usExtraSinTsiDependencyCnt--; - pEchoChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX; - } - else - { - /* Decrement the dependency count, but do not clear the mem index. */ - pEchoChanEntry->usExtraSinTsiDependencyCnt--; - } - - /* Update the chip stats structure. */ - pSharedInfo->ChipStats.usNumEcChanUsingMixer--; - - if ( f_fTap == TRUE ) - { - /* Can now close the bridge. */ - tOCT6100_CONF_BRIDGE_CLOSE BridgeClose; - - Oct6100ConfBridgeCloseDef( &BridgeClose ); - - BridgeClose.ulConfBridgeHndl = cOCT6100_HNDL_TAG_CONF_BRIDGE | (pBridgeEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | pEchoChanEntry->usTapBridgeIndex; - - ulResult = Oct6100ConfBridgeCloseSer( f_pApiInstance, &BridgeClose ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - pEchoChanEntry->usTapBridgeIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->fTap = FALSE; - } - - /* Check if the Rin port must be muted. */ - ulResult = Oct6100ApiMutePorts( - f_pApiInstance, - f_usChanIndex, - pEchoChanEntry->usRinTsstIndex, - pEchoChanEntry->usSinTsstIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - } - else /* f_ulBridgeChanRemove->fRemoveAll == TRUE ) */ - { - UINT16 usNextEventPtr; - - /* Save the next event pointer before invalidating everything. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, pBridgeEntry->usLastSubStoreEventPtr ); - - usNextEventPtr = pSubStoreEventEntry->usNextEventPtr; - - /* Search through the list of API channel entry for the ones on to the specified bridge. */ - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxChannels; i++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, i ); - - if ( pEchoChanEntry->fReserved == TRUE ) - { - if ( ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) && ( pEchoChanEntry->fTap == FALSE ) ) - { - /* Check if we are being tapped. If so, remove the channel that taps us from the conference. */ - /* The removal of the channel will make sure the Rin TSST is re-assigned. */ - if ( pEchoChanEntry->fBeingTapped == TRUE ) - { - tOCT6100_CONF_BRIDGE_CHAN_REMOVE ChanRemove; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, pEchoChanEntry->usTapChanIndex ); - - ulResult = Oct6100ConfBridgeChanRemoveDef( &ChanRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ChanRemove.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | (pTempEchoChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | pEchoChanEntry->usTapChanIndex; - - ulResult = Oct6100ConfBridgeChanRemoveSer( f_pApiInstance, &ChanRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*=======================================================================*/ - /* Clear the Load event. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Clear the Substract and store event. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*=======================================================================*/ - - /*=======================================================================*/ - /* Clear the SIN copy event.*/ - - if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) - { - /* Transform event into no-operation. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Get a pointer to the event entry. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pCopyEventEntry, pEchoChanEntry->usSinCopyEventIndex ); - - /* Update the next event pointer if required. */ - if ( usNextEventPtr == pEchoChanEntry->usSinCopyEventIndex ) - usNextEventPtr = pCopyEventEntry->usNextEventPtr; - - /* Now remove the copy event from the event list. */ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, pEchoChanEntry->usSinCopyEventIndex, cOCT6100_EVENT_TYPE_SIN_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear the copy event created flag. */ - pEchoChanEntry->fCopyEventCreated = FALSE; - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Update the event and channel API structure */ - - /* Reprogram the TSST entry correctly if the Extra SIN TSI entry was released.*/ - if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - if ( pEchoChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pEchoChanEntry->usSinTsstIndex, - pEchoChanEntry->usSinSoutTsiMemIndex, - pEchoChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* If the silence TSI is loaded on this port, update with the original Sin TSI. */ - if ( pEchoChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pEchoChanEntry->usSinSoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, pEchoChanEntry->usLoadEventIndex ); - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, pEchoChanEntry->usSubStoreEventIndex ); - - /* Set the event entries as free. */ - pLoadEventEntry->fReserved = FALSE; - pLoadEventEntry->usEventType = cOCT6100_INVALID_EVENT; - pLoadEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - - pSubStoreEventEntry->fReserved = FALSE; - pSubStoreEventEntry->usEventType = cOCT6100_INVALID_EVENT; - pSubStoreEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - - if ( pCopyEventEntry != NULL ) - { - pCopyEventEntry->fReserved = FALSE; - pCopyEventEntry->usEventType = cOCT6100_INVALID_EVENT; - pCopyEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - } - - /* Indicate that the Extra SIN TSI is not needed anymore by the mixer. */ - if ( pEchoChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - pEchoChanEntry->usExtraSinTsiDependencyCnt--; - pEchoChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX; - } - else - { - /* Decrement the dependency count, but do not clear the mem index. */ - pEchoChanEntry->usExtraSinTsiDependencyCnt--; - } - - /* Invalidate the channel entry. */ - pEchoChanEntry->usLoadEventIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usSubStoreEventIndex = cOCT6100_INVALID_INDEX; - pEchoChanEntry->usSinCopyEventIndex = cOCT6100_INVALID_INDEX; - - /* Update the chip stats structure. */ - pSharedInfo->ChipStats.usNumEcChanUsingMixer--; - - /*=======================================================================*/ - } - } - } - - ulResult = Oct6100ApiGetPrevLastSubStoreEvent( f_pApiInstance, f_usBridgeIndex, pBridgeEntry->usFirstLoadEventPtr, &usPreviousEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND == ulResult ) - { - if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX ) - { - usPreviousEventIndex = cOCT6100_MIXER_HEAD_NODE; - } - else - { - usPreviousEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr; - } - } - else - { - return cOCT6100_ERR_FATAL_28; - } - } - - /* An Entry was found, now, modify it's value. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousEventIndex ); - - /* Now modify the previous last Sub Store event from another bridge.*/ - /* It will now point at the next bridge, or copy events. */ - pTempEntry->usNextEventPtr = usNextEventPtr; - - /*=======================================================================*/ - /* Modify the last node of the other bridge. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = pTempEntry->usNextEventPtr; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*=======================================================================*/ - - /*=======================================================================*/ - /* Update the global mixer pointers. */ - if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == pBridgeEntry->usFirstLoadEventPtr && - pSharedInfo->MixerInfo.usLastBridgeEventPtr == pBridgeEntry->usLastSubStoreEventPtr ) - { - /* This bridge was the only one with event in the list. */ - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usLastBridgeEventPtr = cOCT6100_INVALID_INDEX; - } - else if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == pBridgeEntry->usFirstLoadEventPtr ) - { - /* This bridge was the first bridge. */ - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = usNextEventPtr; - } - else if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == pBridgeEntry->usLastSubStoreEventPtr ) - { - /* This bridge was the last bridge.*/ - pSharedInfo->MixerInfo.usLastBridgeEventPtr = usPreviousEventIndex; - } - /*=======================================================================*/ - - /* Set the event pointer info in the bridge stucture. */ - pBridgeEntry->usFirstLoadEventPtr = cOCT6100_INVALID_INDEX; - pBridgeEntry->usFirstSubStoreEventPtr = cOCT6100_INVALID_INDEX; - pBridgeEntry->usLastSubStoreEventPtr = cOCT6100_INVALID_INDEX; - pBridgeEntry->usLoadIndex = cOCT6100_INVALID_INDEX; - - pBridgeEntry->usSilenceLoadEventPtr = cOCT6100_INVALID_INDEX; - - /* Set the number of clients to 0. */ - pBridgeEntry->usNumClients = 0; - - /* Search through the list of API channel entry for the ones on to the specified bridge. */ - for ( i = 0; i < pSharedInfo->ChipConfig.usMaxChannels; i++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, i ); - - if ( pEchoChanEntry->fReserved == TRUE ) - { - if ( ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) && ( pEchoChanEntry->fTap == FALSE ) ) - { - pEchoChanEntry->usBridgeIndex = cOCT6100_INVALID_INDEX; - - /* Check if the Rin port must be muted. */ - ulResult = Oct6100ApiMutePorts( - f_pApiInstance, - (UINT16)( i & 0xFFFF ), - pEchoChanEntry->usRinTsstIndex, - pEchoChanEntry->usSinTsstIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBridgeRemoveParticipantFromChannel - -Description: This will remove a flexible conference participant from - a channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_usBridgeIndex Bridge index where this channel is located. -f_usSourceChannelIndex Source channel to copy voice from. -f_usDestinationChannelIndex Destination channel to store resulting voice to. -f_fRemovePermanently Whether to remove permanently this participant. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiBridgeRemoveParticipantFromChannel -UINT32 Oct6100ApiBridgeRemoveParticipantFromChannel( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usSourceChannelIndex, - IN UINT16 f_usDestinationChannelIndex, - IN UINT8 f_fRemovePermanently ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - - tPOCT6100_API_MIXER_EVENT pLoadEventEntry; - tPOCT6100_API_MIXER_EVENT pStoreEventEntry; - tPOCT6100_API_MIXER_EVENT pCopyEventEntry; - tPOCT6100_API_MIXER_EVENT pTempEntry; - tPOCT6100_API_MIXER_EVENT pLoadTempEntry; - tPOCT6100_API_MIXER_EVENT pLastEventEntry; - tPOCT6100_API_MIXER_EVENT pLastLoadOrAccumulateEventEntry; - - tPOCT6100_API_CHANNEL pSourceChanEntry; - tPOCT6100_API_CHANNEL pDestinationChanEntry; - - tPOCT6100_API_FLEX_CONF_PARTICIPANT pSourceParticipant; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pDestinationParticipant; - - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - - UINT32 ulResult; - UINT32 ulLoopCount; - UINT16 usLastLoadEventIndex; - UINT16 usLoadOrAccumulateEventIndex; - UINT16 usTempEventIndex; - UINT16 usPreviousEventIndex; - UINT16 usLastEventIndex; - - UINT16 usReadData; - BOOL fLastEvent = FALSE; - BOOL fSoutCopyEvent = FALSE; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex ); - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pSourceChanEntry, f_usSourceChannelIndex ); - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pSourceParticipant, pSourceChanEntry->usFlexConfParticipantIndex ); - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pDestinationChanEntry, f_usDestinationChannelIndex ); - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pDestinationParticipant, pDestinationChanEntry->usFlexConfParticipantIndex ); - - /* Check if the mixer has been created on this channel. */ - if ( pDestinationParticipant->fFlexibleMixerCreated == TRUE ) - { - /*=======================================================================*/ - /* Clear the Load or Accumulate event.*/ - - usTempEventIndex = pDestinationChanEntry->usLoadEventIndex; - ulLoopCount = 0; - - /* Find the Load or Accumulate event entry. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, usTempEventIndex ); - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pStoreEventEntry, pDestinationChanEntry->usSubStoreEventIndex ); - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex ); - - pLastEventEntry = pLoadEventEntry; - pLastLoadOrAccumulateEventEntry = pLoadEventEntry; - usLastLoadEventIndex = usTempEventIndex; - usLastEventIndex = usTempEventIndex; - - while( pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_SUB_STORE && - pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_STORE ) - { - /* If this is the entry we are looking for. */ - if ( pTempEntry->usSourceChanIndex == f_usSourceChannelIndex ) - { - /* Check if this is a Load or Accumulate event. */ - if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_LOAD ) - { - /* This is the first entry. Check if next entry is an accumulate. */ - pLoadTempEntry = pTempEntry; - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, pTempEntry->usNextEventPtr ); - - if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE ) - { - /* Change this entry into a Load event. */ - ReadParams.ulReadAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pLoadTempEntry->usNextEventPtr * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = ReadParams.ulReadAddress; - WriteParams.usWriteData = (UINT16)(( usReadData & 0x1FFF ) | cOCT6100_MIXER_CONTROL_MEM_LOAD); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the channel information with this new load event. */ - pDestinationChanEntry->usLoadEventIndex = pLoadTempEntry->usNextEventPtr; - - /* Update the software model. */ - pTempEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD; - - /* Get the previous event. */ - ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, cOCT6100_MIXER_HEAD_NODE, usTempEventIndex, 0, &usPreviousEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLastEventEntry, usPreviousEventIndex ); - usLastEventIndex = usPreviousEventIndex; - - /* Stop searching. */ - break; - } - else if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_STORE ) - { - /* Get back the event to remove. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex ); - - /* This is the only event on this channel so we can clear everything up. */ - fLastEvent = TRUE; - - /* Get the previous event. */ - ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, cOCT6100_MIXER_HEAD_NODE, usTempEventIndex, 0, &usPreviousEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLastEventEntry, usPreviousEventIndex ); - usLastEventIndex = usPreviousEventIndex; - - /* Stop searching. */ - break; - } - else - { - /* Software model is broken. */ - return cOCT6100_ERR_FATAL_C5; - } - - } - else if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE ) - { - /* Simply remove the entry. */ - - /* Get the previous event. */ - ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, cOCT6100_MIXER_HEAD_NODE, usTempEventIndex, 0, &usPreviousEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLastEventEntry, usPreviousEventIndex ); - usLastEventIndex = usPreviousEventIndex; - - /* Stop searching. */ - break; - } - else - { - /* Software model is broken. */ - return cOCT6100_ERR_FATAL_C6; - } - } - - pLastLoadOrAccumulateEventEntry = pTempEntry; - usLastLoadEventIndex = usTempEventIndex; - - /* Go to the next entry into the list. */ - usTempEventIndex = pTempEntry->usNextEventPtr; - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex ); - - ulLoopCount++; - if ( ulLoopCount == cOCT6100_MAX_LOOP ) - return cOCT6100_ERR_FATAL_C8; - } - - /* Check if we found what we were looking for. */ - if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_STORE - || pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_SUB_STORE ) - { - /* Software model is broken. */ - return cOCT6100_ERR_FATAL_C7; - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Clear the Store event - if needed. */ - - if ( fLastEvent == TRUE ) - { - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pDestinationChanEntry->usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Clear the Load or Accumulate event. */ - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usTempEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save this event index. It's the Load or Accumulate we want to remove from the list later. */ - usLoadOrAccumulateEventIndex = usTempEventIndex; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Clear the Copy event - if needed. */ - - if ( ( fLastEvent == TRUE ) && ( pDestinationChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) && ( f_fRemovePermanently == TRUE ) ) - { - /* Transform event into no-operation. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pDestinationChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* The event remove from the list will be done below. */ - - /* Clear the copy event created flag. */ - pDestinationChanEntry->fCopyEventCreated = FALSE; - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /*=======================================================================*/ - /* Remove the events from the mixer event list.*/ - /*=======================================================================*/ - /*=======================================================================*/ - - /*=======================================================================*/ - /* Remove the Load or Accumulate event from the event list. */ - - if ( fLastEvent == FALSE ) - { - /*=======================================================================*/ - /* Remove the Accumulate event from the event list. */ - - /* We saved the Load or Accumulate event above. We also saved the previous event. Use those. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, usLoadOrAccumulateEventIndex ); - - /* Now modify the previous last event. */ - pLastEventEntry->usNextEventPtr = pLoadEventEntry->usNextEventPtr; - - /* Modify the previous node. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usLastEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = pLastEventEntry->usNextEventPtr; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if this is the first load event on the bridge. */ - if ( pBridgeEntry->usFirstLoadEventPtr == usLoadOrAccumulateEventIndex ) - { - pBridgeEntry->usFirstLoadEventPtr = pLoadEventEntry->usNextEventPtr; - } - - /* Check if this was the first load of all bridges. */ - if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == usLoadOrAccumulateEventIndex ) - { - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = pLoadEventEntry->usNextEventPtr; - } - - /*=======================================================================*/ - } - else /* if ( fLastEvent == TRUE ) */ - { - /*=======================================================================*/ - /* Remove the Load event from the event list. */ - - /* Look for the entry that is pointing at the first entry of our mixer. */ - ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, cOCT6100_MIXER_HEAD_NODE, usLoadOrAccumulateEventIndex, 0, &usPreviousEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* An Entry was found, now, modify it's value. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousEventIndex ); - - /* Check if this is a Sout copy event. */ - if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_COPY ) - { - /* No more previous bridges. */ - fSoutCopyEvent = TRUE; - } - - /* Now modify the previous last Store or Sub-Store or Head-Node event from another bridge/channel. */ - pTempEntry->usNextEventPtr = pStoreEventEntry->usNextEventPtr; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Modify the last node of the previous bridge/channel to point to the next bridge. */ - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - - WriteParams.usWriteData = pTempEntry->usNextEventPtr; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Set the event pointer info in the bridge stucture. */ - - if ( pBridgeEntry->usFirstLoadEventPtr == pDestinationChanEntry->usLoadEventIndex ) - { - UINT16 usChannelIndex; - tPOCT6100_API_CHANNEL pTempEchoChanEntry; - - pBridgeEntry->usFirstSubStoreEventPtr = cOCT6100_INVALID_INDEX; - pBridgeEntry->usFirstLoadEventPtr = cOCT6100_INVALID_INDEX; - - /* Find the next channel in this conference that could give us valid values. */ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - if ( ( usChannelIndex != f_usDestinationChannelIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) ) - { - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant; - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - if ( pTempParticipant->fFlexibleMixerCreated == TRUE ) - { - pBridgeEntry->usFirstSubStoreEventPtr = pTempEchoChanEntry->usSubStoreEventIndex; - pBridgeEntry->usFirstLoadEventPtr = pTempEchoChanEntry->usLoadEventIndex; - break; - } - } - } - } - } - - /* Reprogram the TSST entry correctly if the extra SIN TSI entry was released. */ - if ( ( pDestinationChanEntry->usExtraSinTsiDependencyCnt == 1 ) && ( f_fRemovePermanently == TRUE ) ) - { - if ( pDestinationChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pDestinationChanEntry->usSinTsstIndex, - pDestinationChanEntry->usSinSoutTsiMemIndex, - pDestinationChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* If the silence TSI is loaded on this port, update with the original sin TSI. */ - if ( pDestinationChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pDestinationChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pDestinationChanEntry->usSinSoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Reprogram the TSST entry correctly if the extra RIN TSI entry was released. */ - if ( ( pDestinationChanEntry->usExtraRinTsiDependencyCnt == 1 ) && ( f_fRemovePermanently == TRUE ) ) - { - if ( pDestinationChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pDestinationChanEntry->usRinTsstIndex, - pDestinationChanEntry->usRinRoutTsiMemIndex, - pDestinationChanEntry->TdmConfig.byRinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /*=======================================================================*/ - /* Update the global mixer pointers. */ - - if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == usLoadOrAccumulateEventIndex && - pSharedInfo->MixerInfo.usLastBridgeEventPtr == pDestinationChanEntry->usSubStoreEventIndex ) - { - /* There is no more bridge entry in the mixer link list. */ - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usLastBridgeEventPtr = cOCT6100_INVALID_INDEX; - } - else if ( pSharedInfo->MixerInfo.usFirstBridgeEventPtr == usLoadOrAccumulateEventIndex ) - { - pSharedInfo->MixerInfo.usFirstBridgeEventPtr = pStoreEventEntry->usNextEventPtr; - } - else if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == pDestinationChanEntry->usSubStoreEventIndex ) - { - pSharedInfo->MixerInfo.usLastBridgeEventPtr = usPreviousEventIndex; - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Check if must remove the Sin copy event from the list. */ - - if ( ( pDestinationChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) && ( f_fRemovePermanently == TRUE ) ) - { - /* Now remove the copy event from the event list. */ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, pDestinationChanEntry->usSinCopyEventIndex, cOCT6100_EVENT_TYPE_SIN_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*=======================================================================*/ - - - - /*=======================================================================*/ - - if ( f_fRemovePermanently == TRUE ) - { - /* Set the event entries as free. */ - pLoadEventEntry->fReserved = FALSE; - pLoadEventEntry->usEventType = cOCT6100_INVALID_EVENT; - pLoadEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - - pStoreEventEntry->fReserved = FALSE; - pStoreEventEntry->usEventType = cOCT6100_INVALID_EVENT; - pStoreEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - - if ( pDestinationChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pCopyEventEntry, pDestinationChanEntry->usSinCopyEventIndex ); - - pCopyEventEntry->fReserved = FALSE; - pCopyEventEntry->usEventType = cOCT6100_INVALID_EVENT; - pCopyEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - } - } - - /* Flexible mixer for this channel not created anymore. */ - pDestinationParticipant->fFlexibleMixerCreated = FALSE; - - /*=======================================================================*/ - } - - /*=======================================================================*/ - } - else /* if ( pDestinationChanEntry->fFlexibleMixerCreated == FALSE ) */ - { - /* This point should never be reached. */ - return cOCT6100_ERR_FATAL_C9; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeChanMuteSer - -Description: Mute an echo channel present on a conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeMute Pointer to conference bridge mute structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeChanMuteSer -UINT32 Oct6100ConfBridgeChanMuteSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute ) -{ - UINT16 usChanIndex; - UINT16 usLoadEventIndex; - UINT16 usSubStoreEventIndex; - UINT32 ulResult; - UINT8 fFlexibleConferencing; - - /* Check the validity of the channel and conference bridge given. */ - ulResult = Oct6100ApiCheckBridgeMuteParams( - f_pApiInstance, - f_pConfBridgeMute, - &usChanIndex, - &usLoadEventIndex, - &usSubStoreEventIndex, - &fFlexibleConferencing ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Modify all resources needed by the conference bridge. */ - ulResult = Oct6100ApiUpdateBridgeMuteResources( - f_pApiInstance, - usChanIndex, - usLoadEventIndex, - usSubStoreEventIndex, - fFlexibleConferencing ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckBridgeMuteParams - -Description: Check the validity of the channel and conference bridge given. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeMute Pointer to conference bridge channel mute structure. -f_pusChannelIndex Pointer to a channel index. -f_pusLoadEventIndex Pointer to a load mixer event index. -f_pusSubStoreEventIndex Pointer to a sub-store mixer event index. -f_pfFlexibleConfBridge If this is a flexible conference bridge. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckBridgeMuteParams -UINT32 Oct6100ApiCheckBridgeMuteParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT16 f_pusLoadEventIndex, - OUT PUINT16 f_pusSubStoreEventIndex, - OUT PUINT8 f_pfFlexibleConfBridge ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - tPOCT6100_API_CHANNEL pEchoChanEntry; - UINT32 ulEntryOpenCnt; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 ) - return cOCT6100_ERR_CONF_BRIDGE_DISABLED; - - if ( f_pConfBridgeMute->ulChannelHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_HANDLE; - - /*=====================================================================*/ - /* Check the channel handle.*/ - - if ( (f_pConfBridgeMute->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - *f_pusChannelIndex = (UINT16)( f_pConfBridgeMute->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeMute->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - /* Check if the channel is bound to a conference bridge. */ - if ( pEchoChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE; - - /* Check if channel is already muted. */ - if ( pEchoChanEntry->fMute == TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_ALREADY_MUTED; - - /* Check if this is a tap channel, which is always mute. */ - if ( pEchoChanEntry->fTap == TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_ALWAYS_MUTE; - - /*=====================================================================*/ - - /*=====================================================================*/ - /* Check the conference bridge handle. */ - - if ( pEchoChanEntry->usBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, pEchoChanEntry->usBridgeIndex ) - - /* Check for errors. */ - if ( pBridgeEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - - if ( pBridgeEntry->fFlexibleConferencing == FALSE ) - { - /* Check the event entries.*/ - if ( pEchoChanEntry->usLoadEventIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE; - - if ( pEchoChanEntry->usSubStoreEventIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE; - } - - /*=====================================================================*/ - - /* Return the config of the channel and all other important information. */ - *f_pusSubStoreEventIndex = pEchoChanEntry->usSubStoreEventIndex; - *f_pusLoadEventIndex = pEchoChanEntry->usLoadEventIndex; - *f_pfFlexibleConfBridge = pBridgeEntry->fFlexibleConferencing; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateBridgeMuteResources - -Description: Modify the conference bridge entry for this channel in order - to mute the specified channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usChanIndex Index of the channel to be muted. -f_usLoadEventIndex Allocated entry for the Load event of the channel. -f_usSubStoreEventIndex Allocated entry for the substract and store event of the channel. -f_fFlexibleConfBridge If this is a flexible conference bridge. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateBridgeMuteResources -UINT32 Oct6100ApiUpdateBridgeMuteResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChanIndex, - IN UINT16 f_usLoadEventIndex, - IN UINT16 f_usSubStoreEventIndex, - IN UINT8 f_fFlexibleConfBridge ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - - tPOCT6100_API_CHANNEL pEchoChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - - tPOCT6100_API_MIXER_EVENT pLoadEventEntry; - tPOCT6100_API_MIXER_EVENT pSubStoreEventEntry; - tPOCT6100_API_MIXER_EVENT pTempEntry; - UINT32 ulResult; - UINT16 usTempEventIndex; - UINT32 ulLoopCount; - UINT16 usReadData; - - BOOL fCreateSilenceLoad = FALSE; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex ); - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, pEchoChanEntry->usBridgeIndex ) - - if ( f_fFlexibleConfBridge == TRUE ) - { - tPOCT6100_API_CHANNEL pTempEchoChanEntry; - UINT16 usChannelIndex; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant; - - UINT16 ausMutePortChannelIndexes[ cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE ]; - UINT32 ulMutePortChannelIndex; - - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = cOCT6100_INVALID_INDEX; - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex ); - - /* Search through the list of API channel entry for the ones on to this bridge. */ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) ) - { - if ( pTempEchoChanEntry->usBridgeIndex == pEchoChanEntry->usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if this participant can hear us. */ - if ( ( ( pTempParticipant->ulListenerMask & ( 0x1 << pParticipant->ulListenerMaskIndex ) ) == 0x0 ) - && ( pTempParticipant->fFlexibleMixerCreated == TRUE ) ) - { - /* Then update this channel's mixer. */ - ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel( - f_pApiInstance, - pEchoChanEntry->usBridgeIndex, - f_usChanIndex, - usChannelIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( pTempParticipant->fFlexibleMixerCreated == FALSE ) - { - /* Remember to mute the port on this channel. */ - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - { - if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == usChannelIndex ) - { - break; - } - else if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) - { - ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = usChannelIndex; - break; - } - } - } - } - } - } - } - - /* Travel through the channels that were heard by the participant removed and check if their Rin port must be muted. */ - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - { - if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, ausMutePortChannelIndexes[ ulMutePortChannelIndex ] ); - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - if ( pTempParticipant->fFlexibleMixerCreated == FALSE ) - { - /* Check if the Rin port must be muted on this channel. */ - ulResult = Oct6100ApiMutePorts( - f_pApiInstance, - ausMutePortChannelIndexes[ ulMutePortChannelIndex ], - pTempEchoChanEntry->usRinTsstIndex, - pTempEchoChanEntry->usSinTsstIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_MIXER_ALL_MIXER_EVENT_ENTRY_OPENED ) - { - UINT32 ulTempResult; - - /* Cleanup resources, unmute channel... */ - ulTempResult = Oct6100ApiUpdateBridgeUnMuteResources( - f_pApiInstance, - f_usChanIndex, - f_usLoadEventIndex, - f_usSubStoreEventIndex, - TRUE ); - if ( ulTempResult != cOCT6100_ERR_OK ) - return ulTempResult; - else - return ulResult; - } - else - { - return ulResult; - } - } - } - } - else /* if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) */ - { - /* No more channels to check for muting. */ - break; - } - } - } - else /* if ( f_fFlexibleConfBridge == FALSE ) */ - { - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, f_usLoadEventIndex ); - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, f_usSubStoreEventIndex ); - - /*=======================================================================*/ - /* Program the Load event. */ - - /* Create silence load if this is the first event of the bridge. */ - if ( f_usLoadEventIndex == pBridgeEntry->usFirstLoadEventPtr ) - fCreateSilenceLoad = TRUE; - - /* First check if this event was a load or an accumulate event, if it's a load */ - /* we need to find a new load. */ - if ( f_usLoadEventIndex == pBridgeEntry->usLoadIndex ) - { - /* Change the next entry if one is present to a load event to keep the bridge alive. */ - if ( pBridgeEntry->usNumClients == 1 ) - { - /* There is no other entry on the bridge, no need to search for an Accumulate event. */ - pBridgeEntry->usLoadIndex = cOCT6100_INVALID_INDEX; - } - else - { - /* Search for an accumulate event to tranform into a Load event. */ - usTempEventIndex = pLoadEventEntry->usNextEventPtr; - ulLoopCount = 0; - - /* Find the copy entry before the entry to remove. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex ); - - while( pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_SUB_STORE && - pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_STORE ) - { - if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE ) - { - /* Change this entry into a load event. */ - ReadParams.ulReadAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usTempEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = ReadParams.ulReadAddress; - WriteParams.usWriteData = (UINT16)(( usReadData & 0x1FFF ) | cOCT6100_MIXER_CONTROL_MEM_LOAD); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set this entry as the load index. */ - pBridgeEntry->usLoadIndex = usTempEventIndex; - - /* Update the software model. */ - pTempEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD; - - /* Stop searching. */ - break; - } - - /* Go to the next entry into the list. */ - usTempEventIndex = pTempEntry->usNextEventPtr; - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex ); - - ulLoopCount++; - if ( ulLoopCount == cOCT6100_MAX_LOOP ) - return cOCT6100_ERR_FATAL_9B; - } - } - } - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - /* Do not load the sample if the channel is muted. */ - if ( fCreateSilenceLoad == TRUE ) - { - if ( pBridgeEntry->usSilenceLoadEventPtr == cOCT6100_INVALID_INDEX ) - { - /* Instead of No-oping, load the silence TSI, to make sure the other conferences before us are not heard. */ - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_LOAD; - WriteParams.usWriteData |= 1534; /* TSI index 1534 reserved for silence */ - - /* Remember the silence load event. */ - pBridgeEntry->usSilenceLoadEventPtr = f_usLoadEventIndex; - } - else - { - /* Do nothing. */ - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - } - } - else - { - /* Do nothing. */ - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the software model. */ - pLoadEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Program the Substract and store event. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - /* Do not load the sample if the channel is muted. */ - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_STORE; - - /* If we have an extra Sin copy event, we know we are using the Sout port as a source. */ - if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) - { - /* Sout input. */ - WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - } - else /* if ( pEchoChanEntry->usSinCopyEventIndex == cOCT6100_INVALID_INDEX ) */ - { - /* Rin input. */ - WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.byRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the software model. */ - pSubStoreEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_STORE; - - /*=======================================================================*/ - } - - /* Update the channel entry API structure */ - pEchoChanEntry->fMute = TRUE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeChanUnMuteSer - -Description: UnMute an echo channel present on a conference bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeUnMute Pointer to conference bridge channel unmute structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeChanUnMuteSer -UINT32 Oct6100ConfBridgeChanUnMuteSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute ) -{ - UINT16 usChanIndex; - UINT16 usLoadEventIndex; - UINT16 usSubStoreEventIndex; - UINT8 fFlexibleConfBridge; - UINT32 ulResult; - - /* Check the validity of the channel and conference bridge given. */ - ulResult = Oct6100ApiCheckBridgeUnMuteParams( - f_pApiInstance, - f_pConfBridgeUnMute, - &usChanIndex, - &usLoadEventIndex, - &usSubStoreEventIndex, - &fFlexibleConfBridge ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Modify all resources needed by the conference bridge. */ - ulResult = Oct6100ApiUpdateBridgeUnMuteResources( - f_pApiInstance, - usChanIndex, - usLoadEventIndex, - usSubStoreEventIndex, - fFlexibleConfBridge ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckBridgeUnMuteParams - -Description: Check the validity of the channel and conference bridge given. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeUnMute Pointer to conference bridge channel unmute structure. -f_pusChannelIndex Pointer to the channel index fo the channel to be unmuted. -f_pusLoadEventIndex Pointer to the load index of the channel. -f_pusSubStoreEventIndex Pointer to the sub-store event of the channel. -f_pfFlexibleConfBridge If this is a flexible conference bridge. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckBridgeUnMuteParams -UINT32 Oct6100ApiCheckBridgeUnMuteParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT16 f_pusLoadEventIndex, - OUT PUINT16 f_pusSubStoreEventIndex, - OUT PUINT8 f_pfFlexibleConfBridge ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - tPOCT6100_API_CHANNEL pEchoChanEntry; - UINT32 ulEntryOpenCnt; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 ) - return cOCT6100_ERR_CONF_BRIDGE_DISABLED; - - if ( f_pConfBridgeUnMute->ulChannelHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_ADD_INVALID_HANDLE; - - /*=====================================================================*/ - /* Check the channel handle.*/ - - if ( (f_pConfBridgeUnMute->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - *f_pusChannelIndex = (UINT16)( f_pConfBridgeUnMute->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeUnMute->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - /* Check if the channel is bound to a conference bridge.*/ - if ( pEchoChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE; - - /* Check if channel is already muted.*/ - if ( pEchoChanEntry->fMute == FALSE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_NOT_MUTED; - - /*=====================================================================*/ - - /*=====================================================================*/ - /* Check the conference bridge handle. */ - - if ( pEchoChanEntry->usBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, pEchoChanEntry->usBridgeIndex ) - - /* Check for errors. */ - if ( pBridgeEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - - /* Check the event entries.*/ - if ( pBridgeEntry->fFlexibleConferencing == FALSE ) - { - if ( pEchoChanEntry->usLoadEventIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE; - - /* Check the event entries.*/ - if ( pEchoChanEntry->usSubStoreEventIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_MUTE_INVALID_HANDLE; - } - - /*=====================================================================*/ - - /* Return the config of the channel and all other important information.*/ - *f_pusSubStoreEventIndex = pEchoChanEntry->usSubStoreEventIndex; - *f_pusLoadEventIndex = pEchoChanEntry->usLoadEventIndex; - *f_pfFlexibleConfBridge = pBridgeEntry->fFlexibleConferencing; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateBridgeUnMuteResources - -Description: Modify the conference bridge entry for this channel in order - to un-mute the specified channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usChanIndex Index of the channel to be unmuted. -f_usLoadEventIndex Allocated entry for the Load event of the channel. -f_usSubStoreEventIndex Allocated entry for the substract and store event of the channel. -f_fFlexibleConfBridge If this is a flexible conference bridge. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateBridgeUnMuteResources -UINT32 Oct6100ApiUpdateBridgeUnMuteResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChanIndex, - IN UINT16 f_usLoadEventIndex, - IN UINT16 f_usSubStoreEventIndex, - IN UINT8 f_fFlexibleConfBridge ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - - tPOCT6100_API_CHANNEL pEchoChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - - tPOCT6100_API_MIXER_EVENT pLoadEventEntry; - tPOCT6100_API_MIXER_EVENT pSubStoreEventEntry; - tPOCT6100_API_MIXER_EVENT pTempEntry; - UINT32 ulResult; - UINT16 usTempEventIndex; - UINT32 ulLoopCount; - UINT16 usReadData; - - UINT16 usLoadEventType = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE; - UINT16 usPreviousLoadIndex = cOCT6100_INVALID_INDEX; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_usChanIndex ); - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, pEchoChanEntry->usBridgeIndex ) - - if ( f_fFlexibleConfBridge == TRUE ) - { - tPOCT6100_API_CHANNEL pTempEchoChanEntry; - UINT16 usChannelIndex; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant; - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pEchoChanEntry->usFlexConfParticipantIndex ); - - /* Before doing anything, check if the copy events must be created. */ - if ( ( pParticipant->ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) && ( pEchoChanEntry->fCopyEventCreated == FALSE ) ) - { - /* The copy event has not been created, create it once for the life of the participant on the bridge. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pEchoChanEntry->usSinCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - WriteParams.usWriteData |= pEchoChanEntry->usExtraSinTsiMemIndex; - WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pEchoChanEntry->usSinSoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now insert the Sin copy event into the list. */ - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - pEchoChanEntry->usSinCopyEventIndex, - cOCT6100_EVENT_TYPE_SIN_COPY, - f_usChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - pEchoChanEntry->fCopyEventCreated = TRUE; - } - - /* Search through the list of API channel entry for the ones onto this bridge. */ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - /* Channel reserved? */ - if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) ) - { - /* On current bridge? */ - if ( pTempEchoChanEntry->usBridgeIndex == pEchoChanEntry->usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if this participant can hear us. */ - if ( ( pTempParticipant->ulListenerMask & ( 0x1 << pParticipant->ulListenerMaskIndex ) ) == 0x0 ) - { - /* Then create/update this channel's mixer. */ - ulResult = Oct6100ApiBridgeAddParticipantToChannel( - f_pApiInstance, - pEchoChanEntry->usBridgeIndex, - f_usChanIndex, - usChannelIndex, - pTempParticipant->ausLoadOrAccumulateEventIndex[ pParticipant->ulListenerMaskIndex ], - pTempEchoChanEntry->usSubStoreEventIndex, - pTempEchoChanEntry->usSinCopyEventIndex, - pParticipant->ulInputPort, - pTempParticipant->ulInputPort ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the Rin silence event can be cleared now that the */ - /* channel has unmuted. */ - if ( ( pTempParticipant->fFlexibleMixerCreated == TRUE ) - && ( pTempEchoChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) ) - { - /* Remove the event from the list. */ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pTempEchoChanEntry->usRinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pTempEchoChanEntry->usRinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_DF; - - pTempEchoChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - } - } - } - } - } - else /* if ( f_fFlexibleConfBridge == FALSE ) */ - { - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pLoadEventEntry, f_usLoadEventIndex ); - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pSubStoreEventEntry, f_usSubStoreEventIndex ); - - /*=======================================================================*/ - /* Program the Load event. */ - - /* Before reactivating this event, check what type of event this event must be. */ - if ( f_usLoadEventIndex == pBridgeEntry->usFirstLoadEventPtr || - pBridgeEntry->usLoadIndex == cOCT6100_INVALID_INDEX ) - { - /* This event must become a Load event. */ - usLoadEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD; - pBridgeEntry->usLoadIndex = f_usLoadEventIndex; - } - - usTempEventIndex = pBridgeEntry->usFirstLoadEventPtr; - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex ); - - ulLoopCount = 0; - - while( pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_SUB_STORE && - pTempEntry->usEventType != cOCT6100_MIXER_CONTROL_MEM_STORE ) - { - if ( pTempEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_LOAD ) - { - usPreviousLoadIndex = usTempEventIndex; - } - - /* Check if the previous load event is before or after the event about to be unmuted. */ - if ( pTempEntry->usNextEventPtr == f_usLoadEventIndex ) - { - if ( usPreviousLoadIndex == cOCT6100_INVALID_INDEX ) - { - /* We did not find a load event before our node, this mean this one */ - /* is about to become the new load event. */ - usLoadEventType = cOCT6100_MIXER_CONTROL_MEM_LOAD; - } - } - - /* Go to the next entry into the list. */ - usTempEventIndex = pTempEntry->usNextEventPtr; - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usTempEventIndex ); - - ulLoopCount++; - if ( ulLoopCount == cOCT6100_MAX_LOOP ) - return cOCT6100_ERR_FATAL_9B; - } - - /* Now program the current event node. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usLoadEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = usLoadEventType; - - /* If we have an extra Sin copy event, we know we are using the Sout port as a source. */ - if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) - { - /* Sout source */ - WriteParams.usWriteData |= pEchoChanEntry->usSinSoutTsiMemIndex; - } - else - { - /* Rin source */ - WriteParams.usWriteData |= pEchoChanEntry->usRinRoutTsiMemIndex; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the software event to reflect the hardware. */ - pLoadEventEntry->usEventType = usLoadEventType; - - /* Check if we need to change another node. */ - if ( usLoadEventType == cOCT6100_MIXER_CONTROL_MEM_LOAD ) - { - if ( usPreviousLoadIndex != cOCT6100_INVALID_INDEX ) - { - /* Now program the old load event. */ - ReadParams.ulReadAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usPreviousLoadIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = ReadParams.ulReadAddress; - WriteParams.usWriteData = (UINT16)(( usReadData & 0x1FFF ) | cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the software event to reflect the hardware. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEntry, usPreviousLoadIndex ); - pTempEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_ACCUMULATE; - } - } - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Program the Substract and store event. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usSubStoreEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_SUB_STORE; - /* If we have an extra Sin copy event, we know we are using the Sout port as a source. */ - if ( pEchoChanEntry->usSinCopyEventIndex != cOCT6100_INVALID_INDEX ) - { - /* Sout port source */ - WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.bySoutPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - WriteParams.usWriteData |= pEchoChanEntry->usSinSoutTsiMemIndex; - } - else - { - /* Rin port source */ - WriteParams.usWriteData |= pEchoChanEntry->TdmConfig.byRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - WriteParams.usWriteData |= pEchoChanEntry->usRinRoutTsiMemIndex; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pEchoChanEntry->usRinRoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the software event to reflect the hardware. */ - pSubStoreEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_SUB_STORE; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Check if have to remove silence load event. */ - - if ( pBridgeEntry->usSilenceLoadEventPtr != cOCT6100_INVALID_INDEX ) - { - if ( pBridgeEntry->usSilenceLoadEventPtr == f_usLoadEventIndex ) - { - /* Clear the silence load event ptr. */ - pBridgeEntry->usSilenceLoadEventPtr = cOCT6100_INVALID_INDEX; - } - } - } - - /* Update the channel entry API structure */ - pEchoChanEntry->fMute = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeDominantSpeakerSetSer - -Description: This function sets the dominant speaker of a bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to - keep the present state of the chip and all its - resources. - -f_pConfBridgeDominant Pointer to conference bridge dominant speaker - structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeDominantSpeakerSetSer -UINT32 Oct6100ConfBridgeDominantSpeakerSetSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker ) -{ - UINT16 usChanIndex; - UINT16 usBridgeIndex; - UINT32 ulResult; - - /* Check the validity of the channel handle given. */ - ulResult = Oct6100ApiCheckBridgeDominantSpeakerParams( f_pApiInstance, f_pConfBridgeDominantSpeaker, &usChanIndex, &usBridgeIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Modify all resources needed by the conference bridge. */ - ulResult = Oct6100ApiUpdateBridgeDominantSpeakerResources( f_pApiInstance, usChanIndex, usBridgeIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckBridgeDominantSpeakerParams - -Description: Check the validity of the channel given for setting the - dominant speaker. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_pConfBridgeDominant Pointer to conference bridge channel dominant speaker structure. -f_pusChannelIndex Pointer to a channel index. -f_pusChannelIndex Pointer to a bridge index. -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckBridgeDominantSpeakerParams -UINT32 Oct6100ApiCheckBridgeDominantSpeakerParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT16 f_pusBridgeIndex ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - tPOCT6100_API_CHANNEL pEchoChanEntry; - UINT32 ulEntryOpenCnt; - BOOL fCheckEntryOpenCnt = FALSE; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 ) - return cOCT6100_ERR_CONF_BRIDGE_DISABLED; - - if ( f_pConfBridgeDominantSpeaker->ulChannelHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - /*=====================================================================*/ - /* Check the channel handle. */ - - if ( f_pConfBridgeDominantSpeaker->ulChannelHndl != cOCT6100_CONF_NO_DOMINANT_SPEAKER_HNDL ) - { - if ( (f_pConfBridgeDominantSpeaker->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - *f_pusChannelIndex = (UINT16)( f_pConfBridgeDominantSpeaker->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeDominantSpeaker->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - /* Check if the channel is bound to a conference bridge. */ - if ( pEchoChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHAN_NOT_ON_BRIDGE; - - /* Check if the NLP is enabled on this channel. */ - if ( pEchoChanEntry->VqeConfig.fEnableNlp == FALSE ) - return cOCT6100_ERR_CONF_BRIDGE_NLP_MUST_BE_ENABLED; - - /* Check if conferencing noise reduction is enabled on this channel. */ - if ( pEchoChanEntry->VqeConfig.fSoutConferencingNoiseReduction == FALSE ) - return cOCT6100_ERR_CONF_BRIDGE_CNR_MUST_BE_ENABLED; - - /* Check if this is a tap channel. If it is, it will never be the dominant speaker! */ - if ( pEchoChanEntry->fTap == TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_CHANNEL_TAP_ALWAYS_MUTE; - - /* Set the bridge index. */ - *f_pusBridgeIndex = pEchoChanEntry->usBridgeIndex; - } - else - { - /* Set this such that there is no dominant speaker on this conference bridge. */ - *f_pusChannelIndex = cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED; - - /* Check the conference bridge handle. */ - if ( (f_pConfBridgeDominantSpeaker->ulConfBridgeHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CONF_BRIDGE ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - /* Set the bridge index. */ - *f_pusBridgeIndex = (UINT16)( f_pConfBridgeDominantSpeaker->ulConfBridgeHndl & cOCT6100_HNDL_INDEX_MASK ); - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeDominantSpeaker->ulConfBridgeHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - fCheckEntryOpenCnt = TRUE; - } - - /*=====================================================================*/ - - /*=====================================================================*/ - - if ( *f_pusBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex ) - - /* Check for errors. */ - if ( pBridgeEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( fCheckEntryOpenCnt == TRUE ) - { - if ( ulEntryOpenCnt != pBridgeEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - } - - /*=====================================================================*/ - /* Check if dominant speaker is supported in this firmware version. */ - - if ( f_pApiInstance->pSharedInfo->ImageInfo.fDominantSpeakerEnabled == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_DOMINANT_SPEAKER; - - /*=====================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateBridgeDominantSpeakerResources - -Description: Modify the conference bridge such that the new dominant - speaker is the one specified by the index. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usChanIndex Index of the channel to be set as the dominant speaker. -f_usBridgeIndex Index of the bridge where this channel is on. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateBridgeDominantSpeakerResources -UINT32 Oct6100ApiUpdateBridgeDominantSpeakerResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChanIndex, - IN UINT16 f_usBridgeIndex ) -{ - tPOCT6100_API_CHANNEL pEchoChanEntry; - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - - UINT16 usChannelIndex; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get the bridge entry for this channel. */ - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex ) - - /* Set the dominant speaker index for all channels in this conference. */ - - /* Search through the list of API channel entry for the ones on to this bridge.*/ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, usChannelIndex ); - - if ( pEchoChanEntry->fReserved == TRUE ) - { - if ( pEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - /* If we are unsetting the dominant speaker, of if it is not our channel index. */ - if ( ( f_usChanIndex == cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED ) - || ( f_usChanIndex != usChannelIndex ) ) - { - ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, usChannelIndex, f_usChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - } - - /* Make sure this channel is disabled. */ - if ( f_usChanIndex != cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED ) - { - ulResult = Oct6100ApiBridgeSetDominantSpeaker( f_pApiInstance, f_usChanIndex, cOCT6100_CONF_DOMINANT_SPEAKER_UNASSIGNED ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Save this in the conference bridge structure. */ - /* This will be needed later when removing the channel. */ - pBridgeEntry->fDominantSpeakerSet = TRUE; - pBridgeEntry->usDominantSpeakerChanIndex = f_usChanIndex; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeMaskChangeSer - -Description: This function changes the mask of flexible bridge - participant. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to - keep the present state of the chip and all its - resources. - -f_pConfBridgeMaskChange Pointer to conference bridge participant mask - change structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeMaskChangeSer -UINT32 Oct6100ConfBridgeMaskChangeSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange ) -{ - UINT16 usChanIndex; - UINT16 usBridgeIndex; - UINT32 ulResult; - UINT32 ulNewParticipantMask; - - /* Check the validity of the channel handle given. */ - ulResult = Oct6100ApiCheckBridgeMaskChangeParams( f_pApiInstance, f_pConfBridgeMaskChange, &usChanIndex, &usBridgeIndex, &ulNewParticipantMask ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update all resources needed by the new mask. */ - ulResult = Oct6100ApiUpdateMaskModifyResources( f_pApiInstance, usBridgeIndex, usChanIndex, ulNewParticipantMask ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Commit the changes to the chip's internal memories. */ - ulResult = Oct6100ApiBridgeUpdateMask( f_pApiInstance, usBridgeIndex, usChanIndex, ulNewParticipantMask ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckBridgeMaskChangeParams - -Description: Check the validity of the channel given for setting the - mask. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeMaskChange Pointer to conference bridge channel mask change structure. -f_pusChannelIndex Pointer to a channel index. -f_pusBridgeIndex Pointer to a bridge index. -f_pulNewParticipantMask New mask to apply for this participant. -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckBridgeMaskChangeParams -UINT32 Oct6100ApiCheckBridgeMaskChangeParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT16 f_pusBridgeIndex, - OUT PUINT32 f_pulNewParticipantMask ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - tPOCT6100_API_CHANNEL pEchoChanEntry; - UINT32 ulEntryOpenCnt; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 ) - return cOCT6100_ERR_CONF_BRIDGE_DISABLED; - - if ( f_pConfBridgeMaskChange->ulChannelHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - /*=====================================================================*/ - /* Check the channel handle.*/ - - if ( (f_pConfBridgeMaskChange->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - *f_pusChannelIndex = (UINT16)( f_pConfBridgeMaskChange->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, *f_pusChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeMaskChange->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - /* Check if the channel is bound to a conference bridge. */ - if ( pEchoChanEntry->usBridgeIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_CONF_BRIDGE_CHAN_NOT_ON_BRIDGE; - - /* Set the bridge index. */ - *f_pusBridgeIndex = pEchoChanEntry->usBridgeIndex; - - /*=====================================================================*/ - - /*=====================================================================*/ - - if ( ( *f_pusBridgeIndex == cOCT6100_INVALID_INDEX ) - || ( *f_pusBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges ) ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, *f_pusBridgeIndex ) - - /* Check for errors. */ - if ( pBridgeEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - - /* Check if this is bridge is a flexible conference bridge. */ - if ( pBridgeEntry->fFlexibleConferencing == FALSE ) - return cOCT6100_ERR_CONF_BRIDGE_SIMPLE_BRIDGE; - - /*=====================================================================*/ - - /* Return new mask to apply. */ - *f_pulNewParticipantMask = f_pConfBridgeMaskChange->ulNewListenerMask; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateMaskModifyResources - -Description: Modify/reserve all resources needed for the modification of - the participant's mask. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usBridgeIndex Bridge index of the bridge where this channel is residing. -f_usChanIndex Channel index of the channel to be modified. -f_ulNewListenerMask New mask to apply to the selected participant. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateMaskModifyResources -UINT32 Oct6100ApiUpdateMaskModifyResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChanIndex, - IN UINT32 f_ulNewListenerMask ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_API_CHANNEL pTempEchoChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant; - - UINT32 ulResult = cOCT6100_ERR_OK; - UINT32 ulTempVar; - UINT32 ulOldListenerMask; - UINT16 usChannelIndex; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ) - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pChanEntry->usFlexConfParticipantIndex ); - - /* Must travel all clients of this conference and reserve a load or accumulate event for */ - /* all participants which could not hear us but now can. While at it, check for events that */ - /* could be released, for example a participant that we cannot hear anymore. */ - - ulOldListenerMask = pParticipant->ulListenerMask; - - /* Search through the list of API channel entry for the ones on to this bridge.*/ - for ( usChannelIndex = 0; ( usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels ) && ( ulResult == cOCT6100_ERR_OK ) ; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - /* Channel reserved? */ - if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) ) - { - /* On current bridge? */ - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if we can now hear this participant, but could not before. */ - if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) - && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 ) ) - { - /* Must reserve a load or accumulate entry mixer event here! */ - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, &pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] ); - if ( ulResult != cOCT6100_ERR_OK ) - { - /* Most probably, the hardware is out of mixer events. */ - break; - } - } - - /* Check if we can now NOT hear this participant, but could before. */ - if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 ) - && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) ) - { - /* Must release the load or accumulate entry mixer event. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] ); - if ( ulResult != cOCT6100_ERR_OK ) - { - break; - } - } - } - } - } - - /* If an error is returned, make sure everything is cleaned up properly. */ - if ( ulResult != cOCT6100_ERR_OK ) - { - /* Search through the list of API channel entry for the ones on to this bridge.*/ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - /* Channel reserved? */ - if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) ) - { - /* On current bridge? */ - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if we can now hear this participant, but could not before. */ - if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) - && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 ) ) - { - /* If the load or event entry in the mixer memory was reserved. */ - if ( pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] != cOCT6100_INVALID_INDEX ) - { - /* Must release the load or accumulate entry mixer event. */ - ulTempVar = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - - pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX; - } - } - - /* Check if we can now NOT hear this participant, but could before. */ - if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 ) - && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) ) - { - /* If the load or event entry in the mixer memory was reserved. */ - if ( pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] == cOCT6100_INVALID_INDEX ) - { - /* Must release the load or accumulate entry mixer event. */ - ulTempVar = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, &( pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] ) ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - } - } - } - } - - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBridgeUpdateMask - -Description: Update the participant's mask. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_usBridgeIndex Bridge index of the bridge where this channel is residing. -f_usChanIndex Channel index of the channel to be modified. -f_ulNewListenerMask New mask to apply to the selected participant. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiBridgeUpdateMask -UINT32 Oct6100ApiBridgeUpdateMask( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChanIndex, - IN UINT32 f_ulNewListenerMask ) -{ - tPOCT6100_API_CHANNEL pChanEntry; - tPOCT6100_API_CHANNEL pTempEchoChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pParticipant; - tPOCT6100_API_FLEX_CONF_PARTICIPANT pTempParticipant; - tOCT6100_WRITE_PARAMS WriteParams; - - UINT32 ulResult; - UINT32 ulOldListenerMask; - UINT16 usChannelIndex; - - UINT16 ausMutePortChannelIndexes[ cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE ]; - UINT32 ulMutePortChannelIndex; - - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = cOCT6100_INVALID_INDEX; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, f_usChanIndex ) - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pParticipant, pChanEntry->usFlexConfParticipantIndex ); - - ulOldListenerMask = pParticipant->ulListenerMask; - - /* Search through the list of API channel entry for the ones onto this bridge. */ - for ( usChannelIndex = 0; usChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; usChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, usChannelIndex ); - - /* Channel reserved? */ - if ( ( usChannelIndex != f_usChanIndex ) && ( pTempEchoChanEntry->fReserved == TRUE ) ) - { - /* On current bridge? */ - if ( pTempEchoChanEntry->usBridgeIndex == f_usBridgeIndex ) - { - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - /* Check if we can now hear this participant, but could not before. */ - if ( ( pTempEchoChanEntry->fMute == FALSE ) - && ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) - && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 ) ) - { - /* First create/update the current channel's mixer. */ - ulResult = Oct6100ApiBridgeAddParticipantToChannel( - f_pApiInstance, - f_usBridgeIndex, - usChannelIndex, - f_usChanIndex, - pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ], - pChanEntry->usSubStoreEventIndex, - pChanEntry->usSinCopyEventIndex, - pTempParticipant->ulInputPort, - pParticipant->ulInputPort ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( pParticipant->fFlexibleMixerCreated == TRUE ) - { - /* Check if the Rin silence event can be cleared now that the */ - /* channel has been added to a conference. */ - if ( pChanEntry->usRinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - /* Remove the event from the list.*/ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - pChanEntry->usRinSilenceEventIndex, - cOCT6100_EVENT_TYPE_SOUT_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, pChanEntry->usRinSilenceEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_DF; - - pChanEntry->usRinSilenceEventIndex = cOCT6100_INVALID_INDEX; - } - } - } - - /* Check if we can now NOT hear this participant, but could before. */ - if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 ) - && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) - && ( pParticipant->fFlexibleMixerCreated == TRUE ) - && ( pTempEchoChanEntry->fMute == FALSE ) ) - { - /* First update the current channel's mixer. */ - ulResult = Oct6100ApiBridgeRemoveParticipantFromChannel( - f_pApiInstance, - f_usBridgeIndex, - usChannelIndex, - f_usChanIndex, - TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( pParticipant->fFlexibleMixerCreated == FALSE ) - { - /* Remember to mute the port on this channel. */ - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - { - if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == f_usChanIndex ) - { - break; - } - else if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) - { - ausMutePortChannelIndexes[ ulMutePortChannelIndex ] = f_usChanIndex; - break; - } - } - } - } - - /* Clear the load or accumulate event index for this participant. */ - if ( ( ( f_ulNewListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) != 0x0 ) - && ( ( ulOldListenerMask & ( 0x1 << pTempParticipant->ulListenerMaskIndex ) ) == 0x0 ) ) - { - pParticipant->ausLoadOrAccumulateEventIndex[ pTempParticipant->ulListenerMaskIndex ] = cOCT6100_INVALID_INDEX; - } - } - } - - /* Travel through the channels that were heard by the participant removed and check if their Rin port must be muted. */ - for( ulMutePortChannelIndex = 0; ulMutePortChannelIndex < cOCT6100_MAX_FLEX_CONF_PARTICIPANTS_PER_BRIDGE; ulMutePortChannelIndex ++ ) - { - if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempEchoChanEntry, ausMutePortChannelIndexes[ ulMutePortChannelIndex ] ); - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pTempParticipant, pTempEchoChanEntry->usFlexConfParticipantIndex ); - - if ( pTempParticipant->fFlexibleMixerCreated == FALSE ) - { - /* Check if the Rin port must be muted on this channel. */ - ulResult = Oct6100ApiMutePorts( - f_pApiInstance, - ausMutePortChannelIndexes[ ulMutePortChannelIndex ], - pTempEchoChanEntry->usRinTsstIndex, - pTempEchoChanEntry->usSinTsstIndex, - FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else /* if ( ausMutePortChannelIndexes[ ulMutePortChannelIndex ] == cOCT6100_INVALID_INDEX ) */ - { - /* No more channels to check for muting. */ - break; - } - } - } - - /* Configure the SIN copy mixer entry and memory - if using the SOUT port. */ - if ( pParticipant->ulInputPort == cOCT6100_CHANNEL_PORT_SOUT ) - { - if ( pChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pChanEntry->usSinTsstIndex, - pChanEntry->usExtraSinTsiMemIndex, - pChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* If the silence TSI is loaded on this port, update with the extra sin TSI. */ - if ( pChanEntry->usSinSilenceEventIndex != cOCT6100_INVALID_INDEX ) - { - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pChanEntry->usSinSilenceEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = pChanEntry->usExtraSinTsiMemIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Configure the RIN copy mixer entry and memory - if using the RIN port. */ - if ( pParticipant->ulInputPort == cOCT6100_CHANNEL_PORT_RIN ) - { - if ( pChanEntry->usRinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pChanEntry->usRinTsstIndex, - pChanEntry->usExtraRinTsiMemIndex, - pChanEntry->TdmConfig.byRinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Save the new mask permanently in the API instance. */ - pParticipant->ulListenerMask = f_ulNewListenerMask; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ConfBridgeGetStatsSer - -Description: This function returns the statistics from the specified bridge. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pConfBridgeStats Pointer to conference bridge stats structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ConfBridgeGetStatsSer -UINT32 Oct6100ConfBridgeGetStatsSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CONF_BRIDGE_STATS f_pConfBridgeStats ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - UINT16 usConfBridgeIndex; - UINT32 ulEntryOpenCnt; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges == 0 ) - return cOCT6100_ERR_CONF_BRIDGE_DISABLED; - - /*=====================================================================*/ - /* Check the conference bridge handle. */ - - /* Check the provided handle. */ - if ( (f_pConfBridgeStats->ulConfBridgeHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CONF_BRIDGE ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - usConfBridgeIndex = (UINT16)( f_pConfBridgeStats->ulConfBridgeHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( usConfBridgeIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxConfBridges ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, usConfBridgeIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pConfBridgeStats->ulConfBridgeHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pBridgeEntry->fReserved != TRUE ) - return cOCT6100_ERR_CONF_BRIDGE_NOT_OPEN; - if ( ulEntryOpenCnt != pBridgeEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CONF_BRIDGE_INVALID_HANDLE; - - /*=====================================================================*/ - - /* Return the stats.*/ - f_pConfBridgeStats->ulNumChannels = pBridgeEntry->usNumClients; - f_pConfBridgeStats->ulNumTappedChannels = pBridgeEntry->usNumTappedClients; - f_pConfBridgeStats->fFlexibleConferencing = pBridgeEntry->fFlexibleConferencing; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveBridgeEntry - -Description: Reserves a free entry in the Bridge list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_pusBridgeIndex List entry reserved. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveBridgeEntry -UINT32 Oct6100ApiReserveBridgeEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusBridgeIndex ) -{ - PVOID pBridgeAlloc; - UINT32 ulResult; - UINT32 ulBridgeIndex; - - mOCT6100_GET_CONF_BRIDGE_ALLOC_PNT( f_pApiInstance->pSharedInfo, pBridgeAlloc ) - - ulResult = OctapiLlmAllocAlloc( pBridgeAlloc, &ulBridgeIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_CONF_BRIDGE_ALL_BUFFERS_OPEN; - else - return cOCT6100_ERR_FATAL_29; - } - - *f_pusBridgeIndex = (UINT16)( ulBridgeIndex & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseBridgeEntry - -Description: Release an entry from the bridge list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usBridgeIndex List entry reserved. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseBridgeEntry -UINT32 Oct6100ApiReleaseBridgeEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBridgeIndex ) -{ - PVOID pBridgeAlloc; - UINT32 ulResult; - - mOCT6100_GET_CONF_BRIDGE_ALLOC_PNT( f_pApiInstance->pSharedInfo, pBridgeAlloc ) - - ulResult = OctapiLlmAllocDealloc( pBridgeAlloc, f_usBridgeIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_2A; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetPrevLastSubStoreEvent - -Description: This function will search for the first valid LastSubStoreEvent - in a bridge located before the current bridge in the bridge - link list. - - If the function does not find an event before reaching the end - of the mixers list, then the event head node will be used as the - last Store or SubStore event. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pusBridgeEntry Bridge entry. -f_usBridgeFirstLoadEventPtr Load index to check against. -First valid sub store index. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetPrevLastSubStoreEvent -UINT32 Oct6100ApiGetPrevLastSubStoreEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usBridgeFirstLoadEventPtr, - OUT PUINT16 f_pusLastSubStoreEventIndex ) -{ - tPOCT6100_API_CONF_BRIDGE pBridgeEntry; - tPOCT6100_API_MIXER_EVENT pTempMixerEntry; - UINT16 usNextEventPtr; - UINT16 usHeadEventPtr; - UINT16 usLastSubStoreEventPtr; - UINT32 ulLoopCount = 0; - UINT16 usCurrentPtr; - UINT32 ulResult = cOCT6100_ERR_OK; - - /* Get current entry to obtain the link to the previous entry.*/ - mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBridgeEntry, f_usBridgeIndex ); - - /* Since we have flexible bridges, we have to */ - /* run down the list and check for the appropriate event. */ - - /* Travel down the list for the last Store or Sub/Store event before the bridge. */ - - if ( f_pApiInstance->pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX ) - { - /* The only node in the list then is the head node.*/ - usHeadEventPtr = cOCT6100_MIXER_HEAD_NODE; - } - else - { - usHeadEventPtr = f_pApiInstance->pSharedInfo->MixerInfo.usLastSoutCopyEventPtr; - } - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTempMixerEntry, usHeadEventPtr ); - usLastSubStoreEventPtr = usHeadEventPtr; - usNextEventPtr = pTempMixerEntry->usNextEventPtr; - usCurrentPtr = usHeadEventPtr; - while( usCurrentPtr != f_usBridgeFirstLoadEventPtr ) - { - if ( ( pTempMixerEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_STORE ) - || ( pTempMixerEntry->usEventType == cOCT6100_MIXER_CONTROL_MEM_SUB_STORE ) ) - { - usLastSubStoreEventPtr = usNextEventPtr; - } - - /* Next pointer. */ - usCurrentPtr = usNextEventPtr; - usNextEventPtr = pTempMixerEntry->usNextEventPtr; - - /* Check if next event pointer is valid. */ - if ( ( ( f_usBridgeFirstLoadEventPtr != usCurrentPtr ) - && ( pTempMixerEntry->usNextEventPtr == cOCT6100_INVALID_INDEX ) ) - || ( pTempMixerEntry->usNextEventPtr == cOCT6100_MIXER_HEAD_NODE ) ) - return cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND; - - if ( usNextEventPtr != cOCT6100_INVALID_INDEX ) - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTempMixerEntry, usNextEventPtr ); - - ulLoopCount++; - if ( ulLoopCount == cOCT6100_MAX_LOOP ) - return cOCT6100_ERR_FATAL_CA; - } - - /* Return the result to the user. */ - *f_pusLastSubStoreEventIndex = usLastSubStoreEventPtr; - - return ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetPreviousEvent - -Description: This is a recursive function, it requires an entry event index and - will run down the list until it finds the node just before the one - required. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usEntryIndex Event entry index. -f_pusBridgeEntry Bridge entry. -f_pusPreviousIndex Previous index. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetPreviousEvent -UINT32 Oct6100ApiGetPreviousEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEntryIndex, - IN UINT16 f_usSearchedIndex, - IN UINT16 f_usLoopCnt, - OUT PUINT16 f_pusPreviousIndex ) -{ - tPOCT6100_API_MIXER_EVENT pCurrentEntry; - UINT32 ulResult; - - /* Get current entry to obtain the link to the previous entry. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pCurrentEntry, f_usEntryIndex ); - - /* Avoid stack overflows. */ - if ( f_usLoopCnt == cOCT6100_MAX_MIXER_EVENTS ) - return cOCT6100_ERR_FATAL_E3; - - if ( pCurrentEntry->usNextEventPtr == cOCT6100_INVALID_INDEX ) - { - /* Event not found. */ - ulResult = cOCT6100_ERR_CONF_MIXER_EVENT_NOT_FOUND; - } - else if ( pCurrentEntry->usNextEventPtr == f_usSearchedIndex ) - { - /* We found our node. */ - *f_pusPreviousIndex = f_usEntryIndex; - ulResult = cOCT6100_ERR_OK; - } - else - { - /* Keep searching.*/ - f_usLoopCnt++; - ulResult = Oct6100ApiGetPreviousEvent( f_pApiInstance, pCurrentEntry->usNextEventPtr, f_usSearchedIndex, f_usLoopCnt, f_pusPreviousIndex ); - } - - return ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBridgeSetDominantSpeaker - -Description: This function will set the index of the dominant speaker - for the channel index specified. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to - keep the present state of the chip and all its - resources. - -f_usChannelIndex Index of the channel where the API must set the - current dominant speaker for the conference. -f_usDominantSpeakerIndex Index of the channel which is the dominant - speaker in the conference. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiBridgeSetDominantSpeaker -UINT32 Oct6100ApiBridgeSetDominantSpeaker( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChannelIndex, - IN UINT16 f_usDominantSpeakerIndex ) -{ - UINT32 ulBaseAddress; - UINT32 ulFeatureBytesOffset; - UINT32 ulFeatureBitOffset; - UINT32 ulFeatureFieldLength; - UINT32 ulResult; - UINT32 ulTempData; - UINT32 ulMask; - - tPOCT6100_API_CHANNEL pEchoChanEntry; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChanEntry, f_usChannelIndex ); - - ulBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_usChannelIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + f_pApiInstance->pSharedInfo->MemoryMap.ulChanRootConfOfst; - ulFeatureBytesOffset = f_pApiInstance->pSharedInfo->MemoryMap.DominantSpeakerFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = f_pApiInstance->pSharedInfo->MemoryMap.DominantSpeakerFieldOfst.byBitOffset; - ulFeatureFieldLength = f_pApiInstance->pSharedInfo->MemoryMap.DominantSpeakerFieldOfst.byFieldSize; - - /* Retrieve the current configuration. */ - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pEchoChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear previous value set in the feature field.*/ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - ulTempData &= (~ulMask); - ulTempData |= ( ( f_usDominantSpeakerIndex ) << ulFeatureBitOffset ); - - /* Save the new dominant speaker. */ - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pEchoChanEntry, - ulBaseAddress + ulFeatureBytesOffset, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveFlexConfParticipantEntry - -Description: Reserves a free entry in the participant list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. -f_pusParticipantIndex List entry reserved. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveFlexConfParticipantEntry -UINT32 Oct6100ApiReserveFlexConfParticipantEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusParticipantIndex ) -{ - PVOID pParticipantAlloc; - UINT32 ulResult; - UINT32 ulParticipantIndex; - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pParticipantAlloc ) - - ulResult = OctapiLlmAllocAlloc( pParticipantAlloc, &ulParticipantIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_CONF_BRIDGE_FLEX_CONF_ALL_BUFFERS_OPEN; - else - return cOCT6100_ERR_FATAL_29; - } - - *f_pusParticipantIndex = (UINT16)( ulParticipantIndex & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseFlexConfParticipantEntry - -Description: Release an entry from the flexible conferencing participant - list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usParticipantIndex List entry reserved. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseFlexConfParticipantEntry -UINT32 Oct6100ApiReleaseFlexConfParticipantEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usParticipantIndex ) -{ - PVOID pParticipantAlloc; - UINT32 ulResult; - - mOCT6100_GET_FLEX_CONF_PARTICIPANT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pParticipantAlloc ) - - ulResult = OctapiLlmAllocDealloc( pParticipantAlloc, f_usParticipantIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_2A; - - return cOCT6100_ERR_OK; -} -#endif diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c deleted file mode 100644 index 1f4de01..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_debug.c +++ /dev/null @@ -1,1278 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_debug.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains functions used to debug the OCT6100. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 65 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "oct6100api/oct6100_apiud.h" -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_channel_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_debug_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_memory_priv.h" -#include "oct6100_debug_priv.h" -#include "oct6100_version.h" - - -/**************************** PUBLIC FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100DebugSelectChannel - -Description: This function sets the current debug channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pSelectDebugChan Pointer to select debug channel structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100DebugSelectChannelDef -UINT32 Oct6100DebugSelectChannelDef( - tPOCT6100_DEBUG_SELECT_CHANNEL f_pSelectDebugChan ) -{ - f_pSelectDebugChan->ulChannelHndl = cOCT6100_INVALID_VALUE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100DebugSelectChannel -UINT32 Oct6100DebugSelectChannel( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_DEBUG_SELECT_CHANNEL f_pSelectDebugChan ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100DebugSelectChannelSer( f_pApiInstance, f_pSelectDebugChan, TRUE ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100DebugGetData - -Description: This function retrieves the last recorded debug data. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pGetData Pointer to debug get data structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100DebugGetDataDef -UINT32 Oct6100DebugGetDataDef( - tPOCT6100_DEBUG_GET_DATA f_pGetData ) -{ - f_pGetData->ulGetDataMode = cOCT6100_DEBUG_GET_DATA_MODE_120S_LITE; - f_pGetData->ulGetDataContent = cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE; - f_pGetData->ulRemainingNumBytes = cOCT6100_INVALID_VALUE; - f_pGetData->ulTotalNumBytes = cOCT6100_INVALID_VALUE; - f_pGetData->ulMaxBytes = cOCT6100_INVALID_VALUE; - f_pGetData->ulValidNumBytes = cOCT6100_INVALID_VALUE; - f_pGetData->pbyData = NULL; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100DebugGetData -UINT32 Oct6100DebugGetData( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_DEBUG_GET_DATA f_pGetData ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100DebugGetDataSer( f_pApiInstance, f_pGetData ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100DebugSelectChannelSer - -Description: This function sets the debug channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pSelectDebugChan Pointer to a tOCT6100_DEBUG_SELECT_CHANNEL structure. -f_fCheckChannelRecording Check if channel recording is enabled or not. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100DebugSelectChannelSer -UINT32 Oct6100DebugSelectChannelSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_DEBUG_SELECT_CHANNEL f_pSelectDebugChan, - IN BOOL f_fCheckChannelRecording ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry = NULL; - tPOCT6100_API_CHANNEL pTempChanEntry; - tOCT6100_CHANNEL_OPEN TempChanOpen; - tOCT6100_WRITE_BURST_PARAMS BurstParams; - UINT16 usChanIndex = 0; - UINT32 ulEntryOpenCnt; - UINT16 ausWriteData[ 2 ]; - UINT32 ulResult; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - BurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - BurstParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - BurstParams.pusWriteData = ausWriteData; - - /* First release the resources reserved for the channel that was previously debugged. */ - if ( pSharedInfo->DebugInfo.usCurrentDebugChanIndex != cOCT6100_INVALID_INDEX && - pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE ) - { - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pTempChanEntry, pSharedInfo->DebugInfo.usCurrentDebugChanIndex ) - - /* Release the extra TSI memory entry and reprogram the TSST control memory if required. */ - if ( pTempChanEntry->usExtraSinTsiDependencyCnt >= 1 ) - { - /*=======================================================================*/ - /* Clear memcpy operations. */ - - BurstParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pSharedInfo->MixerInfo.usRecordCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - BurstParams.ulWriteLength = 2; - - ausWriteData[ 0 ] = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - ausWriteData[ 1 ] = 0x0; - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - BurstParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pSharedInfo->MixerInfo.usRecordSinEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* If we are the last dependency using the extra Sin TSI, release it */ - if ( pTempChanEntry->usExtraSinTsiDependencyCnt == 1 ) - { - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, pTempChanEntry->usExtraSinTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Do not forget to reprogram the TSST control memory. */ - if ( pTempChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pTempChanEntry->usSinTsstIndex, - pTempChanEntry->usSinSoutTsiMemIndex, - pTempChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - pTempChanEntry->usExtraSinTsiMemIndex = cOCT6100_INVALID_INDEX; - - /* XXX: What about the silence TSI usSinSilenceEventIndex ?? */ - } - - pTempChanEntry->usExtraSinTsiDependencyCnt--; - - } - } - - /* Set the new parameters. */ - if ( f_pSelectDebugChan->ulChannelHndl != cOCT6100_INVALID_HANDLE ) - { - /* Check the provided handle. */ - if ( (f_pSelectDebugChan->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_DEBUG_CHANNEL_INVALID_HANDLE; - - usChanIndex = (UINT16)( f_pSelectDebugChan->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( usChanIndex >= pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_DEBUG_CHANNEL_INVALID_HANDLE; - - if ( f_fCheckChannelRecording == TRUE ) - { - if ( pSharedInfo->ChipConfig.fEnableChannelRecording == FALSE ) - return cOCT6100_ERR_DEBUG_CHANNEL_RECORDING_DISABLED; - } - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, usChanIndex ); - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pSelectDebugChan->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pChanEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pChanEntry->byEntryOpenCnt ) - return cOCT6100_ERR_CHANNEL_INVALID_HANDLE; - - /*=======================================================================*/ - - /* First program the mixer entry if the user wants to record. */ - /* Check if the API needs to reserve an extra TSI memory to load the SIN signal. */ - if ( pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE ) - { - /* Reserve the extra Sin TSI memory if it was not already reserved. */ - if ( pChanEntry->usExtraSinTsiMemIndex == cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, &pChanEntry->usExtraSinTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reprogram the TSST control memory accordingly. */ - if ( pChanEntry->usSinTsstIndex != cOCT6100_INVALID_INDEX ) - { - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - pChanEntry->usSinTsstIndex, - pChanEntry->usExtraSinTsiMemIndex, - pChanEntry->TdmConfig.bySinPcmLaw ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* XXX: What about the silence TSI usSinSilenceEventIndex ?? */ - } - - - /*=======================================================================*/ - /* Program the Sout Copy event. */ - BurstParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pSharedInfo->MixerInfo.usRecordCopyEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - BurstParams.ulWriteLength = 2; - - ausWriteData[ 0 ] = cOCT6100_MIXER_CONTROL_MEM_COPY; - ausWriteData[ 0 ] |= pChanEntry->usSinSoutTsiMemIndex; - ausWriteData[ 0 ] |= pChanEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - ausWriteData[ 1 ] = (UINT16)( pSharedInfo->DebugInfo.usRecordRinRoutTsiMemIndex ); - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*=======================================================================*/ - - /*=======================================================================*/ - /* Program the Sin copy event. */ - BurstParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( pSharedInfo->MixerInfo.usRecordSinEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - BurstParams.ulWriteLength = 2; - - ausWriteData[ 0 ] = cOCT6100_MIXER_CONTROL_MEM_COPY; - ausWriteData[ 0 ] |= pChanEntry->usExtraSinTsiMemIndex; - ausWriteData[ 0 ] |= pChanEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - ausWriteData[ 1 ] = pChanEntry->usSinSoutTsiMemIndex; - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*=======================================================================*/ - - pChanEntry->usExtraSinTsiDependencyCnt++; - } - } - else - { - /* Set the index to invalid to deactivate the recording. */ - usChanIndex = cOCT6100_INVALID_INDEX; - } - - /* Set law of newly selected hot channel. */ - if ( ( pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE ) - && ( f_pSelectDebugChan->ulChannelHndl != cOCT6100_INVALID_HANDLE ) - && ( pChanEntry != NULL ) ) - { - /* Set the PCM law of the debug channel. */ - /* Let's program the channel memory. */ - Oct6100ChannelOpenDef( &TempChanOpen ); - - TempChanOpen.ulEchoOperationMode = cOCT6100_ECHO_OP_MODE_HT_RESET; /* Activate the channel. */ - TempChanOpen.VqeConfig.fEnableNlp = FALSE; - TempChanOpen.VqeConfig.ulComfortNoiseMode = cOCT6100_COMFORT_NOISE_NORMAL; - TempChanOpen.VqeConfig.fSinDcOffsetRemoval = FALSE; - TempChanOpen.VqeConfig.fRinDcOffsetRemoval = FALSE; - TempChanOpen.VqeConfig.lDefaultErlDb = 0; - - /* Use the law of the channel being recorded. */ - TempChanOpen.TdmConfig.ulRinPcmLaw = pChanEntry->TdmConfig.byRinPcmLaw; - TempChanOpen.TdmConfig.ulSinPcmLaw = pChanEntry->TdmConfig.bySinPcmLaw; - TempChanOpen.TdmConfig.ulRoutPcmLaw = pChanEntry->TdmConfig.byRoutPcmLaw; - TempChanOpen.TdmConfig.ulSoutPcmLaw = pChanEntry->TdmConfig.bySoutPcmLaw; - - ulResult = Oct6100ApiWriteDebugChanMemory( f_pApiInstance, - &TempChanOpen.TdmConfig, - &TempChanOpen.VqeConfig, - &TempChanOpen, - pSharedInfo->DebugInfo.usRecordChanIndex, - pSharedInfo->DebugInfo.usRecordMemIndex, - pSharedInfo->DebugInfo.usRecordRinRoutTsiMemIndex, - pSharedInfo->DebugInfo.usRecordSinSoutTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - ausWriteData[ 0 ] = 0x0; - ausWriteData[ 1 ] = (UINT16)(( usChanIndex >> 0) & 0xFFFF); - - /* Write the channel number into the Matrix hot channel field.*/ - BurstParams.ulWriteAddress = pSharedInfo->DebugInfo.ulHotChannelSelectBaseAddress; - BurstParams.pusWriteData = ausWriteData; - BurstParams.ulWriteLength = 2; - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - pSharedInfo->DebugInfo.usCurrentDebugChanIndex = usChanIndex; - - /* Cancel data dump request, if there was one. */ - pSharedInfo->DebugInfo.fDebugDataBeingDumped = FALSE; - pSharedInfo->DebugInfo.ulDebugDataTotalNumBytes = cOCT6100_INVALID_VALUE; - - /* Call from remote client. */ - if ( f_fCheckChannelRecording == FALSE ) - { - /* If the user has not activated recording, let the remote client know. */ - if ( pSharedInfo->ChipConfig.fEnableChannelRecording == FALSE ) - return cOCT6100_ERR_DEBUG_RC_CHANNEL_RECORDING_DISABLED; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100DebugGetDataSer - -Description: This function retrieves the latest recorded debug data. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pGetData Pointer to a tOCT6100_DEBUG_GET_DATA structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100DebugGetDataSer -UINT32 Oct6100DebugGetDataSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_DEBUG_GET_DATA f_pGetData ) -{ - - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pChanEntry = NULL; - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_BURST_PARAMS ReadBurstParams; - tOCT6100_WRITE_BURST_PARAMS WriteBurstParams; - - UINT16 ausWriteData[ 2 ]; - UINT16 usReadData; - UINT16 usDebugEventReadPtr; - UINT16 usTempNumEvents; - - UINT32 ulResult; - UINT32 ulToneEventIndex; - UINT32 ulReadPointer; - UINT32 ulUserBufWriteIndex = 0; - UINT32 ulTimestamp; - UINT32 ulDebugEventIndex = 0; - UINT32 ulStreamIndex; - UINT32 ulPcmSampleIndex; - UINT32 ulNumAfEvents; - UINT32 ulNumReads = 0; - UINT32 ulTempIndex; - UINT32 ulCopyIndex; - UINT32 ulFeatureBytesOffset; - UINT32 ulFeatureBitOffset; - UINT32 ulFeatureFieldLength; - UINT32 ulStreamIndexMin; - UINT32 ulStreamIndexMax; - UINT32 ulTempData; - UINT32 ulMask; - BOOL fResetRemainingDataFlag = FALSE; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - ReadBurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadBurstParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - WriteBurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteBurstParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Check all user parameters. */ - - /* Check if channel recording is enabled. */ - if ( pSharedInfo->ChipConfig.fEnableChannelRecording == FALSE ) - return cOCT6100_ERR_DEBUG_CHANNEL_RECORDING_DISABLED; - - /* Check if a current debugging channel has been selected. */ - /* If not, the user has not yet called Oct6100DebugSelectChannel. */ - if ( pSharedInfo->DebugInfo.usCurrentDebugChanIndex == cOCT6100_INVALID_INDEX ) - return cOCT6100_ERR_DEBUG_RECORD_NO_CHAN_SELECTED; - - /* Check that the user supplied a valid max bytes value. */ - if ( f_pGetData->ulMaxBytes == cOCT6100_INVALID_VALUE ) - return cOCT6100_ERR_DEBUG_GET_DATA_MAX_BYTES; - - /* Data buffer must be aligned on 1024 bytes. */ - if ( ( f_pGetData->ulMaxBytes % 1024 ) != 0 ) - return cOCT6100_ERR_DEBUG_GET_DATA_MAX_BYTES; - - /* Check that the user provided the required memory to transfer the information. */ - if ( f_pGetData->pbyData == NULL ) - return cOCT6100_ERR_DEBUG_GET_DATA_PTR_INVALID; - - /* Check dump type. */ - if ( ( f_pGetData->ulGetDataMode != cOCT6100_DEBUG_GET_DATA_MODE_16S_LITE ) - && ( f_pGetData->ulGetDataMode != cOCT6100_DEBUG_GET_DATA_MODE_120S_LITE ) - && ( f_pGetData->ulGetDataMode != cOCT6100_DEBUG_GET_DATA_MODE_16S ) - && ( f_pGetData->ulGetDataMode != cOCT6100_DEBUG_GET_DATA_MODE_120S ) ) - return cOCT6100_ERR_DEBUG_GET_DATA_MODE; - - /* Check dump content. */ - if ( ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - && ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_RIN_PCM ) - && ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_SIN_PCM ) - && ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_SOUT_PCM ) ) - return cOCT6100_ERR_DEBUG_GET_DATA_CONTENT; - - /* Check if can accomodate the 120 seconds dump. */ - if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S_LITE ) - || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) ) - { - if ( pSharedInfo->DebugInfo.ulDebugEventSize != 0x100 ) - return cOCT6100_ERR_NOT_SUPPORTED_DEBUG_DATA_MODE_120S; - } - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pChanEntry, pSharedInfo->DebugInfo.usCurrentDebugChanIndex ) - - /* Lets go dump the requested data. */ - - usDebugEventReadPtr = 0; - - /* Check if this is the first time this function is called since the hot channel was set. */ - if ( pSharedInfo->DebugInfo.fDebugDataBeingDumped == FALSE ) - { - /* Check that the channel is not in POWER_DOWN. When the channel is in POWER_DOWN, */ - /* the debug events are not recorded correctly in external memory. */ - if ( pChanEntry->byEchoOperationMode == cOCT6100_ECHO_OP_MODE_POWER_DOWN ) - return cOCT6100_ERR_DEBUG_CHANNEL_IN_POWER_DOWN; - - pSharedInfo->DebugInfo.fDebugDataBeingDumped = TRUE; - - /* Flag the hot channel that it must stop recording. The data is being transfered. */ - /* This also tells the remote client not to do anything right now. */ - - ReadBurstParams.ulReadAddress = pSharedInfo->DebugInfo.ulHotChannelSelectBaseAddress; - ReadBurstParams.ulReadLength = 2; - ReadBurstParams.pusReadData = pSharedInfo->DebugInfo.ausHotChannelData; - - mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteBurstParams.pusWriteData = ausWriteData; - WriteBurstParams.ulWriteAddress = pSharedInfo->DebugInfo.ulHotChannelSelectBaseAddress; - WriteBurstParams.ulWriteLength = 2; - - WriteBurstParams.pusWriteData[ 0 ] = 0xFFFF; - WriteBurstParams.pusWriteData[ 1 ] = 0xFFFF; - - mOCT6100_DRIVER_WRITE_BURST_API( WriteBurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Get the maximum number of events this firmware supports from the TLVs. */ - pSharedInfo->DebugInfo.usMatrixCBMask = (UINT16)( pSharedInfo->DebugInfo.ulDebugEventSize & 0xFFFF ); - pSharedInfo->DebugInfo.usMatrixCBMask -= 1; - - /* Find out the chip log write pointer. */ - - /* Now get the current write pointer for matrix events. */ - ReadParams.pusReadData = &pSharedInfo->DebugInfo.usChipDebugEventWritePtr; - ReadParams.ulReadAddress = pSharedInfo->DebugInfo.ulMatrixWpBaseAddress + 2; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ReadParams.pusReadData = &usReadData; - - /* This write pointer might have wrapped, but we don't know for sure. */ - /* To be confident, the chip frame timestamp is read. */ - ReadParams.ulReadAddress = pSharedInfo->DebugInfo.ulMatrixTimestampBaseAddress; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulTimestamp = usReadData << 16; - - ReadParams.ulReadAddress += 2; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulTimestamp |= usReadData; - - ulTimestamp >>= 12; /* TDM time for 1 event (512 ms) */ - - /* There is a probability here (once very 6.2 days) that the timestamp is close */ - /* to 0, because it has wrapped. But still, we need a way to workaround the highly */ - /* occuring case of the chip just being opened. This will fix this problem. */ - if ( ulTimestamp < (UINT32)( pSharedInfo->DebugInfo.usMatrixCBMask + 1 ) ) - { - if ( pSharedInfo->DebugInfo.usChipDebugEventWritePtr >= 2 ) - { - /* Must trash the first 2 events. The chip is not yet ready. */ - pSharedInfo->DebugInfo.usNumEvents = (UINT16)( pSharedInfo->DebugInfo.usChipDebugEventWritePtr - 2 ); - } - else - { - pSharedInfo->DebugInfo.usNumEvents = 0x0; - } - } - else - { - pSharedInfo->DebugInfo.usNumEvents = (UINT16)( pSharedInfo->DebugInfo.usMatrixCBMask + 1 ); - - /* Account for event being created right now while the chip is running. */ - /* The event at the write pointer will be discarded. */ - if ( pSharedInfo->DebugInfo.usNumEvents > 0 ) - pSharedInfo->DebugInfo.usNumEvents--; - } - - - /* If the user only requested the last 16 seconds, cap the number of events. */ - if ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S - || f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S_LITE ) - { - /* x events to get the last 16 seconds. */ - if ( pSharedInfo->DebugInfo.usNumEvents > ( 16000 / ( pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize / 8 ) ) ) - pSharedInfo->DebugInfo.usNumEvents = (UINT16)( ( 16000 / ( pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize / 8 ) ) & 0xFFFF ); - } - - /* Make sure that all the events are pertaining to the current hot channel. */ - /* Calculate the event read pointer. */ - ulReadPointer = ( ( pSharedInfo->DebugInfo.usChipDebugEventWritePtr - pSharedInfo->DebugInfo.usNumEvents ) & pSharedInfo->DebugInfo.usMatrixCBMask ) * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize; - ulReadPointer %= ( ( pSharedInfo->DebugInfo.usMatrixCBMask + 1 ) * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ); - - /* Travel through the events and throw away the bad events. */ - usTempNumEvents = pSharedInfo->DebugInfo.usNumEvents; - pSharedInfo->DebugInfo.usNumEvents = 0; - for ( ulDebugEventIndex = 0; ulDebugEventIndex < usTempNumEvents; ulDebugEventIndex ++ ) - { - /* The HOT channel index for the event is stored at offset 0xF2 (word offset) */ - - ReadParams.ulReadAddress = pSharedInfo->DebugInfo.ulMatrixBaseAddress + ulReadPointer; - ReadParams.ulReadAddress += 0xF2 * sizeof(UINT16); - ReadParams.pusReadData = &usReadData; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the current debug index is the same as the one found in the event. */ - if ( usReadData != pSharedInfo->DebugInfo.usCurrentDebugChanIndex ) - pSharedInfo->DebugInfo.usNumEvents = 0; /* As soon as we hit another channel, we reset the number of valid events. */ - else - pSharedInfo->DebugInfo.usNumEvents++; - - /* Increment read pointer to get next event. */ - ulReadPointer = ( ulReadPointer + pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ) % ( ( pSharedInfo->DebugInfo.usMatrixCBMask + 1 ) * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ); - } - - /* In heavy mode, the AF log pointer is retrieved. */ - if ( ( pSharedInfo->DebugInfo.usNumEvents >= 2 ) - && ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S ) - || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) ) ) - { - /* The latest AF log write pointer is at the latest matrix event. */ - ReadParams.ulReadAddress = pSharedInfo->DebugInfo.ulMatrixBaseAddress + ( ( pSharedInfo->DebugInfo.usChipDebugEventWritePtr & pSharedInfo->DebugInfo.usMatrixCBMask ) * 1024 ); - - /* To get the AF log write pointer, which is at offset pSharedInfo->ImageInfo.ulAfWritePtrByteOffset. */ - ReadParams.ulReadAddress += pSharedInfo->DebugInfo.ulAfWritePtrByteOffset; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - pSharedInfo->DebugInfo.usAfLogWritePtr = usReadData; - - /* The AF event read pointer is the AF write pointer +4096 */ - /* This will make sure we do not get mixed up and fetch events that have */ - /* just been written, but we think are old. */ - - /* To get the exact AF log pointer, the API would have to wait 512 milliseconds to make */ - /* sure logging had stopped. This is not required since missing a few last events is not */ - /* important at this point (the user knows that valid data has already been recorded). */ - pSharedInfo->DebugInfo.usLastAfLogReadPtr = (UINT16)( ( pSharedInfo->DebugInfo.usAfLogWritePtr + 4096 ) & 0xFFFF ); - - /* Note that if the chip has just been booted, some of the AF events might not be initialized. */ - } - else - { - pSharedInfo->DebugInfo.usLastAfLogReadPtr = 0; - pSharedInfo->DebugInfo.usAfLogWritePtr = 0; - } - - /* To be aligned correctly for the bursts. */ - while ( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 ) ) != 0 ) - pSharedInfo->DebugInfo.usLastAfLogReadPtr++; - - /* Remember the data mode for later checks. Also, the user cannot change this "mode". */ - pSharedInfo->DebugInfo.ulCurrentGetDataMode = f_pGetData->ulGetDataMode; - } - else - { - /* Check that the user did not change the current data mode. */ - if ( pSharedInfo->DebugInfo.ulCurrentGetDataMode != f_pGetData->ulGetDataMode ) - return cOCT6100_ERR_DEBUG_GET_DATA_MODE_CANNOT_CHANGE; - } - - /* Check if this is the first pass here. */ - if ( pSharedInfo->DebugInfo.ulDebugDataTotalNumBytes == cOCT6100_INVALID_VALUE ) - { - /* Calculate how many bytes of data will be returned with respect to the selected data content. */ - - /* Check what content type the user requested. */ - if ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - { - /* Remember first AF Event Read Pointer. */ - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr ) & 0xFF ); - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr >> 8 ) & 0xFF ); - - /* Remember the AF Event Write Pointer. */ - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usAfLogWritePtr ) & 0xFF ); - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usAfLogWritePtr >> 8 ) & 0xFF ); - - /* Remember law and hot channel */ - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( pChanEntry->TdmConfig.bySinPcmLaw | ( ( pSharedInfo->DebugInfo.usCurrentDebugChanIndex >> 2 ) & 0xFE ) ); - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( pChanEntry->TdmConfig.bySoutPcmLaw ); - - /* Insert light or heavy mode in array. */ - if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S_LITE ) - || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S_LITE ) ) - { - f_pGetData->pbyData[ ulUserBufWriteIndex - 1 ] |= 0x80; - } - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( pChanEntry->TdmConfig.byRinPcmLaw | ( ( pSharedInfo->DebugInfo.usCurrentDebugChanIndex & 0x1F ) << 3 ) ); - - /* Remember usNumEvents */ - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usNumEvents ) & 0xFF ); - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->DebugInfo.usNumEvents >> 8 ) & 0xFF ); - } - - /* Last indexes set to '0'! */ - pSharedInfo->DebugInfo.usLastDebugEventIndex = 0; - pSharedInfo->DebugInfo.ulLastPcmSampleIndex = 0; - - /* No tone event has been retrieved. */ - pSharedInfo->DebugInfo.usLastToneEventIndex = 0; - - /* The version strings have not yet been copied. */ - pSharedInfo->DebugInfo.fImageVersionCopied = FALSE; - pSharedInfo->DebugInfo.fApiVersionCopied = FALSE; - - /* Estimate the total size of the buffer that will be returned. */ - f_pGetData->ulTotalNumBytes = ulUserBufWriteIndex; - - /* If the full content is requested, add all the debug data. */ - if ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - { - /* Add the matrix events. */ - if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S ) - || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) ) - { - /* Heavy mode! Grab everything! */ - f_pGetData->ulTotalNumBytes += pSharedInfo->DebugInfo.usNumEvents * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize; - } - else - { - /* Lite mode! Only the most important stuff. */ - f_pGetData->ulTotalNumBytes += pSharedInfo->DebugInfo.usNumEvents * pSharedInfo->DebugInfo.ulDebugChanLiteStatsByteSize; - } - - /* Add the PCM samples. */ - f_pGetData->ulTotalNumBytes += pSharedInfo->DebugInfo.usNumEvents * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize * 3; - - /* If requested, add the AF log events. */ - if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S ) - || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) ) - { - f_pGetData->ulTotalNumBytes += (UINT32)( ( pSharedInfo->DebugInfo.usAfLogWritePtr - pSharedInfo->DebugInfo.usLastAfLogReadPtr ) & 0xFFFF ) * 16; - } - - /* Add the tone events strings. */ - f_pGetData->ulTotalNumBytes += cOCT6100_TLV_MAX_TONE_NAME_SIZE * pSharedInfo->ImageInfo.byNumToneDetectors; - - /* Add the image version string. */ - f_pGetData->ulTotalNumBytes += 512; - - /* Add the API version string. */ - f_pGetData->ulTotalNumBytes += sizeof( cOCT6100_API_VERSION ); - } - else /* if ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) */ - { - /* Add one PCM stream. */ - f_pGetData->ulTotalNumBytes += pSharedInfo->DebugInfo.usNumEvents * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize; - } - - /* Save this in the instance for further calls. */ - pSharedInfo->DebugInfo.ulDebugDataTotalNumBytes = f_pGetData->ulTotalNumBytes; - - /* Calculate remaining bytes. All the bytes for now! */ - f_pGetData->ulRemainingNumBytes = f_pGetData->ulTotalNumBytes; - - /* Save this in the instance for the next calls. */ - pSharedInfo->DebugInfo.ulDebugDataRemainingNumBytes = f_pGetData->ulRemainingNumBytes; - } - else - { - f_pGetData->ulTotalNumBytes = pSharedInfo->DebugInfo.ulDebugDataTotalNumBytes; - } - - /* Calculate the event read pointer. */ - ulReadPointer = ( ( pSharedInfo->DebugInfo.usChipDebugEventWritePtr - pSharedInfo->DebugInfo.usNumEvents ) & pSharedInfo->DebugInfo.usMatrixCBMask ) * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize; - - ulReadPointer += pSharedInfo->DebugInfo.ulDebugChanStatsByteSize * pSharedInfo->DebugInfo.usLastDebugEventIndex; - ulReadPointer %= ( ( pSharedInfo->DebugInfo.usMatrixCBMask + 1 ) * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ); - - if ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - { - /* Copy the debug events in the user buffer. */ - for( ulDebugEventIndex = pSharedInfo->DebugInfo.usLastDebugEventIndex; ulDebugEventIndex < pSharedInfo->DebugInfo.usNumEvents; ulDebugEventIndex ++ ) - { - ReadBurstParams.ulReadAddress = pSharedInfo->DebugInfo.ulMatrixBaseAddress + ulReadPointer; - - /* Check if we are in light or heavy mode. The burst size is not the same. */ - if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S ) - || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) ) - { - if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) >= pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ) - ulNumReads = pSharedInfo->DebugInfo.ulDebugChanStatsByteSize / 2; - else - break; - } - else - { - if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) >= pSharedInfo->DebugInfo.ulDebugChanLiteStatsByteSize ) - ulNumReads = pSharedInfo->DebugInfo.ulDebugChanLiteStatsByteSize / 2; - else - break; - } - - ulTempIndex = 0; - while ( ulNumReads != 0 ) - { - if ( ulNumReads >= pSharedInfo->ChipConfig.usMaxRwAccesses ) - ReadBurstParams.ulReadLength = pSharedInfo->ChipConfig.usMaxRwAccesses; - else - ReadBurstParams.ulReadLength = ulNumReads; - - /* Set pointer where to write data. */ - ReadBurstParams.pusReadData = pSharedInfo->MiscVars.ausSuperArray; - - mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Copy data byte per byte to avoid endianess problems. */ - for ( ulCopyIndex = 0; ulCopyIndex < ReadBurstParams.ulReadLength; ulCopyIndex ++ ) - { - f_pGetData->pbyData[ ulUserBufWriteIndex + ulTempIndex + ( 2 * ulCopyIndex ) ] = (UINT8)( ReadBurstParams.pusReadData[ ulCopyIndex ] & 0xFF ); - f_pGetData->pbyData[ ulUserBufWriteIndex + ulTempIndex + ( 2 * ulCopyIndex ) + 1 ] = (UINT8)( ( ReadBurstParams.pusReadData[ ulCopyIndex ] >> 8 ) & 0xFF ); - } - - /* Update indexes, temp variables, addresses. */ - ulNumReads -= ReadBurstParams.ulReadLength; - ulTempIndex += ReadBurstParams.ulReadLength * 2; - ReadBurstParams.ulReadAddress += ReadBurstParams.ulReadLength * 2; - } - - /* Store register 0x202 in the event structure. */ - f_pGetData->pbyData[ ulUserBufWriteIndex + 255 ] = (UINT8)( pSharedInfo->IntrptManage.usRegister202h & 0xFF ); - f_pGetData->pbyData[ ulUserBufWriteIndex + 256 ] = (UINT8)( ( pSharedInfo->IntrptManage.usRegister202h >> 8 ) & 0xFF ); - - /* Increment index. */ - if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S ) - || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) ) - { - ulUserBufWriteIndex += pSharedInfo->DebugInfo.ulDebugChanStatsByteSize; - } - else - { - ulUserBufWriteIndex += pSharedInfo->DebugInfo.ulDebugChanLiteStatsByteSize; - } - - /* Increment read pointer to get next event. */ - ulReadPointer = ( ulReadPointer + pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ) % ( ( pSharedInfo->DebugInfo.usMatrixCBMask + 1 ) * pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ); - - /* Save in the instance that one of the events was dumped. */ - pSharedInfo->DebugInfo.usLastDebugEventIndex ++; - } - } - - /* Check if all debug events have been transfered. */ - if ( ( ulDebugEventIndex == pSharedInfo->DebugInfo.usNumEvents ) - || ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) ) - { - /* Fetch all streams per event. */ - for ( ulPcmSampleIndex = pSharedInfo->DebugInfo.ulLastPcmSampleIndex; ulPcmSampleIndex < ( (UINT32)pSharedInfo->DebugInfo.usNumEvents * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize ); ulPcmSampleIndex ++ ) - { - /* Check if enough room for this sample. */ - if ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - { - if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) < 1 ) - break; - } - else /* if ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) */ - { - if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) < 3 ) - break; - } - - /* Check if must retrieve data from external memory. */ - if ( ( ulPcmSampleIndex % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE * 2 ) ) == 0x0 ) - { - ulReadPointer = ( ( ( pSharedInfo->DebugInfo.usChipDebugEventWritePtr - pSharedInfo->DebugInfo.usNumEvents ) * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize ) & ( pSharedInfo->DebugInfo.usMatrixCBMask * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize ) ); - ulReadPointer += ( ulPcmSampleIndex / pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize ) * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize; - ulReadPointer &= ( pSharedInfo->DebugInfo.usMatrixCBMask * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize ); - ulReadPointer += ulPcmSampleIndex % pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize; - - /* Retrieve more data from external memory. */ - switch ( f_pGetData->ulGetDataContent ) - { - case cOCT6100_DEBUG_GET_DATA_CONTENT_RIN_PCM: - ulStreamIndexMin = 0; - ulStreamIndexMax = 1; - break; - case cOCT6100_DEBUG_GET_DATA_CONTENT_SIN_PCM: - ulStreamIndexMin = 1; - ulStreamIndexMax = 2; - break; - case cOCT6100_DEBUG_GET_DATA_CONTENT_SOUT_PCM: - ulStreamIndexMin = 2; - ulStreamIndexMax = 3; - break; - case cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE: - default: - ulStreamIndexMin = 0; - ulStreamIndexMax = 3; - break; - } - - for ( ulStreamIndex = ulStreamIndexMin; ulStreamIndex < ulStreamIndexMax; ulStreamIndex ++ ) - { - ReadBurstParams.ulReadAddress = pSharedInfo->MemoryMap.ulChanMainMemBase; - /* To get right channel information. */ - ReadBurstParams.ulReadAddress += ( ( pSharedInfo->DebugInfo.usRecordMemIndex + 2 ) * pSharedInfo->MemoryMap.ulChanMainMemSize ) + pSharedInfo->DebugInfo.ulAfEventCbByteSize; - /* To get correct stream. */ - ReadBurstParams.ulReadAddress += ( ( pSharedInfo->DebugInfo.usMatrixCBMask + 1 ) * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize * ulStreamIndex ); - /* PCM sample pointer in that stream. */ - ReadBurstParams.ulReadAddress += ulReadPointer; - - /* As much as we can for the burst. */ - ulTempIndex = 0; - ulNumReads = cOCT6100_INTERNAL_SUPER_ARRAY_SIZE; - while ( ulNumReads != 0 ) - { - if ( ulNumReads >= pSharedInfo->ChipConfig.usMaxRwAccesses ) - ReadBurstParams.ulReadLength = pSharedInfo->ChipConfig.usMaxRwAccesses; - else - ReadBurstParams.ulReadLength = ulNumReads; - - /* Set pointer where to write data. */ - if ( ulStreamIndex == 0 ) - ReadBurstParams.pusReadData = &pSharedInfo->MiscVars.ausSuperArray[ ulTempIndex ]; - else if ( ulStreamIndex == 1 ) - ReadBurstParams.pusReadData = &pSharedInfo->MiscVars.ausSuperArray1[ ulTempIndex ]; - else /* if ( ulStreamIndex == 2 ) */ - ReadBurstParams.pusReadData = &pSharedInfo->MiscVars.ausSuperArray2[ ulTempIndex ]; - - mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update indexes, temp variables, addresses. */ - ulNumReads -= ReadBurstParams.ulReadLength; - ulTempIndex += ReadBurstParams.ulReadLength; - ReadBurstParams.ulReadAddress += ReadBurstParams.ulReadLength * 2; - } - } - } - - /* We now have the stream data for all streams for 1 event. */ - /* Return what we can to the user. */ - if ( ( ulPcmSampleIndex % 2 ) == 0 ) - { - if ( ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - || ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_RIN_PCM ) ) - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 8 ) & 0xFF ); - - if ( ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - || ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_SIN_PCM ) ) - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray1[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 8 ) & 0xFF ); - - if ( ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - || ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_SOUT_PCM ) ) - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray2[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 8 ) & 0xFF ); - } - else /* if ( ulPcmSampleIndex % 2 == 1 ) */ - { - if ( ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - || ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_RIN_PCM ) ) - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 0 ) & 0xFF ); - - if ( ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - || ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_SIN_PCM ) ) - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray1[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 0 ) & 0xFF ); - - if ( ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - || ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_SOUT_PCM ) ) - f_pGetData->pbyData[ ulUserBufWriteIndex++ ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray2[ ( ulPcmSampleIndex / 2 ) % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE ) ] >> 0 ) & 0xFF ); - } - - pSharedInfo->DebugInfo.ulLastPcmSampleIndex++; - } - - /* Check if we are done dumping the PCM samples! */ - if ( pSharedInfo->DebugInfo.ulLastPcmSampleIndex == ( (UINT32)pSharedInfo->DebugInfo.usNumEvents * pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize ) ) - { - if ( f_pGetData->ulGetDataContent == cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) - { - - /* Go for the AF events. The AF events are only copied in heavy mode. */ - if ( ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_16S ) - || ( f_pGetData->ulGetDataMode == cOCT6100_DEBUG_GET_DATA_MODE_120S ) ) - { - while ( pSharedInfo->DebugInfo.usLastAfLogReadPtr != pSharedInfo->DebugInfo.usAfLogWritePtr ) - { - /* Check if enough room for an event. */ - if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) < 16 ) - break; - - /* Check if must fill our buffer. */ - if ( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 ) ) == 0x0 ) - { - ulNumAfEvents = ( pSharedInfo->DebugInfo.usAfLogWritePtr - pSharedInfo->DebugInfo.usLastAfLogReadPtr ) & 0xFFFF; - - /* Check for the size of the available buffer. */ - if ( ulNumAfEvents > ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 ) ) - ulNumAfEvents = ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 ); - - /* Start at channel main base address. */ - ReadBurstParams.ulReadAddress = pSharedInfo->MemoryMap.ulChanMainMemBase; - /* To get right channel information. */ - ReadBurstParams.ulReadAddress += ( ( pSharedInfo->DebugInfo.usRecordMemIndex + 2 ) * pSharedInfo->MemoryMap.ulChanMainMemSize ); - /* To get the right AF log. */ - ReadBurstParams.ulReadAddress += ( pSharedInfo->DebugInfo.usLastAfLogReadPtr * 16 ); - - ulTempIndex = 0; - ulNumReads = ulNumAfEvents * 8; - - while ( ulNumReads != 0 ) - { - if ( ulNumReads >= pSharedInfo->ChipConfig.usMaxRwAccesses ) - ReadBurstParams.ulReadLength = pSharedInfo->ChipConfig.usMaxRwAccesses; - else - ReadBurstParams.ulReadLength = ulNumReads; - - /* Set pointer where to write data. */ - ReadBurstParams.pusReadData = &pSharedInfo->MiscVars.ausSuperArray[ ulTempIndex ]; - - mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update indexes, temp variables, addresses. */ - ulNumReads -= ReadBurstParams.ulReadLength; - ulTempIndex += ReadBurstParams.ulReadLength; - ReadBurstParams.ulReadAddress += ReadBurstParams.ulReadLength * 2; - } - } - - /* Copy data byte per byte to avoid endianess problems. */ - for ( ulCopyIndex = 0; ulCopyIndex < 8; ulCopyIndex ++ ) - { - f_pGetData->pbyData[ ulUserBufWriteIndex + ( 2 * ulCopyIndex ) ] = (UINT8)( pSharedInfo->MiscVars.ausSuperArray[ ( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 ) ) * 8 ) + ulCopyIndex ] & 0xFF ); - f_pGetData->pbyData[ ulUserBufWriteIndex + ( 2 * ulCopyIndex ) + 1 ] = (UINT8)( ( pSharedInfo->MiscVars.ausSuperArray[ ( ( pSharedInfo->DebugInfo.usLastAfLogReadPtr % ( cOCT6100_INTERNAL_SUPER_ARRAY_SIZE / 8 ) ) * 8 ) + ulCopyIndex ] >> 8 ) & 0xFF ); - } - - ulUserBufWriteIndex += 16; - - /* Increment AF log read ptr. */ - pSharedInfo->DebugInfo.usLastAfLogReadPtr = (UINT16)(( pSharedInfo->DebugInfo.usLastAfLogReadPtr + 1 ) & 0xFFFF ); - } - } - - /* Check if we are done with the AF events. */ - if ( pSharedInfo->DebugInfo.usLastAfLogReadPtr == pSharedInfo->DebugInfo.usAfLogWritePtr ) - { - /* Insert the tone event information. */ - for ( ulToneEventIndex = pSharedInfo->DebugInfo.usLastToneEventIndex; ulToneEventIndex < pSharedInfo->ImageInfo.byNumToneDetectors; ulToneEventIndex++ ) - { - if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) < cOCT6100_TLV_MAX_TONE_NAME_SIZE ) - break; - - Oct6100UserMemCopy( &f_pGetData->pbyData[ ulUserBufWriteIndex ], pSharedInfo->ImageInfo.aToneInfo[ ulToneEventIndex ].aszToneName, cOCT6100_TLV_MAX_TONE_NAME_SIZE ); - - ulUserBufWriteIndex += cOCT6100_TLV_MAX_TONE_NAME_SIZE; - - pSharedInfo->DebugInfo.usLastToneEventIndex++; - } - - /* If all the tone information has been copied. */ - if ( ulToneEventIndex == pSharedInfo->ImageInfo.byNumToneDetectors ) - { - /* Copy the image version. */ - if ( pSharedInfo->DebugInfo.fImageVersionCopied == FALSE ) - { - if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) >= 512 ) - { - Oct6100UserMemCopy( &f_pGetData->pbyData[ ulUserBufWriteIndex ], pSharedInfo->ImageInfo.szVersionNumber, 512 ); - - /* Get PLL jitter count from external memory. */ - if ( pSharedInfo->DebugInfo.fPouchCounter == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.PouchCounterFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.PouchCounterFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.PouchCounterFieldOfst.byFieldSize; - - ulResult = Oct6100ApiReadDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - &ulTempData ); - - /* Create the mask to retrieve the appropriate value. */ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - /* Mask data. */ - ulTempData &= ulMask; - /* Move to right position. */ - ulTempData = ulTempData >> ulFeatureBitOffset; - - f_pGetData->pbyData[ ulUserBufWriteIndex + 510 ] = (UINT8)( ( ulTempData >> 8 ) & 0xFF ); - f_pGetData->pbyData[ ulUserBufWriteIndex + 511 ] = (UINT8)( ( ulTempData >> 0 ) & 0xFF ); - } - - /* Add "ISR is not called" bit. */ - if ( pSharedInfo->IntrptManage.fIsrCalled == FALSE ) - { - f_pGetData->pbyData[ ulUserBufWriteIndex + 510 ] |= 0x80; - } - - ulUserBufWriteIndex += 512; - - /* The version has been copied. */ - pSharedInfo->DebugInfo.fImageVersionCopied = TRUE; - } - } - - /* If the image version has been copied, proceed with the API version. */ - if ( pSharedInfo->DebugInfo.fImageVersionCopied == TRUE ) - { - if ( pSharedInfo->DebugInfo.fApiVersionCopied == FALSE ) - { - if ( ( f_pGetData->ulMaxBytes - ulUserBufWriteIndex ) >= sizeof(cOCT6100_API_VERSION) ) - { - Oct6100UserMemCopy( &f_pGetData->pbyData[ ulUserBufWriteIndex ], cOCT6100_API_VERSION, sizeof(cOCT6100_API_VERSION) ); - ulUserBufWriteIndex += sizeof(cOCT6100_API_VERSION); - - /* The API version has been copied. */ - pSharedInfo->DebugInfo.fApiVersionCopied = TRUE; - } - } - } - } - - /* Check if we are done! */ - if ( pSharedInfo->DebugInfo.fApiVersionCopied == TRUE ) - { - /* Done dumping. */ - - /* Reset data being dumpped flag. */ - pSharedInfo->DebugInfo.fDebugDataBeingDumped = FALSE; - - /* Reset data recording in the chip. */ - WriteBurstParams.ulWriteAddress = pSharedInfo->DebugInfo.ulHotChannelSelectBaseAddress; - WriteBurstParams.ulWriteLength = 2; - WriteBurstParams.pusWriteData = pSharedInfo->DebugInfo.ausHotChannelData; - - mOCT6100_DRIVER_WRITE_BURST_API( WriteBurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - fResetRemainingDataFlag = TRUE; - } - } - } - else /* if ( f_pGetData->ulGetDataContent != cOCT6100_DEBUG_GET_DATA_CONTENT_COMPLETE ) */ - { - fResetRemainingDataFlag = TRUE; - } - } - } - - /* Return number of valid bytes in buffer to user. */ - f_pGetData->ulValidNumBytes = ulUserBufWriteIndex; - - /* Update remaining bytes. */ - pSharedInfo->DebugInfo.ulDebugDataRemainingNumBytes -= ulUserBufWriteIndex; - - /* Return remaining bytes. */ - f_pGetData->ulRemainingNumBytes = pSharedInfo->DebugInfo.ulDebugDataRemainingNumBytes; - - /* Return total number of bytes. */ - f_pGetData->ulTotalNumBytes = pSharedInfo->DebugInfo.ulDebugDataTotalNumBytes; - - /* Check if we are done dump the requested content. */ - if ( fResetRemainingDataFlag == TRUE ) - pSharedInfo->DebugInfo.ulDebugDataTotalNumBytes = cOCT6100_INVALID_VALUE; - - return cOCT6100_ERR_OK; -} -#endif diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_events.c b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_events.c deleted file mode 100644 index 776c6d9..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_events.c +++ /dev/null @@ -1,1379 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_events.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains functions used to retrieve tone and playout events. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 81 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_channel_inst.h" -#include "oct6100api/oct6100_events_inst.h" -#include "oct6100api/oct6100_tone_detection_inst.h" -#include "oct6100api/oct6100_playout_buf_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_events_pub.h" -#include "oct6100api/oct6100_tone_detection_pub.h" -#include "oct6100api/oct6100_playout_buf_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_events_priv.h" -#include "oct6100_tone_detection_priv.h" -#include "oct6100_playout_buf_priv.h" - -/**************************** PUBLIC FUNCTIONS *****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100EventGetTone - -Description: Retreives an array of tone events. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pEventGetTone Pointer to structure used to store the Tone events. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100EventGetToneDef -UINT32 Oct6100EventGetToneDef( - tPOCT6100_EVENT_GET_TONE f_pEventGetTone ) -{ - f_pEventGetTone->pToneEvent = NULL; - f_pEventGetTone->ulMaxToneEvent = 1; - f_pEventGetTone->ulNumValidToneEvent = cOCT6100_INVALID_VALUE; - f_pEventGetTone->fMoreEvents = FALSE; - f_pEventGetTone->fResetBufs = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100EventGetTone -UINT32 Oct6100EventGetTone( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_EVENT_GET_TONE f_pEventGetTone ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100EventGetToneSer( f_pApiInstance, f_pEventGetTone ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutGetEvent - -Description: Retrieves an array of playout stop events. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pBufPlayoutGetEvent Pointer to structure used to store the playout events. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutGetEventDef -UINT32 Oct6100BufferPlayoutGetEventDef( - tPOCT6100_BUFFER_PLAYOUT_GET_EVENT f_pBufPlayoutGetEvent ) -{ - f_pBufPlayoutGetEvent->pBufferPlayoutEvent = NULL; - f_pBufPlayoutGetEvent->ulMaxEvent = 1; - f_pBufPlayoutGetEvent->ulNumValidEvent = cOCT6100_INVALID_VALUE; - f_pBufPlayoutGetEvent->fMoreEvents = FALSE; - f_pBufPlayoutGetEvent->fResetBufs = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100BufferPlayoutGetEvent -UINT32 Oct6100BufferPlayoutGetEvent( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_BUFFER_PLAYOUT_GET_EVENT f_pBufPlayoutGetEvent ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100BufferPlayoutGetEventSer( f_pApiInstance, f_pBufPlayoutGetEvent ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetEventsSwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management of the tone events and playout events - software buffers. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pOpenChip Pointer to chip configuration struct. -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetEventsSwSizes -UINT32 Oct6100ApiGetEventsSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - - { - UINT32 ulTempVar; - - /* Memory needed by soft tone event buffers. */ - - /* Add 1 to the circular buffer such that all user requested events can fit in the circular queue. */ - f_pInstSizes->ulSoftToneEventsBuffer = ( f_pOpenChip->ulSoftToneEventsBufSize + 1 ) * sizeof( tOCT6100_API_TONE_EVENT ); - - /* Round off the sizes of the soft buffers above. */ - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulSoftToneEventsBuffer, ulTempVar ) - } - - { - UINT32 ulTempVar; - - /* Memory needed by soft playout stop event buffers. */ - if ( f_pOpenChip->ulSoftBufferPlayoutEventsBufSize != cOCT6100_INVALID_VALUE ) - { - f_pInstSizes->ulSoftBufPlayoutEventsBuffer = ( f_pOpenChip->ulSoftBufferPlayoutEventsBufSize + 1 ) * sizeof( tOCT6100_API_BUFFER_PLAYOUT_EVENT ); - - /* Round off the sizes of the soft buffers above. */ - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulSoftBufPlayoutEventsBuffer, ulTempVar ) - } - else /* if ( f_pInstSizes->ulSoftBufferPlayoutEventsBufSize == cOCT6100_INVALID_VALUE ) */ - { - f_pInstSizes->ulSoftBufPlayoutEventsBuffer = 0; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100EventGetToneSer - -Description: Retreives an array of tone event from the software event buffer. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pEventGetTone Pointer to structure which will contain the retreived - events. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100EventGetToneSer -UINT32 Oct6100EventGetToneSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_EVENT_GET_TONE f_pEventGetTone ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_TONE_EVENT pSoftEvent; - UINT32 ulSoftReadPnt; - UINT32 ulSoftWritePnt; - UINT32 ulSoftBufSize; - UINT32 ulNumEventsReturned; - UINT32 ulResult; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check the parameters given by the user. */ - if ( f_pEventGetTone->fResetBufs != TRUE && - f_pEventGetTone->fResetBufs != FALSE ) - return cOCT6100_ERR_EVENTS_GET_TONE_RESET_BUFS; - - /* Check max tones. */ - if ( f_pEventGetTone->ulMaxToneEvent > pSharedInfo->ChipConfig.ulSoftToneEventsBufSize ) - return cOCT6100_ERR_EVENTS_MAX_TONES; - - if ( f_pEventGetTone->fResetBufs == FALSE ) - { - /* Check if the events need to be fetched from the chip buffer. */ - ulSoftReadPnt = pSharedInfo->SoftBufs.ulToneEventBufferReadPtr; - ulSoftWritePnt = pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; - - if ( ulSoftReadPnt == ulSoftWritePnt ) - { - ulResult = Oct6100ApiTransferToneEvents( f_pApiInstance, f_pEventGetTone->fResetBufs ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* If there are no events in the soft buffer then there are none in the chip */ - /* either, so return the empty case. Else, return the events in the buffer. */ - ulSoftReadPnt = pSharedInfo->SoftBufs.ulToneEventBufferReadPtr; - ulSoftWritePnt = pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; - ulSoftBufSize = pSharedInfo->SoftBufs.ulToneEventBufferSize; - - if ( ulSoftReadPnt != ulSoftWritePnt ) - { - ulNumEventsReturned = 0; - - while( (ulSoftReadPnt != ulSoftWritePnt) && ( ulNumEventsReturned != f_pEventGetTone->ulMaxToneEvent) ) - { - /* Get a pointer to the first event in the buffer. */ - mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += ulSoftReadPnt; - - f_pEventGetTone->pToneEvent[ ulNumEventsReturned ].ulChannelHndl = pSoftEvent->ulChannelHandle; - f_pEventGetTone->pToneEvent[ ulNumEventsReturned ].ulUserChanId = pSoftEvent->ulUserChanId; - f_pEventGetTone->pToneEvent[ ulNumEventsReturned ].ulTimestamp = pSoftEvent->ulTimestamp; - f_pEventGetTone->pToneEvent[ ulNumEventsReturned ].ulEventType = pSoftEvent->ulEventType; - f_pEventGetTone->pToneEvent[ ulNumEventsReturned ].ulToneDetected = pSoftEvent->ulToneDetected; - f_pEventGetTone->pToneEvent[ ulNumEventsReturned ].ulExtToneDetectionPort = pSoftEvent->ulExtToneDetectionPort; - - /* Update the pointers of the soft buffer. */ - ulSoftReadPnt++; - if ( ulSoftReadPnt == ulSoftBufSize ) - ulSoftReadPnt = 0; - - ulNumEventsReturned++; - } - - pSharedInfo->SoftBufs.ulToneEventBufferReadPtr = ulSoftReadPnt; - - /* Detemine if there are more events pending in the soft buffer. */ - if ( ulSoftReadPnt != ulSoftWritePnt ) - f_pEventGetTone->fMoreEvents = TRUE; - else /* ( ulSoftReadPnt == ulSoftWritePnt ) */ - { - f_pEventGetTone->fMoreEvents = FALSE; - - /* Remember this state in the interrupt manager. */ - pSharedInfo->IntrptManage.fToneEventsPending = FALSE; - } - - f_pEventGetTone->ulNumValidToneEvent = ulNumEventsReturned; - } - else - { - /* No valid tone.*/ - f_pEventGetTone->ulNumValidToneEvent = 0; - f_pEventGetTone->fMoreEvents = FALSE; - - /* Remember this state in the interrupt manager. */ - pSharedInfo->IntrptManage.fToneEventsPending = FALSE; - - return cOCT6100_ERR_EVENTS_TONE_BUF_EMPTY; - } - } - else /* ( f_pEventGetTone->fResetBufs == TRUE ) */ - { - /* Empty the hardware buffer. */ - ulResult = Oct6100ApiTransferToneEvents( f_pApiInstance, f_pEventGetTone->fResetBufs ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* If the buffers are to be reset then update the pointers and full flag. */ - pSharedInfo->SoftBufs.ulToneEventBufferReadPtr = 0; - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; - - f_pEventGetTone->fMoreEvents = FALSE; - f_pEventGetTone->ulNumValidToneEvent = 0; - - /* Remember this state in the interrupt manager. */ - pSharedInfo->IntrptManage.fToneEventsPending = FALSE; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiTransferToneEvents - -Description: Transfers all tone events from the PGSP event out chip buffer - to the soft buffer. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulResetBuf Reset flag. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiTransferToneEvents -UINT32 Oct6100ApiTransferToneEvents( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulResetBuf ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_TONE_EVENT pSoftEvent; - tPOCT6100_API_CHANNEL pEchoChannel; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_READ_BURST_PARAMS BurstParams; - UINT32 ulChipBufFill; - UINT32 ulChipWritePtr = 0; - UINT32 ulChipReadPtr = 0; - - UINT32 usChannelIndex; - UINT32 ulBaseTimestamp; - UINT32 ulToneCnt; - UINT32 ulNumWordsToRead; - UINT32 ulEventCode; - - UINT32 ulResult; - UINT32 i, j; - UINT16 usReadData; - UINT16 ausReadData[ cOCT6100_NUM_WORDS_PER_TONE_EVENT ]; - - UINT32 ulExtToneDetectionPort; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* If the buffer is to be reset then clear the overflow flag. */ - if ( f_ulResetBuf == TRUE ) - { - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt = 0; - } - - /* Set some parameters of read struct. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* Get the current read pointer of the chip buffer. */ - ReadParams.ulReadAddress = cOCT6100_TONE_EVENT_READ_PTR_REG; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulChipReadPtr = usReadData; - - /* Now get the current write pointer. */ - ReadParams.ulReadAddress = cOCT6100_TONE_EVENT_WRITE_PTR_REG; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulChipWritePtr = usReadData; - - ulChipBufFill = (( ulChipWritePtr - ulChipReadPtr ) & ( cOCT6100_NUM_PGSP_EVENT_OUT - 1 )); - - /* Set some parameters of write structs. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - BurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - BurstParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Read in the tone event one at a time. */ - for ( i = 0; i < ulChipBufFill; i++ ) - { - /* Skip the event processing if the buffer is to be reset. */ - if ( f_ulResetBuf == TRUE ) - { - /* Update the control variables of the buffer. */ - ulChipReadPtr++; - if ( cOCT6100_NUM_PGSP_EVENT_OUT == ulChipReadPtr ) - ulChipReadPtr = 0; - } - else - { - /* Read in the event only if there's enough room in the soft buffer, and */ - /* the chip buffer is NOT to be reset. */ - if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && - ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) - { - BurstParams.ulReadAddress = cOCT6100_PGSP_EVENT_OUT_BASE + ( ulChipReadPtr * cOCT6100_PGSP_TONE_EVENT_SIZE ); - BurstParams.pusReadData = ausReadData; - - ulNumWordsToRead = cOCT6100_PGSP_TONE_EVENT_SIZE / 2; - - while ( ulNumWordsToRead > 0 ) - { - if ( ulNumWordsToRead > pSharedInfo->ChipConfig.usMaxRwAccesses ) - { - BurstParams.ulReadLength = pSharedInfo->ChipConfig.usMaxRwAccesses; - } - else - { - BurstParams.ulReadLength = ulNumWordsToRead; - } - - mOCT6100_DRIVER_READ_BURST_API( BurstParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - BurstParams.pusReadData += BurstParams.ulReadLength; - BurstParams.ulReadAddress += BurstParams.ulReadLength * 2; - - ulNumWordsToRead -= BurstParams.ulReadLength; - } - - /* Verify if the event is valid. */ - if ( ( ausReadData[ 0 ] & cOCT6100_VALID_TONE_EVENT ) == 0x0 ) - return cOCT6100_ERR_FATAL_2D; - - /* First extract the channel number of the tone event. */ - usChannelIndex = ausReadData[ 1 ] & 0x3FF; - - /* Now the timestamp. */ - ulBaseTimestamp = ausReadData[ 2 ] << 16; - ulBaseTimestamp |= ausReadData[ 3 ]; - - /* This timestamp is 256 in adwance, must remove 256 frames. */ - ulBaseTimestamp -= 256; - - /* Fetch the channel stucture to validate which event can be reported. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChannel, usChannelIndex ); - - if ( pEchoChannel->fReserved != TRUE ) - { - /* Update the control variables of the buffer. */ - ulChipReadPtr++; - if ( ulChipReadPtr == cOCT6100_NUM_PGSP_EVENT_OUT ) - ulChipReadPtr = 0; - - /* This channel has been closed since the generation of the event. */ - continue; - } - - /* Extract the extended tone detection port if available. */ - if ( pEchoChannel->ulExtToneChanMode == cOCT6100_API_EXT_TONE_SIN_PORT_MODE ) - { - ulExtToneDetectionPort = cOCT6100_CHANNEL_PORT_SIN; - } - else if ( pEchoChannel->ulExtToneChanMode == cOCT6100_API_EXT_TONE_RIN_PORT_MODE ) - { - ulExtToneDetectionPort = cOCT6100_CHANNEL_PORT_RIN; - - /* Modify the channel index. */ - usChannelIndex = pEchoChannel->usExtToneChanIndex; - - /* Change the channel entry to the original one for statistical purposes. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChannel, usChannelIndex ); - - } - else /* pEchoChannel->ulExtToneChanMode == cOCT6100_API_EXT_TONE_DISABLED */ - { - ulExtToneDetectionPort = cOCT6100_INVALID_VALUE; - } - - ulToneCnt = 0; - /* Verify all the possible events that might have been detected. */ - for ( j = 4; j < cOCT6100_NUM_WORDS_PER_TONE_EVENT; j++ ) - { - ulEventCode = ( ausReadData[ j ] >> 8 ) & 0x7; - - if ( ulEventCode != 0x0 ) - { - /* This tone generated an event, now check if event is masked for the channel. */ - if ((( pEchoChannel->aulToneConf[ ulToneCnt / 32 ] >> ( 31 - ( ulToneCnt % 32 ))) & 0x1) == 1 ) - { - BOOL f2100Tone; - - /* Check if it is a 2100 Tone STOP and if the user wants receive those events*/ - ulResult = Oct6100ApiIs2100Tone(f_pApiInstance, - pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID, - &f2100Tone); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( (f2100Tone == FALSE) || - ( (f2100Tone == TRUE) && (ulEventCode != 2) ) || - ( (f2100Tone == TRUE) && pSharedInfo->ChipConfig.fEnable2100StopEvent == TRUE ) ) - { - - /* If enough space. */ - if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && - ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) - { - /* The tone event is not masked, The API can create a soft tone event. */ - mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; - - /* Decode the event type. */ - switch( ulEventCode ) - { - case 1: - pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; - break; - case 2: - pSoftEvent->ulEventType = cOCT6100_TONE_STOP; - break; - case 3: - /* This one is a little tricky. We first */ - /* generate the "PRESENT" event and then generate the "STOP" event. */ - - pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; - pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | usChannelIndex; - pSoftEvent->ulUserChanId = pEchoChannel->ulUserChanId; - pSoftEvent->ulToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; - /* We want the timestamp not to be equal to the "STOP" event, so we subtract one to the detector's value. */ - pSoftEvent->ulTimestamp = ( ulBaseTimestamp + ((( ausReadData[ j ] >> 13 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ) ) - 1; - pSoftEvent->ulExtToneDetectionPort = ulExtToneDetectionPort; - - /* Update the control variables of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr++; - if ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr == pSharedInfo->SoftBufs.ulToneEventBufferSize ) - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; - - /* If enough space for the "STOP" event. */ - if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && - ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) - { - mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; - - pSoftEvent->ulEventType = cOCT6100_TONE_STOP; - } - else - { - /* Set the overflow flag of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; - - /* We continue in the loop in order to empty the hardware buffer. */ - continue; - } - - break; - case 4: - pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; - break; - default: - pSharedInfo->ErrorStats.ulToneDetectorErrorCnt++; - /* do not process this packet*/ - continue; - } - - pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | usChannelIndex; - pSoftEvent->ulUserChanId = pEchoChannel->ulUserChanId; - pSoftEvent->ulToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; - pSoftEvent->ulTimestamp = ulBaseTimestamp + ((( ausReadData[ j ] >> 13 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ); - pSoftEvent->ulExtToneDetectionPort = ulExtToneDetectionPort; - - /* Update the control variables of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr++; - if ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr == pSharedInfo->SoftBufs.ulToneEventBufferSize ) - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; - - /* Set the interrupt manager such that the user knows that some tone events */ - /* are pending in the software Q. */ - pSharedInfo->IntrptManage.fToneEventsPending = TRUE; - } - else - { - /* Set the overflow flag of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; - - /* We continue in the loop in order to empty the hardware buffer. */ - } - } - } - else - { - BOOL fSSTone; - - ulResult = Oct6100ApiIsSSTone( - f_pApiInstance, - pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID, - &fSSTone ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( fSSTone == TRUE ) - { - /* Check if this is a "PRESENT" or "STOP" event */ - switch( ulEventCode ) - { - case 1: - /* This is a signaling system present event. Keep this in the instance memory. */ - pEchoChannel->ulLastSSToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; - pEchoChannel->ulLastSSToneTimestamp = ulBaseTimestamp + ((( ausReadData[ j ] >> 13 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ); - break; - case 2: - /* This is the "STOP" event, invalidate the last value. The user does not want to know about this. */ - pEchoChannel->ulLastSSToneDetected = (PTR_TYPE)cOCT6100_INVALID_VALUE; - pEchoChannel->ulLastSSToneTimestamp = (PTR_TYPE)cOCT6100_INVALID_VALUE; - break; - default: - break; - } - } - } - } - ulToneCnt++; - - /* Check the other tone of this word. */ - ulEventCode = ausReadData[ j ] & 0x7; - - if ( ulEventCode != 0x0 ) - { - if ((( pEchoChannel->aulToneConf[ ulToneCnt / 32 ] >> ( 31 - ( ulToneCnt % 32 ))) & 0x1) == 1 ) - { - BOOL f2100Tone; - - /* Check if it is a 2100 Tone STOP and if the user wants receive those events*/ - ulResult = Oct6100ApiIs2100Tone(f_pApiInstance, - pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID, - &f2100Tone); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( (f2100Tone == FALSE) || - ( (f2100Tone == TRUE) && (ulEventCode != 2) ) || - ( (f2100Tone == TRUE) && pSharedInfo->ChipConfig.fEnable2100StopEvent == TRUE ) ) - { - - /* If enough space. */ - if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && - ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) - { - /* The tone event is not masked, The API can create a soft tone event. */ - mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; - - /* Decode the event type. */ - switch( ulEventCode ) - { - case 1: - pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; - break; - case 2: - pSoftEvent->ulEventType = cOCT6100_TONE_STOP; - break; - case 3: - /* This one is a little tricky. We first */ - /* generate the "PRESENT" event and then generate the "STOP" event. */ - - pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; - pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | usChannelIndex; - pSoftEvent->ulUserChanId = pEchoChannel->ulUserChanId; - pSoftEvent->ulToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; - /* We want the timestamp not to be equal to the "STOP" event, so we subtract one to the detector's value. */ - pSoftEvent->ulTimestamp = ( ulBaseTimestamp + ((( ausReadData[ j ] >> 5 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ) ) - 1; - pSoftEvent->ulExtToneDetectionPort = ulExtToneDetectionPort; - - /* Update the control variables of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr++; - if ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr == pSharedInfo->SoftBufs.ulToneEventBufferSize ) - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; - - /* If enough space for the "STOP" event. */ - if ( ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr) && - ((pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0) ) - { - mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; - - pSoftEvent->ulEventType = cOCT6100_TONE_STOP; - } - else - { - /* Set the overflow flag of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; - - /* We continue in the loop in order to empty the hardware buffer. */ - continue; - } - - break; - case 4: - pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; - break; - default: - pSharedInfo->ErrorStats.ulToneDetectorErrorCnt++; - /* Do not process this packet. */ - continue; - } - - pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | usChannelIndex; - pSoftEvent->ulUserChanId = pEchoChannel->ulUserChanId; - pSoftEvent->ulToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; - pSoftEvent->ulTimestamp = ulBaseTimestamp + ((( ausReadData[ j ] >> 5 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ); - pSoftEvent->ulExtToneDetectionPort = ulExtToneDetectionPort; - - /* Update the control variables of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr++; - if ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr == pSharedInfo->SoftBufs.ulToneEventBufferSize ) - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; - - /* Set the interrupt manager such that the user knows that some tone events */ - /* are pending in the software Q. */ - pSharedInfo->IntrptManage.fToneEventsPending = TRUE; - - } - else - { - /* Set the overflow flag of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; - - /* We continue in the loop in order to empty the hardware buffer. */ - } - } - } - else - { - BOOL fSSTone; - - ulResult = Oct6100ApiIsSSTone( - f_pApiInstance, - pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID, - &fSSTone ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( fSSTone == TRUE ) - { - /* Check if this is a "PRESENT" event. */ - switch ( ulEventCode ) - { - case 1: - /* This is a signaling system present event. Keep this in the instance memory. */ - pEchoChannel->ulLastSSToneDetected = pSharedInfo->ImageInfo.aToneInfo[ ulToneCnt ].ulToneID; - pEchoChannel->ulLastSSToneTimestamp = ulBaseTimestamp + ((( ausReadData[ j ] >> 5 ) & 0x7) * cOCT6100_LOCAL_TIMESTAMP_INCREMENT ); - break; - case 2: - /* This is the "STOP" event, invalidate the last value. The user does not want to know about this. */ - pEchoChannel->ulLastSSToneDetected = (PTR_TYPE)cOCT6100_INVALID_VALUE; - pEchoChannel->ulLastSSToneTimestamp = (PTR_TYPE)cOCT6100_INVALID_VALUE; - break; - default: - break; - } - } - } - } - ulToneCnt++; - } - } - else - { - /* Set the overflow flag of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; - - /* We continue in the loop in order to empty the hardware buffer. */ - } - - /* Update the control variables of the buffer. */ - ulChipReadPtr++; - if ( ulChipReadPtr == cOCT6100_NUM_PGSP_EVENT_OUT ) - ulChipReadPtr = 0; - } - } - - /* Write the value of the new Read pointer.*/ - WriteParams.ulWriteAddress = cOCT6100_TONE_EVENT_READ_PTR_REG; - WriteParams.usWriteData = (UINT16)( ulChipReadPtr ); - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - - - return cOCT6100_ERR_OK; -} -#endif - - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutGetEventSer - -Description: Retreives an array of buffer playout event from the software - event buffer. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pEventGetPlayoutStop Pointer to structure which will contain the retreived - events. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutGetEventSer -UINT32 Oct6100BufferPlayoutGetEventSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_GET_EVENT f_pBufPlayoutGetEvent ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BUFFER_PLAYOUT_EVENT pSoftEvent; - UINT32 ulSoftReadPnt; - UINT32 ulSoftWritePnt; - UINT32 ulSoftBufSize; - UINT32 ulNumEventsReturned; - UINT32 ulResult; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check the parameters past by the user. */ - if ( f_pBufPlayoutGetEvent->fResetBufs != TRUE && - f_pBufPlayoutGetEvent->fResetBufs != FALSE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_EVENT_RESET; - - /* Check if software buffer has been allocated and thus enabled. */ - if ( pSharedInfo->ChipConfig.ulSoftBufPlayoutEventsBufSize == 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_EVENT_DISABLED; - - /* Checking max playout events. */ - if ( f_pBufPlayoutGetEvent->ulMaxEvent > pSharedInfo->ChipConfig.ulSoftBufPlayoutEventsBufSize ) - return cOCT6100_ERR_BUFFER_PLAYOUT_MAX_EVENT; - - if ( f_pBufPlayoutGetEvent->fResetBufs == FALSE ) - { - /* Check if events need to be fetched from the chip. */ - ulSoftReadPnt = pSharedInfo->SoftBufs.ulBufPlayoutEventBufferReadPtr; - ulSoftWritePnt = pSharedInfo->SoftBufs.ulBufPlayoutEventBufferWritePtr; - - if ( ulSoftReadPnt == ulSoftWritePnt ) - { - ulResult = Oct6100BufferPlayoutTransferEvents( f_pApiInstance, f_pBufPlayoutGetEvent->fResetBufs ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* If there are no events in the soft buffer then there are none in the chip */ - /* either, so return the empty case. Else, return the events in the buffer. */ - ulSoftReadPnt = pSharedInfo->SoftBufs.ulBufPlayoutEventBufferReadPtr; - ulSoftWritePnt = pSharedInfo->SoftBufs.ulBufPlayoutEventBufferWritePtr; - ulSoftBufSize = pSharedInfo->SoftBufs.ulBufPlayoutEventBufferSize; - - if ( ulSoftReadPnt != ulSoftWritePnt ) - { - ulNumEventsReturned = 0; - - while( (ulSoftReadPnt != ulSoftWritePnt) && ( ulNumEventsReturned != f_pBufPlayoutGetEvent->ulMaxEvent) ) - { - /* Get a pointer to the first event in the buffer. */ - mOCT6100_GET_BUFFER_PLAYOUT_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += ulSoftReadPnt; - - f_pBufPlayoutGetEvent->pBufferPlayoutEvent[ ulNumEventsReturned ].ulChannelHndl = pSoftEvent->ulChannelHandle; - f_pBufPlayoutGetEvent->pBufferPlayoutEvent[ ulNumEventsReturned ].ulUserChanId = pSoftEvent->ulUserChanId; - f_pBufPlayoutGetEvent->pBufferPlayoutEvent[ ulNumEventsReturned ].ulChannelPort = pSoftEvent->ulChannelPort; - f_pBufPlayoutGetEvent->pBufferPlayoutEvent[ ulNumEventsReturned ].ulUserEventId = pSoftEvent->ulUserEventId; - f_pBufPlayoutGetEvent->pBufferPlayoutEvent[ ulNumEventsReturned ].ulEventType = pSoftEvent->ulEventType; - f_pBufPlayoutGetEvent->pBufferPlayoutEvent[ ulNumEventsReturned ].ulTimestamp = pSoftEvent->ulTimestamp; - - /* Update the pointers of the soft buffer. */ - ulSoftReadPnt++; - if ( ulSoftReadPnt == ulSoftBufSize ) - ulSoftReadPnt = 0; - - ulNumEventsReturned++; - } - - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferReadPtr = ulSoftReadPnt; - - /* Detemine if there are more events pending in the soft buffer. */ - if ( ulSoftReadPnt != ulSoftWritePnt ) - f_pBufPlayoutGetEvent->fMoreEvents = TRUE; - else /* ( ulSoftReadPnt == ulSoftWritePnt ) */ - { - f_pBufPlayoutGetEvent->fMoreEvents = FALSE; - - /* Remember this state in the interrupt manager. */ - pSharedInfo->IntrptManage.fBufferPlayoutEventsPending = FALSE; - } - - f_pBufPlayoutGetEvent->ulNumValidEvent = ulNumEventsReturned; - } - else /* if ( ulSoftReadPnt == ulSoftWritePnt ) */ - { - /* No valid buffer playout events. */ - f_pBufPlayoutGetEvent->ulNumValidEvent = 0; - f_pBufPlayoutGetEvent->fMoreEvents = FALSE; - - /* Remember this state in the interrupt manager. */ - pSharedInfo->IntrptManage.fBufferPlayoutEventsPending = FALSE; - - return cOCT6100_ERR_BUFFER_PLAYOUT_EVENT_BUF_EMPTY; - } - } - else /* ( f_pEventGetPlayoutStop->fResetBufs == TRUE ) */ - { - /* Check with the hardware first. */ - ulResult = Oct6100BufferPlayoutTransferEvents( f_pApiInstance, f_pBufPlayoutGetEvent->fResetBufs ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* If the buffers are to be reset, then update the pointers and full flag. */ - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferReadPtr = 0; - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferWritePtr = 0; - - f_pBufPlayoutGetEvent->fMoreEvents = FALSE; - f_pBufPlayoutGetEvent->ulNumValidEvent = 0; - - /* Remember this state in the interrupt manager. */ - pSharedInfo->IntrptManage.fBufferPlayoutEventsPending = FALSE; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutTransferEvents - -Description: Check all channels that are currently playing a buffer and - generate an event if a buffer has stopped playing. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulResetBuf Reset flag. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutTransferEvents -UINT32 Oct6100BufferPlayoutTransferEvents( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulResetBuf ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pEchoChannel; - - UINT32 ulChannelIndex; - UINT32 ulResult; - UINT32 ulLastBufPlayoutEventBufferOverflowCnt; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* If the buffer is to be reset then clear the overflow flag. */ - if ( f_ulResetBuf == TRUE ) - { - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferOverflowCnt = 0; - /* We are done for now. */ - /* No need to check for new events since the user requested to empty the soft buffer. */ - return cOCT6100_ERR_OK; - } - - /* Check if buffer playout has been activated on some ports. */ - if ( pSharedInfo->ChipStats.usNumberActiveBufPlayoutPorts == 0 ) - { - /* Buffer playout has not been activated on any channel, */ - /* let's not waste time here. */ - return cOCT6100_ERR_OK; - } - - /* Save the current overflow count. We want to know if an overflow occured to get out of the loop. */ - ulLastBufPlayoutEventBufferOverflowCnt = pSharedInfo->SoftBufs.ulBufPlayoutEventBufferOverflowCnt; - - /* Search through the list of API channel entry for the ones that need playout event checking. */ - for ( ulChannelIndex = 0; ulChannelIndex < pSharedInfo->ChipConfig.usMaxChannels; ulChannelIndex++ ) - { - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChannel, ulChannelIndex ); - - /* Check if buffer playout is active on this channel, using the optimization flag. */ - /* This flag is redundant of other flags used for playout, but will make the above loop */ - /* much faster. This is needed since this function is called very frequently on systems */ - /* which use buffer playout stop events. */ - if ( pEchoChannel->fBufPlayoutActive == TRUE ) - { - /* Read in the event only if there's enough room in the soft buffer. */ - if ( ulLastBufPlayoutEventBufferOverflowCnt == pSharedInfo->SoftBufs.ulBufPlayoutEventBufferOverflowCnt ) - { - /* Check Rout buffer playout first. */ - if ( ( pEchoChannel->fRinBufPlayoutNotifyOnStop == TRUE ) - && ( pEchoChannel->fRinBufPlaying == TRUE ) ) - { - ulResult = Oct6100BufferPlayoutCheckForSpecificEvent( f_pApiInstance, ulChannelIndex, cOCT6100_CHANNEL_PORT_ROUT, TRUE, NULL ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else /* if ( ulLastBufPlayoutEventBufferOverflowCnt != pSharedInfo->SoftBufs.ulBufPlayoutEventBufferOverflowCnt ) */ - { - /* Get out of the loop, no more events can be inserted in the soft buffer. */ - break; - } - - /* An overflow might have been detected in the lower level function. */ - /* Check the overflow count once again to make sure there might be room for a next event. */ - if ( ulLastBufPlayoutEventBufferOverflowCnt == pSharedInfo->SoftBufs.ulBufPlayoutEventBufferOverflowCnt ) - { - /* Check Sout buffer playout. */ - if ( ( pEchoChannel->fSoutBufPlayoutNotifyOnStop == TRUE ) - && ( pEchoChannel->fSoutBufPlaying == TRUE ) ) - { - ulResult = Oct6100BufferPlayoutCheckForSpecificEvent( f_pApiInstance, ulChannelIndex, cOCT6100_CHANNEL_PORT_SOUT, TRUE, NULL ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - else /* if ( ulLastBufPlayoutEventBufferOverflowCnt != pSharedInfo->SoftBufs.ulBufPlayoutEventBufferOverflowCnt ) */ - { - /* Get out of the loop, no more events can be inserted in the soft buffer. */ - break; - } - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutCheckForSpecificEvent - -Description: Check a specific channel/port for playout buffer events. - If asked to, save this event to the software event buffer. - Return a flag specifying whether the event was detected or not. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulChannelIndex Index of the channel to be checked. -f_ulChannelPort Port of the channel to be checked. -f_fSaveToSoftBuffer Save event to software buffer. -f_pfEventDetected Whether or not an event was detected. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutCheckForSpecificEvent -UINT32 Oct6100BufferPlayoutCheckForSpecificEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulChannelPort, - IN BOOL f_fSaveToSoftBuffer, - OUT PBOOL f_pfEventDetected ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BUFFER_PLAYOUT_EVENT pSoftEvent; - tPOCT6100_API_CHANNEL pEchoChannel; - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_GET_TIME GetTimeParms; - - UINT32 ulResult; - UINT16 usReadData; - UINT32 ulReadPtrBytesOfst; - UINT32 ulReadPtrBitOfst; - UINT32 ulReadPtrFieldSize; - - UINT32 ulWritePtrBytesOfst; - UINT32 ulWritePtrBitOfst; - UINT32 ulWritePtrFieldSize; - - UINT32 ulPlayoutBaseAddress; - UINT32 ulTempData; - UINT32 ulReadPtr; - UINT32 ulMask; - UINT32 ulWritePtr; - UINT32 ulUserEventId; - UINT32 ulEventType; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Compare the read and write pointers for matching. If they matched, playout stopped. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChannel, f_ulChannelIndex ); - - /* Set the playout feature base address. */ - ulPlayoutBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_ulChannelIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst; - - if ( f_ulChannelPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - /* Check on the Rout port. */ - ulUserEventId = pEchoChannel->ulRinUserBufPlayoutEventId; - ulEventType = pEchoChannel->byRinPlayoutStopEventType; - - ulWritePtrBytesOfst = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.usDwordOffset * 4; - ulWritePtrBitOfst = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.byBitOffset; - ulWritePtrFieldSize = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.byFieldSize; - - ulReadPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.usDwordOffset * 4; - ulReadPtrBitOfst = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.byBitOffset; - ulReadPtrFieldSize = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.byFieldSize; - } - else /* if ( f_ulChannelPort == cOCT6100_CHANNEL_PORT_SOUT ) */ - { - /* Check on the Sout port. */ - ulUserEventId = pEchoChannel->ulSoutUserBufPlayoutEventId; - ulEventType = pEchoChannel->bySoutPlayoutStopEventType; - - ulWritePtrBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.usDwordOffset * 4; - ulWritePtrBitOfst = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.byBitOffset; - ulWritePtrFieldSize = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.byFieldSize; - - ulReadPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.usDwordOffset * 4; - ulReadPtrBitOfst = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.byBitOffset; - ulReadPtrFieldSize = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.byFieldSize; - } - - /* Retrieve the current write pointer. */ - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pEchoChannel, - ulPlayoutBaseAddress + ulWritePtrBytesOfst, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulWritePtrFieldSize, ulWritePtrBitOfst, &ulMask ); - - /* Store the write pointer.*/ - ulWritePtr = ( ulTempData & ulMask ) >> ulWritePtrBitOfst; - - /* Read the read pointer.*/ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - ReadParams.ulReadAddress = ulPlayoutBaseAddress + ulReadPtrBytesOfst; - - /* Optimize this access by only reading the word we are interested in. */ - if ( ulReadPtrBitOfst < 16 ) - ReadParams.ulReadAddress += 2; - - /* Must read in memory directly since this value is changed by hardware */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move data at correct position according to what was read. */ - if ( ulReadPtrBitOfst < 16 ) - ulTempData = usReadData; - else - ulTempData = usReadData << 16; - - mOCT6100_CREATE_FEATURE_MASK( ulReadPtrFieldSize, ulReadPtrBitOfst, &ulMask ); - - /* Store the read pointer. */ - ulReadPtr = ( ulTempData & ulMask ) >> ulReadPtrBitOfst; - - /* Playout has finished when the read pointer reaches the write pointer. */ - if ( ulReadPtr != ulWritePtr ) - { - /* Still playing -- do not generate an event. */ - if ( f_pfEventDetected != NULL ) - *f_pfEventDetected = FALSE; - } - else - { - /* Buffer stopped playing, generate an event here, if asked. */ - if ( ( f_fSaveToSoftBuffer == TRUE ) - && ( ( pSharedInfo->SoftBufs.ulBufPlayoutEventBufferWritePtr + 1 ) != pSharedInfo->SoftBufs.ulBufPlayoutEventBufferReadPtr ) - && ( ( pSharedInfo->SoftBufs.ulBufPlayoutEventBufferWritePtr + 1 ) != pSharedInfo->SoftBufs.ulBufPlayoutEventBufferSize || pSharedInfo->SoftBufs.ulBufPlayoutEventBufferReadPtr != 0 ) ) - { - /* The API can create a soft buffer playout event. */ - mOCT6100_GET_BUFFER_PLAYOUT_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += pSharedInfo->SoftBufs.ulBufPlayoutEventBufferWritePtr; - - pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChannel->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_ulChannelIndex; - pSoftEvent->ulUserChanId = pEchoChannel->ulUserChanId; - pSoftEvent->ulUserEventId = ulUserEventId; - pSoftEvent->ulChannelPort = f_ulChannelPort; - /* For now, only this type of event is available. */ - pSoftEvent->ulEventType = ulEventType; - - /* Generate millisecond timestamp. */ - GetTimeParms.pProcessContext = f_pApiInstance->pProcessContext; - ulResult = Oct6100UserGetTime( &GetTimeParms ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - pSoftEvent->ulTimestamp = ( GetTimeParms.aulWallTimeUs[ 0 ] / 1000 ); - pSoftEvent->ulTimestamp += ( GetTimeParms.aulWallTimeUs[ 1 ] ) * ( 0xFFFFFFFF / 1000 ); - - /* Update the control variables of the buffer. */ - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferWritePtr++; - if ( pSharedInfo->SoftBufs.ulBufPlayoutEventBufferWritePtr == pSharedInfo->SoftBufs.ulBufPlayoutEventBufferSize ) - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferWritePtr = 0; - - /* Set the interrupt manager such that the user knows that some playout events */ - /* are pending in the software Q. */ - pSharedInfo->IntrptManage.fBufferPlayoutEventsPending = TRUE; - } - else if ( f_fSaveToSoftBuffer == TRUE ) - { - /* Set the overflow flag of the buffer. */ - pSharedInfo->SoftBufs.ulBufPlayoutEventBufferOverflowCnt++; - } - - /* Update the channel entry to set the playing flag to FALSE. */ - - /* Select the port of interest. */ - if ( f_ulChannelPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - /* Decrement the number of active buffer playout ports. */ - /* No need to check anything here, it's been done in the calling function. */ - pSharedInfo->ChipStats.usNumberActiveBufPlayoutPorts--; - - pEchoChannel->fRinBufPlaying = FALSE; - pEchoChannel->fRinBufPlayoutNotifyOnStop = FALSE; - - /* Clear optimization flag if possible. */ - if ( ( pEchoChannel->fSoutBufPlaying == FALSE ) - && ( pEchoChannel->fSoutBufPlayoutNotifyOnStop == FALSE ) ) - { - /* Buffer playout is no more active on this channel. */ - pEchoChannel->fBufPlayoutActive = FALSE; - } - } - else /* f_ulChannelPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - /* Decrement the number of active buffer playout ports. */ - /* No need to check anything here, it's been done in the calling function. */ - pSharedInfo->ChipStats.usNumberActiveBufPlayoutPorts--; - - pEchoChannel->fSoutBufPlaying = FALSE; - pEchoChannel->fSoutBufPlayoutNotifyOnStop = FALSE; - - /* Clear optimization flag if possible. */ - if ( ( pEchoChannel->fRinBufPlaying == FALSE ) - && ( pEchoChannel->fRinBufPlayoutNotifyOnStop == FALSE ) ) - { - /* Buffer playout is no more active on this channel. */ - pEchoChannel->fBufPlayoutActive = FALSE; - } - } - - /* Return that an event was detected. */ - if ( f_pfEventDetected != NULL ) - *f_pfEventDetected = TRUE; - } - - return cOCT6100_ERR_OK; -} -#endif - - diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c deleted file mode 100644 index 58a7194..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_interrupts.c +++ /dev/null @@ -1,2012 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_interrupts.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains the API's interrupt service routine and all of its - sub-functions. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 81 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_events_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_channel_inst.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_events_priv.h" -#include "oct6100_interrupts_priv.h" - -/**************************** PUBLIC FUNCTIONS *****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100InterruptConfigure - -Description: Configure the operation of all possible interrupt sources. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pIntrptConfig Pointer to interrupt configuration structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100InterruptConfigureDef -UINT32 Oct6100InterruptConfigureDef( - tPOCT6100_INTERRUPT_CONFIGURE f_pIntrptConfig ) -{ - f_pIntrptConfig->ulFatalGeneralConfig = cOCT6100_INTERRUPT_NO_TIMEOUT; - f_pIntrptConfig->ulFatalMemoryConfig = cOCT6100_INTERRUPT_NO_TIMEOUT; - - f_pIntrptConfig->ulErrorMemoryConfig = cOCT6100_INTERRUPT_NO_TIMEOUT; - f_pIntrptConfig->ulErrorOverflowToneEventsConfig = cOCT6100_INTERRUPT_NO_TIMEOUT; - f_pIntrptConfig->ulErrorH100Config = cOCT6100_INTERRUPT_NO_TIMEOUT; - - f_pIntrptConfig->ulFatalMemoryTimeout = 100; - - f_pIntrptConfig->ulErrorMemoryTimeout = 100; - f_pIntrptConfig->ulErrorOverflowToneEventsTimeout = 100; - f_pIntrptConfig->ulErrorH100Timeout = 100; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100InterruptConfigure -UINT32 Oct6100InterruptConfigure( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_INTERRUPT_CONFIGURE f_pIntrptConfig ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulResult; - UINT32 ulFncRes; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Create serialization object for ISR. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulResult = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Call serialized sub-function. */ - ulFncRes = Oct6100InterruptConfigureSer( f_pApiInstance, f_pIntrptConfig, TRUE ); - /* Release serialization object. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulResult = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if an error occured in sub-function. */ - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100InterruptServiceRoutine - -Description: The API's interrupt service routine. This function clears all - register ROLs which have generated an interrupt and report the - events in the user supplied structure. Also, the tone event - and/or playout event buffer will be emptied if valid events - are present. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pIntFlags Pointer to structure containing event flags returned - to user. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100InterruptServiceRoutineDef -UINT32 Oct6100InterruptServiceRoutineDef( - tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ) -{ - f_pIntFlags->fFatalGeneral = FALSE; - f_pIntFlags->ulFatalGeneralFlags = 0x0; - f_pIntFlags->fFatalReadTimeout = FALSE; - - f_pIntFlags->fErrorRefreshTooLate = FALSE; - f_pIntFlags->fErrorPllJitter = FALSE; - - f_pIntFlags->fErrorOverflowToneEvents = FALSE; - - f_pIntFlags->fErrorH100OutOfSync = FALSE; - f_pIntFlags->fErrorH100ClkA = FALSE; - f_pIntFlags->fErrorH100ClkB = FALSE; - f_pIntFlags->fErrorH100FrameA = FALSE; - - f_pIntFlags->fToneEventsPending = FALSE; - f_pIntFlags->fBufferPlayoutEventsPending = FALSE; - - f_pIntFlags->fApiSynch = FALSE; - - - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100InterruptServiceRoutine -UINT32 Oct6100InterruptServiceRoutine( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulResult; - UINT32 ulFncRes; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize the serialization object for the ISR. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulResult = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Call the serialized sub-function. */ - ulFncRes = Oct6100InterruptServiceRoutineSer( f_pApiInstance, f_pIntFlags ); - } - else - { - return ulResult; - } - - /* Release the serialization object. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulResult = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check for an error in the sub-function. */ - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiIsrSwInit - -Description: Initializes portions of API instance associated to the API's - interrupt service routine. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiIsrSwInit -UINT32 Oct6100ApiIsrSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Set the state of each interrupt group to disabled. The state will */ - /* be updated to the true configuration once the configure interrupts function is called. */ - pSharedInfo->IntrptManage.byFatalGeneralState = cOCT6100_INTRPT_DISABLED; - pSharedInfo->IntrptManage.byFatalMemoryState = cOCT6100_INTRPT_DISABLED; - pSharedInfo->IntrptManage.byErrorMemoryState = cOCT6100_INTRPT_DISABLED; - pSharedInfo->IntrptManage.byErrorH100State = cOCT6100_INTRPT_DISABLED; - pSharedInfo->IntrptManage.byErrorOverflowToneEventsState = cOCT6100_INTRPT_DISABLED; - - /* Indicate that the mclk interrupt is not active at the moment. */ - pSharedInfo->IntrptManage.fMclkIntrptActive = FALSE; - - /* Indicate that no buffer playout events are pending for the moment. */ - pSharedInfo->IntrptManage.fBufferPlayoutEventsPending = FALSE; - - /* Indicate that no tone events are pending for the moment. */ - pSharedInfo->IntrptManage.fToneEventsPending = FALSE; - - /* The ISR has never been called. */ - pSharedInfo->IntrptManage.fIsrCalled = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiIsrHwInit - -Description: Initializes the chip's interrupt registers. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pIntrptConfig Pointer to structure defining how the interrupts - should be configured. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiIsrHwInit -UINT32 Oct6100ApiIsrHwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_INTERRUPT_CONFIGURE f_pIntrptConfig ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Set some parameters of write struct. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /*==================================================================================*/ - /* Enable all the interrupts */ - - WriteParams.ulWriteAddress = 0x104; - WriteParams.usWriteData = 0x0001; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x204; - WriteParams.usWriteData = 0x1C05; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x304; - WriteParams.usWriteData = 0xFFFF; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x504; - WriteParams.usWriteData = 0x0002; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x704; - WriteParams.usWriteData = 0x0007; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==================================================================================*/ - - /* Calculate the number of mclk cycles in 1 ms. */ - f_pApiInstance->pSharedInfo->IntrptManage.ulNumMclkCyclesIn1Ms = f_pApiInstance->pSharedInfo->MiscVars.ulMclkFreq / 1000; - - /* Configure the interrupt registers as requested by the user. */ - ulResult = Oct6100InterruptConfigureSer( f_pApiInstance, f_pIntrptConfig, TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100InterruptConfigureSer - -Description: Configure the operation of interrupt groups. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pIntrptConfig Pointer to interrupt configuration structure. -f_fCheckParams Check parameter enable flag. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100InterruptConfigureSer -UINT32 Oct6100InterruptConfigureSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_INTERRUPT_CONFIGURE f_pIntrptConfig, - IN BOOL f_fCheckParams ) -{ - tPOCT6100_API_INTRPT_CONFIG pIntrptConfig; - tPOCT6100_API_INTRPT_MANAGE pIntrptManage; - UINT32 ulResult; - - /* Check for errors. */ - if ( f_fCheckParams == TRUE ) - { - if ( f_pIntrptConfig->ulFatalGeneralConfig != cOCT6100_INTERRUPT_DISABLE && - f_pIntrptConfig->ulFatalGeneralConfig != cOCT6100_INTERRUPT_NO_TIMEOUT ) - return cOCT6100_ERR_INTRPTS_FATAL_GENERAL_CONFIG; - if ( f_pIntrptConfig->ulFatalMemoryConfig != cOCT6100_INTERRUPT_DISABLE && - f_pIntrptConfig->ulFatalMemoryConfig != cOCT6100_INTERRUPT_TIMEOUT && - f_pIntrptConfig->ulFatalMemoryConfig != cOCT6100_INTERRUPT_NO_TIMEOUT ) - return cOCT6100_ERR_INTRPTS_FATAL_MEMORY_CONFIG; - if ( f_pIntrptConfig->ulErrorMemoryConfig != cOCT6100_INTERRUPT_DISABLE && - f_pIntrptConfig->ulErrorMemoryConfig != cOCT6100_INTERRUPT_TIMEOUT && - f_pIntrptConfig->ulErrorMemoryConfig != cOCT6100_INTERRUPT_NO_TIMEOUT ) - return cOCT6100_ERR_INTRPTS_DATA_ERR_MEMORY_CONFIG; - if ( f_pIntrptConfig->ulErrorOverflowToneEventsConfig != cOCT6100_INTERRUPT_DISABLE && - f_pIntrptConfig->ulErrorOverflowToneEventsConfig != cOCT6100_INTERRUPT_TIMEOUT && - f_pIntrptConfig->ulErrorOverflowToneEventsConfig != cOCT6100_INTERRUPT_NO_TIMEOUT ) - return cOCT6100_ERR_INTRPTS_OVERFLOW_TONE_EVENTS_CONFIG; - if ( f_pIntrptConfig->ulErrorH100Config != cOCT6100_INTERRUPT_DISABLE && - f_pIntrptConfig->ulErrorH100Config != cOCT6100_INTERRUPT_TIMEOUT && - f_pIntrptConfig->ulErrorH100Config != cOCT6100_INTERRUPT_NO_TIMEOUT ) - return cOCT6100_ERR_INTRPTS_H100_ERROR_CONFIG; - - if ( f_pIntrptConfig->ulFatalMemoryTimeout < 10 || - f_pIntrptConfig->ulFatalMemoryTimeout > 10000 ) - return cOCT6100_ERR_INTRPTS_FATAL_MEMORY_TIMEOUT; - if ( f_pIntrptConfig->ulErrorMemoryTimeout < 10 || - f_pIntrptConfig->ulErrorMemoryTimeout > 10000 ) - return cOCT6100_ERR_INTRPTS_DATA_ERR_MEMORY_TIMEOUT; - if ( f_pIntrptConfig->ulErrorOverflowToneEventsTimeout < 10 || - f_pIntrptConfig->ulErrorOverflowToneEventsTimeout > 10000 ) - return cOCT6100_ERR_INTRPTS_OVERFLOW_TONE_EVENTS_TIMEOUT; - if ( f_pIntrptConfig->ulErrorH100Timeout < 10 || - f_pIntrptConfig->ulErrorH100Timeout > 10000 ) - return cOCT6100_ERR_INTRPTS_H100_ERROR_TIMEOUT; - } - - /* Copy the configuration to the API instance. */ - pIntrptConfig = &f_pApiInstance->pSharedInfo->IntrptConfig; - pIntrptManage = &f_pApiInstance->pSharedInfo->IntrptManage; - - pIntrptConfig->byFatalGeneralConfig = (UINT8)( f_pIntrptConfig->ulFatalGeneralConfig & 0xFF ); - pIntrptConfig->byFatalMemoryConfig = (UINT8)( f_pIntrptConfig->ulFatalMemoryConfig & 0xFF ); - pIntrptConfig->byErrorMemoryConfig = (UINT8)( f_pIntrptConfig->ulErrorMemoryConfig & 0xFF ); - pIntrptConfig->byErrorOverflowToneEventsConfig = (UINT8)( f_pIntrptConfig->ulErrorOverflowToneEventsConfig & 0xFF ); - pIntrptConfig->byErrorH100Config = (UINT8)( f_pIntrptConfig->ulErrorH100Config & 0xFF ); - - f_pIntrptConfig->ulFatalMemoryTimeout = ((f_pIntrptConfig->ulFatalMemoryTimeout + 9) / 10) * 10; - pIntrptConfig->ulFatalMemoryTimeoutMclk = f_pIntrptConfig->ulFatalMemoryTimeout * pIntrptManage->ulNumMclkCyclesIn1Ms; - - f_pIntrptConfig->ulErrorMemoryTimeout = ((f_pIntrptConfig->ulErrorMemoryTimeout + 9) / 10) * 10; - pIntrptConfig->ulErrorMemoryTimeoutMclk = f_pIntrptConfig->ulErrorMemoryTimeout * pIntrptManage->ulNumMclkCyclesIn1Ms; - - f_pIntrptConfig->ulErrorOverflowToneEventsTimeout = ((f_pIntrptConfig->ulErrorOverflowToneEventsTimeout + 9) / 10) * 10; - pIntrptConfig->ulErrorOverflowToneEventsTimeoutMclk = f_pIntrptConfig->ulErrorOverflowToneEventsTimeout * pIntrptManage->ulNumMclkCyclesIn1Ms; - - f_pIntrptConfig->ulErrorH100Timeout = ((f_pIntrptConfig->ulErrorH100Timeout + 9) / 10) * 10; - pIntrptConfig->ulErrorH100TimeoutMclk = f_pIntrptConfig->ulErrorH100Timeout * pIntrptManage->ulNumMclkCyclesIn1Ms; - - - /*Clear all interrupts that were already enabled*/ - ulResult = Oct6100ApiClearEnabledInterrupts( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Before writing the new configuration to the chip's registers, make sure that any */ - /* interrupts which are either disabled or have no timeout period are not on the */ - /* disabled interrupt list. */ - - /*==================================================================================*/ - if ( pIntrptConfig->byFatalGeneralConfig == cOCT6100_INTERRUPT_DISABLE ) - pIntrptManage->byFatalGeneralState = cOCT6100_INTRPT_DISABLED; - else /* pIntrptConfig->byFatalGeneralConfig == cOCT6100_INTERRUPT_NO_TIMEOUT */ - pIntrptManage->byFatalGeneralState = cOCT6100_INTRPT_ACTIVE; - - /*==================================================================================*/ - if ( pIntrptConfig->byFatalMemoryConfig == cOCT6100_INTERRUPT_DISABLE ) - pIntrptManage->byFatalMemoryState = cOCT6100_INTRPT_DISABLED; - else if ( pIntrptConfig->byFatalMemoryConfig == cOCT6100_INTERRUPT_NO_TIMEOUT ) - pIntrptManage->byFatalMemoryState = cOCT6100_INTRPT_ACTIVE; - else /* ( pIntrptConfig->byFatalMemoryConfig == cOCT6100_INTERRUPT_TIMEOUT ) */ - { - if ( pIntrptManage->byFatalMemoryState == cOCT6100_INTRPT_DISABLED ) - pIntrptManage->byFatalMemoryState = cOCT6100_INTRPT_ACTIVE; - } - - /*==================================================================================*/ - if ( pIntrptConfig->byErrorMemoryConfig == cOCT6100_INTERRUPT_DISABLE ) - pIntrptManage->byErrorMemoryState = cOCT6100_INTRPT_DISABLED; - else if ( pIntrptConfig->byErrorMemoryConfig == cOCT6100_INTERRUPT_NO_TIMEOUT ) - pIntrptManage->byErrorMemoryState = cOCT6100_INTRPT_ACTIVE; - else /* (pIntrptConfig->byErrorMemoryConfig == cOCT6100_INTERRUPT_TIMEOUT ) */ - { - if ( pIntrptManage->byErrorMemoryState == cOCT6100_INTRPT_DISABLED ) - pIntrptManage->byErrorMemoryState = cOCT6100_INTRPT_ACTIVE; - } - - /*==================================================================================*/ - if ( pIntrptConfig->byErrorOverflowToneEventsConfig == cOCT6100_INTERRUPT_DISABLE ) - pIntrptManage->byErrorOverflowToneEventsState = cOCT6100_INTRPT_DISABLED; - else if ( pIntrptConfig->byErrorOverflowToneEventsConfig == cOCT6100_INTERRUPT_NO_TIMEOUT ) - pIntrptManage->byErrorOverflowToneEventsState = cOCT6100_INTRPT_ACTIVE; - else /* (pIntrptConfig->byErrorOverflowToneEventsConfig == cOCT6100_INTERRUPT_TIMEOUT ) */ - { - if ( pIntrptManage->byErrorOverflowToneEventsState == cOCT6100_INTRPT_DISABLED ) - pIntrptManage->byErrorOverflowToneEventsState = cOCT6100_INTRPT_ACTIVE; - } - - /*==================================================================================*/ - if ( pIntrptConfig->byErrorH100Config == cOCT6100_INTERRUPT_DISABLE ) - pIntrptManage->byErrorH100State = cOCT6100_INTRPT_DISABLED; - else if ( pIntrptConfig->byErrorH100Config == cOCT6100_INTERRUPT_NO_TIMEOUT ) - pIntrptManage->byErrorH100State = cOCT6100_INTRPT_ACTIVE; - else /* (pIntrptConfig->byErrorH100Config == cOCT6100_INTERRUPT_TIMEOUT ) */ - { - if ( pIntrptManage->byErrorH100State == cOCT6100_INTRPT_DISABLED ) - pIntrptManage->byErrorH100State = cOCT6100_INTRPT_ACTIVE; - } - - - /* Write to the interrupt registers to update the state of each interrupt group. */ - ulResult = Oct6100ApiWriteIeRegs( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiClearEnabledInterrupts - -Description: Disabled interruption are not reported but still available. This - function will clear the interrupts that were disabled and wish - to enable now. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pIntrptConfig Pointer to interrupt configuration structure. -f_pIntrptManage Pointer to interrupt manager structure. -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#if !SKIP_Oct6100ApiClearEnabledInterrupts -UINT32 Oct6100ApiClearEnabledInterrupts( - IN tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - tPOCT6100_API_INTRPT_CONFIG pIntrptConfig; - tPOCT6100_API_INTRPT_MANAGE pIntrptManage; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Set the process context and user chip ID parameters once and for all. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Copy the configuration to the API instance. */ - pIntrptConfig = &f_pApiInstance->pSharedInfo->IntrptConfig; - pIntrptManage = &f_pApiInstance->pSharedInfo->IntrptManage; - - if ( pIntrptConfig->byFatalGeneralConfig != cOCT6100_INTERRUPT_DISABLE && - pIntrptManage->byFatalGeneralState != cOCT6100_INTRPT_DISABLED ) - { - WriteParams.ulWriteAddress = 0x102; - WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_102H; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x202; - WriteParams.usWriteData = 0x1800; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x502; - WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_502H; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - if ( pIntrptConfig->byErrorMemoryConfig != cOCT6100_INTERRUPT_DISABLE && - pIntrptManage->byErrorMemoryState != cOCT6100_INTRPT_DISABLED ) - { - WriteParams.ulWriteAddress = 0x202; - WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_202H; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - if ( pIntrptConfig->byErrorH100Config != cOCT6100_INTERRUPT_DISABLE && - pIntrptManage->byErrorH100State != cOCT6100_INTRPT_DISABLED ) - { - WriteParams.ulWriteAddress = 0x302; - WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_302H; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - if ( pIntrptConfig->byErrorOverflowToneEventsConfig != cOCT6100_INTERRUPT_DISABLE && - pIntrptManage->byErrorOverflowToneEventsState != cOCT6100_INTRPT_DISABLED ) - { - WriteParams.ulWriteAddress = 0x702; - WriteParams.usWriteData = cOCT6100_INTRPT_MASK_REG_702H; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - - return cOCT6100_ERR_OK; - -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100InterruptServiceRoutineSer - -Description: Serialized sub-function of API's interrupt service routine. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pIntFlags Pointer to structure containing event flags returned - to user. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100InterruptServiceRoutineSer -UINT32 Oct6100InterruptServiceRoutineSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulRegister210h; - UINT32 ulResult; - UINT16 usReadData; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Must update the statistics. Set parameters in read and write structs. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* Set all the flags to default values to make sure the variables are initialized. */ - f_pIntFlags->fFatalGeneral = FALSE; - f_pIntFlags->ulFatalGeneralFlags = 0x0; - f_pIntFlags->fFatalReadTimeout = FALSE; - - f_pIntFlags->fErrorRefreshTooLate = FALSE; - f_pIntFlags->fErrorPllJitter = FALSE; - - f_pIntFlags->fErrorH100OutOfSync = FALSE; - f_pIntFlags->fErrorH100ClkA = FALSE; - f_pIntFlags->fErrorH100ClkB = FALSE; - f_pIntFlags->fErrorH100FrameA = FALSE; - f_pIntFlags->fApiSynch = FALSE; - - f_pIntFlags->fErrorOverflowToneEvents = FALSE; - - /* Start by reading registers 210h to determine if any modules have flagged an interrupt. */ - ReadParams.ulReadAddress = 0x210; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - ulRegister210h = usReadData; - - /* Update the extended mclk counter. */ - ulResult = Oct6100ApiReadChipMclkTime( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* If the mclk interrupt is active then check which interrupt timeout periods have expired. */ - ReadParams.ulReadAddress = 0x302; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - if ( (usReadData & 0x1) != 0 && pSharedInfo->IntrptManage.fMclkIntrptActive == TRUE ) - { - /* Update timeout periods. */ - ulResult = Oct6100ApiUpdateIntrptTimeouts( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - f_pIntFlags->fApiSynch = TRUE; - - /* Read registers 210h and 212h again to determine if any modules have flagged an interrupt. */ - ReadParams.ulReadAddress = 0x210; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - ulRegister210h = usReadData; - } - - /* Read the interrupt registers to determine what interrupt conditions have occured. */ - ulResult = Oct6100ApiReadIntrptRegs( f_pApiInstance, f_pIntFlags, ulRegister210h ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Empty the tone buffer if any events are pending. */ - ulResult = Oct6100ApiTransferToneEvents( f_pApiInstance, FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the tone events pending flag. */ - f_pIntFlags->fToneEventsPending = pSharedInfo->IntrptManage.fToneEventsPending; - - /* Check for buffer playout events and insert in the software queue -- if activated. */ - if ( pSharedInfo->ChipConfig.ulSoftBufPlayoutEventsBufSize != 0 ) - { - ulResult = Oct6100BufferPlayoutTransferEvents( f_pApiInstance, FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the buffer playout events pending flag. */ - f_pIntFlags->fBufferPlayoutEventsPending = pSharedInfo->IntrptManage.fBufferPlayoutEventsPending; - } - else - { - f_pIntFlags->fBufferPlayoutEventsPending = FALSE; - } - - /* Update the states of each interrupt group. */ - ulResult = Oct6100ApiUpdateIntrptStates( f_pApiInstance, f_pIntFlags ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check the state of the NLP timestamp if required.*/ - ulResult = Oct6100ApiCheckProcessorState( f_pApiInstance, f_pIntFlags ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write to the necessary IE registers. */ - ulResult = Oct6100ApiWriteIntrptRegs( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Schedule the next mclk interrupt, if one is needed. */ - ulResult = Oct6100ApiScheduleNextMclkIntrptSer( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Free the interrupt pin of the chip (i.e. remove minimum time requirement between interrupts). */ - WriteParams.ulWriteAddress = 0x214; - WriteParams.usWriteData = 0x0000; - if ( pSharedInfo->ChipConfig.byInterruptPolarity == cOCT6100_ACTIVE_HIGH_POLARITY ) - WriteParams.usWriteData |= 0x4000; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Indicate that the interrupt ROLs have been treated. */ - WriteParams.ulWriteAddress = 0x212; - WriteParams.usWriteData = 0x8000; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReadIntrptRegs - -Description: Reads the interrupt registers of all modules currently - indicating an interrupt condition. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pIntFlags Pointer to an interrupt flag structure. -f_ulRegister210h Value of register 0x210. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReadIntrptRegs -UINT32 Oct6100ApiReadIntrptRegs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT tPOCT6100_INTERRUPT_FLAGS f_pIntFlags, - IN UINT32 f_ulRegister210h ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHIP_ERROR_STATS pErrorStats; - tPOCT6100_API_INTRPT_MANAGE pIntrptManage; - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_WRITE_PARAMS WriteParams; - - UINT32 ulResult; - UINT16 usReadData; - UINT32 ulFeatureBytesOffset; - UINT32 ulFeatureBitOffset; - UINT32 ulFeatureFieldLength; - UINT32 ulTempData; - UINT32 ulCounterValue; - UINT32 ulMask; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - pErrorStats = &pSharedInfo->ErrorStats; - pIntrptManage = &pSharedInfo->IntrptManage; - - /* Set some parameters of read struct. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* Set some parameters of write struct. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - - - /* CPU registers. */ - if ( (f_ulRegister210h & 0x00001) != 0 ) - { - /*=======================================================================*/ - /* Read registers of this module. */ - ReadParams.ulReadAddress = 0x102; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check which interrupt(s) were set. */ - if ( (usReadData & 0x0001) != 0 ) - { - f_pIntFlags->fFatalReadTimeout = TRUE; - pErrorStats->ulInternalReadTimeoutCnt++; - } - - pIntrptManage->usRegister102h = usReadData; - /*=======================================================================*/ - } - else - { - pIntrptManage->usRegister102h = 0x0; - } - - /* MAIN registers. */ - if ( (f_ulRegister210h & 0x00002) != 0 ) - { - /*=======================================================================*/ - /* Read registers of this module. */ - ReadParams.ulReadAddress = 0x202; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save current value in instance. */ - pIntrptManage->usRegister202h = usReadData; - - /* Check which interrupts were set. */ - if ( (usReadData & 0x0001) != 0 ) - { - f_pIntFlags->fErrorRefreshTooLate = TRUE; - pErrorStats->ulSdramRefreshTooLateCnt++; - } - if ( (usReadData & 0x0800) != 0 ) - { - f_pIntFlags->ulFatalGeneralFlags |= cOCT6100_FATAL_GENERAL_ERROR_TYPE_1; - f_pIntFlags->fFatalGeneral = TRUE; - pErrorStats->fFatalChipError = TRUE; - } - if ( (usReadData & 0x1000) != 0 ) - { - f_pIntFlags->ulFatalGeneralFlags |= cOCT6100_FATAL_GENERAL_ERROR_TYPE_2; - f_pIntFlags->fFatalGeneral = TRUE; - pErrorStats->fFatalChipError = TRUE; - } - if ( (usReadData & 0x0400) != 0 ) - { - f_pIntFlags->fErrorPllJitter = TRUE; - pErrorStats->ulPllJitterErrorCnt++; - - /* Update the PLL jitter error count here. */ - if ( pSharedInfo->DebugInfo.fPouchCounter == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.PouchCounterFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.PouchCounterFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.PouchCounterFieldOfst.byFieldSize; - - ulResult = Oct6100ApiReadDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - &ulTempData ); - - /* Read previous value set in the feature field. */ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - /* Update counter. */ - ulCounterValue = ulTempData & ulMask; - ulCounterValue = ulCounterValue >> ulFeatureBitOffset; - ulCounterValue ++; - /* Handle wrap around case. */ - ulCounterValue &= ( 1 << ulFeatureFieldLength ) - 1; - - /* Clear old counter value. */ - ulTempData &= (~ulMask); - ulTempData |= ulCounterValue << ulFeatureBitOffset; - - /* Write the DWORD where the field is located.*/ - ulResult = Oct6100ApiWriteDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - ulTempData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /*=======================================================================*/ - } - else - { - pIntrptManage->usRegister202h = 0x0; - } - - /* H.100 registers. */ - if ( (f_ulRegister210h & 0x00004) != 0 ) - { - /*=======================================================================*/ - /* Read registers of this module. */ - ReadParams.ulReadAddress = 0x302; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check which interrupts were set. */ - if ( (usReadData & 0x0100) != 0 ) - { - f_pIntFlags->fErrorH100OutOfSync = TRUE; - pErrorStats->ulH100OutOfSyncCnt++; - } - if ( (usReadData & 0x1000) != 0 ) - { - f_pIntFlags->fErrorH100FrameA = TRUE; - pErrorStats->ulH100FrameABadCnt++; - } - if ( (usReadData & 0x4000) != 0 ) - { - f_pIntFlags->fErrorH100ClkA = TRUE; - pErrorStats->ulH100ClkABadCnt++; - } - if ( (usReadData & 0x8000) != 0 ) - { - if ( f_pApiInstance->pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - { - f_pIntFlags->fErrorH100ClkB = TRUE; - pErrorStats->ulH100ClkBBadCnt++; - } - } - - pIntrptManage->usRegister302h = usReadData; - /*=======================================================================*/ - } - else - { - pIntrptManage->usRegister302h = 0x0; - } - - /* TDMIE registers. */ - if ( (f_ulRegister210h & 0x00010) != 0 ) - { - /*=======================================================================*/ - /* Read register. */ - ReadParams.ulReadAddress = 0x502; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check which interrupts were set. */ - if ( (usReadData & 0x0002) != 0 ) - { - f_pIntFlags->ulFatalGeneralFlags |= cOCT6100_FATAL_GENERAL_ERROR_TYPE_3; - f_pIntFlags->fFatalGeneral = TRUE; - pErrorStats->fFatalChipError = TRUE; - } - - pIntrptManage->usRegister502h = usReadData; - /*=======================================================================*/ - } - else - { - pIntrptManage->usRegister502h = 0x0; - } - - /* PGSP registers. */ - if ( (f_ulRegister210h & 0x00080) != 0 ) - { - /*=======================================================================*/ - /* Read register. */ - ReadParams.ulReadAddress = 0x702; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check which interrupts were set. */ - if ( (usReadData & 0x0002) != 0 ) - { - f_pIntFlags->fErrorOverflowToneEvents = TRUE; - pErrorStats->ulOverflowToneEventsCnt++; - } - - pIntrptManage->usRegister702h = usReadData; - /*=======================================================================*/ - } - else - { - pIntrptManage->usRegister702h = 0x0; - } - - - - /* If this is the first time the ISR is called, clear the ISR is not called bit */ - /* in external memory to signal the remote client that we are called. */ - if ( pSharedInfo->IntrptManage.fIsrCalled == FALSE ) - { - /* Remember that we are being called. */ - pSharedInfo->IntrptManage.fIsrCalled = TRUE; - - if ( pSharedInfo->DebugInfo.fIsIsrCalledField == TRUE ) - { - ulFeatureBytesOffset = pSharedInfo->MemoryMap.IsIsrCalledFieldOfst.usDwordOffset * 4; - ulFeatureBitOffset = pSharedInfo->MemoryMap.IsIsrCalledFieldOfst.byBitOffset; - ulFeatureFieldLength = pSharedInfo->MemoryMap.IsIsrCalledFieldOfst.byFieldSize; - - ulResult = Oct6100ApiReadDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - &ulTempData ); - - /* Read previous value set in the feature field. */ - mOCT6100_CREATE_FEATURE_MASK( ulFeatureFieldLength, ulFeatureBitOffset, &ulMask ); - - /* Clear the field. */ - ulTempData &= (~ulMask); - - /* Write the DWORD where the field is located.*/ - ulResult = Oct6100ApiWriteDword( f_pApiInstance, - cOCT6100_POUCH_BASE + ulFeatureBytesOffset, - ulTempData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateIntrptStates - -Description: Updates the state of all interrupt register groups. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pIntFlags Interrupt flags. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateIntrptStates -UINT32 Oct6100ApiUpdateIntrptStates( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ) -{ - tPOCT6100_API_INTRPT_CONFIG pIntrptConfig; - tPOCT6100_API_INTRPT_MANAGE pIntrptManage; - - pIntrptConfig = &f_pApiInstance->pSharedInfo->IntrptConfig; - pIntrptManage = &f_pApiInstance->pSharedInfo->IntrptManage; - - /*-----------------------------------------------------------------------*/ - if ( ( f_pIntFlags->fFatalReadTimeout == TRUE) && - pIntrptConfig->byFatalMemoryConfig == cOCT6100_INTERRUPT_TIMEOUT && - pIntrptManage->byFatalMemoryState == cOCT6100_INTRPT_ACTIVE ) - { - pIntrptManage->byFatalMemoryState = cOCT6100_INTRPT_WILL_TIMEOUT; - pIntrptManage->ulFatalMemoryDisableMclkHigh = pIntrptManage->ulRegMclkTimeHigh; - pIntrptManage->ulFatalMemoryDisableMclkLow = pIntrptManage->ulRegMclkTimeLow; - } - /*-----------------------------------------------------------------------*/ - if ( (f_pIntFlags->fErrorRefreshTooLate == TRUE || - f_pIntFlags->fErrorPllJitter == TRUE ) && - pIntrptConfig->byErrorMemoryConfig == cOCT6100_INTERRUPT_TIMEOUT && - pIntrptManage->byErrorMemoryState == cOCT6100_INTRPT_ACTIVE ) - { - pIntrptManage->byErrorMemoryState = cOCT6100_INTRPT_WILL_TIMEOUT; - pIntrptManage->ulErrorMemoryDisableMclkHigh = pIntrptManage->ulRegMclkTimeHigh; - pIntrptManage->ulErrorMemoryDisableMclkLow = pIntrptManage->ulRegMclkTimeLow; - } - /*-----------------------------------------------------------------------*/ - if ( (f_pIntFlags->fErrorOverflowToneEvents == TRUE) && - pIntrptConfig->byErrorOverflowToneEventsConfig == cOCT6100_INTERRUPT_TIMEOUT && - pIntrptManage->byErrorOverflowToneEventsState == cOCT6100_INTRPT_ACTIVE ) - { - pIntrptManage->byErrorOverflowToneEventsState = cOCT6100_INTRPT_WILL_TIMEOUT; - pIntrptManage->ulErrorOverflowToneEventsDisableMclkHigh = pIntrptManage->ulRegMclkTimeHigh; - pIntrptManage->ulErrorOverflowToneEventsDisableMclkLow = pIntrptManage->ulRegMclkTimeLow; - } - /*-----------------------------------------------------------------------*/ - if ( (f_pIntFlags->fErrorH100OutOfSync == TRUE || - f_pIntFlags->fErrorH100ClkA == TRUE || - f_pIntFlags->fErrorH100ClkB == TRUE || - f_pIntFlags->fErrorH100FrameA == TRUE ) && - pIntrptConfig->byErrorH100Config == cOCT6100_INTERRUPT_TIMEOUT && - pIntrptManage->byErrorH100State == cOCT6100_INTRPT_ACTIVE ) - { - pIntrptManage->byErrorH100State = cOCT6100_INTRPT_WILL_TIMEOUT; - pIntrptManage->ulErrorH100DisableMclkHigh = pIntrptManage->ulRegMclkTimeHigh; - pIntrptManage->ulErrorH100DisableMclkLow = pIntrptManage->ulRegMclkTimeLow; - } - /*-----------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteIntrptRegs - -Description: Writes to interrupt registers to clear interrupt condition, and - writes to an interrupt's IE register if interrupt is to time - out. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteIntrptRegs -UINT32 Oct6100ApiWriteIntrptRegs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_API_INTRPT_MANAGE pIntrptManage; - tOCT6100_WRITE_PARAMS WriteParams; - - UINT32 ulResult; - - /* Get some local pointers. */ - pIntrptManage = &f_pApiInstance->pSharedInfo->IntrptManage; - - /* Set some parameters of write struct. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - - - /*===========================================================================*/ - if ( pIntrptManage->byFatalMemoryState == cOCT6100_INTRPT_WILL_TIMEOUT ) - { - WriteParams.ulWriteAddress = 0x104; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - if ( (pIntrptManage->usRegister102h & cOCT6100_INTRPT_MASK_REG_102H) != 0 ) - { - WriteParams.ulWriteAddress = 0x102; - WriteParams.usWriteData = pIntrptManage->usRegister102h; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - /*===========================================================================*/ - - /*===========================================================================*/ - if ( pIntrptManage->byFatalMemoryState == cOCT6100_INTRPT_WILL_TIMEOUT || - pIntrptManage->byErrorMemoryState == cOCT6100_INTRPT_WILL_TIMEOUT ) - { - WriteParams.ulWriteAddress = 0x204; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->byFatalMemoryState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x1800; - - if ( pIntrptManage->byErrorMemoryState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x0401; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - if ( (pIntrptManage->usRegister202h & cOCT6100_INTRPT_MASK_REG_202H) != 0 ) - { - WriteParams.ulWriteAddress = 0x202; - WriteParams.usWriteData = pIntrptManage->usRegister202h; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - /*===========================================================================*/ - - /*===========================================================================*/ - if ( pIntrptManage->byErrorH100State == cOCT6100_INTRPT_WILL_TIMEOUT ) - { - WriteParams.ulWriteAddress = 0x304; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->fMclkIntrptActive == TRUE ) - WriteParams.usWriteData |= 0x0001; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - if ( (pIntrptManage->usRegister302h & cOCT6100_INTRPT_MASK_REG_302H) != 0 ) - { - WriteParams.ulWriteAddress = 0x302; - WriteParams.usWriteData = pIntrptManage->usRegister302h; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - /*===========================================================================*/ - - /*===========================================================================*/ - if ( (pIntrptManage->usRegister502h & cOCT6100_INTRPT_MASK_REG_502H) != 0 ) - { - WriteParams.ulWriteAddress = 0x502; - WriteParams.usWriteData = pIntrptManage->usRegister502h; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - /*===========================================================================*/ - - /*===========================================================================*/ - if ( pIntrptManage->byErrorOverflowToneEventsState == cOCT6100_INTRPT_WILL_TIMEOUT ) - { - WriteParams.ulWriteAddress = 0x704; - WriteParams.usWriteData = 0x0000; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - if ( (pIntrptManage->usRegister702h & cOCT6100_INTRPT_MASK_REG_702H) != 0 ) - { - WriteParams.ulWriteAddress = 0x702; - WriteParams.usWriteData = pIntrptManage->usRegister702h; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - /*===========================================================================*/ - - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteIeRegs - -Description: Writes the IE field of each interrupt register. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteIeRegs -UINT32 Oct6100ApiWriteIeRegs( - tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_API_INTRPT_MANAGE pIntrptManage; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - - /* Get some local pointers. */ - pIntrptManage = &f_pApiInstance->pSharedInfo->IntrptManage; - - /* Set some parameters of write struct. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - - /* Set some parameters of read struct. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /*==================================================================================*/ - WriteParams.ulWriteAddress = 0x104; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->byFatalMemoryState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x0001; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*==================================================================================*/ - - /*==================================================================================*/ - WriteParams.ulWriteAddress = 0x204; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->byFatalMemoryState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x1800; - if ( pIntrptManage->byErrorMemoryState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x0401; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*==================================================================================*/ - - /*==================================================================================*/ - WriteParams.ulWriteAddress = 0x304; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->fMclkIntrptActive == TRUE ) - WriteParams.usWriteData |= 0x0001; - if ( pIntrptManage->byErrorH100State == cOCT6100_INTRPT_ACTIVE ) - { - if ( f_pApiInstance->pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - WriteParams.usWriteData |= 0xD100; - else - WriteParams.usWriteData |= 0x5100; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*==================================================================================*/ - - /*==================================================================================*/ - WriteParams.ulWriteAddress = 0x504; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->byFatalGeneralState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x0002; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*==================================================================================*/ - - /*==================================================================================*/ - WriteParams.ulWriteAddress = 0x704; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->byErrorOverflowToneEventsState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x0002; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*==================================================================================*/ - - - /*==================================================================================*/ - /* Enable the GLOBAL IEs for the interrupt pin. */ - WriteParams.ulWriteAddress = 0x218; - WriteParams.usWriteData = 0x00D7; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - /*==================================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReadChipMclkTime - -Description: Reads the chip's mclk cycle count to construct a chip time. - The time is used to manage interrupts. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReadChipMclkTime -UINT32 Oct6100ApiReadChipMclkTime( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_API_INTRPT_MANAGE pIntrptManage; - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulCheckData; - UINT32 ulResult; - UINT32 i; - UINT16 usReadData; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - pIntrptManage = &pSharedInfo->IntrptManage; - - /* Assign memory for read data. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* Perform reads. */ - for ( i = 0; i < 100; i++ ) - { - ReadParams.ulReadAddress = 0x306; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - pIntrptManage->ulRegMclkTimeHigh = usReadData & 0xFF; - ulCheckData = usReadData; - - ReadParams.ulReadAddress = 0x308; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - pIntrptManage->ulRegMclkTimeLow = (usReadData & 0xFFFF) << 16; - - ReadParams.ulReadAddress = 0x306; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - if ( ulCheckData == usReadData ) - break; - } - - if ( i == 100 ) - return cOCT6100_ERR_FATAL_2F; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateIntrptTimeouts - -Description: Checks which interrupt groups have finished their timeout - period. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateIntrptTimeouts -UINT32 Oct6100ApiUpdateIntrptTimeouts( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_API_INTRPT_MANAGE pIntrptManage; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulRegMclkTimePlus5MsHigh; - UINT32 ulRegMclkTimePlus5MsLow; - UINT32 ulResult; - BOOL fFatalMemoryChange = FALSE; - BOOL fDataErrMemoryChange = FALSE; - BOOL fErrorOverflowToneEventsChange = FALSE; - BOOL fH100ErrorChange = FALSE; - - /* Get local pointer to interrupt management structure. */ - pIntrptManage = &f_pApiInstance->pSharedInfo->IntrptManage; - - /* Calculate mclk time + 5 ms. */ - ulRegMclkTimePlus5MsLow = pIntrptManage->ulRegMclkTimeLow + (5 * pIntrptManage->ulNumMclkCyclesIn1Ms); - if ( ulRegMclkTimePlus5MsLow < pIntrptManage->ulRegMclkTimeLow ) - ulRegMclkTimePlus5MsHigh = pIntrptManage->ulRegMclkTimeHigh + 1; - else /* ( ulRegMclkTimePlus5MsLow >= pIntrptManage->ulRegMclkTimeLow ) */ - ulRegMclkTimePlus5MsHigh = pIntrptManage->ulRegMclkTimeHigh; - - /* Check which interrupts are timed out and need to be reenabled now. */ - if ( pIntrptManage->byFatalMemoryState == cOCT6100_INTRPT_IN_TIMEOUT ) - { - mOCT6100_CHECK_INTRPT_TIMEOUT( ulRegMclkTimePlus5MsHigh, ulRegMclkTimePlus5MsLow, pIntrptManage->ulFatalMemoryDisableMclkHigh, pIntrptManage->ulFatalMemoryDisableMclkLow, pIntrptManage->ulFatalMemoryEnableMclkHigh, pIntrptManage->ulFatalMemoryEnableMclkLow, pIntrptManage->byFatalMemoryState, fFatalMemoryChange ) - } - if ( pIntrptManage->byErrorMemoryState == cOCT6100_INTRPT_IN_TIMEOUT ) - { - mOCT6100_CHECK_INTRPT_TIMEOUT( ulRegMclkTimePlus5MsHigh, ulRegMclkTimePlus5MsLow, pIntrptManage->ulErrorMemoryDisableMclkHigh, pIntrptManage->ulErrorMemoryDisableMclkLow, pIntrptManage->ulErrorMemoryEnableMclkHigh, pIntrptManage->ulErrorMemoryEnableMclkLow, pIntrptManage->byErrorMemoryState, fDataErrMemoryChange ) - } - if ( pIntrptManage->byErrorOverflowToneEventsState == cOCT6100_INTRPT_IN_TIMEOUT ) - { - mOCT6100_CHECK_INTRPT_TIMEOUT( ulRegMclkTimePlus5MsHigh, ulRegMclkTimePlus5MsLow, pIntrptManage->ulErrorOverflowToneEventsDisableMclkHigh, pIntrptManage->ulErrorOverflowToneEventsDisableMclkLow, pIntrptManage->ulErrorOverflowToneEventsEnableMclkHigh, pIntrptManage->ulErrorOverflowToneEventsEnableMclkLow, pIntrptManage->byErrorOverflowToneEventsState, fErrorOverflowToneEventsChange ) - } - if ( pIntrptManage->byErrorH100State == cOCT6100_INTRPT_IN_TIMEOUT ) - { - mOCT6100_CHECK_INTRPT_TIMEOUT( ulRegMclkTimePlus5MsHigh, ulRegMclkTimePlus5MsLow, pIntrptManage->ulErrorH100DisableMclkHigh, pIntrptManage->ulErrorH100DisableMclkLow, pIntrptManage->ulErrorH100EnableMclkHigh, pIntrptManage->ulErrorH100EnableMclkLow, pIntrptManage->byErrorH100State, fH100ErrorChange ) - } - - /* Set some parameters of write struct. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Write to the IE registers which have changed. */ - - /*==================================================================================*/ - if ( fFatalMemoryChange == TRUE ) - { - WriteParams.ulWriteAddress = 0x104; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->byFatalMemoryState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x0001; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - } - /*==================================================================================*/ - - /*==================================================================================*/ - if ( fFatalMemoryChange == TRUE || - fDataErrMemoryChange == TRUE ) - { - WriteParams.ulWriteAddress = 0x204; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->byFatalMemoryState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x1800; - if ( pIntrptManage->byErrorMemoryState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x0401; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - } - /*==================================================================================*/ - - /*==================================================================================*/ - if ( pIntrptManage->fMclkIntrptActive == TRUE || - fH100ErrorChange == TRUE ) - { - WriteParams.ulWriteAddress = 0x304; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->fMclkIntrptActive == TRUE ) - WriteParams.usWriteData |= 0x0001; - - if ( pIntrptManage->byErrorH100State == cOCT6100_INTRPT_ACTIVE ) - { - if ( f_pApiInstance->pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - WriteParams.usWriteData |= 0xD100; - else - WriteParams.usWriteData |= 0x5100; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - } - /*==================================================================================*/ - - - /*==================================================================================*/ - if ( fErrorOverflowToneEventsChange == TRUE ) - { - WriteParams.ulWriteAddress = 0x704; - WriteParams.usWriteData = 0x0000; - - if ( pIntrptManage->byErrorOverflowToneEventsState == cOCT6100_INTRPT_ACTIVE ) - WriteParams.usWriteData |= 0x0002; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - } - /*==================================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiScheduleNextMclkIntrptSer - -Description: Serialized sub-function of Oct6100ApiScheduleNextMclkIntrpt. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiScheduleNextMclkIntrptSer -UINT32 Oct6100ApiScheduleNextMclkIntrptSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_INTRPT_CONFIG pIntrptConfig; - tPOCT6100_API_INTRPT_MANAGE pIntrptManage; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulTimeDiff; - UINT32 ulRegMclkTimeHigh; - UINT32 ulRegMclkTimeLow; - UINT32 ulResult; - BOOL fConditionFlag = TRUE; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain temporary pointers to reduce indirection, thus speeding up processing. */ - pIntrptConfig = &pSharedInfo->IntrptConfig; - pIntrptManage = &pSharedInfo->IntrptManage; - ulRegMclkTimeHigh = pIntrptManage->ulRegMclkTimeHigh; - ulRegMclkTimeLow = pIntrptManage->ulRegMclkTimeLow; - - /* First, check if any interrupts have just been disabled. If there are any, */ - /* determine the time at which they should be reenabled. */ - pIntrptManage->ulNextMclkIntrptTimeHigh = cOCT6100_INVALID_VALUE; - pIntrptManage->ulNextMclkIntrptTimeLow = cOCT6100_INVALID_VALUE; - - while ( fConditionFlag ) - { - /* Indicate that no mclk interrupt is needed, yet. */ - ulTimeDiff = cOCT6100_INVALID_VALUE; - - /* Check each interrupt category to see if an mclk interrupt is needed to */ - /* reenable an interrupt at a later time. */ - if ( pIntrptManage->byFatalMemoryState != cOCT6100_INTRPT_ACTIVE && - pIntrptManage->byFatalMemoryState != cOCT6100_INTRPT_DISABLED ) - { - mOCT6100_GET_INTRPT_ENABLE_TIME( ulRegMclkTimeHigh, ulRegMclkTimeLow, pIntrptManage->byFatalMemoryState, pIntrptManage->ulFatalMemoryEnableMclkHigh, pIntrptManage->ulFatalMemoryEnableMclkLow, pIntrptConfig->ulFatalMemoryTimeoutMclk, ulTimeDiff ) - } - if ( pIntrptManage->byErrorMemoryState != cOCT6100_INTRPT_ACTIVE && - pIntrptManage->byErrorMemoryState != cOCT6100_INTRPT_DISABLED ) - { - mOCT6100_GET_INTRPT_ENABLE_TIME( ulRegMclkTimeHigh, ulRegMclkTimeLow, pIntrptManage->byErrorMemoryState, pIntrptManage->ulErrorMemoryEnableMclkHigh, pIntrptManage->ulErrorMemoryEnableMclkLow, pIntrptConfig->ulErrorMemoryTimeoutMclk, ulTimeDiff ) - } - if ( pIntrptManage->byErrorOverflowToneEventsState != cOCT6100_INTRPT_ACTIVE && - pIntrptManage->byErrorOverflowToneEventsState != cOCT6100_INTRPT_DISABLED ) - { - mOCT6100_GET_INTRPT_ENABLE_TIME( ulRegMclkTimeHigh, ulRegMclkTimeLow, pIntrptManage->byErrorOverflowToneEventsState, pIntrptManage->ulErrorOverflowToneEventsEnableMclkHigh, pIntrptManage->ulErrorOverflowToneEventsEnableMclkLow, pIntrptConfig->ulErrorOverflowToneEventsTimeoutMclk, ulTimeDiff ) - } - if ( pIntrptManage->byErrorH100State != cOCT6100_INTRPT_ACTIVE && - pIntrptManage->byErrorH100State != cOCT6100_INTRPT_DISABLED ) - { - mOCT6100_GET_INTRPT_ENABLE_TIME( ulRegMclkTimeHigh, ulRegMclkTimeLow, pIntrptManage->byErrorH100State, pIntrptManage->ulErrorH100EnableMclkHigh, pIntrptManage->ulErrorH100EnableMclkLow, pIntrptConfig->ulErrorH100TimeoutMclk, ulTimeDiff ) - } - - /* Set some parameters of write struct. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Schedule next mclk interrupt, if any is needed. */ - if ( ulTimeDiff != cOCT6100_INVALID_VALUE ) - { - UINT32 ulMclkTimeTest; - UINT32 ulAlarmTimeTest; - UINT32 ulTimeDiffTest; - BOOL fAlarmTimePassed; - - /* Indicate that an mclk interrupt is scheduled.*/ - pIntrptManage->fMclkIntrptActive = TRUE; - - pIntrptManage->ulNextMclkIntrptTimeLow = ulRegMclkTimeLow + ulTimeDiff; - if ( pIntrptManage->ulNextMclkIntrptTimeLow < ulRegMclkTimeLow ) - pIntrptManage->ulNextMclkIntrptTimeHigh = ulRegMclkTimeHigh + 1; - else /* ( pIntrptManage->ulNextMclkIntrptTimeLow >= ulRegMclkTimeLow ) */ - pIntrptManage->ulNextMclkIntrptTimeHigh = ulRegMclkTimeHigh; - - WriteParams.ulWriteAddress = 0x30C; - WriteParams.usWriteData = (UINT16)( (pIntrptManage->ulNextMclkIntrptTimeLow >> 24) & 0xFF ); - WriteParams.usWriteData |= (UINT16)( (pIntrptManage->ulNextMclkIntrptTimeHigh & 0xFF) << 8 ); - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x30E; - WriteParams.usWriteData = (UINT16)( (pIntrptManage->ulNextMclkIntrptTimeLow >> 8) & 0xFFFF ); - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress = 0x304; - WriteParams.usWriteData = 0; - - if ( pIntrptManage->fMclkIntrptActive == TRUE ) - WriteParams.usWriteData = 0x0001; - - if ( pIntrptManage->byErrorH100State == cOCT6100_INTRPT_ACTIVE ) - { - if ( f_pApiInstance->pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - WriteParams.usWriteData |= 0xD100; - else - WriteParams.usWriteData |= 0x5100; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Disable the ROL if previously set. */ - WriteParams.ulWriteAddress = 0x302; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if already passed the next interrupt time. */ - ulResult = Oct6100ApiReadChipMclkTime( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulMclkTimeTest = (pIntrptManage->ulRegMclkTimeLow >> 16) & 0xFFFF; - ulAlarmTimeTest = (pIntrptManage->ulNextMclkIntrptTimeLow >> 16) & 0xFFFF; - - /* Update the local Mlck timer values.*/ - ulRegMclkTimeHigh = pIntrptManage->ulRegMclkTimeHigh; - ulRegMclkTimeLow = pIntrptManage->ulRegMclkTimeLow; - - fAlarmTimePassed = FALSE; - - if ( ulMclkTimeTest > ulAlarmTimeTest ) - { - ulTimeDiffTest = ulMclkTimeTest - ulAlarmTimeTest; - if ( ulTimeDiffTest <= 0x8000 ) - fAlarmTimePassed = TRUE; - } - else /* ( ulMclkTimeTest <= ulAlarmTimeTest ) */ - { - ulTimeDiffTest = ulAlarmTimeTest - ulMclkTimeTest; - if ( ulTimeDiffTest > 0x8000 ) - fAlarmTimePassed = TRUE; - } - - if ( fAlarmTimePassed == TRUE ) - { - /* Passed the interrupt time. Schedule next interrupt (if needed). */ - ulResult = Oct6100ApiUpdateIntrptTimeouts( f_pApiInstance ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - continue; - } - else - { - fConditionFlag = FALSE; - } - } - else - { - /* Indicate that no mclk interrupt is scheduled. */ - pIntrptManage->fMclkIntrptActive = FALSE; - - /* Insure that the mclk interrupt is not enabled. */ - WriteParams.ulWriteAddress = 0x304; - WriteParams.usWriteData = 0x0000; - if ( pIntrptManage->byErrorH100State == cOCT6100_INTRPT_ACTIVE ) - { - if ( f_pApiInstance->pSharedInfo->ChipConfig.fEnableFastH100Mode == TRUE ) - WriteParams.usWriteData |= 0xD100; - else - WriteParams.usWriteData |= 0x5100; - } - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - fConditionFlag = FALSE; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckProcessorState - -Description: This function verifies if the NLP and AF processors are operating - correctly. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pIntFlags Pointer to a tOCT6100_INTERRUPT_FLAGS structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckProcessorState -UINT32 Oct6100ApiCheckProcessorState( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_READ_BURST_PARAMS ReadBurstParams; - - UINT32 ulNlpTimestamp; - UINT32 ulAfTimestamp; - UINT32 ulTimestampDiff; - - UINT32 ulResult; - UINT32 i; - - UINT16 usReadData; - UINT16 ausReadData[ 2 ]; - - UINT32 aulWaitTime[ 2 ]; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Set some parameters of write struct. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* Set some parameters of write struct. */ - ReadBurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadBurstParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadBurstParams.pusReadData = ausReadData; - - /*-----------------------------------------------------------------------*/ - /* Check if chip is in reset. */ - - /* Read the main control register. */ - ReadParams.ulReadAddress = 0x100; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData == 0x0000 ) - { - /* Chip was resetted. */ - f_pIntFlags->ulFatalGeneralFlags |= cOCT6100_FATAL_GENERAL_ERROR_TYPE_4; - f_pIntFlags->fFatalGeneral = TRUE; - pSharedInfo->ErrorStats.fFatalChipError = TRUE; - } - - /*-----------------------------------------------------------------------*/ - - - /*-----------------------------------------------------------------------*/ - /* Reading the AF timestamp.*/ - - for ( i = 0; i < cOCT6100_MAX_LOOP; i++ ) - { - /* Read the timestamp.*/ - ReadBurstParams.ulReadAddress = 0x082E0008; - ReadBurstParams.ulReadLength = 2; - - mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Read the high part again to make sure it didn't wrap. */ - ReadParams.ulReadAddress = 0x082E0008; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the low part wrapped. */ - if ( ausReadData[ 0 ] == usReadData ) - break; - } - - if ( i == cOCT6100_MAX_LOOP ) - return cOCT6100_ERR_INTRPTS_AF_TIMESTAMP_READ_TIMEOUT; - - /* Save the AF timestamp. */ - ulAfTimestamp = (ausReadData[ 0 ] << 16) | ausReadData[ 1 ]; - - /*-----------------------------------------------------------------------*/ - - - /*-----------------------------------------------------------------------*/ - /* Reading the NLP timestamp. */ - - for ( i = 0; i < cOCT6100_MAX_LOOP; i++ ) - { - /* Read the timestamp. */ - ReadBurstParams.ulReadAddress = 0x08000008; - ReadBurstParams.ulReadLength = 2; - - mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Read the high part again to make sure it didn't wrap. */ - ReadParams.ulReadAddress = 0x08000008; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the low part wrapped. */ - if ( ausReadData[ 0 ] == usReadData ) - break; - } - - if ( i == cOCT6100_MAX_LOOP ) - return cOCT6100_ERR_INTRPTS_NLP_TIMESTAMP_READ_TIMEOUT; - - /* Save the NLP timestamp. */ - ulNlpTimestamp = (ausReadData[ 0 ] << 16) | ausReadData[ 1 ]; - - /*-----------------------------------------------------------------------*/ - - - /*-----------------------------------------------------------------------*/ - /* Check the validity of the timestamp. */ - - if ( ulAfTimestamp > ulNlpTimestamp ) - { - /* The NLP timestamp wrapped. */ - ulTimestampDiff = 0xFFFFFFFF - ulAfTimestamp + 1; - ulTimestampDiff += ulNlpTimestamp; - } - else - ulTimestampDiff = ulNlpTimestamp - ulAfTimestamp; - - if ( ulTimestampDiff > 0x2000 ) - { - f_pIntFlags->ulFatalGeneralFlags |= cOCT6100_FATAL_GENERAL_ERROR_TYPE_5; - f_pIntFlags->fFatalGeneral = TRUE; - pSharedInfo->ErrorStats.fFatalChipError = TRUE; - } - - /*Check if AF and NLP are both stuck*/ - if ( f_pIntFlags->fErrorH100ClkA == FALSE && - f_pIntFlags->fErrorH100ClkB == FALSE && - f_pIntFlags->fErrorH100FrameA == FALSE && - f_pIntFlags->fErrorH100OutOfSync == FALSE ) - - { - if ( ulAfTimestamp == 0 && ulNlpTimestamp == 0 ) - { - /*Give some time to the counters*/ - aulWaitTime[ 0 ] = 250; - aulWaitTime[ 1 ] = 0; - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*Let's read again the AF timestamp to be sure. Maybe they were at 0 at the same time*/ - ReadBurstParams.ulReadAddress = 0x082E0008; - ReadBurstParams.ulReadLength = 2; - - mOCT6100_DRIVER_READ_BURST_API( ReadBurstParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulAfTimestamp = (ausReadData[ 0 ] << 16) | ausReadData[ 1 ]; - - if ( ulAfTimestamp == 0 ) - { - /*TDM Clocks are ok but NLP and AF timestamps are both at 0*/ - f_pIntFlags->ulFatalGeneralFlags |= cOCT6100_FATAL_GENERAL_ERROR_TYPE_9; - f_pIntFlags->fFatalGeneral = TRUE; - pSharedInfo->ErrorStats.fFatalChipError = TRUE; - } - } - - } - - /*-----------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_memory.c b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_memory.c deleted file mode 100644 index b2c0e8e..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_memory.c +++ /dev/null @@ -1,831 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_memory.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains the functions used to manage the allocation of memory - blocks in external memory. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 42 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_apiud.h" -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_playout_buf_inst.h" -#include "oct6100api/oct6100_api_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_memory_priv.h" - - -/**************************** PRIVATE FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetMemorySwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management of the memories. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pOpenChip Pointer to chip configuration struct. -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetMemorySwSizes -UINT32 Oct6100ApiGetMemorySwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulTempVar; - UINT32 ulResult; - UINT32 ulNumTsiChariots; - - /*=========================================================================*/ - /* Internal memory */ - - /* Evaluate the number of available TSI memory after reserving the ones used by channels. */ - ulNumTsiChariots = cOCT6100_TOTAL_TSI_CONTROL_MEM_ENTRY - f_pOpenChip->ulMaxPhasingTssts - cOCT6100_TSI_MEM_FOR_TIMESTAMP; - - if ( f_pOpenChip->fEnableExtToneDetection == TRUE ) - ulNumTsiChariots--; - - /* Calculate memory needed for TSI memory allocation. */ - ulResult = OctapiLlmAllocGetSize( ulNumTsiChariots, &f_pInstSizes->ulTsiMemoryAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_94; - - /* Calculate memory needed for conversion memory allocation. */ - ulResult = OctapiLlmAllocGetSize( cOCT6100_MAX_CONVERSION_MEMORY_BLOCKS, &f_pInstSizes->ulConversionMemoryAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_B5; - - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulTsiMemoryAlloc, ulTempVar ); - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulConversionMemoryAlloc, ulTempVar ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiMemorySwInit - -Description: Initializes all elements of the instance structure associated - to memories. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiMemorySwInit -UINT32 Oct6100ApiMemorySwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pTsiMemAlloc; - PVOID pAllocPnt; - UINT32 ulResult; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /*=========================================================================*/ - /* Internal memory */ - - /* Initialize the TSI memory allocation structure. */ - pSharedInfo->MemoryMap.ulNumTsiEntries = cOCT6100_TOTAL_TSI_CONTROL_MEM_ENTRY - pSharedInfo->ChipConfig.usMaxPhasingTssts - cOCT6100_TSI_MEM_FOR_TIMESTAMP; - - if ( pSharedInfo->ChipConfig.fEnableExtToneDetection == TRUE ) - pSharedInfo->MemoryMap.ulNumTsiEntries--; - - mOCT6100_GET_TSI_MEMORY_ALLOC_PNT( pSharedInfo, pTsiMemAlloc ); - - ulResult = OctapiLlmAllocInit( &pTsiMemAlloc, pSharedInfo->MemoryMap.ulNumTsiEntries ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_95; - - /* Initialize the conversion memory allocation structure. */ - mOCT6100_GET_CONVERSION_MEMORY_ALLOC_PNT( pSharedInfo, pAllocPnt ); - - ulResult = OctapiLlmAllocInit( &pAllocPnt, cOCT6100_MAX_CONVERSION_MEMORY_BLOCKS ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_B6; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiBufferPlayoutMemorySwInit - -Description: Initialize the buffer playout memory allocation working - structures. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiBufferPlayoutMemorySwInit -UINT32 Oct6100ApiBufferPlayoutMemorySwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE pNode; - UINT32 i; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Only if buffer playout will be used. */ - if ( pSharedInfo->ChipConfig.usMaxPlayoutBuffers > 0 ) - { - mOCT6100_GET_BUFFER_MEMORY_NODE_LIST_PNT( pSharedInfo, pNode ); - - /* First node contains all free memory at beginning. This node is not used, but represents the memory. */ - pNode->ulSize = ( pSharedInfo->MiscVars.ulTotalMemSize + cOCT6100_EXTERNAL_MEM_BASE_ADDRESS ) - pSharedInfo->MemoryMap.ulFreeMemBaseAddress; - pNode->ulNext = 0; - pNode->ulPrevious = 0; - pNode->fAllocated = FALSE; - pNode->ulStartAddress = pSharedInfo->MemoryMap.ulFreeMemBaseAddress; - - pNode++; - - /* Now create the first node of the free list, i.e. nodes that can be used later for modeling the memory. */ - pNode->ulSize = 0; - /* Next free. */ - pNode->ulNext = 2; - /* Last. */ - pNode->ulPrevious = ( pSharedInfo->ChipConfig.usMaxPlayoutBuffers * 2 ) - 1; - pNode->fAllocated = FALSE; - pNode->ulStartAddress = 0; - - pNode++; - - /* Link all the unused nodes. */ - for( i = 2; i < (UINT32)( ( pSharedInfo->ChipConfig.usMaxPlayoutBuffers * 2 ) - 1 ); i ++ ) - { - pNode->ulNext = i + 1; - pNode->ulPrevious = i - 1; - pNode->ulStartAddress = 0; - pNode->ulSize = 0; - pNode->fAllocated = FALSE; - pNode++; - } - - /* Last node of the unused list. */ - pNode->fAllocated = FALSE; - pNode->ulPrevious = ( pSharedInfo->ChipConfig.usMaxPlayoutBuffers * 2 ) - 2; - /* Free list head. */ - pNode->ulNext = 1; - pNode->ulSize = 0; - pNode->ulStartAddress = 0; - - /* Set roving pointer to first node ( which can be used! ) */ - pSharedInfo->PlayoutInfo.ulRovingNode = 0; - - /* First unused node. */ - pSharedInfo->PlayoutInfo.ulFirstUnusedNode = 1; - - /* Last unused node. */ - pSharedInfo->PlayoutInfo.ulLastUnusedNode = ( pSharedInfo->ChipConfig.usMaxPlayoutBuffers * 2 ) - 1; - - /* Number of unused nodes. */ - pSharedInfo->PlayoutInfo.ulUnusedNodeCnt = ( pSharedInfo->ChipConfig.usMaxPlayoutBuffers * 2 ) - 1; - } - else - { - pSharedInfo->PlayoutInfo.ulUnusedNodeCnt = 0; - } - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveBufferPlayoutMemoryNode - -Description: Get a free node from the unused buffer playout node list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pulNewNode The index of the node. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveBufferPlayoutMemoryNode -UINT32 Oct6100ApiReserveBufferPlayoutMemoryNode( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT32 f_pulNewNode ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE pNode; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check if a free block is left. */ - if ( pSharedInfo->PlayoutInfo.ulUnusedNodeCnt == 0 ) - { - /* This should not happen according to the allocated list from the beginning. */ - return cOCT6100_ERR_FATAL_CC; - } - - /* The new node is the first in the unused list. */ - *f_pulNewNode = pSharedInfo->PlayoutInfo.ulFirstUnusedNode; - - /* Unlink this new node from the unused list. */ - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pNode, *f_pulNewNode ); - - pSharedInfo->PlayoutInfo.ulFirstUnusedNode = pNode->ulNext; - - pNode->ulPrevious = pSharedInfo->PlayoutInfo.ulLastUnusedNode; - - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pNode, pSharedInfo->PlayoutInfo.ulLastUnusedNode ); - - pNode->ulNext = pSharedInfo->PlayoutInfo.ulFirstUnusedNode; - - /* Update unused node count. */ - pSharedInfo->PlayoutInfo.ulUnusedNodeCnt--; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseBufferPlayoutMemoryNode - -Description: Release a node that is not used anymore. Insert this node - into the unused list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulOldNode The index of the node. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseBufferPlayoutMemoryNode -UINT32 Oct6100ApiReleaseBufferPlayoutMemoryNode( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulOldNode ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE pNode; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get the last unused node. Insert this old node at the end of the unused list. */ - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pNode, pSharedInfo->PlayoutInfo.ulLastUnusedNode ); - - /* Last node points to old node. */ - pNode->ulNext = f_ulOldNode; - - /* Update old node. */ - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pNode, f_ulOldNode ); - - pNode->ulPrevious = pSharedInfo->PlayoutInfo.ulLastUnusedNode; - pNode->ulNext = pSharedInfo->PlayoutInfo.ulFirstUnusedNode; - pSharedInfo->PlayoutInfo.ulLastUnusedNode = f_ulOldNode; - - /* Keep unused node count. */ - pSharedInfo->PlayoutInfo.ulUnusedNodeCnt++; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveBufferPlayoutMemory - -Description: Try to allocate requested size. - Returns an error if malloc point could not be found. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulSize Needed size. -f_pulMallocAddress Alloc point. This memory can now be used. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveBufferPlayoutMemory -UINT32 Oct6100ApiReserveBufferPlayoutMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulSize, - OUT PUINT32 f_pulMallocAddress ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE pCurrentNode; - tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE pTempNode; - tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE pNewNode; - - UINT32 ulCurrentBufferPlayoutMallocNode; - UINT32 ulNewNode; - BOOL fFoundMemory = FALSE; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Requested size must be divisible by 64. */ - if ( f_ulSize % 64 ) - { - f_ulSize = f_ulSize + ( 64 - ( f_ulSize % 64 ) ); - } - - /* Start with roving pointer. */ - ulCurrentBufferPlayoutMallocNode = pSharedInfo->PlayoutInfo.ulRovingNode; - - *f_pulMallocAddress = 0; - - /* Return an error if size requested is zero. */ - if ( f_ulSize == 0 ) - { - return cOCT6100_ERR_BUFFER_PLAYOUT_MALLOC_ZERO; - } - - do - { - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pCurrentNode, ulCurrentBufferPlayoutMallocNode ); - - /* Look for a free node big enough to fulfill user requested size. */ - if ( ( pCurrentNode->fAllocated == FALSE ) && ( pCurrentNode->ulSize >= f_ulSize ) ) - { - /* Use this node! */ - pCurrentNode->fAllocated = TRUE; - - if ( pCurrentNode->ulNext != 0 ) - { - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pTempNode, pCurrentNode->ulNext ); - - if( ( pTempNode->fAllocated == TRUE ) && ( pCurrentNode->ulSize > f_ulSize ) ) - { - /* Fragmentation NOW! */ - - /* Allocate new node that will contain free size. */ - ulResult = Oct6100ApiReserveBufferPlayoutMemoryNode( f_pApiInstance, &ulNewNode ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pNewNode, ulNewNode ); - - /* Can use this free node. */ - pNewNode->ulSize = pCurrentNode->ulSize - f_ulSize; - pNewNode->ulStartAddress = pCurrentNode->ulStartAddress + f_ulSize; - - /* Link new node into the list. */ - pNewNode->ulNext = pCurrentNode->ulNext; - pNewNode->ulPrevious = ulCurrentBufferPlayoutMallocNode; - pNewNode->fAllocated = FALSE; - pTempNode->ulPrevious = ulNewNode; - pCurrentNode->ulNext = ulNewNode; - } - } - else if ( pCurrentNode->ulSize > f_ulSize ) - { - /* Must allocate a new free node for the rest of the space. */ - ulResult = Oct6100ApiReserveBufferPlayoutMemoryNode( f_pApiInstance, &ulNewNode ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pNewNode, ulNewNode ); - - pNewNode->ulNext = pCurrentNode->ulNext; - pCurrentNode->ulNext = ulNewNode; - pNewNode->ulPrevious = ulCurrentBufferPlayoutMallocNode; - pNewNode->fAllocated = FALSE; - pNewNode->ulSize = pCurrentNode->ulSize - f_ulSize; - pNewNode->ulStartAddress = pCurrentNode->ulStartAddress + f_ulSize; - - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pTempNode, 0 ); - - /* Check for the head node that would have to be updated. */ - if ( ( ulCurrentBufferPlayoutMallocNode == 0 ) && ( pTempNode->ulPrevious == 0 ) ) - pTempNode->ulPrevious = ulNewNode; - } - else - { - /* Perfect fit. */ - } - pCurrentNode->ulSize = f_ulSize; - - /* Update roving pointer. */ - pSharedInfo->PlayoutInfo.ulRovingNode = ulCurrentBufferPlayoutMallocNode; - *f_pulMallocAddress = pCurrentNode->ulStartAddress; - fFoundMemory = TRUE; - break; - } - - /* Next block! */ - ulCurrentBufferPlayoutMallocNode = pCurrentNode->ulNext; - - } while ( pSharedInfo->PlayoutInfo.ulRovingNode != ulCurrentBufferPlayoutMallocNode ); - - if ( fFoundMemory == FALSE ) - { - return cOCT6100_ERR_BUFFER_PLAYOUT_NO_MEMORY; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseBufferPlayoutMemory - -Description: Free what was allocated at address. Free is somewhat slower - then Malloc. O(n), must travel through the list looking for - the malloc point. Return an error if alloc point was not found. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulMallocAddress Alloc point. The memory at address will be freed. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseBufferPlayoutMemory -UINT32 Oct6100ApiReleaseBufferPlayoutMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulMallocAddress ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE pCurrentNode; - tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE pTempNode; - tPOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE pOldNode; - - UINT32 ulResult = cOCT6100_ERR_BUFFER_PLAYOUT_MALLOC_POINT_NOT_FOUND; - UINT32 ulNodeToMerge; - UINT32 ulNodeToRemove; - UINT32 ulCurrentBufferPlayoutMallocNode; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Start from the beginning and find the alloc node. */ - ulCurrentBufferPlayoutMallocNode = 0; - - do - { - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pCurrentNode, ulCurrentBufferPlayoutMallocNode ); - - if ( ( pCurrentNode->ulStartAddress == f_ulMallocAddress ) && ( pCurrentNode->fAllocated == TRUE ) ) - { - /* We found the block! */ - pCurrentNode->fAllocated = FALSE; - - /* Check if the next node can be merged. */ - if ( pCurrentNode->ulNext != 0 ) - { - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pTempNode, pCurrentNode->ulNext ); - - if ( pTempNode->fAllocated == FALSE ) - { - /* Can merge this block to us. */ - pCurrentNode->ulSize += pTempNode->ulSize; - pTempNode->ulSize = 0; - - /* Unlink unused node. */ - ulNodeToRemove = pCurrentNode->ulNext; - pCurrentNode->ulNext = pTempNode->ulNext; - - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pTempNode, pCurrentNode->ulNext ); - - pTempNode->ulPrevious = ulCurrentBufferPlayoutMallocNode; - - ulResult = Oct6100ApiReleaseBufferPlayoutMemoryNode( f_pApiInstance, ulNodeToRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move roving pointer if have to. */ - if ( pSharedInfo->PlayoutInfo.ulRovingNode == ulNodeToRemove ) - pSharedInfo->PlayoutInfo.ulRovingNode = ulCurrentBufferPlayoutMallocNode; - } - } - - /* Check if previous node can merge. */ - if ( ulCurrentBufferPlayoutMallocNode != 0 ) - { - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pTempNode, pCurrentNode->ulPrevious ); - - if ( pTempNode->fAllocated == FALSE ) - { - ulNodeToMerge = pCurrentNode->ulPrevious; - - /* Can merge us to this node. */ - pTempNode->ulSize += pCurrentNode->ulSize; - pCurrentNode->ulSize = 0; - - /* Unlink unused node. */ - ulNodeToRemove = ulCurrentBufferPlayoutMallocNode; - - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pOldNode, ulNodeToRemove ); - - pTempNode->ulNext = pOldNode->ulNext; - - mOCT6100_GET_BUFFER_MEMORY_NODE_ENTRY_PNT( pSharedInfo, pTempNode, pTempNode->ulNext ); - - pTempNode->ulPrevious = ulNodeToMerge; - - pOldNode->fAllocated = FALSE; - pOldNode->ulSize = 0; - pOldNode->ulStartAddress = 0; - - /* Move roving pointer if have to. */ - if ( pSharedInfo->PlayoutInfo.ulRovingNode == ulNodeToRemove ) - pSharedInfo->PlayoutInfo.ulRovingNode = ulNodeToMerge; - - /* Release this unused node. */ - ulResult = Oct6100ApiReleaseBufferPlayoutMemoryNode( f_pApiInstance, ulNodeToRemove ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* All's good! */ - ulResult = 0; - break; - } - - /* Next node. */ - ulCurrentBufferPlayoutMallocNode = pCurrentNode->ulNext; - - } while( ulCurrentBufferPlayoutMallocNode != 0 ); - - return ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveTsiMemEntry - -Description: Reserves a TSI chariot memory entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pusTsiMemIndex Resulting index reserved in the TSI chariot memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveTsiMemEntry -UINT32 Oct6100ApiReserveTsiMemEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusTsiMemIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pTsiMemAlloc; - UINT32 ulResult; - UINT32 ulIndex; - UINT32 ulNumTsiB4Timestamp; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_TSI_MEMORY_ALLOC_PNT( pSharedInfo, pTsiMemAlloc ) - - ulResult = OctapiLlmAllocAlloc( pTsiMemAlloc, &ulIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_MEMORY_ALL_TSI_MEM_ENTRY_RESERVED; - else - return cOCT6100_ERR_FATAL_92; - } - - - if ( ulIndex >= cOCT6100_NUM_TSI_B4_PHASING ) - { - /* Evaluate the number of TSI memory before the timestamp TSI. */ - ulNumTsiB4Timestamp = cOCT6100_NUM_TSI_B4_PHASING + cOCT6100_MAX_TSI_B4_TIMESTAMP - pSharedInfo->ChipConfig.usMaxPhasingTssts; - - if ( ulIndex >= ulNumTsiB4Timestamp ) - { - /* + 4 for the timestamp TSI entries.*/ - *f_pusTsiMemIndex = (UINT16)( pSharedInfo->ChipConfig.usMaxPhasingTssts + ulIndex + cOCT6100_TSI_MEM_FOR_TIMESTAMP ); - } - else /* ulIndex < ulNumTsiB4Timestamp */ - { - *f_pusTsiMemIndex = (UINT16)( pSharedInfo->ChipConfig.usMaxPhasingTssts + ulIndex ); - } - } - else /* ulIndex < ulNumTsiB4Timestamp */ - { - *f_pusTsiMemIndex = (UINT16)( ulIndex ); - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseTsiMemEntry - -Description: Releases a TSI chariot memory entry specified. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_usTsiMemIndex Index reserved in the TSI chariot memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseTsiMemEntry -UINT32 Oct6100ApiReleaseTsiMemEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsiMemIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pTsiMemAlloc; - UINT32 ulResult; - UINT32 ulIndex; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check if the entry programmed is greater then the timestamp entries. */ - if ( f_usTsiMemIndex > cOCT6100_TSST_CONTROL_TIMESTAMP_BASE_ENTRY ) - ulIndex = f_usTsiMemIndex - cOCT6100_TSI_MEM_FOR_TIMESTAMP; - else - ulIndex = f_usTsiMemIndex; - - /* Check if the entry programmed is greater then the phasing TSST entries. */ - if ( ulIndex > cOCT6100_TSST_CONTROL_PHASING_TSST_BASE_ENTRY ) - ulIndex -= pSharedInfo->ChipConfig.usMaxPhasingTssts; - - mOCT6100_GET_TSI_MEMORY_ALLOC_PNT( pSharedInfo, pTsiMemAlloc ) - - ulResult = OctapiLlmAllocDealloc( pTsiMemAlloc, ulIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_93; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveConversionMemEntry - -Description: Reserves one of the conversion memory entry - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to - keep the present state of the chip and all its - resources. - -f_pusConversionMemIndex Resulting index reserved in the conversion memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveConversionMemEntry -UINT32 Oct6100ApiReserveConversionMemEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusConversionMemIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pConversionMemAlloc; - UINT32 ulConversionMemIndex; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_CONVERSION_MEMORY_ALLOC_PNT( pSharedInfo, pConversionMemAlloc ) - - ulResult = OctapiLlmAllocAlloc( pConversionMemAlloc, &ulConversionMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_MEMORY_ALL_CONVERSION_MEM_ENTRY_RESERVED; - else - return cOCT6100_ERR_FATAL_B8; - } - - *f_pusConversionMemIndex = (UINT16)( ulConversionMemIndex & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseConversionMemEntry - -Description: Releases the conversion chariot memory entry specified. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to - keep the present state of the chip and all its - resources. - -f_usConversionMemIndex Index reserved in the conversion chariot memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseConversionMemEntry -UINT32 Oct6100ApiReleaseConversionMemEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usConversionMemIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pConversionMemAlloc; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_CONVERSION_MEMORY_ALLOC_PNT( pSharedInfo, pConversionMemAlloc ) - - ulResult = OctapiLlmAllocDealloc( pConversionMemAlloc, f_usConversionMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_B7; - } - - return cOCT6100_ERR_OK; -} -#endif diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_miscellaneous.c b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_miscellaneous.c deleted file mode 100644 index 4e5c189..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_miscellaneous.c +++ /dev/null @@ -1,640 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_miscellaneous.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains miscellaneous functions used in various files. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 35 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" - -#include "apilib/octapi_largmath.h" - -#include "oct6100api/oct6100_apiud.h" -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_channel_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_miscellaneous_priv.h" - - -/**************************** PRIVATE FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWaitForTime - -Description: Waits for the specified amount of time. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_aulWaitTime[ 2 ] The amout of time to be waited. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWaitForTime -UINT32 Oct6100ApiWaitForTime( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_aulWaitTime[ 2 ] ) -{ - tOCT6100_GET_TIME StartTime; - tOCT6100_GET_TIME CurrentTime; - UINT32 aulTimeDelta[ 2 ]; - UINT32 ulResult; - UINT16 usTempVar; - BOOL fConditionFlag = TRUE; - - /* Copy the process context. */ - StartTime.pProcessContext = f_pApiInstance->pProcessContext; - CurrentTime.pProcessContext = f_pApiInstance->pProcessContext; - - ulResult = Oct6100UserGetTime( &StartTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - while ( fConditionFlag ) - { - ulResult = Oct6100UserGetTime( &CurrentTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = octapi_lm_subtract( - CurrentTime.aulWallTimeUs, 1, - StartTime.aulWallTimeUs, 1, - aulTimeDelta, 1, - &usTempVar ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_37; - - if ( aulTimeDelta[ 1 ] >= f_aulWaitTime[ 1 ] && - aulTimeDelta[ 0 ] >= f_aulWaitTime[ 0 ] ) - fConditionFlag = FALSE; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWaitForPcRegisterBit - -Description: Polls the specified PC register bit. The function exits once - the bit is cleared by hardware, or when the specified timeout - period has been expired. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulPcRegAdd Address of the register containing the PC bit. -f_ulPcBitNum Number of the PC bit within the register. -f_ulValue Expected value of the bit. -f_ulTimeoutUs The timeout period, in usec. -f_pfBitEqual Pointer to the result of the bit comparison. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWaitForPcRegisterBit -UINT32 Oct6100ApiWaitForPcRegisterBit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulPcRegAdd, - IN UINT32 f_ulPcBitNum, - IN UINT32 f_ulValue, - IN UINT32 f_ulTimeoutUs, - OUT PBOOL f_pfBitEqual ) -{ - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_GET_TIME StartTime; - tOCT6100_GET_TIME TimeoutTime; - tOCT6100_GET_TIME CurrentTime; - UINT32 ulResult; - UINT16 usReadData; - BOOL fConditionFlag = TRUE; - - /* Copy the process context. */ - StartTime.pProcessContext = f_pApiInstance->pProcessContext; - CurrentTime.pProcessContext = f_pApiInstance->pProcessContext; - - /* Get the current system time. */ - ulResult = Oct6100UserGetTime( &StartTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Mark the bit as not being equal, for now. */ - *f_pfBitEqual = FALSE; - - /* Determine the time at which the timeout has expired. */ - ulResult = octapi_lm_add( - StartTime.aulWallTimeUs, 1, - &f_ulTimeoutUs, 0, - TimeoutTime.aulWallTimeUs, 1 ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Prepare read structure. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.ulReadAddress = f_ulPcRegAdd; - ReadParams.pusReadData = &usReadData; - - /* Read the PC bit while the timeout period hasn't expired. */ - while ( fConditionFlag ) - { - /* Read the current time again to check for timeout. */ - ulResult = Oct6100UserGetTime( &CurrentTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - ulResult = Oct6100UserDriverReadApi( &ReadParams ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( ( UINT16 )((usReadData >> f_ulPcBitNum) & 0x1) == ( UINT16 )f_ulValue ) - { - /* Mark the bit as being equal. */ - *f_pfBitEqual = TRUE; - fConditionFlag = FALSE; - } - - if ( CurrentTime.aulWallTimeUs[ 1 ] > TimeoutTime.aulWallTimeUs[ 1 ] || - (CurrentTime.aulWallTimeUs[ 1 ] == TimeoutTime.aulWallTimeUs[ 1 ] && - CurrentTime.aulWallTimeUs[ 0 ] >= TimeoutTime.aulWallTimeUs[ 0 ]) ) - fConditionFlag = FALSE; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReadDword - -Description: Read a DWORD at specified address in external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulAddress DWORD address where to read. -f_pulReadData Resulting data. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReadDword -UINT32 Oct6100ApiReadDword( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulAddress, - OUT PUINT32 f_pulReadData ) -{ - tOCT6100_READ_PARAMS ReadParams; - UINT16 usReadData; - - UINT32 ulResult; - UINT32 ulTempData; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /*==================================================================================*/ - /* Read the first 16 bits. */ - ReadParams.ulReadAddress = f_ulAddress; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulTempData = usReadData << 16; - - /* Read the last 16 bits. */ - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulTempData |= usReadData; - - /*==================================================================================*/ - - /* Return the read value.*/ - *f_pulReadData = ulTempData; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteDword - -Description: Write a DWORD at specified address in external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulAddress DWORD address where to write. -f_ulWriteData DWORD data to write. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteDword -UINT32 Oct6100ApiWriteDword( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulAddress, - IN UINT32 f_ulWriteData ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Write the first 16 bits. */ - WriteParams.ulWriteAddress = f_ulAddress; - WriteParams.usWriteData = (UINT16)((f_ulWriteData >> 16) & 0xFFFF); - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write the last word. */ - WriteParams.ulWriteAddress += 2; - WriteParams.usWriteData = (UINT16)(f_ulWriteData & 0xFFFF); - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCreateFeatureMask - -Description: - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_ulFieldSize Size of the field, in bits. -f_ulFieldBitOffset Bit offset, from the least significant bit. -f_pulFieldMask Resulting mask. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCreateFeatureMask -VOID Oct6100ApiCreateFeatureMask( - IN UINT32 f_ulFieldSize, - IN UINT32 f_ulFieldBitOffset, - OUT PUINT32 f_pulFieldMask ) -{ - UINT32 ulMask; - UINT32 i; - - ulMask = 0; - - /* Create the mask based on the field size. */ - for ( i = 0; i < f_ulFieldSize; i++ ) - { - ulMask <<= 1; - ulMask |= 1; - } - - /* Once the mask is of the desired size, offset it to fit the field */ - /* within the DWORD read. */ - ulMask <<= f_ulFieldBitOffset; - - /* Return the mask. */ - *f_pulFieldMask = ulMask; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiStrStr - -Description: OCT6100 API version of strstr() - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_pszSource Source string to analyze. -f_pszString String to look for. -f_pszLastCharPtr Last character in the source string. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiStrStr -unsigned char const *Oct6100ApiStrStr( - IN unsigned char const *f_pszSource, - IN unsigned char const *f_pszString, - IN unsigned char const *f_pszLastCharPtr ) -{ - UINT32 ulCurrentPos; - UINT32 ulStringLength; - UINT32 ulNumMatchingCharFound = 0; - unsigned char const *pchFirstChar = NULL; - UINT32 ulSourceLength; - - if ( f_pszLastCharPtr < f_pszSource ) - return NULL; - - ulSourceLength = (UINT32)( f_pszLastCharPtr - f_pszSource ); - ulStringLength = Oct6100ApiStrLen( f_pszString ); - - for ( ulCurrentPos = 0; ulCurrentPos < ulSourceLength; ulCurrentPos++ ) - { - /* Check if the character matches. */ - if ( f_pszSource[ ulCurrentPos ] == f_pszString[ ulNumMatchingCharFound ] ) - { - if ( ulNumMatchingCharFound == 0 ) - pchFirstChar = ( f_pszSource + ulCurrentPos ); - - ulNumMatchingCharFound++; - - /* Check if the whole string matched. */ - if ( ulNumMatchingCharFound == ulStringLength ) - break; - } - else if ( ulNumMatchingCharFound != 0 ) - { - ulNumMatchingCharFound = 0; - - /* Reset the search, but take a look at the current character. It might */ - /* be the beginning of the string we are looking for. */ - if ( f_pszSource[ ulCurrentPos ] == f_pszString[ ulNumMatchingCharFound ] ) - { - pchFirstChar = ( f_pszSource + ulCurrentPos ); - ulNumMatchingCharFound++; - - /* Check if the whole string matched. */ - /* This check must be done in case we have the 1 character strstr */ - if ( ulNumMatchingCharFound == ulStringLength ) - break; - } - } - } - - if ( ulCurrentPos == ulSourceLength ) - return NULL; - else - return pchFirstChar; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiStrLen - -Description: OCT6100 API version of strlen() - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_pszString Source string to count length of. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiStrLen -UINT32 Oct6100ApiStrLen( - IN unsigned char const *f_pszString ) -{ - UINT32 ulCount = 0; - - while( f_pszString[ ulCount ] != '\0' ) - ulCount++; - - return ulCount; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAsciiToHex - -Description: Convert an ASCII character to an hexadecimal value. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_chCharacter ASCII character to convert. -f_pulValue Resulting hexadecimal value. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAsciiToHex -UINT32 Oct6100ApiAsciiToHex( - IN UINT8 f_chCharacter, - OUT PUINT32 f_pulValue ) -{ - switch ( f_chCharacter ) - { - case '0': - (*f_pulValue) = 0x0; - break; - case '1': - (*f_pulValue) = 0x1; - break; - case '2': - (*f_pulValue) = 0x2; - break; - case '3': - (*f_pulValue) = 0x3; - break; - case '4': - (*f_pulValue) = 0x4; - break; - case '5': - (*f_pulValue) = 0x5; - break; - case '6': - (*f_pulValue) = 0x6; - break; - case '7': - (*f_pulValue) = 0x7; - break; - case '8': - (*f_pulValue) = 0x8; - break; - case '9': - (*f_pulValue) = 0x9; - break; - case 'A': - case 'a': - (*f_pulValue) = 0xA; - break; - case 'B': - case 'b': - (*f_pulValue) = 0xB; - break; - case 'C': - case 'c': - (*f_pulValue) = 0xC; - break; - case 'D': - case 'd': - (*f_pulValue) = 0xD; - break; - case 'E': - case 'e': - (*f_pulValue) = 0xE; - break; - case 'F': - case 'f': - (*f_pulValue) = 0xF; - break; - default: - (*f_pulValue) = 0x0; - return cOCT6100_ERR_MISC_ASCII_CONVERSION_FAILED; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiHexToAscii - -Description: Convert an hexadecimal value to an ASCII character. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_ulNumber Hexadecimal value to convert. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiHexToAscii -UINT8 Oct6100ApiHexToAscii( - IN UINT32 f_ulNumber ) -{ - if ( f_ulNumber >= 0xA ) - return (UINT8)( 55 + f_ulNumber ); /* Hex values from 0xA to 0xF */ - else - return (UINT8)( 48 + f_ulNumber ); /* Hex values from 0x0 to 0x9 */ -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRand - -Description: Random number generator. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_ulRange Range of the random number to be generated. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRand -UINT32 Oct6100ApiRand( - IN UINT32 f_ulRange ) -{ - static UINT32 ulRandomSeed = 0x12345678; - UINT32 ulBit0; - - UINT32 i, j; - UINT16 ulWithinRange = FALSE; - - UINT32 ulResult = cOCT6100_ERR_OK; - UINT16 ulLoop; - - UINT32 ulRangeMask; - UINT32 ulAddedValue; - - - ulRangeMask = 1; - ulLoop = TRUE; - i = 1; - - while ( ulLoop ) - { - - ulAddedValue = 2; - for ( j = 1; j < i; j++ ) - ulAddedValue *= 2; - - ulRangeMask = ulRangeMask + ulAddedValue; - - if ( ulRangeMask >= f_ulRange ) - ulLoop = FALSE; - - i++; - } - - while ( !ulWithinRange ) - { - ulBit0 = ((ulRandomSeed >> 19) & 0x1) ^ ((ulRandomSeed >> 16) & 0x1); - ulRandomSeed = ((ulRandomSeed << 1) & 0xFFFFF) | ulBit0; - - ulResult = ulRandomSeed & ulRangeMask; - - if ( ulResult <= f_ulRange ) - ulWithinRange = TRUE; - } - - return ulResult; -} -#endif diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_mixer.c b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_mixer.c deleted file mode 100644 index 05aff3b..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_mixer.c +++ /dev/null @@ -1,1586 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_mixer.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains the functions used to manage the allocation of mixer - blocks in memories. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 42 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_apiud.h" -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_channel_inst.h" -#include "oct6100api/oct6100_mixer_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_mixer_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_mixer_priv.h" - -/**************************** PUBLIC FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100MixerCopyEventCreate - -Description: This function creates a mixer copy event used to copy - information from one channel port to another channel port. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pCopyEventCreate Pointer to a mixer copy event structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100MixerCopyEventCreateDef -UINT32 Oct6100MixerCopyEventCreateDef( - tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate ) -{ - f_pCopyEventCreate->pulCopyEventHndl = NULL; - - f_pCopyEventCreate->ulSourceChanHndl = cOCT6100_INVALID_HANDLE; - f_pCopyEventCreate->ulSourcePort = cOCT6100_INVALID_PORT; - - f_pCopyEventCreate->ulDestinationChanHndl = cOCT6100_INVALID_HANDLE; - f_pCopyEventCreate->ulDestinationPort = cOCT6100_INVALID_PORT; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100MixerCopyEventCreate -UINT32 Oct6100MixerCopyEventCreate( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100MixerCopyEventCreateSer( f_pApiInstance, f_pCopyEventCreate ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100MixerCopyEventDestroy - -Description: This function destroys a mixer copy event used to copy - information from one channel port to another. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pCopyEventDestroy Pointer to a destroy copy event structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100MixerCopyEventDestroyDef -UINT32 Oct6100MixerCopyEventDestroyDef( - tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy ) -{ - f_pCopyEventDestroy->ulCopyEventHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100MixerCopyEventDestroy -UINT32 Oct6100MixerCopyEventDestroy( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100MixerCopyEventDestroySer( f_pApiInstance, f_pCopyEventDestroy ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetMixerSwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management of mixer events. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_pOpenChip User chip configuration. -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetMixerSwSizes -UINT32 Oct6100ApiGetMixerSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulTempVar; - UINT32 ulResult; - - /* Calculate the API memory required for the resource entry lists. */ - f_pInstSizes->ulMixerEventList = cOCT6100_MAX_MIXER_EVENTS * sizeof( tOCT6100_API_MIXER_EVENT ); - - /* Calculate memory needed for mixers entry allocation. */ - ulResult = OctapiLlmAllocGetSize( cOCT6100_MAX_MIXER_EVENTS, &f_pInstSizes->ulMixerEventAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_1D; - - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulMixerEventList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulMixerEventAlloc, ulTempVar ) - - - f_pInstSizes->ulCopyEventList = cOCT6100_MAX_MIXER_EVENTS * sizeof( tOCT6100_API_COPY_EVENT ); - - ulResult = OctapiLlmAllocGetSize( cOCT6100_MAX_MIXER_EVENTS, &f_pInstSizes->ulCopyEventAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_1D; - - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulCopyEventList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulCopyEventAlloc, ulTempVar ) - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiMixerSwInit - -Description: Initializes all elements of the instance structure associated - to the mixer events. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This mixer is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiMixerSwInit -UINT32 Oct6100ApiMixerSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_MIXER_EVENT pMixerEventList; - PVOID pMixerEventAlloc; - PVOID pCopyEventAlloc; - UINT32 ulTempVar; - UINT32 ulResult; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /*===================================================================*/ - /* Initialize the mixer event list. */ - mOCT6100_GET_MIXER_EVENT_LIST_PNT( pSharedInfo, pMixerEventList ); - - /* Initialize the mixer event allocation software to "all free". */ - Oct6100UserMemSet( pMixerEventList, 0x00, cOCT6100_MAX_MIXER_EVENTS * sizeof( tOCT6100_API_MIXER_EVENT )); - - mOCT6100_GET_MIXER_EVENT_ALLOC_PNT( pSharedInfo, pMixerEventAlloc ) - - ulResult = OctapiLlmAllocInit( &pMixerEventAlloc, cOCT6100_MAX_MIXER_EVENTS ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_1F; - - /* Now reserve the first entry as the first node. */ - ulResult = OctapiLlmAllocAlloc( pMixerEventAlloc, &ulTempVar ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_20; - } - - /* Check that we obtain the first event. */ - if ( ulTempVar != 0 ) - return cOCT6100_ERR_FATAL_21; - - /* Now reserve the tail entry. */ - ulResult = OctapiLlmAllocAlloc( pMixerEventAlloc, &ulTempVar ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_AA; - } - /* Check that we obtain the first event. */ - if ( ulTempVar != 1 ) - return cOCT6100_ERR_FATAL_AB; - - /* Program the head node. */ - pMixerEventList[ cOCT6100_MIXER_HEAD_NODE ].fReserved = TRUE; - pMixerEventList[ cOCT6100_MIXER_HEAD_NODE ].usNextEventPtr = cOCT6100_MIXER_TAIL_NODE; - pMixerEventList[ cOCT6100_MIXER_HEAD_NODE ].usEventType = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - /* Program the tail node. */ - pMixerEventList[ cOCT6100_MIXER_TAIL_NODE ].fReserved = TRUE; - pMixerEventList[ cOCT6100_MIXER_TAIL_NODE ].usNextEventPtr = cOCT6100_INVALID_INDEX; - pMixerEventList[ cOCT6100_MIXER_TAIL_NODE ].usEventType = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - /* Now reserve the entry used for channel recording if the feature is enabled. */ - if ( pSharedInfo->ChipConfig.fEnableChannelRecording == TRUE ) - { - UINT32 ulAllocIndex; - - /* Reserve an entry to copy the desire SOUT signal to the SIN signal of the recording channel. */ - ulResult = OctapiLlmAllocAlloc( pMixerEventAlloc, &ulAllocIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_90; - } - - pSharedInfo->MixerInfo.usRecordCopyEventIndex = (UINT16)( ulAllocIndex & 0xFFFF ); - - /* Reserve an entry to copy the saved SIN signal of the debugged channel into it's original location. */ - ulResult = OctapiLlmAllocAlloc( pMixerEventAlloc, &ulAllocIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_90; - } - - pSharedInfo->MixerInfo.usRecordSinEventIndex = (UINT16)( ulAllocIndex & 0xFFFF ); - - /* Configure the SIN event. */ - pMixerEventList[ pSharedInfo->MixerInfo.usRecordSinEventIndex ].fReserved = TRUE; - pMixerEventList[ pSharedInfo->MixerInfo.usRecordSinEventIndex ].usNextEventPtr = cOCT6100_MIXER_TAIL_NODE; - pMixerEventList[ pSharedInfo->MixerInfo.usRecordSinEventIndex ].usEventType = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - /* Configure the SOUT copy event. */ - pMixerEventList[ pSharedInfo->MixerInfo.usRecordCopyEventIndex ].fReserved = TRUE; - pMixerEventList[ pSharedInfo->MixerInfo.usRecordCopyEventIndex ].usNextEventPtr = pSharedInfo->MixerInfo.usRecordSinEventIndex; - pMixerEventList[ pSharedInfo->MixerInfo.usRecordCopyEventIndex ].usEventType = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - /* Program the head node. */ - pMixerEventList[ cOCT6100_MIXER_HEAD_NODE ].usNextEventPtr = pSharedInfo->MixerInfo.usRecordCopyEventIndex; - } - - /* Initialize the copy event list. */ - mOCT6100_GET_COPY_EVENT_ALLOC_PNT( pSharedInfo, pCopyEventAlloc ) - - ulResult = OctapiLlmAllocInit( &pCopyEventAlloc, cOCT6100_MAX_MIXER_EVENTS ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_B4; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiMixerEventAdd - -Description: This function adds a mixer event event to the list of events - based on the event type passed to the function. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. -f_usEventIndex Index of the event within the API's mixer event list. -f_usEventType Type of mixer event. -f_usDestinationChanIndex Index of the destination channel within the API's - channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiMixerEventAdd -UINT32 Oct6100ApiMixerEventAdd( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEventIndex, - IN UINT16 f_usEventType, - IN UINT16 f_usDestinationChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_MIXER_EVENT pCurrentEventEntry; - tPOCT6100_API_MIXER_EVENT pTempEventEntry; - tPOCT6100_API_CHANNEL pDestinationEntry; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - UINT16 usTempEventIndex; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Get a pointer to the event entry. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pCurrentEventEntry, f_usEventIndex ); - - /* Get a pointer to the destination channel entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pDestinationEntry, f_usDestinationChanIndex ); - - /* Now proceed according to the event type. */ - switch ( f_usEventType ) - { - case cOCT6100_EVENT_TYPE_SOUT_COPY: - - /* Now insert the Sin copy event */ - if ( pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr == cOCT6100_INVALID_INDEX ) - { - /* The only node in the list before the point where the node needs to */ - /* be inserted is the head node. */ - usTempEventIndex = cOCT6100_MIXER_HEAD_NODE; - - /* This node will be the first one in the Sout copy section. */ - pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr = f_usEventIndex; - pSharedInfo->MixerInfo.usLastSoutCopyEventPtr = f_usEventIndex; - } - else /* pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr != cOCT6100_INVALID_INDEX */ - { - usTempEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr; - pSharedInfo->MixerInfo.usLastSoutCopyEventPtr = f_usEventIndex; - } - - break; - - case cOCT6100_EVENT_TYPE_SIN_COPY: - - /* Now insert the Sin copy event. */ - if ( pSharedInfo->MixerInfo.usFirstSinCopyEventPtr == cOCT6100_INVALID_INDEX ) - { - /* This is the first Sin copy event. We must find the event that comes before */ - /* the event we want to add. First let's check for a bridge event. */ - if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr == cOCT6100_INVALID_INDEX ) - { - /* No event in the bridge section, now let's check in the Sout copy section. */ - if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr == cOCT6100_INVALID_INDEX ) - { - /* The only node in the list then is the head node. */ - usTempEventIndex = cOCT6100_MIXER_HEAD_NODE; - } - else - { - usTempEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr; - } - } - else - { - usTempEventIndex = pSharedInfo->MixerInfo.usLastBridgeEventPtr; - } - - /* This node will be the first one in the Sin copy section. */ - pSharedInfo->MixerInfo.usFirstSinCopyEventPtr = f_usEventIndex; - pSharedInfo->MixerInfo.usLastSinCopyEventPtr = f_usEventIndex; - } - else /* pSharedInfo->MixerInfo.usFirstSinCopyEventPtr != cOCT6100_INVALID_INDEX */ - { - usTempEventIndex = pSharedInfo->MixerInfo.usLastSinCopyEventPtr; - pSharedInfo->MixerInfo.usLastSinCopyEventPtr = f_usEventIndex; - } - - break; - - default: - return cOCT6100_ERR_FATAL_AF; - - } - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, usTempEventIndex ); - - /*=======================================================================*/ - /* Program the Copy event. */ - - /* Set the Copy event first. */ - pCurrentEventEntry->usEventType = cOCT6100_MIXER_CONTROL_MEM_COPY; - pCurrentEventEntry->usNextEventPtr = pTempEventEntry->usNextEventPtr; - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - WriteParams.usWriteData = pCurrentEventEntry->usNextEventPtr; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Modify the previous node. */ - - /* Set the last Sub-store entry. */ - pTempEventEntry->usNextEventPtr = f_usEventIndex; - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usTempEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - WriteParams.usWriteData = f_usEventIndex; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Save the destination channel index, needed when removing the event from the mixer. */ - pCurrentEventEntry->usDestinationChanIndex = f_usDestinationChanIndex; - - /* Mark the entry as reserved. */ - pCurrentEventEntry->fReserved = TRUE; - - /* Increment the event count on that particular destination channel */ - pDestinationEntry->usMixerEventCnt++; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiMixerEventRemove - -Description: This function removes a mixer event event from the list of events based - on the event type passed to the function. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usEventIndex Index of event within the API's mixer event list. -f_usEventType Type of mixer event. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiMixerEventRemove -UINT32 Oct6100ApiMixerEventRemove( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEventIndex, - IN UINT16 f_usEventType ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_MIXER_EVENT pCurrentEventEntry; - tPOCT6100_API_MIXER_EVENT pTempEventEntry; - tPOCT6100_API_CHANNEL pDestinationEntry; - tOCT6100_WRITE_BURST_PARAMS BurstWriteParams; - tOCT6100_WRITE_PARAMS WriteParams; - BOOL fFirstSinCopyEvent = FALSE; - UINT32 ulResult; - UINT16 usTempEventIndex; - UINT32 ulLoopCount = 0; - UINT16 ausWriteData[ 4 ] = { 0 }; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - BurstWriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - BurstWriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - BurstWriteParams.pusWriteData = ausWriteData; - BurstWriteParams.ulWriteLength = 4; - - /* Get a pointer to the event entry. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pCurrentEventEntry, f_usEventIndex ); - - /* Get the pointer to the channel entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pDestinationEntry, pCurrentEventEntry->usDestinationChanIndex ); - - /* Now proceed according to the event type. */ - switch ( f_usEventType ) - { - case cOCT6100_EVENT_TYPE_SOUT_COPY: - - if ( f_usEventIndex == pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr ) - { - usTempEventIndex = cOCT6100_MIXER_HEAD_NODE; - } - else - { - /* Now insert the Sin copy event. */ - usTempEventIndex = pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr; - } - - /* Find the copy entry before the entry to remove. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, usTempEventIndex ); - - while( pTempEventEntry->usNextEventPtr != f_usEventIndex ) - { - usTempEventIndex = pTempEventEntry->usNextEventPtr; - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, usTempEventIndex ); - - ulLoopCount++; - if ( ulLoopCount == cOCT6100_MAX_LOOP ) - return cOCT6100_ERR_FATAL_B2; - } - - /*=======================================================================*/ - /* Update the global mixer pointers. */ - if ( f_usEventIndex == pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr ) - { - if ( f_usEventIndex == pSharedInfo->MixerInfo.usLastSoutCopyEventPtr ) - { - /* This event was the only of the list.*/ - pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usLastSoutCopyEventPtr = cOCT6100_INVALID_INDEX; - } - else - { - pSharedInfo->MixerInfo.usFirstSoutCopyEventPtr = pCurrentEventEntry->usNextEventPtr; - } - } - else if ( f_usEventIndex == pSharedInfo->MixerInfo.usLastSoutCopyEventPtr ) - { - pSharedInfo->MixerInfo.usLastSoutCopyEventPtr = usTempEventIndex; - } - /*=======================================================================*/ - - break; - - - case cOCT6100_EVENT_TYPE_SIN_COPY: - - if ( f_usEventIndex == pSharedInfo->MixerInfo.usFirstSinCopyEventPtr ) - { - fFirstSinCopyEvent = TRUE; - - if ( pSharedInfo->MixerInfo.usLastBridgeEventPtr != cOCT6100_INVALID_INDEX ) - { - usTempEventIndex = pSharedInfo->MixerInfo.usLastBridgeEventPtr; - } - else if ( pSharedInfo->MixerInfo.usLastSoutCopyEventPtr != cOCT6100_INVALID_INDEX ) - { - usTempEventIndex = pSharedInfo->MixerInfo.usLastSoutCopyEventPtr; - } - else - { - usTempEventIndex = cOCT6100_MIXER_HEAD_NODE; - } - } - else - { - /* Now insert the Sin copy event. */ - usTempEventIndex = pSharedInfo->MixerInfo.usFirstSinCopyEventPtr; - } - - /* Find the copy entry before the entry to remove. */ - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, usTempEventIndex ); - - /* If we are not the first event of the Sin copy list. */ - if ( fFirstSinCopyEvent == FALSE ) - { - while( pTempEventEntry->usNextEventPtr != f_usEventIndex ) - { - usTempEventIndex = pTempEventEntry->usNextEventPtr; - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, usTempEventIndex ); - - ulLoopCount++; - if ( ulLoopCount == cOCT6100_MAX_LOOP ) - return cOCT6100_ERR_FATAL_B1; - } - } - - /*=======================================================================*/ - /* Update the global mixer pointers. */ - if ( f_usEventIndex == pSharedInfo->MixerInfo.usFirstSinCopyEventPtr ) - { - if ( f_usEventIndex == pSharedInfo->MixerInfo.usLastSinCopyEventPtr ) - { - /* This event was the only of the list. */ - pSharedInfo->MixerInfo.usFirstSinCopyEventPtr = cOCT6100_INVALID_INDEX; - pSharedInfo->MixerInfo.usLastSinCopyEventPtr = cOCT6100_INVALID_INDEX; - } - else - { - pSharedInfo->MixerInfo.usFirstSinCopyEventPtr = pCurrentEventEntry->usNextEventPtr; - } - } - else if ( f_usEventIndex == pSharedInfo->MixerInfo.usLastSinCopyEventPtr ) - { - pSharedInfo->MixerInfo.usLastSinCopyEventPtr = usTempEventIndex; - } - /*=======================================================================*/ - - break; - - default: - return cOCT6100_ERR_FATAL_B0; - - } - - /*=======================================================================*/ - /* Modify the previous event. */ - - pTempEventEntry->usNextEventPtr = pCurrentEventEntry->usNextEventPtr; - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( usTempEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.ulWriteAddress += 4; - WriteParams.usWriteData = pTempEventEntry->usNextEventPtr; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Clear the current event. */ - - BurstWriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - mOCT6100_DRIVER_WRITE_BURST_API( BurstWriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Decrement the mixer event count active on that channel. */ - pDestinationEntry->usMixerEventCnt--; - - /*=======================================================================*/ - - - /*=======================================================================*/ - - /* This index of this channel is not valid anymore! */ - pCurrentEventEntry->usDestinationChanIndex = cOCT6100_INVALID_INDEX; - - /* Mark this entry as free. */ - pCurrentEventEntry->fReserved = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100MixerCopyEventCreateSer - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pCopyEventCreate Pointer to a create copy event structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100MixerCopyEventCreateSer -UINT32 Oct6100MixerCopyEventCreateSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate ) -{ - UINT16 usCopyEventIndex = 0; - UINT16 usMixerEventIndex = 0; - UINT16 usSourceChanIndex; - UINT16 usDestinationChanIndex; - UINT32 ulResult; - - /* Check the user's configuration of the copy event for errors. */ - ulResult = Oct6100ApiCheckCopyEventCreateParams( f_pApiInstance, - f_pCopyEventCreate, - &usSourceChanIndex, - &usDestinationChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reserve all resources needed by the copy event. */ - ulResult = Oct6100ApiReserveCopyEventCreateResources( f_pApiInstance, - &usCopyEventIndex, - &usMixerEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write all necessary structures to activate the echo cancellation channel. */ - ulResult = Oct6100ApiWriteCopyEventCreateStructs( f_pApiInstance, - f_pCopyEventCreate, - usMixerEventIndex, - usSourceChanIndex, - usDestinationChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the new echo cancellation channels's entry in the ECHO channel list. */ - ulResult = Oct6100ApiUpdateCopyEventCreateEntry( f_pApiInstance, - f_pCopyEventCreate, - usCopyEventIndex, - usMixerEventIndex, - usSourceChanIndex, - usDestinationChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckCopyEventCreateParams - -Description: Checks the user's parameter passed to the create - copy event function. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pCopyEventCreate Pointer to a create copy event structure. -f_pusSourceChanIndex Pointer to the index of the input channel. -f_pusDestinationChanIndex Pointer to the index of the output channel. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckCopyEventCreateParams -UINT32 Oct6100ApiCheckCopyEventCreateParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate, - OUT PUINT16 f_pusSourceChanIndex, - OUT PUINT16 f_pusDestinationChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pSourceEntry; - tPOCT6100_API_CHANNEL pDestinationEntry; - UINT32 ulEntryOpenCnt; - - /* Obtain shared resources pointer. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - if ( f_pCopyEventCreate->pulCopyEventHndl == NULL ) - return cOCT6100_ERR_MIXER_COPY_EVENT_HANDLE; - - if ( f_pCopyEventCreate->ulSourceChanHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_MIXER_SOURCE_CHAN_HANDLE; - if ( f_pCopyEventCreate->ulDestinationChanHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_MIXER_DESTINATION_CHAN_HANDLE; - - if ( f_pCopyEventCreate->ulSourcePort != cOCT6100_CHANNEL_PORT_RIN && - f_pCopyEventCreate->ulSourcePort != cOCT6100_CHANNEL_PORT_SIN ) - return cOCT6100_ERR_MIXER_SOURCE_PORT; - - if ( f_pCopyEventCreate->ulDestinationPort != cOCT6100_CHANNEL_PORT_RIN && - f_pCopyEventCreate->ulDestinationPort != cOCT6100_CHANNEL_PORT_SIN ) - return cOCT6100_ERR_MIXER_DESTINATION_PORT; - - /*=======================================================================*/ - /* Verify the first channel handle. */ - - if ( (f_pCopyEventCreate->ulSourceChanHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_MIXER_SOURCE_CHAN_HANDLE; - - *f_pusSourceChanIndex = (UINT16)( f_pCopyEventCreate->ulSourceChanHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusSourceChanIndex >= pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_MIXER_SOURCE_CHAN_HANDLE; - - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pSourceEntry, *f_pusSourceChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pCopyEventCreate->ulSourceChanHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pSourceEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pSourceEntry->byEntryOpenCnt ) - return cOCT6100_ERR_MIXER_SOURCE_CHAN_HANDLE; - if ( pSourceEntry->CodecConfig.byDecoderPort == f_pCopyEventCreate->ulSourcePort ) - return cOCT6100_ERR_MIXER_SOURCE_ADPCM_RESOURCES_ACTIVATED; - - /*=======================================================================*/ - - /*=======================================================================*/ - /* Verify the second channel handle. */ - - if ( (f_pCopyEventCreate->ulDestinationChanHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_MIXER_DESTINATION_CHAN_HANDLE; - - *f_pusDestinationChanIndex = (UINT16)( f_pCopyEventCreate->ulDestinationChanHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusDestinationChanIndex >= pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_MIXER_DESTINATION_CHAN_HANDLE; - - /* Get a pointer to the channel's list entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pDestinationEntry, *f_pusDestinationChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pCopyEventCreate->ulDestinationChanHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pDestinationEntry->fReserved != TRUE ) - return cOCT6100_ERR_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pDestinationEntry->byEntryOpenCnt ) - return cOCT6100_ERR_MIXER_DESTINATION_CHAN_HANDLE; - if ( pDestinationEntry->CodecConfig.byDecoderPort == f_pCopyEventCreate->ulDestinationPort ) - return cOCT6100_ERR_MIXER_DEST_ADPCM_RESOURCES_ACTIVATED; - - /*=======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveCopyEventCreateResources - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pusCopyEntryIndex Pointer to the index of the copy entry within the API's list. -f_pusCopyEventIndex Pointer to the index of the mixer copy event. -. -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveCopyEventCreateResources -UINT32 Oct6100ApiReserveCopyEventCreateResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusCopyEntryIndex, - IN OUT PUINT16 f_pusCopyEventIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult = cOCT6100_ERR_OK; - UINT32 ulTempVar; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /*===============================================================================*/ - /* Verify and reserve the resources that might already be allocated. */ - - ulResult = Oct6100ApiReserveCopyEventEntry( f_pApiInstance, - f_pusCopyEntryIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Reserve the source copy event for the first channel. */ - ulResult = Oct6100ApiReserveMixerEventEntry( f_pApiInstance, - f_pusCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - /* Reserve the Sin copy event for the first channel. */ - ulTempVar = Oct6100ApiReleaseCopyEventEntry ( f_pApiInstance, - *f_pusCopyEntryIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteCopyEventCreateStructs - -Description: Performs all the required structure writes to configure the - new copy event - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pCopyEventCreate Pointer to a create copy event structure. -f_usMixerEventIndex Index of the copy event within the mixer memory. -f_usSourceChanIndex Index of the source channel within the API's channel list. -f_usDestinationChanIndex Index of the destination channel within the API's channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteCopyEventCreateStructs -UINT32 Oct6100ApiWriteCopyEventCreateStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate, - IN UINT16 f_usMixerEventIndex, - IN UINT16 f_usSourceChanIndex, - IN UINT16 f_usDestinationChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pSourceEntry; - tPOCT6100_API_CHANNEL pDestinationEntry; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*==============================================================================*/ - /* Get a pointer to the two channel entry. */ - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pSourceEntry, f_usSourceChanIndex ); - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pDestinationEntry, f_usDestinationChanIndex ); - - /*==============================================================================*/ - /* Configure the TSST control memory and add the Sin copy event if necessary. */ - - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usMixerEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_COPY; - - if ( f_pCopyEventCreate->ulSourcePort == cOCT6100_CHANNEL_PORT_RIN ) - { - WriteParams.usWriteData |= pSourceEntry->usRinRoutTsiMemIndex; - WriteParams.usWriteData |= pSourceEntry->TdmConfig.byRinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - } - else /* f_pCopyEventCreate->ulSourcePort == cOCT6100_CHANNEL_PORT_SIN */ - { - if ( pSourceEntry->usExtraSinTsiMemIndex != cOCT6100_INVALID_INDEX ) - { - WriteParams.usWriteData |= pSourceEntry->usExtraSinTsiMemIndex; - } - else - { - WriteParams.usWriteData |= pSourceEntry->usSinSoutTsiMemIndex; - } - - WriteParams.usWriteData |= pSourceEntry->TdmConfig.bySinPcmLaw << cOCT6100_MIXER_CONTROL_MEM_LAW_OFFSET; - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - WriteParams.ulWriteAddress += 2; - - if ( f_pCopyEventCreate->ulDestinationPort == cOCT6100_CHANNEL_PORT_RIN ) - { - WriteParams.usWriteData = (UINT16)( pDestinationEntry->usRinRoutTsiMemIndex ); - } - else /* f_pCopyEventCreate->ulDestinationPort == cOCT6100_CHANNEL_PORT_SIN */ - { - WriteParams.usWriteData = (UINT16)( pDestinationEntry->usSinSoutTsiMemIndex ); - } - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Now insert the event into the event list. */ - ulResult = Oct6100ApiMixerEventAdd( f_pApiInstance, - f_usMixerEventIndex, - cOCT6100_EVENT_TYPE_SIN_COPY, - f_usDestinationChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Increment the copy event count on this channel. */ - pDestinationEntry->usCopyEventCnt++; - - /*==============================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateCopyEventCreateEntry - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. -f_pCopyEventCreate Pointer to a create copy event structure. -f_usCopyEventIndex Index of the copy event within the API's event list. -f_usMixerEventIndex Index of the copy event within the mixer memory. -f_usSourceChanIndex Index of the source channel within the API's channel list. -f_usDestinationChanIndex Index of the destination channel within the API's channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateCopyEventCreateEntry -UINT32 Oct6100ApiUpdateCopyEventCreateEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate, - IN UINT16 f_usCopyEventIndex, - IN UINT16 f_usMixerEventIndex, - IN UINT16 f_usSourceChanIndex, - IN UINT16 f_usDestinationChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_COPY_EVENT pCopyEventEntry; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Obtain a pointer to the new buffer's list entry. */ - mOCT6100_GET_COPY_EVENT_ENTRY_PNT( pSharedInfo, pCopyEventEntry, f_usCopyEventIndex ); - - /*=======================================================================*/ - /* Copy the channel's configuration and allocated resources. */ - - /* Save the channel info in the copy event. */ - pCopyEventEntry->usSourceChanIndex = f_usSourceChanIndex; - pCopyEventEntry->bySourcePort = (UINT8)( f_pCopyEventCreate->ulSourcePort & 0xFF ); - - pCopyEventEntry->usDestinationChanIndex = f_usDestinationChanIndex; - pCopyEventEntry->byDestinationPort = (UINT8)( f_pCopyEventCreate->ulDestinationPort & 0xFF ); - - pCopyEventEntry->usMixerEventIndex = f_usMixerEventIndex; - - /*=======================================================================*/ - - /* Form handle returned to user. */ - *f_pCopyEventCreate->pulCopyEventHndl = cOCT6100_HNDL_TAG_COPY_EVENT | (pCopyEventEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_usCopyEventIndex; - - /* Finally, mark the event as used. */ - pCopyEventEntry->fReserved = TRUE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100MixerCopyEventDestroySer - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pCopyEventDestroy Pointer to a destroy copy event structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100MixerCopyEventDestroySer -UINT32 Oct6100MixerCopyEventDestroySer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy ) -{ - UINT16 usCopyEventIndex; - UINT16 usMixerEventIndex; - UINT32 ulResult; - - /* Verify that all the parameters given match the state of the API. */ - ulResult = Oct6100ApiAssertCopyEventDestroyParams( f_pApiInstance, - f_pCopyEventDestroy, - &usCopyEventIndex, - &usMixerEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the echo cancellation channel. */ - ulResult = Oct6100ApiInvalidateCopyEventStructs( f_pApiInstance, - usCopyEventIndex, - usMixerEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the echo cancellation channel. */ - ulResult = Oct6100ApiReleaseCopyEventResources( f_pApiInstance, - usCopyEventIndex, - usMixerEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Invalidate the handle. */ - f_pCopyEventDestroy->ulCopyEventHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertCopyEventDestroyParams - -Description: - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pCopyEventDestroy Pointer to a destroy copy event structure. -f_pusCopyEventIndex Pointer to the index of the copy event in the API. -f_pusMixerEventIndex Pointer to the index of the copy event in the mixer memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertCopyEventDestroyParams -UINT32 Oct6100ApiAssertCopyEventDestroyParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy, - IN OUT PUINT16 f_pusCopyEventIndex, - IN OUT PUINT16 f_pusMixerEventIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_COPY_EVENT pCopyEventEntry; - UINT32 ulEntryOpenCnt; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check the provided handle. */ - if ( (f_pCopyEventDestroy->ulCopyEventHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_COPY_EVENT ) - return cOCT6100_ERR_MIXER_COPY_EVENT_HANDLE; - - *f_pusCopyEventIndex = (UINT16)( f_pCopyEventDestroy->ulCopyEventHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusCopyEventIndex >= cOCT6100_MAX_MIXER_EVENTS ) - return cOCT6100_ERR_MIXER_COPY_EVENT_HANDLE; - - /*=======================================================================*/ - - mOCT6100_GET_COPY_EVENT_ENTRY_PNT( pSharedInfo, pCopyEventEntry, *f_pusCopyEventIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = ( f_pCopyEventDestroy->ulCopyEventHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pCopyEventEntry->fReserved != TRUE ) - return cOCT6100_ERR_MIXER_EVENT_NOT_OPEN; - if ( ulEntryOpenCnt != pCopyEventEntry->byEntryOpenCnt ) - return cOCT6100_ERR_MIXER_COPY_EVENT_HANDLE; - - /*=======================================================================*/ - - /* Return the index of the associated event. */ - *f_pusMixerEventIndex = pCopyEventEntry->usMixerEventIndex; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInvalidateCopyEventStructs - -Description: Destroy the link between the two channels. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usCopyEventIndex Index of the copy event in the API. -f_usMixerEventIndex Index of the copy event in the mixer memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInvalidateCopyEventStructs -UINT32 Oct6100ApiInvalidateCopyEventStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usCopyEventIndex, - IN UINT16 f_usMixerEventIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*=======================================================================*/ - /* Clear the Copy event. */ - WriteParams.ulWriteAddress = cOCT6100_MIXER_CONTROL_MEM_BASE + ( f_usMixerEventIndex * cOCT6100_MIXER_CONTROL_MEM_ENTRY_SIZE ); - WriteParams.usWriteData = cOCT6100_MIXER_CONTROL_MEM_NO_OP; - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - /* Remove the event from the list. */ - ulResult = Oct6100ApiMixerEventRemove( f_pApiInstance, - f_usMixerEventIndex, - cOCT6100_EVENT_TYPE_SIN_COPY ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseCopyEventResources - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usCopyEventIndex Index of the copy event in the API. -f_usMixerEventIndex Index of the copy event in the mixer memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseCopyEventResources -UINT32 Oct6100ApiReleaseCopyEventResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usCopyEventIndex, - IN UINT16 f_usMixerEventIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHANNEL pDestinationEntry; - tPOCT6100_API_COPY_EVENT pCopyEventEntry; - tPOCT6100_API_MIXER_EVENT pTempEventEntry; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_COPY_EVENT_ENTRY_PNT( pSharedInfo, pCopyEventEntry, f_usCopyEventIndex ); - - ulResult = Oct6100ApiReleaseCopyEventEntry( f_pApiInstance, f_usCopyEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_AC; - - /* Relese the SIN copy event. */ - ulResult = Oct6100ApiReleaseMixerEventEntry( f_pApiInstance, f_usMixerEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_B3; - - mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pTempEventEntry, f_usMixerEventIndex ); - - /* Invalidate the entry. */ - pTempEventEntry->fReserved = FALSE; - pTempEventEntry->usEventType = cOCT6100_INVALID_INDEX; - pTempEventEntry->usNextEventPtr = cOCT6100_INVALID_INDEX; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pDestinationEntry, pCopyEventEntry->usDestinationChanIndex ); - - /* Decrement the copy event count on this channel. */ - pDestinationEntry->usCopyEventCnt--; - - /*=======================================================================*/ - - /* Mark the event entry as unused. */ - pCopyEventEntry->fReserved = FALSE; - pCopyEventEntry->byEntryOpenCnt++; - - /*=======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveMixerEventEntry - -Description: Reserves a free entry in the mixer event list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pusEventIndex List entry reserved. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveMixerEventEntry -UINT32 Oct6100ApiReserveMixerEventEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusEventIndex ) -{ - PVOID pMixerEventAlloc; - UINT32 ulResult; - UINT32 ulEventIndex; - - mOCT6100_GET_MIXER_EVENT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pMixerEventAlloc ) - - ulResult = OctapiLlmAllocAlloc( pMixerEventAlloc, &ulEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_MIXER_ALL_MIXER_EVENT_ENTRY_OPENED; - else - return cOCT6100_ERR_FATAL_2B; - } - - *f_pusEventIndex = (UINT16)( ulEventIndex & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseMixerEventEntry - -Description: Release an entry from the mixer event list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usEventIndex List entry reserved. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseMixerEventEntry -UINT32 Oct6100ApiReleaseMixerEventEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEventIndex ) -{ - PVOID pMixerEventAlloc; - UINT32 ulResult; - - mOCT6100_GET_MIXER_EVENT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pMixerEventAlloc ) - - ulResult = OctapiLlmAllocDealloc( pMixerEventAlloc, f_usEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_2C; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetFreeMixerEventCnt - -Description: Retrieve the number of events left in the list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pulFreeEventCnt How many events left. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetFreeMixerEventCnt -UINT32 Oct6100ApiGetFreeMixerEventCnt( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT32 f_pulFreeEventCnt ) -{ - PVOID pMixerEventAlloc; - UINT32 ulResult; - UINT32 ulAllocatedEvents; - UINT32 ulAvailableEvents; - - mOCT6100_GET_MIXER_EVENT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pMixerEventAlloc ) - - ulResult = OctapiLlmAllocInfo( pMixerEventAlloc, &ulAllocatedEvents, &ulAvailableEvents ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_E8; - - /* Return number of free events. */ - *f_pulFreeEventCnt = ulAvailableEvents; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveCopyEventEntry - -Description: Reserves a free entry in the copy event list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pusEventIndex List entry reserved. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveCopyEventEntry -UINT32 Oct6100ApiReserveCopyEventEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusEventIndex ) -{ - PVOID pCopyEventAlloc; - UINT32 ulResult; - UINT32 ulEventIndex; - - mOCT6100_GET_COPY_EVENT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pCopyEventAlloc ) - - ulResult = OctapiLlmAllocAlloc( pCopyEventAlloc, &ulEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_MIXER_ALL_COPY_EVENT_ENTRY_OPENED; - else - return cOCT6100_ERR_FATAL_AD; - } - - *f_pusEventIndex = (UINT16)( ulEventIndex & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseCopyEventEntry - -Description: Release an entry from the copy event list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usEventIndex List entry reserved. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseCopyEventEntry -UINT32 Oct6100ApiReleaseCopyEventEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEventIndex ) -{ - PVOID pCopyEventAlloc; - UINT32 ulResult; - - mOCT6100_GET_COPY_EVENT_ALLOC_PNT( f_pApiInstance->pSharedInfo, pCopyEventAlloc ) - - ulResult = OctapiLlmAllocDealloc( pCopyEventAlloc, f_usEventIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_AE; - - return cOCT6100_ERR_OK; -} -#endif diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_phasing_tsst.c b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_phasing_tsst.c deleted file mode 100644 index e8a4199..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_phasing_tsst.c +++ /dev/null @@ -1,922 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_phasing_tsst.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains functions used to open and close phasing TSSTs. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 46 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_phasing_tsst_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_phasing_tsst_pub.h" -#include "oct6100api/oct6100_channel_inst.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_memory_priv.h" -#include "oct6100_tsst_priv.h" -#include "oct6100_phasing_tsst_priv.h" - -/**************************** PUBLIC FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100PhasingTsstOpen - -Description: This function opens a phasing TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pPhasingTsstOpen Pointer to phasing TSST open structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100PhasingTsstOpenDef -UINT32 Oct6100PhasingTsstOpenDef( - tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen ) -{ - f_pPhasingTsstOpen->pulPhasingTsstHndl = NULL; - - f_pPhasingTsstOpen->ulTimeslot = cOCT6100_INVALID_TIMESLOT; - f_pPhasingTsstOpen->ulStream = cOCT6100_INVALID_STREAM; - - f_pPhasingTsstOpen->ulPhasingLength = 88; - - - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100PhasingTsstOpen -UINT32 Oct6100PhasingTsstOpen( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100PhasingTsstOpenSer( f_pApiInstance, f_pPhasingTsstOpen ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100PhasingTsstClose - -Description: This function closes a phasing TSST - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pPhasingTsstClose Pointer to phasing TSST close structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100PhasingTsstCloseDef -UINT32 Oct6100PhasingTsstCloseDef( - tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose ) -{ - f_pPhasingTsstClose->ulPhasingTsstHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100PhasingTsstClose -UINT32 Oct6100PhasingTsstClose( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100PhasingTsstCloseSer( f_pApiInstance, f_pPhasingTsstClose ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetPhasingTsstSwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management of Phasing TSSTs. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pOpenChip Pointer to chip configuration struct. -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetPhasingTsstSwSizes -UINT32 Oct6100ApiGetPhasingTsstSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulTempVar; - UINT32 ulResult; - - /* Determine the amount of memory required for the API phasing TSST list. */ - f_pInstSizes->ulPhasingTsstList = f_pOpenChip->ulMaxPhasingTssts * sizeof( tOCT6100_API_PHASING_TSST ); - - if ( f_pOpenChip->ulMaxPhasingTssts > 0 ) - { - /* Calculate memory needed for Phasing TSST API memory allocation */ - ulResult = OctapiLlmAllocGetSize( f_pOpenChip->ulMaxPhasingTssts, &f_pInstSizes->ulPhasingTsstAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_38; - } - else - { - f_pInstSizes->ulPhasingTsstAlloc = 0; - } - - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulPhasingTsstList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulPhasingTsstAlloc, ulTempVar ) - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiPhasingTsstSwInit - -Description: Initializes all elements of the instance structure associated - to phasing TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiPhasingTsstSwInit -UINT32 Oct6100ApiPhasingTsstSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_API_PHASING_TSST pPhasingTsstList; - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulMaxPhasingTssts; - PVOID pPhasingTsstAlloc; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Initialize the phasing TSST API list. */ - ulMaxPhasingTssts = pSharedInfo->ChipConfig.usMaxPhasingTssts; - - /* Set all entries in the phasing TSST list to unused. */ - mOCT6100_GET_PHASING_TSST_LIST_PNT( pSharedInfo, pPhasingTsstList ) - - /* Clear the memory */ - Oct6100UserMemSet( pPhasingTsstList, 0x00, sizeof(tOCT6100_API_PHASING_TSST) * ulMaxPhasingTssts ); - - /* Initialize the phasing TSST allocation software to "all free". */ - if ( ulMaxPhasingTssts > 0 ) - { - mOCT6100_GET_PHASING_TSST_ALLOC_PNT( pSharedInfo, pPhasingTsstAlloc ) - - ulResult = OctapiLlmAllocInit( &pPhasingTsstAlloc, ulMaxPhasingTssts ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_39; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100PhasingTsstOpenSer - -Description: Opens a phasing TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pPhasingTsstOpen Pointer to phasing TSST open configuration structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100PhasingTsstOpenSer -UINT32 Oct6100PhasingTsstOpenSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen ) -{ - UINT16 usPhasingIndex; - UINT16 usTsstIndex; - UINT32 ulResult; - - /* Check the user's configuration of the phasing TSST for errors. */ - ulResult = Oct6100ApiCheckPhasingParams( f_pApiInstance, f_pPhasingTsstOpen ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reserve all resources needed by the phasing TSST. */ - ulResult = Oct6100ApiReservePhasingResources( f_pApiInstance, f_pPhasingTsstOpen, &usPhasingIndex, &usTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write all necessary structures to activate the phasing TSST. */ - ulResult = Oct6100ApiWritePhasingStructs( f_pApiInstance, f_pPhasingTsstOpen, usPhasingIndex, usTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the new phasing TSST entry in the API list. */ - ulResult = Oct6100ApiUpdatePhasingEntry( f_pApiInstance, f_pPhasingTsstOpen, usPhasingIndex, usTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckPhasingParams - -Description: Checks the user's phasing TSST open configuration for errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pPhasingTsstOpen Pointer to phasing TSST open configuration structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckPhasingParams -UINT32 Oct6100ApiCheckPhasingParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen ) -{ - UINT32 ulResult; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxPhasingTssts == 0 ) - return cOCT6100_ERR_PHASING_TSST_DISABLED; - - if ( f_pPhasingTsstOpen->pulPhasingTsstHndl == NULL ) - return cOCT6100_ERR_PHASING_TSST_INVALID_HANDLE; - - /* Check the phasing length. */ - if ( f_pPhasingTsstOpen->ulPhasingLength > 240 || - f_pPhasingTsstOpen->ulPhasingLength < 2 ) - return cOCT6100_ERR_PHASING_TSST_PHASING_LENGTH; - - - - /* Check the input TDM streams, timeslots component for errors. */ - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - cOCT6100_NUMBER_TSSTS_1, - f_pPhasingTsstOpen->ulTimeslot, - f_pPhasingTsstOpen->ulStream, - cOCT6100_INPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_PHASING_TSST_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_PHASING_TSST_STREAM; - } - else - { - return ulResult; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReservePhasingResources - -Description: Reserves all resources needed for the new phasing TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pPhasingTsstOpen Pointer to phasing TSST configuration structure. -f_pusPhasingIndex Allocated entry in Phasing TSST API list. -f_pusTsstIndex TSST memory index of the counter. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReservePhasingResources -UINT32 Oct6100ApiReservePhasingResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen, - OUT PUINT16 f_pusPhasingIndex, - OUT PUINT16 f_pusTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult; - UINT32 ulTempVar; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Reserve an entry in the phasing TSST list. */ - ulResult = Oct6100ApiReservePhasingEntry( f_pApiInstance, - f_pusPhasingIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Reserve the input TSST entry. */ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - f_pPhasingTsstOpen->ulTimeslot, - f_pPhasingTsstOpen->ulStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_INPUT_TSST, - f_pusTsstIndex, - NULL ); - if ( ulResult != cOCT6100_ERR_OK ) - { - /* Release the previously reserved entries. */ - ulTempVar = Oct6100ApiReleasePhasingEntry( f_pApiInstance, *f_pusPhasingIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - - return ulResult; - } - } - else - { - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWritePhasingStructs - -Description: Performs all the required structure writes to configure the - new phasing TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pPhasingTsstOpen Pointer to phasing TSST configuration structure. -f_usPhasingIndex Allocated entry in phasing TSST API list. -f_usTsstIndex TSST memory index of the counter. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWritePhasingStructs -UINT32 Oct6100ApiWritePhasingStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen, - IN UINT16 f_usPhasingIndex, - IN UINT16 f_usTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulPhasingTsstChariotMemIndex; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*------------------------------------------------------------------------------*/ - /* Configure the TSST control memory of the phasing TSST. */ - - /* Find the asociated entry in the chariot memory for the phasing TSST. */ - ulPhasingTsstChariotMemIndex = cOCT6100_TSST_CONTROL_PHASING_TSST_BASE_ENTRY + f_usPhasingIndex; - - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( f_usTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = cOCT6100_TSST_CONTROL_MEM_INPUT_TSST; - WriteParams.usWriteData |= ulPhasingTsstChariotMemIndex & cOCT6100_TSST_CONTROL_MEM_TSI_MEM_MASK; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - - /*------------------------------------------------------------------------------*/ - /* Write the phasing length of the TSST in the ADPCM / MIXER memory. */ - - WriteParams.ulWriteAddress = cOCT6100_CONVERSION_CONTROL_PHASE_SIZE_BASE_ADD + ( f_usPhasingIndex * 2 ); - WriteParams.usWriteData = (UINT16)( f_pPhasingTsstOpen->ulPhasingLength ); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdatePhasingEntry - -Description: Updates the new phasing TSST in the API phasing TSST list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pPhasingTsstOpen Pointer to phasing TSST open structure. -f_usPhasingIndex Allocated entry in phasing TSST API list. -f_usTsstIndex TSST memory index of the counter. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdatePhasingEntry -UINT32 Oct6100ApiUpdatePhasingEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen, - IN UINT16 f_usPhasingIndex, - IN UINT16 f_usTsstIndex ) -{ - tPOCT6100_API_PHASING_TSST pPhasingTsstEntry; - - /*================================================================================*/ - /* Obtain a pointer to the new buffer's list entry. */ - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( f_pApiInstance->pSharedInfo, pPhasingTsstEntry, f_usPhasingIndex ) - - /* Copy the phasing TSST's configuration and allocated resources. */ - pPhasingTsstEntry->usTimeslot = (UINT16)( f_pPhasingTsstOpen->ulTimeslot & 0xFFFF ); - pPhasingTsstEntry->usStream = (UINT16)( f_pPhasingTsstOpen->ulStream & 0xFFFF ); - - pPhasingTsstEntry->usPhasingLength = (UINT16)( f_pPhasingTsstOpen->ulPhasingLength & 0xFFFF ); - - /* Store hardware related information. */ - pPhasingTsstEntry->usPhasingTsstIndex = f_usTsstIndex; - - /* Form handle returned to user. */ - *f_pPhasingTsstOpen->pulPhasingTsstHndl = cOCT6100_HNDL_TAG_PHASING_TSST | (pPhasingTsstEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_usPhasingIndex; - pPhasingTsstEntry->usDependencyCnt = 0; /* Nobody is using the phasing TSST.*/ - - /* Finally, mark the phasing TSST as open. */ - pPhasingTsstEntry->fReserved = TRUE; - - /* Increment the number of phasing TSSTs opened. */ - f_pApiInstance->pSharedInfo->ChipStats.usNumberPhasingTssts++; - - /*================================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100PhasingTsstCloseSer - -Description: Closes a phasing TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pPhasingTsstClose Pointer to phasing TSST close structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100PhasingTsstCloseSer -UINT32 Oct6100PhasingTsstCloseSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose ) -{ - UINT16 usPhasingIndex; - UINT16 usTsstIndex; - UINT32 ulResult; - - /* Verify that all the parameters given match the state of the API. */ - ulResult = Oct6100ApiAssertPhasingParams( f_pApiInstance, f_pPhasingTsstClose, &usPhasingIndex, &usTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the phasing TSST. */ - ulResult = Oct6100ApiInvalidatePhasingStructs( f_pApiInstance, usTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the phasing TSST. */ - ulResult = Oct6100ApiReleasePhasingResources( f_pApiInstance, usPhasingIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - f_pPhasingTsstClose->ulPhasingTsstHndl = cOCT6100_INVALID_VALUE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertPhasingParams - -Description: Validate the handle given by the user and verify the state of - the phasing TSST about to be closed. Also returns all - required information to deactivate the phasing TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pPhasingTsstClose Pointer to phasing TSST close structure. -f_pusPhasingIndex Index of the phasing TSST structure in the API list. -f_pusTsstIndex Index of the entry in the TSST control memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertPhasingParams -UINT32 Oct6100ApiAssertPhasingParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose, - OUT PUINT16 f_pusPhasingIndex, - OUT PUINT16 f_pusTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_PHASING_TSST pPhasingEntry; - UINT32 ulEntryOpenCnt; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check the provided handle. */ - if ( (f_pPhasingTsstClose->ulPhasingTsstHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_PHASING_TSST ) - return cOCT6100_ERR_PHASING_TSST_INVALID_HANDLE; - - *f_pusPhasingIndex = (UINT16)( f_pPhasingTsstClose->ulPhasingTsstHndl & cOCT6100_HNDL_INDEX_MASK ); - if ( *f_pusPhasingIndex >= pSharedInfo->ChipConfig.usMaxPhasingTssts ) - return cOCT6100_ERR_PHASING_TSST_INVALID_HANDLE; - - /*=======================================================================*/ - /* Get a pointer to the phasing TSST's list entry. */ - - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( pSharedInfo, pPhasingEntry, *f_pusPhasingIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pPhasingTsstClose->ulPhasingTsstHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pPhasingEntry->fReserved != TRUE ) - return cOCT6100_ERR_PHASING_TSST_NOT_OPEN; - if ( pPhasingEntry->usDependencyCnt != 0 ) - return cOCT6100_ERR_PHASING_TSST_ACTIVE_DEPENDENCIES; - if ( ulEntryOpenCnt != pPhasingEntry->byEntryOpenCnt ) - return cOCT6100_ERR_PHASING_TSST_INVALID_HANDLE; - - /* Return info needed to close the phasing TSST and release all resources. */ - *f_pusTsstIndex = pPhasingEntry->usPhasingTsstIndex; - - /*=======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInvalidatePhasingStructs - -Description: Closes a phasing TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usTsstIndex Index of the entry in the TSST control memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInvalidatePhasingStructs -UINT32 Oct6100ApiInvalidatePhasingStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*------------------------------------------------------------------------------*/ - /* Deactivate the TSST control memory. */ - - /* Set the input TSST control entry to unused. */ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( f_usTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = 0x0000; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*------------------------------------------------------------------------------*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleasePhasingResources - -Description: Release and clear the API entry associated to the phasing TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usPhasingIndex Index of the phasing TSST in the API list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleasePhasingResources -UINT32 Oct6100ApiReleasePhasingResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usPhasingIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_PHASING_TSST pPhasingEntry; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_PHASING_TSST_ENTRY_PNT( pSharedInfo, pPhasingEntry, f_usPhasingIndex ); - - /* Release the entry in the phasing TSST list. */ - ulResult = Oct6100ApiReleasePhasingEntry( f_pApiInstance, f_usPhasingIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Release the entry. */ - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pPhasingEntry->usTimeslot, - pPhasingEntry->usStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); /* Release the TSST entry */ - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL; - } - } - else - { - return ulResult; - } - - /*=============================================================*/ - /* Update the phasing TSST's list entry. */ - - /* Mark the entry as closed. */ - pPhasingEntry->fReserved = FALSE; - pPhasingEntry->byEntryOpenCnt++; - - /* Decrement the number of phasing TSSTs opened. */ - f_pApiInstance->pSharedInfo->ChipStats.usNumberPhasingTssts--; - - /*=============================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReservePhasingEntry - -Description: Reserves a phasing TSST API entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pusPhasingIndex Resulting index reserved in the phasing TSST list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReservePhasingEntry -UINT32 Oct6100ApiReservePhasingEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusPhasingIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pPhasingAlloc; - UINT32 ulResult; - UINT32 ulPhasingIndex; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_PHASING_TSST_ALLOC_PNT( pSharedInfo, pPhasingAlloc ) - - ulResult = OctapiLlmAllocAlloc( pPhasingAlloc, &ulPhasingIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_PHASING_TSST_ALL_ENTRIES_ARE_OPENED; - else - return cOCT6100_ERR_FATAL_3A; - } - - *f_pusPhasingIndex = (UINT16)( ulPhasingIndex & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleasePhasingEntry - -Description: Releases the specified phasing TSST API entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_usPhasingIndex Index reserved in the phasing TSST API list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleasePhasingEntry -UINT32 Oct6100ApiReleasePhasingEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usPhasingIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pPhasingAlloc; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_PHASING_TSST_ALLOC_PNT( pSharedInfo, pPhasingAlloc ) - - ulResult = OctapiLlmAllocDealloc( pPhasingAlloc, f_usPhasingIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_3B; - } - - return cOCT6100_ERR_OK; -} -#endif diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_playout_buf.c b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_playout_buf.c deleted file mode 100644 index cf3affa..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_playout_buf.c +++ /dev/null @@ -1,3337 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_playout_buf.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains functions used to manage buffer playout. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 109 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_channel_inst.h" -#include "oct6100api/oct6100_playout_buf_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_events_pub.h" -#include "oct6100api/oct6100_playout_buf_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_memory_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_events_priv.h" -#include "oct6100_playout_buf_priv.h" - -/**************************** PUBLIC FUNCTIONS *****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutLoad - -Description: This function loads a playout buffer into external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferLoad Pointer to buffer playout load structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutLoadDef -UINT32 Oct6100BufferPlayoutLoadDef( - tPOCT6100_BUFFER_LOAD f_pBufferLoad ) -{ - f_pBufferLoad->pbyBufferPattern = NULL; - f_pBufferLoad->ulBufferSize = 128; - f_pBufferLoad->ulBufferPcmLaw = cOCT6100_PCM_U_LAW; - - f_pBufferLoad->pulBufferIndex = NULL; - f_pBufferLoad->pulPlayoutFreeMemSize = NULL; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100BufferPlayoutLoad -UINT32 Oct6100BufferPlayoutLoad( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_BUFFER_LOAD f_pBufferLoad ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100BufferLoadSer( f_pApiInstance, f_pBufferLoad, TRUE, cOCT6100_INVALID_INDEX ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutLoadBlockInit - -Description: This function allows the user to initialize loading a buffer - into external memory using blocks. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pBufferLoadBlockInit Pointer to buffer playout load block init structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutLoadBlockInitDef -UINT32 Oct6100BufferPlayoutLoadBlockInitDef( - tPOCT6100_BUFFER_LOAD_BLOCK_INIT f_pBufferLoadBlockInit ) -{ - f_pBufferLoadBlockInit->ulBufferSize = 128; - f_pBufferLoadBlockInit->ulBufferPcmLaw = cOCT6100_PCM_U_LAW; - - f_pBufferLoadBlockInit->pulBufferIndex = NULL; - f_pBufferLoadBlockInit->pulPlayoutFreeMemSize = NULL; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100BufferPlayoutLoadBlockInit -UINT32 Oct6100BufferPlayoutLoadBlockInit( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_BUFFER_LOAD_BLOCK_INIT f_pBufferLoadBlockInit ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure.*/ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100BufferLoadBlockInitSer( f_pApiInstance, f_pBufferLoadBlockInit ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutLoadBlock - -Description: This function allows the user to load a buffer block into - external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pBufferLoadBlock Pointer to buffer playout load block structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutLoadBlockDef -UINT32 Oct6100BufferPlayoutLoadBlockDef( - tPOCT6100_BUFFER_LOAD_BLOCK f_pBufferLoadBlock ) -{ - f_pBufferLoadBlock->ulBufferIndex = cOCT6100_INVALID_VALUE; - f_pBufferLoadBlock->ulBlockLength = cOCT6100_INVALID_VALUE; - f_pBufferLoadBlock->ulBlockOffset = cOCT6100_INVALID_VALUE; - - f_pBufferLoadBlock->pbyBufferPattern = NULL; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100BufferPlayoutLoadBlock -UINT32 Oct6100BufferPlayoutLoadBlock( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_BUFFER_LOAD_BLOCK f_pBufferLoadBlock ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100BufferLoadBlockSer( f_pApiInstance, f_pBufferLoadBlock ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutUnload - -Description: This function unloads a playout buffer from external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferUnload Pointer to buffer playout unload structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutUnloadDef -UINT32 Oct6100BufferPlayoutUnloadDef( - tPOCT6100_BUFFER_UNLOAD f_pBufferUnload ) -{ - f_pBufferUnload->ulBufferIndex = cOCT6100_INVALID_VALUE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100BufferPlayoutUnload -UINT32 Oct6100BufferPlayoutUnload( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_BUFFER_UNLOAD f_pBufferUnload ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100BufferUnloadSer( f_pApiInstance, f_pBufferUnload, TRUE ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutAdd - -Description: This function adds a buffer to a port's playout list on the - selected channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutAdd Pointer to buffer playout add structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutAddDef -UINT32 Oct6100BufferPlayoutAddDef( - tPOCT6100_BUFFER_PLAYOUT_ADD f_pBufferPlayoutAdd ) -{ - f_pBufferPlayoutAdd->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pBufferPlayoutAdd->ulBufferIndex = cOCT6100_INVALID_VALUE; - - f_pBufferPlayoutAdd->ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; - f_pBufferPlayoutAdd->ulMixingMode = cOCT6100_MIXING_MINUS_6_DB; - f_pBufferPlayoutAdd->lGainDb = 0; - - f_pBufferPlayoutAdd->fRepeat = FALSE; - f_pBufferPlayoutAdd->ulRepeatCount = cOCT6100_REPEAT_INFINITELY; - - f_pBufferPlayoutAdd->ulDuration = cOCT6100_INVALID_VALUE; - - f_pBufferPlayoutAdd->ulBufferLength = cOCT6100_AUTO_SELECT; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100BufferPlayoutAdd -UINT32 Oct6100BufferPlayoutAdd( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_BUFFER_PLAYOUT_ADD f_pBufferPlayoutAdd ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100BufferPlayoutAddSer( f_pApiInstance, f_pBufferPlayoutAdd ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutStart - -Description: This function enables playout of the specified buffer on the - requested channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutStart Pointer to buffer playout start structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutStartDef -UINT32 Oct6100BufferPlayoutStartDef( - tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart ) -{ - f_pBufferPlayoutStart->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pBufferPlayoutStart->ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; - f_pBufferPlayoutStart->fNotifyOnPlayoutStop = FALSE; - f_pBufferPlayoutStart->ulUserEventId = cOCT6100_INVALID_VALUE; - f_pBufferPlayoutStart->fAllowStartWhileActive = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100BufferPlayoutStart -UINT32 Oct6100BufferPlayoutStart( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100BufferPlayoutStartSer( f_pApiInstance, f_pBufferPlayoutStart, cOCT6100_BUFFER_PLAYOUT_EVENT_STOP ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutStop - -Description: This function disables playout of a buffer on the specified - channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutStop Pointer to buffer playout stop structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutStopDef -UINT32 Oct6100BufferPlayoutStopDef( - tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop ) -{ - f_pBufferPlayoutStop->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pBufferPlayoutStop->ulPlayoutPort = cOCT6100_CHANNEL_PORT_ROUT; - f_pBufferPlayoutStop->fStopCleanly = TRUE; - f_pBufferPlayoutStop->pfAlreadyStopped = NULL; - f_pBufferPlayoutStop->pfNotifyOnPlayoutStop = NULL; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100BufferPlayoutStop -UINT32 Oct6100BufferPlayoutStop( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100BufferPlayoutStopSer( f_pApiInstance, f_pBufferPlayoutStop ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetPlayoutBufferSwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management of playout buffers. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pOpenChip Pointer to chip configuration struct. -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetPlayoutBufferSwSizes -UINT32 Oct6100ApiGetPlayoutBufferSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulTempVar; - UINT32 ulResult; - - /* Calculate memory needed for playout buffer list. */ - f_pInstSizes->ulPlayoutBufList = f_pOpenChip->ulMaxPlayoutBuffers * sizeof( tOCT6100_API_BUFFER ); - - f_pInstSizes->ulPlayoutBufMemoryNodeList = 0; - - /* Calculate memory needed for playout buffer allocation software. */ - if ( f_pOpenChip->ulMaxPlayoutBuffers > 0 ) - { - ulResult = OctapiLlmAllocGetSize( f_pOpenChip->ulMaxPlayoutBuffers, &f_pInstSizes->ulPlayoutBufAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_3C; - - f_pInstSizes->ulPlayoutBufMemoryNodeList = 2 * f_pOpenChip->ulMaxPlayoutBuffers * sizeof( tOCT6100_API_BUFFER_PLAYOUT_MALLOC_NODE ); - } - else - { - f_pInstSizes->ulPlayoutBufAlloc = 0; - } - - /* Calculate memory needed for list and allocation software serialization. */ - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulPlayoutBufList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulPlayoutBufAlloc, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulPlayoutBufMemoryNodeList, ulTempVar ) - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiPlayoutBufferSwInit - -Description: Initializes all elements of the instance structure associated - to playout buffers. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiPlayoutBufferSwInit -UINT32 Oct6100ApiPlayoutBufferSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BUFFER pBufferList; - PVOID pBufferPlayoutAlloc; - UINT32 ulMaxBufferPlayout; - UINT32 ulResult, i; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get the maximum number of buffer playout. */ - ulMaxBufferPlayout = pSharedInfo->ChipConfig.usMaxPlayoutBuffers; - - /* Set all entries in the buffer playout list to unused. */ - mOCT6100_GET_BUFFER_LIST_PNT( pSharedInfo, pBufferList ) - - for ( i = 0; i < ulMaxBufferPlayout; i++ ) - { - pBufferList[ i ].fReserved = FALSE; - pBufferList[ i ].ulBufferSize = 0; - pBufferList[ i ].ulBufferBase = cOCT6100_INVALID_VALUE; - pBufferList[ i ].usDependencyCnt = 0; - pBufferList[ i ].byBufferPcmLaw = cOCT6100_PCM_U_LAW; - - } - - /* Initialize the buffer playout allocation software to "all free". */ - if ( ulMaxBufferPlayout > 0 ) - { - mOCT6100_GET_BUFFER_ALLOC_PNT( pSharedInfo, pBufferPlayoutAlloc ) - - ulResult = OctapiLlmAllocInit( &pBufferPlayoutAlloc, ulMaxBufferPlayout ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_3D; - } - - /* Initialize the amount of free memory used by playout. */ - f_pApiInstance->pSharedInfo->ChipStats.ulPlayoutMemUsed = 0; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferLoadSer - -Description: Loads a buffer in external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferLoad Pointer to buffer configuration structure. The handle - identifying the buffer in all future function calls is - returned in this structure. - -f_fReserveListStruct Flag indicating if a list structure should be reserved - or if the structure has been reserved before. If this - is set, the f_ulBufIndex variable must also be set. - -f_ulBufIndex If the f_fReserveListStruct flag is set, this index - will identify the buffer playout list structure - that must be used to load the specified buffer. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferLoadSer -UINT32 Oct6100BufferLoadSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_LOAD f_pBufferLoad, - IN BOOL f_fReserveListStruct, - IN UINT32 f_ulBufIndex ) -{ - UINT32 ulBufferIndex; - UINT32 ulBufferBase; - UINT32 ulResult; - - /* Check the user's configuration of the buffer for errors. */ - ulResult = Oct6100ApiCheckBufferParams( f_pApiInstance, f_pBufferLoad, TRUE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reserve all resources needed by the buffer. */ - ulResult = Oct6100ApiReserveBufferResources( f_pApiInstance, f_pBufferLoad, f_fReserveListStruct, f_ulBufIndex, &ulBufferIndex, &ulBufferBase ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write the buffer in external memory. */ - ulResult = Oct6100ApiWriteBufferInMemory( f_pApiInstance, ulBufferBase, f_pBufferLoad->ulBufferSize, f_pBufferLoad->pbyBufferPattern ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the new buffer's entry in the buffer list. */ - ulResult = Oct6100ApiUpdateBufferEntry( f_pApiInstance, f_pBufferLoad, ulBufferIndex, ulBufferBase ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferLoadBlockInitSer - -Description: Reserve resources for loading a buffer into external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pBufferLoadBlockInit Pointer to buffer configuration structure. The - handle identifying the buffer in all future - function calls is returned in this structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferLoadBlockInitSer -UINT32 Oct6100BufferLoadBlockInitSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_LOAD_BLOCK_INIT f_pBufferLoadBlockInit ) -{ - UINT32 ulBufferIndex; - UINT32 ulBufferBase; - UINT32 ulResult; - tOCT6100_BUFFER_LOAD BufferLoad; - - Oct6100BufferPlayoutLoadDef( &BufferLoad ); - - /* Not to replicate the code, we use the BufferLoad functions directly. */ - BufferLoad.pulBufferIndex = f_pBufferLoadBlockInit->pulBufferIndex; - BufferLoad.pulPlayoutFreeMemSize = f_pBufferLoadBlockInit->pulPlayoutFreeMemSize; - BufferLoad.ulBufferPcmLaw = f_pBufferLoadBlockInit->ulBufferPcmLaw; - BufferLoad.ulBufferSize = f_pBufferLoadBlockInit->ulBufferSize; - BufferLoad.pbyBufferPattern = NULL; /* Must not check this for now */ - - /* Check the user's configuration of the buffer for errors, but do */ - /* not check if the buffer pointer is NULL. It is NULL for sure! */ - ulResult = Oct6100ApiCheckBufferParams( f_pApiInstance, &BufferLoad, FALSE ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reserve all resources needed by the buffer. */ - ulResult = Oct6100ApiReserveBufferResources( f_pApiInstance, &BufferLoad, TRUE, cOCT6100_INVALID_INDEX, &ulBufferIndex, &ulBufferBase ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the new buffer's entry in the buffer list. */ - ulResult = Oct6100ApiUpdateBufferEntry( f_pApiInstance, &BufferLoad, ulBufferIndex, ulBufferBase ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferLoadBlockSer - -Description: Loads a buffer in external memory using blocks. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pBufferLoadBlock Pointer to buffer block to be loaded into external - memory descriptor. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferLoadBlockSer -UINT32 Oct6100BufferLoadBlockSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_LOAD_BLOCK f_pBufferLoadBlock ) -{ - UINT32 ulBufferBase; - UINT32 ulResult; - - /* Check the user's configuration for errors. */ - ulResult = Oct6100ApiCheckBufferLoadBlockParams( f_pApiInstance, f_pBufferLoadBlock, &ulBufferBase ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write the buffer in external memory at the appropriate offset - must do some pointer arithmetic. */ - ulResult = Oct6100ApiWriteBufferInMemory( f_pApiInstance, ulBufferBase + f_pBufferLoadBlock->ulBlockOffset, - f_pBufferLoadBlock->ulBlockLength, f_pBufferLoadBlock->pbyBufferPattern + f_pBufferLoadBlock->ulBlockOffset ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckBufferParams - -Description: Checks the user's buffer playout load configuration for errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferLoad Pointer to buffer configuration structure. -f_fCheckBufferPtr Check if the buffer pointer is NULL or not. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckBufferParams -UINT32 Oct6100ApiCheckBufferParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_LOAD f_pBufferLoad, - IN BOOL f_fCheckBufferPtr ) -{ - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxPlayoutBuffers == 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_DISABLED; - - if ( f_pApiInstance->pSharedInfo->ImageInfo.fBufferPlayout == FALSE ) - return cOCT6100_ERR_NOT_SUPPORTED_BUFFER_PLAYOUT; - - if ( f_pBufferLoad->pulBufferIndex == NULL ) - return cOCT6100_ERR_BUFFER_PLAYOUT_BUF_INDEX; - - if( f_fCheckBufferPtr ) - { - if ( f_pBufferLoad->pbyBufferPattern == NULL ) - return cOCT6100_ERR_BUFFER_PLAYOUT_PATTERN; - } - - if ( f_pBufferLoad->ulBufferSize < cOCT6100_MINIMUM_BUFFER_SIZE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_TOO_SMALL; - - if ( ( f_pBufferLoad->ulBufferSize % cOCT6100_BUFFER_SIZE_GRANULARITY ) != 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_BUF_SIZE; - - if ( f_pBufferLoad->ulBufferPcmLaw != cOCT6100_PCM_U_LAW && - f_pBufferLoad->ulBufferPcmLaw != cOCT6100_PCM_A_LAW ) - return cOCT6100_ERR_BUFFER_PLAYOUT_PCM_LAW; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckBufferLoadBlockParams - -Description: Checks the user's buffer playout load block configuration for - errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferLoadBlock Pointer to buffer block descriptor. -f_pulBufferBase Pointer to the base address of the buffer in external - memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckBufferLoadBlockParams -UINT32 Oct6100ApiCheckBufferLoadBlockParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_LOAD_BLOCK f_pBufferLoadBlock, - OUT PUINT32 f_pulBufferBase ) -{ - /* Check for errors. */ - tPOCT6100_API_BUFFER pBufEntry; - - if ( f_pBufferLoadBlock->ulBufferIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxPlayoutBuffers ) - return cOCT6100_ERR_BUFFER_PLAYOUT_BUF_INDEX; - - mOCT6100_GET_BUFFER_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBufEntry, f_pBufferLoadBlock->ulBufferIndex ) - - if ( pBufEntry->fReserved != TRUE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_NOT_OPEN; - - if ( ( f_pBufferLoadBlock->ulBlockLength % 2 ) != 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_BLOCK_LENGTH_INVALID; - - if ( ( f_pBufferLoadBlock->ulBlockOffset % 2 ) != 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_BLOCK_OFFSET_INVALID; - - if ( f_pBufferLoadBlock->pbyBufferPattern == NULL ) - return cOCT6100_ERR_BUFFER_PLAYOUT_PATTERN; - - /* Check boundaries */ - if ( ( f_pBufferLoadBlock->ulBlockLength + f_pBufferLoadBlock->ulBlockOffset ) > pBufEntry->ulBufferSize ) - return cOCT6100_ERR_BUFFER_PLAYOUT_BUF_SIZE; - - *f_pulBufferBase = pBufEntry->ulBufferBase; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveBufferResources - -Description: Reserves all resources needed for the new buffer. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferLoad Pointer to buffer configuration structure. - -f_fReserveListStruct Flag indicating if a list structure should be reserved - or if the structure has been reserved before. - -f_ulBufIndex If the f_fReserveListStruct flag is set, this index - will identifying the buffer playout list structure - that must be used to load the specified buffer. - -f_pulBufferIndex Allocated entry in buffer playout list. - -f_pulBufferBase Allocated external memory block for the buffer. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveBufferResources -UINT32 Oct6100ApiReserveBufferResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_LOAD f_pBufferLoad, - IN BOOL f_fReserveListStruct, - IN UINT32 f_ulBufIndex, - OUT PUINT32 f_pulBufferIndex, - OUT PUINT32 f_pulBufferBase ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult = cOCT6100_ERR_OK; - UINT32 ulTempVar; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Reserve an entry in the buffer list. */ - if ( f_fReserveListStruct == TRUE ) - { - ulResult = Oct6100ApiReserveBufPlayoutListEntry( f_pApiInstance, f_pulBufferIndex ); - } - else - { - *f_pulBufferIndex = f_ulBufIndex; - } - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Find a free block to store the buffer. */ - ulResult = Oct6100ApiReserveBufferPlayoutMemory( f_pApiInstance, f_pBufferLoad->ulBufferSize, f_pulBufferBase ); - if ( ulResult != cOCT6100_ERR_OK ) - { - /* Release the list entry. */ - if ( f_fReserveListStruct == TRUE ) - { - ulTempVar = Oct6100ApiReleaseBufPlayoutListEntry( f_pApiInstance, *f_pulBufferIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - } - } - - return ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteBufferInMemory - -Description: Writes the buffer in external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulBufferBase Allocated external memory address for the buffer. - -f_ulBufferLength Length in bytes of the buffer to be copied in memory. - -f_pbyBuffer Address where the buffer should be copied from. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteBufferInMemory -UINT32 Oct6100ApiWriteBufferInMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulBufferBase, - IN UINT32 f_ulBufferLength, - IN PUINT8 f_pbyBuffer ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_BURST_PARAMS BurstParams; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - UINT32 ulNumWrites; - PUINT16 pusSuperArray; - PUINT8 pbyPlayoutBuffer; - UINT32 ulByteCount = 0; - UINT32 i; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Set the process context and user chip ID parameters once and for all. */ - BurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - BurstParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /* Write the buffer in external memory. */ - ulNumWrites = f_ulBufferLength / 2; - - BurstParams.ulWriteAddress = f_ulBufferBase; - BurstParams.pusWriteData = pSharedInfo->MiscVars.ausSuperArray; - - pusSuperArray = pSharedInfo->MiscVars.ausSuperArray; - pbyPlayoutBuffer = f_pbyBuffer; - - /* Check if we can maximize the bandwidth through the CPU port. */ - if ( f_pApiInstance->pSharedInfo->ChipStats.usNumberChannels == 0 ) - { - WriteParams.ulWriteAddress = 0x234; - WriteParams.usWriteData = 0x08ff; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - while ( ulNumWrites != 0 ) - { - if ( ulNumWrites >= pSharedInfo->ChipConfig.usMaxRwAccesses ) - BurstParams.ulWriteLength = pSharedInfo->ChipConfig.usMaxRwAccesses; - else - BurstParams.ulWriteLength = ulNumWrites; - - for ( i = 0; i < BurstParams.ulWriteLength; i++ ) - { - pusSuperArray[ i ] = ( UINT16 )(( pbyPlayoutBuffer [ ulByteCount++ ]) << 8); - pusSuperArray[ i ] |= ( UINT16 )pbyPlayoutBuffer [ ulByteCount++ ]; - } - - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - BurstParams.ulWriteAddress += 2 * BurstParams.ulWriteLength; - ulNumWrites -= BurstParams.ulWriteLength; - - } - - /* Make sure we revert back the changes made to the CPU bandwidth register. */ - if ( f_pApiInstance->pSharedInfo->ChipStats.usNumberChannels == 0 ) - { - WriteParams.ulWriteAddress = 0x234; - WriteParams.usWriteData = 0x0804; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateBufferEntry - -Description: Updates the new buffer's entry in the buffer playout list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pBufferLoad Pointer to buffer configuration structure. -f_ulBufferIndex Allocated entry in buffer playout list. -f_ulBufferBase Allocated external memory block for the buffer. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateBufferEntry -UINT32 Oct6100ApiUpdateBufferEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_LOAD f_pBufferLoad, - IN UINT32 f_ulBufferIndex, - IN UINT32 f_ulBufferBase ) -{ - tPOCT6100_API_BUFFER pBufEntry; - UINT32 ulBufferSize = f_pBufferLoad->ulBufferSize; - - /* Obtain a pointer to the new buffer's list entry. */ - mOCT6100_GET_BUFFER_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBufEntry, f_ulBufferIndex ) - - /* Copy the buffer's configuration and allocated resources. */ - pBufEntry->ulBufferSize = f_pBufferLoad->ulBufferSize; - pBufEntry->byBufferPcmLaw = (UINT8)( f_pBufferLoad->ulBufferPcmLaw & 0xFF ); - pBufEntry->ulBufferBase = f_ulBufferBase; - - /* Update the entries flags. */ - pBufEntry->usDependencyCnt = 0; - - /* Mark the buffer as opened. */ - pBufEntry->fReserved = TRUE; - - /* Increment the number of buffer loaded into the chip.*/ - f_pApiInstance->pSharedInfo->ChipStats.usNumberPlayoutBuffers++; - - /* Refresh the amount of memory used by buffer playout. */ - - /* Reserved size is divisible by 64. */ - if ( ulBufferSize % 64 ) - ulBufferSize = ulBufferSize + ( 64 - ( ulBufferSize % 64 ) ); - f_pApiInstance->pSharedInfo->ChipStats.ulPlayoutMemUsed += ulBufferSize; - - /* Return the buffer index to the user. */ - *f_pBufferLoad->pulBufferIndex = f_ulBufferIndex; - - /* Return the amount of free memory left in the chip. */ - /* Note that this value does not give the "fragmentation" state of the available memory. */ - /* This value only gives the amount of free memory */ - if( f_pBufferLoad->pulPlayoutFreeMemSize ) - *f_pBufferLoad->pulPlayoutFreeMemSize = ( f_pApiInstance->pSharedInfo->MiscVars.ulTotalMemSize - ( f_pApiInstance->pSharedInfo->MemoryMap.ulFreeMemBaseAddress - cOCT6100_EXTERNAL_MEM_BASE_ADDRESS ) ) - ( f_pApiInstance->pSharedInfo->ChipStats.ulPlayoutMemUsed ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferUnloadSer - -Description: Unloads a buffer from external memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferUnload Pointer to buffer unload structure. -f_fReleaseListStruct Whether to release the buffer playout list structure - or not. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferUnloadSer -UINT32 Oct6100BufferUnloadSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_UNLOAD f_pBufferUnload, - IN BOOL f_fReleaseListStruct ) -{ - UINT32 ulBufferIndex; - UINT32 ulBufferBase; - UINT32 ulResult; - - /* Verify that all the parameters given match the state of the API. */ - ulResult = Oct6100ApiAssertBufferParams( f_pApiInstance, f_pBufferUnload, &ulBufferIndex, &ulBufferBase ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the unloaded buffer. */ - ulResult = Oct6100ApiReleaseBufferResources( f_pApiInstance, ulBufferIndex, ulBufferBase, f_fReleaseListStruct ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertBufferParams - -Description: Checks the buffer playout unload configuration for errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferUnload Pointer to buffer unload structure. -f_pulBufferIndex Pointer to the index of the buffer in the API's buffers list. -f_pulBufferBase Pointer to the base address of the buffer in external memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertBufferParams -UINT32 Oct6100ApiAssertBufferParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_UNLOAD f_pBufferUnload, - OUT PUINT32 f_pulBufferIndex, - OUT PUINT32 f_pulBufferBase ) -{ - tPOCT6100_API_BUFFER pBufEntry; - - *f_pulBufferIndex = f_pBufferUnload->ulBufferIndex; - - if ( *f_pulBufferIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxPlayoutBuffers ) - return cOCT6100_ERR_BUFFER_PLAYOUT_BUF_INDEX; - - mOCT6100_GET_BUFFER_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBufEntry, *f_pulBufferIndex ) - - /* Check for errors. */ - if ( pBufEntry->fReserved != TRUE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_NOT_OPEN; - if ( pBufEntry->usDependencyCnt != 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_ACTIVE_DEPENDENCIES; - - /* Return all info needed to invalidate buffer. */ - *f_pulBufferBase = pBufEntry->ulBufferBase; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseBufferResources - -Description: Release resources needed by the buffer. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulBufferIndex Allocated entry in buffer playout list. -f_ulBufferBase Allocated external memory block for the buffer. -f_fReleaseListStruct Free the list structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseBufferResources -UINT32 Oct6100ApiReleaseBufferResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulBufferIndex, - IN UINT32 f_ulBufferBase, - IN BOOL f_fReleaseListStruct ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_BUFFER pBufEntry; - UINT32 ulResult; - UINT32 ulBufferSize; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Free the external memory reserved for the buffer. */ - ulResult = Oct6100ApiReleaseBufferPlayoutMemory( f_pApiInstance, f_ulBufferBase ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_3E; - - /* Release the entry from the buffer list. */ - if ( f_fReleaseListStruct == TRUE ) - ulResult = Oct6100ApiReleaseBufPlayoutListEntry( f_pApiInstance, f_ulBufferIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_GET_BUFFER_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBufEntry, f_ulBufferIndex ); - - /* Save buffer size before releasing that entry, will be needed to calculate the amount of */ - /* free memory left for the user. */ - ulBufferSize = pBufEntry->ulBufferSize; - - /* Flag the buffer entry as free. */ - pBufEntry->fReserved = FALSE; - - /* Decrement the number of buffer loaded into the chip. */ - f_pApiInstance->pSharedInfo->ChipStats.usNumberPlayoutBuffers--; - - /* Refresh the amount of memory used by buffer playout. */ - /* Reserved size is divisible by 64. */ - if ( ulBufferSize % 64 ) - ulBufferSize = ulBufferSize + ( 64 - ( ulBufferSize % 64 ) ); - f_pApiInstance->pSharedInfo->ChipStats.ulPlayoutMemUsed -= ulBufferSize; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutAddSer - -Description: This function adds a buffer to a channel buffer list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutAdd Pointer to buffer playout add structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutAddSer -UINT32 Oct6100BufferPlayoutAddSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_ADD f_pBufferPlayoutAdd ) -{ - UINT32 ulBufferIndex; - UINT32 ulChannelIndex; - UINT32 ulResult; - - /* Check the user's configuration of the buffer for errors. */ - ulResult = Oct6100ApiCheckPlayoutAddParams( f_pApiInstance, f_pBufferPlayoutAdd, &ulChannelIndex, &ulBufferIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write to all resources needed to activate buffer playout. */ - ulResult = Oct6100ApiWriteBufferAddStructs( f_pApiInstance, f_pBufferPlayoutAdd, ulChannelIndex, ulBufferIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckPlayoutAddParams - -Description: Check the validity of the channel and buffer requested. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutAdd Pointer to buffer playout add structure. -f_pulChannelIndex Pointer to the channel index of the selected channel. -f_pulBufferIndex Pointer to the buffer index within the API's buffer list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckPlayoutAddParams -UINT32 Oct6100ApiCheckPlayoutAddParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_ADD f_pBufferPlayoutAdd, - OUT PUINT32 f_pulChannelIndex, - OUT PUINT32 f_pulBufferIndex ) -{ - tPOCT6100_API_BUFFER pBufferEntry; - tPOCT6100_API_CHANNEL pEchoChannel; - UINT32 ulEntryOpenCnt; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxPlayoutBuffers == 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_DISABLED; - - if ( f_pBufferPlayoutAdd->ulChannelHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - if ( f_pBufferPlayoutAdd->ulPlayoutPort != cOCT6100_CHANNEL_PORT_ROUT && - f_pBufferPlayoutAdd->ulPlayoutPort != cOCT6100_CHANNEL_PORT_SOUT ) - return cOCT6100_ERR_BUFFER_PLAYOUT_PLAYOUT_PORT; - - if ( f_pBufferPlayoutAdd->fRepeat != TRUE && f_pBufferPlayoutAdd->fRepeat != FALSE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_ADD_REPEAT; - - if ( f_pBufferPlayoutAdd->fRepeat == TRUE ) - { - if ( f_pBufferPlayoutAdd->ulRepeatCount != cOCT6100_REPEAT_INFINITELY ) - { - if ( f_pBufferPlayoutAdd->ulRepeatCount == 0x0 - || f_pBufferPlayoutAdd->ulRepeatCount > cOCT6100_REPEAT_MAX) - { - return cOCT6100_ERR_BUFFER_PLAYOUT_ADD_REPEAT_COUNT; - } - } - } - - if ( f_pBufferPlayoutAdd->ulMixingMode != cOCT6100_MIXING_0_DB && - f_pBufferPlayoutAdd->ulMixingMode != cOCT6100_MIXING_MINUS_6_DB && - f_pBufferPlayoutAdd->ulMixingMode != cOCT6100_MIXING_MINUS_12_DB && - f_pBufferPlayoutAdd->ulMixingMode != cOCT6100_MIXING_MUTE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_ADD_MIXING; - - if ( ( f_pBufferPlayoutAdd->lGainDb < -24 ) - || ( f_pBufferPlayoutAdd->lGainDb > 24 ) ) - return cOCT6100_ERR_BUFFER_PLAYOUT_ADD_GAIN_DB; - - /*=====================================================================*/ - /* Check the channel handle. */ - - if ( (f_pBufferPlayoutAdd->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - *f_pulChannelIndex = f_pBufferPlayoutAdd->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK; - if ( *f_pulChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChannel, *f_pulChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pBufferPlayoutAdd->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChannel->fReserved != TRUE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChannel->byEntryOpenCnt ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - /* Check if repeat flag has been used for this port. */ - if ( ( ( f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) && ( pEchoChannel->fRinBufPlayoutRepeatUsed == TRUE ) ) - || ( ( f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) && ( pEchoChannel->fSoutBufPlayoutRepeatUsed == TRUE ) ) ) - return cOCT6100_ERR_BUFFER_PLAYOUT_REPEAT_USED; - - /*=====================================================================*/ - - /*=====================================================================*/ - /* Check the buffer information. */ - - *f_pulBufferIndex = f_pBufferPlayoutAdd->ulBufferIndex; - if ( *f_pulBufferIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxPlayoutBuffers ) - return cOCT6100_ERR_BUFFER_PLAYOUT_BUF_INDEX; - - mOCT6100_GET_BUFFER_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBufferEntry, *f_pulBufferIndex ) - - if ( pBufferEntry->fReserved != TRUE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_NOT_OPEN; - - /* Check if the play length is not larger then the currently uploaded buffer. */ - if ( ( f_pBufferPlayoutAdd->ulBufferLength > pBufferEntry->ulBufferSize ) && - ( f_pBufferPlayoutAdd->ulBufferLength != cOCT6100_AUTO_SELECT ) ) - return cOCT6100_ERR_BUFFER_PLAYOUT_BUF_SIZE; - - if( f_pBufferPlayoutAdd->ulBufferLength != cOCT6100_AUTO_SELECT ) - { - if ( f_pBufferPlayoutAdd->ulBufferLength < cOCT6100_MINIMUM_BUFFER_SIZE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_TOO_SMALL; - - if ( ( f_pBufferPlayoutAdd->ulBufferLength % cOCT6100_BUFFER_SIZE_GRANULARITY ) != 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_BUF_SIZE; - } - - /*=====================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteBufferAddStructs - -Description: Write the buffer playout event in the channel's port playout - circular buffer. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutAdd Pointer to buffer playout add structure. -f_ulChannelIndex Index of the channel on which the buffer is to be added. -f_ulBufferIndex Index of the buffer structure within the API's buffer list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteBufferAddStructs -UINT32 Oct6100ApiWriteBufferAddStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_ADD f_pBufferPlayoutAdd, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulBufferIndex ) -{ - tPOCT6100_API_BUFFER pBufferEntry; - tPOCT6100_API_CHANNEL pEchoChannel; - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT32 ulTempData; - UINT32 ulEventBuffer; - - UINT32 ulReadPtrBytesOfst; - UINT32 ulReadPtrBitOfst; - UINT32 ulReadPtrFieldSize; - - UINT32 ulWritePtrBytesOfst; - UINT32 ulWritePtrBitOfst; - UINT32 ulWritePtrFieldSize; - - UINT32 ulWritePtr; - UINT32 ulReadPtr; - - UINT32 ulPlayoutBaseAddress; - UINT32 ulAddress; - UINT32 ulEventIndex; - UINT32 ulMask; - - UINT32 ulRepeatCount = 0; - BOOL fRepeatCountSet = FALSE; - UINT32 ulDurationModulo = 0; - UINT32 ulEventsToCreate = 1; - UINT32 ulBufferDurationMs; - - UINT32 ulBufferLength; - UINT16 usTempData = 0; - - UINT16 usReadData; - UINT32 ulChipWritePtr; - UINT32 ulReadData; - UINT32 ulLoopCnt = 0; - BOOL fStillPlaying = TRUE; - BOOL fCheckHardStop = FALSE; - BOOL fOldBufferPlayoutVersion = FALSE; - - UINT32 aulWaitTime[ 2 ]; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChannel, f_ulChannelIndex ); - mOCT6100_GET_BUFFER_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBufferEntry, f_ulBufferIndex ); - - /* Select the buffer of interest. */ - if ( f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - ulEventBuffer = pSharedInfo->MemoryMap.ulChanMainRinPlayoutMemOfst; - ulWritePtr = pEchoChannel->ulRinBufWritePtr; - - ulWritePtrBytesOfst = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.usDwordOffset * 4; - ulWritePtrBitOfst = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.byBitOffset; - ulWritePtrFieldSize = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.byFieldSize; - - ulReadPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.usDwordOffset * 4; - ulReadPtrBitOfst = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.byBitOffset; - ulReadPtrFieldSize = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.byFieldSize; - } - else /* f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - ulEventBuffer = pSharedInfo->MemoryMap.ulChanMainSoutPlayoutMemOfst; - ulWritePtr = pEchoChannel->ulSoutBufWritePtr; - - ulWritePtrBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.usDwordOffset * 4; - ulWritePtrBitOfst = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.byBitOffset; - ulWritePtrFieldSize = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.byFieldSize; - - ulReadPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.usDwordOffset * 4; - ulReadPtrBitOfst = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.byBitOffset; - ulReadPtrFieldSize = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.byFieldSize; - } - - /*=======================================================================*/ - /* Calculate the repeat count. */ - - /* The buffer length is either the total buffer size or the value specified by the user */ - if ( f_pBufferPlayoutAdd->ulBufferLength == cOCT6100_AUTO_SELECT ) - { - ulBufferLength = pBufferEntry->ulBufferSize; - } - else - { - ulBufferLength = f_pBufferPlayoutAdd->ulBufferLength; - } - - if ( f_pBufferPlayoutAdd->ulDuration != cOCT6100_INVALID_VALUE ) - { - /* With duration and buffer length, we can find the number of times we must repeat playing this buffer. */ - ulBufferDurationMs = ulBufferLength / cOCT6100_SAMPLES_PER_MS; - ulRepeatCount = f_pBufferPlayoutAdd->ulDuration / ulBufferDurationMs; - fRepeatCountSet = TRUE; - - /* Check if buffer is larger then asked duration. */ - if ( ulRepeatCount != 0x0 ) - { - /* We might have to create more then 1 event to accomodate for the repeat-max limit. */ - ulEventsToCreate = ( ulRepeatCount / cOCT6100_REPEAT_MAX ) + 1; - } - else - { - /* No repeat event. Maybe only the duration modulo! */ - ulEventsToCreate = 0x0; - } - - /* Check if must create a second event for a buffer that cannot be played completely. */ - ulDurationModulo = f_pBufferPlayoutAdd->ulDuration % ulBufferDurationMs; - if ( ulDurationModulo != 0x0 ) - { - ulDurationModulo *= cOCT6100_SAMPLES_PER_MS; - if ( ulDurationModulo / cOCT6100_BUFFER_SIZE_GRANULARITY ) - { - /* Round the modulo to be on a buffer size granularity. */ - /* This will round down. */ - ulDurationModulo = ( ulDurationModulo / cOCT6100_BUFFER_SIZE_GRANULARITY ) * cOCT6100_BUFFER_SIZE_GRANULARITY; - - /* If the event about to be created is smaller then the minimum buffer size, */ - /* round up to the minimum required by the hardware. */ - if ( ulDurationModulo < cOCT6100_MINIMUM_BUFFER_SIZE ) - ulDurationModulo = cOCT6100_MINIMUM_BUFFER_SIZE; - ulEventsToCreate++; - } - else - { - /* The modulo is too small to be played. Skip. */ - ulDurationModulo = 0; - } - } - } - else if ( f_pBufferPlayoutAdd->fRepeat == TRUE - && f_pBufferPlayoutAdd->ulRepeatCount != cOCT6100_REPEAT_INFINITELY ) - { - /* The repeat count is set directly from the user. */ - ulRepeatCount = f_pBufferPlayoutAdd->ulRepeatCount; - fRepeatCountSet = TRUE; - } - - /*=======================================================================*/ - - /* Set the playout feature base address. */ - ulPlayoutBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_ulChannelIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst; - - /* Read the read pointer. */ - ulAddress = ulPlayoutBaseAddress + ulReadPtrBytesOfst; - - /* Must read in memory directly since this value is changed by hardware. */ - ulResult = Oct6100ApiReadDword( f_pApiInstance, ulAddress, &ulTempData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulReadPtrFieldSize, ulReadPtrBitOfst, &ulMask ); - - /* Store the read pointer. */ - ulReadPtr = ( ulTempData & ulMask ) >> ulReadPtrBitOfst; - - /* Compare the pointers... Are they different? If so, there is something already in the list. */ - if ( ulReadPtr != ulWritePtr ) - { - /* Check if there is enough room for the playout events. */ - if ( ( pSharedInfo->ImageInfo.fRinBufferPlayoutHardSkip == TRUE ) - && ( pSharedInfo->ImageInfo.fSoutBufferPlayoutHardSkip == TRUE ) ) - { - /* 127 or 31 events image. */ - if ( (UINT8)( ( ulWritePtr - ulReadPtr ) & ( pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents - 1 ) ) >= ( pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents - (UINT8)ulEventsToCreate ) ) - fCheckHardStop = TRUE; - } - else - { - /* Old 31 events image. */ - if ( ( ( ulWritePtr - ulReadPtr ) & 0x1F ) >= ( 0x20 - ulEventsToCreate ) ) - fCheckHardStop = TRUE; - - fOldBufferPlayoutVersion = TRUE; - } - - if ( fCheckHardStop == TRUE ) - { - /* Ok. From what was read, the list is full. But we might still have a chance if the hard-stop */ - /* version was used. In this case, some of the buffers in the list might */ - /* become free in a couple of milliseconds, so try to wait for this. */ - - if ( ( ( f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) && ( pEchoChannel->fRinHardStop == TRUE ) ) - || ( ( f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) && ( pEchoChannel->fSoutHardStop == TRUE ) ) ) - { - /* Read the 'chip' write pointer in the hardware. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - ReadParams.ulReadAddress = ulPlayoutBaseAddress + ulReadPtrBytesOfst; - - /* Get the write pointer in the chip. */ - ulAddress = ulPlayoutBaseAddress + ulWritePtrBytesOfst; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, pEchoChannel, ulAddress, &ulReadData, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulWritePtrFieldSize, ulWritePtrBitOfst, &ulMask ); - - /* Store the write pointer. */ - ulChipWritePtr = ( ulReadData & ulMask ) >> ulWritePtrBitOfst; - - /* Optimize this access by only reading the word we are interested in. */ - if ( ulReadPtrBitOfst < 16 ) - ReadParams.ulReadAddress += 2; - - while( fStillPlaying == TRUE ) - { - /* Read the read pointer until equals to the write pointer. */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move data at correct position according to what was read. */ - if ( ulReadPtrBitOfst < 16 ) - ulTempData = usReadData; - else - ulTempData = usReadData << 16; - - mOCT6100_CREATE_FEATURE_MASK( ulReadPtrFieldSize, ulReadPtrBitOfst, &ulMask ); - - /* Store the read pointer.*/ - ulReadPtr = ( ulTempData & ulMask ) >> ulReadPtrBitOfst; - - /* Playout has finished when the read pointer reaches the write pointer. */ - if ( ulReadPtr == ulChipWritePtr ) - break; - - ulLoopCnt++; - if ( ulLoopCnt > cOCT6100_MAX_LOOP ) - { - return cOCT6100_ERR_FATAL_E7; - } - - aulWaitTime[ 0 ] = 100; - aulWaitTime[ 1 ] = 0; - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /* Clear hard-stop flag. */ - if ( f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - /* No hard stop for now. */ - pEchoChannel->fRinHardStop = FALSE; - } - else /* if ( f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) */ - { - /* No hard stop for now. */ - pEchoChannel->fSoutHardStop = FALSE; - } - - /* Now check again if the event can be added... */ - if ( fOldBufferPlayoutVersion == FALSE ) - { - if ( (UINT8)( ( ulWritePtr - ulReadPtr ) & ( pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents - 1 ) ) >= ( pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents - (UINT8)ulEventsToCreate ) ) - return cOCT6100_ERR_BUFFER_PLAYOUT_ADD_EVENT_BUF_FULL; - } - else /* if ( fOldBufferPlayoutVersion == TRUE ) */ - { - /* Old 31 events image. */ - if ( ( ( ulWritePtr - ulReadPtr ) & 0x1F ) >= ( 0x20 - ulEventsToCreate ) ) - return cOCT6100_ERR_BUFFER_PLAYOUT_ADD_EVENT_BUF_FULL; - } - - /* Good, at least another buffer can be added! Add the buffer to the list. */ - } - else - { - /* Well the list is full! */ - return cOCT6100_ERR_BUFFER_PLAYOUT_ADD_EVENT_BUF_FULL; - } - } - } - - /*=======================================================================*/ - /* Write the events. */ - - for ( ulEventIndex = 0; ulEventIndex < ulEventsToCreate; ulEventIndex ++ ) - { - /* Set the playout event base address. */ - if ( ( pSharedInfo->ImageInfo.fRinBufferPlayoutHardSkip == TRUE ) - && ( pSharedInfo->ImageInfo.fSoutBufferPlayoutHardSkip == TRUE ) ) - { - /* 127 or 31 events image. */ - ulAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + (f_ulChannelIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + ulEventBuffer + (cOCT6100_PLAYOUT_EVENT_MEM_SIZE * (ulWritePtr & ( pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents - 1 ))); - } - else - { - /* Old 31 events image. */ - ulAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + (f_ulChannelIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + ulEventBuffer + (cOCT6100_PLAYOUT_EVENT_MEM_SIZE * (ulWritePtr & 0x1F)); - } - - /* EVENT BASE + 0 */ - /* Make sure the xIS and xHS bits are cleared. */ - ulTempData = 0; - - /* Set the repeat count. */ - if ( fRepeatCountSet == TRUE ) - { - if ( ( ulRepeatCount != 0x0 ) && ( ulRepeatCount <= cOCT6100_REPEAT_MAX ) ) - { - /* Use repeat count directly. */ - ulTempData |= ulRepeatCount; - - /* Will be used later when creating the duration modulo event. */ - ulRepeatCount = 0; - } - else if ( ulRepeatCount != 0x0 ) - { - /* Get ready for next event. */ - ulRepeatCount -= cOCT6100_REPEAT_MAX; - - /* Set maximum for this event. */ - ulTempData |= cOCT6100_REPEAT_MAX; - } - else - { - /* Duration modulo case. Nothing to set here. */ - } - } - else /* if ( fRepeatCountSet != TRUE ) */ - { - /* Repeat only once. */ - ulTempData |= 0x1; - } - - ulResult = Oct6100ApiWriteDword( f_pApiInstance, ulAddress, ulTempData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* EVENT BASE + 4 */ - /* Set the buffer base address and playout configuration. */ - ulAddress += 4; - ulTempData = pBufferEntry->ulBufferBase & 0x07FFFFFF; - - /* Set play indefinitely or loop N times. */ - if ( ( fRepeatCountSet == FALSE ) && ( f_pBufferPlayoutAdd->fRepeat == TRUE ) ) - { - /* Repeat indefinitely. */ - ulTempData |= 0x1 << cOCT6100_PLAYOUT_EVENT_REPEAT_OFFSET; - - if ( f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - pEchoChannel->fRinBufPlayoutRepeatUsed = TRUE; - else /* if ( f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) */ - pEchoChannel->fSoutBufPlayoutRepeatUsed = TRUE; - } - - /* Use loop N times feature. */ - ulTempData |= 0x1 << cOCT6100_PLAYOUT_EVENT_LOOP_TIMES_OFFSET; - - /* Set the law.*/ - ulTempData |= ( pBufferEntry->byBufferPcmLaw << cOCT6100_PLAYOUT_EVENT_LAW_OFFSET ); - - /* Set the mixing configuration.*/ - ulTempData |= f_pBufferPlayoutAdd->ulMixingMode << cOCT6100_PLAYOUT_EVENT_MIX_OFFSET; - - ulResult = Oct6100ApiWriteDword( f_pApiInstance, ulAddress, ulTempData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - - /* EVENT BASE + 8 */ - /* Set the buffer size and playout gain. */ - ulAddress += 4; - - /* Check if we are setting the duration modulo. This would be the last event and this */ - /* event is of a very specific size. */ - if ( ( fRepeatCountSet == TRUE ) - && ( ulEventIndex == ( ulEventsToCreate - 1 ) ) - && ( ulDurationModulo != 0x0 ) ) - { - /* The duration modulo variable contains all that is needed here. */ - ulBufferLength = ulDurationModulo; - } - ulTempData = ulBufferLength; - - /* Adjust playout gain. */ - if ( f_pBufferPlayoutAdd->lGainDb != 0 ) - { - /* Convert the dB value into OctFloat format. */ - usTempData = Oct6100ApiDbAmpHalfToOctFloat( f_pBufferPlayoutAdd->lGainDb ); - ulTempData |= ( usTempData & 0xFF00 ) << 16; - } - else - { - ulTempData |= cOCT6100_PLAYOUT_GAIN; - } - - ulResult = Oct6100ApiWriteDword( f_pApiInstance, ulAddress, ulTempData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* EVENT BASE + 0xC */ - ulAddress += 4; - ulTempData = ( ulBufferLength - 1 ) & 0xFFFFFFC0; /* Must be multiple of 64 bytes */ - - /* Adjust playout gain. */ - if ( f_pBufferPlayoutAdd->lGainDb != 0 ) - { - ulTempData |= ( usTempData & 0xFF ) << 24; - } - - ulResult = Oct6100ApiWriteDword( f_pApiInstance, ulAddress, ulTempData ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Next event. */ - ulWritePtr++; - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Increment the write pointer to make it point to the next empty entry. */ - - if ( f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - pEchoChannel->ulRinBufWritePtr = ( pEchoChannel->ulRinBufWritePtr + ulEventsToCreate ) & ( pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents - 1 ); - /* Remember that a buffer was added on the rin port. */ - pEchoChannel->fRinBufAdded = TRUE; - } - else /* f_pBufferPlayoutAdd->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - pEchoChannel->ulSoutBufWritePtr = ( pEchoChannel->ulSoutBufWritePtr + ulEventsToCreate ) & ( pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents - 1 ); - /* Remember that a buffer was added on the sout port. */ - pEchoChannel->fSoutBufAdded = TRUE; - } - - /*=======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutStartSer - -Description: Starts buffer playout on a channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutStart Pointer to buffer playout start structure. - -f_ulPlayoutStopEventType Playout stop event type to be generated if required. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutStartSer -UINT32 Oct6100BufferPlayoutStartSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart, - IN UINT32 f_ulPlayoutStopEventType ) -{ - UINT32 ulBufferIndex = 0; - UINT32 ulChannelIndex; - BOOL fNotifyOnPlayoutStop; - UINT32 ulUserEventId; - BOOL fAddToCurrentlyPlayingList; - UINT32 ulResult; - - /* Check the user's configuration of the buffer for errors. */ - ulResult = Oct6100ApiCheckPlayoutStartParams( f_pApiInstance, f_pBufferPlayoutStart, &ulChannelIndex, &ulBufferIndex, &fNotifyOnPlayoutStop, &ulUserEventId, &fAddToCurrentlyPlayingList ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write to all resources needed to activate buffer playout. */ - ulResult = Oct6100ApiWriteChanPlayoutStructs( f_pApiInstance, f_pBufferPlayoutStart, ulChannelIndex, ulBufferIndex, fNotifyOnPlayoutStop, ulUserEventId, fAddToCurrentlyPlayingList, f_ulPlayoutStopEventType ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckPlayoutStartParams - -Description: Check the validity of the channel and buffer requested. - Check the validity of the flags requested. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutStart Pointer to buffer playout start structure. -f_pulChannelIndex Pointer to the channel index of the selected channel. -f_pulBufferIndex Pointer to the buffer index within the API's buffer list. -f_pfNotifyOnPlayoutStop Pointer to the notify on playout stop flag. -f_pulUserEventId Pointer to the user event id specified. -f_pfAllowStartIfActive Pointer to the add to currently playing list flag. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckPlayoutStartParams -UINT32 Oct6100ApiCheckPlayoutStartParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart, - OUT PUINT32 f_pulChannelIndex, - OUT PUINT32 f_pulBufferIndex, - OUT PBOOL f_pfNotifyOnPlayoutStop, - OUT PUINT32 f_pulUserEventId, - OUT PBOOL f_pfAllowStartIfActive ) -{ - tPOCT6100_API_CHANNEL pEchoChannel; - UINT32 ulEntryOpenCnt; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxPlayoutBuffers == 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_DISABLED; - - if ( f_pBufferPlayoutStart->ulChannelHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - if ( f_pBufferPlayoutStart->ulPlayoutPort != cOCT6100_CHANNEL_PORT_ROUT && - f_pBufferPlayoutStart->ulPlayoutPort != cOCT6100_CHANNEL_PORT_SOUT ) - return cOCT6100_ERR_BUFFER_PLAYOUT_PLAYOUT_PORT; - - if ( f_pBufferPlayoutStart->fNotifyOnPlayoutStop != FALSE - && f_pBufferPlayoutStart->fNotifyOnPlayoutStop != TRUE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_NOTIFY_ON_STOP; - - if ( f_pBufferPlayoutStart->fAllowStartWhileActive != FALSE - && f_pBufferPlayoutStart->fAllowStartWhileActive != TRUE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_ALLOW_ACTIVE; - - /*=====================================================================*/ - /* Check the channel handle. */ - - if ( (f_pBufferPlayoutStart->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - *f_pulChannelIndex = f_pBufferPlayoutStart->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK; - if ( *f_pulChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChannel, *f_pulChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pBufferPlayoutStart->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChannel->fReserved != TRUE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChannel->byEntryOpenCnt ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - /* The channel cannot be in POWER_DOWN or HT_FREEZE to start the playout. */ - if ( ( pEchoChannel->byEchoOperationMode == cOCT6100_ECHO_OP_MODE_POWER_DOWN ) - || ( pEchoChannel->byEchoOperationMode == cOCT6100_ECHO_OP_MODE_HT_FREEZE ) ) - return cOCT6100_ERR_BUFFER_PLAYOUT_ECHO_OP_MODE; - - /* The channel's NLP must be enabled for playout to occur. */ - if ( pEchoChannel->VqeConfig.fEnableNlp == FALSE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_NLP_DISABLED; - - /*=====================================================================*/ - - /*=====================================================================*/ - /* Check if the user activated the buffer playout events. */ - - if ( f_pBufferPlayoutStart->fNotifyOnPlayoutStop == TRUE - && f_pApiInstance->pSharedInfo->ChipConfig.ulSoftBufPlayoutEventsBufSize == 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_EVENT_DISABLED; - - /*=====================================================================*/ - - /*=====================================================================*/ - /* Check if there is actually a buffer added in the list. */ - - if ( f_pBufferPlayoutStart->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - if ( pEchoChannel->fRinBufAdded == FALSE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_LIST_EMPTY; - } - else /* if ( f_pBufferPlayoutStart->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) */ - { - if ( pEchoChannel->fSoutBufAdded == FALSE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_LIST_EMPTY; - } - - /*=====================================================================*/ - - /* Return the requested information. */ - *f_pfNotifyOnPlayoutStop = f_pBufferPlayoutStart->fNotifyOnPlayoutStop; - *f_pulUserEventId = f_pBufferPlayoutStart->ulUserEventId; - *f_pfAllowStartIfActive = f_pBufferPlayoutStart->fAllowStartWhileActive; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteChanPlayoutStructs - -Description: Write the buffer playout event in the channel main structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutStart Pointer to buffer playout start structure. -f_ulChannelIndex Index of the channel within the API's channel list. -f_ulBufferIndex Index of the buffer within the API's buffer list. -f_fNotifyOnPlayoutStop Flag for the notify on playout stop. -f_ulUserEventId User event id passed to the user when a playout event is generated. -f_fAllowStartIfActive Add to currently playing list flag. -f_ulPlayoutStopEventType Playout stop event type to be generated if required. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteChanPlayoutStructs -UINT32 Oct6100ApiWriteChanPlayoutStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulBufferIndex, - IN BOOL f_fNotifyOnPlayoutStop, - IN UINT32 f_ulUserEventId, - IN BOOL f_fAllowStartIfActive, - IN UINT32 f_ulPlayoutStopEventType ) -{ - tPOCT6100_API_BUFFER pBufferEntry; - tPOCT6100_API_CHANNEL pEchoChannel; - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_READ_PARAMS ReadParams; - - UINT32 ulResult; - - UINT32 ulWritePtr; - UINT32 ulChipWritePtr; - PUINT32 pulSkipPtr; - UINT32 ulWritePtrBytesOfst; - UINT32 ulSkipPtrBytesOfst; - UINT32 ulWritePtrBitOfst; - UINT32 ulSkipPtrBitOfst; - UINT32 ulWritePtrFieldSize; - UINT32 ulSkipPtrFieldSize; - - UINT32 ulIgnoreBytesOfst; - UINT32 ulIgnoreBitOfst; - UINT32 ulIgnoreFieldSize; - - UINT32 ulHardSkipBytesOfst; - UINT32 ulHardSkipBitOfst; - UINT32 ulHardSkipFieldSize; - - UINT32 ulReadPtrBytesOfst; - UINT32 ulReadPtrBitOfst; - UINT32 ulReadPtrFieldSize; - - UINT32 ulPlayoutBaseAddress; - UINT32 ulAddress; - UINT32 ulTempData; - UINT32 ulMask; - UINT32 ulReadData; - UINT32 ulReadPtr; - UINT32 ulLoopCnt = 0; - - UINT16 usReadData; - - BOOL fBufferPlayoutStopDetected; - BOOL fWriteSkipPtr = FALSE; - BOOL fStillPlaying = TRUE; - - UINT32 aulWaitTime[ 2 ]; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChannel, f_ulChannelIndex ); - mOCT6100_GET_BUFFER_ENTRY_PNT( f_pApiInstance->pSharedInfo, pBufferEntry, f_ulBufferIndex ); - - /* First off, check for buffer playout events, if requested for this channel/port. */ - /* At the same time, if requested, check that the playout has stopped for this channel/port. */ - if ( ( ( pEchoChannel->fRinBufPlaying == TRUE ) - && ( ( pEchoChannel->fRinBufPlayoutNotifyOnStop == TRUE ) || ( f_fAllowStartIfActive == FALSE ) ) - && ( f_pBufferPlayoutStart->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) ) - || ( ( ( pEchoChannel->fSoutBufPlaying == TRUE ) || ( f_fAllowStartIfActive == FALSE ) ) - && ( pEchoChannel->fSoutBufPlayoutNotifyOnStop == TRUE ) - && ( f_pBufferPlayoutStart->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) ) ) - { - /* Buffer playout might still be going on for this channel/port. */ - ulResult = Oct6100BufferPlayoutCheckForSpecificEvent( f_pApiInstance, - f_ulChannelIndex, - f_pBufferPlayoutStart->ulPlayoutPort, - pEchoChannel->fRinBufPlayoutNotifyOnStop, - &fBufferPlayoutStopDetected ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check if the user requested to only start if playout is over. Return an error if */ - /* buffer playout is still going on on this channel/port. */ - if ( ( f_fAllowStartIfActive == FALSE ) && ( fBufferPlayoutStopDetected == FALSE ) ) - { - /* No go! User should wait for the current list to stop, or call the */ - /* Oct6100BufferPlayoutStop function. */ - return cOCT6100_ERR_BUFFER_PLAYOUT_STILL_ACTIVE; - } - } - - /* Select the buffer of interest. */ - if ( f_pBufferPlayoutStart->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - ulWritePtr = pEchoChannel->ulRinBufWritePtr; - pulSkipPtr = &pEchoChannel->ulRinBufSkipPtr; - - ulWritePtrBytesOfst = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.usDwordOffset * 4; - ulSkipPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutRinSkipPtrOfst.usDwordOffset * 4; - ulIgnoreBytesOfst = pSharedInfo->MemoryMap.PlayoutRinIgnoreSkipCleanOfst.usDwordOffset * 4; - ulHardSkipBytesOfst = pSharedInfo->MemoryMap.PlayoutRinHardSkipOfst.usDwordOffset * 4; - ulReadPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.usDwordOffset * 4; - - ulWritePtrBitOfst = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.byBitOffset; - ulSkipPtrBitOfst = pSharedInfo->MemoryMap.PlayoutRinSkipPtrOfst.byBitOffset; - ulIgnoreBitOfst = pSharedInfo->MemoryMap.PlayoutRinIgnoreSkipCleanOfst.byBitOffset; - ulHardSkipBitOfst = pSharedInfo->MemoryMap.PlayoutRinHardSkipOfst.byBitOffset; - ulReadPtrBitOfst = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.byBitOffset; - - ulWritePtrFieldSize = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.byFieldSize; - ulSkipPtrFieldSize = pSharedInfo->MemoryMap.PlayoutRinSkipPtrOfst.byFieldSize; - ulIgnoreFieldSize = pSharedInfo->MemoryMap.PlayoutRinIgnoreSkipCleanOfst.byFieldSize; - ulHardSkipFieldSize = pSharedInfo->MemoryMap.PlayoutRinHardSkipOfst.byFieldSize; - ulReadPtrFieldSize = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.byFieldSize; - } - else /* f_pBufferPlayoutStart->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - ulWritePtr = pEchoChannel->ulSoutBufWritePtr; - pulSkipPtr = &pEchoChannel->ulSoutBufSkipPtr; - - ulWritePtrBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.usDwordOffset * 4; - ulSkipPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutSkipPtrOfst.usDwordOffset * 4; - ulIgnoreBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutIgnoreSkipCleanOfst.usDwordOffset * 4; - ulHardSkipBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutHardSkipOfst.usDwordOffset * 4; - ulReadPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.usDwordOffset * 4; - - ulWritePtrBitOfst = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.byBitOffset; - ulSkipPtrBitOfst = pSharedInfo->MemoryMap.PlayoutSoutSkipPtrOfst.byBitOffset; - ulIgnoreBitOfst = pSharedInfo->MemoryMap.PlayoutSoutIgnoreSkipCleanOfst.byBitOffset; - ulHardSkipBitOfst = pSharedInfo->MemoryMap.PlayoutSoutHardSkipOfst.byBitOffset; - ulReadPtrBitOfst = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.byBitOffset; - - ulWritePtrFieldSize = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.byFieldSize; - ulSkipPtrFieldSize = pSharedInfo->MemoryMap.PlayoutSoutSkipPtrOfst.byFieldSize; - ulIgnoreFieldSize = pSharedInfo->MemoryMap.PlayoutSoutIgnoreSkipCleanOfst.byFieldSize; - ulHardSkipFieldSize = pSharedInfo->MemoryMap.PlayoutSoutHardSkipOfst.byFieldSize; - ulReadPtrFieldSize = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.byFieldSize; - } - - - - /* Set the playout feature base address. */ - ulPlayoutBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_ulChannelIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst; - - /* Check if we must wait for stop to complete before starting a new list. */ - if ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == FALSE ) - { - if ( ( ( f_pBufferPlayoutStart->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) && ( pEchoChannel->fRinHardStop == TRUE ) ) - || ( ( f_pBufferPlayoutStart->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) && ( pEchoChannel->fSoutHardStop == TRUE ) ) ) - { - /* Read the read pointer. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - ReadParams.ulReadAddress = ulPlayoutBaseAddress + ulReadPtrBytesOfst; - - /* Get the write pointer in the chip. */ - ulAddress = ulPlayoutBaseAddress + ulWritePtrBytesOfst; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, pEchoChannel, ulAddress, &ulReadData, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulWritePtrFieldSize, ulWritePtrBitOfst, &ulMask ); - - /* Store the write pointer. */ - ulChipWritePtr = ( ulReadData & ulMask ) >> ulWritePtrBitOfst; - - /* Optimize this access by only reading the word we are interested in. */ - if ( ulReadPtrBitOfst < 16 ) - ReadParams.ulReadAddress += 2; - - while( fStillPlaying == TRUE ) - { - /* Read the read pointer until equals to the write pointer. */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move data at correct position according to what was read. */ - if ( ulReadPtrBitOfst < 16 ) - ulTempData = usReadData; - else - ulTempData = usReadData << 16; - - mOCT6100_CREATE_FEATURE_MASK( ulReadPtrFieldSize, ulReadPtrBitOfst, &ulMask ); - - /* Store the read pointer. */ - ulReadPtr = ( ulTempData & ulMask ) >> ulReadPtrBitOfst; - - /* Playout has finished when the read pointer reaches the write pointer. */ - if ( ulReadPtr == ulChipWritePtr ) - break; - - ulLoopCnt++; - if( ulLoopCnt > cOCT6100_MAX_LOOP ) - { - return cOCT6100_ERR_FATAL_E6; - } - - aulWaitTime[ 0 ] = 100; - aulWaitTime[ 1 ] = 0; - ulResult = Oct6100ApiWaitForTime( f_pApiInstance, aulWaitTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - - /* Check if must clear the skip bit. */ - if ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == FALSE ) - { - if ( ( pSharedInfo->ImageInfo.fRinBufferPlayoutHardSkip == TRUE ) - && ( pSharedInfo->ImageInfo.fSoutBufferPlayoutHardSkip == TRUE ) ) - { - /* Make sure the skip bit is cleared to start playout! */ - ulAddress = ulPlayoutBaseAddress + ulIgnoreBytesOfst; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, pEchoChannel, ulAddress, &ulTempData, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulIgnoreFieldSize, ulIgnoreBitOfst, &ulMask ); - - /* Cleared! */ - ulTempData &= ( ~ulMask ); - - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pEchoChannel, - ulAddress, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Make sure the hard skip bit is cleared to start playout! */ - ulAddress = ulPlayoutBaseAddress + ulHardSkipBytesOfst; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChannel, - ulAddress, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulIgnoreFieldSize, ulHardSkipBitOfst, &ulMask ); - - /* Cleared! */ - ulTempData &= ( ~ulMask ); - - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pEchoChannel, - ulAddress, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Write the skip and write pointer to activate buffer playout. */ - - /* Update the skip pointer. */ - if ( ( pSharedInfo->ImageInfo.fRinBufferPlayoutHardSkip == FALSE ) - || ( pSharedInfo->ImageInfo.fSoutBufferPlayoutHardSkip == FALSE ) ) - { - /* Old 31 events image. */ - if ( ( ( ulWritePtr - *pulSkipPtr ) & 0x7F ) > 63 ) - { - *pulSkipPtr = ( ulWritePtr - 63 ) & 0x7F; - fWriteSkipPtr = TRUE; - } - } - else - { - /* No need to update the skip pointer, a bit needs to be set when skipping. */ - /* fWriteSkipPtr set to FALSE from variable declaration. */ - } - - if ( fWriteSkipPtr == TRUE ) - { - /*=======================================================================*/ - /* Fetch and modify the skip pointer. */ - - ulAddress = ulPlayoutBaseAddress + ulSkipPtrBytesOfst; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChannel, - ulAddress, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulSkipPtrFieldSize, ulSkipPtrBitOfst, &ulMask ); - - ulTempData &= ( ~ulMask ); - ulTempData |= *pulSkipPtr << ulSkipPtrBitOfst; - - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pEchoChannel, - ulAddress, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - } - - - /*=======================================================================*/ - /* Fetch and modify the write pointer. */ - - ulAddress = ulPlayoutBaseAddress + ulWritePtrBytesOfst; - - mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInstance, - pEchoChannel, - ulAddress, - &ulTempData, - ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulWritePtrFieldSize, ulWritePtrBitOfst, &ulMask ); - - ulTempData &= ( ~ulMask ); - ulTempData |= ulWritePtr << ulWritePtrBitOfst; - - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pEchoChannel, - ulAddress, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Now update the state of the channel stating that the buffer playout is activated. */ - - /* Select the buffer of interest.*/ - if ( f_pBufferPlayoutStart->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - /* Check if the global ports active stat must be incremented. */ - if ( pEchoChannel->fRinBufPlaying == FALSE ) - { - /* Increment the number of active buffer playout ports. */ - pSharedInfo->ChipStats.usNumberActiveBufPlayoutPorts++; - } - - pEchoChannel->fRinBufPlaying = TRUE; - /* Keep the new notify on event flag. */ - pEchoChannel->fRinBufPlayoutNotifyOnStop = (UINT8)( f_fNotifyOnPlayoutStop & 0xFF ); - /* Keep the specified user event id. */ - pEchoChannel->ulRinUserBufPlayoutEventId = f_ulUserEventId; - /* Keep type of event to be generated. */ - pEchoChannel->byRinPlayoutStopEventType = (UINT8)( f_ulPlayoutStopEventType & 0xFF ); - /* No hard stop for now. */ - pEchoChannel->fRinHardStop = FALSE; - /* No buffer added in the rin list for now. */ - pEchoChannel->fRinBufAdded = FALSE; - /* Buffer playout is active on this channel. */ - pEchoChannel->fBufPlayoutActive = TRUE; - } - else /* f_pBufferPlayoutStart->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - /* Check if the global ports active stat must be incremented. */ - if ( pEchoChannel->fSoutBufPlaying == FALSE ) - { - /* Increment the number of active buffer playout ports. */ - pSharedInfo->ChipStats.usNumberActiveBufPlayoutPorts++; - } - - pEchoChannel->fSoutBufPlaying = TRUE; - /* Keep the new notify on event flag. */ - pEchoChannel->fSoutBufPlayoutNotifyOnStop = (UINT8)( f_fNotifyOnPlayoutStop & 0xFF ); - /* Keep the specified user event id. */ - pEchoChannel->ulSoutUserBufPlayoutEventId = f_ulUserEventId; - /* Keep type of event to be generated. */ - pEchoChannel->bySoutPlayoutStopEventType = (UINT8)( f_ulPlayoutStopEventType & 0xFF ); - /* No hard stop for now. */ - pEchoChannel->fSoutHardStop = FALSE; - /* No buffer added in the sout list for now. */ - pEchoChannel->fSoutBufAdded = FALSE; - /* Buffer playout is active on this channel. */ - pEchoChannel->fBufPlayoutActive = TRUE; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100BufferPlayoutStopSer - -Description: Stops buffer playout on a channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutStop Pointer to buffer playout stop structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100BufferPlayoutStopSer -UINT32 Oct6100BufferPlayoutStopSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop ) -{ - UINT32 ulChannelIndex; - UINT16 usEchoMemIndex; - UINT32 ulResult; - - /* Check the user's configuration of the buffer for errors. */ - ulResult = Oct6100ApiAssertPlayoutStopParams( - f_pApiInstance, - f_pBufferPlayoutStop, - &ulChannelIndex, - &usEchoMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write to all resources needed to deactivate buffer playout. */ - ulResult = Oct6100ApiInvalidateChanPlayoutStructs( - f_pApiInstance, - f_pBufferPlayoutStop, - ulChannelIndex, - usEchoMemIndex - - ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertPlayoutStopParams - -Description: Check the validity of the channel and buffer requested. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutStop Pointer to buffer playout stop structure. -f_pulChannelIndex Pointer to the channel index on which playout is to be stopped. -f_pusEchoMemIndex Pointer to the echo mem index on which playout is to be stopped. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertPlayoutStopParams -UINT32 Oct6100ApiAssertPlayoutStopParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop, - OUT PUINT32 f_pulChannelIndex, - OUT PUINT16 f_pusEchoMemIndex ) -{ - tPOCT6100_API_CHANNEL pEchoChannel; - UINT32 ulEntryOpenCnt; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxPlayoutBuffers == 0 ) - return cOCT6100_ERR_BUFFER_PLAYOUT_DISABLED; - - if ( f_pBufferPlayoutStop->ulChannelHndl == cOCT6100_INVALID_HANDLE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - if ( f_pBufferPlayoutStop->ulPlayoutPort != cOCT6100_CHANNEL_PORT_ROUT && - f_pBufferPlayoutStop->ulPlayoutPort != cOCT6100_CHANNEL_PORT_SOUT ) - return cOCT6100_ERR_BUFFER_PLAYOUT_PLAYOUT_PORT; - - if ( f_pBufferPlayoutStop->fStopCleanly != TRUE && f_pBufferPlayoutStop->fStopCleanly != FALSE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_STOP_CLEANLY; - - /*=====================================================================*/ - /* Check the channel handle. */ - - if ( (f_pBufferPlayoutStop->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - *f_pulChannelIndex = f_pBufferPlayoutStop->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK; - if ( *f_pulChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChannel, *f_pulChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pBufferPlayoutStop->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChannel->fReserved != TRUE ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChannel->byEntryOpenCnt ) - return cOCT6100_ERR_BUFFER_PLAYOUT_CHANNEL_HANDLE_INVALID; - - /* Return echo memory index. */ - *f_pusEchoMemIndex = pEchoChannel->usEchoMemIndex; - - /* Check if buffer playout is active for the selected port. */ - if ( ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - && ( pEchoChannel->fRinBufPlaying == FALSE ) - && ( pEchoChannel->fRinBufAdded == FALSE ) ) - return cOCT6100_ERR_BUFFER_PLAYOUT_NOT_STARTED; - - if ( ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) - && ( pEchoChannel->fSoutBufPlaying == FALSE ) - && ( pEchoChannel->fSoutBufAdded == FALSE ) ) - return cOCT6100_ERR_BUFFER_PLAYOUT_NOT_STARTED; - - /*=====================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInvalidateChanPlayoutStructs - -Description: Write the buffer playout event in the channel main structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pBufferPlayoutStop Pointer to buffer playout stop structure. -f_ulChannelIndex Index of the channel within the API's channel list. -f_usEchoMemIndex Index of the echo channel in hardware memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInvalidateChanPlayoutStructs -UINT32 Oct6100ApiInvalidateChanPlayoutStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop, - IN UINT32 f_ulChannelIndex, - IN UINT16 f_usEchoMemIndex - - ) -{ - tPOCT6100_API_CHANNEL pEchoChannel; - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_WRITE_PARAMS WriteParams; - - UINT32 ulResult; - - UINT32 ulWritePtrBytesOfst; - UINT32 ulWritePtrBitOfst; - UINT32 ulWritePtrFieldSize; - UINT32 ulSkipPtrBytesOfst; - UINT32 ulSkipPtrBitOfst; - UINT32 ulSkipPtrFieldSize; - UINT32 ulIgnoreBytesOfst; - UINT32 ulIgnoreBitOfst; - UINT32 ulIgnoreFieldSize; - UINT32 ulHardSkipBytesOfst; - UINT32 ulHardSkipBitOfst; - UINT32 ulHardSkipFieldSize; - UINT32 ulReadPtrBytesOfst; - UINT32 ulReadPtrBitOfst; - UINT32 ulReadPtrFieldSize; - - UINT32 ulSkipPtr; - UINT32 ulWritePtr; - UINT32 ulReadPtr = 0; - UINT32 ulCurrentPtr; - - UINT32 ulPlayoutBaseAddress; - UINT32 ulAddress; - UINT32 ulTempData; - UINT32 ulMask; - UINT32 ulReadData; - - UINT16 usReadData; - BOOL fCheckStop = FALSE; - - UINT32 ulEventBuffer; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChannel, f_ulChannelIndex ); - - /* Select the port of interest. */ - if ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - ulWritePtr = pEchoChannel->ulRinBufWritePtr; - ulSkipPtr = ulWritePtr; - - ulWritePtrBytesOfst = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.usDwordOffset * 4; - ulWritePtrBitOfst = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.byBitOffset; - ulWritePtrFieldSize = pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst.byFieldSize; - - ulSkipPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutRinSkipPtrOfst.usDwordOffset * 4; - ulSkipPtrBitOfst = pSharedInfo->MemoryMap.PlayoutRinSkipPtrOfst.byBitOffset; - ulSkipPtrFieldSize = pSharedInfo->MemoryMap.PlayoutRinSkipPtrOfst.byFieldSize; - - ulIgnoreBytesOfst = pSharedInfo->MemoryMap.PlayoutRinIgnoreSkipCleanOfst.usDwordOffset * 4; - ulIgnoreBitOfst = pSharedInfo->MemoryMap.PlayoutRinIgnoreSkipCleanOfst.byBitOffset; - ulIgnoreFieldSize = pSharedInfo->MemoryMap.PlayoutRinIgnoreSkipCleanOfst.byFieldSize; - - ulHardSkipBytesOfst = pSharedInfo->MemoryMap.PlayoutRinHardSkipOfst.usDwordOffset * 4; - ulHardSkipBitOfst = pSharedInfo->MemoryMap.PlayoutRinHardSkipOfst.byBitOffset; - ulHardSkipFieldSize = pSharedInfo->MemoryMap.PlayoutRinHardSkipOfst.byFieldSize; - - ulReadPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.usDwordOffset * 4; - ulReadPtrBitOfst = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.byBitOffset; - ulReadPtrFieldSize = pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst.byFieldSize; - } - else /* f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - ulWritePtr = pEchoChannel->ulSoutBufWritePtr; - ulSkipPtr = ulWritePtr; - - ulWritePtrBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.usDwordOffset * 4; - ulWritePtrBitOfst = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.byBitOffset; - ulWritePtrFieldSize = pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst.byFieldSize; - - ulSkipPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutSkipPtrOfst.usDwordOffset * 4; - ulSkipPtrBitOfst = pSharedInfo->MemoryMap.PlayoutSoutSkipPtrOfst.byBitOffset; - ulSkipPtrFieldSize = pSharedInfo->MemoryMap.PlayoutSoutSkipPtrOfst.byFieldSize; - - ulIgnoreBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutIgnoreSkipCleanOfst.usDwordOffset * 4; - ulIgnoreBitOfst = pSharedInfo->MemoryMap.PlayoutSoutIgnoreSkipCleanOfst.byBitOffset; - ulIgnoreFieldSize = pSharedInfo->MemoryMap.PlayoutSoutIgnoreSkipCleanOfst.byFieldSize; - - ulHardSkipBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutHardSkipOfst.usDwordOffset * 4; - ulHardSkipBitOfst = pSharedInfo->MemoryMap.PlayoutSoutHardSkipOfst.byBitOffset; - ulHardSkipFieldSize = pSharedInfo->MemoryMap.PlayoutSoutHardSkipOfst.byFieldSize; - - ulReadPtrBytesOfst = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.usDwordOffset * 4; - ulReadPtrBitOfst = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.byBitOffset; - ulReadPtrFieldSize = pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst.byFieldSize; - } - - /* Set the playout feature base address. */ - ulPlayoutBaseAddress = cOCT6100_CHANNEL_ROOT_BASE + ( f_usEchoMemIndex * cOCT6100_CHANNEL_ROOT_SIZE ) + pSharedInfo->MemoryMap.ulChanRootConfOfst; - - /* Check if something is currently playing. */ - if ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - if ( pEchoChannel->fRinBufPlaying == TRUE ) - { - /* Check if we are stopping it or if it stopped by itself. */ - fCheckStop = TRUE; - } - else - { - /* Not playing! */ - if ( f_pBufferPlayoutStop->pfAlreadyStopped != NULL ) - *f_pBufferPlayoutStop->pfAlreadyStopped = TRUE; - } - } - else /* if ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) */ - { - if ( pEchoChannel->fSoutBufPlaying == TRUE ) - { - /* Check if we are stopping it or if it stopped by itself. */ - fCheckStop = TRUE; - } - else - { - /* Not playing! */ - if ( f_pBufferPlayoutStop->pfAlreadyStopped != NULL ) - *f_pBufferPlayoutStop->pfAlreadyStopped = TRUE; - } - } - - if ( ( fCheckStop == TRUE ) || ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == TRUE ) ) - { - /* Read the read pointer. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - ReadParams.ulReadAddress = ulPlayoutBaseAddress + ulReadPtrBytesOfst; - - /* Optimize this access by only reading the word we are interested in. */ - if ( ulReadPtrBitOfst < 16 ) - ReadParams.ulReadAddress += 2; - - /* Must read in memory directly since this value is changed by hardware */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Move data at correct position according to what was read. */ - if ( ulReadPtrBitOfst < 16 ) - ulTempData = usReadData; - else - ulTempData = usReadData << 16; - - mOCT6100_CREATE_FEATURE_MASK( ulReadPtrFieldSize, ulReadPtrBitOfst, &ulMask ); - - /* Store the read pointer. */ - ulReadPtr = ( ulTempData & ulMask ) >> ulReadPtrBitOfst; - - /* Playout has finished when the read pointer reaches the write pointer. */ - if ( f_pBufferPlayoutStop->pfAlreadyStopped != NULL ) - { - if ( ulReadPtr != ulWritePtr ) - *f_pBufferPlayoutStop->pfAlreadyStopped = FALSE; - else /* if ( ulReadPtr == ulWritePtr ) */ - *f_pBufferPlayoutStop->pfAlreadyStopped = TRUE; - } - } - - /* If the skip bits are located in the event itself, the playout is stopped by setting the */ - /* skip pointer to the hardware chip write pointer. Read it directly from the NLP configuration. */ - if ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == TRUE ) - { - if ( ulReadPtr != ulWritePtr ) - { - /* Get the write pointer in the chip. */ - ulAddress = ulPlayoutBaseAddress + ulWritePtrBytesOfst; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, pEchoChannel, ulAddress, &ulReadData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulWritePtrFieldSize, ulWritePtrBitOfst, &ulMask ); - - /* Store the write pointer. */ - ulWritePtr = ( ulReadData & ulMask ) >> ulWritePtrBitOfst; - ulSkipPtr = ulWritePtr; - } - } - - /* Check if must clear repeat bit. */ - if ( ( ( pEchoChannel->fRinBufPlayoutRepeatUsed == TRUE ) && ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) ) - || ( ( pEchoChannel->fSoutBufPlayoutRepeatUsed == TRUE ) && ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) ) ) - { - if ( ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == FALSE ) - || ( ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == TRUE ) - && ( ulWritePtr != ulReadPtr ) ) ) - { - if ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - ulEventBuffer = pSharedInfo->MemoryMap.ulChanMainRinPlayoutMemOfst; - } - else /* f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - ulEventBuffer = pSharedInfo->MemoryMap.ulChanMainSoutPlayoutMemOfst; - } - - /* Set the playout event base address. */ - if ( ( pSharedInfo->ImageInfo.fRinBufferPlayoutHardSkip == TRUE ) - && ( pSharedInfo->ImageInfo.fSoutBufferPlayoutHardSkip == TRUE ) ) - { - /* 127 or 31 events image. */ - ulAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_usEchoMemIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + ulEventBuffer + (cOCT6100_PLAYOUT_EVENT_MEM_SIZE * ( ( ulWritePtr - 1 ) & ( pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents - 1 ))); - } - else - { - /* Old 31 events image. */ - ulAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_usEchoMemIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + ulEventBuffer + (cOCT6100_PLAYOUT_EVENT_MEM_SIZE * ( ( ulWritePtr - 1 ) & 0x1F)); - } - - /* EVENT BASE + 4 */ - /* Playout configuration. */ - ulAddress += 4; - - ReadParams.ulReadAddress = ulAddress; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Read-clear-write the new repeat bit. */ - usReadData &= 0x7FFF; - - WriteParams.ulWriteAddress = ulAddress; - WriteParams.usWriteData = usReadData; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /* Write the skip to the value of the write pointer to stop buffer playout. */ - - /*=======================================================================*/ - /* First set the ignore skip clean bit if required. */ - - if ( ( pSharedInfo->ImageInfo.fRinBufferPlayoutHardSkip == FALSE ) - || ( pSharedInfo->ImageInfo.fSoutBufferPlayoutHardSkip == FALSE ) ) - { - ulAddress = ulPlayoutBaseAddress + ulIgnoreBytesOfst; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pEchoChannel, - ulAddress, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulIgnoreFieldSize, ulIgnoreBitOfst, &ulMask ); - - ulTempData &= ( ~ulMask ); - - /* Check if the skip need to be clean or not. */ - if ( f_pBufferPlayoutStop->fStopCleanly == FALSE ) - ulTempData |= 0x1 << ulIgnoreBitOfst; - - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pEchoChannel, - ulAddress, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Fetch and modify the write pointer. */ - - ulAddress = ulPlayoutBaseAddress + ulWritePtrBytesOfst; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, pEchoChannel, ulAddress, &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulWritePtrFieldSize, ulWritePtrBitOfst, &ulMask ); - - ulTempData &= ( ~ulMask ); - ulTempData |= ulWritePtr << ulWritePtrBitOfst; - - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pEchoChannel, - ulAddress, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* Fetch and modify the skip pointer. */ - - ulAddress = ulPlayoutBaseAddress + ulSkipPtrBytesOfst; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pEchoChannel, - ulAddress, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulSkipPtrFieldSize, ulSkipPtrBitOfst, &ulMask ); - - ulTempData &= ( ~ulMask ); - ulTempData |= ulSkipPtr << ulSkipPtrBitOfst; - - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pEchoChannel, - ulAddress, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* If in the new buffer playout case, things are in a different order. */ - - if ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == FALSE ) - { - if ( ( pSharedInfo->ImageInfo.fRinBufferPlayoutHardSkip == TRUE ) - && ( pSharedInfo->ImageInfo.fSoutBufferPlayoutHardSkip == TRUE ) ) - { - ulAddress = ulPlayoutBaseAddress + ulHardSkipBytesOfst; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pEchoChannel, - ulAddress, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulHardSkipFieldSize, ulHardSkipBitOfst, &ulMask ); - - ulTempData &= ( ~ulMask ); - - /* Check if the skip need to be clean or not. */ - if ( f_pBufferPlayoutStop->fStopCleanly == FALSE ) - ulTempData |= 0x1 << ulHardSkipBitOfst; - - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pEchoChannel, - ulAddress, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Now is the appropriate time to skip! */ - ulAddress = ulPlayoutBaseAddress + ulIgnoreBytesOfst; - - ulResult = oct6100_retrieve_nlp_conf_dword(f_pApiInstance, - pEchoChannel, - ulAddress, - &ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - mOCT6100_CREATE_FEATURE_MASK( ulIgnoreFieldSize, ulIgnoreBitOfst, &ulMask ); - - ulTempData &= ( ~ulMask ); - - /* Set the skip bit. */ - ulTempData |= 0x1 << ulIgnoreBitOfst; - - ulResult = oct6100_save_nlp_conf_dword(f_pApiInstance, - pEchoChannel, - ulAddress, - ulTempData); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - /*=======================================================================*/ - - - /*=======================================================================*/ - /* The API must set the skip bit in all the events that are queued. */ - - if ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == TRUE ) - { - if ( fCheckStop == TRUE ) - { - if ( ulReadPtr != ulWritePtr ) - { - if ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - ulEventBuffer = pSharedInfo->MemoryMap.ulChanMainRinPlayoutMemOfst; - } - else /* f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - ulEventBuffer = pSharedInfo->MemoryMap.ulChanMainSoutPlayoutMemOfst; - } - - for ( ulCurrentPtr = ulReadPtr; ulCurrentPtr != ulWritePtr; ) - { - /* Set the playout event base address. */ - - /* 127 or 31 events image. */ - ulAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_usEchoMemIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ) + ulEventBuffer + ( cOCT6100_PLAYOUT_EVENT_MEM_SIZE * ulCurrentPtr ); - ulCurrentPtr++; - ulCurrentPtr &= ( pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents - 1 ); - - /* EVENT BASE + 0 playout configuration. */ - WriteParams.ulWriteAddress = ulAddress; - - /* Set skip bit + hard-skip bit. */ - WriteParams.usWriteData = 0x8000; - if ( f_pBufferPlayoutStop->fStopCleanly == FALSE ) - WriteParams.usWriteData |= 0x4000; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - } - } - - /*=======================================================================*/ - /* If stop immediatly, wait the stop before leaving the function. */ - - if ( f_pBufferPlayoutStop->fStopCleanly == FALSE ) - { - /* Remember that an "hard stop" was used for the next start. */ - if ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - pEchoChannel->fRinHardStop = TRUE; - else /* if ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT ) */ - pEchoChannel->fSoutHardStop = TRUE; - } - - /*=======================================================================*/ - /* Update the channel entry to set the playing flag to FALSE. */ - - /* Select the port of interest. */ - if ( f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_ROUT ) - { - /* Check if the global ports active stat must be decremented. */ - if ( pEchoChannel->fRinBufPlaying == TRUE ) - { - /* Decrement the number of active buffer playout ports. */ - pSharedInfo->ChipStats.usNumberActiveBufPlayoutPorts--; - } - - pEchoChannel->fRinBufPlaying = FALSE; - - /* Return user information. */ - if ( f_pBufferPlayoutStop->pfNotifyOnPlayoutStop != NULL ) - *f_pBufferPlayoutStop->pfNotifyOnPlayoutStop = pEchoChannel->fRinBufPlayoutNotifyOnStop; - - /* Make sure no new event is recorded for this channel/port. */ - pEchoChannel->fRinBufPlayoutNotifyOnStop = FALSE; - if ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == TRUE ) - { - pEchoChannel->ulRinBufSkipPtr = ulSkipPtr; - pEchoChannel->ulRinBufWritePtr = ulWritePtr; - } - else /* if ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == FALSE ) */ - pEchoChannel->ulRinBufSkipPtr = pEchoChannel->ulRinBufWritePtr; - - /* The repeat flag can now be used. */ - pEchoChannel->fRinBufPlayoutRepeatUsed = FALSE; - - /* For sure, all buffers have now been cleared on the Rin port. */ - pEchoChannel->fRinBufAdded = FALSE; - - /* Clear optimization flag if possible. */ - if ( ( pEchoChannel->fSoutBufPlaying == FALSE ) - && ( pEchoChannel->fSoutBufPlayoutNotifyOnStop == FALSE ) ) - { - /* Buffer playout is no more active on this channel. */ - pEchoChannel->fBufPlayoutActive = FALSE; - } - } - else /* f_pBufferPlayoutStop->ulPlayoutPort == cOCT6100_CHANNEL_PORT_SOUT */ - { - /* Check if the global ports active stat must be decremented. */ - if ( pEchoChannel->fSoutBufPlaying == TRUE ) - { - /* Decrement the number of active buffer playout ports. */ - pSharedInfo->ChipStats.usNumberActiveBufPlayoutPorts--; - } - - pEchoChannel->fSoutBufPlaying = FALSE; - - /* Return user information. */ - if ( f_pBufferPlayoutStop->pfNotifyOnPlayoutStop != NULL ) - *f_pBufferPlayoutStop->pfNotifyOnPlayoutStop = pEchoChannel->fSoutBufPlayoutNotifyOnStop; - - /* Make sure no new event is recorded for this channel/port. */ - pEchoChannel->fSoutBufPlayoutNotifyOnStop = FALSE; - if ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == TRUE ) - { - pEchoChannel->ulSoutBufSkipPtr = ulSkipPtr; - pEchoChannel->ulSoutBufWritePtr = ulWritePtr; - } - else /* if ( pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents == FALSE ) */ - pEchoChannel->ulSoutBufSkipPtr = pEchoChannel->ulSoutBufWritePtr; - - /* The repeat flag can now be used. */ - pEchoChannel->fSoutBufPlayoutRepeatUsed = FALSE; - - /* For sure, all buffers have now been cleared on the Sout port. */ - pEchoChannel->fSoutBufAdded = FALSE; - - /* Clear optimization flag if possible. */ - if ( ( pEchoChannel->fRinBufPlaying == FALSE ) - && ( pEchoChannel->fRinBufPlayoutNotifyOnStop == FALSE ) ) - { - /* Buffer playout is no more active on this channel. */ - pEchoChannel->fBufPlayoutActive = FALSE; - } - } - - /*=======================================================================*/ - - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveBufPlayoutListEntry - -Description: Reserves a free entry in the Buffer playout list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pulBufferIndex List entry reserved. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveBufPlayoutListEntry -UINT32 Oct6100ApiReserveBufPlayoutListEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT32 f_pulBufferIndex ) -{ - PVOID pBufPlayoutAlloc; - UINT32 ulResult; - - mOCT6100_GET_BUFFER_ALLOC_PNT( f_pApiInstance->pSharedInfo, pBufPlayoutAlloc ) - - ulResult = OctapiLlmAllocAlloc( pBufPlayoutAlloc, f_pulBufferIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_BUFFER_PLAYOUT_ALL_BUFFERS_OPEN; - else - return cOCT6100_ERR_FATAL_40; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseBufPlayoutListEntry - -Description: Release an entry from the Buffer playout list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulBufferIndex List entry to be freed. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseBufPlayoutListEntry -UINT32 Oct6100ApiReleaseBufPlayoutListEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulBufferIndex ) -{ - PVOID pBufPlayoutAlloc; - UINT32 ulResult; - - mOCT6100_GET_BUFFER_ALLOC_PNT( f_pApiInstance->pSharedInfo, pBufPlayoutAlloc ) - - ulResult = OctapiLlmAllocDealloc( pBufPlayoutAlloc, f_ulBufferIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_41; - - return cOCT6100_ERR_OK; -} -#endif diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.c b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.c deleted file mode 100644 index 8afb2f9..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_remote_debug.c +++ /dev/null @@ -1,1598 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_remote_debug.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains the routines used for remote debugging. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 35 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" - -#include "apilib/octapi_bt0.h" -#include "apilib/octapi_largmath.h" - -#include "oct6100api/oct6100_apiud.h" -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_channel_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_debug_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_remote_debug_pub.h" - -#include "octrpc/rpc_protocol.h" -#include "octrpc/oct6100_rpc_protocol.h" - -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_chip_open_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_debug_priv.h" -#include "oct6100_remote_debug_priv.h" - -/**************************** PUBLIC FUNCTIONS *****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100RemoteDebug - -Description: This function interprets the remote debugging packets received - by the user’s software. Commands contained in the packet are - executed by the API. In addition, a response packet is - constructed and returned by the function. It is the responsibility - of the user’s software to transmit the response packet back to - the source of the debugging packet. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pRemoteDebug Pointer to a remote debug structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100RemoteDebugDef -UINT32 Oct6100RemoteDebugDef( - tPOCT6100_REMOTE_DEBUG f_pRemoteDebug ) -{ - f_pRemoteDebug->pulReceivedPktPayload = NULL; - f_pRemoteDebug->ulReceivedPktLength = 0; - f_pRemoteDebug->pulResponsePktPayload = NULL; - f_pRemoteDebug->ulMaxResponsePktLength = 0; - f_pRemoteDebug->ulResponsePktLength = 0; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100RemoteDebug -UINT32 Oct6100RemoteDebug( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_REMOTE_DEBUG f_pRemoteDebug ) -{ - tPOCTRPC_OGRDTP_HEADER pOgrdtpHeader; - tPOCTRPC_INTERFACE_HEADER pInterfaceHeader; - tPOCTRPC_COMMAND_HEADER pRspCmndHeader; - PUINT32 pulRcvPktPayload; - PUINT32 pulRspPktPayload; - UINT32 ulPktLengthDword; - UINT32 ulSessionIndex; - UINT32 ulChecksum; - UINT32 ulResult; - - /* Check for errors. */ - if ( f_pRemoteDebug->pulReceivedPktPayload == NULL ) - return cOCT6100_ERR_REMOTEDEBUG_RECEIVED_PKT_PAYLOAD; - if ( f_pRemoteDebug->pulResponsePktPayload == NULL ) - return cOCT6100_ERR_REMOTEDEBUG_RESPONSE_PKT_PAYLOAD; - if ( f_pRemoteDebug->ulReceivedPktLength < cOCTRPC_MIN_PACKET_BYTE_LENGTH ) - return cOCT6100_ERR_REMOTEDEBUG_RECEIVED_PKT_LENGTH; - if ( f_pRemoteDebug->ulReceivedPktLength > cOCTRPC_MAX_PACKET_BYTE_LENGTH ) - return cOCT6100_ERR_REMOTEDEBUG_RECEIVED_PKT_LENGTH; - if ( f_pRemoteDebug->ulMaxResponsePktLength < f_pRemoteDebug->ulReceivedPktLength ) - return cOCT6100_ERR_REMOTEDEBUG_RESPONSE_PKT_LENGTH; - if ( (f_pRemoteDebug->ulReceivedPktLength % 4) != 0 ) - return cOCT6100_ERR_REMOTEDEBUG_RECEIVED_PKT_LENGTH; - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxRemoteDebugSessions == 0 ) - return cOCT6100_ERR_REMOTEDEBUG_DISABLED; - - /* Set response length as received length. */ - f_pRemoteDebug->ulResponsePktLength = f_pRemoteDebug->ulReceivedPktLength; - - /* Typecast the packet payload to local pointers. */ - pOgrdtpHeader = ( tPOCTRPC_OGRDTP_HEADER )f_pRemoteDebug->pulReceivedPktPayload; - pInterfaceHeader = ( tPOCTRPC_INTERFACE_HEADER )(f_pRemoteDebug->pulReceivedPktPayload + (sizeof( tOCTRPC_OGRDTP_HEADER ) / 4)); - - /* Get local pointer to received and response packet payloads. */ - pulRcvPktPayload = f_pRemoteDebug->pulReceivedPktPayload; - pulRspPktPayload = f_pRemoteDebug->pulResponsePktPayload; - - /* Get the length of the packet in UINT32s. */ - ulPktLengthDword = f_pRemoteDebug->ulReceivedPktLength / 4; - - /* Check the endian detection field to determine if the payload must be */ - /* swapped to account for different endian formats. */ - ulResult = Oct6100ApiCheckEndianDetectField( pOgrdtpHeader, ulPktLengthDword ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Check the packet's length. */ - if ( pOgrdtpHeader->ulPktByteSize != f_pRemoteDebug->ulReceivedPktLength ) - return cOCT6100_ERR_REMOTEDEBUG_RECEIVED_PKT_LENGTH; - - /* Perform the sum of each word in the packet and compare to checksum. */ - Oct6100ApiCalculateChecksum( pulRcvPktPayload, ulPktLengthDword, &ulChecksum ); - if ( ulChecksum != pOgrdtpHeader->ulChecksum ) - return cOCT6100_ERR_REMOTEDEBUG_CHECKSUM; - - /* Check if the packet's session number has a corresponding entry in the API table. - If not then close an entry which has timed out, and allocate the entry to the - new session number. */ - ulResult = Oct6100ApiCheckSessionNum( f_pApiInstance, pOgrdtpHeader, &ulSessionIndex ); - if ( ulResult == cOCT6100_ERR_REMOTEDEBUG_ALL_SESSIONS_OPEN ) - { - Oct6100ApiFormResponsePkt( f_pApiInstance, pulRcvPktPayload, pulRspPktPayload, ulPktLengthDword, FALSE, FALSE, FALSE, FALSE, cOCT6100_INVALID_VALUE, cOCTRPC_RDBGERR_ALL_SESSIONS_OPEN, cOCT6100_INVALID_VALUE, ulChecksum ); - return cOCT6100_ERR_OK; - } - else if ( ulResult == cOCT6100_ERR_REMOTEDEBUG_TRANSACTION_ANSWERED ) - { - Oct6100ApiFormResponsePkt( f_pApiInstance, pulRcvPktPayload, pulRspPktPayload, ulPktLengthDword, TRUE, FALSE, FALSE, FALSE, ulSessionIndex, cOCT6100_INVALID_VALUE, cOCT6100_INVALID_VALUE, ulChecksum ); - return cOCT6100_ERR_OK; - } - else if ( ulResult != cOCT6100_ERR_OK ) - { - return ulResult; - } - - /* Check if an echo packet. If so then there's no need to check the rest of - the packet. Simply copy the packet back to the output buffer, enter the - protocol number supported by this API compilation, and recalculate the - checksum. If the packet is not an echo packet and the protocol version - does not correspond to this compiled version then return the supported - protocol version. */ - if ( pOgrdtpHeader->ulRpcProtocolNum == cOCTRPC_ECHO_PROTOCOL ) - { - Oct6100ApiFormResponsePkt( f_pApiInstance, pulRcvPktPayload, pulRspPktPayload, ulPktLengthDword, FALSE, TRUE, FALSE, FALSE, ulSessionIndex, cOCT6100_INVALID_VALUE, cOCT6100_INVALID_VALUE, ulChecksum ); - return cOCT6100_ERR_OK; - } - else if ( pOgrdtpHeader->ulRpcProtocolNum != cOCTRPC_PROTOCOL_V1_1 ) - { - Oct6100ApiFormResponsePkt( f_pApiInstance, pulRcvPktPayload, pulRspPktPayload, ulPktLengthDword, FALSE, TRUE, FALSE, FALSE, ulSessionIndex, cOCTRPC_RDBGERR_PROTOCOL_NUMBER, cOCT6100_INVALID_VALUE, ulChecksum ); - return cOCT6100_ERR_OK; - } - else if ( f_pRemoteDebug->ulReceivedPktLength <= cOCTRPC_FIRST_COMMAND_BYTE_OFFSET ) - { - Oct6100ApiFormResponsePkt( f_pApiInstance, pulRcvPktPayload, pulRspPktPayload, ulPktLengthDword, FALSE, FALSE, FALSE, FALSE, ulSessionIndex, cOCTRPC_RDBGERR_NO_COMMAND_HEADER, cOCT6100_INVALID_VALUE, ulChecksum ); - return cOCT6100_ERR_OK; - } - - - /* Check the packet's RPC interface type and version. If either does not match then - return the packet with the supported interface type and version of this compilation. */ - if ( pInterfaceHeader->ulInterfaceVersion != cOCTRPC_INTERFACE_VERSION ) - { - Oct6100ApiFormResponsePkt( f_pApiInstance, pulRcvPktPayload, pulRspPktPayload, ulPktLengthDword, FALSE, FALSE, TRUE, TRUE, ulSessionIndex, cOCTRPC_RDBGERR_INTERFACE_VERSION, cOCT6100_INVALID_VALUE, ulChecksum ); - return cOCT6100_ERR_OK; - } - if ( pInterfaceHeader->ulInterfaceType != cOCTRPC_OCT6100_INTERFACE ) - { - Oct6100ApiFormResponsePkt( f_pApiInstance, pulRcvPktPayload, pulRspPktPayload, ulPktLengthDword, FALSE, FALSE, TRUE, TRUE, ulSessionIndex, cOCTRPC_RDBGERR_INTERFACE_TYPE, cOCT6100_INVALID_VALUE, ulChecksum ); - return cOCT6100_ERR_OK; - } - - /* Check each command header to make sure the indicated command and length agree. If - there is an error in the packet's commands then the response packet will be - constructed by the function. */ - ulResult = Oct6100ApiCheckPktCommands( f_pApiInstance, pulRcvPktPayload, pulRspPktPayload, ulSessionIndex, ulPktLengthDword, ulChecksum ); - if ( ulResult == cOCT6100_ERR_REMOTE_DEBUG_PARSING_ERROR ) - return cOCT6100_ERR_OK; - - /* The packet's fields are valid. Each command must now be extracted and executed. */ - Oct6100ApiExecutePktCommands( f_pApiInstance, pulRcvPktPayload, ulPktLengthDword ); - - pRspCmndHeader = ( tPOCTRPC_COMMAND_HEADER )(( PUINT32 )pulRspPktPayload + ((sizeof( tOCTRPC_OGRDTP_HEADER ) + sizeof( tOCTRPC_INTERFACE_HEADER )) / 4)); - - /* Verify if the new method of using the protocol is the selected case. */ - /* All commands have been executed. Calculate the packet's new checksum - and copy the packet to user provided buffer for response packet. */ - Oct6100ApiCalculateChecksum( pulRcvPktPayload, ulPktLengthDword, &ulChecksum ); - - /* Send response packet. */ - Oct6100ApiFormResponsePkt( f_pApiInstance, pulRcvPktPayload, pulRspPktPayload, ulPktLengthDword, FALSE, FALSE, FALSE, FALSE, ulSessionIndex, cOCTRPC_RDBGERR_OK, cOCT6100_INVALID_VALUE, ulChecksum ); - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetRemoteDebugSwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management of remote debugging. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pChipOpen Pointer to chip configuration struct. -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetRemoteDebugSwSizes -UINT32 Oct6100ApiGetRemoteDebugSwSizes( - IN tPOCT6100_CHIP_OPEN f_pChipOpen, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulTempVar; - UINT32 ulResult; - - /* Memory needed for remote debugging sessions. */ - if ( f_pChipOpen->ulMaxRemoteDebugSessions > 0 ) - { - f_pInstSizes->ulRemoteDebugList = f_pChipOpen->ulMaxRemoteDebugSessions * sizeof( tOCT6100_API_REMOTE_DEBUG_SESSION ); - - ulResult = octapi_bt0_get_size( f_pChipOpen->ulMaxRemoteDebugSessions, 4, 4, &f_pInstSizes->ulRemoteDebugTree ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_41; - - f_pInstSizes->ulRemoteDebugPktCache = cOCTRPC_MAX_PACKET_BYTE_LENGTH * f_pChipOpen->ulMaxRemoteDebugSessions; - f_pInstSizes->ulRemoteDebugDataBuf = cOCTRPC_MAX_PACKET_BYTE_LENGTH * 4; - } - else - { - f_pInstSizes->ulRemoteDebugList = 0; - f_pInstSizes->ulRemoteDebugTree = 0; - f_pInstSizes->ulRemoteDebugPktCache = 0; - f_pInstSizes->ulRemoteDebugDataBuf = 0; - } - - /* Round off the size. */ - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulRemoteDebugList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulRemoteDebugTree, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulRemoteDebugPktCache, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulRemoteDebugDataBuf, ulTempVar ) - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRemoteDebuggingSwInit - -Description: Initializes all portions of the API instance associated to - remote debugging. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRemoteDebuggingSwInit -UINT32 Oct6100ApiRemoteDebuggingSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pSessionTree; - UINT32 ulResult; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - pSharedInfo->RemoteDebugInfo.ulNumSessionsOpen = 0; - pSharedInfo->RemoteDebugInfo.ulMaxSessionsOpen = pSharedInfo->ChipConfig.usMaxRemoteDebugSessions; - pSharedInfo->RemoteDebugInfo.ulSessionListHead = cOCT6100_INVALID_VALUE; - pSharedInfo->RemoteDebugInfo.ulSessionListTail = cOCT6100_INVALID_VALUE; - - if ( pSharedInfo->ChipConfig.usMaxRemoteDebugSessions > 0 ) - { - mOCT6100_GET_REMOTE_DEBUG_TREE_PNT( pSharedInfo, pSessionTree ) - - ulResult = octapi_bt0_init( ( ( PVOID* )&pSessionTree ), pSharedInfo->ChipConfig.usMaxRemoteDebugSessions, 4, 4 ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_42; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckEndianDetectField - -Description: Checks the endian field of a packet and performs a swap of - the packet data if deemed necessary. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulPktLengthDword Length of the packet in dwords. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckEndianDetectField -UINT32 Oct6100ApiCheckEndianDetectField( - IN OUT tPOCTRPC_OGRDTP_HEADER f_pOgrdtpHeader, - IN UINT32 f_ulPktLengthDword ) -{ - PUINT32 pulPktPayload; - UINT32 ulBytePositionW = cOCT6100_INVALID_VALUE; - UINT32 ulBytePositionX = cOCT6100_INVALID_VALUE; - UINT32 ulBytePositionY = cOCT6100_INVALID_VALUE; - UINT32 ulBytePositionZ = cOCT6100_INVALID_VALUE; - UINT32 ulTempVar; - UINT32 i; - - /* Bytes in dword are labeled as Z Y X W. */ - - /* Only swap if necessary. */ - if ( f_pOgrdtpHeader->ulEndianDetect != cOCTRPC_ENDIAN_DETECT ) - { - /* Find the position of each byte. */ - for ( i = 0; i < 4; i++ ) - { - ulTempVar = (f_pOgrdtpHeader->ulEndianDetect >> (8 * i)) & 0xFF; - switch ( ulTempVar ) - { - case cOCTRPC_ENDIAN_DETECT_BYTE_W: - ulBytePositionW = i * 8; - break; - case cOCTRPC_ENDIAN_DETECT_BYTE_X: - ulBytePositionX = i * 8; - break; - case cOCTRPC_ENDIAN_DETECT_BYTE_Y: - ulBytePositionY = i * 8; - break; - case cOCTRPC_ENDIAN_DETECT_BYTE_Z: - ulBytePositionZ = i * 8; - break; - default: - return cOCT6100_ERR_REMOTEDEBUG_INVALID_PACKET; - } - } - - /* Make sure all bytes of the endian detect field were found. */ - if ( ulBytePositionW == cOCT6100_INVALID_VALUE || - ulBytePositionX == cOCT6100_INVALID_VALUE || - ulBytePositionY == cOCT6100_INVALID_VALUE || - ulBytePositionZ == cOCT6100_INVALID_VALUE ) - return cOCT6100_ERR_REMOTEDEBUG_INVALID_PACKET; - - /* Swap the bytes of each dword of the packet. */ - pulPktPayload = ( PUINT32 )f_pOgrdtpHeader; - for ( i = 0; i < f_ulPktLengthDword; i++ ) - { - ulTempVar = pulPktPayload[ i ]; - pulPktPayload[ i ] = ((ulTempVar >> ulBytePositionZ) & 0xFF) << 24; - pulPktPayload[ i ] |= ((ulTempVar >> ulBytePositionY) & 0xFF) << 16; - pulPktPayload[ i ] |= ((ulTempVar >> ulBytePositionX) & 0xFF) << 8; - pulPktPayload[ i ] |= ((ulTempVar >> ulBytePositionW) & 0xFF) << 0; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCalculateChecksum - -Description: Calculates the checksum of the given packet payload. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pulPktPayload Pointer to the payload of the packet. -f_ulPktLengthDword Length of the packet in dwords. -f_pulChecksum Pointer to the checksum of the packet. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCalculateChecksum -VOID Oct6100ApiCalculateChecksum( - IN PUINT32 f_pulPktPayload, - IN UINT32 f_ulPktLengthDword, - OUT PUINT32 f_pulChecksum ) -{ - tPOCTRPC_OGRDTP_HEADER pOgrdtpHeader; - UINT32 i; - - for ( i = 0, *f_pulChecksum = 0; i < f_ulPktLengthDword; i++ ) - { - *f_pulChecksum += (f_pulPktPayload[ i ] >> 16) & 0xFFFF; - *f_pulChecksum += (f_pulPktPayload[ i ] >> 0) & 0xFFFF; - } - - pOgrdtpHeader = ( tPOCTRPC_OGRDTP_HEADER )f_pulPktPayload; - *f_pulChecksum -= (pOgrdtpHeader->ulChecksum >> 16) & 0xFFFF; - *f_pulChecksum -= (pOgrdtpHeader->ulChecksum >> 0) & 0xFFFF; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiFormResponsePkt - -Description: Modifies the values of the indicated receive packet, update - the checksum field, and copy the receive packet to the - response packet. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pulRcvPktPayload Pointer to the payload of the received packet. -f_pulRspPktPayload Pointer to the payload of the response packet. -f_ulPktLengthDword Length of the packet in dwords. -f_fRetryPktResponse Flag indicating if the received packet was a retry packet. -f_fReplaceProtocolNum Flag indicating if the protocol number must be replaced. -f_fReplaceInterfaceType Flag indicating if the interface type must be replaced. -f_fReplaceInterfaceVersion Flag indicating if the interface version must be replaced. -f_ulSessionIndex Index of the remote debug session within the API' session list. -f_ulParsingErrorValue Parsing error value. -f_ulPayloadDwordIndex Index in the packet where the payload starts. -f_ulChecksum Checksum of the packet. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiFormResponsePkt -VOID Oct6100ApiFormResponsePkt( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN PUINT32 f_pulRcvPktPayload, - OUT PUINT32 f_pulRspPktPayload, - IN UINT32 f_ulPktLengthDword, - IN BOOL f_fRetryPktResponse, - IN BOOL f_fReplaceProtocolNum, - IN BOOL f_fReplaceInterfaceType, - IN BOOL f_fReplaceInterfaceVersion, - IN UINT32 f_ulSessionIndex, - IN UINT32 f_ulParsingErrorValue, - IN UINT32 f_ulPayloadDwordIndex, - IN UINT32 f_ulChecksum ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCTRPC_OGRDTP_HEADER pOgrdtpHeader; - tPOCTRPC_INTERFACE_HEADER pInterfaceHeader; - PUINT32 pulPktCache; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Typecast pointer to OGRDTP packet header. */ - pOgrdtpHeader = ( tPOCTRPC_OGRDTP_HEADER )f_pulRcvPktPayload; - - /* Check if a response to a retry packet. */ - if ( f_fRetryPktResponse == TRUE ) - { - mOCT6100_GET_REMOTE_DEBUG_SESSION_PKT_CACHE_PNT( pSharedInfo, pulPktCache, f_ulSessionIndex ) - - Oct6100UserMemCopy( f_pulRspPktPayload, pulPktCache, f_ulPktLengthDword * 4 ); - return; - } - - /* Replace all packet header fields which must be changed. */ - if ( f_ulParsingErrorValue != cOCT6100_INVALID_VALUE ) - { - f_ulChecksum -= (pOgrdtpHeader->ulParsingError >> 16) & 0xFFFF; - f_ulChecksum -= (pOgrdtpHeader->ulParsingError >> 0) & 0xFFFF; - - pOgrdtpHeader->ulParsingError = f_ulParsingErrorValue; - - f_ulChecksum += (pOgrdtpHeader->ulParsingError >> 16) & 0xFFFF; - f_ulChecksum += (pOgrdtpHeader->ulParsingError >> 0) & 0xFFFF; - } - - if ( f_fReplaceProtocolNum == TRUE ) - { - f_ulChecksum -= (pOgrdtpHeader->ulRpcProtocolNum >> 16) & 0xFFFF; - f_ulChecksum -= (pOgrdtpHeader->ulRpcProtocolNum >> 0) & 0xFFFF; - - pOgrdtpHeader->ulRpcProtocolNum = cOCTRPC_PROTOCOL_V1_1; - - f_ulChecksum += (pOgrdtpHeader->ulRpcProtocolNum >> 16) & 0xFFFF; - f_ulChecksum += (pOgrdtpHeader->ulRpcProtocolNum >> 0) & 0xFFFF; - } - - if ( f_fReplaceInterfaceType == TRUE ) - { - pInterfaceHeader = ( tPOCTRPC_INTERFACE_HEADER )(f_pulRcvPktPayload + (sizeof( tOCTRPC_OGRDTP_HEADER ) / 4)); - - f_ulChecksum -= (pInterfaceHeader->ulInterfaceType >> 16) & 0xFFFF; - f_ulChecksum -= (pInterfaceHeader->ulInterfaceType >> 0) & 0xFFFF; - - pInterfaceHeader->ulInterfaceType = cOCTRPC_OCT6100_INTERFACE; - - f_ulChecksum += (pInterfaceHeader->ulInterfaceType >> 16) & 0xFFFF; - f_ulChecksum += (pInterfaceHeader->ulInterfaceType >> 0) & 0xFFFF; - } - - if ( f_fReplaceInterfaceVersion == TRUE ) - { - pInterfaceHeader = ( tPOCTRPC_INTERFACE_HEADER )(f_pulRcvPktPayload + (sizeof( tOCTRPC_OGRDTP_HEADER ) / 4)); - - f_ulChecksum -= (pInterfaceHeader->ulInterfaceVersion >> 16) & 0xFFFF; - f_ulChecksum -= (pInterfaceHeader->ulInterfaceVersion >> 0) & 0xFFFF; - - pInterfaceHeader->ulInterfaceVersion = cOCTRPC_INTERFACE_VERSION; - - f_ulChecksum += (pInterfaceHeader->ulInterfaceVersion >> 16) & 0xFFFF; - f_ulChecksum += (pInterfaceHeader->ulInterfaceVersion >> 0) & 0xFFFF; - } - - if ( f_ulPayloadDwordIndex != cOCT6100_INVALID_VALUE ) - { - f_pulRcvPktPayload += f_ulPayloadDwordIndex; - - f_ulChecksum -= (*f_pulRcvPktPayload >> 16) & 0xFFFF; - f_ulChecksum -= (*f_pulRcvPktPayload >> 0) & 0xFFFF; - - *f_pulRcvPktPayload = cOCTRPC_UNKNOWN_COMMAND_NUM; - - f_ulChecksum += (*f_pulRcvPktPayload >> 16) & 0xFFFF; - f_ulChecksum += (*f_pulRcvPktPayload >> 0) & 0xFFFF; - - f_pulRcvPktPayload -= f_ulPayloadDwordIndex; - } - - /* Replace checksum. */ - pOgrdtpHeader->ulChecksum = f_ulChecksum; - - /* Copy the modified receive packet payload to the response packet. */ - Oct6100UserMemCopy( f_pulRspPktPayload, f_pulRcvPktPayload, f_ulPktLengthDword * 4 ); - - /* Copy the response packet to the session's packet cache. */ - if ( f_ulSessionIndex != cOCT6100_INVALID_VALUE ) - { - mOCT6100_GET_REMOTE_DEBUG_SESSION_PKT_CACHE_PNT( pSharedInfo, pulPktCache, f_ulSessionIndex ) - - Oct6100UserMemCopy( pulPktCache, f_pulRspPktPayload, f_ulPktLengthDword * 4 ); - } -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckPktCommands - -Description: Checks the commands contained in the packet for errors in size. - Also checks for unknown commands. If an error is encountered - then the function will construct the response packet. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pulRcvPktPayload Pointer to the payload of the received packet. -f_pulRspPktPayload Pointer to the payload of the response packet. -f_ulPktLengthDword Length of the packet in dwords. -f_ulSessionIndex Index of the remote debug session within the API' session list. -f_ulChecksum Checksum of the packet. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckPktCommands -UINT32 Oct6100ApiCheckPktCommands( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN PUINT32 f_pulRcvPktPayload, - IN OUT PUINT32 f_pulRspPktPayload, - IN UINT32 f_ulSessionIndex, - IN UINT32 f_ulPktLengthDword, - IN UINT32 f_ulChecksum ) -{ - tPOCTRPC_COMMAND_HEADER pCmndHeader; - UINT32 ulNumDwordsLeft; - UINT32 ulNumDwordsNeeded = 0; - UINT32 ulRpcCmndSizeDword; - BOOL fCmndIdentified; - BOOL fCmndHeaderPresent; - - pCmndHeader = ( tPOCTRPC_COMMAND_HEADER )(f_pulRcvPktPayload + ((sizeof( tOCTRPC_OGRDTP_HEADER ) + sizeof( tOCTRPC_INTERFACE_HEADER )) / 4)); - ulNumDwordsLeft = f_ulPktLengthDword - ((sizeof( tOCTRPC_OGRDTP_HEADER ) + sizeof( tOCTRPC_INTERFACE_HEADER )) / 4); - ulRpcCmndSizeDword = sizeof( tOCTRPC_COMMAND_HEADER ) / 4; - fCmndIdentified = TRUE; - - while ( ulNumDwordsLeft != 0 ) - { - if ( ulNumDwordsLeft < ulRpcCmndSizeDword ) - { - fCmndHeaderPresent = FALSE; - } - else - { - fCmndHeaderPresent = TRUE; - - switch ( pCmndHeader->ulRpcCommandNum ) - { - case cOCT6100_RPC_READ_WORD: - { - ulNumDwordsNeeded = sizeof( tOCT6100_RPC_READ_WORD ) / 4; - } - break; - case cOCT6100_RPC_READ_BURST: - { - tPOCT6100_RPC_READ_BURST pBurstHeader; - - ulNumDwordsNeeded = (sizeof( tOCT6100_RPC_READ_BURST ) - sizeof( UINT32 )) / 4; - pBurstHeader = ( tPOCT6100_RPC_READ_BURST )(( PUINT32 )pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - ulNumDwordsNeeded += (pBurstHeader->ulBurstLength + 1) / 2; - } - break; - case cOCT6100_RPC_WRITE_WORD: - { - ulNumDwordsNeeded = sizeof( tOCT6100_RPC_WRITE_WORD ) / 4; - } - break; - case cOCT6100_RPC_WRITE_SMEAR: - { - ulNumDwordsNeeded = sizeof( tOCT6100_RPC_WRITE_SMEAR ) / 4; - } - break; - case cOCT6100_RPC_WRITE_INC: - { - ulNumDwordsNeeded = sizeof( tOCT6100_RPC_WRITE_INC ) / 4; - } - break; - case cOCT6100_RPC_READ_ARRAY: - { - tPOCT6100_RPC_READ_ARRAY pArrayHeader; - - ulNumDwordsNeeded = (sizeof( tOCT6100_RPC_READ_ARRAY ) - sizeof( UINT32 )) / 4; - pArrayHeader = ( tPOCT6100_RPC_READ_ARRAY )(( PUINT32 )pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - ulNumDwordsNeeded += pArrayHeader->ulArrayLength; - ulNumDwordsNeeded += (pArrayHeader->ulArrayLength + 1) / 2; - } - break; - case cOCT6100_RPC_WRITE_BURST: - { - tPOCT6100_RPC_WRITE_BURST pBurstHeader; - - ulNumDwordsNeeded = (sizeof( tOCT6100_RPC_WRITE_BURST ) - sizeof( UINT32 )) / 4; - pBurstHeader = ( tPOCT6100_RPC_WRITE_BURST )(( PUINT32 )pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - ulNumDwordsNeeded += (pBurstHeader->ulBurstLength + 1) / 2; - } - break; - case cOCT6100_RPC_SET_HOT_CHANNEL: - { - ulNumDwordsNeeded = sizeof( tOCT6100_RPC_SET_HOT_CHANNEL ) / 4; - } - break; - case cOCT6100_RPC_GET_DEBUG_CHAN_INDEX: - { - ulNumDwordsNeeded = sizeof( tOCT6100_RPC_GET_DEBUG_CHAN_INDEX ) / 4; - } - break; - case cOCT6100_RPC_API_DISCONNECT: - { - /* There is no parameter to the disconnect command. */ - ulNumDwordsNeeded = 0; - } - break; - default: - fCmndIdentified = FALSE; - } - - ulNumDwordsNeeded += sizeof( tOCTRPC_COMMAND_HEADER ) / 4; - } - - if ( fCmndHeaderPresent != TRUE ) - { - Oct6100ApiFormResponsePkt( f_pApiInstance, f_pulRcvPktPayload, f_pulRspPktPayload, f_ulPktLengthDword, FALSE, FALSE, FALSE, FALSE, f_ulSessionIndex, cOCTRPC_RDBGERR_INVALID_PACKET_LENGTH, cOCT6100_INVALID_VALUE, f_ulChecksum ); - return cOCT6100_ERR_REMOTE_DEBUG_PARSING_ERROR; - } - if ( fCmndIdentified != TRUE ) - { - Oct6100ApiFormResponsePkt( f_pApiInstance, f_pulRcvPktPayload, f_pulRspPktPayload, f_ulPktLengthDword, FALSE, FALSE, FALSE, FALSE, f_ulSessionIndex, cOCTRPC_RDBGERR_INVALID_COMMAND_NUMBER, f_ulPktLengthDword - ulNumDwordsLeft, f_ulChecksum ); - return cOCT6100_ERR_REMOTE_DEBUG_PARSING_ERROR; - } - - if ( ulNumDwordsNeeded != (pCmndHeader->ulCommandByteSize / 4) || - ulNumDwordsNeeded > ulNumDwordsLeft ) - { - Oct6100ApiFormResponsePkt( f_pApiInstance, f_pulRcvPktPayload, f_pulRspPktPayload, f_ulPktLengthDword, FALSE, FALSE, FALSE, FALSE, f_ulSessionIndex, cOCTRPC_RDBGERR_INVALID_COMMAND_LENGTH, cOCT6100_INVALID_VALUE, f_ulChecksum ); - return cOCT6100_ERR_REMOTE_DEBUG_PARSING_ERROR; - } - - pCmndHeader = ( tPOCTRPC_COMMAND_HEADER )(( PUINT32 )pCmndHeader + ulNumDwordsNeeded); - ulNumDwordsLeft -= ulNumDwordsNeeded; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiExecutePktCommands - -Description: Executes the commands contained in the received packet. The - received packet payload buffer is modified but NOT copied to - the response packet buffer. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pulRcvPktPayload Pointer to the payload of the received packet. -f_ulPktLengthDword Length of the packet in dwords. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiExecutePktCommands -VOID Oct6100ApiExecutePktCommands( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN PUINT32 f_pulRcvPktPayload, - IN UINT32 f_ulPktLengthDword ) -{ - tPOCTRPC_COMMAND_HEADER pReqCmndHeader; - tPOCTRPC_OGRDTP_HEADER pReqPktHeader; - UINT32 ulNumDwordsLeft; - UINT32 ulRpcCmndSizeDword; - - pReqPktHeader = ( tPOCTRPC_OGRDTP_HEADER )(f_pulRcvPktPayload); - pReqCmndHeader = ( tPOCTRPC_COMMAND_HEADER )(( PUINT32 )f_pulRcvPktPayload + ((sizeof( tOCTRPC_OGRDTP_HEADER ) + sizeof( tOCTRPC_INTERFACE_HEADER )) / 4)); - ulNumDwordsLeft = f_ulPktLengthDword - ((sizeof( tOCTRPC_OGRDTP_HEADER ) + sizeof( tOCTRPC_INTERFACE_HEADER )) / 4); - ulRpcCmndSizeDword = sizeof( tOCTRPC_COMMAND_HEADER ) / 4; - - while ( ulNumDwordsLeft != 0 ) - { - /* Switch on command number. */ - switch ( pReqCmndHeader->ulRpcCommandNum ) - { - case cOCT6100_RPC_READ_WORD: - Oct6100ApiRpcReadWord( f_pApiInstance, pReqCmndHeader ); - break; - case cOCT6100_RPC_READ_BURST: - Oct6100ApiRpcReadBurst( f_pApiInstance, pReqCmndHeader ); - break; - case cOCT6100_RPC_READ_ARRAY: - Oct6100ApiRpcReadArray( f_pApiInstance, pReqCmndHeader ); - break; - case cOCT6100_RPC_WRITE_WORD: - Oct6100ApiRpcWriteWord( f_pApiInstance, pReqCmndHeader ); - break; - case cOCT6100_RPC_WRITE_SMEAR: - Oct6100ApiRpcWriteSmear( f_pApiInstance, pReqCmndHeader ); - break; - case cOCT6100_RPC_WRITE_BURST: - Oct6100ApiRpcWriteBurst( f_pApiInstance, pReqCmndHeader ); - break; - case cOCT6100_RPC_SET_HOT_CHANNEL: - Oct6100ApiRpcSetHotChannel( f_pApiInstance, pReqCmndHeader ); - break; - case cOCT6100_RPC_GET_DEBUG_CHAN_INDEX: - Oct6100ApiRpcGetDebugChanIndex( f_pApiInstance, pReqCmndHeader ); - break; - case cOCT6100_RPC_API_DISCONNECT: - Oct6100ApiRpcDisconnect( f_pApiInstance, pReqCmndHeader, pReqPktHeader->ulDebugSessionNum ); - break; - default: - pReqCmndHeader->ulFunctionResult = cOCT6100_ERR_REMOTEDEBUG_INVALID_RPC_COMMAND_NUM; - break; - } - - /* Insert the result of the operation in the command header. */ - if ( pReqCmndHeader->ulFunctionResult != cOCT6100_ERR_OK ) - break; - - /* Decrement the number of DWORDs left in the packet. */ - ulNumDwordsLeft -= pReqCmndHeader->ulCommandByteSize / 4; - - /* Point to the next command in the packet. */ - pReqCmndHeader = ( tPOCTRPC_COMMAND_HEADER )(( PUINT32 )pReqCmndHeader + (pReqCmndHeader->ulCommandByteSize / 4)); - } -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckSessionNum - -Description: Checks if there is a session list entry open for the session - number received. If not, a free one is reserved if one is - available. If none are free, one which has timed-out is - released. If none are timed out then an error is returned. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pOgrdtpHeader Pointer to the header of the packet. -f_pulSessionIndex Pointer to the remote debugging session within the - API's session list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckSessionNum -UINT32 Oct6100ApiCheckSessionNum( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCTRPC_OGRDTP_HEADER f_pOgrdtpHeader, - OUT PUINT32 f_pulSessionIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_REMOTE_DEBUG_INFO pRemoteDebugInfo; - tPOCT6100_API_REMOTE_DEBUG_SESSION pSessionEntry; - tPOCT6100_API_REMOTE_DEBUG_SESSION pSessionLink; - tOCT6100_GET_TIME GetTime; - PVOID pSessionTree; - PUINT32 pulTreeData; - UINT32 ulNewSessionIndex; - UINT32 aulTimeDiff[ 2 ]; - UINT32 ulResult; - UINT16 usNegative; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Set the process context of GetTime. */ - GetTime.pProcessContext = f_pApiInstance->pProcessContext; - - /* Get the current system time. */ - ulResult = Oct6100UserGetTime( &GetTime ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Get a local pointer to the remote debugging info. */ - pRemoteDebugInfo = &pSharedInfo->RemoteDebugInfo; - - /* Check if the session number has an associated session list entry. */ - mOCT6100_GET_REMOTE_DEBUG_TREE_PNT( pSharedInfo, pSessionTree ) - - ulResult = octapi_bt0_query_node( pSessionTree, ( ( PVOID )(&f_pOgrdtpHeader->ulDebugSessionNum) ), ( ( PVOID* )&pulTreeData ) ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Return session index. */ - *f_pulSessionIndex = *pulTreeData; - - /* A session list entry is associated, so update the entries last packet time, - transaction number and packet retry number, and position in the linked list. */ - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, *pulTreeData, pSessionEntry ) - - pSessionEntry->aulLastPktTime[ 0 ] = GetTime.aulWallTimeUs[ 0 ]; - pSessionEntry->aulLastPktTime[ 1 ] = GetTime.aulWallTimeUs[ 1 ]; - pSessionEntry->ulPktRetryNum = f_pOgrdtpHeader->ulPktRetryNum; - - /* Remove the node from its current place in the linked-list and add it to the end. */ - if ( pRemoteDebugInfo->ulSessionListTail != *pulTreeData ) - { - /* Obtain local pointer to the session list entry to be moved. */ - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, *pulTreeData, pSessionEntry ) - - /* Update link of previous session in list. */ - if ( pSessionEntry->ulBackwardLink != cOCT6100_INVALID_VALUE ) - { - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, pSessionEntry->ulBackwardLink, pSessionLink ) - pSessionLink->ulForwardLink = pSessionEntry->ulForwardLink; - } - else - { - pRemoteDebugInfo->ulSessionListHead = pSessionEntry->ulForwardLink; - } - - /* Update link of next session in list. */ - if ( pSessionEntry->ulForwardLink != cOCT6100_INVALID_VALUE ) - { - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, pSessionEntry->ulForwardLink, pSessionLink ) - pSessionLink->ulBackwardLink = pSessionEntry->ulBackwardLink; - } - else - { - pRemoteDebugInfo->ulSessionListTail = pSessionEntry->ulBackwardLink; - } - - /* Place session at the end of the list. */ - pSessionEntry->ulBackwardLink = pRemoteDebugInfo->ulSessionListTail; - pSessionEntry->ulForwardLink = cOCT6100_INVALID_VALUE; - - pRemoteDebugInfo->ulSessionListTail = *pulTreeData; - - if ( pRemoteDebugInfo->ulSessionListHead == cOCT6100_INVALID_VALUE ) - { - pRemoteDebugInfo->ulSessionListHead = *pulTreeData; - } - else - { - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, pSessionEntry->ulBackwardLink, pSessionLink ) - pSessionLink->ulForwardLink = *pulTreeData; - } - } - - /* Check if packet should be interpreted based on transaction number. */ - if ( f_pOgrdtpHeader->ulPktRetryNum != 0 && - pSessionEntry->ulTransactionNum == f_pOgrdtpHeader->ulTransactionNum && - pSessionEntry->ulPktByteSize == f_pOgrdtpHeader->ulPktByteSize ) - return cOCT6100_ERR_REMOTEDEBUG_TRANSACTION_ANSWERED; - - /* Update transaction number since packet will be interpreted. */ - pSessionEntry->ulTransactionNum = f_pOgrdtpHeader->ulTransactionNum; - pSessionEntry->ulPktByteSize = f_pOgrdtpHeader->ulPktByteSize; - - return cOCT6100_ERR_OK; - } - else if ( ulResult == OCTAPI_BT0_KEY_NOT_IN_TREE ) - { - /* If there is a free entry in the session list then seize it. Else, try to - find an entry which has timed out. If there are none then return an error. */ - if ( pRemoteDebugInfo->ulNumSessionsOpen < pRemoteDebugInfo->ulMaxSessionsOpen ) - { - ulNewSessionIndex = pRemoteDebugInfo->ulNumSessionsOpen; - } - else /* ( pRemoteDebugInfo->ulNumSessionsOpen == pRemoteDebugInfo->ulMaxSessionsOpen ) */ - { - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, pRemoteDebugInfo->ulSessionListHead, pSessionEntry ) - - ulResult = octapi_lm_subtract( GetTime.aulWallTimeUs, 1, pSessionEntry->aulLastPktTime, 1, aulTimeDiff, 1, &usNegative ); - if ( ulResult != cOCT6100_ERR_OK || usNegative != FALSE ) - return cOCT6100_ERR_FATAL_43; - - /* If there are no session list entries available then return the packet with - a parsing error. */ - if ( aulTimeDiff[ 1 ] == 0 && aulTimeDiff[ 0 ] < (cOCTRPC_SESSION_TIMEOUT * 1000000) ) - return cOCT6100_ERR_REMOTEDEBUG_ALL_SESSIONS_OPEN; - - ulNewSessionIndex = pRemoteDebugInfo->ulSessionListHead; - - /* Remove old session index. */ - ulResult = octapi_bt0_remove_node( pSessionTree, ( ( PVOID )&pSessionEntry->ulSessionNum ) ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_44; - - if ( pSessionEntry->ulBackwardLink != cOCT6100_INVALID_VALUE ) - { - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, pSessionEntry->ulBackwardLink, pSessionLink ) - pSessionLink->ulForwardLink = pSessionEntry->ulForwardLink; - } - else - { - pRemoteDebugInfo->ulSessionListHead = pSessionEntry->ulForwardLink; - } - - if ( pSessionEntry->ulForwardLink != cOCT6100_INVALID_VALUE ) - { - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, pSessionEntry->ulForwardLink, pSessionLink ) - pSessionLink->ulBackwardLink = pSessionEntry->ulBackwardLink; - } - else - { - pRemoteDebugInfo->ulSessionListTail = pSessionEntry->ulBackwardLink; - } - - /* Decrement number of open sessions. */ - pRemoteDebugInfo->ulNumSessionsOpen--; - } - - /* Add new session. */ - ulResult = octapi_bt0_add_node( pSessionTree, ( ( PVOID )&f_pOgrdtpHeader->ulDebugSessionNum ), ( ( PVOID* )&pulTreeData ) ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_45; - *pulTreeData = ulNewSessionIndex; - - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, ulNewSessionIndex, pSessionEntry ) - - pSessionEntry->aulLastPktTime[ 0 ] = GetTime.aulWallTimeUs[ 0 ]; - pSessionEntry->aulLastPktTime[ 1 ] = GetTime.aulWallTimeUs[ 1 ]; - pSessionEntry->ulSessionNum = f_pOgrdtpHeader->ulDebugSessionNum; - pSessionEntry->ulTransactionNum = f_pOgrdtpHeader->ulTransactionNum; - pSessionEntry->ulPktRetryNum = f_pOgrdtpHeader->ulPktRetryNum; - - pSessionEntry->ulBackwardLink = pRemoteDebugInfo->ulSessionListTail; - pSessionEntry->ulForwardLink = cOCT6100_INVALID_VALUE; - - pRemoteDebugInfo->ulSessionListTail = ulNewSessionIndex; - if ( pRemoteDebugInfo->ulSessionListHead == cOCT6100_INVALID_VALUE ) - pRemoteDebugInfo->ulSessionListHead = ulNewSessionIndex; - - if ( pSessionEntry->ulBackwardLink != cOCT6100_INVALID_VALUE ) - { - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, pSessionEntry->ulBackwardLink, pSessionLink ) - pSessionLink->ulForwardLink = ulNewSessionIndex; - } - - *f_pulSessionIndex = ulNewSessionIndex; - - /* Increment number of open sessions. */ - pRemoteDebugInfo->ulNumSessionsOpen++; - - return cOCT6100_ERR_OK; - } - else - { - return cOCT6100_ERR_FATAL_46; - } -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRpcReadWord - -Description: Checks the provided portion of an OCTRPC packet and interprets - it as an cOCT6100_RPC_READ_WORD command. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pCmndHeader Pointer to RPC command structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRpcReadWord -VOID Oct6100ApiRpcReadWord( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ) -{ - tPOCT6100_RPC_READ_WORD pReadCommand; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT16 usReadData; - - /* Get pointer to command arguments. */ - pReadCommand = ( tPOCT6100_RPC_READ_WORD )(( PUINT32 )f_pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - - /* Set some read structure parameters. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Copy parameters from packet payload to local read structure. */ - ReadParams.ulReadAddress = pReadCommand->ulAddress; - - /* Supply memory for read data. */ - ReadParams.pusReadData = &usReadData; - - /* Perform read access. */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - - usReadData &= 0xFFFF; - - /* Return read data and result. */ - pReadCommand->ulReadData = (usReadData << 16) | usReadData; - f_pCmndHeader->ulFunctionResult = ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRpcReadBurst - -Description: Checks the provided portion of an OCTRPC packet and interprets - it as an cOCT6100_RPC_READ_BURST command. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pCmndHeader Pointer to RPC command structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRpcReadBurst -VOID Oct6100ApiRpcReadBurst( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ) -{ - tPOCT6100_RPC_READ_BURST pBurstCommand; - tOCT6100_READ_BURST_PARAMS BurstParams; - UINT32 ulResult = cOCT6100_ERR_OK; - UINT32 ulTempVar; - UINT32 i; - PUINT16 pusReadData; - UINT32 ulNumWordsToRead; - - /* Get local pointer to remote debugging read data buffer. */ - mOCT6100_GET_REMOTE_DEBUG_DATA_BUF_PNT( f_pApiInstance->pSharedInfo, pusReadData ) - - /* Get pointer to command arguments. */ - pBurstCommand = ( tPOCT6100_RPC_READ_BURST )(( PUINT32 )f_pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - - /* Set some read structure parameters. */ - BurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - BurstParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Copy parameters from packet payload to local read structure. */ - BurstParams.ulReadAddress = pBurstCommand->ulAddress; - - - /* Supply memory for read data. */ - BurstParams.pusReadData = pusReadData; - - ulNumWordsToRead = pBurstCommand->ulBurstLength; - while( ulNumWordsToRead > 0) - { - if ( ulNumWordsToRead <= f_pApiInstance->pSharedInfo->ChipConfig.usMaxRwAccesses ) - BurstParams.ulReadLength = ulNumWordsToRead; - else - BurstParams.ulReadLength = f_pApiInstance->pSharedInfo->ChipConfig.usMaxRwAccesses; - - /* Perform read access. */ - mOCT6100_DRIVER_READ_BURST_API( BurstParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - { - f_pCmndHeader->ulFunctionResult = ulResult; - return; - } - - BurstParams.ulReadAddress += BurstParams.ulReadLength * 2; - BurstParams.pusReadData += BurstParams.ulReadLength; - - /* Update the number of dword to read. */ - ulNumWordsToRead -= BurstParams.ulReadLength; - } - - /* Return read data. */ - ulTempVar = (pBurstCommand->ulBurstLength + 1) / 2; - for ( i = 0; i < ulTempVar; i++ ) - { - pBurstCommand->aulReadData[ i ] = (*pusReadData & 0xFFFF) << 16; - pusReadData++; - pBurstCommand->aulReadData[ i ] |= (*pusReadData & 0xFFFF) << 0; - pusReadData++; - } - - /* Return result. */ - f_pCmndHeader->ulFunctionResult = ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRpcReadArray - -Description: Checks the provided portion of an OCTRPC packet and interprets - it as an cOCT6100_RPC_READ_ARRAY command. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pCmndHeader Pointer to RPC command structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRpcReadArray -VOID Oct6100ApiRpcReadArray( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ) -{ - tPOCT6100_RPC_READ_ARRAY pArrayCommand; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult = cOCT6100_ERR_OK; - UINT32 i; - PUINT32 pulAddressArray; - PUINT32 pulDataArray; - UINT16 usReadData; - - - /* Get pointer to command arguments. */ - pArrayCommand = ( tPOCT6100_RPC_READ_ARRAY )(( PUINT32 )f_pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - - /* Set some read structure parameters. */ - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Supply memory for read data. */ - ReadParams.pusReadData = &usReadData; - - /* Get pointers to array of addresses and data. */ - pulAddressArray = pArrayCommand->aulArrayData; - pulDataArray = pArrayCommand->aulArrayData + pArrayCommand->ulArrayLength; - - for ( i = 0; i < pArrayCommand->ulArrayLength; i++ ) - { - /* Copy parameters from packet payload to local read structure. */ - ReadParams.ulReadAddress = pulAddressArray[ i ]; - - /* Perform read access. */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) - if ( ulResult != cOCT6100_ERR_OK ) - break; - - /* Return read data. */ - if ( (i % 2) == 0 ) - pulDataArray[ i / 2 ] = (usReadData & 0xFFFF) << 16; - else /* ( (i % 2) == 1 ) */ - pulDataArray[ i / 2 ] |= (usReadData & 0xFFFF) << 0; - } - - /* Return result. */ - f_pCmndHeader->ulFunctionResult = ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRpcWriteWord - -Description: Checks the provided portion of an OCTRPC packet and interprets - it as an cOCT6100_RPC_WRITE_WORD command. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pCmndHeader Pointer to RPC command structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRpcWriteWord -VOID Oct6100ApiRpcWriteWord( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ) -{ - tPOCT6100_RPC_WRITE_WORD pWriteCommand; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Get pointer to command arguments. */ - pWriteCommand = ( tPOCT6100_RPC_WRITE_WORD )(( PUINT32 )f_pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - - /* Set some read structure parameters. */ - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Copy parameters from packet payload to local read structure. */ - WriteParams.ulWriteAddress = pWriteCommand->ulAddress; - WriteParams.usWriteData = (UINT16)pWriteCommand->ulWriteData; - - /* Perform write access. */ - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) - - /* Return result. */ - f_pCmndHeader->ulFunctionResult = ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRpcWriteSmear - -Description: Checks the provided portion of an OCTRPC packet and interprets - it as an cOCT6100_RPC_WRITE_SMEAR command. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pCmndHeader Pointer to RPC command structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRpcWriteSmear -VOID Oct6100ApiRpcWriteSmear( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ) -{ - tPOCT6100_RPC_WRITE_SMEAR pSmearCommand; - tOCT6100_WRITE_SMEAR_PARAMS SmearParams; - UINT32 ulResult; - - /* Get pointer to command arguments. */ - pSmearCommand = ( tPOCT6100_RPC_WRITE_SMEAR )(( PUINT32 )f_pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - - /* Set the smear structure parameters. */ - SmearParams.pProcessContext = f_pApiInstance->pProcessContext; - - SmearParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Copy parameters from packet payload to local read structure. */ - SmearParams.ulWriteAddress = pSmearCommand->ulAddress; - SmearParams.usWriteData = (UINT16)pSmearCommand->ulWriteData; - SmearParams.ulWriteLength = pSmearCommand->ulSmearLength; - - /* Perform write access. */ - mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ) - - /* Return result. */ - f_pCmndHeader->ulFunctionResult = ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRpcWriteBurst - -Description: Checks the provided portion of an OCTRPC packet and interprets - it as an cOCT6100_RPC_WRITE_BURST command. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pCmndHeader Pointer to RPC command structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRpcWriteBurst -VOID Oct6100ApiRpcWriteBurst( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ) -{ - tPOCT6100_RPC_WRITE_BURST pBurstCommand; - tOCT6100_WRITE_BURST_PARAMS BurstParams; - UINT32 ulResult; - UINT32 ulTempVar; - UINT32 i, j; - PUINT16 pusWriteData; - - /* Get local pointer to remote debugging write data buffer. */ - mOCT6100_GET_REMOTE_DEBUG_DATA_BUF_PNT( f_pApiInstance->pSharedInfo, pusWriteData ) - - /* Get pointer to command arguments. */ - pBurstCommand = ( tPOCT6100_RPC_WRITE_BURST )(( PUINT32 )f_pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - - ulTempVar = (pBurstCommand->ulBurstLength + 1) / 2; - for ( i = 0, j = 0; i < ulTempVar; i++ ) - { - pusWriteData[ j++ ] = (UINT16)((pBurstCommand->aulWriteData[ i ] >> 16) & 0xFFFF); - pusWriteData[ j++ ] = (UINT16)((pBurstCommand->aulWriteData[ i ] >> 0) & 0xFFFF); - } - - /* Set some structure parameters. */ - BurstParams.pProcessContext = f_pApiInstance->pProcessContext; - - BurstParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - - /* Copy parameters from packet payload to local read structure. */ - BurstParams.ulWriteAddress = pBurstCommand->ulAddress; - BurstParams.ulWriteLength = pBurstCommand->ulBurstLength; - BurstParams.pusWriteData = pusWriteData; - - /* Perform write access. */ - mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ) - - /* Return result. */ - f_pCmndHeader->ulFunctionResult = ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRpcSetHotChannel - -Description: Checks the provided portion of an OCTRPC packet and interprets - it as an cOCT6100_RPC_SET_HOT_CHANNEL command. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pCmndHeader Pointer to RPC command structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRpcSetHotChannel -VOID Oct6100ApiRpcSetHotChannel( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ) -{ - tPOCT6100_RPC_SET_HOT_CHANNEL pHotChanCommand; - tOCT6100_DEBUG_SELECT_CHANNEL DebugSelectChannel; - tPOCT6100_API_CHANNEL pChanEntry; - UINT32 ulResult; - - pHotChanCommand = ( tPOCT6100_RPC_SET_HOT_CHANNEL )(( PUINT32 )f_pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - - /* Verify if the hot channel index is valid. */ - if ( pHotChanCommand->ulHotChannel >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - { - f_pCmndHeader->ulFunctionResult = cOCT6100_ERR_REMOTEDEBUG_INVALID_HOT_CHAN_INDEX; - return; - } - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pChanEntry, pHotChanCommand->ulHotChannel ); - - DebugSelectChannel.ulChannelHndl = cOCT6100_HNDL_TAG_CHANNEL | (pChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | pHotChanCommand->ulHotChannel; - - /* The PCM law parameter is now obsolete. */ - /* The instance knows the law of the channel being recorded! */ - - /* Call the function. */ - ulResult = Oct6100DebugSelectChannelSer( f_pApiInstance, &DebugSelectChannel, FALSE ); - - /* Return result. */ - f_pCmndHeader->ulFunctionResult = ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRpcGetDebugChanIndex - -Description: Checks the provided portion of an OCTRPC packet and interprets - it as an cOCT6100_RPC_GET_DEBUG_CHAN_INDEX command. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pCmndHeader Pointer to RPC command structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRpcGetDebugChanIndex -VOID Oct6100ApiRpcGetDebugChanIndex( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ) -{ - tPOCT6100_RPC_GET_DEBUG_CHAN_INDEX pDebugChanCommand; - - pDebugChanCommand = ( tPOCT6100_RPC_GET_DEBUG_CHAN_INDEX )(( PUINT32 )f_pCmndHeader + (sizeof( tOCTRPC_COMMAND_HEADER ) / 4)); - - /* Set the debug channel index of the structure. */ - pDebugChanCommand->ulDebugChanIndex = f_pApiInstance->pSharedInfo->DebugInfo.usRecordMemIndex; - - /* Return result. */ - f_pCmndHeader->ulFunctionResult = cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiRpcDisconnect - -Description: Destroy the current session. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pCmndHeader Pointer to RPC command structure. -f_ulSessionNumber Session number of the current remote debugging session. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiRpcDisconnect -VOID Oct6100ApiRpcDisconnect( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader, - IN UINT32 f_ulSessionNumber ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_REMOTE_DEBUG_INFO pRemoteDebugInfo; - tPOCT6100_API_REMOTE_DEBUG_SESSION pSessionEntry; - tPOCT6100_API_REMOTE_DEBUG_SESSION pSessionTempEntry; - PVOID pSessionTree; - UINT32 ulResult; - PUINT32 pulTreeData; - UINT32 ulSessionIndex; - - f_pCmndHeader->ulFunctionResult = cOCT6100_ERR_OK; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Get a local pointer to the remote debugging info. */ - pRemoteDebugInfo = &pSharedInfo->RemoteDebugInfo; - - /* Check if the session number has an associated session list entry. */ - mOCT6100_GET_REMOTE_DEBUG_TREE_PNT( pSharedInfo, pSessionTree ) - - ulResult = octapi_bt0_query_node( pSessionTree, ( ( PVOID )(&f_ulSessionNumber) ), ( ( PVOID* )&pulTreeData ) ); - if ( ulResult != cOCT6100_ERR_OK ) - f_pCmndHeader->ulFunctionResult = cOCT6100_ERR_REMOTEDEBUG_INAVLID_SESSION_NUMBER; - - /* Return session index. */ - ulSessionIndex= *pulTreeData; - - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, ulSessionIndex, pSessionEntry ); - - /* Clear the entry of the session. */ - pSessionEntry->aulLastPktTime[ 0 ] = 0; - pSessionEntry->aulLastPktTime[ 1 ] = 0; - pSessionEntry->ulSessionNum = cOCT6100_INVALID_VALUE; - pSessionEntry->ulTransactionNum = cOCT6100_INVALID_VALUE; - pSessionEntry->ulPktRetryNum = cOCT6100_INVALID_VALUE; - - /* Update the other entry before removing the node. */ - pSessionEntry->ulBackwardLink = pRemoteDebugInfo->ulSessionListTail; - pSessionEntry->ulForwardLink = cOCT6100_INVALID_VALUE; - - if ( pSessionEntry->ulBackwardLink != cOCT6100_INVALID_VALUE ) - { - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, pSessionEntry->ulBackwardLink, pSessionTempEntry ); - pSessionTempEntry->ulForwardLink = pSessionEntry->ulForwardLink; - } - else /* pSessionEntry->ulBackwardLink == cOCT6100_INVALID_VALUE */ - { - pRemoteDebugInfo->ulSessionListHead = pSessionEntry->ulForwardLink; - } - - if ( pSessionEntry->ulForwardLink != cOCT6100_INVALID_VALUE ) - { - mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, pSessionEntry->ulForwardLink, pSessionTempEntry ); - pSessionTempEntry->ulBackwardLink = pSessionEntry->ulBackwardLink; - } - else /* pSessionEntry->ulForwardLink == cOCT6100_INVALID_VALUE */ - { - pRemoteDebugInfo->ulSessionListTail = pSessionEntry->ulBackwardLink; - } - - /* Invalidate the pointer. */ - pSessionEntry->ulBackwardLink = cOCT6100_INVALID_VALUE; - pSessionEntry->ulForwardLink = cOCT6100_INVALID_VALUE; - - /* Remove the session. */ - ulResult = octapi_bt0_remove_node( pSessionTree, ( ( PVOID )&f_ulSessionNumber ) ); - if ( ulResult != cOCT6100_ERR_OK ) - f_pCmndHeader->ulFunctionResult = cOCT6100_ERR_FATAL_47; - - /* Increment number of open sessions. */ - pRemoteDebugInfo->ulNumSessionsOpen--; -} -#endif diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tlv.c b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tlv.c deleted file mode 100644 index ab2dd70..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tlv.c +++ /dev/null @@ -1,2056 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tlv.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains the functions used to read information allowing the - API to know where all the features supported by this API version are - located in the chip's external memory. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 113 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" - -#include "oct6100api/oct6100_apiud.h" -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" - -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_inst.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_tlv_priv.h" - -/**************************** PRIVATE FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiProcessTlvRegion - -Description: This function will read and interpret the TLV memory of the chip - to obtain memory offsets and features available of the image - loaded into the chip. - - The API will read this region until it finds a TLV type of 0 with - a length of 0. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiProcessTlvRegion -UINT32 Oct6100ApiProcessTlvRegion( - tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tOCT6100_READ_PARAMS ReadParams; - UINT16 usReadData; - UINT32 ulResult; - - UINT32 ulTlvTypeField; - UINT32 ulTlvLengthField; - UINT32 ulTlvWritingTimeoutCount = 0; - UINT32 ulConditionFlag = TRUE; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* Set the address of the first TLV type. */ - ReadParams.ulReadAddress = cOCT6100_TLV_BASE; - ReadParams.ulReadAddress += 2; - - /* Wait for the TLV configuration to be configured in memory. */ - while ( ulConditionFlag ) - { - /* Read the TLV write done flag. */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( usReadData & 0x1 ) - break; - - ulTlvWritingTimeoutCount++; - if ( ulTlvWritingTimeoutCount == 0x100000 ) - return cOCT6100_ERR_TLV_TIMEOUT; - } - - /*======================================================================*/ - /* Read the first 16 bits of the TLV type. */ - - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulTlvTypeField = usReadData << 16; - - /* Read the last word of the TLV type. */ - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulTlvTypeField |= usReadData; - - /*======================================================================*/ - - - /*======================================================================*/ - /* Now, read the TLV field length. */ - - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulTlvLengthField = usReadData << 16; - - /* Read the last word of the TLV length. */ - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulTlvLengthField |= usReadData; - - /* Modify the address to point at the TLV value field. */ - ReadParams.ulReadAddress += 2; - - /*======================================================================*/ - - /* Read the TLV value until the end of TLV region is reached. */ - while( !((ulTlvTypeField == 0) && (ulTlvLengthField == 0)) ) - { - ulResult = Oct6100ApiInterpretTlvEntry( f_pApiInstance, - ulTlvTypeField, - ulTlvLengthField, - ReadParams.ulReadAddress ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the address to after the TLV value. */ - ReadParams.ulReadAddress += ulTlvLengthField; - - /*======================================================================*/ - /* Read the first 16 bits of the TLV type. */ - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulTlvTypeField = usReadData << 16; - - /* Read the last word of the TLV type. */ - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulTlvTypeField |= usReadData; - - /*======================================================================*/ - - - /*======================================================================*/ - /* Now, read the TLV field length. */ - - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulTlvLengthField = usReadData << 16; - - /* Read the last word of the TLV length. */ - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulTlvLengthField |= usReadData; - - ReadParams.ulReadAddress += 2; - - /*======================================================================*/ - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInterpretTlvEntry - -Description: This function will interpret a TLV entry from the chip. All - known TLV types by the API are exhaustively listed here. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_ulTlvFieldType Type of the TLV field to interpret. -f_ulTlvFieldLength Byte length of the TLV field. -f_ulTlvValueAddress Address where the data of the TLV block starts. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInterpretTlvEntry -UINT32 Oct6100ApiInterpretTlvEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulTlvFieldType, - IN UINT32 f_ulTlvFieldLength, - IN UINT32 f_ulTlvValueAddress ) -{ - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult = cOCT6100_ERR_OK; - UINT16 usReadData; - UINT32 i; - UINT32 ulTempValue = 0; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /* Find out how to interpret the TLV value according to the TLV type. */ - switch( f_ulTlvFieldType ) - { - case cOCT6100_TLV_TYPE_VERSION_NUMBER: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_VERSION_NUMBER, - cOCT6100_TLV_MAX_LENGTH_VERSION_NUMBER ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ReadParams.ulReadAddress = f_ulTlvValueAddress; - - for( i = 0; i < (f_ulTlvFieldLength/2); i++ ) - { - /* Perform the actual read. */ - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - f_pApiInstance->pSharedInfo->ImageInfo.szVersionNumber[ (i * 2) ] = (UINT8)((usReadData >> 8) & 0xFF); - f_pApiInstance->pSharedInfo->ImageInfo.szVersionNumber[ (i * 2) + 1 ] = (UINT8)((usReadData >> 0) & 0xFF); - - /* Modify the address. */ - ReadParams.ulReadAddress += 2; - } - } - break; - - case cOCT6100_TLV_TYPE_CUSTOMER_PROJECT_ID: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CUSTOMER_PROJECT_ID, - cOCT6100_TLV_MAX_LENGTH_CUSTOMER_PROJECT_ID ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Perform the actual read. */ - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->ImageInfo.ulBuildId ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_CH0_MAIN_BASE_ADDRESS: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CH0_MAIN_BASE_ADDRESS, - cOCT6100_TLV_MAX_LENGTH_CH0_MAIN_BASE_ADDRESS ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemBase ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemBase &= 0x0FFFFFFF; - - /* Modify the base address to incorporate the external memory offset. */ - f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemBase += cOCT6100_EXTERNAL_MEM_BASE_ADDRESS; - } - break; - - case cOCT6100_TLV_TYPE_CH_MAIN_SIZE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CH_MAIN_SIZE, - cOCT6100_TLV_MAX_LENGTH_CH_MAIN_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainMemSize ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_CH_MAIN_IO_OFFSET: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CH_MAIN_IO_OFFSET, - cOCT6100_TLV_MAX_LENGTH_CH_MAIN_IO_OFFSET ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoMemOfst ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_CH_MAIN_ZCB_OFFSET: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CH_MAIN_ZCB_OFFSET, - cOCT6100_TLV_MAX_LENGTH_CH_MAIN_ZCB_OFFSET ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainRinCBMemOfst ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_CH_MAIN_ZCB_SIZE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CH_MAIN_ZCB_SIZE, - cOCT6100_TLV_MAX_LENGTH_CH_MAIN_ZCB_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainRinCBMemSize ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_CH_MAIN_XCB_OFFSET: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CH_MAIN_XCB_OFFSET, - cOCT6100_TLV_MAX_LENGTH_CH_MAIN_XCB_OFFSET ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainSinCBMemOfst ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_CH_MAIN_XCB_SIZE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CH_MAIN_XCB_SIZE, - cOCT6100_TLV_MAX_LENGTH_CH_MAIN_XCB_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainSinCBMemSize ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_CH_MAIN_YCB_OFFSET: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CH_MAIN_YCB_OFFSET, - cOCT6100_TLV_MAX_LENGTH_CH_MAIN_YCB_OFFSET ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainSoutCBMemOfst ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_CH_MAIN_YCB_SIZE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CH_MAIN_YCB_SIZE, - cOCT6100_TLV_MAX_LENGTH_CH_MAIN_YCB_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainSoutCBMemSize ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_FREE_MEM_BASE_ADDRESS: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_FREE_MEM_BASE_ADDRESS, - cOCT6100_TLV_MAX_LENGTH_FREE_MEM_BASE_ADDRESS ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulFreeMemBaseAddress ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - f_pApiInstance->pSharedInfo->MemoryMap.ulFreeMemBaseAddress &= 0x0FFFFFFF; - - } - break; - - case cOCT6100_TLV_TYPE_CHAN_MAIN_IO_STATS_OFFSET: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CHAN_MAIN_IO_STATS_OFFSET, - cOCT6100_TLV_MAX_LENGTH_CHAN_MAIN_IO_STATS_OFFSET ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoStatsOfst ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_CHAN_MAIN_IO_STATS_SIZE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CHAN_MAIN_IO_STATS_OFFSET, - cOCT6100_TLV_MAX_LENGTH_CHAN_MAIN_IO_STATS_OFFSET ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainIoStatsSize ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_CH_ROOT_CONF_OFFSET: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CH_ROOT_CONF_OFFSET, - cOCT6100_TLV_MAX_LENGTH_CH_ROOT_CONF_OFFSET ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanRootConfOfst ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - - case cOCT6100_TLV_TYPE_POA_CH_MAIN_ZPO_OFFSET: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_CH_MAIN_ZPO_OFFSET, - cOCT6100_TLV_MAX_LENGTH_POA_CH_MAIN_ZPO_OFFSET ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainRinPlayoutMemOfst ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_POA_CH_MAIN_ZPO_SIZE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_CH_MAIN_ZPO_SIZE, - cOCT6100_TLV_MAX_LENGTH_POA_CH_MAIN_ZPO_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainRinPlayoutMemSize ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - break; - - case cOCT6100_TLV_TYPE_POA_CH_MAIN_YPO_OFFSET: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_CH_MAIN_YPO_OFFSET, - cOCT6100_TLV_MAX_LENGTH_POA_CH_MAIN_YPO_OFFSET ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainSoutPlayoutMemOfst ); - } - break; - - case cOCT6100_TLV_TYPE_POA_CH_MAIN_YPO_SIZE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_CH_MAIN_YPO_SIZE, - cOCT6100_TLV_MAX_LENGTH_POA_CH_MAIN_YPO_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ulChanMainSoutPlayoutMemSize ); - } - break; - - case cOCT6100_TLV_TYPE_POA_BOFF_RW_ZWP: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_ZWP, - cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_ZWP ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PlayoutRinWritePtrOfst ); - } - break; - - case cOCT6100_TLV_TYPE_POA_BOFF_RW_ZIS: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_ZIS, - cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_ZIS ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PlayoutRinIgnoreSkipCleanOfst ); - } - break; - - case cOCT6100_TLV_TYPE_POA_BOFF_RW_ZSP: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_ZSP, - cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_ZSP ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PlayoutRinSkipPtrOfst ); - } - break; - - case cOCT6100_TLV_TYPE_POA_BOFF_RW_YWP: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_YWP, - cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_YWP ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PlayoutSoutWritePtrOfst ); - } - break; - - case cOCT6100_TLV_TYPE_POA_BOFF_RW_YIS: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_YIS, - cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_YIS ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PlayoutSoutIgnoreSkipCleanOfst ); - } - break; - - case cOCT6100_TLV_TYPE_POA_BOFF_RW_YSP: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_YSP, - cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_YSP ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PlayoutSoutSkipPtrOfst ); - } - break; - - case cOCT6100_TLV_TYPE_POA_BOFF_RO_ZRP: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RO_ZRP, - cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RO_ZRP ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PlayoutRinReadPtrOfst ); - } - break; - - case cOCT6100_TLV_TYPE_POA_BOFF_RO_YRP: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RO_YRP, - cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RO_YRP ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PlayoutSoutReadPtrOfst ); - } - break; - - case cOCT6100_TLV_TYPE_CNR_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CNR_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_CNR_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ConferencingNoiseReductionOfst ); - } - break; - - case cOCT6100_TLV_TYPE_ANR_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_ANR_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_ANR_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.AdaptiveNoiseReductionOfst ); - } - break; - - case cOCT6100_TLV_TYPE_HZ_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_HZ_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_HZ_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.RinDcOffsetRemovalOfst ); - } - /* Set flag indicating that the feature is present.*/ - f_pApiInstance->pSharedInfo->ImageInfo.fRinDcOffsetRemoval = TRUE; - break; - - case cOCT6100_TLV_TYPE_HX_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_HX_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_HX_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.SinDcOffsetRemovalOfst ); - } - /* Set flag indicating that the feature is present.*/ - f_pApiInstance->pSharedInfo->ImageInfo.fSinDcOffsetRemoval = TRUE; - break; - - case cOCT6100_TLV_TYPE_LCA_Z_CONF_BOFF_RW_GAIN: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_LCA_Z_CONF_BOFF_RW_GAIN, - cOCT6100_TLV_MAX_LENGTH_LCA_Z_CONF_BOFF_RW_GAIN ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.RinLevelControlOfst ); - } - break; - - case cOCT6100_TLV_TYPE_LCA_Y_CONF_BOFF_RW_GAIN: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_LCA_Y_CONF_BOFF_RW_GAIN, - cOCT6100_TLV_MAX_LENGTH_LCA_Y_CONF_BOFF_RW_GAIN ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.SoutLevelControlOfst ); - } - break; - - case cOCT6100_TLV_TYPE_CNA_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CNA_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_CNA_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ComfortNoiseModeOfst ); - } - /* Set flag indicating that the feature is present.*/ - f_pApiInstance->pSharedInfo->ImageInfo.fComfortNoise = TRUE; - break; - - case cOCT6100_TLV_TYPE_NOA_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_NOA_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_NOA_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.NlpControlFieldOfst ); - } - /* Set flag indicating that the feature is present.*/ - f_pApiInstance->pSharedInfo->ImageInfo.fNlpControl = TRUE; - break; - - case cOCT6100_TLV_TYPE_VFA_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_VFA_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_VFA_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.VadControlFieldOfst ); - } - /* Set flag indicating that the feature is present.*/ - f_pApiInstance->pSharedInfo->ImageInfo.fSilenceSuppression = TRUE; - break; - - case cOCT6100_TLV_TYPE_TLA_MAIN_IO_BOFF_RW_TAIL_DISP: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_TLA_MAIN_IO_BOFF_RW_TAIL_DISP, - cOCT6100_TLV_MAX_LENGTH_TLA_MAIN_IO_BOFF_RW_TAIL_DISP ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PouchTailDisplOfst ); - } - break; - - case cOCT6100_TLV_TYPE_BOOTA_POUCH_BOFF_RW_BOOT_INST: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_BOOTA_POUCH_BOFF_RW_BOOT_INST, - cOCT6100_TLV_MAX_LENGTH_BOOTA_POUCH_BOFF_RW_BOOT_INST ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PouchBootInstructionOfst ); - } - break; - - case cOCT6100_TLV_TYPE_BOOTA_POUCH_BOFF_RW_BOOT_RESULT: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_BOOTA_POUCH_BOFF_RW_BOOT_RESULT, - cOCT6100_TLV_MAX_LENGTH_BOOTA_POUCH_BOFF_RW_BOOT_RESULT ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PouchBootResultOfst ); - } - break; - - case cOCT6100_TLV_TYPE_TDM_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_TDM_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_TDM_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ToneDisablerControlOfst ); - } - - f_pApiInstance->pSharedInfo->ImageInfo.fToneDisabler = TRUE; - break; - - case cOCT6100_TLV_TYPE_DIS_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_DIS_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_DIS_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.TailDisplEnableOfst ); - } - - f_pApiInstance->pSharedInfo->ImageInfo.fTailDisplacement = TRUE; - break; - - case cOCT6100_TLV_TYPE_NT_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_NT_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_NT_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.NlpTrivialFieldOfst ); - } - - break; - - case cOCT6100_TLV_TYPE_DEBUG_CHAN_INDEX_VALUE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_DEBUG_CHAN_INDEX_VALUE, - cOCT6100_TLV_MAX_LENGTH_DEBUG_CHAN_INDEX_VALUE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - } - - f_pApiInstance->pSharedInfo->DebugInfo.usRecordMemIndex = (UINT16)( ulTempValue & 0xFFFF ); - - break; - - case cOCT6100_TLV_TYPE_ADPCM_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_ADPCM_ENABLE, - cOCT6100_TLV_MAX_LENGTH_ADPCM_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - } - - if ( ulTempValue == 0 ) - f_pApiInstance->pSharedInfo->ImageInfo.fAdpcm = FALSE; - else - f_pApiInstance->pSharedInfo->ImageInfo.fAdpcm = TRUE; - - break; - - case cOCT6100_TLV_TYPE_CONFERENCING_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CONFERENCING_ENABLE, - cOCT6100_TLV_MAX_LENGTH_CONFERENCING_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - } - - if ( ulTempValue == 0 ) - f_pApiInstance->pSharedInfo->ImageInfo.fConferencing = FALSE; - else - f_pApiInstance->pSharedInfo->ImageInfo.fConferencing = TRUE; - - break; - - case cOCT6100_TLV_TYPE_TONE_DETECTOR_PROFILE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_TONE_DETECTOR_PROFILE, - cOCT6100_TLV_MIN_LENGTH_TONE_DETECTOR_PROFILE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->ImageInfo.ulToneProfileNumber ); - } - - break; - - case cOCT6100_TLV_TYPE_MAX_TAIL_DISPLACEMENT: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_MAX_TAIL_DISPLACEMENT, - cOCT6100_TLV_MAX_LENGTH_MAX_TAIL_DISPLACEMENT ); - if ( ulResult == cOCT6100_ERR_OK ) - { - UINT32 ulTailDispTempValue; - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTailDispTempValue ); - - ulTailDispTempValue += 1; /* Convert the value into milliseconds.*/ - ulTailDispTempValue *= 16; /* value was given in multiple of 16 ms. */ - - if ( ulTailDispTempValue >= 128 ) - f_pApiInstance->pSharedInfo->ImageInfo.usMaxTailDisplacement = (UINT16)( ulTailDispTempValue - 128 ); - else - f_pApiInstance->pSharedInfo->ImageInfo.usMaxTailDisplacement = 0; - - } - - break; - - case cOCT6100_TLV_TYPE_AEC_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_AEC_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_AEC_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.AecFieldOfst ); - } - - /* Set the flag. */ - f_pApiInstance->pSharedInfo->ImageInfo.fAecEnabled = TRUE; - - /* Acoustic echo cancellation available! */ - f_pApiInstance->pSharedInfo->ImageInfo.fAcousticEcho = TRUE; - - break; - - case cOCT6100_TLV_TYPE_PCM_LEAK_CONF_BOFF_RW: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_PCM_LEAK_CONF_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_PCM_LEAK_CONF_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PcmLeakFieldOfst ); - } - - f_pApiInstance->pSharedInfo->ImageInfo.fNonLinearityBehaviorA = TRUE; - break; - - case cOCT6100_TLV_TYPE_DEFAULT_ERL_CONF_BOFF_RW: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_DEFAULT_ERL_CONF_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_DEFAULT_ERL_CONF_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.DefaultErlFieldOfst ); - } - - /* Set the flag. */ - f_pApiInstance->pSharedInfo->ImageInfo.fDefaultErl = TRUE; - - break; - - case cOCT6100_TLV_TYPE_TONE_REM_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_TONE_REM_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_TONE_REM_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ToneRemovalFieldOfst ); - } - - /* Set the flag. */ - f_pApiInstance->pSharedInfo->ImageInfo.fToneRemoval = TRUE; - - break; - - - - case cOCT6100_TLV_TYPE_TLA_MAIN_IO_BOFF_RW_MAX_ECHO_POINT: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_TLA_MAIN_IO_BOFF_RW_MAX_ECHO_POINT, - cOCT6100_TLV_MAX_LENGTH_TLA_MAIN_IO_BOFF_RW_MAX_ECHO_POINT ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ChanMainIoMaxEchoPointOfst ); - } - - /* Set the flag. */ - f_pApiInstance->pSharedInfo->ImageInfo.fMaxEchoPoint = TRUE; - - break; - - case cOCT6100_TLV_TYPE_NLP_CONV_CAP_CONF_BOFF_RW: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_NLP_CONV_CAP_CONF_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_NLP_CONV_CAP_CONF_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.NlpConvCapFieldOfst ); - } - - /* Set the flag. */ - f_pApiInstance->pSharedInfo->ImageInfo.fNonLinearityBehaviorB = TRUE; - - break; - - case cOCT6100_TLV_TYPE_MATRIX_EVENT_SIZE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_MATRIX_EVENT_SIZE, - cOCT6100_TLV_MAX_LENGTH_MATRIX_EVENT_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->DebugInfo.ulDebugEventSize ); - } - - break; - - case cOCT6100_TLV_TYPE_CNR_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CNR_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_CNR_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - f_pApiInstance->pSharedInfo->ImageInfo.fConferencingNoiseReduction = (UINT8)( ulTempValue & 0xFF ); - - if ( f_pApiInstance->pSharedInfo->ImageInfo.fConferencingNoiseReduction == TRUE ) - { - /* Set flag indicating that the dominant speaker feature is present. */ - f_pApiInstance->pSharedInfo->ImageInfo.fDominantSpeakerEnabled = TRUE; - } - } - - break; - - case cOCT6100_TLV_TYPE_MAX_TAIL_LENGTH_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_MAX_TAIL_LENGTH_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_MAX_TAIL_LENGTH_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - f_pApiInstance->pSharedInfo->ImageInfo.usMaxTailLength = (UINT16)( ulTempValue & 0xFFFF ); - } - - break; - - case cOCT6100_TLV_TYPE_MAX_NUMBER_OF_CHANNELS: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_MAX_NUMBER_OF_CHANNELS, - cOCT6100_TLV_MAX_LENGTH_MAX_NUMBER_OF_CHANNELS ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - f_pApiInstance->pSharedInfo->ImageInfo.usMaxNumberOfChannels = (UINT16)( ulTempValue & 0xFFFF ); - } - - break; - - case cOCT6100_TLV_TYPE_PLAYOUT_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_PLAYOUT_ENABLE, - cOCT6100_TLV_MAX_LENGTH_PLAYOUT_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Set flag indicating that the feature is present. */ - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - f_pApiInstance->pSharedInfo->ImageInfo.fBufferPlayout = (UINT8)( ulTempValue & 0xFF ); - } - - break; - - case cOCT6100_TLV_TYPE_DOMINANT_SPEAKER_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_DOMINANT_SPEAKER_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_DOMINANT_SPEAKER_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.DominantSpeakerFieldOfst ); - } - - break; - - case cOCT6100_TLV_TYPE_TAIL_DISP_CONF_BOFF_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_TAIL_DISP_CONF_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_TAIL_DISP_CONF_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PerChanTailDisplacementFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fPerChannelTailDisplacement = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_ANR_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_ANR_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_ANR_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - f_pApiInstance->pSharedInfo->ImageInfo.fAdaptiveNoiseReduction = (UINT8)( ulTempValue & 0xFF ); - } - - break; - - case cOCT6100_TLV_TYPE_MUSIC_PROTECTION_RW_ENABLE: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_MUSIC_PROTECTION_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_MUSIC_PROTECTION_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - f_pApiInstance->pSharedInfo->ImageInfo.fMusicProtection = (UINT8)( ulTempValue & 0xFF ); - } - - break; - - case cOCT6100_TLV_TYPE_AEC_DEFAULT_ERL_BOFF: - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_AEC_DEFAULT_ERL_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_AEC_DEFAULT_ERL_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.AecDefaultErlFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fAecDefaultErl = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_Z_ALC_TARGET_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_Z_ALC_TARGET_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_Z_ALC_TARGET_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.RinAutoLevelControlTargetOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fRinAutoLevelControl = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_Y_ALC_TARGET_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_Y_ALC_TARGET_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_Y_ALC_TARGET_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.SoutAutoLevelControlTargetOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fSoutAutoLevelControl = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_Z_HLC_TARGET_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_Z_HLC_TARGET_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_Z_HLC_TARGET_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.RinHighLevelCompensationThresholdOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fRinHighLevelCompensation = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_Y_HLC_TARGET_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_Y_HLC_TARGET_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_Y_HLC_TARGET_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.SoutHighLevelCompensationThresholdOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fSoutHighLevelCompensation = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_ALC_HLC_STATUS_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_ALC_HLC_STATUS_BOFF_RW_ENABLE, - cOCT6100_TLV_MAX_LENGTH_ALC_HLC_STATUS_BOFF_RW_ENABLE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.AlcHlcStatusOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fAlcHlcStatus = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_Z_PLAYOUT_HARD_SKIP_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_Z_PLAYOUT_HARD_SKIP_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_Z_PLAYOUT_HARD_SKIP_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PlayoutRinHardSkipOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fRinBufferPlayoutHardSkip = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_Y_PLAYOUT_HARD_SKIP_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_Y_PLAYOUT_HARD_SKIP_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_Y_PLAYOUT_HARD_SKIP_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PlayoutSoutHardSkipOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fSoutBufferPlayoutHardSkip = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_AFT_FIELD_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_AFT_FIELD_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_AFT_FIELD_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.AftControlOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fAftControl = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_VOICE_DETECTED_STAT_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_VOICE_DETECTED_STAT_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_VOICE_DETECTED_STAT_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.SinVoiceDetectedStatOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fSinVoiceDetectedStat = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_GAIN_APPLIED_RIN_STAT_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_GAIN_APPLIED_RIN_STAT_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_GAIN_APPLIED_RIN_STAT_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.RinAppliedGainStatOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fRinAppliedGainStat = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_GAIN_APPLIED_SOUT_STAT_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_GAIN_APPLIED_SOUT_STAT_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_GAIN_APPLIED_SOUT_STAT_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.SoutAppliedGainStatOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fSoutAppliedGainStat = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_MAX_ADAPT_ALE_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_MAX_ADAPT_ALE_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_MAX_ADAPT_ALE_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.AdaptiveAleOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fListenerEnhancement = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_RIN_ANR_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_RIN_ANR_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_RIN_ANR_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.RinAnrOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fRoutNoiseReduction = TRUE; - } - - break; - case cOCT6100_TLV_TYPE_RIN_ANR_VALUE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_RIN_ANR_VALUE_RW, - cOCT6100_TLV_MAX_LENGTH_RIN_ANR_VALUE_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.RinAnrValOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fRoutNoiseReductionLevel = TRUE; - } - - break; - case cOCT6100_TLV_TYPE_RIN_MUTE_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_RIN_MUTE_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_RIN_MUTE_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.RinMuteOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fRinMute = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_SIN_MUTE_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_SIN_MUTE_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_SIN_MUTE_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.SinMuteOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fSinMute = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_NUMBER_PLAYOUT_EVENTS: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_NUMBER_PLAYOUT_EVENTS, - cOCT6100_TLV_MAX_LENGTH_NUMBER_PLAYOUT_EVENTS ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - f_pApiInstance->pSharedInfo->ImageInfo.byMaxNumberPlayoutEvents = (UINT8)( ulTempValue & 0xFF ); - } - - break; - - case cOCT6100_TLV_TYPE_ANR_SNR_IMPROVEMENT_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_ANR_SNR_IMPROVEMENT_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_ANR_SNR_IMPROVEMENT_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.AnrSnrEnhancementOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fAnrSnrEnhancement = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_ANR_AGRESSIVITY_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_ANR_AGRESSIVITY_BOFF_RW, - cOCT6100_TLV_MAX_LENGTH_ANR_AGRESSIVITY_BOFF_RW ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.AnrVoiceNoiseSegregationOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fAnrVoiceNoiseSegregation = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_CHAN_TAIL_LENGTH_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CHAN_TAIL_LENGTH_BOFF, - cOCT6100_TLV_MAX_LENGTH_CHAN_TAIL_LENGTH_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PerChanTailLengthFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fPerChannelTailLength = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_CHAN_VQE_TONE_DISABLING_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_CHAN_VQE_TONE_DIS_BOFF, - cOCT6100_TLV_MAX_LENGTH_CHAN_VQE_TONE_DIS_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.ToneDisablerVqeActivationDelayOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fToneDisablerVqeActivationDelay = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_AF_TAIL_DISP_VALUE_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_AF_TAIL_DISP_VALUE_BOFF, - cOCT6100_TLV_MAX_LENGTH_AF_TAIL_DISP_VALUE_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.AfTailDisplacementFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fAfTailDisplacement = TRUE; - } - - break; - - - case cOCT6100_TLV_TYPE_POUCH_COUNTER_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_POUCH_COUNTER_BOFF, - cOCT6100_TLV_MAX_LENGTH_POUCH_COUNTER_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.PouchCounterFieldOfst ); - - f_pApiInstance->pSharedInfo->DebugInfo.fPouchCounter = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_AEC_TAIL_LENGTH_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_AEC_TAIL_BOFF, - cOCT6100_TLV_MAX_LENGTH_AEC_TAIL_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.AecTailLengthFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fAecTailLength = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_MATRIX_DWORD_BASE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_MATRIX_DWORD_BASE, - cOCT6100_TLV_MAX_LENGTH_MATRIX_DWORD_BASE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->DebugInfo.ulMatrixBaseAddress ); - - /* Mask the upper bits set by the firmware. */ - f_pApiInstance->pSharedInfo->DebugInfo.ulMatrixBaseAddress &= 0x0FFFFFFF; - - /* Modify the base address to incorporate the external memory offset. */ - f_pApiInstance->pSharedInfo->DebugInfo.ulMatrixBaseAddress += cOCT6100_EXTERNAL_MEM_BASE_ADDRESS; - } - - break; - - case cOCT6100_TLV_TYPE_DEBUG_CHAN_STATS_BYTE_SIZE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_DEBUG_CHAN_STATS_BYTE_SIZE, - cOCT6100_TLV_MAX_LENGTH_DEBUG_CHAN_STATS_BYTE_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->DebugInfo.ulDebugChanStatsByteSize ); - } - - break; - - case cOCT6100_TLV_TYPE_DEBUG_CHAN_LITE_STATS_BYTE_SIZE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_DEBUG_CHAN_LITE_STATS_BYTE_SIZE, - cOCT6100_TLV_MAX_LENGTH_DEBUG_CHAN_LITE_STATS_BYTE_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->DebugInfo.ulDebugChanLiteStatsByteSize ); - } - - break; - - case cOCT6100_TLV_TYPE_HOT_CHANNEL_SELECT_DWORD_BASE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_HOT_CHANNEL_SELECT_DWORD_BASE, - cOCT6100_TLV_MAX_LENGTH_HOT_CHANNEL_SELECT_DWORD_BASE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->DebugInfo.ulHotChannelSelectBaseAddress ); - } - - break; - - case cOCT6100_TLV_TYPE_MATRIX_TIMESTAMP_DWORD_BASE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_TIMESTAMP_DWORD_BASE, - cOCT6100_TLV_MAX_LENGTH_TIMESTAMP_DWORD_BASE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->DebugInfo.ulMatrixTimestampBaseAddress ); - } - - break; - - case cOCT6100_TLV_TYPE_MATRIX_WP_DWORD_BASE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_MATRIX_WP_DWORD_BASE, - cOCT6100_TLV_MAX_LENGTH_MATRIX_WP_DWORD_BASE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->DebugInfo.ulMatrixWpBaseAddress ); - } - - break; - - case cOCT6100_TLV_TYPE_AF_WRITE_PTR_BYTE_OFFSET: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_AF_WRITE_PTR_BYTE_OFFSET, - cOCT6100_TLV_MAX_LENGTH_AF_WRITE_PTR_BYTE_OFFSET ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->DebugInfo.ulAfWritePtrByteOffset ); - } - - break; - - case cOCT6100_TLV_TYPE_RECORDED_PCM_EVENT_BYTE_SIZE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_RECORDED_PCM_EVENT_BYTE_SIZE, - cOCT6100_TLV_MAX_LENGTH_RECORDED_PCM_EVENT_BYTE_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->DebugInfo.ulRecordedPcmEventByteSize ); - } - - break; - - case cOCT6100_TLV_TYPE_IS_ISR_CALLED_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_IS_ISR_CALLED_BOFF, - cOCT6100_TLV_MAX_LENGTH_IS_ISR_CALLED_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.IsIsrCalledFieldOfst ); - - f_pApiInstance->pSharedInfo->DebugInfo.fIsIsrCalledField = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_MUSIC_PROTECTION_ENABLE_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_MUSIC_PROTECTION_ENABLE_BOFF, - cOCT6100_TLV_MAX_LENGTH_MUSIC_PROTECTION_ENABLE_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.MusicProtectionFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fMusicProtectionConfiguration = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_IDLE_CODE_DETECTION_ENABLE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_IDLE_CODE_DETECTION, - cOCT6100_TLV_MAX_LENGTH_IDLE_CODE_DETECTION ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - f_pApiInstance->pSharedInfo->ImageInfo.fIdleCodeDetection = (UINT8)( ulTempValue & 0xFF ); - } - - break; - - case cOCT6100_TLV_TYPE_IDLE_CODE_DETECTION_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_IDLE_CODE_DETECTION_BOFF, - cOCT6100_TLV_MAX_LENGTH_IDLE_CODE_DETECTION_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.IdleCodeDetectionFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fIdleCodeDetectionConfiguration = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_IMAGE_TYPE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_IMAGE_TYPE, - cOCT6100_TLV_MAX_LENGTH_IMAGE_TYPE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - /* Check if read image type value is what's expected. */ - if ( ( ulTempValue != cOCT6100_IMAGE_TYPE_WIRELINE ) - && ( ulTempValue != cOCT6100_IMAGE_TYPE_COMBINED ) ) - return cOCT6100_ERR_FATAL_E9; - - f_pApiInstance->pSharedInfo->ImageInfo.byImageType = (UINT8)( ulTempValue & 0xFF ); - } - - break; - - case cOCT6100_TLV_TYPE_MAX_WIRELINE_CHANNELS: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_MAX_WIRELINE_CHANNELS, - cOCT6100_TLV_MAX_LENGTH_MAX_WIRELINE_CHANNELS ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - } - - break; - - case cOCT6100_TLV_TYPE_AF_EVENT_CB_SIZE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_AF_EVENT_CB_BYTE_SIZE, - cOCT6100_TLV_MAX_LENGTH_AF_EVENT_CB_BYTE_SIZE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->DebugInfo.ulAfEventCbByteSize ); - } - - break; - - case cOCT6100_TLV_TYPE_BUFFER_PLAYOUT_SKIP_IN_EVENTS: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_BUFFER_PLAYOUT_SKIP_IN_EVENTS, - cOCT6100_TLV_MAX_LENGTH_BUFFER_PLAYOUT_SKIP_IN_EVENTS ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - f_pApiInstance->pSharedInfo->ImageInfo.fBufferPlayoutSkipInEvents = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_ZZ_ENERGY_CHAN_STATS_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_ZZ_ENERGY_CHAN_STATS_BOFF, - cOCT6100_TLV_MAX_LENGTH_ZZ_ENERGY_CHAN_STATS_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.RinEnergyStatFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fRinEnergyStat = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_YY_ENERGY_CHAN_STATS_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_YY_ENERGY_CHAN_STATS_BOFF, - cOCT6100_TLV_MAX_LENGTH_YY_ENERGY_CHAN_STATS_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.SoutEnergyStatFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fSoutEnergyStat = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_DOUBLE_TALK_BEH_MODE: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_DOUBLE_TALK_BEH_MODE, - cOCT6100_TLV_MAX_LENGTH_DOUBLE_TALK_BEH_MODE ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - if ( ulTempValue != 0 ) - f_pApiInstance->pSharedInfo->ImageInfo.fDoubleTalkBehavior = TRUE; - else - f_pApiInstance->pSharedInfo->ImageInfo.fDoubleTalkBehavior = FALSE; - - } - - break; - - case cOCT6100_TLV_TYPE_DOUBLE_TALK_BEH_MODE_BOFF: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_DOUBLE_TALK_BEH_MODE_BOFF, - cOCT6100_TLV_MAX_LENGTH_DOUBLE_TALK_BEH_MODE_BOFF ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiTlvReadBitOffsetStruct( f_pApiInstance, - f_ulTlvValueAddress, - &f_pApiInstance->pSharedInfo->MemoryMap.DoubleTalkBehaviorFieldOfst ); - - f_pApiInstance->pSharedInfo->ImageInfo.fDoubleTalkBehaviorFieldOfst = TRUE; - } - - break; - - case cOCT6100_TLV_TYPE_SOUT_NOISE_BLEACHING: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_SOUT_NOISE_BLEACHING, - cOCT6100_TLV_MAX_LENGTH_SOUT_NOISE_BLEACHING ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - if ( ulTempValue != 0 ) - f_pApiInstance->pSharedInfo->ImageInfo.fSoutNoiseBleaching = TRUE; - else - f_pApiInstance->pSharedInfo->ImageInfo.fSoutNoiseBleaching = FALSE; - - } - - break; - - case cOCT6100_TLV_TYPE_NLP_STATISTICS: - - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_NLP_STATISTICS, - cOCT6100_TLV_MAX_LENGTH_NLP_STATISTICS ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReadDword( f_pApiInstance, - f_ulTlvValueAddress, - &ulTempValue ); - - if ( ulTempValue != 0 ) - f_pApiInstance->pSharedInfo->ImageInfo.fSinLevel = TRUE; - else - f_pApiInstance->pSharedInfo->ImageInfo.fSinLevel = FALSE; - - } - - break; - - default: - /* Unknown TLV type field... check default length and nothing else. */ - ulResult = Oct6100ApiTlvCheckLengthField( f_ulTlvFieldLength, - cOCT6100_TLV_MIN_LENGTH_DEFAULT, - cOCT6100_TLV_MAX_LENGTH_DEFAULT ); - break; - } - - return ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiTlvCheckLengthField - -Description: This function validates the TLV length field. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_ulTlvFieldLength Length field read from the TLV. -f_ulMinLengthValue Minimum value supported for the TLV. -f_ulMaxLengthValue Maximum value supported for the TLV. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiTlvCheckLengthField -UINT32 Oct6100ApiTlvCheckLengthField( - IN UINT32 f_ulTlvFieldLength, - IN UINT32 f_ulMinLengthValue, - IN UINT32 f_ulMaxLengthValue ) -{ - /* Check if the value is too small. */ - if ( f_ulTlvFieldLength < f_ulMinLengthValue ) - return ( cOCT6100_ERR_FATAL_59 ); - - /* Check if the value is too big. */ - if ( f_ulTlvFieldLength > f_ulMaxLengthValue ) - return ( cOCT6100_ERR_FATAL_5A ); - - /* Check if the value is dword aligned. */ - if ( ( f_ulTlvFieldLength % 4 ) != 0 ) - return ( cOCT6100_ERR_OPEN_INVALID_TLV_LENGTH ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiTlvReadBitOffsetStruct - -Description: This function extracts a bit offset structure from the TLV. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulAddress Address where the read the TLV information. -f_pBitOffsetStruct Pointer to a bit offset stucture. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiTlvReadBitOffsetStruct -UINT32 Oct6100ApiTlvReadBitOffsetStruct( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulAddress, - OUT tPOCT6100_TLV_OFFSET f_pBitOffsetStruct ) -{ - tOCT6100_READ_PARAMS ReadParams; - UINT16 usReadData; - - UINT32 ulResult; - UINT32 ulOffsetValue; - UINT32 ulSizeValue; - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = f_pApiInstance->pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - /*======================================================================*/ - /* Read the first 16 bits of the TLV field. */ - - ReadParams.ulReadAddress = f_ulAddress; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulOffsetValue = usReadData << 16; - - /* Read the last word of the TLV type. */ - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulOffsetValue |= usReadData; - - /*======================================================================*/ - - - /*======================================================================*/ - /* Read the first 16 bits of the TLV field. */ - - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulSizeValue = usReadData << 16; - - /* Read the last word of the TLV type. */ - ReadParams.ulReadAddress += 2; - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Save data. */ - ulSizeValue |= usReadData; - - /*======================================================================*/ - - /* Set the structure fields. */ - f_pBitOffsetStruct->usDwordOffset = (UINT16)(ulOffsetValue / 32); - f_pBitOffsetStruct->byBitOffset = (UINT8) (32 - (ulOffsetValue % 32) - ulSizeValue); - f_pBitOffsetStruct->byFieldSize = (UINT8) (ulSizeValue); - - return cOCT6100_ERR_OK; -} -#endif diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tone_detection.c b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tone_detection.c deleted file mode 100644 index 6d9c82b..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tone_detection.c +++ /dev/null @@ -1,1088 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tone_detection.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains functions used to enable and disable tone detection on - an echo channel. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 51 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_channel_inst.h" -#include "oct6100api/oct6100_tone_detection_inst.h" -#include "oct6100api/oct6100_events_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_tone_detection_pub.h" -#include "oct6100api/oct6100_events_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_memory_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_tone_detection_priv.h" -#include "oct6100_events_priv.h" - - -/**************************** PUBLIC FUNCTIONS *****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ToneDetectionEnable - -Description: This function enables the generation of event for a selected - tone on the specified channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pToneDetectEnable Pointer to tone detection enable structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ToneDetectionEnableDef -UINT32 Oct6100ToneDetectionEnableDef( - tPOCT6100_TONE_DETECTION_ENABLE f_pToneDetectEnable ) -{ - f_pToneDetectEnable->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pToneDetectEnable->ulToneNumber = cOCT6100_INVALID_TONE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100ToneDetectionEnable -UINT32 Oct6100ToneDetectionEnable( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_TONE_DETECTION_ENABLE f_pToneDetectEnable ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ToneDetectionEnableSer( f_pApiInstance, f_pToneDetectEnable ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ToneDetectionDisable - -Description: This function disables the detection of a tone for a specific - channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pToneDetectDisable Pointer to tone detection disable structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ToneDetectionDisableDef -UINT32 Oct6100ToneDetectionDisableDef( - tPOCT6100_TONE_DETECTION_DISABLE f_pToneDetectDisable ) -{ - f_pToneDetectDisable->ulChannelHndl = cOCT6100_INVALID_HANDLE; - f_pToneDetectDisable->ulToneNumber = cOCT6100_INVALID_VALUE; - f_pToneDetectDisable->fDisableAll = FALSE; - - return cOCT6100_ERR_OK; -} -#endif - - -#if !SKIP_Oct6100ToneDetectionDisable -UINT32 Oct6100ToneDetectionDisable( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_TONE_DETECTION_DISABLE f_pToneDetectDisable ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100ToneDetectionDisableSer( f_pApiInstance, f_pToneDetectDisable ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ToneDetectionEnableSer - -Description: Activate the detection of a tone on the specified channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pToneDetectEnable Pointer to tone detect enable structure. This structure - contains, among other things, the tone ID to enable - and the channel handle where detection should be - enabled. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ToneDetectionEnableSer -UINT32 Oct6100ToneDetectionEnableSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TONE_DETECTION_ENABLE f_pToneDetectEnable ) -{ - UINT32 ulChanIndex; - UINT32 ulExtToneChanIndex; - UINT32 ulToneEventNumber = 0; - - UINT32 ulResult; - - /* Check the user's configuration of the tone detection for errors. */ - ulResult = Oct6100ApiCheckToneEnableParams( - f_pApiInstance, - f_pToneDetectEnable, - &ulChanIndex, - &ulToneEventNumber, - - &ulExtToneChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write to all resources needed to enable tone detection. */ - ulResult = Oct6100ApiWriteToneDetectEvent( - f_pApiInstance, - ulChanIndex, - ulToneEventNumber, - - ulExtToneChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the channel entry to indicate that a new tone has been activated. */ - ulResult = Oct6100ApiUpdateChanToneDetectEntry( - f_pApiInstance, - ulChanIndex, - ulToneEventNumber, - ulExtToneChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckToneEnableParams - -Description: Check the validity of the channel and tone requested. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pToneDetectEnable Pointer to tone detection enable structure. -f_pulChannelIndex Pointer to the channel index. -f_pulToneEventNumber Pointer to the Index of the tone associated to the requested tone. -f_pulExtToneChanIndex Pointer to the index of the extended channel index. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckToneEnableParams -UINT32 Oct6100ApiCheckToneEnableParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TONE_DETECTION_ENABLE f_pToneDetectEnable, - OUT PUINT32 f_pulChannelIndex, - OUT PUINT32 f_pulToneEventNumber, - - OUT PUINT32 f_pulExtToneChanIndex ) -{ - tPOCT6100_API_CHANNEL pEchoChannel; - UINT32 ulEntryOpenCnt; - UINT32 i; - - /*=====================================================================*/ - /* Check the channel handle. */ - - if ( (f_pToneDetectEnable->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_TONE_DETECTION_CHANNEL_HANDLE_INVALID; - - *f_pulChannelIndex = f_pToneDetectEnable->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK; - if ( *f_pulChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_TONE_DETECTION_CHANNEL_HANDLE_INVALID; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChannel, *f_pulChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pToneDetectEnable->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChannel->fReserved != TRUE ) - return cOCT6100_ERR_TONE_DETECTION_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChannel->byEntryOpenCnt ) - return cOCT6100_ERR_TONE_DETECTION_CHANNEL_HANDLE_INVALID; - - /* Set the extended tone detection info if it is activated on the channel. */ - *f_pulExtToneChanIndex = pEchoChannel->usExtToneChanIndex; - - /*=====================================================================*/ - /* Check the tone information. */ - - /* Find out if the tone is present in the build. */ - for ( i = 0; i < cOCT6100_MAX_TONE_EVENT; i++ ) - { - if ( f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ i ].ulToneID == f_pToneDetectEnable->ulToneNumber ) - { - *f_pulToneEventNumber = i; - break; - } - } - - /* Check if tone is present. */ - if ( i == cOCT6100_MAX_TONE_EVENT ) - return cOCT6100_ERR_NOT_SUPPORTED_TONE_NOT_PRESENT_IN_FIRMWARE; - - /* Check if the requested tone is actually detected. */ - if ((( pEchoChannel->aulToneConf[ *f_pulToneEventNumber / 32 ] >> ( 31 - ( *f_pulToneEventNumber % 32 ))) & 0x1) == 1 ) - return cOCT6100_ERR_TONE_DETECTION_TONE_ACTIVATED; - - - - /*=====================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteToneDetectEvent - -Description: Write the tone detection event in the channel main structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulChannelIndex Index of the channel within the API's channel list. -f_ulToneEventNumber Event number of the tone to be activated. -f_ulExtToneChanIndex Index of the extended tone detection channel. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteToneDetectEvent -UINT32 Oct6100ApiWriteToneDetectEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulToneEventNumber, - - IN UINT32 f_ulExtToneChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT32 ulResult; - UINT16 usReadData; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*=======================================================================*/ - /* Read the current event config about to be modified. */ - - ReadParams.ulReadAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_ulChannelIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ); - ReadParams.ulReadAddress += cOCT6100_CH_MAIN_TONE_EVENT_OFFSET; - ReadParams.ulReadAddress += (f_ulToneEventNumber / 16) * 2; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - /* Set the tone event in the channel main memory for the requested direction. */ - - WriteParams.ulWriteAddress = ReadParams.ulReadAddress; - WriteParams.usWriteData = usReadData; - WriteParams.usWriteData |= ( 0x1 << ( 15 - ( f_ulToneEventNumber % 16 ))); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*=======================================================================*/ - /* Also program the extended channel if one is present. */ - - if ( f_ulExtToneChanIndex != cOCT6100_INVALID_INDEX ) - { - /* Read the current event config about to be modified. */ - ReadParams.ulReadAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_ulExtToneChanIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ); - ReadParams.ulReadAddress += cOCT6100_CH_MAIN_TONE_EVENT_OFFSET; - ReadParams.ulReadAddress += (f_ulToneEventNumber / 16) * 2; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write the tone event in the channel main memory for the requested direction. */ - WriteParams.ulWriteAddress = ReadParams.ulReadAddress; - WriteParams.usWriteData = usReadData; - WriteParams.usWriteData |= ( 0x1 << ( 15 - ( f_ulToneEventNumber % 16 ))); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*=======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateChanToneDetectEntry - -Description: Update the echo channel entry to store the info about the tone - being configured to generate detection events. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulChannelIndex Index of the channel within the API's channel list. -f_ulToneEventNumber Enabled tone event number. -f_ulExtToneChanIndex Index of the extended tone detection channel. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateChanToneDetectEntry -UINT32 Oct6100ApiUpdateChanToneDetectEntry ( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulToneEventNumber, - IN UINT32 f_ulExtToneChanIndex ) -{ - tPOCT6100_API_CHANNEL pEchoChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulToneEntry; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Update the channel entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_ulChannelIndex ); - - /* Set the corresponding bit in the channel array. */ - ulToneEntry = pEchoChanEntry->aulToneConf[ f_ulToneEventNumber / 32 ]; - - /* Modify the entry. */ - ulToneEntry |= ( 0x1 << ( 31 - ( f_ulToneEventNumber % 32 ))); - - /* Copy back the new value. */ - pEchoChanEntry->aulToneConf[ f_ulToneEventNumber / 32 ] = ulToneEntry; - - /* Configure also the extended channel if necessary. */ - if ( f_ulExtToneChanIndex != cOCT6100_INVALID_INDEX ) - { - /* Update the channel entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_ulExtToneChanIndex ); - - /* Set the corresponding bit in the channel array. */ - ulToneEntry = pEchoChanEntry->aulToneConf[ f_ulToneEventNumber / 32 ]; - - /* Modify the entry. */ - ulToneEntry |= ( 0x1 << ( 31 - ( f_ulToneEventNumber % 32 ))); - - /* Copy back the new value. */ - pEchoChanEntry->aulToneConf[ f_ulToneEventNumber / 32 ] = ulToneEntry; - } - - /* Check for the SS tone events that could have been generated before. */ - if ( f_ulExtToneChanIndex == cOCT6100_INVALID_INDEX ) - { - BOOL fSSTone; - UINT32 ulResult; - - ulResult = Oct6100ApiIsSSTone( f_pApiInstance, pSharedInfo->ImageInfo.aToneInfo[ f_ulToneEventNumber ].ulToneID, &fSSTone ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Is this a signaling system tone? */ - if ( fSSTone == TRUE ) - { - /* Check if must generate an event for the last detected SS tone. */ - if ( ( pEchoChanEntry->ulLastSSToneDetected != cOCT6100_INVALID_INDEX ) - && ( pEchoChanEntry->ulLastSSToneDetected == pSharedInfo->ImageInfo.aToneInfo[ f_ulToneEventNumber ].ulToneID ) ) - { - /* Must write an event for this. */ - tPOCT6100_API_TONE_EVENT pSoftEvent; - - /* If enough space. */ - if ( ( ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1 ) != pSharedInfo->SoftBufs.ulToneEventBufferReadPtr ) && - ( ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr + 1 ) != pSharedInfo->SoftBufs.ulToneEventBufferSize || pSharedInfo->SoftBufs.ulToneEventBufferReadPtr != 0 ) ) - { - /* Form the event for this captured tone. */ - mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftEvent ) - pSoftEvent += pSharedInfo->SoftBufs.ulToneEventBufferWritePtr; - - pSoftEvent->ulChannelHandle = cOCT6100_HNDL_TAG_CHANNEL | (pEchoChanEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_ulChannelIndex; - pSoftEvent->ulUserChanId = pEchoChanEntry->ulUserChanId; - pSoftEvent->ulToneDetected = pSharedInfo->ImageInfo.aToneInfo[ f_ulToneEventNumber ].ulToneID; - pSoftEvent->ulTimestamp = pEchoChanEntry->ulLastSSToneTimestamp; - pSoftEvent->ulExtToneDetectionPort = cOCT6100_INVALID_VALUE; - pSoftEvent->ulEventType = cOCT6100_TONE_PRESENT; - - /* Update the control variables of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr++; - if ( pSharedInfo->SoftBufs.ulToneEventBufferWritePtr == pSharedInfo->SoftBufs.ulToneEventBufferSize ) - pSharedInfo->SoftBufs.ulToneEventBufferWritePtr = 0; - - /* Set the interrupt manager such that the user knows that some tone events */ - /* are pending in the software Q. */ - pSharedInfo->IntrptManage.fToneEventsPending = TRUE; - } - else - { - /* Set the overflow flag of the buffer. */ - pSharedInfo->SoftBufs.ulToneEventBufferOverflowCnt++; - } - } - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ToneDetectionDisableSer - -Description: Disable the generation of events for a selected tone on the - specified channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pToneDetectDisable Pointer to tOCT6100_TONE_DETECTION_DISABLE structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ToneDetectionDisableSer -UINT32 Oct6100ToneDetectionDisableSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TONE_DETECTION_DISABLE f_pToneDetectDisable ) -{ - UINT32 ulChanIndex; - UINT32 ulExtToneChanIndex; - UINT32 ulToneEventNumber = 0; - UINT32 ulResult; - BOOL fDisableAll; - - - /* Check the user's configuration of the tone detection disable structure for errors. */ - ulResult = Oct6100ApiAssertToneDetectionParams( - f_pApiInstance, - f_pToneDetectDisable, - &ulChanIndex, - &ulToneEventNumber, - &ulExtToneChanIndex, - - &fDisableAll ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear the event to detect the specified tone. */ - ulResult = Oct6100ApiClearToneDetectionEvent( - f_pApiInstance, - ulChanIndex, - ulToneEventNumber, - ulExtToneChanIndex, - - fDisableAll ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the channel structure to indicate that the tone is no longer detected. */ - ulResult = Oct6100ApiReleaseToneDetectionEvent( - f_pApiInstance, - ulChanIndex, - ulToneEventNumber, - ulExtToneChanIndex, - fDisableAll ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertToneDetectionParams - -Description: Check the validity of the tone detection disable command. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pToneDetectDisable Pointer to tone detection disable structure. -f_pulChannelIndex Pointer to the channel index -f_pulToneEventNumber Pointer to the tone event number. -f_pulExtToneChanIndex Pointer to the extended channel index. -f_pfDisableAll Pointer to the flag specifying whether all tones - should be disabled. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertToneDetectionParams -UINT32 Oct6100ApiAssertToneDetectionParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TONE_DETECTION_DISABLE f_pToneDetectDisable, - OUT PUINT32 f_pulChannelIndex, - OUT PUINT32 f_pulToneEventNumber, - OUT PUINT32 f_pulExtToneChanIndex, - - OUT PBOOL f_pfDisableAll ) -{ - tPOCT6100_API_CHANNEL pEchoChannel; - UINT32 ulEntryOpenCnt; - UINT32 i; - - /*=====================================================================*/ - /* Check the echo channel handle. */ - - if ( (f_pToneDetectDisable->ulChannelHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_CHANNEL ) - return cOCT6100_ERR_TONE_DETECTION_CHANNEL_HANDLE_INVALID; - - *f_pulChannelIndex = f_pToneDetectDisable->ulChannelHndl & cOCT6100_HNDL_INDEX_MASK; - if ( *f_pulChannelIndex >= f_pApiInstance->pSharedInfo->ChipConfig.usMaxChannels ) - return cOCT6100_ERR_TONE_DETECTION_CHANNEL_HANDLE_INVALID; - - mOCT6100_GET_CHANNEL_ENTRY_PNT( f_pApiInstance->pSharedInfo, pEchoChannel, *f_pulChannelIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pToneDetectDisable->ulChannelHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pEchoChannel->fReserved != TRUE ) - return cOCT6100_ERR_TONE_DETECTION_CHANNEL_NOT_OPEN; - if ( ulEntryOpenCnt != pEchoChannel->byEntryOpenCnt ) - return cOCT6100_ERR_TONE_DETECTION_CHANNEL_HANDLE_INVALID; - - /* Return the extended channel index. */ - *f_pulExtToneChanIndex = pEchoChannel->usExtToneChanIndex; - - /* Check the disable all flag. */ - if ( f_pToneDetectDisable->fDisableAll != TRUE && f_pToneDetectDisable->fDisableAll != FALSE ) - return cOCT6100_ERR_TONE_DETECTION_DISABLE_ALL; - - /*=====================================================================*/ - /* Check the tone information. */ - - /* Find out if the tone is present in the build. */ - if ( f_pToneDetectDisable->fDisableAll == FALSE ) - { - for ( i = 0; i < cOCT6100_MAX_TONE_EVENT; i++ ) - { - if ( f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ i ].ulToneID == f_pToneDetectDisable->ulToneNumber ) - { - *f_pulToneEventNumber = i; - break; - } - } - - /* Check if tone is present. */ - if ( i == cOCT6100_MAX_TONE_EVENT ) - return cOCT6100_ERR_NOT_SUPPORTED_TONE_NOT_PRESENT_IN_FIRMWARE; - - - - /* Check if the requested tone is actually detected. */ - if ((( pEchoChannel->aulToneConf[ *f_pulToneEventNumber / 32 ] >> ( 31 - ( *f_pulToneEventNumber % 32 ))) & 0x1) == 0 ) - return cOCT6100_ERR_TONE_DETECTION_TONE_NOT_ACTIVATED; - } - - - /*=====================================================================*/ - - /* Return the disable all flag as requested. */ - *f_pfDisableAll = f_pToneDetectDisable->fDisableAll; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiClearToneDetectionEvent - -Description: Clear the buffer playout event in the channel main structure. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulChannelIndex Index of the channel within the API's channel list. -f_ulToneEventNumber Tone event number to be deactivated. -f_ulExtToneChanIndex Index of the extended tone detection channel. -f_fDisableAll Clear all activated tones. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiClearToneDetectionEvent -UINT32 Oct6100ApiClearToneDetectionEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulToneEventNumber, - IN UINT32 f_ulExtToneChanIndex, - - IN BOOL f_fDisableAll ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - tOCT6100_WRITE_SMEAR_PARAMS SmearParams; - UINT32 ulResult; - UINT32 ulToneEventBaseAddress; - UINT16 usReadData; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - - - ReadParams.pProcessContext = f_pApiInstance->pProcessContext; - - ReadParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - ReadParams.pusReadData = &usReadData; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - SmearParams.pProcessContext = f_pApiInstance->pProcessContext; - - SmearParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*=======================================================================*/ - /* Read the current event config about to be modified. */ - - ulToneEventBaseAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_ulChannelIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ); - ulToneEventBaseAddress += cOCT6100_CH_MAIN_TONE_EVENT_OFFSET; - - /* Check if must disable all tone events or not. */ - if ( f_fDisableAll == FALSE ) - { - ReadParams.ulReadAddress = ulToneEventBaseAddress; - ReadParams.ulReadAddress += (f_ulToneEventNumber / 16) * 2; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear the event in the channel main memory.*/ - WriteParams.ulWriteAddress = ReadParams.ulReadAddress; - WriteParams.usWriteData = usReadData; - WriteParams.usWriteData &= (~( 0x1 << ( 15 - ( f_ulToneEventNumber % 16 )))); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else /* if ( f_fDisableAll == TRUE ) */ - { - /* Clear all events in the channel main memory. */ - SmearParams.ulWriteLength = 4; - SmearParams.usWriteData = 0x0000; - SmearParams.ulWriteAddress = ulToneEventBaseAddress; - mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - - /*=======================================================================*/ - /* Also program the extended channel if one is present. */ - - if ( f_ulExtToneChanIndex != cOCT6100_INVALID_INDEX ) - { - ulToneEventBaseAddress = pSharedInfo->MemoryMap.ulChanMainMemBase + ( f_ulExtToneChanIndex * pSharedInfo->MemoryMap.ulChanMainMemSize ); - ulToneEventBaseAddress += cOCT6100_CH_MAIN_TONE_EVENT_OFFSET; - - /* Check if must disable all tone events or not. */ - if ( f_fDisableAll == FALSE ) - { - /* Read the current event config about to be modified. */ - ReadParams.ulReadAddress = ulToneEventBaseAddress; - ReadParams.ulReadAddress += (f_ulToneEventNumber / 16) * 2; - - mOCT6100_DRIVER_READ_API( ReadParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Clear the event in the channel main memory.*/ - WriteParams.ulWriteAddress = ReadParams.ulReadAddress; - WriteParams.usWriteData = usReadData; - WriteParams.usWriteData &= (~( 0x1 << ( 15 - ( f_ulToneEventNumber % 16 )))); - - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - else /* if ( f_fDisableAll == TRUE ) */ - { - /* Clear all events in the channel main memory.*/ - SmearParams.ulWriteLength = 4; - SmearParams.usWriteData = 0x0000; - SmearParams.ulWriteAddress = ulToneEventBaseAddress; - mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseToneDetectionEvent - -Description: Clear the entry made for this tone in the channel tone - enable array. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulChannelIndex Index of the channel within the API's channel list. -f_ulToneEventNumber Tone event number to be deactivated. -f_ulExtToneChanIndex Index of the extended tone detection channel. -f_fDisableAll Release all activated tones. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseToneDetectionEvent -UINT32 Oct6100ApiReleaseToneDetectionEvent ( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulToneEventNumber, - IN UINT32 f_ulExtToneChanIndex, - IN BOOL f_fDisableAll ) -{ - tPOCT6100_API_CHANNEL pEchoChanEntry; - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulToneEntry; - UINT32 ulResult; - UINT32 ulToneEventNumber; - BOOL fSSTone; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Update the channel entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_ulChannelIndex ); - - /* Check if must release all tone events. */ - if ( f_fDisableAll == FALSE ) - { - /* Set the corresponding bit in the channel array. */ - ulToneEntry = pEchoChanEntry->aulToneConf[ f_ulToneEventNumber / 32 ]; - - /* Modify the entry. */ - ulToneEntry &= (~( 0x1 << ( 31 - ( f_ulToneEventNumber % 32 )))); - - /* Copy back the new value. */ - pEchoChanEntry->aulToneConf[ f_ulToneEventNumber / 32 ] = ulToneEntry; - } - else /* if ( f_fDisableAll == TRUE ) */ - { - /* Clear all events. */ - Oct6100UserMemSet( pEchoChanEntry->aulToneConf, 0x00, sizeof( pEchoChanEntry->aulToneConf ) ); - } - - /* Configure also the extended channel if necessary. */ - if ( f_ulExtToneChanIndex != cOCT6100_INVALID_INDEX ) - { - /* Update the channel entry. */ - mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEchoChanEntry, f_ulExtToneChanIndex ); - - /* Check if must release all tone events. */ - if ( f_fDisableAll == FALSE ) - { - /* Set the corresponding bit in the channel array. */ - ulToneEntry = pEchoChanEntry->aulToneConf[ f_ulToneEventNumber / 32 ]; - - /* Modify the entry. */ - ulToneEntry &= (~( 0x1 << ( 31 - ( f_ulToneEventNumber % 32 )))); - - /* Copy back the new value. */ - pEchoChanEntry->aulToneConf[ f_ulToneEventNumber / 32 ] = ulToneEntry; - } - else /* if ( f_fDisableAll == TRUE ) */ - { - /* Clear all events. */ - Oct6100UserMemSet( pEchoChanEntry->aulToneConf, 0x00, sizeof( pEchoChanEntry->aulToneConf ) ); - } - } - - /* Re-enable the SS7 tones */ - for ( ulToneEventNumber = 0; ulToneEventNumber < cOCT6100_MAX_TONE_EVENT; ulToneEventNumber++ ) - { - /* Check if the current tone is a SS tone. */ - ulResult = Oct6100ApiIsSSTone( - f_pApiInstance, - f_pApiInstance->pSharedInfo->ImageInfo.aToneInfo[ ulToneEventNumber ].ulToneID, - &fSSTone ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - if ( fSSTone == TRUE ) - { - /* Write to all resources needed to activate tone detection on this SS tone. */ - ulResult = Oct6100ApiWriteToneDetectEvent( - f_pApiInstance, - f_ulChannelIndex, - ulToneEventNumber, - - cOCT6100_INVALID_INDEX ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiIsSSTone - -Description: Check if specified tone number is a special signaling - system tone. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulToneEventNumber Tone event number to be checked against. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiIsSSTone -UINT32 Oct6100ApiIsSSTone( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulToneEventNumber, - OUT PBOOL f_fSSTone ) -{ - *f_fSSTone = FALSE; - - switch( f_ulToneEventNumber ) - { - case cOCT6100_TONE_SIN_SYSTEM7_2000 : - case cOCT6100_TONE_SIN_SYSTEM7_1780 : - case cOCT6100_TONE_ROUT_G168_2100GB_ON : - case cOCT6100_TONE_ROUT_G168_2100GB_WSPR : - case cOCT6100_TONE_ROUT_G168_1100GB_ON : - case cOCT6100_TONE_ROUT_G168_2100GB_ON_WIDE_A : - case cOCT6100_TONE_ROUT_G168_2100GB_ON_WIDE_B : - case cOCT6100_TONE_ROUT_G168_2100GB_WSPR_WIDE : - case cOCT6100_TONE_SOUT_G168_2100GB_ON : - case cOCT6100_TONE_SOUT_G168_2100GB_WSPR : - case cOCT6100_TONE_SOUT_G168_1100GB_ON : - case cOCT6100_TONE_SOUT_G168_2100GB_ON_WIDE_A : - case cOCT6100_TONE_SOUT_G168_2100GB_ON_WIDE_B : - case cOCT6100_TONE_SOUT_G168_2100GB_WSPR_WIDE : - case cOCT6100_TONE_SIN_SYSTEM5_2400 : - case cOCT6100_TONE_SIN_SYSTEM5_2600 : - case cOCT6100_TONE_SIN_SYSTEM5_2400_2600 : - *f_fSSTone = TRUE; - break; - default: - break; - } - - return cOCT6100_ERR_OK; -} -#endif - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiIsSSTone - -Description: Check if specified tone number is a 2100 special signaling - system tone. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_ulToneEventNumber Tone event number to be checked against. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiIs2100Tone -UINT32 Oct6100ApiIs2100Tone( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulToneEventNumber, - OUT PBOOL f_fIs2100Tone ) -{ - *f_fIs2100Tone = FALSE; - - switch( f_ulToneEventNumber ) - { - case cOCT6100_TONE_ROUT_G168_2100GB_ON : - case cOCT6100_TONE_ROUT_G168_2100GB_WSPR : - case cOCT6100_TONE_ROUT_G168_2100GB_ON_WIDE_A : - case cOCT6100_TONE_ROUT_G168_2100GB_ON_WIDE_B : - case cOCT6100_TONE_ROUT_G168_2100GB_WSPR_WIDE : - case cOCT6100_TONE_SOUT_G168_2100GB_ON : - case cOCT6100_TONE_SOUT_G168_2100GB_WSPR : - case cOCT6100_TONE_SOUT_G168_2100GB_ON_WIDE_A : - case cOCT6100_TONE_SOUT_G168_2100GB_ON_WIDE_B : - case cOCT6100_TONE_SOUT_G168_2100GB_WSPR_WIDE : - *f_fIs2100Tone = TRUE; - break; - default: - break; - } - - return cOCT6100_ERR_OK; -} -#endif diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsi_cnct.c b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsi_cnct.c deleted file mode 100644 index e885aa4..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsi_cnct.c +++ /dev/null @@ -1,1023 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tsi_cnct.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains functions used to open and close TSI connections - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 38 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_apiud.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_channel_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_tsi_cnct_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_tsi_cnct_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_miscellaneous_priv.h" -#include "oct6100_memory_priv.h" -#include "oct6100_tsst_priv.h" -#include "oct6100_channel_priv.h" -#include "oct6100_tsi_cnct_priv.h" - -/**************************** PUBLIC FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100TsiCnctOpen - -Description: This function opens a TSI connection between two TDM timeslots. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pTsiCnctOpen Pointer to TSI connection open structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100TsiCnctOpenDef -UINT32 Oct6100TsiCnctOpenDef( - tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen ) -{ - f_pTsiCnctOpen->pulTsiCnctHndl = NULL; - - f_pTsiCnctOpen->ulInputTimeslot = cOCT6100_INVALID_TIMESLOT; - f_pTsiCnctOpen->ulInputStream = cOCT6100_INVALID_STREAM; - f_pTsiCnctOpen->ulOutputTimeslot = cOCT6100_INVALID_TIMESLOT; - f_pTsiCnctOpen->ulOutputStream = cOCT6100_INVALID_STREAM; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100TsiCnctOpen -UINT32 Oct6100TsiCnctOpen( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100TsiCnctOpenSer( f_pApiInstance, f_pTsiCnctOpen ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100TsiCnctClose - -Description: This function closes a TSI connection. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pTsiCnctClose Pointer to TSI connection close structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100TsiCnctCloseDef -UINT32 Oct6100TsiCnctCloseDef( - tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose ) -{ - f_pTsiCnctClose->ulTsiCnctHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - -#if !SKIP_Oct6100TsiCnctClose -UINT32 Oct6100TsiCnctClose( - tPOCT6100_INSTANCE_API f_pApiInstance, - tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose ) -{ - tOCT6100_SEIZE_SERIALIZE_OBJECT SeizeSerObj; - tOCT6100_RELEASE_SERIALIZE_OBJECT ReleaseSerObj; - UINT32 ulSerRes = cOCT6100_ERR_OK; - UINT32 ulFncRes = cOCT6100_ERR_OK; - - /* Set the process context of the serialize structure. */ - SeizeSerObj.pProcessContext = f_pApiInstance->pProcessContext; - ReleaseSerObj.pProcessContext = f_pApiInstance->pProcessContext; - - /* Seize all list semaphores needed by this function. */ - SeizeSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - SeizeSerObj.ulTryTimeMs = cOCT6100_WAIT_INFINITELY; - ulSerRes = Oct6100UserSeizeSerializeObject( &SeizeSerObj ); - if ( ulSerRes == cOCT6100_ERR_OK ) - { - /* Call the serialized function. */ - ulFncRes = Oct6100TsiCnctCloseSer( f_pApiInstance, f_pTsiCnctClose ); - } - else - { - return ulSerRes; - } - - /* Release the seized semaphores. */ - ReleaseSerObj.ulSerialObjHndl = f_pApiInstance->ulApiSerObj; - ulSerRes = Oct6100UserReleaseSerializeObject( &ReleaseSerObj ); - - /* If an error occured then return the error code. */ - if ( ulSerRes != cOCT6100_ERR_OK ) - return ulSerRes; - if ( ulFncRes != cOCT6100_ERR_OK ) - return ulFncRes; - - return cOCT6100_ERR_OK; -} -#endif - - -/**************************** PRIVATE FUNCTIONS ****************************/ - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetTsiCnctSwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management the TSI memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pOpenChip Pointer to chip configuration struct. -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetTsiCnctSwSizes -UINT32 Oct6100ApiGetTsiCnctSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulTempVar; - UINT32 ulResult; - - /* Determine the amount of memory required for the API TSI connection list. */ - f_pInstSizes->ulTsiCnctList = f_pOpenChip->ulMaxTsiCncts * sizeof( tOCT6100_API_TSI_CNCT ); - - if ( f_pOpenChip->ulMaxTsiCncts > 0 ) - { - /* Calculate memory needed for TSI memory allocation. */ - ulResult = OctapiLlmAllocGetSize( f_pOpenChip->ulMaxTsiCncts, &f_pInstSizes->ulTsiCnctAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_48; - } - else - { - f_pInstSizes->ulTsiCnctAlloc = 0; - } - - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulTsiCnctList, ulTempVar ) - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulTsiCnctAlloc, ulTempVar ) - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiTsiCnctSwInit - -Description: Initializes all elements of the instance structure associated - to the TSI memory. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiTsiCnctSwInit -UINT32 Oct6100ApiTsiCnctSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_API_TSI_CNCT pChannelsTsiList; - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulMaxTsiChannels; - PVOID pTsiChannelsAlloc; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Initialize the TSI connections API list. */ - ulMaxTsiChannels = pSharedInfo->ChipConfig.usMaxTsiCncts; - - mOCT6100_GET_TSI_CNCT_LIST_PNT( pSharedInfo, pChannelsTsiList ) - - /* Clear the memory. */ - Oct6100UserMemSet( pChannelsTsiList, 0x00, sizeof(tOCT6100_API_TSI_CNCT) * ulMaxTsiChannels ); - - /* Set all entries in the TSI connections list to unused. */ - if ( ulMaxTsiChannels > 0 ) - { - mOCT6100_GET_TSI_CNCT_ALLOC_PNT( pSharedInfo, pTsiChannelsAlloc ) - - ulResult = OctapiLlmAllocInit( &pTsiChannelsAlloc, ulMaxTsiChannels ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_49; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100TsiCnctOpenSer - -Description: Opens a TSI connection. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pTsiCnctOpen Pointer to a tOCT6100_TSI_CNCT_OPEN structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100TsiCnctOpenSer -UINT32 Oct6100TsiCnctOpenSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen ) -{ - UINT16 usTsiChanIndex; - UINT16 usTsiMemIndex; - UINT16 usInputTsstIndex; - UINT16 usOutputTsstIndex; - UINT32 ulResult; - - /* Check the user's configuration of the TSI connection open structure for errors. */ - ulResult = Oct6100ApiCheckTsiParams( f_pApiInstance, f_pTsiCnctOpen ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Reserve all resources needed by the TSI connection. */ - ulResult = Oct6100ApiReserveTsiResources( f_pApiInstance, f_pTsiCnctOpen, &usTsiChanIndex, &usTsiMemIndex, &usInputTsstIndex, &usOutputTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Write all necessary structures to activate the TSI connection. */ - ulResult = Oct6100ApiWriteTsiStructs( f_pApiInstance, f_pTsiCnctOpen, usTsiMemIndex, usInputTsstIndex, usOutputTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Update the TSI connection entry in the API list. */ - ulResult = Oct6100ApiUpdateTsiEntry( f_pApiInstance, f_pTsiCnctOpen, usTsiChanIndex, usTsiMemIndex, usInputTsstIndex, usOutputTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiCheckTsiParams - -Description: Checks the user's TSI connection open configuration for errors. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pTsiCnctOpen Pointer to TSI connection open configuration structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiCheckTsiParams -UINT32 Oct6100ApiCheckTsiParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen ) -{ - UINT32 ulResult; - - /* Check for errors. */ - if ( f_pApiInstance->pSharedInfo->ChipConfig.usMaxTsiCncts == 0 ) - return cOCT6100_ERR_TSI_CNCT_DISABLED; - - if ( f_pTsiCnctOpen->pulTsiCnctHndl == NULL ) - return cOCT6100_ERR_TSI_CNCT_INVALID_HANDLE; - - /* Check the input TDM streams, timeslots component for errors. */ - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - cOCT6100_NUMBER_TSSTS_1, - f_pTsiCnctOpen->ulInputTimeslot, - f_pTsiCnctOpen->ulInputStream, - cOCT6100_INPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_TSI_CNCT_INPUT_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_TSI_CNCT_INPUT_STREAM; - } - else - { - return ulResult; - } - } - - /* Check the output TDM streams, timeslots component for errors. */ - ulResult = Oct6100ApiValidateTsst( f_pApiInstance, - cOCT6100_NUMBER_TSSTS_1, - f_pTsiCnctOpen->ulOutputTimeslot, - f_pTsiCnctOpen->ulOutputStream, - cOCT6100_OUTPUT_TSST ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == cOCT6100_ERR_TSST_TIMESLOT ) - { - return cOCT6100_ERR_TSI_CNCT_OUTPUT_TIMESLOT; - } - else if ( ulResult == cOCT6100_ERR_TSST_STREAM ) - { - return cOCT6100_ERR_TSI_CNCT_OUTPUT_STREAM; - } - else - { - return ulResult; - } - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveTsiResources - -Description: Reserves all resources needed for the new TSI connection. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pTsiCnctOpen Pointer to tsi channel configuration structure. -f_pusTsiChanIndex Allocated entry in TSI channel list. -f_pusTsiMemIndex Allocated entry in the TSI control memory. -f_pusInputTsstIndex TSST memory index of the input samples. -f_pusOutputTsstIndex TSST memory index of the output samples. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveTsiResources -UINT32 Oct6100ApiReserveTsiResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen, - OUT PUINT16 f_pusTsiChanIndex, - OUT PUINT16 f_pusTsiMemIndex, - OUT PUINT16 f_pusInputTsstIndex, - OUT PUINT16 f_pusOutputTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - UINT32 ulResult; - UINT32 ulTempVar; - BOOL fTsiChanEntry = FALSE; - BOOL fTsiMemEntry = FALSE; - BOOL fInputTsst = FALSE; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Reserve an entry in the TSI connection list. */ - ulResult = Oct6100ApiReserveTsiCnctEntry( f_pApiInstance, f_pusTsiChanIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fTsiChanEntry = TRUE; - - /* Find a TSI memory entry. */ - ulResult = Oct6100ApiReserveTsiMemEntry( f_pApiInstance, f_pusTsiMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fTsiMemEntry = TRUE; - - /* Reserve the input TSST entry. */ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - f_pTsiCnctOpen->ulInputTimeslot, - f_pTsiCnctOpen->ulInputStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_INPUT_TSST, - f_pusInputTsstIndex, - NULL ); - if ( ulResult == cOCT6100_ERR_OK ) - { - fInputTsst = TRUE; - - /* Reserve the output TSST entry. */ - ulResult = Oct6100ApiReserveTsst( f_pApiInstance, - f_pTsiCnctOpen->ulOutputTimeslot, - f_pTsiCnctOpen->ulOutputStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_OUTPUT_TSST, - f_pusOutputTsstIndex, - NULL ); - } - } - else - { - /* Return an error other then a fatal. */ - ulResult = cOCT6100_ERR_TSI_CNCT_NO_MORE_TSI_AVAILABLE; - } - } - - if ( ulResult != cOCT6100_ERR_OK ) - { - if( fTsiChanEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsiCnctEntry( f_pApiInstance, *f_pusTsiChanIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fTsiMemEntry == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, *f_pusTsiMemIndex ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - if( fInputTsst == TRUE ) - { - ulTempVar = Oct6100ApiReleaseTsst( f_pApiInstance, - f_pTsiCnctOpen->ulInputTimeslot, - f_pTsiCnctOpen->ulInputStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulTempVar != cOCT6100_ERR_OK ) - return ulTempVar; - } - - return ulResult; - } - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiWriteTsiStructs - -Description: Performs all the required structure writes to configure the - new TSI connection. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pTsiCnctOpen Pointer to tsi connection open structure. -f_usTsiMemIndex Allocated entry in the TSI control memory. -f_usInputTsstIndex TSST memory index of the input samples. -f_usOutputTsstIndex TSST memory index of the output samples. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiWriteTsiStructs -UINT32 Oct6100ApiWriteTsiStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen, - IN UINT16 f_usTsiMemIndex, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*==================================================================================*/ - /* Configure the TSST control memory.*/ - - /* Set the input TSST control entry.*/ - ulResult = Oct6100ApiWriteInputTsstControlMemory( f_pApiInstance, - f_usInputTsstIndex, - f_usTsiMemIndex, - cOCT6100_PCM_U_LAW ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the output TSST control entry. */ - ulResult = Oct6100ApiWriteOutputTsstControlMemory( f_pApiInstance, - f_usOutputTsstIndex, - cOCT6100_ADPCM_IN_LOW_BITS, - 1, - f_usTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==================================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiUpdateTsiEntry - -Description: Updates the new TSI connection in the TSI connection list. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pTsiCnctOpen Pointer to TSI connection open configuration structure. -f_usTsiMemIndex Allocated entry in TSI chariot memory. -f_usTsiChanIndex Allocated entry in the TSI channel list. -f_usInputTsstIndex TSST control memory index of the input TSST. -f_usOutputTsstIndex TSST control memory index of the output TSST. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiUpdateTsiEntry -UINT32 Oct6100ApiUpdateTsiEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen, - IN UINT16 f_usTsiChanIndex, - IN UINT16 f_usTsiMemIndex, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ) -{ - tPOCT6100_API_TSI_CNCT pTsiCnctEntry; - - /*================================================================================*/ - /* Obtain a pointer to the new TSI connection's list entry. */ - - mOCT6100_GET_TSI_CNCT_ENTRY_PNT( f_pApiInstance->pSharedInfo, pTsiCnctEntry, f_usTsiChanIndex ) - - /* Copy the TSI's configuration and allocated resources. */ - pTsiCnctEntry->usInputTimeslot = (UINT16)( f_pTsiCnctOpen->ulInputTimeslot & 0xFFFF ); - pTsiCnctEntry->usInputStream = (UINT16)( f_pTsiCnctOpen->ulInputStream & 0xFFFF ); - - pTsiCnctEntry->usOutputTimeslot = (UINT16)( f_pTsiCnctOpen->ulOutputTimeslot & 0xFFFF ); - pTsiCnctEntry->usOutputStream = (UINT16)( f_pTsiCnctOpen->ulOutputStream & 0xFFFF ); - - /* Store hardware related information. */ - pTsiCnctEntry->usTsiMemIndex = f_usTsiMemIndex; - pTsiCnctEntry->usInputTsstIndex = f_usInputTsstIndex; - pTsiCnctEntry->usOutputTsstIndex = f_usOutputTsstIndex; - - /* Form handle returned to user. */ - *f_pTsiCnctOpen->pulTsiCnctHndl = cOCT6100_HNDL_TAG_TSI_CNCT | (pTsiCnctEntry->byEntryOpenCnt << cOCT6100_ENTRY_OPEN_CNT_SHIFT) | f_usTsiChanIndex; - - /* Finally, mark the connection as opened. */ - pTsiCnctEntry->fReserved = TRUE; - - /* Increment the number of TSI connection opened. */ - f_pApiInstance->pSharedInfo->ChipStats.usNumberTsiCncts++; - - /*================================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100TsiCnctCloseSer - -Description: Closes a TSI connection. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pTsiCnctClose Pointer to TSI connection close structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100TsiCnctCloseSer -UINT32 Oct6100TsiCnctCloseSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose ) -{ - UINT16 usTsiChanIndex; - UINT16 usTsiMemIndex; - UINT16 usInputTsstIndex; - UINT16 usOutputTsstIndex; - UINT32 ulResult; - - /* Verify that all the parameters given match the state of the API. */ - ulResult = Oct6100ApiAssertTsiParams( f_pApiInstance, f_pTsiCnctClose, &usTsiChanIndex, &usTsiMemIndex, &usInputTsstIndex, &usOutputTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the TSI channel. */ - ulResult = Oct6100ApiInvalidateTsiStructs( f_pApiInstance, usInputTsstIndex, usOutputTsstIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Release all resources associated to the TSI connection. */ - ulResult = Oct6100ApiReleaseTsiResources( f_pApiInstance, usTsiChanIndex, usTsiMemIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Invalidate the handle. */ - f_pTsiCnctClose->ulTsiCnctHndl = cOCT6100_INVALID_HANDLE; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiAssertTsiParams - -Description: Validate the handle given by the user and verify the state of - the TSI connection about to be closed. - Also returns all required information to deactivate the connection. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_pTsiCnctClose Pointer to TSI connection close structure. -f_pusTsiChanIndex Index of the TSI connection structure in the API list. -f_pusTsiMemIndex Index of the TSI entry within the TSI chariot memory -f_pusInputTsstIndex Index of the input entry in the TSST control memory. -f_pusOutputTsstIndex Index of the output entry in the TSST control memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiAssertTsiParams -UINT32 Oct6100ApiAssertTsiParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose, - OUT PUINT16 f_pusTsiChanIndex, - OUT PUINT16 f_pusTsiMemIndex, - OUT PUINT16 f_pusInputTsstIndex, - OUT PUINT16 f_pusOutputTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_TSI_CNCT pTsiEntry; - UINT32 ulEntryOpenCnt; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Check the provided handle. */ - if ( (f_pTsiCnctClose->ulTsiCnctHndl & cOCT6100_HNDL_TAG_MASK) != cOCT6100_HNDL_TAG_TSI_CNCT ) - return cOCT6100_ERR_TSI_CNCT_INVALID_HANDLE; - - *f_pusTsiChanIndex = (UINT16)( f_pTsiCnctClose->ulTsiCnctHndl & cOCT6100_HNDL_INDEX_MASK ); - - if ( *f_pusTsiChanIndex >= pSharedInfo->ChipConfig.usMaxTsiCncts ) - return cOCT6100_ERR_TSI_CNCT_INVALID_HANDLE; - - /*=======================================================================*/ - /* Get a pointer to the channel's list entry. */ - - mOCT6100_GET_TSI_CNCT_ENTRY_PNT( pSharedInfo, pTsiEntry, *f_pusTsiChanIndex ) - - /* Extract the entry open count from the provided handle. */ - ulEntryOpenCnt = (f_pTsiCnctClose->ulTsiCnctHndl >> cOCT6100_ENTRY_OPEN_CNT_SHIFT) & cOCT6100_ENTRY_OPEN_CNT_MASK; - - /* Check for errors. */ - if ( pTsiEntry->fReserved != TRUE ) - return cOCT6100_ERR_TSI_CNCT_NOT_OPEN; - if ( ulEntryOpenCnt != pTsiEntry->byEntryOpenCnt ) - return cOCT6100_ERR_TSI_CNCT_INVALID_HANDLE; - - /* Return info needed to close the channel and release all resources. */ - *f_pusInputTsstIndex = pTsiEntry->usInputTsstIndex; - *f_pusOutputTsstIndex = pTsiEntry->usOutputTsstIndex; - *f_pusTsiMemIndex = pTsiEntry->usTsiMemIndex; - - /*=======================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiInvalidateTsiStructs - -Description: This function closes a TSI connection. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usInputTsstIndex Index of the input entry in the TSST control memory. -f_usOutputTsstIndex Index of the output entry in the TSST control memory. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiInvalidateTsiStructs -UINT32 Oct6100ApiInvalidateTsiStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tOCT6100_WRITE_PARAMS WriteParams; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - WriteParams.pProcessContext = f_pApiInstance->pProcessContext; - - WriteParams.ulUserChipId = pSharedInfo->ChipConfig.ulUserChipId; - - /*==================================================================================*/ - /* Deactivate the TSST control memory. */ - - /* Set the input TSST control entry to unused. */ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( f_usInputTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = 0x0000; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /* Set the output TSST control entry to unused. */ - WriteParams.ulWriteAddress = cOCT6100_TSST_CONTROL_MEM_BASE + ( f_usOutputTsstIndex * cOCT6100_TSST_CONTROL_MEM_ENTRY_SIZE ); - - WriteParams.usWriteData = 0x0000; - mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ); - if ( ulResult != cOCT6100_ERR_OK ) - return ulResult; - - /*==================================================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseTsiResources - -Description: Release and clear the API entry associated to the TSI channel. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep the - present state of the chip and all its resources. - -f_usTsiChanIndex Index of the TSI connection in the API list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseTsiResources -UINT32 Oct6100ApiReleaseTsiResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsiChanIndex, - IN UINT16 f_usTsiMemIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_TSI_CNCT pTsiEntry; - UINT32 ulResult; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_TSI_CNCT_ENTRY_PNT( pSharedInfo, pTsiEntry, f_usTsiChanIndex ); - - /* Release the entry in the TSI connection list. */ - ulResult = Oct6100ApiReleaseTsiCnctEntry( f_pApiInstance, f_usTsiChanIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - ulResult = Oct6100ApiReleaseTsiMemEntry( f_pApiInstance, f_usTsiMemIndex ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Release the input entry. */ - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pTsiEntry->usInputTimeslot, - pTsiEntry->usInputStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_INPUT_TSST, - cOCT6100_INVALID_INDEX ); - if ( ulResult == cOCT6100_ERR_OK ) - { - /* Release the output TSST entry. */ - ulResult = Oct6100ApiReleaseTsst( f_pApiInstance, - pTsiEntry->usOutputTimeslot, - pTsiEntry->usOutputStream, - cOCT6100_NUMBER_TSSTS_1, - cOCT6100_OUTPUT_TSST, - cOCT6100_INVALID_INDEX ); - } - } - } - - /* Check if an error occured while releasing the reserved resources. */ - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult >= cOCT6100_ERR_FATAL ) - return ulResult; - else - return cOCT6100_ERR_FATAL_4A; - } - - /*=============================================================*/ - /* Update the TSI connection's list entry. */ - - /* Mark the connection as closed. */ - pTsiEntry->fReserved = FALSE; - pTsiEntry->byEntryOpenCnt++; - - /* Decrement the number of TSI connection opened. */ - f_pApiInstance->pSharedInfo->ChipStats.usNumberTsiCncts--; - - /*=============================================================*/ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveTsiCnctEntry - -Description: Reserves one of the TSI connection API entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_pusTsiChanIndex Resulting index reserved in the TSI channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveTsiCnctEntry -UINT32 Oct6100ApiReserveTsiCnctEntry( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusTsiChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pTsiChanAlloc; - UINT32 ulResult; - UINT32 ulTsiIndex; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_TSI_CNCT_ALLOC_PNT( pSharedInfo, pTsiChanAlloc ) - - ulResult = OctapiLlmAllocAlloc( pTsiChanAlloc, &ulTsiIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - return cOCT6100_ERR_TSI_CNCT_ALL_CHANNELS_ARE_OPENED; - else - return cOCT6100_ERR_FATAL_4B; - } - - *f_pusTsiChanIndex = (UINT16)( ulTsiIndex & 0xFFFF ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseTsiCnctEntry - -Description: Releases the specified TSI connection API entry. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. - -f_usTsiChanIndex Index reserved in the TSI channel list. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseTsiCnctEntry -UINT32 Oct6100ApiReleaseTsiCnctEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsiChanIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pTsiChanAlloc; - UINT32 ulResult; - - /* Get local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_TSI_CNCT_ALLOC_PNT( pSharedInfo, pTsiChanAlloc ) - - ulResult = OctapiLlmAllocDealloc( pTsiChanAlloc, f_usTsiChanIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_4C; - } - - return cOCT6100_ERR_OK; -} -#endif diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.c b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.c deleted file mode 100644 index 02fbd8f..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_tsst.c +++ /dev/null @@ -1,575 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tsst.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains the functions used to manage the allocation of TSST - control structures in internal memory. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 39 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "octdef.h" - -#include "oct6100api/oct6100_defines.h" -#include "oct6100api/oct6100_errors.h" - -#include "apilib/octapi_llman.h" - -#include "oct6100api/oct6100_apiud.h" -#include "oct6100api/oct6100_tlv_inst.h" -#include "oct6100api/oct6100_chip_open_inst.h" -#include "oct6100api/oct6100_chip_stats_inst.h" -#include "oct6100api/oct6100_interrupts_inst.h" -#include "oct6100api/oct6100_remote_debug_inst.h" -#include "oct6100api/oct6100_debug_inst.h" -#include "oct6100api/oct6100_api_inst.h" -#include "oct6100api/oct6100_tsst_inst.h" - -#include "oct6100api/oct6100_interrupts_pub.h" -#include "oct6100api/oct6100_channel_pub.h" -#include "oct6100api/oct6100_chip_open_pub.h" - -#include "oct6100_chip_open_priv.h" -#include "oct6100_tsst_priv.h" - - -/**************************** PRIVATE FUNCTIONS ****************************/ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiGetTsstSwSizes - -Description: Gets the sizes of all portions of the API instance pertinent - to the management of TSSTs. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pInstSizes Pointer to struct containing instance sizes. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiGetTsstSwSizes -UINT32 Oct6100ApiGetTsstSwSizes( - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ) -{ - UINT32 ulTempVar; - UINT32 ulResult; - - /* Determine amount of TSST needed for TSST allocation table. */ - f_pInstSizes->ulTsstAlloc = 4096 / 8; - - /* Calculate the API memory required for the TSST entry list. */ - f_pInstSizes->ulTsstEntryList = cOCT6100_MAX_TSSTS * sizeof( tOCT6100_API_TSST_ENTRY ); - - /* Calculate memory needed for TSST entry allocation. */ - ulResult = OctapiLlmAllocGetSize( cOCT6100_MAX_TSSTS, &f_pInstSizes->ulTsstEntryAlloc ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_4D; - - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulTsstAlloc, ulTempVar ); - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulTsstEntryList, ulTempVar ); - mOCT6100_ROUND_MEMORY_SIZE( f_pInstSizes->ulTsstEntryAlloc, ulTempVar ); - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiTsstSwInit - -Description: Initializes all elements of the instance structure associated - to the TSST control entries. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This tsst is used to keep - the present state of the chip and all its resources. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiTsstSwInit -UINT32 Oct6100ApiTsstSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_TSST_ENTRY pTsstList; - PUINT32 pulTsstAlloc; - PVOID pTsstListAlloc; - UINT32 ulResult; - - /* Get local pointer(s). */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - /* Initialize the TSST allocation table to "all free". */ - mOCT6100_GET_TSST_ALLOC_PNT( pSharedInfo, pulTsstAlloc ); - Oct6100UserMemSet( pulTsstAlloc, 0x00, 512 ); - - /* Initialize all the TSST list entries. */ - mOCT6100_GET_TSST_LIST_PNT( pSharedInfo, pTsstList ); - Oct6100UserMemSet( pTsstList, 0xFF, cOCT6100_MAX_TSSTS * sizeof(tOCT6100_API_TSST_ENTRY) ); - - /* Initialize the allocation list to manage the TSST entries.*/ - mOCT6100_GET_TSST_LIST_ALLOC_PNT( pSharedInfo, pTsstListAlloc ) - - ulResult = OctapiLlmAllocInit( &pTsstListAlloc, cOCT6100_MAX_TSSTS ); - if ( ulResult != cOCT6100_ERR_OK ) - return cOCT6100_ERR_FATAL_4E; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiValidateTsst - -Description: Validates a timeslot, stream combination. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This tsst is used to keep - the present state of the chip and all its resources. - -f_ulTimeslot Timeslot component of the TDM TSST. -f_ulStream Stream component of the TDM TSST. -f_ulNumTssts Number of TSST required. -f_ulDirection Direction of the TSST (Input or Output). - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiValidateTsst -UINT32 Oct6100ApiValidateTsst( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulNumTssts, - IN UINT32 f_ulTimeslot, - IN UINT32 f_ulStream, - IN UINT32 f_ulDirection ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - tPOCT6100_API_CHIP_CONFIG pChipConfig; - PUINT32 pulTsstAlloc; - - /* Obtain local pointer to shared portion of instance. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_TSST_ALLOC_PNT( f_pApiInstance->pSharedInfo, pulTsstAlloc ); - - /* Obtain local pointer to chip configuration. */ - pChipConfig = &pSharedInfo->ChipConfig; - - /* Check the TDM streams, timeslots component for errors. */ - if ( f_ulTimeslot == cOCT6100_UNASSIGNED && - f_ulStream != cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_TSST_TIMESLOT; - - if ( f_ulTimeslot != cOCT6100_UNASSIGNED && - f_ulStream == cOCT6100_UNASSIGNED ) - return cOCT6100_ERR_TSST_STREAM; - - if ( f_ulStream >= pChipConfig->byMaxTdmStreams ) - return cOCT6100_ERR_TSST_STREAM; - - /* Check timeslot value based on the frequenccy of the selected stream. */ - switch ( pChipConfig->aulTdmStreamFreqs[ f_ulStream / 4 ] ) - { - case cOCT6100_TDM_STREAM_FREQ_2MHZ: - if ( f_ulTimeslot >= 32 ) - return cOCT6100_ERR_TSST_TIMESLOT; - break; - case cOCT6100_TDM_STREAM_FREQ_4MHZ: - if ( f_ulTimeslot >= 64 ) - return cOCT6100_ERR_TSST_TIMESLOT; - break; - case cOCT6100_TDM_STREAM_FREQ_8MHZ: - if ( f_ulTimeslot >= 128 ) - return cOCT6100_ERR_TSST_TIMESLOT; - break; - case cOCT6100_TDM_STREAM_FREQ_16MHZ: - if ( f_ulTimeslot >= 256 ) - return cOCT6100_ERR_TSST_TIMESLOT; - - /* Check the stream value based on the direction. */ - if ( f_ulDirection == cOCT6100_INPUT_TSST && f_ulStream >= 16 ) - { - return cOCT6100_ERR_TSST_STREAM; - } - else if( f_ulDirection == cOCT6100_OUTPUT_TSST && f_ulStream < 16 ) - { - return cOCT6100_ERR_TSST_STREAM; - } - - break; - default: - return cOCT6100_ERR_FATAL_DC; - } - - /* Stream must be odd if two TSSTs are required. */ - if ( f_ulNumTssts == 2 && ( ( f_ulStream & 0x1) != 0x1 ) ) - return cOCT6100_ERR_TSST_STREAM; - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReserveTsst - -Description: Reserves a TSST, only one TSI entry can access a TSST at any one - time. - If the pointer f_pulTsstListIndex is set to NULL, no TSST list - entry will be reserved. - - The index in TSST control memory returned is based on the frequency - of the streams where the TSST is located and on the direction of - the TSST ( input or output ). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This tsst is used to keep - the present state of the chip and all its resources. - -f_ulTimeslot Timeslot component of the TDM TSST. -f_ulNumTssts Number of TSSTs required. -f_ulStream Stream component of the TDM TSST. -f_ulDirection Whether the TSST in and input TSST or output TSST. -f_pusTsstMemIndex Index of the resulting TSST in the TSST control memory. -f_pusTsstListIndex Index in the TSST list of the current entry. -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReserveTsst -UINT32 Oct6100ApiReserveTsst( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulTimeslot, - IN UINT32 f_ulStream, - IN UINT32 f_ulNumTsst, - IN UINT32 f_ulDirection, - OUT PUINT16 f_pusTsstMemIndex, - OUT PUINT16 f_pusTsstListIndex ) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PVOID pTsstListAlloc; - PUINT32 pulTsstAlloc; - UINT32 ulResult = cOCT6100_ERR_OK; - UINT32 ulStream; - UINT32 ulTimeslot; - - /* Get local pointer to shared portion of API instance structure. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - mOCT6100_GET_TSST_ALLOC_PNT( f_pApiInstance->pSharedInfo, pulTsstAlloc ); - - /*==================================================================================*/ - /* Now make the proper conversion to obtain the TSST value. */ - - /* Save the timeslot and stream value received. */ - ulStream = f_ulStream; - ulTimeslot = f_ulTimeslot; - - /* Set the TSST index associated to this stream, timeslot combination. */ - switch ( f_pApiInstance->pSharedInfo->ChipConfig.aulTdmStreamFreqs[ f_ulStream / 4 ] ) - { - case cOCT6100_TDM_STREAM_FREQ_16MHZ: - if ( f_ulDirection == cOCT6100_INPUT_TSST ) - { - ulStream = f_ulStream + ( f_ulTimeslot % 2 ) * 16; - ulTimeslot = f_ulTimeslot / 2; - } - else /* f_ulDirection == cOCT6100_OUTPUT_TSST */ - { - ulStream = ( f_ulStream - 16 ) + ( f_ulTimeslot % 2 ) * 16; - - if ( f_ulStream < 28 && ((f_ulTimeslot % 2) == 1) ) - { - ulTimeslot = ((f_ulTimeslot / 2) + 4) % 128; - } - else - { - ulTimeslot = f_ulTimeslot / 2 ; - } - } - - *f_pusTsstMemIndex = (UINT16)( ulTimeslot * 32 + ulStream ); - break; - - case cOCT6100_TDM_STREAM_FREQ_8MHZ: - *f_pusTsstMemIndex = (UINT16)( ulTimeslot * 32 + ulStream ); - break; - - case cOCT6100_TDM_STREAM_FREQ_4MHZ: - *f_pusTsstMemIndex = (UINT16)( ulTimeslot * 32 * 2 ); - if ( f_ulDirection == cOCT6100_OUTPUT_TSST ) - { - *f_pusTsstMemIndex = (UINT16)( *f_pusTsstMemIndex + ulStream ); - } - else /* if ( f_ulDirection == cOCT6100_INPUT_TSST ) */ - { - *f_pusTsstMemIndex = (UINT16)( ( 1 * 32 + ulStream ) + *f_pusTsstMemIndex ); - } - break; - - case cOCT6100_TDM_STREAM_FREQ_2MHZ: - *f_pusTsstMemIndex = (UINT16)( ulTimeslot * 32 * 4 ); - if ( f_ulDirection == cOCT6100_OUTPUT_TSST ) - { - *f_pusTsstMemIndex = (UINT16)( ulStream + *f_pusTsstMemIndex ); - } - else /* if ( f_ulDirection == cOCT6100_INPUT_TSST ) */ - { - *f_pusTsstMemIndex = (UINT16)( ( 3 * 32 + ulStream ) + *f_pusTsstMemIndex ); - } - break; - - default: - ulResult = cOCT6100_ERR_FATAL_8B; - } - /*======================================================================*/ - - - /*======================================================================*/ - /* First reserve the TSST. */ - - /* Get local pointer to TSST's entry in allocation table. */ - switch ( pSharedInfo->ChipConfig.aulTdmStreamFreqs[ ulStream / 4 ] ) - { - case cOCT6100_TDM_STREAM_FREQ_2MHZ: - ulTimeslot *= 4; - break; - case cOCT6100_TDM_STREAM_FREQ_4MHZ: - ulTimeslot *= 2; - break; - case cOCT6100_TDM_STREAM_FREQ_8MHZ: - ulTimeslot *= 1; - break; - case cOCT6100_TDM_STREAM_FREQ_16MHZ: - ulTimeslot *= 1; - break; - default: - return cOCT6100_ERR_FATAL_DD; - } - - /* Check if entry is already reserved. */ - if ( ((pulTsstAlloc[ ulTimeslot ] >> ulStream) & 0x1) == 0x1 ) - return cOCT6100_ERR_TSST_TSST_RESERVED; - - /* Check and reserve the associated TSST if required. */ - if ( f_ulNumTsst == 2 ) - { - /* Check if entry is already reserved. */ - if ( ((pulTsstAlloc[ ulTimeslot ] >> (ulStream - 1) ) & 0x1) == 0x1 ) - return cOCT6100_ERR_TSST_ASSOCIATED_TSST_RESERVED; - - /* The entry is free, it won't anymore. */ - pulTsstAlloc[ ulTimeslot ] |= (0x1 << (ulStream - 1)); - } - - /* The entry is free, it won't anymore.*/ - pulTsstAlloc[ ulTimeslot ] |= (0x1 << ulStream); - - /*======================================================================*/ - - - /*======================================================================*/ - /* Now reserve a TSST entry if requested. */ - - if ( f_pusTsstListIndex != NULL && ulResult == cOCT6100_ERR_OK ) - { - UINT32 ulTsstListIndex; - - /* Reserve a TSST entry in the API TSST list. */ - mOCT6100_GET_TSST_LIST_ALLOC_PNT( f_pApiInstance->pSharedInfo, pTsstListAlloc ); - - ulResult = OctapiLlmAllocAlloc( pTsstListAlloc, &ulTsstListIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - if ( ulResult == OCTAPI_LLM_NO_STRUCTURES_LEFT ) - ulResult = cOCT6100_ERR_TSST_ALL_TSSTS_ARE_OPENED; - else - ulResult = cOCT6100_ERR_FATAL_52; - } - - *f_pusTsstListIndex = (UINT16)( ulTsstListIndex & 0xFFFF ); - } - /*======================================================================*/ - - - /*======================================================================*/ - /* Check the result of the TSST list reservation. */ - - if ( ulResult != cOCT6100_ERR_OK ) - { - /* Release the previously reserved TSST. */ - if ( f_ulNumTsst == 2 ) - { - /* Clear the entry. */ - pulTsstAlloc[ ulTimeslot ] &= ~(0x1 << (ulStream - 1) ); - - } - - /* Clear the entry. */ - pulTsstAlloc[ ulTimeslot ] &= ~(0x1 << ulStream); - } - - /*======================================================================*/ - - return ulResult; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100ApiReleaseTsst - -Description: Releases a TSST. - - If f_usTsstListIndex is set to cOCT6100_INVALID_INDEX, the API - will assume that no TSST list entry was reserved for this TSST. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pApiInstance Pointer to API instance. This tsst is used to keep - the present state of the chip and all its resources. - -f_ulNumTssts Number of TSSTs to be released. -f_ulStream Stream component of the TDM TSST. -f_ulTimeslot Timeslot component of the TDM TSST. -f_ulDirection Whether the TSST is an input TSST or output TSST. -f_usTsstListIndex Index in the TSST list of the current entry. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100ApiReleaseTsst -UINT32 Oct6100ApiReleaseTsst( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulTimeslot, - IN UINT32 f_ulStream, - IN UINT32 f_ulNumTsst, - IN UINT32 f_ulDirection, - IN UINT16 f_usTsstListIndex) -{ - tPOCT6100_SHARED_INFO pSharedInfo; - PUINT32 pulTsstAlloc; - PVOID pTsstListAlloc; - UINT32 ulResult; - UINT32 ulStream; - UINT32 ulTimeslot; - - /* Get local pointer to shared portion of API instance structure. */ - pSharedInfo = f_pApiInstance->pSharedInfo; - - if ( f_usTsstListIndex != cOCT6100_INVALID_INDEX ) - { - mOCT6100_GET_TSST_LIST_ALLOC_PNT( pSharedInfo, pTsstListAlloc ) - - ulResult = OctapiLlmAllocDealloc( pTsstListAlloc, f_usTsstListIndex ); - if ( ulResult != cOCT6100_ERR_OK ) - { - return cOCT6100_ERR_FATAL_53; - } - } - - mOCT6100_GET_TSST_ALLOC_PNT( f_pApiInstance->pSharedInfo, pulTsstAlloc ); - - /*==================================================================================*/ - /* Now make the proper conversion to obtain the TSST value. */ - - /* Save the timeslot and stream value received. */ - ulStream = f_ulStream; - ulTimeslot = f_ulTimeslot; - - /* Set the TSST index associated to this stream, timeslot combination. */ - if ( pSharedInfo->ChipConfig.aulTdmStreamFreqs[ f_ulStream / 4 ] == cOCT6100_TDM_STREAM_FREQ_16MHZ ) - { - if ( f_ulDirection == cOCT6100_INPUT_TSST ) - { - ulStream = f_ulStream + ( f_ulTimeslot % 2 ) * 16; - ulTimeslot = f_ulTimeslot / 2; - } - else /* f_ulDirection == cOCT6100_OUTPUT_TSST */ - { - ulStream = ( f_ulStream - 16 ) + ( f_ulTimeslot % 2 ) * 16; - - if ( f_ulStream < 28 && ((f_ulTimeslot % 2) == 1) ) - { - ulTimeslot = ((f_ulTimeslot / 2) + 4) % 128; - } - else - { - ulTimeslot = f_ulTimeslot / 2 ; - } - } - } - - /* Get local pointer to TSST's entry in allocation table. */ - switch ( pSharedInfo->ChipConfig.aulTdmStreamFreqs[ ulStream / 4 ] ) - { - case cOCT6100_TDM_STREAM_FREQ_2MHZ: - ulTimeslot *= 4; - break; - case cOCT6100_TDM_STREAM_FREQ_4MHZ: - ulTimeslot *= 2; - break; - case cOCT6100_TDM_STREAM_FREQ_8MHZ: - ulTimeslot *= 1; - break; - case cOCT6100_TDM_STREAM_FREQ_16MHZ: - ulTimeslot *= 1; - break; - default: - return cOCT6100_ERR_FATAL_DE; - } - - /* Check if entry is actualy reserved. */ - if ( ((pulTsstAlloc[ ulTimeslot ] >> ulStream) & 0x1) != 0x1 ) - return cOCT6100_ERR_FATAL_55; - - /*==================================================================================*/ - - /* Clear the entry. */ - pulTsstAlloc[ ulTimeslot ] &= ~(0x1 << ulStream); - - /* Check and release the associated TSST if required. */ - if ( f_ulNumTsst == 2 ) - { - /* Check if entry is actualy reserved. */ - if ( ((pulTsstAlloc[ ulTimeslot ] >> ( ulStream - 1)) & 0x1) != 0x1 ) - return cOCT6100_ERR_FATAL_54; - - /* Clear the entry. */ - pulTsstAlloc[ ulTimeslot ] &= ~(0x1 << (ulStream - 1)); - - } - - return cOCT6100_ERR_OK; -} -#endif diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_user.c b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_user.c deleted file mode 100644 index 9d0e317..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_api/oct6100_user.c +++ /dev/null @@ -1,508 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_user.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains the functions provided by the user. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 28 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - - -#include "oct6100api/oct6100_apiud.h" -#include "oct6100api/oct6100_errors.h" - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserGetTime - -Description: Returns the system time in us. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pTime Pointer to structure in which the time is returned. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserGetTime -UINT32 Oct6100UserGetTime( - IN OUT tPOCT6100_GET_TIME f_pTime ) -{ - - return cOCT6100_ERR_OK; -} -#endif - - - - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserMemSet - -Description: Sets f_ulLength bytes pointed to by f_pAddress to f_ulPattern. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_pAddress Address in host memory where data should be set. -f_ulPattern Pattern to apply at the address. This value will never - exceed 0xFF. -f_ulLength Length in bytes to set. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserMemSet -UINT32 Oct6100UserMemSet( - IN PVOID f_pAddress, - IN UINT32 f_ulPattern, - IN UINT32 f_ulLength ) -{ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserMemCopy - -Description: Copy f_ulLength bytes from f_pSource to f_pDestination. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- - -f_pDestination Host data destination address. -f_pSource Host data source address. -f_ulLength Length in bytes to copy. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserMemCopy -UINT32 Oct6100UserMemCopy( - IN PVOID f_pDestination, - IN const void *f_pSource, - IN UINT32 f_ulLength ) -{ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserCreateSerializeObject - -Description: Creates a serialization object. The serialization object is - seized via the Oct6100UserSeizeSerializeObject function. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pCreate Pointer to structure in which the serialization object's - handle is returned. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserCreateSerializeObject -UINT32 Oct6100UserCreateSerializeObject( - IN OUT tPOCT6100_CREATE_SERIALIZE_OBJECT f_pCreate ) -{ - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDestroySerializeObject - -Description: Destroys the indicated serialization object. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pDestroy Pointer to structure containing the handle of the - serialization object. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDestroySerializeObject -UINT32 Oct6100UserDestroySerializeObject( - IN tPOCT6100_DESTROY_SERIALIZE_OBJECT f_pDestroy ) -{ - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserSeizeSerializeObject - -Description: Seizes the indicated serialization object. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pSeize Pointer to structure containing the handle of the - serialization object. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserSeizeSerializeObject -UINT32 Oct6100UserSeizeSerializeObject( - IN tPOCT6100_SEIZE_SERIALIZE_OBJECT f_pSeize ) -{ - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserReleaseSerializeObject - -Description: Releases the indicated serialization object. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pRelease Pointer to structure containing the handle of the - serialization object. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserReleaseSerializeObject -UINT32 Oct6100UserReleaseSerializeObject( - IN tPOCT6100_RELEASE_SERIALIZE_OBJECT f_pRelease ) -{ - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDriverWriteApi - -Description: Performs a write access to the chip. This function is - accessible only from the API code entity (i.e. not from the - APIMI code entity). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pWriteParams Pointer to structure containing the Params to the - write function. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDriverWriteApi -UINT32 Oct6100UserDriverWriteApi( - IN tPOCT6100_WRITE_PARAMS f_pWriteParams ) -{ - - - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDriverWriteOs - -Description: Performs a write access to the chip. This function is - accessible only from the APIMI code entity (i.e. not from the - API code entity). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pWriteParams Pointer to structure containing the Params to the - write function. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDriverWriteOs -UINT32 Oct6100UserDriverWriteOs( - IN tPOCT6100_WRITE_PARAMS f_pWriteParams ) -{ - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDriverWriteSmearApi - -Description: Performs a series of write accesses to the chip. The same data - word is written to a series of addresses. The writes begin at - the start address, and the address is incremented by the - indicated amount for each subsequent write. This function is - accessible only from the API code entity (i.e. not from the - APIMI code entity). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pSmearParams Pointer to structure containing the parameters to the - write smear function. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDriverWriteSmearApi -UINT32 Oct6100UserDriverWriteSmearApi( - IN tPOCT6100_WRITE_SMEAR_PARAMS f_pSmearParams ) -{ - - - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDriverWriteSmearOs - -Description: Performs a series of write accesses to the chip. The same data - word is written to a series of addresses. The writes begin at - the start address, and the address is incremented by the - indicated amount for each subsequent write. This function is - accessible only from the APIMI code entity (i.e. not from the - API code entity). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pSmearParams Pointer to structure containing the parameters to the - write smear function. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDriverWriteSmearOs -UINT32 Oct6100UserDriverWriteSmearOs( - IN tPOCT6100_WRITE_SMEAR_PARAMS f_pSmearParams ) -{ - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDriverWriteBurstApi - -Description: Performs a series of write accesses to the chip. An array of - data words is written to a series of consecutive addresses. - The writes begin at the start address with element 0 of the - provided array as the data word. The address is incremented by - two for each subsequent write. This function is accessible only - from the API code entity (i.e. not from the APIMI code entity). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pBurstParams Pointer to structure containing the parameters to the - write burst function. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDriverWriteBurstApi -UINT32 Oct6100UserDriverWriteBurstApi( - IN tPOCT6100_WRITE_BURST_PARAMS f_pBurstParams ) -{ - - - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDriverWriteBurstOs - -Description: Performs a series of write accesses to the chip. An array of - data words is written to a series of consecutive addresses. - The writes begin at the start address with element 0 of the - provided array as the data word. The address is incremented by - two for each subsequent write. This function is accessible only - from the API code entity (i.e. not from the APIMI code entity). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pBurstParams Pointer to structure containing the parameters to the - write burst function. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDriverWriteBurstOs -UINT32 Oct6100UserDriverWriteBurstOs( - IN tPOCT6100_WRITE_BURST_PARAMS f_pBurstParams ) -{ - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDriverReadApi - -Description: Performs a read access to the chip. This function is accessible - only from the API code entity (i.e. not from the APIMI code - entity). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pReadParams Pointer to structure containing the parameters to the - read function. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDriverReadApi -UINT32 Oct6100UserDriverReadApi( - IN OUT tPOCT6100_READ_PARAMS f_pReadParams ) -{ - - - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDriverReadOs - -Description: Performs a read access to the chip. This function is accessible - only from the APIMI code entity (i.e. not from the API code - entity). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pReadParams Pointer to structure containing the parameters to the - read function. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDriverReadOs -UINT32 Oct6100UserDriverReadOs( - IN OUT tPOCT6100_READ_PARAMS f_pReadParams ) -{ - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDriverReadBurstApi - -Description: Performs a burst of read accesses to the chip. The first read - is performed at the start address, and the address is - incremented by two for each subsequent read. The data is - retunred in an array provided by the user. This function is - accessible only from the API code entity (i.e. not from the - APIMI code entity). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pBurstParams Pointer to structure containing the parameters to the - read burst function. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDriverReadBurstApi -UINT32 Oct6100UserDriverReadBurstApi( - IN OUT tPOCT6100_READ_BURST_PARAMS f_pBurstParams ) -{ - - - - - return cOCT6100_ERR_OK; -} -#endif - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100UserDriverReadBurstOs - -Description: Performs a burst of read accesses to the chip. The first read - is performed at the start address, and the address is - incremented by two for each subsequent read. The data is - retunred in an array provided by the user. This function is - accessible only from the APIMI code entity (i.e. not from the - API code entity). - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pBurstParams Pointer to structure containing the parameters to the - read burst function. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#if !SKIP_Oct6100UserDriverReadBurstOs -UINT32 Oct6100UserDriverReadBurstOs( - IN OUT tPOCT6100_READ_BURST_PARAMS f_pBurstParams ) -{ - - - return cOCT6100_ERR_OK; -} -#endif - - - - - - - diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_apimi/oct6100_mask_interrupts.c b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_apimi/oct6100_mask_interrupts.c deleted file mode 100644 index a93db97..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_apimi/oct6100_mask_interrupts.c +++ /dev/null @@ -1,116 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_mask_interrupts.c - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains the mask interrupts function. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 8 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - - -/***************************** INCLUDE FILES *******************************/ - -#include "oct6100api/oct6100_apimi.h" -#include "oct6100api/oct6100_apiud.h" -#include "oct6100api/oct6100_errors.h" -#include "oct6100api/oct6100_defines.h" - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: Oct6100InterruptMask - -Description: The function is used to mask out the interrupt pin of the chip. - This function is used when a deferred procedure call treats the - interrupt (new interrupts must not be generated until the - signaled interrupt is treated). Which chip is to have its - interrupts masked is determined by the mask structure, - f_pInterruptMask. - -------------------------------------------------------------------------------- -| Argument | Description -------------------------------------------------------------------------------- -f_pInterruptMask Pointer to the interrupt masking structure. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -UINT32 Oct6100InterruptMaskDef( - OUT tPOCT6100_INTERRUPT_MASK f_pInterruptMask ) -{ - f_pInterruptMask->ulUserChipIndex = cOCT6100_INVALID_VALUE; - f_pInterruptMask->pProcessContext = NULL; - - - return cOCT6100_ERR_OK; -} - -UINT32 Oct6100InterruptMask( - IN tPOCT6100_INTERRUPT_MASK f_pInterruptMask ) -{ - tOCT6100_WRITE_PARAMS WriteParams; - tOCT6100_READ_PARAMS ReadParams; - UINT32 result; - UINT16 usReadData; - - /* Determine if the chip's interrupt pin is active.*/ - ReadParams.ulReadAddress = 0x210; - ReadParams.pusReadData = &usReadData; - ReadParams.pProcessContext = f_pInterruptMask->pProcessContext; - - ReadParams.ulUserChipId = f_pInterruptMask->ulUserChipIndex; - - result = Oct6100UserDriverReadOs( &ReadParams ); - if ( result != cOCT6100_ERR_OK ) - return cOCT6100_ERR_INTRPTS_RW_ERROR; - - if ( (usReadData & 0xFFFF) != 0 ) - { - /* Chip's interrupt pin is active, so mask interrupt pin. */ - ReadParams.ulReadAddress = 0x214; - result = Oct6100UserDriverReadOs( &ReadParams ); - if ( result != cOCT6100_ERR_OK ) - return cOCT6100_ERR_INTRPTS_RW_ERROR; - - /* Determine if the chip's interrupt pin is active. */ - WriteParams.pProcessContext = f_pInterruptMask->pProcessContext; - - WriteParams.ulUserChipId = f_pInterruptMask->ulUserChipIndex; - WriteParams.ulWriteAddress = 0x214; - WriteParams.usWriteData = (UINT16)( (usReadData & 0xC000) | 0x3FFF ); - - result = Oct6100UserDriverWriteOs( &WriteParams ); - if ( result != cOCT6100_ERR_OK ) - return cOCT6100_ERR_INTRPTS_RW_ERROR; - - WriteParams.ulWriteAddress = 0x212; - WriteParams.usWriteData = 0x8000; - - result = Oct6100UserDriverWriteOs( &WriteParams ); - if ( result != cOCT6100_ERR_OK ) - return cOCT6100_ERR_INTRPTS_RW_ERROR; - - return cOCT6100_ERR_OK; - } - - return cOCT6100_ERR_INTRPTS_NOT_ACTIVE; -} diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_channel_priv.h b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_channel_priv.h deleted file mode 100644 index cd55191..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_channel_priv.h +++ /dev/null @@ -1,529 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_channel_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_channel.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_channel_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 62 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_CHANNEL_PRIV_H__ -#define __OCT6100_CHANNEL_PRIV_H__ - - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - -/* ECHO channel list pointer macros. */ -#define mOCT6100_GET_CHANNEL_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_CHANNEL )(( PUINT8 )pSharedInfo + pSharedInfo->ulChannelListOfst ); - -#define mOCT6100_GET_CHANNEL_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_CHANNEL )(( PUINT8 )pSharedInfo + pSharedInfo->ulChannelListOfst)) + ulIndex; - -#define mOCT6100_GET_CHANNEL_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulChannelAllocOfst); - -#define mOCT6100_GET_BIDIR_CHANNEL_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_BIDIR_CHANNEL )(( PUINT8 )pSharedInfo + pSharedInfo->ulBiDirChannelListOfst ); - -#define mOCT6100_GET_BIDIR_CHANNEL_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_BIDIR_CHANNEL )(( PUINT8 )pSharedInfo + pSharedInfo->ulBiDirChannelListOfst)) + ulIndex; - -#define mOCT6100_GET_BIDIR_CHANNEL_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulBiDirChannelAllocOfst ); - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_API_ECHO_CHAN_INDEX_ -{ - /* Index of the channel in the API echo channel list.*/ - UINT16 usEchoChanIndex; - - /* TSI chariot memory entry for the Rin/Rout stream. */ - UINT16 usRinRoutTsiMemIndex; - - /* TSI chariot memory entry for the Sin/Sout stream. */ - UINT16 usSinSoutTsiMemIndex; - - /* SSPX memory entry. */ - UINT16 usEchoMemIndex; - - /* TDM sample conversion control memory entry. */ - UINT16 usRinRoutConversionMemIndex; - UINT16 usSinSoutConversionMemIndex; - - /* Internal info for quick access to structures associated to this TSI cnct. */ - UINT16 usRinTsstIndex; - UINT16 usSinTsstIndex; - UINT16 usRoutTsstIndex; - UINT16 usSoutTsstIndex; - - /* Index of the phasing TSST */ - UINT16 usPhasingTsstIndex; - - UINT8 fSinSoutCodecActive; - UINT8 fRinRoutCodecActive; - - - /* Extended Tone Detection resources.*/ - UINT16 usExtToneChanIndex; - UINT16 usExtToneMixerIndex; - UINT16 usExtToneTsiIndex; -} tOCT6100_API_ECHO_CHAN_INDEX, *tPOCT6100_API_ECHO_CHAN_INDEX; - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetChannelsEchoSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100ApiChannelsEchoSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ChannelOpenSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_OPEN f_pChannelOpen ); - -UINT32 Oct6100ApiCheckChannelParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN OUT tPOCT6100_API_ECHO_CHAN_INDEX f_pChanIndexConf ); - -UINT32 Oct6100ApiReserveChannelResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN OUT tPOCT6100_API_ECHO_CHAN_INDEX f_pChanIndexConf ); - -UINT32 Oct6100ApiWriteChannelStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN tPOCT6100_API_ECHO_CHAN_INDEX f_pChanIndexConf ); - -UINT32 Oct6100ApiUpdateChannelEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN tPOCT6100_API_ECHO_CHAN_INDEX f_pChanIndexConf ); - -UINT32 Oct6100ChannelCloseSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_CLOSE f_pChannelClose ); - -UINT32 Oct6100ApiAssertChannelParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_CLOSE f_pChannelClose, - - IN OUT PUINT16 f_pusChanIndex ); - -UINT32 Oct6100ApiInvalidateChannelStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - - IN UINT16 f_usChanIndex ); - -UINT32 Oct6100ApiReleaseChannelResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChannelIndex ); - -UINT32 Oct6100ChannelModifySer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MODIFY f_pChannelModify ); - -UINT32 Oct6100ApiCheckChannelModify( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MODIFY f_pChannelModify, - IN OUT tPOCT6100_CHANNEL_OPEN f_pTempChanOpen, - OUT PUINT16 f_pusNewPhasingTsstIndex, - OUT PUINT16 f_pusChanIndex ); - -UINT32 Oct6100ApiModifyChannelResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MODIFY f_pChannelModify, - IN UINT16 f_usChanIndex, - OUT PUINT16 f_pusNewRinTsstIndex, - OUT PUINT16 f_pusNewSinTsstIndex, - OUT PUINT16 f_pusNewRoutTsstIndex, - OUT PUINT16 f_pusNewSoutTsstIndex ); - -UINT32 Oct6100ApiModifyChannelStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MODIFY f_pChannelModify, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usNewPhasingTsstIndex, - OUT PUINT8 f_pfSinSoutCodecActive, - OUT PUINT8 f_pfRinRoutCodecActive, - IN UINT16 f_usNewRinTsstIndex, - IN UINT16 f_uslNewSinTsstIndex, - IN UINT16 f_usNewRoutTsstIndex, - IN UINT16 f_usNewSoutTsstIndex ); - -UINT32 Oct6100ApiModifyChannelEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_MODIFY f_pChannelModify, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usNewPhasingTsstIndex, - IN UINT8 f_fSinSoutCodecActive, - IN UINT8 f_fRinRoutCodecActive, - IN UINT16 f_usNewRinTsstIndex, - IN UINT16 f_usNewSinTsstIndex, - IN UINT16 f_usNewRoutTsstIndex, - IN UINT16 f_usNewSoutTsstIndex ); - -UINT32 Oct6100ChannelBroadcastTsstAddSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstAdd ); - -UINT32 Oct6100ApiCheckChanTsstAddParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstRemove, - OUT PUINT16 f_pusChanIndex ); - -UINT32 Oct6100ApiReserveTsstAddResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstRemove, - IN UINT16 f_usChanIndex, - OUT PUINT16 f_pusNewTsstIndex, - OUT PUINT16 f_pusNewTsstEntry ); - -UINT32 Oct6100ApiWriteTsstAddStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstRemove, - IN UINT16 f_usChanIndex, - IN UINT16 f_usNewTsstIndex ); - -UINT32 Oct6100ApiUpdateTsstAddChanEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_ADD f_pChannelTsstRemove, - IN UINT16 f_usChanIndex, - IN UINT16 f_usNewTsstIndex, - IN UINT16 f_usNewTsstEntry ); - -UINT32 Oct6100ChannelBroadcastTsstRemoveSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelTsstRemove); - -UINT32 Oct6100ApiAssertChanTsstRemoveParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelTsstRemove, - OUT PUINT16 f_pusChanIndex, - OUT PUINT16 f_pusTsstIndex, - OUT PUINT16 f_pusTsstEntry, - OUT PUINT16 f_pusPrevTsstEntry ); - -UINT32 Oct6100ApiInvalidateTsstRemoveStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChanIndex, - IN UINT16 f_usTsstIndex, - IN UINT32 f_ulPort, - IN BOOL f_fRemoveAll ); - -UINT32 Oct6100ApiReleaseTsstRemoveResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_BROADCAST_TSST_REMOVE f_pChannelTsstRemove, - IN UINT16 f_usChanIndex, - IN UINT16 f_usTsstIndex, - IN UINT16 f_usTsstEntry, - IN UINT16 f_usPrevTsstEntry ); - -UINT32 Oct6100ApiChannelGetStatsSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_STATS f_pChannelStats ); - -UINT32 Oct6100ApiReserveEchoEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusEchoIndex ); - -UINT32 Oct6100ApiReleaseEchoEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEchoChanIndex ); - -UINT32 Oct6100ApiCheckTdmConfig( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_TDM f_pTdmConfig ); - -UINT32 Oct6100ApiCheckVqeConfig( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN BOOL f_fEnableToneDisabler ); - -UINT32 Oct6100ApiCheckCodecConfig( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_CODEC f_pCodecConfig, - IN UINT32 f_ulDecoderNumTssts, - OUT PUINT16 f_pusPhasingTsstIndex ); - -UINT32 Oct6100ApiWriteInputTsstControlMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsstIndex, - IN UINT16 f_usTsiMemIndex, - IN UINT32 f_ulTsstInputLaw ); - -UINT32 Oct6100ApiWriteOutputTsstControlMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsstIndex, - IN UINT32 f_ulAdpcmNibblePosition, - IN UINT32 f_ulNumTssts, - IN UINT16 f_usTsiMemIndex ); - -UINT32 Oct6100ApiWriteEncoderMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulEncoderIndex, - IN UINT32 f_ulCompType, - IN UINT16 f_usTsiMemIndex, - IN UINT32 f_ulEnableSilenceSuppression, - IN UINT32 f_ulAdpcmNibblePosition, - IN UINT16 f_usPhasingTsstIndex, - IN UINT32 f_ulPhasingType, - IN UINT32 f_ulPhase ); - -UINT32 Oct6100ApiWriteDecoderMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usDecoderIndex, - IN UINT32 f_ulCompType, - IN UINT16 f_usTsiMemIndex, - IN UINT32 f_ulPcmLaw, - IN UINT32 f_ulAdpcmNibblePosition ); - - -UINT32 Oct6100ApiClearConversionMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usConversionMemIndex ); - -UINT32 Oct6100ApiWriteVqeMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN BOOL f_fClearPlayoutPointers, - IN BOOL f_fModifyOnly ); - -UINT32 Oct6100ApiWriteVqeNlpMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN BOOL f_fClearPlayoutPointers, - IN BOOL f_fModifyOnly ); - -UINT32 Oct6100ApiWriteVqeAfMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN BOOL f_fClearPlayoutPointers, - IN BOOL f_fModifyOnly ); - -UINT32 Oct6100ApiWriteEchoMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_TDM f_pTdmConfig, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usEchoIndex, - IN UINT16 f_usRinRoutTsiIndex, - IN UINT16 f_usSinSoutTsiIndex ); - -UINT32 Oct6100ApiUpdateOpenStruct( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MODIFY f_pChanModify, - IN OUT tPOCT6100_CHANNEL_OPEN f_pChanOpen, - IN tPOCT6100_API_CHANNEL f_pChanEntry ); - - - - - -UINT32 Oct6100ApiRetrieveNlpConfDword( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_CHANNEL f_pChanEntry, - IN UINT32 f_ulAddress, - OUT PUINT32 f_pulConfigDword ); - -UINT32 Oct6100ApiSaveNlpConfDword( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_CHANNEL f_pChanEntry, - IN UINT32 f_ulAddress, - IN UINT32 f_ulConfigDword ); - -UINT32 Oct6100ChannelCreateBiDirSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT IN OUT tPOCT6100_CHANNEL_CREATE_BIDIR f_pChannelCreateBiDir ); - -UINT32 Oct6100ApiCheckChannelCreateBiDirParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_CREATE_BIDIR f_pChannelCreateBiDir, - OUT PUINT16 f_pusFirstChanIndex, - OUT PUINT16 f_pusFirstChanExtraTsiIndex, - OUT PUINT16 f_pusFirstChanSinCopyEventIndex, - OUT PUINT16 f_pusSecondChanIndex, - OUT PUINT16 f_pusSecondChanExtraTsiIndex, - OUT PUINT16 f_pusSecondChanSinCopyEventIndex - - ); - -UINT32 Oct6100ApiReserveChannelCreateBiDirResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - - OUT PUINT16 f_pusBiDirChanIndex, - IN OUT PUINT16 f_pusFirstChanExtraTsiIndex, - IN OUT PUINT16 f_pusFirstChanSinCopyEventIndex, - OUT PUINT16 f_pusFirstChanSoutCopyEventIndex, - IN OUT PUINT16 f_pusSecondChanExtraTsiIndex, - IN OUT PUINT16 f_pusSecondChanSinCopyEventIndex, - OUT PUINT16 f_pusSecondChanSoutCopyEventIndex ); - -UINT32 Oct6100ApiWriteChannelCreateBiDirStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - - IN UINT16 f_usFirstChanIndex, - IN UINT16 f_usFirstChanExtraTsiIndex, - IN UINT16 f_usFirstChanSinCopyEventIndex, - IN UINT16 f_usFirstChanSoutCopyEventIndex, - IN UINT16 f_usSecondChanIndex, - IN UINT16 f_usSecondChanExtraTsiIndex, - IN UINT16 f_usSecondChanSinCopyEventIndex, - IN UINT16 f_usSecondChanSoutCopyEventIndex ); - -UINT32 Oct6100ApiUpdateBiDirChannelEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT tPOCT6100_CHANNEL_CREATE_BIDIR f_pChannelCreateBiDir, - IN UINT16 f_usBiDirChanIndex, - IN UINT16 f_usFirstChanIndex, - IN UINT16 f_usFirstChanExtraTsiIndex, - IN UINT16 f_usFirstChanSinCopyEventIndex, - IN UINT16 f_usFirstChanSoutCopyEventIndex, - IN UINT16 f_usSecondChanIndex, - IN UINT16 f_usSecondChanExtraTsiIndex, - IN UINT16 f_usSecondChanSinCopyEventIndex, - IN UINT16 f_usSecondChanSoutCopyEventIndex ); - -UINT32 Oct6100ChannelDestroyBiDirSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_CHANNEL_DESTROY_BIDIR f_pChannelDestroyBiDir ); - -UINT32 Oct6100ApiAssertDestroyBiDirChanParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_DESTROY_BIDIR f_pChannelDestroyBiDir, - IN OUT PUINT16 f_pusBiDirChanIndex, - - IN OUT PUINT16 f_pusFirstChanIndex, - IN OUT PUINT16 f_pusSecondChanIndex ); - -UINT32 Oct6100ApiInvalidateBiDirChannelStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - - IN UINT16 f_usFirstChanIndex, - IN UINT16 f_usSecondChanIndex ); - -UINT32 Oct6100ApiReleaseBiDirChannelResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usBiDirChanIndex, - - IN UINT16 f_usFirstChanIndex, - IN UINT16 f_usSecondChanIndex ); - -UINT32 Oct6100ApiWriteDebugChanMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_TDM f_pTdmConfig, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN tPOCT6100_CHANNEL_OPEN f_pChannelOpen, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN UINT16 f_usRinRoutTsiIndex, - IN UINT16 f_usSinSoutTsiIndex ); - -UINT32 Oct6100ApiDebugChannelOpen( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiMutePorts( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEchoIndex, - IN UINT16 f_usRinTsstIndex, - IN UINT16 f_usSinTsstIndex, - IN BOOL f_fCheckBridgeIndex ); - -UINT32 Oct6100ApiSetChannelLevelControl( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN BOOL f_fClearAlcHlcStatusBit ); - -UINT32 Oct6100ApiSetChannelTailConfiguration( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_OPEN_VQE f_pVqeConfig, - IN UINT16 f_usChanIndex, - IN UINT16 f_usEchoMemIndex, - IN BOOL f_fModifyOnly ); - -UINT32 Oct6100ChannelMuteSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MUTE f_pChannelMute ); - -UINT32 Oct6100ApiAssertChannelMuteParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_MUTE f_pChannelMute, - OUT PUINT16 f_pusChanIndex, - OUT PUINT16 f_pusPorts ); - -UINT32 Oct6100ChannelUnMuteSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_UNMUTE f_pChannelUnMute ); - -UINT32 Oct6100ApiAssertChannelUnMuteParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHANNEL_UNMUTE f_pChannelUnMute, - OUT PUINT16 f_pusChanIndex, - OUT PUINT16 f_pusPorts ); - -UINT32 Oct6100ApiMuteSinWithFeatures( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChanIndex, - IN BOOL f_fEnableSinWithFeatures ); - -UINT32 Oct6100ApiMuteChannelPorts( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usChanIndex, - IN UINT16 f_usPortMask, - IN BOOL f_fMute ); - -INT32 Oct6100ApiOctFloatToDbEnergyByte( - IN UINT8 x ); - -INT32 Oct6100ApiOctFloatToDbEnergyHalf( - IN UINT16 x ); - -UINT16 Oct6100ApiDbAmpHalfToOctFloat( - IN INT32 x ); - -#endif /* __OCT6100_CHANNEL_PRIV_H__ */ diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_chip_open_priv.h b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_chip_open_priv.h deleted file mode 100644 index 46a13e3..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_chip_open_priv.h +++ /dev/null @@ -1,264 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_chip_open_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_chip_open.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_chip_open_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 63 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_CHIP_OPEN_PRIV_H__ -#define __OCT6100_CHIP_OPEN_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - -typedef struct _OCT6100_API_INSTANCE_SIZES_ -{ - /* Each of the following elements indicates the size of the instance memory */ - /* needed by the corresponding API module. All sizes are in bytes. */ - UINT32 ulChannelList; - UINT32 ulChannelAlloc; - - UINT32 ulTsiCnctList; - UINT32 ulTsiCnctAlloc; - - UINT32 ulMixerEventList; - UINT32 ulMixerEventAlloc; - - UINT32 ulBiDirChannelList; - UINT32 ulBiDirChannelAlloc; - - UINT32 ulAdpcmChannelList; - UINT32 ulAdpcmChannelAlloc; - - UINT32 ulSoftBufPlayoutEventsBuffer; - - UINT32 ulCopyEventList; - UINT32 ulCopyEventAlloc; - - UINT32 ulConfBridgeList; - UINT32 ulConfBridgeAlloc; - - UINT32 ulFlexConfParticipantsList; - UINT32 ulFlexConfParticipantsAlloc; - - UINT32 ulPlayoutBufList; - UINT32 ulPlayoutBufAlloc; - UINT32 ulPlayoutBufMemoryNodeList; - - - - UINT32 ulSoftToneEventsBuffer; - - UINT32 ulPhasingTsstList; - UINT32 ulPhasingTsstAlloc; - - UINT32 ulConversionMemoryAlloc; - - UINT32 ulTsiMemoryAlloc; - UINT32 ulTsstAlloc; - - UINT32 ulTsstEntryList; - UINT32 ulTsstEntryAlloc; - - UINT32 ulRemoteDebugList; - UINT32 ulRemoteDebugTree; - UINT32 ulRemoteDebugPktCache; - UINT32 ulRemoteDebugDataBuf; - - /* Memory consumed by static members of API instance. */ - UINT32 ulApiInstStatic; - - /* Total memory size for API instance. */ - UINT32 ulApiInstTotal; - -} tOCT6100_API_INSTANCE_SIZES, *tPOCT6100_API_INSTANCE_SIZES; - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiCheckChipConfiguration( - IN tPOCT6100_CHIP_OPEN f_pOpenChip ); - -UINT32 Oct6100ApiCheckImageFileHeader( - IN tPOCT6100_CHIP_OPEN f_pChipOpen ); - -UINT32 Oct6100ApiCopyChipConfiguration( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_CHIP_OPEN f_pOpenChip ); - -UINT32 Oct6100ApiInitializeMiscellaneousVariables( - IN OUT tPOCT6100_INSTANCE_API f_pInstance ); - -UINT32 Oct6100ApiCalculateInstanceSizes( - IN OUT tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstanceSizes ); - -UINT32 Oct6100ApiAllocateInstanceMemory( - IN OUT tPOCT6100_INSTANCE_API f_pInstance, - IN tPOCT6100_API_INSTANCE_SIZES f_pInstanceSizes ); - -UINT32 Oct6100ApiInitializeInstanceMemory( - IN OUT tPOCT6100_INSTANCE_API f_pInstance ); - -UINT32 Oct6100ApiGetChipRevisionNum( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiMapExternalMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiDecodeKeyAndBist( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiBootFc2Pll( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiProgramFc1Pll( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiBootFc1Pll( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiWriteH100Registers( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiExternalMemoryBist( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiExternalMemoryInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiLoadImage( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiCpuRegisterBist( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiBootSdram( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiEnableClocks( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiProgramNLP( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiSetH100Register( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiWriteMiscellaneousRegisters( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT16 Oct6100ApiGenerateNumber( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulIndex, - IN UINT32 f_ulDataMask ); - -UINT32 Oct6100ApiRandomMemoryWrite( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulMemBase, - IN UINT32 f_ulMemSize, - IN UINT32 f_ulNumDataBits, - IN UINT32 f_ulNumAccesses, - IN UINT32 f_ulErrorCode ); - -UINT32 Oct6100ApiUserIoTest( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiCreateSerializeObjects( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulUserChipId ); - -UINT32 Oct6100ApiDestroySerializeObjects( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiRunEgo( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN BOOL f_fStoreFlag, - IN UINT32 f_ulNumEntry, - OUT PUINT32 f_aulEntry ); - -UINT32 Oct6100ApiCreateEgoEntry( - IN OUT UINT32 f_ulExternalAddress, - IN UINT32 f_ulInternalAddress, - IN UINT32 f_ulNumBytes, - IN UINT32 f_aulEntry[ 2 ] ); - - - - - -UINT32 Oct6100ApiInitChannels( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiInitMixer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiInitRecordResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100FreeResourcesSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_FREE_RESOURCES f_pFreeResources ); - -UINT32 Oct6100ProductionBistSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_PRODUCTION_BIST f_pProductionBist ); - -UINT32 Oct6100ApiProductionCrc( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN PUINT32 f_pulMessage, - IN UINT32 f_ulMessageLength, - OUT PUINT32 f_pulCrcResult ); - -UINT32 Oct6100ApiReadCapacity( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins ); - -UINT32 Oct6100ApiCpuRegisterBistReadCap( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins ); - -UINT32 Oct6100ApiBootFc2PllReadCap( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins ); - -UINT32 Oct6100ApiProgramFc1PllReadCap( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_API_GET_CAPACITY_PINS f_pGetCapacityPins ); - -UINT32 Oct6100ApiInitToneInfo( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiClearInterrupts( - IN tPOCT6100_INSTANCE_API f_pApiInstance ); -#endif /* __OCT6100_CHIP_OPEN_PRIV_H__ */ diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_chip_stats_priv.h b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_chip_stats_priv.h deleted file mode 100644 index 6c36163..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_chip_stats_priv.h +++ /dev/null @@ -1,55 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_chip_stats_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_chip_stats.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_chip_stats_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 8 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_CHIP_STATS_PRIV_H__ -#define __OCT6100_CHIP_STATS_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiChipStatsSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ChipGetStatsSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT tPOCT6100_CHIP_STATS f_pChipStats ); - -#endif /* __OCT6100_CHIP_STATS_PRIV_H__ */ diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_conf_bridge_priv.h b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_conf_bridge_priv.h deleted file mode 100644 index 071e645..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_conf_bridge_priv.h +++ /dev/null @@ -1,318 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_conf_bridge_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_conf_bridge.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_conf_bridge_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 30 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_CONF_BRIDGE_PRIV_H__ -#define __OCT6100_CONF_BRIDGE_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - -#define mOCT6100_GET_CONF_BRIDGE_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_CONF_BRIDGE )(( PUINT8 )pSharedInfo + pSharedInfo->ulConfBridgeListOfst); - -#define mOCT6100_GET_CONF_BRIDGE_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_CONF_BRIDGE )(( PUINT8 )pSharedInfo + pSharedInfo->ulConfBridgeListOfst)) + ulIndex; - -#define mOCT6100_GET_CONF_BRIDGE_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulConfBridgeAllocOfst); - -#define mOCT6100_GET_FLEX_CONF_PARTICIPANT_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_FLEX_CONF_PARTICIPANT )(( PUINT8 )pSharedInfo + pSharedInfo->ulFlexConfParticipantListOfst); - -#define mOCT6100_GET_FLEX_CONF_PARTICIPANT_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_FLEX_CONF_PARTICIPANT )(( PUINT8 )pSharedInfo + pSharedInfo->ulFlexConfParticipantListOfst)) + ulIndex; - -#define mOCT6100_GET_FLEX_CONF_PARTICIPANT_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulFlexConfParticipantAllocOfst); - - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetConfBridgeSwSizes( - IN OUT tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100ApiConfBridgeSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst ); - -UINT32 Oct6100ConfBridgeOpenSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN OUT tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen ); - -UINT32 Oct6100ApiCheckBridgeParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN OUT tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen ); - -UINT32 Oct6100ApiReserveBridgeResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - OUT PUINT16 f_pusBridgeIndex ); - -UINT32 Oct6100ApiUpdateBridgeEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_OPEN f_pConfBridgeOpen, - IN UINT16 f_usBridgeIndex ); - -UINT32 Oct6100ConfBridgeCloseSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CLOSE f_pConfBridgeClose ); - -UINT32 Oct6100ApiAssertBridgeParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CLOSE f_pConfBridgeClose, - OUT PUINT16 f_pusBridgeIndex ); - -UINT32 Oct6100ApiReleaseBridgeResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usBridgeIndex ); - -UINT32 Oct6100ConfBridgeChanAddSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CHAN_ADD f_pConfBridgeAdd ); - -UINT32 Oct6100ApiCheckBridgeAddParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CHAN_ADD f_pConfBridgeAdd, - OUT PUINT16 f_pusBridgeIndex, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT8 f_pfMute, - OUT PUINT32 f_pulInputPort, - OUT PUINT8 f_pfFlexibleConfBridge, - OUT PUINT32 f_pulListenerMaskIndex, - OUT PUINT32 f_pulListenerMask, - OUT PUINT8 f_pfTap, - OUT PUINT16 f_pusTapChannelIndex ); - -UINT32 Oct6100ApiReserveBridgeAddResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChanIndex, - IN UINT32 f_ulInputPort, - IN UINT8 f_fFlexibleConfBridge, - IN UINT32 f_ulListenerMaskIndex, - IN UINT32 f_ulListenerMask, - IN UINT8 f_fTap, - OUT PUINT16 f_pusLoadEventIndex, - OUT PUINT16 f_pusSubStoreEventIndex, - OUT PUINT16 f_pusCopyEventIndex, - OUT PUINT16 f_pusTapBridgeIndex ); - -UINT32 Oct6100ApiBridgeEventAdd( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChannelIndex, - IN UINT8 f_fFlexibleConfBridge, - IN UINT16 f_usLoadEventIndex, - IN UINT16 f_usSubStoreEventIndex, - IN UINT16 f_usCopyEventIndex, - IN UINT32 f_ulInputPort, - IN UINT8 f_fMute, - IN UINT32 f_ulListenerMaskIndex, - IN UINT32 f_ulListenerMask, - IN UINT8 f_fTap, - IN UINT16 f_usTapBridgeIndex, - IN UINT16 f_usTapChanIndex ); - -UINT32 Oct6100ApiBridgeAddParticipantToChannel( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usSourceChannelIndex, - IN UINT16 f_usDestinationChannelIndex, - IN UINT16 f_usLoadOrAccumulateEventIndex, - IN UINT16 f_usStoreEventIndex, - IN UINT16 f_usCopyEventIndex, - IN UINT32 f_ulSourceInputPort, - IN UINT32 f_ulDestinationInputPort ); - -UINT32 Oct6100ConfBridgeChanRemoveSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove ); - -UINT32 Oct6100ApiCheckChanRemoveParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove, - OUT PUINT16 f_pusBridgeIndex, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT8 f_pfFlexibleConfBridge, - OUT PUINT8 f_pfTap, - OUT PUINT16 f_pusLoadEventIndex, - OUT PUINT16 f_pusSubStoreEventIndex, - OUT PUINT16 f_pusCopyEventIndex ); - -UINT32 Oct6100ApiReleaseChanEventResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChanIndex, - IN UINT8 f_fFlexibleConfBridge, - IN UINT16 f_usLoadEventIndex, - IN UINT16 f_usSubStoreEventIndex, - IN UINT16 f_usCopyEventIndex ); - -UINT32 Oct6100ApiBridgeEventRemove ( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CHAN_REMOVE f_pConfBridgeRemove, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChannelIndex, - IN UINT8 f_fFlexibleConfBridge, - IN UINT16 f_usLoadEventIndex, - IN UINT16 f_usSubStoreEventIndex, - IN UINT16 f_usCopyEventIndex, - IN UINT8 f_fTap ); - -UINT32 Oct6100ApiBridgeRemoveParticipantFromChannel( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usSourceChannelIndex, - IN UINT16 f_usDestinationChannelIndex, - IN UINT8 f_fRemovePermanently ); - -UINT32 Oct6100ConfBridgeChanMuteSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute ); - -UINT32 Oct6100ApiUpdateBridgeMuteResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usChanIndex, - IN UINT16 f_usLoadEventIndex, - IN UINT16 f_usSubStoreEventIndex, - IN UINT8 f_fFlexibleConfBridge ); - -UINT32 Oct6100ApiCheckBridgeMuteParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CHAN_MUTE f_pConfBridgeMute, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT16 f_pusLoadEventIndex, - OUT PUINT16 f_pusSubStoreEventIndex, - OUT PUINT8 f_pfFlexibleConfBridge ); - -UINT32 Oct6100ConfBridgeChanUnMuteSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute ); - -UINT32 Oct6100ApiCheckBridgeUnMuteParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_CHAN_UNMUTE f_pConfBridgeUnMute, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT16 f_pusLoadEventIndex, - OUT PUINT16 f_pusSubStoreEventIndex, - OUT PUINT8 f_pfFlexibleConfBridge ); - -UINT32 Oct6100ApiUpdateBridgeUnMuteResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usChanIndex, - IN UINT16 f_usLoadEventIndex, - IN UINT16 f_usSubStoreEventIndex, - IN UINT8 f_fFlexibleConfBridge ); - -UINT32 Oct6100ConfBridgeDominantSpeakerSetSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker ); - -UINT32 Oct6100ApiCheckBridgeDominantSpeakerParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_DOMINANT_SPEAKER_SET f_pConfBridgeDominantSpeaker, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT16 f_pusBridgeIndex ); - -UINT32 Oct6100ApiUpdateBridgeDominantSpeakerResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usChanIndex, - IN UINT16 f_usBridgeIndex ); - -UINT32 Oct6100ConfBridgeMaskChangeSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange ); - -UINT32 Oct6100ApiCheckBridgeMaskChangeParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN tPOCT6100_CONF_BRIDGE_MASK_CHANGE f_pConfBridgeMaskChange, - OUT PUINT16 f_pusChannelIndex, - OUT PUINT16 f_pusBridgeIndex, - OUT PUINT32 f_pulNewParticipantMask ); - -UINT32 Oct6100ApiUpdateMaskModifyResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChanIndex, - IN UINT32 f_ulNewListenerMask ); - -UINT32 Oct6100ApiBridgeUpdateMask( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usChanIndex, - IN UINT32 f_ulNewListenerMask ); - -UINT32 Oct6100ConfBridgeGetStatsSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN OUT tPOCT6100_CONF_BRIDGE_STATS f_pConfBridgeStats ); - -UINT32 Oct6100ApiReserveBridgeEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - OUT PUINT16 f_pusConfBridgeIndex ); - -UINT32 Oct6100ApiReleaseBridgeEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usConfBridgeIndex ); - -UINT32 Oct6100ApiGetPrevLastSubStoreEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usBridgeIndex, - IN UINT16 f_usBridgeFirstLoadEventPtr, - OUT PUINT16 f_pusLastSubStoreEventIndex ); - -UINT32 Oct6100ApiGetPreviousEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usStartIndex, - IN UINT16 f_usSearchedIndex, - IN UINT16 f_usLoopCnt, - OUT PUINT16 f_pusPreviousIndex ); - -UINT32 Oct6100ApiBridgeSetDominantSpeaker( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usChannelIndex, - IN UINT16 f_usDominantSpeakerIndex ); - -UINT32 Oct6100ApiReserveFlexConfParticipantEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - OUT PUINT16 f_pusParticipantIndex ); - -UINT32 Oct6100ApiReleaseFlexConfParticipantEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInst, - IN UINT16 f_usParticipantIndex ); - -#endif /* __OCT6100_CONF_BRIDGE_PRIV_H__ */ diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_debug_priv.h b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_debug_priv.h deleted file mode 100644 index 44a9a21..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_debug_priv.h +++ /dev/null @@ -1,58 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_debug_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_debug.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_debug_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 12 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_DEBUG_PRIV_H__ -#define __OCT6100_DEBUG_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - - -UINT32 Oct6100DebugSelectChannelSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_DEBUG_SELECT_CHANNEL f_pSelectDebugChan, - IN BOOL f_fCheckChannelRecording ); - -UINT32 Oct6100DebugGetDataSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_DEBUG_GET_DATA f_pGetData ); - -#endif /* __OCT6100_DEBUG_PRIV_H__ */ diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_events_priv.h b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_events_priv.h deleted file mode 100644 index fd3980a..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_events_priv.h +++ /dev/null @@ -1,82 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_events_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_events.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_events_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 14 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_EVENTS_PRIV_H__ -#define __OCT6100_EVENTS_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - -#define mOCT6100_GET_TONE_EVENT_BUF_PNT( pSharedInfo, pSoftBuf ) \ - pSoftBuf = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->SoftBufs.ulToneEventBufferMemOfst ); - -#define mOCT6100_GET_BUFFER_PLAYOUT_EVENT_BUF_PNT( pSharedInfo, pSoftBuf ) \ - pSoftBuf = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->SoftBufs.ulBufPlayoutEventBufferMemOfst ); - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetEventsSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100EventGetToneSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_EVENT_GET_TONE f_pEventGetTone ); - -UINT32 Oct6100ApiTransferToneEvents( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulResetBuf ); - - - -UINT32 Oct6100BufferPlayoutGetEventSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_GET_EVENT f_pBufPlayoutGetEvent ); - -UINT32 Oct6100BufferPlayoutTransferEvents( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulResetBuf ); - -UINT32 Oct6100BufferPlayoutCheckForSpecificEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulChannelPort, - IN BOOL f_fSaveToSoftBuffer, - OUT PBOOL f_pfEventDetected ); - -#endif /* __OCT6100_EVENTS_PRIV_H__ */ diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_interrupts_priv.h b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_interrupts_priv.h deleted file mode 100644 index d29f1b0..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_interrupts_priv.h +++ /dev/null @@ -1,158 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_interrupts_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_interrupts.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_interrupts_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 11 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_INTERRUPTS_PRIV_H__ -#define __OCT6100_INTERRUPTS_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - -#define mOCT6100_GET_INTRPT_ENABLE_TIME( \ - ulRegMclkTimeHigh, \ - ulRegMclkTimeLow, \ - ulIntrptState, \ - ulIntrptEnableMclkHigh, \ - ulIntrptEnableMclkLow, \ - ulIntrptTimeoutMclk, \ - ulTimeDiff ) \ - if ( ulIntrptState == cOCT6100_INTRPT_WILL_TIMEOUT ) \ - { \ - ulIntrptEnableMclkLow = ulRegMclkTimeLow + ulIntrptTimeoutMclk; \ - if ( ulIntrptEnableMclkLow < ulRegMclkTimeLow ) \ - ulIntrptEnableMclkHigh = (ulRegMclkTimeHigh + 1) & 0xFF; \ - else \ - ulIntrptEnableMclkHigh = ulRegMclkTimeHigh; \ - \ - ulIntrptState = cOCT6100_INTRPT_IN_TIMEOUT; \ - } \ - \ - if ( ulIntrptEnableMclkLow < ulRegMclkTimeLow ) \ - { \ - ulTimeDiff = (cOCT6100_FFFFFFFF - ulRegMclkTimeLow - 1) + ulIntrptEnableMclkLow; \ - } \ - else \ - { \ - ulTimeDiff = ulIntrptEnableMclkLow - ulRegMclkTimeLow; \ - } - -#define mOCT6100_CHECK_INTRPT_TIMEOUT( \ - ulRegMclkTimePlus5MsHigh, \ - ulRegMclkTimePlus5MsLow, \ - ulIntrptDisableMclkHigh, \ - ulIntrptDisableMclkLow, \ - ulIntrptEnableMclkHigh, \ - ulIntrptEnableMclkLow, \ - ulIntrptState, \ - fIntrptChange ) \ - /* Branch depending on whether the disable time is lesser or greater than the timeout time. */ \ - if ( ulIntrptDisableMclkLow < ulIntrptEnableMclkLow ) \ - { \ - /* Disable period is over if mclk is greater than timeout time or less than disabled time. */ \ - if ( ulRegMclkTimePlus5MsLow > ulIntrptEnableMclkLow || \ - ulRegMclkTimePlus5MsLow < ulIntrptDisableMclkLow || \ - ulRegMclkTimePlus5MsHigh != ulIntrptEnableMclkHigh ) \ - { \ - fIntrptChange = TRUE; \ - ulIntrptState = cOCT6100_INTRPT_ACTIVE; \ - } \ - } \ - else \ - { \ - /* Disable period is over if mclk is lesser than disable time and greater than timeout. */ \ - if ( (ulRegMclkTimePlus5MsLow > ulIntrptEnableMclkLow && ulRegMclkTimePlus5MsLow < ulIntrptDisableMclkLow) || \ - (ulRegMclkTimePlus5MsHigh != ulIntrptDisableMclkHigh && ulRegMclkTimePlus5MsHigh != ulIntrptEnableMclkHigh) ) \ - { \ - fIntrptChange = TRUE; \ - ulIntrptState = cOCT6100_INTRPT_ACTIVE; \ - } \ - } - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiIsrSwInit( - IN tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiIsrHwInit( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_INTERRUPT_CONFIGURE f_pIntrptConfig ); - -UINT32 Oct6100InterruptConfigureSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_INTERRUPT_CONFIGURE f_pIntrptConfig, - IN BOOL f_fCheckParams ); - -UINT32 Oct6100ApiClearEnabledInterrupts( - IN tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100InterruptServiceRoutineSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - OUT tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ); - -UINT32 Oct6100ApiWriteIeRegs( - IN tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiReadIntrptRegs( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - OUT tPOCT6100_INTERRUPT_FLAGS f_pIntFlags, - IN UINT32 f_ulRegister210h ); - -UINT32 Oct6100ApiUpdateIntrptStates( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - OUT tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ); - -UINT32 Oct6100ApiWriteIntrptRegs( - IN tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiReadChipMclkTime( - IN tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiUpdateIntrptTimeouts( - IN tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiScheduleNextMclkIntrpt( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulIntrptToSet ); - -UINT32 Oct6100ApiScheduleNextMclkIntrptSer( - IN tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiCheckProcessorState( - IN tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_INTERRUPT_FLAGS f_pIntFlags ); - -#endif /* __OCT6100_INTERRUPTS_PRIV_H__ */ diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_memory_priv.h b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_memory_priv.h deleted file mode 100644 index 77eed5e..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_memory_priv.h +++ /dev/null @@ -1,97 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_memory_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_memory.c. All elements defined in this - file are for private usage of the API. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 17 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_MEMORY_PRIV_H__ -#define __OCT6100_MEMORY_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - -/* TSI allocation pointer macros. */ -#define mOCT6100_GET_TSI_MEMORY_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulTsiMemoryAllocOfst ); - -/* Conversion memory allocation pointer macros. */ -#define mOCT6100_GET_CONVERSION_MEMORY_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulConversionMemoryAllocOfst ); - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetMemorySwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100ApiMemorySwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiBufferPlayoutMemorySwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiReserveBufferPlayoutMemoryNode( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT32 f_pulNewNode ); - -UINT32 Oct6100ApiReleaseBufferPlayoutMemoryNode( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulOldNode ); - -UINT32 Oct6100ApiReserveBufferPlayoutMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulSize, - OUT PUINT32 f_pulMallocAddress ); - -UINT32 Oct6100ApiReleaseBufferPlayoutMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulMallocAddress ); - -UINT32 Oct6100ApiReserveTsiMemEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusTsiMemIndex ); - -UINT32 Oct6100ApiReleaseTsiMemEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsiMemIndex ); - -UINT32 Oct6100ApiReserveConversionMemEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusConversionMemIndex ); - -UINT32 Oct6100ApiReleaseConversionMemEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usConversionMemIndex ); - -#endif /* __OCT6100_MEMORY_PRIV_H__ */ diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h deleted file mode 100644 index c0381f4..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h +++ /dev/null @@ -1,279 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_miscellaneous_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_miscellaneous.c. All elements defined in - this file are for private usage of the API. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 20 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_MISCELLANEOUS_PRIV_H__ -#define __OCT6100_MISCELLANEOUS_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/*---------------------------------------------------------------------------*\ - Macros used to shell the user function calls. These macros are used to - assert that the user does not change any of the members of the function's - parameter structure, as required and indicated in the API specification. - Ofcourse, these macros make the code heavier and thus slower. That is why - there is a compile option for disabling the extra checking. These can be - very helpful tools in debugging. -\*---------------------------------------------------------------------------*/ - -#ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK -#define mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) \ -{ \ - PVOID _pProcessContext; \ - UINT32 _ulUserChipId; \ - UINT32 _ulWriteAddress; \ - UINT16 _usWriteData; \ - \ - /* Store the data that is to be passed to the user. */ \ - _pProcessContext = WriteParams.pProcessContext; \ - _ulUserChipId = WriteParams.ulUserChipId; \ - _ulWriteAddress = WriteParams.ulWriteAddress; \ - _usWriteData = WriteParams.usWriteData; \ - \ - /* Call user function. */ \ - ulResult = Oct6100UserDriverWriteApi( &WriteParams ); \ - \ - /* Check if user changed members of function's parameter structure. */ \ - if ( WriteParams.pProcessContext != _pProcessContext || \ - WriteParams.ulUserChipId != _ulUserChipId || \ - WriteParams.ulWriteAddress != _ulWriteAddress || \ - WriteParams.ulWriteAddress != _ulWriteAddress || \ - WriteParams.usWriteData != _usWriteData ) \ - ulResult = cOCT6100_ERR_FATAL_DRIVER_WRITE_API; \ -} -#else -#define mOCT6100_DRIVER_WRITE_API( WriteParams, ulResult ) \ - ulResult = Oct6100UserDriverWriteApi( &WriteParams ); -#endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */ - - -#ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK -#define mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ) \ -{ \ - PVOID _pProcessContext; \ - UINT32 _ulUserChipId; \ - UINT32 _ulWriteAddress; \ - UINT16 _usWriteData; \ - UINT32 _ulWriteLength; \ - \ - /* Store the data that is to be passed to the user. */ \ - _pProcessContext = SmearParams.pProcessContext; \ - _ulUserChipId = SmearParams.ulUserChipId; \ - _ulWriteAddress = SmearParams.ulWriteAddress; \ - _usWriteData = SmearParams.usWriteData; \ - _ulWriteLength = SmearParams.ulWriteLength; \ - \ - /* Call user function. */ \ - ulResult = Oct6100UserDriverWriteSmearApi( &SmearParams ); \ - \ - /* Check if user changed members of function's paraeter structure. */ \ - if ( SmearParams.pProcessContext != _pProcessContext || \ - SmearParams.ulUserChipId != _ulUserChipId || \ - SmearParams.usWriteData != _usWriteData || \ - SmearParams.ulWriteLength != _ulWriteLength) \ - ulResult = cOCT6100_ERR_FATAL_DRIVER_WRITE_SMEAR_API; \ -} -#else -#define mOCT6100_DRIVER_WRITE_SMEAR_API( SmearParams, ulResult ) \ - ulResult = Oct6100UserDriverWriteSmearApi( &SmearParams ); -#endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */ - - -#ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK -#define mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ) \ -{ \ - PVOID _pProcessContext; \ - UINT32 _ulUserChipId; \ - UINT32 _ulWriteAddress; \ - PUINT16 _pusWriteData; \ - UINT32 _ulWriteLength; \ - \ - /* Store the data that is to be passed to the user. */ \ - _pProcessContext = BurstParams.pProcessContext; \ - _ulUserChipId = BurstParams.ulUserChipId; \ - _ulWriteAddress = BurstParams.ulWriteAddress; \ - _pusWriteData = BurstParams.pusWriteData; \ - _ulWriteLength = BurstParams.ulWriteLength; \ - \ - /* Call user function. */ \ - ulResult = Oct6100UserDriverWriteBurstApi( &BurstParams ); \ - \ - /* Check if user changed members of function's parameter structure. */ \ - if ( BurstParams.pProcessContext != _pProcessContext || \ - BurstParams.ulUserChipId != _ulUserChipId || \ - BurstParams.ulWriteAddress != _ulWriteAddress || \ - BurstParams.pusWriteData != _pusWriteData || \ - BurstParams.ulWriteLength != _ulWriteLength ) \ - ulResult = cOCT6100_ERR_FATAL_DRIVER_WRITE_BURST_API; \ -} -#else -#define mOCT6100_DRIVER_WRITE_BURST_API( BurstParams, ulResult ) \ - ulResult = Oct6100UserDriverWriteBurstApi( &BurstParams ); -#endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */ - - -#ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK -#define mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) \ -{ \ - PVOID _pProcessContext; \ - UINT32 _ulUserChipId; \ - UINT32 _ulReadAddress; \ - PUINT16 _pusReadData; \ - \ - /* Store the data that is to be passed to the user. */ \ - _pProcessContext = ReadParams.pProcessContext; \ - _ulUserChipId = ReadParams.ulUserChipId; \ - _ulReadAddress = ReadParams.ulReadAddress; \ - _pusReadData = ReadParams.pusReadData; \ - \ - /* Call user function. */ \ - ulResult = Oct6100UserDriverReadApi( &ReadParams ); \ - \ - /* Check if user changed members of function's parameter structure. */ \ - if ( ReadParams.pProcessContext != _pProcessContext || \ - ReadParams.ulUserChipId != _ulUserChipId || \ - ReadParams.ulReadAddress != _ulReadAddress || \ - ReadParams.pusReadData != _pusReadData ) \ - ulResult = cOCT6100_ERR_FATAL_DRIVER_READ_API; \ -} -#else -#define mOCT6100_DRIVER_READ_API( ReadParams, ulResult ) \ - ulResult = Oct6100UserDriverReadApi( &ReadParams ); -#endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */ - - -#ifndef cOCT6100_REMOVE_USER_FUNCTION_CHECK -#define mOCT6100_DRIVER_READ_BURST_API( BurstParams, ulResult ) \ -{ \ - PVOID _pProcessContext; \ - UINT32 _ulUserChipId; \ - UINT32 _ulReadAddress; \ - PUINT16 _pusReadData; \ - UINT32 _ulReadLength; \ - \ - /* Store the data that is to be passed to the user. */ \ - _pProcessContext = BurstParams.pProcessContext; \ - _ulUserChipId = BurstParams.ulUserChipId; \ - _ulReadAddress = BurstParams.ulReadAddress; \ - _pusReadData = BurstParams.pusReadData; \ - _ulReadLength = BurstParams.ulReadLength; \ - \ - /* Call user function. */ \ - ulResult = Oct6100UserDriverReadBurstApi( &BurstParams ); \ - \ - /* Check if user changed members of function's parameter structure. */ \ - if ( BurstParams.pProcessContext != _pProcessContext || \ - BurstParams.ulUserChipId != _ulUserChipId || \ - BurstParams.ulReadAddress != _ulReadAddress || \ - BurstParams.pusReadData != _pusReadData || \ - BurstParams.ulReadLength != _ulReadLength ) \ - ulResult = cOCT6100_ERR_FATAL_DRIVER_READ_BURST_API; \ -} -#else -#define mOCT6100_DRIVER_READ_BURST_API( BurstParams, ulResult ) \ - ulResult = Oct6100UserDriverReadBurstApi( &BurstParams ); -#endif /* cOCT6100_REMOVE_USER_FUNCTION_CHECK */ - -#define mOCT6100_ASSIGN_USER_READ_WRITE_OBJ( f_pApiInst, Params ) - -#define mOCT6100_CREATE_FEATURE_MASK( f_ulFieldSize, f_ulFieldBitOffset, f_pulFieldMask ) \ -{ \ - (*f_pulFieldMask) = ( 1 << f_ulFieldSize ); \ - (*f_pulFieldMask) --; \ - (*f_pulFieldMask) <<= f_ulFieldBitOffset; \ -} - - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiWaitForTime( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_aulWaitTime[ 2 ] ); - -UINT32 Oct6100ApiWaitForPcRegisterBit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulPcRegAdd, - IN UINT32 f_ulPcBitNum, - IN UINT32 f_ulValue, - IN UINT32 f_ulTimeoutUs, - OUT PBOOL f_pfBitEqual ); - -UINT32 Oct6100ApiWriteDword( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulAddress, - IN UINT32 f_ulWriteData ); - -UINT32 Oct6100ApiReadDword( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulAddress, - OUT PUINT32 f_pulReadData ); - -VOID Oct6100ApiCreateFeatureMask( - IN UINT32 f_ulFieldSize, - IN UINT32 f_ulFieldBitOffset, - OUT PUINT32 f_pulFieldMask ); - -unsigned char const *Oct6100ApiStrStr( - IN unsigned char const *f_pszSource, - IN unsigned char const *f_pszString, - IN unsigned char const *f_pszLastCharPtr ); - -UINT32 Oct6100ApiStrLen( - IN unsigned char const *f_pszString ); - -UINT32 Oct6100ApiAsciiToHex( - IN UINT8 f_chCharacter, - IN PUINT32 f_pulValue ); - -UINT8 Oct6100ApiHexToAscii( - IN UINT32 f_ulNumber ); - -UINT32 Oct6100ApiRand( - IN UINT32 f_ulRange ); - -UINT32 oct6100_retrieve_nlp_conf_dword(tPOCT6100_INSTANCE_API f_pApiInst, - tPOCT6100_API_CHANNEL f_pChanEntry, - UINT32 f_ulAddress, - UINT32 *f_pulConfigDword); - -UINT32 oct6100_save_nlp_conf_dword(tPOCT6100_INSTANCE_API f_pApiInst, - tPOCT6100_API_CHANNEL f_pChanEntry, - UINT32 f_ulAddress, - UINT32 f_ulConfigDword); - -#endif /* __OCT6100_MISCELLANEOUS_PRIV_H__ */ diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_mixer_priv.h b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_mixer_priv.h deleted file mode 100644 index b6a7a34..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_mixer_priv.h +++ /dev/null @@ -1,150 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_mixer_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_mixer.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_mixer_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 18 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_MIXER_PRIV_H__ -#define __OCT6100_MIXER_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - -/***************************** DEFINES *************************************/ - -#define mOCT6100_GET_MIXER_EVENT_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_MIXER_EVENT )(( PUINT8 )pSharedInfo + pSharedInfo->ulMixerEventListOfst); - -#define mOCT6100_GET_MIXER_EVENT_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_MIXER_EVENT )(( PUINT8 )pSharedInfo + pSharedInfo->ulMixerEventListOfst)) + ulIndex; - -#define mOCT6100_GET_MIXER_EVENT_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulMixerEventAllocOfst); - -#define mOCT6100_GET_COPY_EVENT_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_COPY_EVENT )(( PUINT8 )pSharedInfo + pSharedInfo->ulCopyEventListOfst); - -#define mOCT6100_GET_COPY_EVENT_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_COPY_EVENT )(( PUINT8 )pSharedInfo + pSharedInfo->ulCopyEventListOfst)) + ulIndex; - -#define mOCT6100_GET_COPY_EVENT_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulCopyEventAllocOfst); - -/***************************** TYPES ***************************************/ - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetMixerSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100ApiMixerSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiMixerEventAdd( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEventIndex, - IN UINT16 f_usEventType, - IN UINT16 f_usDestinationChanIndex ); - -UINT32 Oct6100ApiMixerEventRemove( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEventIndex, - IN UINT16 f_usEventType ); - -UINT32 Oct6100MixerCopyEventCreateSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate ); - -UINT32 Oct6100ApiCheckCopyEventCreateParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate, - OUT PUINT16 f_pusSourceChanIndex, - OUT PUINT16 f_pusDestinationChanIndex ); - -UINT32 Oct6100ApiReserveCopyEventCreateResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusCopyEntryIndex, - IN OUT PUINT16 f_pusCopyEventIndex ); - -UINT32 Oct6100ApiWriteCopyEventCreateStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate, - IN UINT16 f_usMixerEventIndex, - IN UINT16 f_usSourceChanIndex, - IN UINT16 f_usDestinationChanIndex ); - -UINT32 Oct6100ApiUpdateCopyEventCreateEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_COPY_EVENT_CREATE f_pCopyEventCreate, - IN UINT16 f_usCopyEventIndex, - IN UINT16 f_usMixerEventIndex, - IN UINT16 f_usSourceChanIndex, - IN UINT16 f_usDestinationChanIndex ); - -UINT32 Oct6100MixerCopyEventDestroySer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy ); - -UINT32 Oct6100ApiAssertCopyEventDestroyParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_COPY_EVENT_DESTROY f_pCopyEventDestroy, - IN OUT PUINT16 f_pusCopyEventIndex, - IN OUT PUINT16 f_pusMixerEventIndex ); - -UINT32 Oct6100ApiInvalidateCopyEventStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usCopyEventIndex, - IN UINT16 f_usMixerEventIndex ); - -UINT32 Oct6100ApiReleaseCopyEventResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usCopyEventIndex, - IN UINT16 f_usMixerEventIndex ); - -UINT32 Oct6100ApiReserveMixerEventEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusEventIndex ); - -UINT32 Oct6100ApiReleaseMixerEventEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEventIndex ); - -UINT32 Oct6100ApiGetFreeMixerEventCnt( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT32 f_pulFreeEventCnt ); - -UINT32 Oct6100ApiReserveCopyEventEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusEventIndex ); - -UINT32 Oct6100ApiReleaseCopyEventEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usEventIndex ); -#endif /* __OCT6100_MIXER_PRIV_H__ */ diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_phasing_tsst_priv.h b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_phasing_tsst_priv.h deleted file mode 100644 index e17ab8b..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_phasing_tsst_priv.h +++ /dev/null @@ -1,114 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_phasing_tsst_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_phasing_tsst.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_phasing_tsst_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 12 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_PHASING_TSST_PRIV_H__ -#define __OCT6100_PHASING_TSST_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - -/***************************** DEFINES *************************************/ - -#define mOCT6100_GET_PHASING_TSST_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_PHASING_TSST )(( PUINT8 )pSharedInfo + pSharedInfo->ulPhasingTsstListOfst); - -#define mOCT6100_GET_PHASING_TSST_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_PHASING_TSST )(( PUINT8 )pSharedInfo + pSharedInfo->ulPhasingTsstListOfst)) + ulIndex; - -#define mOCT6100_GET_PHASING_TSST_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulPhasingTsstAllocOfst); - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetPhasingTsstSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100ApiPhasingTsstSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100PhasingTsstOpenSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen ); - -UINT32 Oct6100ApiCheckPhasingParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen ); - -UINT32 Oct6100ApiReservePhasingResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen, - OUT PUINT16 f_pusPhasingIndex, - OUT PUINT16 f_pusTsstIndex ); - -UINT32 Oct6100ApiWritePhasingStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen, - IN UINT16 f_usPhasingIndex, - IN UINT16 f_usTsstIndex ); - -UINT32 Oct6100ApiUpdatePhasingEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_PHASING_TSST_OPEN f_pPhasingTsstOpen, - IN UINT16 f_usPhasingIndex, - IN UINT16 f_usTsstIndex ); - -UINT32 Oct6100PhasingTsstCloseSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose ); - -UINT32 Oct6100ApiAssertPhasingParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_PHASING_TSST_CLOSE f_pPhasingTsstClose, - OUT PUINT16 f_pusPhasingIndex, - OUT PUINT16 f_pusTsstIndex ); - -UINT32 Oct6100ApiInvalidatePhasingStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsstIndex ); - -UINT32 Oct6100ApiReleasePhasingResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT UINT16 f_usPhasingIndex ); - -UINT32 Oct6100ApiReservePhasingEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusPhasingIndex ); - -UINT32 Oct6100ApiReleasePhasingEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usPhasingIndex ); - -#endif /* #ifndef cOCT6100_REMOVE_PHASING_TSST */ diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_playout_buf_priv.h b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_playout_buf_priv.h deleted file mode 100644 index a69e942..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_playout_buf_priv.h +++ /dev/null @@ -1,201 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_playout_buf_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_playout_buf.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_playout_buf_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 22 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_PLAYOUT_BUF_PRIV_H__ -#define __OCT6100_PLAYOUT_BUF_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - -/***************************** DEFINES *************************************/ - -/* Playout buffer list pointer macros. */ -#define mOCT6100_GET_BUFFER_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_BUFFER )(( PUINT8 )pSharedInfo + pSharedInfo->ulPlayoutBufListOfst ); - -#define mOCT6100_GET_BUFFER_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_BUFFER )(( PUINT8 )pSharedInfo + pSharedInfo->ulPlayoutBufListOfst)) + ulIndex; - -#define mOCT6100_GET_BUFFER_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulPlayoutBufAllocOfst); - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetPlayoutBufferSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100ApiPlayoutBufferSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100BufferLoadSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_LOAD f_pBufferLoad, - IN BOOL f_fReserveListStruct, - IN UINT32 f_ulBufIndex ); - -UINT32 Oct6100BufferLoadBlockInitSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_LOAD_BLOCK_INIT f_pBufferLoadBlockInit ); - -UINT32 Oct6100BufferLoadBlockSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_LOAD_BLOCK f_pBufferLoadBlock ); - -UINT32 Oct6100ApiCheckBufferParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_LOAD f_pBufferLoad, - IN BOOL f_fCheckBufferPtr ); - -UINT32 Oct6100ApiCheckBufferLoadBlockParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_LOAD_BLOCK f_pBufferLoadBlock, - OUT PUINT32 f_pulBufferBase ); - -UINT32 Oct6100ApiReserveBufferResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_LOAD f_pBufferLoad, - IN BOOL f_fReserveListStruct, - IN UINT32 f_ulBufIndex, - OUT PUINT32 f_pulBufIndex, - OUT PUINT32 f_pulBufBase ); - -UINT32 Oct6100ApiWriteBufferInMemory( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulBufferBase, - IN UINT32 f_ulBufferLength, - IN PUINT8 f_pbyBuffer ); - -UINT32 Oct6100ApiUpdateBufferEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_LOAD f_pBufferLoad, - IN UINT32 f_ulBufIndex, - IN UINT32 f_ulBufBase ); - -UINT32 Oct6100BufferUnloadSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_UNLOAD f_pBufferUnload, - IN BOOL f_fReleaseListStruct ); - -UINT32 Oct6100ApiAssertBufferParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_UNLOAD f_pBufferUnload, - OUT PUINT32 f_pulBufIndex, - OUT PUINT32 f_pulBufBase ); - -UINT32 Oct6100ApiReleaseBufferResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulBufIndex, - IN UINT32 f_ulBufBase, - IN BOOL f_fReleaseListStruct ); - -UINT32 Oct6100BufferPlayoutAddSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_ADD f_pBufferPlayoutAdd ); - -UINT32 Oct6100ApiCheckPlayoutAddParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_ADD f_pBufferPlayoutAdd, - OUT PUINT32 f_pulChannelIndex, - OUT PUINT32 f_pulBufferIndex ); - -UINT32 Oct6100ApiWriteBufferAddStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_ADD f_pBufferPlayoutAdd, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulBufferIndex ); - -UINT32 Oct6100BufferPlayoutStartSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart, - IN UINT32 f_ulPlayoutStopEventType ); - -UINT32 Oct6100ApiCheckPlayoutStartParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart, - OUT PUINT32 f_pulChannelIndex, - OUT PUINT32 f_pulBufferIndex, - OUT PBOOL f_pfNotifyOnPlayoutStop, - OUT PUINT32 f_pulUserEventId, - OUT PBOOL f_pfAllowStartIfActive ); - -UINT32 Oct6100ApiWriteChanPlayoutStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulBufferIndex, - IN BOOL f_fNotifyOnPlayoutStop, - IN UINT32 f_ulUserEventId, - IN BOOL f_fAllowStartIfActive, - IN UINT32 f_ulPlayoutStopEventType ); - -UINT32 Oct6100ApiUpdateChanPlayoutEntry ( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_START f_pBufferPlayoutStart, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulBufferIndex ); - -UINT32 Oct6100BufferPlayoutStopSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop ); - -UINT32 Oct6100ApiAssertPlayoutStopParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop, - OUT PUINT32 f_pulChannelIndex, - OUT PUINT16 f_pusEchoMemIndex ); - -UINT32 Oct6100ApiInvalidateChanPlayoutStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop, - IN UINT32 f_ulChannelIndex, - IN UINT16 f_usEchoMemIndex - - ); - -UINT32 Oct6100ApiReleaseChanPlayoutResources ( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_BUFFER_PLAYOUT_STOP f_pBufferPlayoutStop, - IN UINT32 f_ulChannelIndex ); - -UINT32 Oct6100ApiReserveBufPlayoutListEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT32 f_pulBufIndex ); - -UINT32 Oct6100ApiReleaseBufPlayoutListEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulBufIndex ); - -#endif /* __OCT6100_PLAYOUT_BUF_PRIV_H__ */ diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_remote_debug_priv.h b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_remote_debug_priv.h deleted file mode 100644 index c599ee9..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_remote_debug_priv.h +++ /dev/null @@ -1,144 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_remote_debug_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_remote_debug.c. All elements defined in this - file are for private usage of the API. All public elements are defined - in the oct6100_remote_debug_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 13 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_REMOTE_DEBUG_PRIV_H__ -#define __OCT6100_REMOTE_DEBUG_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - -#define mOCT6100_GET_REMOTE_DEBUG_LIST_ENTRY_PNT( pSharedInfo, ulIndex, pEntry ) \ - pEntry = ( tPOCT6100_API_REMOTE_DEBUG_SESSION )(( PUINT8 )pSharedInfo + pSharedInfo->RemoteDebugInfo.ulSessionListOfst) + ulIndex; - -#define mOCT6100_GET_REMOTE_DEBUG_TREE_PNT( pSharedInfo, pList ) \ - pList = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->RemoteDebugInfo.ulSessionTreeOfst); - -#define mOCT6100_GET_REMOTE_DEBUG_DATA_BUF_PNT( pSharedInfo, pulDataBuf ) \ - pulDataBuf = ( PUINT16 )(( PUINT8 )pSharedInfo + pSharedInfo->RemoteDebugInfo.ulDataBufOfst); - -#define mOCT6100_GET_REMOTE_DEBUG_SESSION_PKT_CACHE_PNT( pSharedInfo, pulPktCache, ulSessionIndex ) \ - pulPktCache = ( PUINT32 )(( PUINT8 )pSharedInfo + pSharedInfo->RemoteDebugInfo.ulPktCacheOfst) + (ulSessionIndex * (cOCTRPC_MAX_PACKET_BYTE_LENGTH / 4)); - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetRemoteDebugSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100ApiRemoteDebuggingSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiCheckEndianDetectField( - IN tPOCTRPC_OGRDTP_HEADER f_pOgrdtpHeader, - IN UINT32 f_ulPktLengthDword ); - -VOID Oct6100ApiCalculateChecksum( - IN PUINT32 f_pulPktPayload, - IN UINT32 f_ulPktLengthDword, - OUT PUINT32 f_pulChecksum ); - -VOID Oct6100ApiFormResponsePkt( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN PUINT32 f_pulRcvPktPayload, - IN OUT PUINT32 f_pulRspPktPayload, - IN UINT32 f_ulPktLengthDword, - IN BOOL f_fRetryPktResponse, - IN BOOL f_fReplaceProtocolNum, - IN BOOL f_fReplaceInterfaceType, - IN BOOL f_fReplaceInterfaceVersion, - IN UINT32 f_ulSessionIndex, - IN UINT32 f_ulParsingErrorValue, - IN UINT32 f_ulPayloadDwordIndex, - IN UINT32 f_ulChecksum ); - -UINT32 Oct6100ApiCheckPktCommands( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN PUINT32 f_pulRcvPktPayload, - IN OUT PUINT32 f_pulRspPktPayload, - IN UINT32 f_ulSessionIndex, - IN UINT32 f_ulPktLengthDword, - IN UINT32 f_ulChecksum ); - -VOID Oct6100ApiExecutePktCommands( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN PUINT32 f_pulRcvPktPayload, - IN UINT32 f_ulPktLengthDword ); - -UINT32 Oct6100ApiCheckSessionNum( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCTRPC_OGRDTP_HEADER f_pOgrdtpHeader, - OUT PUINT32 f_pulSessionIndex ); - -VOID Oct6100ApiRpcReadWord( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ); - -VOID Oct6100ApiRpcReadBurst( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ); - -VOID Oct6100ApiRpcReadArray( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ); - -VOID Oct6100ApiRpcWriteWord( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ); - -VOID Oct6100ApiRpcWriteSmear( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ); - -VOID Oct6100ApiRpcWriteBurst( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ); - -VOID Oct6100ApiRpcSetHotChannel( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ); - -VOID Oct6100ApiRpcGetDebugChanIndex( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader ); - -VOID Oct6100ApiRpcDisconnect( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCTRPC_COMMAND_HEADER f_pCmndHeader, - IN OUT UINT32 f_ulSessionNumber ); - -#endif /* __OCT6100_REMOTE_DEBUG_PRIV_H__ */ diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_tlv_priv.h b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_tlv_priv.h deleted file mode 100644 index e1982bd..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_tlv_priv.h +++ /dev/null @@ -1,515 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tlv_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_tlv.c. All elements defined in this - file are for private usage of the API. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 58 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_TLV_PRIV_H__ -#define __OCT6100_TLV_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - -/* List of TLV types supported by this API. */ -#define cOCT6100_TLV_TYPE_VERSION_NUMBER 0 -#define cOCT6100_TLV_TYPE_CUSTOMER_PROJECT_ID 2 - -#define cOCT6100_TLV_TYPE_POUCH_BASE_ADDRESS 3 -#define cOCT6100_TLV_TYPE_CH0_MAIN_BASE_ADDRESS 4 -#define cOCT6100_TLV_TYPE_CH_MAIN_SIZE 5 -#define cOCT6100_TLV_TYPE_CH_MAIN_IO_OFFSET 6 -#define cOCT6100_TLV_TYPE_CH_MAIN_ZCB_OFFSET 7 -#define cOCT6100_TLV_TYPE_CH_MAIN_ZCB_SIZE 8 -#define cOCT6100_TLV_TYPE_CH_MAIN_XCB_OFFSET 9 -#define cOCT6100_TLV_TYPE_CH_MAIN_XCB_SIZE 10 -#define cOCT6100_TLV_TYPE_CH_MAIN_YCB_OFFSET 11 -#define cOCT6100_TLV_TYPE_CH_MAIN_YCB_SIZE 12 -#define cOCT6100_TLV_TYPE_FREE_MEM_BASE_ADDRESS 13 -#define cOCT6100_TLV_TYPE_CH_ROOT_CONF_OFFSET 14 - -#define cOCT6100_TLV_TYPE_POA_CH_MAIN_ZPO_OFFSET 15 -#define cOCT6100_TLV_TYPE_POA_CH_MAIN_ZPO_SIZE 16 -#define cOCT6100_TLV_TYPE_POA_CH_MAIN_YPO_OFFSET 17 -#define cOCT6100_TLV_TYPE_POA_CH_MAIN_YPO_SIZE 18 -#define cOCT6100_TLV_TYPE_POA_BOFF_RW_ZWP 19 -#define cOCT6100_TLV_TYPE_POA_BOFF_RW_ZIS 20 -#define cOCT6100_TLV_TYPE_POA_BOFF_RW_ZSP 21 -#define cOCT6100_TLV_TYPE_POA_BOFF_RW_YWP 22 -#define cOCT6100_TLV_TYPE_POA_BOFF_RW_YIS 23 -#define cOCT6100_TLV_TYPE_POA_BOFF_RW_YSP 24 -#define cOCT6100_TLV_TYPE_POA_BOFF_RO_ZRP 25 -#define cOCT6100_TLV_TYPE_POA_BOFF_RO_YRP 26 - -#define cOCT6100_TLV_TYPE_CNR_CONF_BOFF_RW_ENABLE 27 -#define cOCT6100_TLV_TYPE_ANR_CONF_BOFF_RW_ENABLE 28 - -#define cOCT6100_TLV_TYPE_HZ_CONF_BOFF_RW_ENABLE 29 -#define cOCT6100_TLV_TYPE_HX_CONF_BOFF_RW_ENABLE 30 - -#define cOCT6100_TLV_TYPE_LCA_Z_CONF_BOFF_RW_GAIN 31 -#define cOCT6100_TLV_TYPE_LCA_Y_CONF_BOFF_RW_GAIN 32 - -#define cOCT6100_TLV_TYPE_CNA_CONF_BOFF_RW_ENABLE 33 - -#define cOCT6100_TLV_TYPE_NOA_CONF_BOFF_RW_ENABLE 34 - -#define cOCT6100_TLV_TYPE_VFA_CONF_BOFF_RW_ENABLE 35 - -#define cOCT6100_TLV_TYPE_TLA_MAIN_IO_BOFF_RW_TAIL_DISP 37 - -#define cOCT6100_TLV_TYPE_STATSA_MAIN_IO_BOFF_RO_EPC 38 -#define cOCT6100_TLV_TYPE_BOOTA_POUCH_BOFF_RW_BOOT_INST 39 -#define cOCT6100_TLV_TYPE_BOOTA_POUCH_BOFF_RW_BOOT_RESULT 40 - -#define cOCT6100_TLV_TYPE_DIS_CONF_BOFF_RW_ENABLE 41 -#define cOCT6100_TLV_TYPE_TDM_CONF_BOFF_RW_ENABLE 42 -#define cOCT6100_TLV_TYPE_NT_CONF_BOFF_RW_ENABLE 43 -#define cOCT6100_TLV_TYPE_AEC_CONF_BOFF_RW_ENABLE 44 - -#define cOCT6100_TLV_TYPE_PCM_LEAK_CONF_BOFF_RW 45 -#define cOCT6100_TLV_TYPE_DEFAULT_ERL_CONF_BOFF_RW 46 -#define cOCT6100_TLV_TYPE_TONE_REM_CONF_BOFF_RW_ENABLE 47 - -#define cOCT6100_TLV_TYPE_TLA_MAIN_IO_BOFF_RW_MAX_ECHO_POINT 48 - -#define cOCT6100_TLV_TYPE_NLP_CONV_CAP_CONF_BOFF_RW 49 -#define cOCT6100_TLV_TYPE_MATRIX_EVENT_SIZE 50 -#define cOCT6100_TLV_TYPE_CNR_RW_ENABLE 51 -#define cOCT6100_TLV_TYPE_MAX_TAIL_LENGTH_RW_ENABLE 52 - -#define cOCT6100_TLV_TYPE_PLAYOUT_ENABLE 53 -#define cOCT6100_TLV_TYPE_DOMINANT_SPEAKER_BOFF_RW_ENABLE 54 - -#define cOCT6100_TLV_TYPE_ANR_RW_ENABLE 57 -#define cOCT6100_TLV_TYPE_TONE_REMOVAL_ENABLE 58 -#define cOCT6100_TLV_TYPE_MUSIC_PROTECTION_RW_ENABLE 59 -#define cOCT6100_TLV_TYPE_TAIL_DISP_CONF_BOFF_RW_ENABLE 60 -#define cOCT6100_TLV_TYPE_IDLE_CODE_DETECTION_ENABLE 62 - -#define cOCT6100_TLV_TYPE_AEC_DEFAULT_ERL_BOFF 64 - -#define cOCT6100_TLV_TYPE_Z_ALC_TARGET_BOFF 65 -#define cOCT6100_TLV_TYPE_Y_ALC_TARGET_BOFF 66 -#define cOCT6100_TLV_TYPE_Z_HLC_TARGET_BOFF 67 -#define cOCT6100_TLV_TYPE_Y_HLC_TARGET_BOFF 68 -#define cOCT6100_TLV_TYPE_ALC_HLC_STATUS_BOFF 69 - -#define cOCT6100_TLV_TYPE_Z_PLAYOUT_HARD_SKIP_BOFF 70 -#define cOCT6100_TLV_TYPE_Y_PLAYOUT_HARD_SKIP_BOFF 71 - -#define cOCT6100_TLV_TYPE_AFT_FIELD_BOFF 72 - -#define cOCT6100_TLV_TYPE_VOICE_DETECTED_STAT_BOFF 73 - -#define cOCT6100_TLV_TYPE_GAIN_APPLIED_RIN_STAT_BOFF 74 -#define cOCT6100_TLV_TYPE_GAIN_APPLIED_SOUT_STAT_BOFF 75 - -#define cOCT6100_TLV_TYPE_MAX_ADAPT_ALE_BOFF 77 -#define cOCT6100_TLV_TYPE_RIN_ANR_BOFF 78 - -#define cOCT6100_TLV_TYPE_NUMBER_PLAYOUT_EVENTS 79 - -#define cOCT6100_TLV_TYPE_RIN_MUTE_BOFF 80 -#define cOCT6100_TLV_TYPE_SIN_MUTE_BOFF 81 - -#define cOCT6100_TLV_TYPE_CHAN_TAIL_LENGTH_BOFF 82 - -#define cOCT6100_TLV_TYPE_CHAN_VQE_TONE_DISABLING_BOFF 83 - -#define cOCT6100_TLV_TYPE_ANR_SNR_IMPROVEMENT_BOFF 84 -#define cOCT6100_TLV_TYPE_ANR_AGRESSIVITY_BOFF 85 - -#define cOCT6100_TLV_TYPE_RIN_TONE_REM_CONF_BOFF_RW_ENABLE 86 -#define cOCT6100_TLV_TYPE_RIN_TONE_REM_COUNTER_BOFF 87 - -#define cOCT6100_TLV_TYPE_AF_TAIL_DISP_VALUE_BOFF 88 - -#define cOCT6100_TLV_TYPE_POUCH_COUNTER_BOFF 89 - -#define cOCT6100_TLV_TYPE_AEC_TAIL_LENGTH_BOFF 90 - -#define cOCT6100_TLV_TYPE_MATRIX_DWORD_BASE 91 -#define cOCT6100_TLV_TYPE_DEBUG_CHAN_STATS_BYTE_SIZE 92 -#define cOCT6100_TLV_TYPE_RECORDED_PCM_EVENT_BYTE_SIZE 93 -#define cOCT6100_TLV_TYPE_HOT_CHANNEL_SELECT_DWORD_BASE 94 -#define cOCT6100_TLV_TYPE_IS_ISR_CALLED_BOFF 95 - -#define cOCT6100_TLV_TYPE_MATRIX_TIMESTAMP_DWORD_BASE 96 - -#define cOCT6100_TLV_TYPE_CHAN_MAIN_IO_STATS_OFFSET 100 -#define cOCT6100_TLV_TYPE_CHAN_MAIN_IO_STATS_SIZE 101 - -#define cOCT6100_TLV_TYPE_AF_WRITE_PTR_BYTE_OFFSET 104 -#define cOCT6100_TLV_TYPE_MATRIX_WP_DWORD_BASE 105 -#define cOCT6100_TLV_TYPE_DEBUG_CHAN_LITE_STATS_BYTE_SIZE 106 - -#define cOCT6100_TLV_TYPE_MUSIC_PROTECTION_ENABLE_BOFF 107 - -#define cOCT6100_TLV_TYPE_IMAGE_TYPE 108 -#define cOCT6100_TLV_TYPE_MAX_WIRELINE_CHANNELS 111 - -#define cOCT6100_TLV_TYPE_AF_EVENT_CB_SIZE 112 - -#define cOCT6100_TLV_TYPE_ZZ_ENERGY_CHAN_STATS_BOFF 116 -#define cOCT6100_TLV_TYPE_YY_ENERGY_CHAN_STATS_BOFF 117 - -#define cOCT6100_TLV_TYPE_BUFFER_PLAYOUT_SKIP_IN_EVENTS 119 - -#define cOCT6100_TLV_TYPE_SOUT_NOISE_BLEACHING 121 - -#define cOCT6100_TLV_TYPE_DOUBLE_TALK_BEH_MODE 124 -#define cOCT6100_TLV_TYPE_DOUBLE_TALK_BEH_MODE_BOFF 125 - -#define cOCT6100_TLV_TYPE_IDLE_CODE_DETECTION_BOFF 136 - -#define cOCT6100_TLV_TYPE_NLP_STATISTICS 138 - -#define cOCT6100_TLV_TYPE_RIN_ANR_VALUE 147 - -#define cOCT6100_TLV_TYPE_ADPCM_ENABLE 150 -#define cOCT6100_TLV_TYPE_NUM_TONE_DETECTOR 151 -#define cOCT6100_TLV_TYPE_CONFERENCING_ENABLE 152 -#define cOCT6100_TLV_TYPE_MAX_NUMBER_OF_CHANNELS 153 -#define cOCT6100_TLV_TYPE_DEBUG_CHAN_INDEX_VALUE 154 -#define cOCT6100_TLV_TYPE_TONE_DETECTOR_PROFILE 155 -#define cOCT6100_TLV_TYPE_TEST_MODE_ENABLE 156 -#define cOCT6100_TLV_TYPE_MAX_TAIL_DISPLACEMENT 157 - - -/* TLV length defines. */ -#define cOCT6100_TLV_MIN_LENGTH_DEFAULT 4 -#define cOCT6100_TLV_MAX_LENGTH_DEFAULT 0xFFFFFFFF - -#define cOCT6100_TLV_MIN_LENGTH_VERSION_NUMBER 4 -#define cOCT6100_TLV_MAX_LENGTH_VERSION_NUMBER 1016 -#define cOCT6100_TLV_MIN_LENGTH_CUSTOMER_PROJECT_ID 4 -#define cOCT6100_TLV_MAX_LENGTH_CUSTOMER_PROJECT_ID 4 - - -#define cOCT6100_TLV_MIN_LENGTH_CH0_MAIN_BASE_ADDRESS 4 -#define cOCT6100_TLV_MAX_LENGTH_CH0_MAIN_BASE_ADDRESS 4 -#define cOCT6100_TLV_MIN_LENGTH_CH_MAIN_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_CH_MAIN_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_CH_MAIN_IO_OFFSET 4 -#define cOCT6100_TLV_MAX_LENGTH_CH_MAIN_IO_OFFSET 4 -#define cOCT6100_TLV_MIN_LENGTH_CH_MAIN_ZCB_OFFSET 4 -#define cOCT6100_TLV_MAX_LENGTH_CH_MAIN_ZCB_OFFSET 4 -#define cOCT6100_TLV_MIN_LENGTH_CH_MAIN_ZCB_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_CH_MAIN_ZCB_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_CH_MAIN_XCB_OFFSET 4 -#define cOCT6100_TLV_MAX_LENGTH_CH_MAIN_XCB_OFFSET 4 -#define cOCT6100_TLV_MIN_LENGTH_CH_MAIN_XCB_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_CH_MAIN_XCB_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_CH_MAIN_YCB_OFFSET 4 -#define cOCT6100_TLV_MAX_LENGTH_CH_MAIN_YCB_OFFSET 4 -#define cOCT6100_TLV_MIN_LENGTH_CH_MAIN_YCB_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_CH_MAIN_YCB_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_FREE_MEM_BASE_ADDRESS 4 -#define cOCT6100_TLV_MAX_LENGTH_FREE_MEM_BASE_ADDRESS 4 -#define cOCT6100_TLV_MIN_LENGTH_CH_ROOT_CONF_OFFSET 4 -#define cOCT6100_TLV_MAX_LENGTH_CH_ROOT_CONF_OFFSET 4 - -#define cOCT6100_TLV_MIN_LENGTH_POA_CH_MAIN_ZPO_OFFSET 4 -#define cOCT6100_TLV_MAX_LENGTH_POA_CH_MAIN_ZPO_OFFSET 4 -#define cOCT6100_TLV_MIN_LENGTH_POA_CH_MAIN_ZPO_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_POA_CH_MAIN_ZPO_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_POA_CH_MAIN_YPO_OFFSET 4 -#define cOCT6100_TLV_MAX_LENGTH_POA_CH_MAIN_YPO_OFFSET 4 -#define cOCT6100_TLV_MIN_LENGTH_POA_CH_MAIN_YPO_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_POA_CH_MAIN_YPO_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_ZWP 8 -#define cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_ZWP 8 -#define cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_ZIS 8 -#define cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_ZIS 8 -#define cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_ZSP 8 -#define cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_ZSP 8 -#define cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_YWP 8 -#define cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_YWP 8 -#define cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_YIS 8 -#define cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_YIS 8 -#define cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RW_YSP 8 -#define cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RW_YSP 8 -#define cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RO_ZRP 8 -#define cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RO_ZRP 8 -#define cOCT6100_TLV_MIN_LENGTH_POA_BOFF_RO_YRP 8 -#define cOCT6100_TLV_MAX_LENGTH_POA_BOFF_RO_YRP 8 - -#define cOCT6100_TLV_MIN_LENGTH_CNR_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_CNR_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_ANR_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_ANR_CONF_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_HZ_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_HZ_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_HX_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_HX_CONF_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_LCA_Z_CONF_BOFF_RW_GAIN 8 -#define cOCT6100_TLV_MAX_LENGTH_LCA_Z_CONF_BOFF_RW_GAIN 8 -#define cOCT6100_TLV_MIN_LENGTH_LCA_Y_CONF_BOFF_RW_GAIN 8 -#define cOCT6100_TLV_MAX_LENGTH_LCA_Y_CONF_BOFF_RW_GAIN 8 - -#define cOCT6100_TLV_MIN_LENGTH_CNA_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_CNA_CONF_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_NOA_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_NOA_CONF_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_VFA_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_VFA_CONF_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_TLA_MAIN_IO_BOFF_RW_TAIL_DISP 8 -#define cOCT6100_TLV_MAX_LENGTH_TLA_MAIN_IO_BOFF_RW_TAIL_DISP 8 - -#define cOCT6100_TLV_MIN_LENGTH_STATSA_MAIN_IO_BOFF_RO_EPC 8 -#define cOCT6100_TLV_MAX_LENGTH_STATSA_MAIN_IO_BOFF_RO_EPC 8 - -#define cOCT6100_TLV_MIN_LENGTH_BOOTA_POUCH_BOFF_RW_BOOT_INST 8 -#define cOCT6100_TLV_MAX_LENGTH_BOOTA_POUCH_BOFF_RW_BOOT_INST 8 -#define cOCT6100_TLV_MIN_LENGTH_BOOTA_POUCH_BOFF_RW_BOOT_RESULT 8 -#define cOCT6100_TLV_MAX_LENGTH_BOOTA_POUCH_BOFF_RW_BOOT_RESULT 8 - -#define cOCT6100_TLV_MIN_LENGTH_CHAN_MAIN_IO_STATS_OFFSET 4 -#define cOCT6100_TLV_MAX_LENGTH_CHAN_MAIN_IO_STATS_OFFSET 4 -#define cOCT6100_TLV_MIN_LENGTH_CHAN_MAIN_IO_STATS_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_CHAN_MAIN_IO_STATS_SIZE 4 - -#define cOCT6100_TLV_MIN_LENGTH_CDA_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_CDA_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_TDM_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_TDM_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_DIS_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_DIS_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_NT_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_NT_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_AEC_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_AEC_CONF_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_PCM_LEAK_CONF_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_PCM_LEAK_CONF_BOFF_RW 8 -#define cOCT6100_TLV_MIN_LENGTH_DEFAULT_ERL_CONF_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_DEFAULT_ERL_CONF_BOFF_RW 8 -#define cOCT6100_TLV_MIN_LENGTH_TONE_REM_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_TONE_REM_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_NLP_CONV_CAP_CONF_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_NLP_CONV_CAP_CONF_BOFF_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_TLA_MAIN_IO_BOFF_RW_MAX_ECHO_POINT 8 -#define cOCT6100_TLV_MAX_LENGTH_TLA_MAIN_IO_BOFF_RW_MAX_ECHO_POINT 8 - -#define cOCT6100_TLV_MIN_LENGTH_DOMINANT_SPEAKER_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_DOMINANT_SPEAKER_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_TAIL_DISP_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_TAIL_DISP_CONF_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_AEC_DEFAULT_ERL_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_AEC_DEFAULT_ERL_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_Z_ALC_TARGET_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_Z_ALC_TARGET_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_Y_ALC_TARGET_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_Y_ALC_TARGET_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_Z_HLC_TARGET_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_Z_HLC_TARGET_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_Y_HLC_TARGET_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_Y_HLC_TARGET_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MIN_LENGTH_ALC_HLC_STATUS_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_ALC_HLC_STATUS_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_Z_PLAYOUT_HARD_SKIP_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_Z_PLAYOUT_HARD_SKIP_BOFF_RW 8 -#define cOCT6100_TLV_MIN_LENGTH_Y_PLAYOUT_HARD_SKIP_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_Y_PLAYOUT_HARD_SKIP_BOFF_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_AFT_FIELD_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_AFT_FIELD_BOFF_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_VOICE_DETECTED_STAT_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_VOICE_DETECTED_STAT_BOFF_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_GAIN_APPLIED_RIN_STAT_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_GAIN_APPLIED_RIN_STAT_BOFF_RW 8 -#define cOCT6100_TLV_MIN_LENGTH_GAIN_APPLIED_SOUT_STAT_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_GAIN_APPLIED_SOUT_STAT_BOFF_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_MAX_ADAPT_ALE_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_MAX_ADAPT_ALE_BOFF_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_RIN_ANR_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_RIN_ANR_BOFF_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_RIN_ANR_VALUE_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_RIN_ANR_VALUE_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_RIN_MUTE_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_RIN_MUTE_BOFF_RW 8 -#define cOCT6100_TLV_MIN_LENGTH_SIN_MUTE_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_SIN_MUTE_BOFF_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_ANR_SNR_IMPROVEMENT_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_ANR_SNR_IMPROVEMENT_BOFF_RW 8 -#define cOCT6100_TLV_MIN_LENGTH_ANR_AGRESSIVITY_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_ANR_AGRESSIVITY_BOFF_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_CHAN_TAIL_LENGTH_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_CHAN_TAIL_LENGTH_BOFF 8 - -#define cOCT6100_TLV_MIN_LENGTH_CHAN_VQE_TONE_DIS_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_CHAN_VQE_TONE_DIS_BOFF 8 - -#define cOCT6100_TLV_MIN_LENGTH_RIN_TONE_REM_CONF_BOFF_RW_ENABLE 8 -#define cOCT6100_TLV_MAX_LENGTH_RIN_TONE_REM_CONF_BOFF_RW_ENABLE 8 - -#define cOCT6100_TLV_MIN_LENGTH_RIN_TONE_REM_COUNTER_BOFF_RW 8 -#define cOCT6100_TLV_MAX_LENGTH_RIN_TONE_REM_COUNTER_BOFF_RW 8 - -#define cOCT6100_TLV_MIN_LENGTH_AF_TAIL_DISP_VALUE_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_AF_TAIL_DISP_VALUE_BOFF 8 - -#define cOCT6100_TLV_MIN_LENGTH_POUCH_COUNTER_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_POUCH_COUNTER_BOFF 8 - -#define cOCT6100_TLV_MIN_LENGTH_AEC_TAIL_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_AEC_TAIL_BOFF 8 - -#define cOCT6100_TLV_MIN_LENGTH_IS_ISR_CALLED_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_IS_ISR_CALLED_BOFF 8 - -#define cOCT6100_TLV_MIN_LENGTH_MUSIC_PROTECTION_ENABLE_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_MUSIC_PROTECTION_ENABLE_BOFF 8 - -#define cOCT6100_TLV_MIN_LENGTH_ZZ_ENERGY_CHAN_STATS_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_ZZ_ENERGY_CHAN_STATS_BOFF 8 -#define cOCT6100_TLV_MIN_LENGTH_YY_ENERGY_CHAN_STATS_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_YY_ENERGY_CHAN_STATS_BOFF 8 - -#define cOCT6100_TLV_MIN_LENGTH_DOUBLE_TALK_BEH_MODE_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_DOUBLE_TALK_BEH_MODE_BOFF 8 - -#define cOCT6100_TLV_MIN_LENGTH_IDLE_CODE_DETECTION_BOFF 8 -#define cOCT6100_TLV_MAX_LENGTH_IDLE_CODE_DETECTION_BOFF 8 - -#define cOCT6100_TLV_MIN_LENGTH_DEBUG_CHAN_INDEX_VALUE 4 -#define cOCT6100_TLV_MAX_LENGTH_DEBUG_CHAN_INDEX_VALUE 4 -#define cOCT6100_TLV_MIN_LENGTH_ADPCM_ENABLE 4 -#define cOCT6100_TLV_MAX_LENGTH_ADPCM_ENABLE 4 -#define cOCT6100_TLV_MIN_LENGTH_NUM_TONE_DETECTOR 4 -#define cOCT6100_TLV_MAX_LENGTH_NUM_TONE_DETECTOR 4 -#define cOCT6100_TLV_MIN_LENGTH_CONFERENCING_ENABLE 4 -#define cOCT6100_TLV_MAX_LENGTH_CONFERENCING_ENABLE 4 -#define cOCT6100_TLV_MIN_LENGTH_MAX_NUMBER_OF_CHANNELS 4 -#define cOCT6100_TLV_MAX_LENGTH_MAX_NUMBER_OF_CHANNELS 4 -#define cOCT6100_TLV_MIN_LENGTH_TONE_DETECTOR_PROFILE 4 -#define cOCT6100_TLV_MAX_LENGTH_TONE_DETECTOR_PROFILE 4 -#define cOCT6100_TLV_MIN_LENGTH_TEST_MODE_ENABLE 4 -#define cOCT6100_TLV_MAX_LENGTH_TEST_MODE_ENABLE 4 -#define cOCT6100_TLV_MIN_LENGTH_MAX_TAIL_DISPLACEMENT 4 -#define cOCT6100_TLV_MAX_LENGTH_MAX_TAIL_DISPLACEMENT 4 -#define cOCT6100_TLV_MIN_LENGTH_MATRIX_EVENT_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_MATRIX_EVENT_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_CNR_RW_ENABLE 4 -#define cOCT6100_TLV_MAX_LENGTH_CNR_RW_ENABLE 4 -#define cOCT6100_TLV_MIN_LENGTH_ANR_RW_ENABLE 4 -#define cOCT6100_TLV_MAX_LENGTH_ANR_RW_ENABLE 4 -#define cOCT6100_TLV_MIN_LENGTH_MAX_TAIL_LENGTH_RW_ENABLE 4 -#define cOCT6100_TLV_MAX_LENGTH_MAX_TAIL_LENGTH_RW_ENABLE 4 -#define cOCT6100_TLV_MIN_LENGTH_PLAYOUT_ENABLE 4 -#define cOCT6100_TLV_MAX_LENGTH_PLAYOUT_ENABLE 4 -#define cOCT6100_TLV_MIN_LENGTH_MUSIC_PROTECTION_RW_ENABLE 4 -#define cOCT6100_TLV_MAX_LENGTH_MUSIC_PROTECTION_RW_ENABLE 4 -#define cOCT6100_TLV_MIN_LENGTH_TONE_REMOVAL_ENABLE 4 -#define cOCT6100_TLV_MAX_LENGTH_TONE_REMOVAL_ENABLE 4 -#define cOCT6100_TLV_MIN_LENGTH_NUMBER_PLAYOUT_EVENTS 4 -#define cOCT6100_TLV_MAX_LENGTH_NUMBER_PLAYOUT_EVENTS 4 -#define cOCT6100_TLV_MIN_LENGTH_MATRIX_DWORD_BASE 4 -#define cOCT6100_TLV_MAX_LENGTH_MATRIX_DWORD_BASE 4 -#define cOCT6100_TLV_MIN_LENGTH_DEBUG_CHAN_STATS_BYTE_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_DEBUG_CHAN_STATS_BYTE_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_HOT_CHANNEL_SELECT_DWORD_BASE 4 -#define cOCT6100_TLV_MAX_LENGTH_HOT_CHANNEL_SELECT_DWORD_BASE 4 -#define cOCT6100_TLV_MIN_LENGTH_TIMESTAMP_DWORD_BASE 4 -#define cOCT6100_TLV_MAX_LENGTH_TIMESTAMP_DWORD_BASE 4 -#define cOCT6100_TLV_MIN_LENGTH_AF_WRITE_PTR_BYTE_OFFSET 4 -#define cOCT6100_TLV_MAX_LENGTH_AF_WRITE_PTR_BYTE_OFFSET 4 -#define cOCT6100_TLV_MIN_LENGTH_RECORDED_PCM_EVENT_BYTE_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_RECORDED_PCM_EVENT_BYTE_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_MATRIX_WP_DWORD_BASE 4 -#define cOCT6100_TLV_MAX_LENGTH_MATRIX_WP_DWORD_BASE 4 -#define cOCT6100_TLV_MIN_LENGTH_DEBUG_CHAN_LITE_STATS_BYTE_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_DEBUG_CHAN_LITE_STATS_BYTE_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_IMAGE_TYPE 4 -#define cOCT6100_TLV_MAX_LENGTH_IMAGE_TYPE 4 -#define cOCT6100_TLV_MIN_LENGTH_MAX_WIRELINE_CHANNELS 4 -#define cOCT6100_TLV_MAX_LENGTH_MAX_WIRELINE_CHANNELS 4 -#define cOCT6100_TLV_MIN_LENGTH_AF_EVENT_CB_BYTE_SIZE 4 -#define cOCT6100_TLV_MAX_LENGTH_AF_EVENT_CB_BYTE_SIZE 4 -#define cOCT6100_TLV_MIN_LENGTH_BUFFER_PLAYOUT_SKIP_IN_EVENTS 4 -#define cOCT6100_TLV_MAX_LENGTH_BUFFER_PLAYOUT_SKIP_IN_EVENTS 4 -#define cOCT6100_TLV_MIN_LENGTH_DOUBLE_TALK_BEH_MODE 4 -#define cOCT6100_TLV_MAX_LENGTH_DOUBLE_TALK_BEH_MODE 4 -#define cOCT6100_TLV_MIN_LENGTH_SOUT_NOISE_BLEACHING 4 -#define cOCT6100_TLV_MAX_LENGTH_SOUT_NOISE_BLEACHING 4 -#define cOCT6100_TLV_MIN_LENGTH_IDLE_CODE_DETECTION 4 -#define cOCT6100_TLV_MAX_LENGTH_IDLE_CODE_DETECTION 4 -#define cOCT6100_TLV_MIN_LENGTH_NLP_STATISTICS 4 -#define cOCT6100_TLV_MAX_LENGTH_NLP_STATISTICS 4 - - -/***************************** TYPES ***************************************/ - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiProcessTlvRegion( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiInterpretTlvEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulTlvFieldType, - IN UINT32 f_ulTlvFieldLength, - IN UINT32 f_ulTlvValueAddress ); - -UINT32 Oct6100ApiTlvCheckLengthField( - IN OUT UINT32 f_ulTlvFieldLength, - IN UINT32 f_ulMinLengthValue, - IN UINT32 f_ulMaxLengthValue ); - -UINT32 Oct6100ApiTlvReadDword( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulAddress, - OUT PUINT32 f_pulReadData ); - -UINT32 Oct6100ApiTlvReadBitOffsetStruct( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulAddress, - OUT tPOCT6100_TLV_OFFSET f_pBitOffsetStruct ); - -#endif /* __OCT6100_TLV_PRIV_H__ */ diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_tone_detection_priv.h b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_tone_detection_priv.h deleted file mode 100644 index c3192c2..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_tone_detection_priv.h +++ /dev/null @@ -1,111 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tone_detection_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_tone_detection.c. All elements defined in - this file are for private usage of the API. All public elements are - defined in the oct6100_tone_detection_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 14 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_TONE_DETECTION_PRIV_H__ -#define __OCT6100_TONE_DETECTION_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ToneDetectionEnableSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TONE_DETECTION_ENABLE f_pToneDetectEnable ); - -UINT32 Oct6100ApiCheckToneEnableParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TONE_DETECTION_ENABLE f_pToneDetectEnable, - OUT PUINT32 f_pulChannelIndex, - OUT PUINT32 f_pulToneEventNumber, - - OUT PUINT32 f_pulExtToneChanIndex ); - -UINT32 Oct6100ApiWriteToneDetectEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulToneEventNumber, - - IN UINT32 f_ulExtToneChanIndex ); - -UINT32 Oct6100ApiUpdateChanToneDetectEntry ( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulToneEventNumber, - IN UINT32 f_ulExtToneChanIndex ); - -UINT32 Oct6100ToneDetectionDisableSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_TONE_DETECTION_DISABLE f_pToneDetectDisable ); - -UINT32 Oct6100ApiAssertToneDetectionParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TONE_DETECTION_DISABLE f_pToneDetectDisable, - OUT PUINT32 f_pulChannelIndex, - OUT PUINT32 f_pulToneEventNumber, - OUT PUINT32 f_pulExtToneChanIndex, - - OUT PBOOL f_pfDisableAll ); - -UINT32 Oct6100ApiClearToneDetectionEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulToneEventNumber, - IN UINT32 f_ulExtToneChanIndex, - - IN BOOL f_fDisableAll ); - -UINT32 Oct6100ApiReleaseToneDetectionEvent( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulChannelIndex, - IN UINT32 f_ulToneEventNumber, - IN UINT32 f_ulExtToneChanIndex, - IN BOOL f_fDisableAll ); - -UINT32 Oct6100ApiIsSSTone( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulToneEventNumber, - OUT PBOOL f_fSSTone ); - -UINT32 Oct6100ApiIs2100Tone( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulToneEventNumber, - OUT PBOOL f_fIs2100Tone ); - -#endif /* __OCT6100_TONE_DETECTION_PRIV_H__ */ diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_tsi_cnct_priv.h b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_tsi_cnct_priv.h deleted file mode 100644 index b7c57f3..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_tsi_cnct_priv.h +++ /dev/null @@ -1,126 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tsi_cnct_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_tsi_cnct.c. All elements defined in - this file are for private usage of the API. All public elements are - defined in the oct6100_tsi_cnct_pub.h file. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 14 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_TSI_CNCT_PRIV_H__ -#define __OCT6100_TSI_CNCT_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - -/***************************** DEFINES *************************************/ - -/* TSI connection list pointer macros. */ -#define mOCT6100_GET_TSI_CNCT_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_TSI_CNCT )(( PUINT8 )pSharedInfo + pSharedInfo->ulTsiCnctListOfst ); - -#define mOCT6100_GET_TSI_CNCT_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_TSI_CNCT )(( PUINT8 )pSharedInfo + pSharedInfo->ulTsiCnctListOfst)) + ulIndex; - -#define mOCT6100_GET_TSI_CNCT_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulTsiCnctAllocOfst); - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetTsiCnctSwSizes( - IN tPOCT6100_CHIP_OPEN f_pOpenChip, - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100ApiTsiCnctSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - - -UINT32 Oct6100TsiCnctOpenSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen ); - -UINT32 Oct6100ApiCheckTsiParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen ); - -UINT32 Oct6100ApiReserveTsiResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen, - OUT PUINT16 f_pusTsiChanIndex, - OUT PUINT16 f_pusTsiMemIndex, - OUT PUINT16 f_pusInputTsstIndex, - OUT PUINT16 f_pusOutputTsstIndex ); - -UINT32 Oct6100ApiWriteTsiStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen, - IN UINT16 f_usTsiMemIndex, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ); - -UINT32 Oct6100ApiUpdateTsiEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_TSI_CNCT_OPEN f_pTsiCnctOpen, - IN UINT16 f_usTsiChanIndex, - IN UINT16 f_usTsiMemIndex, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ); - - -UINT32 Oct6100TsiCnctCloseSer( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN OUT tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose ); - -UINT32 Oct6100ApiAssertTsiParams( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN tPOCT6100_TSI_CNCT_CLOSE f_pTsiCnctClose, - OUT PUINT16 f_pusTsiChanIndex, - OUT PUINT16 f_pusTsiMemIndex, - OUT PUINT16 f_pusInputTsstIndex, - OUT PUINT16 f_pusOutputTsstIndex ); - -UINT32 Oct6100ApiInvalidateTsiStructs( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usInputTsstIndex, - IN UINT16 f_usOutputTsstIndex ); - -UINT32 Oct6100ApiReleaseTsiResources( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsiChanIndex, - IN UINT16 f_usTsiMemIndex ); - -UINT32 Oct6100ApiReserveTsiCnctEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - OUT PUINT16 f_pusTsiChanIndex ); - -UINT32 Oct6100ApiReleaseTsiCnctEntry( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT16 f_usTsiChanIndex ); - -#endif /* __OCT6100_TSI_CNCT_PRIV_H__ */ diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_tsst_priv.h b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_tsst_priv.h deleted file mode 100644 index ca080b3..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_tsst_priv.h +++ /dev/null @@ -1,89 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_tsst_priv.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - File containing all private defines, macros, structures and prototypes - pertaining to the file oct6100_tsst.c. All elements defined in - this file are for private usage of the API. - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 14 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_TSST_PRIV_H__ -#define __OCT6100_TSST_PRIV_H__ - -/***************************** INCLUDE FILES *******************************/ - - -/***************************** DEFINES *************************************/ - -/* TSST allocation and serialization pointer macros. */ -#define mOCT6100_GET_TSST_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PUINT32 )(( PUINT8 )pSharedInfo + pSharedInfo->ulTsstAllocOfst); - -#define mOCT6100_GET_TSST_LIST_PNT( pSharedInfo, pList ) \ - pList = ( tPOCT6100_API_TSST_ENTRY )(( PUINT8 )pSharedInfo + pSharedInfo->ulTsstListOfst ); - -#define mOCT6100_GET_TSST_LIST_ENTRY_PNT( pSharedInfo, pEntry, ulIndex ) \ - pEntry = (( tPOCT6100_API_TSST_ENTRY )(( PUINT8 )pSharedInfo + pSharedInfo->ulTsstListOfst)) + ulIndex; - -#define mOCT6100_GET_TSST_LIST_ALLOC_PNT( pSharedInfo, pAlloc ) \ - pAlloc = ( PVOID )(( PUINT8 )pSharedInfo + pSharedInfo->ulTsstListAllocOfst); - -/***************************** TYPES ***************************************/ - - -/************************** FUNCTION PROTOTYPES *****************************/ - -UINT32 Oct6100ApiGetTsstSwSizes( - OUT tPOCT6100_API_INSTANCE_SIZES f_pInstSizes ); - -UINT32 Oct6100ApiTsstSwInit( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance ); - -UINT32 Oct6100ApiValidateTsst( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulNumTssts, - IN UINT32 f_ulTimeslot, - IN UINT32 f_ulStream, - IN UINT32 f_ulDirection ); - -UINT32 Oct6100ApiReserveTsst( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulTimeslot, - IN UINT32 f_ulStream, - IN UINT32 f_ulNumTsst, - IN UINT32 f_ulDirection, - OUT PUINT16 f_pusTsstMemIndex, - OUT PUINT16 f_pusTsstListIndex ); - -UINT32 Oct6100ApiReleaseTsst( - IN OUT tPOCT6100_INSTANCE_API f_pApiInstance, - IN UINT32 f_ulTimeslot, - IN UINT32 f_ulStream, - IN UINT32 f_ulNumTsst, - IN UINT32 f_ulDirection, - IN UINT16 f_usTsstListIndex ); - -#endif /* __OCT6100_TSST_PRIV_H__ */ diff --git a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_version.h b/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_version.h deleted file mode 100644 index 7b3eb5d..0000000 --- a/drivers/dahdi/oct612x/octdeviceapi/oct6100api/oct6100_version.h +++ /dev/null @@ -1,39 +0,0 @@ -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -File: oct6100_version.h - - Copyright (c) 2001-2007 Octasic Inc. - -Description: - - This file contains the version of API. To obtain that version - number, the user must call the API function Oct6100ApiGetVersion(). - -This file is part of the Octasic OCT6100 GPL API . The OCT6100 GPL API is -free software; you can redistribute it and/or modify it under the terms of -the GNU General Public License as published by the Free Software Foundation; -either version 2 of the License, or (at your option) any later version. - -The OCT6100 GPL API is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with the OCT6100 GPL API; if not, write to the Free Software -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - -$Octasic_Release: OCT612xAPI-01.00-PR49 $ - -$Octasic_Revision: 52 $ - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ - -#ifndef __OCT6100_VERSION_H__ -#define __OCT6100_VERSION_H__ - -/* String version of the OCT6100 API.*/ - -#define cOCT6100_API_VERSION "OCT6100API-01.00-PR49" - -#endif /* __OCT6100_VERSION_H__ */ |