//***************************************************************************** // // This function handles callbacks for the interrupt IN endpoint. // //***************************************************************************** static void HIDIntINCallback(unsigned long ulPipe, unsigned long ulEvent) { switch (ulEvent) { // // Handles a request to schedule a new request on the interrupt IN // pipe. // case USB_EVENT_SCHEDULER: { USBHCDPipeSchedule(ulPipe, 0, 1); break; } // // Called when new data is available on the interrupt IN pipe. // case USB_EVENT_RX_AVAILABLE: { // // Send the report data to the USB host HID device class driver. // g_HIDDevice.pfnCallback((void *)g_HIDDevice.ulCBData, USB_EVENT_RX_AVAILABLE, ulPipe, 0); break; } } }
static void USBHCDCInterruptCallback(uint32_t ulPipe, uint32_t ulEvent) { uint32_t ulSize; // // Handles a request to schedule a new request on the interrupt IN // pipe. // if(ulEvent == USB_EVENT_SCHEDULER) { USBHCDPipeSchedule(ulPipe, SchedulePipeInterruptBuffer, 100); } // // Called when new data is available on the interrupt IN pipe. // if(ulEvent == USB_EVENT_RX_AVAILABLE) { // // If the callback exists then call it. // if(g_USBHCDCDevice.pfnCallback != 0) { // // Read the Data out. // ulSize = USBHCDPipeReadNonBlocking(ulPipe, SchedulePipeInterruptBuffer, 100); // // Call // g_USBHCDCDevice.pfnCallback(&g_USBHCDCDevice, CDC_EVENT_INTERRUPT, (void*)SchedulePipeInterruptBuffer, ulSize); // // Schedule another read // USBHCDPipeSchedule(ulPipe, SchedulePipeInterruptBuffer, 100); //UARTprintf("USBHCDCInterruptCallback\n\r"); } } }
//***************************************************************************** // // This function handles callbacks for the interrupt IN endpoint for the hub // device. // //***************************************************************************** static void HubIntINCallback(uint32_t ui32Pipe, uint32_t ui32Event) { switch (ui32Event) { // // Handles a request to schedule a new request on the interrupt IN // pipe. // case USB_EVENT_SCHEDULER: { // // Set things up to read the next change indication from the hub. // USBHCDPipeSchedule(ui32Pipe, (uint8_t *)&g_ui32HubChanges, (uint32_t)g_sRootHub.ui8ReportSize); break; } // // Called when new data is available on the interrupt IN pipe. // case USB_EVENT_RX_AVAILABLE: { // // For data transfers on INT IN endpoints, we need to acknowledge // the data from this callback. // USBHCDPipeDataAck(ui32Pipe); // // Update our global "ports needing service" flags with the latest // information we have just received. // g_ui32ChangeFlags |= g_ui32HubChanges; // // Send the report data to the USB host hub device class driver if // we have been given a callback function. // if(g_sRootHub.pfnCallback) { g_sRootHub.pfnCallback((void *)g_sRootHub.ui32CBData, USB_EVENT_RX_AVAILABLE, ui32Pipe, &g_ui32HubChanges); } break; } case USB_EVENT_ERROR: { break; } } }
//***************************************************************************** // // This function handles callbacks for the interrupt IN endpoint. // //***************************************************************************** static void HIDIntINCallback(unsigned long ulPipe, unsigned long ulEvent) { long lDev; switch (ulEvent) { // // Handles a request to schedule a new request on the interrupt IN // pipe. // case USB_EVENT_SCHEDULER: { USBHCDPipeSchedule(ulPipe, 0, 1); break; } // // Called when new data is available on the interrupt IN pipe. // case USB_EVENT_RX_AVAILABLE: { // // Determine which device this notification is intended for. // for(lDev = 0; lDev < MAX_HID_DEVICES; lDev++) { // // Does this device own the pipe we've been passed? // if(g_pHIDDevice[lDev].ulIntInPipe == ulPipe) { // // Yes - send the report data to the USB host HID device // class driver. // g_pHIDDevice[lDev].pfnCallback( (void *)g_pHIDDevice[lDev].ulCBData, USB_EVENT_RX_AVAILABLE, ulPipe, 0); } } break; } } }