void Endpoint0(chanend c_ep0_out, chanend c_ep0_in)
{
    USB_SetupPacket_t sp;
    XUD_BusSpeed_t usbBusSpeed;
    XUD_ep ep0_out = XUD_InitEp(c_ep0_out);
    XUD_ep ep0_in  = XUD_InitEp(c_ep0_in);

    while(1)
    {
        XUD_Result_t result = USB_GetSetupPacket(ep0_out, ep0_in, sp);

        if(result == XUD_RES_OKAY)
        {
            result = USB_StandardRequests(ep0_out, ep0_in,
                        devDesc_HS, sizeof(devDesc_HS),
                        cfgDesc_HS, sizeof(cfgDesc_HS),
                        devDesc_FS, sizeof(devDesc_FS),
                        cfgDesc_FS, sizeof(cfgDesc_FS),
                        stringTable, sizeof(stringTable),
                        sp, usbBusSpeed);
        }

        /* USB bus reset detected, reset EP and get new bus speed */
        if(result == XUD_RES_RST)
        {
            usbBusSpeed = XUD_ResetEndpoint(ep0_out, ep0_in);
        }
    }
}
