void DACA_FillSE(uint16 value) { uint32 I; uint32 fsize = dacaEx.frame_size; volatile uint16* ptr = SAL_PcmEx_GetBuf(SAL_PCMEX_DACA_BUF_UL); for( I = fsize; I > 0; I-- ) *ptr++ = value; }
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 DACA_PutToSE(const uint16 *ul_data) { uint32 I; uint32 fsize = dacaEx.frame_size; volatile uint16* ptr = SAL_PcmEx_GetBuf(SAL_PCMEX_DACA_BUF_UL); for( I = fsize; I > 0; I-- ) *ptr++ = *ul_data++; }
uint32 DACA_GetFromSD(uint16 *dl_buf) { uint32 I; uint32 fsize = dacaEx.frame_size; volatile uint16* ptr = SAL_PcmEx_GetBuf(SAL_PCMEX_DACA_BUF_DL); *dl_buf = *ptr; // dummy read for( I = fsize ; I > 0; I-- ) *dl_buf++ = *ptr++; return fsize; }
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; }
void PCM2WAY_GetFromMic(uint16 *ul_buf) { uint32 I; int32 bufLength; volatile uint16* ptr = SAL_PcmEx_GetBuf(SAL_PCMEX_PNW_BUF_UL1); bufLength = pcmEx.u4DspPcmExMicLen; #if defined(__DUAL_MIC_SUPPORT__) || defined(__SMART_PHONE_MODEM__)//every buffer is contain only one mic WHEN CALIBRATION if(P2W_APP_TYPE_REC_ONLY_CAL == pcmEx.app_type || P2W_APP_TYPE_REC_PLAY_CAL == pcmEx.app_type) { bufLength >>= 1; }
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++; } }
uint32 DACA_GetFromSD(uint16 *dl_buf) { uint32 I; uint32 fsize = dacaEx.frame_size; if(SP_IsSpeakerMute()){ memset(dl_buf, 0, fsize * sizeof(uint16)); } else { volatile uint16* ptr = SAL_PcmEx_GetBuf(SAL_PCMEX_DACA_BUF_DL); *dl_buf = *ptr; // dummy read for( I = fsize ; I > 0; I-- ) *dl_buf++ = *ptr++; } return fsize; }
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; }
uint32 DACA_GetFromSD(uint16 *dl_buf) { uint32 I; uint32 fsize = dacaEx.frame_size; if(SP_IsSpeakerMute()) { memset(dl_buf, 0, fsize * sizeof(uint16)); } else { volatile int16* ptr = SAL_PcmEx_GetBuf(SAL_PCMEX_DACA_BUF_DL); int16 *out_buf = dl_buf; int32 gain = AM_DSP_GetSpeechDigitalGain(); ASSERT(gain > 0 && gain <= 4096); for( I = 0 ; I < fsize; I++ ) { // tmp = *ptr++; //tmp = (tmp * gain) >> 12; //*out_buf++ = tmp; *out_buf++ = (*ptr++ * gain) >> 12; } } return fsize; }