Пример #1
0
/**
 * Handles CDC-specific SETUP requests. Should be called from a
 * re-implementation of USBDCallbacks_RequestReceived() method.
 * \param request Pointer to a USBGenericRequest instance.
 */
uint32_t CDCDSerial_RequestHandler(const USBGenericRequest *request)
{
    CDCDSerialPort * pCdcd = &cdcdSerial;

    TRACE_INFO_WP("Cdcf ");
    return CDCDSerialPort_RequestHandler(pCdcd, request);
}
Пример #2
0
/**
 * Handles composite-specific USB requests sent by the host, and forwards
 * standard ones to the USB device driver.
 * \param request Pointer to a USBGenericRequest instance.
 */
void DUALCDCDDriver_RequestHandler(const USBGenericRequest *request)
{
    CDCDSerialPort *pCdcd = 0;
    USBDDriver *pUsbd = 0;
    uint32_t rc, i;

    TRACE_INFO_WP("NewReq ");

    for (i = 0; i < NUM_PORTS; i ++) {
        pCdcd = &dualcdcdDriver.cdcdSerialPort[i];
        rc = CDCDSerialPort_RequestHandler(pCdcd, request);
        if (rc == USBRC_SUCCESS)
            break;
    }

    /* Not handled by CDC Serial */
    if (rc != USBRC_SUCCESS) {
        if (USBGenericRequest_GetType(request) == USBGenericRequest_STANDARD) {
            pUsbd = pCdcd->pUsbd;
            USBDDriver_RequestHandler(pUsbd, request);
        }
        else {
            TRACE_WARNING(
              "DUALCDCDDriver_RequestHandler: Unsupported request (%d,%d)\n\r",
              USBGenericRequest_GetType(request),
              USBGenericRequest_GetRequest(request));
            USBD_Stall(0);
        }
    }

}