summaryrefslogtreecommitdiff
path: root/software/octdeviceapi/oct6100api
diff options
context:
space:
mode:
authorShaun Ruffell <sruffell@digium.com>2011-02-10 16:22:49 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2011-02-27 21:24:13 +0200
commiteb755c20d77990e9c3bb9295a05ed95787db96b6 (patch)
tree9bbbbda4c7a3e6be779614ef215d5640beced62c /software/octdeviceapi/oct6100api
parent50b83b3abecd87ffb8d35cdbda0860b15ce638cf (diff)
wct4xxp: Reduce the memory footprint of the hardware echocanceler.
This saves ~300K of kernel memory for each quad or dual span VPM. Due to the fact that this change disables caching of the NLP words (among other things), the time to disable the echocans appears to have increased by ~1ms. Before this change: ======================================================================= 0) ! 356.498 us | vpm450m_setecmode(); <--- disable 0) ! 387.762 us | vpm450m_setecmode(); <--- enable 0) ! 429.839 us | vpm450m_setecmode(); <--- disable ]# echo 1 > /proc/sys/vm/drop_caches && free -k total used free shared buffers cached Mem: 2005352 228368 1776984 0 132 5540 -/+ buffers/cache: 222696 1782656 Swap: 983036 0 983036 After this change: ======================================================================= 0) ! 1109.515 us | vpm450m_setecmode(); <--- disable 0) ! 339.017 us | vpm450m_setecmode(); <--- enable 0) ! 1431.460 us | vpm450m_setecmode(); <--- disable ]# echo 1 > /proc/sys/vm/drop_caches && free -k total used free shared buffers cached Mem: 2005352 228080 1777272 0 112 5484 -/+ buffers/cache: 222484 1782868 Swap: 983036 0 983036 Signed-off-by: Shaun Ruffell <sruffell@digium.com> git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9750 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'software/octdeviceapi/oct6100api')
-rw-r--r--software/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c2
-rw-r--r--software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c13
-rw-r--r--software/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h161
3 files changed, 54 insertions, 122 deletions
diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c
index 49a876f..f06b64b 100644
--- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c
+++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_channel.c
@@ -5481,7 +5481,7 @@ UINT32 Oct6100ApiModifyChannelStructs(
if ( f_pChannelModify->fDisableToneDetection == TRUE )
{
/* Check if tone detection has been enabled on this channel. */
- for ( ulToneConfIndex = 0; ulToneConfIndex < ( sizeof( pChanEntry->aulToneConf ) / sizeof(UINT32) ); ulToneConfIndex ++ )
+ for (ulToneConfIndex = 0; ulToneConfIndex < ARRAY_SIZE(pChanEntry->aulToneConf); ulToneConfIndex++)
{
/* Check if some tone has been activated on this channel. */
if ( pChanEntry->aulToneConf[ ulToneConfIndex ] != 0 )
diff --git a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c
index 00c0fec..14f13e0 100644
--- a/software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c
+++ b/software/octdeviceapi/oct6100api/oct6100_api/oct6100_chip_open.c
@@ -200,7 +200,7 @@ UINT32 Oct6100ChipOpenDef(
f_pChipOpen->fEnableAcousticEcho = FALSE;
/* Resource allocation parameters. */
- f_pChipOpen->ulMaxChannels = 672;
+ f_pChipOpen->ulMaxChannels = 256;
f_pChipOpen->ulMaxTsiCncts = 0;
f_pChipOpen->ulMaxBiDirChannels = 0;
f_pChipOpen->ulMaxConfBridges = 0;
@@ -219,7 +219,7 @@ UINT32 Oct6100ChipOpenDef(
f_pChipOpen->fEnableFastH100Mode = FALSE;
/* Configure the soft tone event buffer. */
- f_pChipOpen->ulSoftToneEventsBufSize = 2048;
+ f_pChipOpen->ulSoftToneEventsBufSize = 128;
f_pChipOpen->fEnableExtToneDetection = FALSE;
f_pChipOpen->fEnable2100StopEvent = FALSE;
@@ -240,7 +240,7 @@ UINT32 Oct6100ChipOpenDef(
f_pChipOpen->InterruptConfig.ulFatalMemoryTimeout = 100;
f_pChipOpen->InterruptConfig.ulErrorH100Timeout = 100;
f_pChipOpen->InterruptConfig.ulErrorOverflowToneEventsTimeout = 100;
- f_pChipOpen->ulMaxRemoteDebugSessions = 1;
+ 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;
@@ -321,6 +321,7 @@ UINT32 Oct6100ChipOpen(
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 ) {
@@ -1180,7 +1181,7 @@ UINT32 Oct6100ApiCheckChipConfiguration(
/*-----------------------------------------------------------------------------*/
/* Check soft buffer for tone events size. */
- if ( f_pChipOpen->ulSoftToneEventsBufSize < cOCT6100_NUM_PGSP_EVENT_OUT ||
+ if (f_pChipOpen->ulSoftToneEventsBufSize < 64 ||
f_pChipOpen->ulSoftToneEventsBufSize > cOCT6100_ABSOLUTE_MAX_NUM_PGSP_EVENT_OUT )
return cOCT6100_ERR_OPEN_SOFT_TONE_EVENT_SIZE;
@@ -1678,6 +1679,7 @@ UINT32 Oct6100ApiCalculateInstanceSizes(
/*-----------------------------------------------------------------------------*/
/* 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;
@@ -1687,8 +1689,6 @@ UINT32 Oct6100ApiCalculateInstanceSizes(
if ( ulResult != cOCT6100_ERR_OK )
return ulResult;
-
-
/*-----------------------------------------------------------------------------*/
/* Memory needed by soft Rx Event buffers. */
ulResult = Oct6100ApiGetEventsSwSizes( f_pChipOpen, f_pInstSizes );
@@ -1741,7 +1741,6 @@ UINT32 Oct6100ApiCalculateInstanceSizes(
ulApiInstProcessSpecific = sizeof( tOCT6100_INSTANCE_API );
mOCT6100_ROUND_MEMORY_SIZE( ulApiInstProcessSpecific, ulTempVar )
-
f_pInstSizes->ulApiInstTotal =
f_pInstSizes->ulChannelList +
f_pInstSizes->ulChannelAlloc +
diff --git a/software/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h b/software/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h
index dba94fd..8d4eca6 100644
--- a/software/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h
+++ b/software/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h
@@ -231,67 +231,34 @@ IN f_pulConfigDword Pointer to the content stored in the API located at the
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#define mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInst, f_pChanEntry, f_ulAddress, f_pulConfigDword, f_ulResult ) \
-{ \
- UINT32 _ulFirstEmptyIndex = 0xFFFFFFFF; \
- UINT32 _i; \
- \
- f_ulResult = cOCT6100_ERR_FATAL_8E; \
- (*f_pulConfigDword) = cOCT6100_INVALID_VALUE; \
- \
- /* 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 ]; \
- f_ulResult = cOCT6100_ERR_OK; \
- } \
- } \
- \
- if ( ( _i == cOCT6100_MAX_NLP_CONF_DWORD ) && ( _ulFirstEmptyIndex == 0xFFFFFFFF ) ) \
- { \
- /* Nothing to do here, a fatal error occured, no memory was left. */ \
- } \
- else \
- { \
- if ( f_ulResult != cOCT6100_ERR_OK ) \
- { \
- tOCT6100_READ_PARAMS _ReadParams; \
- UINT16 _usReadData; \
- \
- /* We did not found any entry, let's create a new entry.*/ \
- f_pChanEntry->aulNlpConfDword[ _ulFirstEmptyIndex ][ 0 ] = f_ulAddress; \
- \
- _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, f_ulResult ); \
- if ( f_ulResult == cOCT6100_ERR_OK ) \
- { \
- /* Save data.*/ \
- (*f_pulConfigDword) = _usReadData << 16; \
- \
- /* Read the last 16 bits .*/ \
- _ReadParams.ulReadAddress += 2; \
- mOCT6100_DRIVER_READ_API( _ReadParams, f_ulResult ); \
- if ( f_ulResult == cOCT6100_ERR_OK ) \
- { \
- /* Save data.*/ \
- (*f_pulConfigDword) |= _usReadData; \
- f_ulResult = cOCT6100_ERR_OK; \
- } \
- } \
- } \
- } \
-}
+{ \
+ tOCT6100_READ_PARAMS _ReadParams; \
+ UINT16 _usReadData; \
+ f_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, f_ulResult); \
+ if (f_ulResult == cOCT6100_ERR_OK) { \
+ /* Save data.*/ \
+ (*f_pulConfigDword) = _usReadData << 16; \
+ \
+ /* Read the last 16 bits .*/ \
+ _ReadParams.ulReadAddress += 2; \
+ mOCT6100_DRIVER_READ_API(_ReadParams, f_ulResult); \
+ if (f_ulResult == cOCT6100_ERR_OK) { \
+ /* Save data.*/ \
+ (*f_pulConfigDword) |= _usReadData; \
+ f_ulResult = cOCT6100_ERR_OK; \
+ } \
+ } \
+} \
/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\
@@ -314,59 +281,25 @@ IN f_pulConfigDword content to be stored in the API located at the
\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/
#define mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInst, f_pChanEntry, f_ulAddress, f_ulConfigDword, f_ulResult ) \
-{ \
- UINT32 _i; \
- UINT32 _ulLastValue = 0x0; \
- \
- /* 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.*/ \
- _ulLastValue = f_pChanEntry->aulNlpConfDword[ _i ][ 1 ]; \
- f_pChanEntry->aulNlpConfDword[ _i ][ 1 ] = f_ulConfigDword; \
- break; \
- } \
- } \
- \
- if ( _i == cOCT6100_MAX_NLP_CONF_DWORD ) \
- { \
- f_ulResult = cOCT6100_ERR_FATAL_8F; \
- } \
- else \
- { \
- /* 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; \
- \
- /* Check if it is worth calling the user function. */ \
- if ( ( f_ulConfigDword & 0xFFFF0000 ) != ( _ulLastValue & 0xFFFF0000 ) ) \
- { \
- /* Write the first 16 bits. */ \
- _WriteParams.ulWriteAddress = f_ulAddress; \
- _WriteParams.usWriteData = (UINT16)((f_ulConfigDword >> 16) & 0xFFFF); \
- mOCT6100_DRIVER_WRITE_API( _WriteParams, f_ulResult ); \
- } \
- else \
- { \
- f_ulResult = cOCT6100_ERR_OK; \
- } \
- \
- if ( f_ulResult == cOCT6100_ERR_OK ) \
- { \
- if ( ( f_ulConfigDword & 0x0000FFFF ) != ( _ulLastValue & 0x0000FFFF ) ) \
- { \
- /* Write the last word. */ \
- _WriteParams.ulWriteAddress = f_ulAddress + 2; \
- _WriteParams.usWriteData = (UINT16)(f_ulConfigDword & 0xFFFF); \
- mOCT6100_DRIVER_WRITE_API( _WriteParams, f_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, f_ulResult); \
+ \
+ if (f_ulResult == cOCT6100_ERR_OK) { \
+ /* Write the last word. */ \
+ _WriteParams.ulWriteAddress = f_ulAddress + 2; \
+ _WriteParams.usWriteData = (UINT16)(f_ulConfigDword & 0xFFFF); \
+ mOCT6100_DRIVER_WRITE_API(_WriteParams, f_ulResult); \
+ } \
}