Example #1
0
/******************************************************************************
 *   @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)
 *****************************************************************************/
static void AUDIO_TIMER_ISR(void)
{
#if (defined BSP_TWRMCF51JE)||(defined BSP_TWRMCF51MM)||(defined BSP_MCF51JMEVB)
   ClearCmtInterrupt();
#elif (defined BSP_TWRMCF51JF)
   ClearFTMInterrupt(AUDIO_TIMER);
#else
   _pit_clear_int(AUDIO_TIMER);
#endif
   if (USB_APP_DATA_RECEIVED_EVENT_MASK == app_event.VALUE)
   {
      *duty = audio_data_buff0[audio_sample];  
      audio_sample += AUDIO_DATA_SIZE/8;
      if (AUDIO_DATA_SIZE < (audio_sample + 1))
      {
         audio_sample = 0;
         if (MQX_OK != _lwevent_clear(&app_event, USB_APP_DATA_RECEIVED_EVENT_MASK)) {
            printf("\n_lwevent_clear app_event failed.\n");
            _task_block();
         }
      }
   }
#if (defined BSP_TWR_K40X256) || (defined BSP_TWR_K60N512) || (defined BSP_TWR_K53N512) || (defined BSP_KWIKSTIK_K40X256)
   PIT_TCTRL_REG(PIT_BASE_PTR,1)|= PIT_TCTRL_TIE_MASK;
#endif
}
Example #2
0
/******************************************************************************
 *   @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
}
Example #3
0
void _bsp_timer_isr
   (
      void   *dummy
   )
{ /* Body */

   // Acknowlege the interrupt to clear it
   _pit_clear_int(BSP_TIMER);

   _time_notify_kernel();

} /* Endbody */