forked from PAWPAW-Mirror/lib_xua
Tidy
This commit is contained in:
@@ -53,27 +53,27 @@ unsigned char DFUdevDesc[] = {
|
||||
};
|
||||
|
||||
unsigned char DFUcfgDesc[] = {
|
||||
/* Standard USB device descriptor */
|
||||
0x09, /* 0 bLength */
|
||||
CONFIGURATION, /* 1 bDescriptorType */
|
||||
0x1b, /* 2 wTotalLength */
|
||||
0x00, /* 3 wTotalLength */
|
||||
1, /* 4 bNumInterface: Number of interfaces*/
|
||||
0x01, /* 5 bConfigurationValue */
|
||||
0x00, /* 6 iConfiguration */
|
||||
0xC0, /* 7 bmAttributes */
|
||||
0x32, /* 8 bMaxPower */
|
||||
/* Standard USB device descriptor */
|
||||
0x09, /* 0 bLength */
|
||||
USB_CONFIGURATION, /* 1 bDescriptorType */
|
||||
0x1b, /* 2 wTotalLength */
|
||||
0x00, /* 3 wTotalLength */
|
||||
1, /* 4 bNumInterface: Number of interfaces*/
|
||||
0x01, /* 5 bConfigurationValue */
|
||||
0x00, /* 6 iConfiguration */
|
||||
0xC0, /* 7 bmAttributes */
|
||||
0x32, /* 8 bMaxPower */
|
||||
|
||||
/* Standard DFU class interface descriptor */
|
||||
0x09, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */
|
||||
0x04, /* 1 bDescriptorType : INTERFACE descriptor. (field size 1 bytes) */
|
||||
0x00, /* 2 bInterfaceNumber : Index of this interface. (field size 1 bytes) */
|
||||
0x00, /* 3 bAlternateSetting : Index of this setting. (field size 1 bytes) */
|
||||
0x00, /* 4 bNumEndpoints : 0 endpoints. (field size 1 bytes) */
|
||||
0xFE, /* 5 bInterfaceClass : AUDIO. (field size 1 bytes) */
|
||||
0x01, /* 6 bInterfaceSubclass : AUDIO_CONTROL. (field size 1 bytes) */
|
||||
0x02, /* 7 bInterfaceProtocol : Unused. (field size 1 bytes) */
|
||||
0x00, /* 8 iInterface : Unused. (field size 1 bytes) */
|
||||
0x09, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */
|
||||
0x04, /* 1 bDescriptorType : INTERFACE descriptor. (field size 1 bytes) */
|
||||
0x00, /* 2 bInterfaceNumber : Index of this interface. (field size 1 bytes) */
|
||||
0x00, /* 3 bAlternateSetting : Index of this setting. (field size 1 bytes) */
|
||||
0x00, /* 4 bNumEndpoints : 0 endpoints. (field size 1 bytes) */
|
||||
0xFE, /* 5 bInterfaceClass : AUDIO. (field size 1 bytes) */
|
||||
0x01, /* 6 bInterfaceSubclass : AUDIO_CONTROL. (field size 1 bytes) */
|
||||
0x02, /* 7 bInterfaceProtocol : Unused. (field size 1 bytes) */
|
||||
0x00, /* 8 iInterface : Unused. (field size 1 bytes) */
|
||||
|
||||
#if 0
|
||||
/* DFU 1.0 Standard DFU class functional descriptor */
|
||||
@@ -86,72 +86,22 @@ unsigned char DFUcfgDesc[] = {
|
||||
0x00
|
||||
#else
|
||||
/* DFU 1.1 Run-Time DFU Functional Descriptor */
|
||||
0x09, /* 0 Size */
|
||||
0x21, /* 1 bDescriptorType : DFU FUNCTIONAL */
|
||||
0x07, /* 2 bmAttributes */
|
||||
0xFA, /* 3 wDetachTimeOut */
|
||||
0x00, /* 4 wDetachTimeOut */
|
||||
0x40, /* 5 wTransferSize */
|
||||
0x00, /* 6 wTransferSize */
|
||||
0x10, /* 7 bcdDFUVersion */
|
||||
0x01, /* 7 bcdDFUVersion */
|
||||
0x09, /* 0 Size */
|
||||
0x21, /* 1 bDescriptorType : DFU FUNCTIONAL */
|
||||
0x07, /* 2 bmAttributes */
|
||||
0xFA, /* 3 wDetachTimeOut */
|
||||
0x00, /* 4 wDetachTimeOut */
|
||||
0x40, /* 5 wTransferSize */
|
||||
0x00, /* 6 wTransferSize */
|
||||
0x10, /* 7 bcdDFUVersion */
|
||||
0x01, /* 7 bcdDFUVersion */
|
||||
#endif
|
||||
|
||||
|
||||
};
|
||||
|
||||
unsigned char DFUoSpeedCfgDesc[] =
|
||||
{
|
||||
/* Standard USB device descriptor */
|
||||
0x09, /* 0 bLength */
|
||||
OTHER_SPEED_CONFIGURATION, /* 1 bDescriptorType */
|
||||
0x1b, /* 2 wTotalLength */
|
||||
0x00, /* 3 wTotalLength */
|
||||
1, /* 4 bNumInterface: Number of interfaces*/
|
||||
0x01, /* 5 bConfigurationValue */
|
||||
0x00, /* 6 iConfiguration */
|
||||
0xC0, /* 7 bmAttributes */
|
||||
0x32, /* 8 bMaxPower */
|
||||
|
||||
/* Standard DFU class interface descriptor */
|
||||
0x09, /* 0 bLength : Size of this descriptor, in bytes. (field size 1 bytes) */
|
||||
0x04, /* 1 bDescriptorType : INTERFACE descriptor. (field size 1 bytes) */
|
||||
0x00, /* 2 bInterfaceNumber : Index of this interface. (field size 1 bytes) */
|
||||
0x00, /* 3 bAlternateSetting : Index of this setting. (field size 1 bytes) */
|
||||
0x00, /* 4 bNumEndpoints : 0 endpoints. (field size 1 bytes) */
|
||||
0xFE, /* 5 bInterfaceClass : AUDIO. (field size 1 bytes) */
|
||||
0x01, /* 6 bInterfaceSubclass : AUDIO_CONTROL. (field size 1 bytes) */
|
||||
0x02, /* 7 bInterfaceProtocol : Unused. (field size 1 bytes) */
|
||||
0x00, /* 8 iInterface : Unused. (field size 1 bytes) */
|
||||
|
||||
/* DFU 1.1 Run-Time DFU Functional Descriptor */
|
||||
0x09, /* 0 Size */
|
||||
0x21, /* 1 bDescriptorType : DFU FUNCTIONAL */
|
||||
0x07, /* 2 bmAttributes */
|
||||
0xFA, /* 3 wDetachTimeOut */
|
||||
0x00, /* 4 wDetachTimeOut */
|
||||
0x40, /* 5 wTransferSize */
|
||||
0x00, /* 6 wTransferSize */
|
||||
0x10, /* 7 bcdDFUVersion */
|
||||
0x01, /* 7 bcdDFUVersion */
|
||||
};
|
||||
|
||||
unsigned char DFUdevQualDesc[] =
|
||||
{
|
||||
10, /* 0 bLength : Size of descriptor in Bytes (18 Bytes) */
|
||||
DEVICE_QUALIFIER, /* 1 bdescriptorType */
|
||||
0, /* 2 bcdUSB */
|
||||
2, /* 3 bcdUSB */
|
||||
0xfe, /* 4 bDeviceClass */
|
||||
1, /* 5 bDeviceSubClass */
|
||||
0, /* 6 bDeviceProtocol */
|
||||
64, /* 7 bMaxPacketSize */
|
||||
0x01, /* 8 bNumConfigurations : Number of possible configs */ \
|
||||
0x00 /* 9 bReserved (must be zero) */ \
|
||||
};
|
||||
|
||||
int DFUReportResetState(chanend ?c_user_cmd);
|
||||
int DFUDeviceRequests(XUD_ep c_ep0_out, XUD_ep &?ep0_in, SetupPacket &sp, chanend ?c_user_cmd, unsigned int altInterface, unsigned int user_reset);
|
||||
int DFUDeviceRequests(XUD_ep c_ep0_out, XUD_ep &?ep0_in, USB_SetupPacket_t &sp, chanend ?c_user_cmd, unsigned int altInterface, unsigned int user_reset);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -390,14 +390,14 @@ int XMOS_DFU_LoadState()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DFUDeviceRequests(XUD_ep ep0_out, XUD_ep &?ep0_in, SetupPacket &sp, chanend ?c_user_cmd, unsigned int altInterface, unsigned int user_reset)
|
||||
int DFUDeviceRequests(XUD_ep ep0_out, XUD_ep &?ep0_in, USB_SetupPacket_t &sp, chanend ?c_user_cmd, unsigned int altInterface, unsigned int user_reset)
|
||||
{
|
||||
unsigned int return_data_len = 0;
|
||||
unsigned int data_buffer_len = 0;
|
||||
unsigned int data_buffer[17];
|
||||
unsigned int reset_device_after_ack = 0;
|
||||
|
||||
if(sp.bmRequestType.Direction == BM_REQTYPE_DIRECTION_OUT)
|
||||
if(sp.bmRequestType.Direction == USB_BM_REQTYPE_DIRECTION_H2D)
|
||||
{
|
||||
// Host to device
|
||||
if (sp.wLength)
|
||||
@@ -465,7 +465,7 @@ int DFUDeviceRequests(XUD_ep ep0_out, XUD_ep &?ep0_in, SetupPacket &sp, chanend
|
||||
break;
|
||||
}
|
||||
|
||||
if (sp.bmRequestType.Direction == BM_REQTYPE_DIRECTION_IN && sp.wLength != 0)
|
||||
if (sp.bmRequestType.Direction == USB_BM_REQTYPE_DIRECTION_D2H && sp.wLength != 0)
|
||||
{
|
||||
// Device to host
|
||||
#ifdef ARCH_G
|
||||
@@ -477,9 +477,9 @@ int DFUDeviceRequests(XUD_ep ep0_out, XUD_ep &?ep0_in, SetupPacket &sp, chanend
|
||||
else
|
||||
{
|
||||
#ifdef ARCH_G
|
||||
XUD_DoSetRequestStatus(ep0_out, 0);
|
||||
XUD_DoSetRequestStatus(ep0_out);
|
||||
#else
|
||||
XUD_DoSetRequestStatus(ep0_in, 0);
|
||||
XUD_DoSetRequestStatus(ep0_in);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user