void PCM4WAY_GetFromMic(uint16 *ul_buf) { uint32 I; // Use address mode to prevent idma being interrupted by other ISR, ie. L1D. volatile uint16* ptr = SAL_PcmEx_GetBuf(SAL_PCMEX_PNW_BUF_UL1); if( L1SP_IsMicrophoneMuted() ){ for( I = SAL_PcmEx_GetBufLen(SAL_PCMEX_PNW_BUF_UL1); I > 0; I-- ) *ul_buf++ = 0; } else { for( I = SAL_PcmEx_GetBufLen(SAL_PCMEX_PNW_BUF_UL1); I > 0; I-- ) *ul_buf++ = *ptr++; } }
void PCM4WAY_PutToSpk(const uint16 *dl_data) { uint32 I; volatile uint16* ptr = SAL_PcmEx_GetBuf(SAL_PCMEX_PNW_BUF_DL2); for( I = SAL_PcmEx_GetBufLen(SAL_PCMEX_PNW_BUF_DL2) ; I > 0; I-- ) *ptr++ = *dl_data++; }
void PCM4WAY_GetFromSD(uint16 *dl_buf) { uint32 I; volatile uint16* ptr = SAL_PcmEx_GetBuf(SAL_PCMEX_PNW_BUF_DL1); for( I = SAL_PcmEx_GetBufLen(SAL_PCMEX_PNW_BUF_DL1); I > 0; I-- ) *dl_buf++ = *ptr++; }
void PCM4WAY_FillSE(uint16 value) { uint32 I; volatile uint16* ptr = SAL_PcmEx_GetBuf(SAL_PCMEX_PNW_BUF_UL2); for( I = SAL_PcmEx_GetBufLen(SAL_PCMEX_PNW_BUF_UL2) ; I > 0; I-- ) *ptr++ = value; }
void PCM4WAY_FillSpk(uint16 value) { uint32 I; // Use address mode to prevent idma being interrupted by other ISR, ie. L1D. volatile uint16* ptr = SAL_PcmEx_GetBuf(SAL_PCMEX_PNW_BUF_DL2); *ptr++ = value; for( I = SAL_PcmEx_GetBufLen(SAL_PCMEX_PNW_BUF_DL2) - 1 ; I > 0; I-- ) *ptr++ = value; }
uint16 pcmEx_writePatternToDsp(uint16 pattern, Sal_PcmEx_BufId_t bufName) { uint32 I; uint16 bufLen = SAL_PcmEx_GetBufLen(bufName); volatile uint16* ptr = SAL_PcmEx_GetBuf(bufName); for( I = bufLen; I > 0; I-- ) *ptr++ = pattern; return bufLen; }
uint16 pcmEx_writeDataToDsp(const uint16 *fromBuf, Sal_PcmEx_BufId_t bufName) { uint32 I; uint16 bufLen = SAL_PcmEx_GetBufLen(bufName); volatile uint16* ptr = SAL_PcmEx_GetBuf(bufName); kal_prompt_trace(MOD_L1SP, "pcmEx_writeDataToDsp bufName=%d, addr=%x, length=%d" , bufName, ptr, bufLen); for( I = bufLen; I > 0; I-- ) *ptr++ = *fromBuf++; return bufLen; }
uint16 pcmEx_getDataFromDsp(uint16 *toBuf, Sal_PcmEx_BufId_t bufName, kal_bool isUl) { uint32 I; uint16 bufLen = SAL_PcmEx_GetBufLen(bufName); // Use address mode to prevent idma being interrupted by other ISR, ie. L1D. volatile uint16* ptr = SAL_PcmEx_GetBuf(bufName); kal_prompt_trace(MOD_L1SP, "pcmEx_getDataFromDsp bufName=%d, addr=%x, length=%d" , bufName, ptr, bufLen); if( SP_IsMicMute() && (KAL_TRUE == isUl) ){ for( I = bufLen; I > 0; I-- ) *toBuf++ = 0; } else { for( I = bufLen; I > 0; I-- ) *toBuf++ = *ptr++; } return bufLen; }