diff options
author | Shaun Ruffell <sruffell@digium.com> | 2011-02-10 16:22:55 +0000 |
---|---|---|
committer | Tzafrir Cohen <tzafrir.cohen@xorcom.com> | 2011-02-27 21:34:00 +0200 |
commit | 0867515a55e4ac8176a396b8de60d7ad5310447c (patch) | |
tree | 64a79c496042a966dd5056f0acf4c6d4efec7301 /software/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h | |
parent | eb755c20d77990e9c3bb9295a05ed95787db96b6 (diff) |
wct4xxp: Reduce stack usage in oct612x API.dahdi-embedded
Reduce the stack usage by replacing the mOCT6100_RETRIEVE_NLP_CONF_DWORD
and mOCT6100_SAVE_NLP_CONF_DWORD macros with functions. Some compilers
do a better job of optimizing the local variables declared in those
macros than others.
For example, with gcc 4.3.0, running
]# make stackcheck | grep Oct6100 | head -n 20 | sed -e 's/^0\S* //g' | uniq
Before:
Oct6100ApiWriteVqeNlpMemory [wct4xxp]: 1112
Oct6100ApiInvalidateChanPlayoutStructs [wct4xxp]:520
Oct6100ApiSetChannelLevelControl [wct4xxp]: 392
Oct6100ApiBridgeEventRemove [wct4xxp]: 344
Oct6100ApiDebugChannelOpen [wct4xxp]: 312
Oct6100ApiWriteVqeAfMemory [wct4xxp]: 296
Oct6100ApiSetChannelTailConfiguration [wct4xxp]:264
Oct6100ApiRandomMemoryWrite [wct4xxp]: 248
Oct6100ApiTransferToneEvents [wct4xxp]: 248
Oct6100ApiModifyChannelStructs [wct4xxp]: 232
After:
Oct6100ApiBridgeEventRemove [wct4xxp]: 344
Oct6100ApiDebugChannelOpen [wct4xxp]: 312
Oct6100ApiRandomMemoryWrite [wct4xxp]: 248
Oct6100ApiTransferToneEvents [wct4xxp]: 248
Oct6100ApiInvalidateChanPlayoutStructs [wct4xxp]:248
Oct6100ApiModifyChannelStructs [wct4xxp]: 232
Oct6100ApiBridgeRemoveParticipantFromChannel [wct4xxp]:216
Oct6100ApiWriteVqeNlpMemory [wct4xxp]: 200
Oct6100ApiInitChannels [wct4xxp]: 168
Oct6100ApiProgramNLP [wct4xxp]: 168
Signed-off-by: Shaun Ruffell <sruffell@digium.com>
git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9751 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'software/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h')
-rw-r--r-- | software/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h | 105 |
1 files changed, 10 insertions, 95 deletions
diff --git a/software/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h b/software/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h index 8d4eca6..c0381f4 100644 --- a/software/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h +++ b/software/octdeviceapi/oct6100api/oct6100_miscellaneous_priv.h @@ -208,101 +208,6 @@ $Octasic_Revision: 20 $ #define mOCT6100_ASSIGN_USER_READ_WRITE_OBJ( f_pApiInst, Params ) - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: mOCT6100_RETRIEVE_NLP_CONF_DWORD - -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 -------------------------------------------------------------------------------- - -IN f_pApiInst Pointer to API instance. This memory is used to keep - the present state of the chip and all its resources. -IN f_pChanEntry Pointer to an API channel structure.. -IN f_ulAddress Address that needs to be modified.. -IN f_pulConfigDword Pointer to the content stored in the API located at the - desired address. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#define mOCT6100_RETRIEVE_NLP_CONF_DWORD( f_pApiInst, f_pChanEntry, f_ulAddress, f_pulConfigDword, f_ulResult ) \ -{ \ - 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; \ - } \ - } \ -} \ - - -/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\ - -Function: mOCT6100_SAVE_NLP_CONF_DWORD - -Description: This function stores a configuration Dword within an API channel - structure and then writes it into the chip. - -------------------------------------------------------------------------------- -| 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. -IN f_pChanEntry Pointer to an API channel structure.. -IN f_ulAddress Address that needs to be modified.. -IN f_pulConfigDword content to be stored in the API located at the - desired address. - -\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/ -#define mOCT6100_SAVE_NLP_CONF_DWORD( f_pApiInst, f_pChanEntry, f_ulAddress, f_ulConfigDword, 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); \ - } \ -} - - #define mOCT6100_CREATE_FEATURE_MASK( f_ulFieldSize, f_ulFieldBitOffset, f_pulFieldMask ) \ { \ (*f_pulFieldMask) = ( 1 << f_ulFieldSize ); \ @@ -361,4 +266,14 @@ UINT8 Oct6100ApiHexToAscii( 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__ */ |