/****************************************************************************** * @name AUDIO_TIMER_ISR * * @brief This routine services RTC Interrupt * * @param None * * @return None * ****************************************************************************** * Services Programmable Interrupt Timer 0. If a Timer Object expires, then * removes the object from Timer Queue and Calls the callback function * (if registered) *****************************************************************************/ static void AUDIO_TIMER_ISR(void) { _audio_clear_int(AUDIO_TIMER); if (USB_DEVICE_INTERFACED == audio_stream.DEV_STATE) { /* the attached device is microphone */ if(OUT_DEVICE == device_direction) { /* Recv data */ usb_audio_recv_data( (CLASS_CALL_STRUCT_PTR)&audio_control.CLASS_INTF, (CLASS_CALL_STRUCT_PTR)&audio_stream.CLASS_INTF, usb_host_audio_tr_callback, NULL, packet_size, (uchar_ptr)wav_recv_buff ); } } #if (defined BSP_TWR_K40X256) || (defined BSP_TWR_K60N512) ||\ (defined BSP_TWR_K53N512) || (defined BSP_TWR_K70F120M) ||\ (defined BSP_KWIKSTIK_K40X256) || (defined BSP_TWR_K60F120M) (defined BSP_TWR_K60D100M) /* Enable PIT interrupt neeed due to errata on Kinetis PIT */ PIT_TCTRL_REG(PIT_BASE_PTR,AUDIO_TIMER) |= PIT_TCTRL_TIE_MASK; #endif }
/****************************************************************************** * @name PIT0_ISR * * @brief This routine services RTC Interrupt * * @param None * * @return None * ****************************************************************************** * Services Programmable Interrupt Timer 0. If a Timer Object expires, then * removes the object from Timer Queue and Calls the callback function * (if registered) *****************************************************************************/ void AUDIO_TIMER_ISR(void) { #if (defined BSP_M52259DEMO) || (defined BSP_M52259EVB) || (defined BSP_TWRMCF52259) || ((defined BSP_M52223EVB))\ || (defined BSP_TWRMCF54418) _pit_clear_int(BSP_LAST_TIMER); #endif #if(defined BSP_TWRMCF51JE)||(defined BSP_TWRMCF51MM)||(defined BSP_MCF51JMEVB) ClearCmtInterrupt(); #endif #if (defined BSP_TWRMCF51JF) ClearFTM0Interrupt(); #endif #if (defined BSP_TWR_K40X256) || (defined BSP_TWR_K60N512) || (defined BSP_TWR_K53N512) _kinetis_timer_clear_int(BSP_LAST_TIMER); #endif if (USB_DEVICE_INTERFACED == audio_stream.DEV_STATE) { /* Check device type */ if(IN_DEVICE == device_direction) { /* For speaker */ /* Send data */ usb_audio_send_data((CLASS_CALL_STRUCT_PTR)&audio_control.CLASS_INTF, (CLASS_CALL_STRUCT_PTR)&audio_stream.CLASS_INTF, usb_host_audio_tr_callback, NULL, packet_size, (uchar_ptr)wav_buff); } else { /* For microphone */ if((packet_size-1) < audio_sample) { audio_sample = 0; /* Recv data */ usb_audio_recv_data((CLASS_CALL_STRUCT_PTR)&audio_control.CLASS_INTF, (CLASS_CALL_STRUCT_PTR)&audio_stream.CLASS_INTF, usb_host_audio_tr_callback, NULL, packet_size*resolution_size, (uchar_ptr)wav_recv_buff); } else { /* Check packet is sent completely */ if(trCallBack) { trCallBack=FALSE; /* update duty */ *duty = wav_recv_buff_tmp[audio_sample]; } } audio_sample+=sample_out; } } #if (defined BSP_TWR_K40X256) || (defined BSP_TWR_K60N512) || (defined BSP_TWR_K53N512) /* Enable PIT interrupt neeed due to errata on Kinetis PIT */ PIT_TCTRL_REG(PIT_BASE_PTR,1)|= PIT_TCTRL_TIE_MASK; #endif }