//filters the ping from stereo in void filtPingTsk() { int32_t pingBuffer[48]; while (1) { MBX_pend(&MBX_DmaFiltPing, pingBuffer, SYS_FOREVER); firFilt(pingBuffer, &g_audioBuffer[PING_START]); } }
/* Reconfigures codec in response to USB message */ void CodecConfigTask(void) { CodecCfgMsgObj codecCfgMsg; Int16 *pData; while (1) { //TSK_settime(TSK_self()); // statistic collection if (MBX_pend(&MBX_codecConfig, &codecCfgMsg, SYS_FOREVER)) { switch (codecCfgMsg.wMsg) { case CODEC_CFG_MSG_ADJ_VOL_L: pData = (Int16 *)codecCfgMsg.wData; Adjust_Volume(*pData, 0); break; case CODEC_CFG_MSG_ADJ_VOL_R: pData = (Int16 *)codecCfgMsg.wData; Adjust_Volume(*pData, 1); break; case CODEC_CFG_MSG_ADJ_MUTE: pData = (Int16 *)codecCfgMsg.wData; if ((*pData & 0xff) == 0) { // un-mute //STS_set(&mySts1, CLK_gethtime()); if(Set_Mute_State(FALSE) == FALSE) { LOG_printf(&trace, "FAILED MUTE CLEAR\n"); } //STS_delta(&mySts1, CLK_gethtime()); //TSK_deltatime(TSK_self()); // statistic collection break; } else if ((*pData & 0xff) == 1) { // mute //STS_set(&mySts1, CLK_gethtime()); if(Set_Mute_State(TRUE) == FALSE) { LOG_printf(&trace, "FAILED MUTE SET\n"); } //STS_delta(&mySts1, CLK_gethtime()); //TSK_deltatime(TSK_self()); // statistic collection } break; default: break; } } } }
/** * \brief USB Msc task * * \param None * * \return None */ static void MSCTask(void) { CSL_UsbMscMsg wMSCMsg; pUsbContext pContext = &gUsbContext; volatile WORD Msg; pUsbEpStatus peps; //TSK_settime(TSK_self()); // statistic collection while(TRUE) { /* wait for mailbox to be posted */ MBX_pend(&MBX_msc, &wMSCMsg, SYS_FOREVER); Msg = wMSCMsg; if(Msg == CSL_USB_MSG_MSC_TASK_EXIT) break; switch(Msg) { case CSL_USB_MSG_MSC_CTL: peps = &pContext->pEpStatus[CSL_USB_EP0]; if(peps->hEventHandler) (*peps->hEventHandler)(); break; case CSL_USB_MSG_ISO_IN: peps = &pContext->pEpStatus[CSL_USB_EP1]; if(peps->hEventHandler) (*peps->hEventHandler)(); break; case CSL_USB_MSG_ISO_OUT: peps = &pContext->pEpStatus[CSL_USB_EP2]; if(peps->hEventHandler) (*peps->hEventHandler)(); break; case CSL_USB_MSG_HID_INT_IN: peps = &pContext->pEpStatus[CSL_USB_EP3]; if(peps->hEventHandler) (*peps->hEventHandler)(); break; default: break; } //TSK_deltatime(TSK_self()); // statistic collection } /* Ack for exit this task */ SEM_post(&SEM_MUSBMSCTaskExited); }
//filters test vec samples for ping void filtTestVecPing() { int16_t i; int16_t samples[8]; int16_t upsamples[48]; while (1) { MBX_pend(&MBX_TestVecPing, samples,SYS_FOREVER); for (i = 0; i<48; i = _sadd(i,1)) { if (i%6 == 0) { upsamples[i] = samples[i/6]; } else { upsamples[i] = 0; } } fir2((DATA*)upsamples, (DATA*)interpFilt, (DATA*)&g_audioBuffer[PING_START], (DATA*)testVecDelayLine, 48, INTERPFILT_SIZE); } }