keil_examples/USBMem/usbuser.c
/*
 *  USB Endpoint 2 Event Callback
 *   Called automatically on USB Endpoint 2 Event
 *    Parameter:       event
 */
USB Endpoint 2 Event Callback
Called automatically on USB Endpoint 2 Event
Parameter:       event
USB Endpoint 2 Event Callback Called automatically on USB Endpoint 2 Event Parameter : event
void USB_EndPoint2 (uint32_t event) {
#if USB_DMA
  USB_DMA_DESCRIPTOR DD;
#endif
  switch (event) {
    case USB_EVT_OUT:
      MSC_BulkOut();
      break;
    case USB_EVT_IN:
      MSC_BulkIn();
      break;
#if USB_DMA
    case USB_EVT_OUT_DMA_EOT: 
      MSC_BulkOut();
      break;
    case USB_EVT_OUT_DMA_NDR:                    
      DD.BufAdr  = (uint32_t)BulkBuf;            
      DD.BufLen  = MSC_MAX_PACKET;               
      DD.MaxSize = MSC_MAX_PACKET;               
      DD.Cfg.Val = 0;                            
      DD.Cfg.Type.IsoEP = 0;                     
      USB_DMA_Setup (MSC_EP_OUT, &DD);           
      USB_DMA_Enable(MSC_EP_OUT);                
      break;
    case USB_EVT_IN_DMA_NDR:                     
      MSC_BulkIn();
      break;
    case USB_EVT_IN_DMA_EOT:                     
      break;
#endif
  }
}
void USB_EndPoint2 ( uint32_t event ) { #if USB_DMA USB_DMA_DESCRIPTOR DD ; #endif switch ( event ) { case USB_EVT_OUT : MSC_BulkOut ( ) ; break ; case USB_EVT_IN : MSC_BulkIn ( ) ; break ; #if USB_DMA case USB_EVT_OUT_DMA_EOT : MSC_BulkOut ( ) ; break ; case USB_EVT_OUT_DMA_NDR : DD . BufAdr = ( uint32_t ) BulkBuf ; DD . BufLen = MSC_MAX_PACKET ; DD . MaxSize = MSC_MAX_PACKET ; DD . Cfg . Val = 0 ; DD . Cfg . Type . IsoEP = 0 ; USB_DMA_Setup ( MSC_EP_OUT , & DD ) ; USB_DMA_Enable ( MSC_EP_OUT ) ; break ; case USB_EVT_IN_DMA_NDR : MSC_BulkIn ( ) ; break ; case USB_EVT_IN_DMA_EOT : break ; #endif } }
USB Endpoint 2 Event Callback
   Called automatically on USB Endpoint 2 Event
    Parameter:       event
USB Endpoint 2 Event Callback Called automatically on USB Endpoint 2 Event Parameter : event
//      USB_DMA_Enable(MSC_EP_OUT);   /* 11.08.09  USB_DMA_Enable is not necessary at this point */ // new DMA Descriptor request // DMA Buffer Address // DMA Buffer Length in bytes // Maximum packet size // Initial DMA Configuration // Non-Iso Endpoint // Setup DMA // Enable DMA // new DMA Descriptor request // End of Transfer request  //      MSC_BulkIn();                 /* 11.08.09 MSC_BulkIn must only be called upon a DMA_NDR interrupt */