lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | #include "global.h"
|
| 2 |
|
| 3 | __align(4) const dwc_config_all_t desc =
|
| 4 | {
|
| 5 | //T_CONFIG_DESCRIPTOR
|
| 6 | {
|
| 7 | sizeof(dwc_config_descriptor_t), //bLength
|
| 8 | CONFIG_DESCRIPTOR, //bDescriptorType
|
| 9 | sizeof(dwc_config_all_t),
|
| 10 | 2, //bNumInterfaces
|
| 11 | 1, //bConfigurationValue
|
| 12 | 0, //iConfiguration×Ö·û´®ÃèÊöµÄË÷Òý
|
| 13 | ATTR_D7 |ATTR_SELF_POWERED , //bmAttributes
|
| 14 | POWER_MA(500), //
|
| 15 | },
|
| 16 |
|
| 17 |
|
| 18 | //T_INTERFACE_DESCRIPTOR
|
| 19 | {
|
| 20 | sizeof(dwc_interface_descriptor_t), //bLength
|
| 21 | INTERFACE_DESCRIPTOR, //bDescriptorType
|
| 22 | 0, //bInterfaceNumber
|
| 23 | 0, //bAlternateSetting
|
| 24 | 0x02, //bNumEndpoints
|
| 25 | VERDOR_SPECIFIC, //bInterfaceClass
|
| 26 | 0xff, //bInterfaceSubClass
|
| 27 | 0xff, //bInterfaceProtocol
|
| 28 | 0x04, //iInterface×Ö·û´®ÃèÊöµÄË÷Òý
|
| 29 | },
|
| 30 |
|
| 31 | {
|
| 32 | sizeof(dwc_ep_descriptor_t), //bLength
|
| 33 | ENDPOINT_DESCRIPTOR, //bDescriptorType
|
| 34 | EP_ADDRESS_DIRECTION_IN |0x1, //bEndpointAddress
|
| 35 | EP_ATTR_TRANSFER_TYPE_BULK, //bmAttributes
|
| 36 | USB_HIGHSPEED_BULK_MAXSIZE, //wMaxPacketSize
|
| 37 | 0, //bInterval
|
| 38 | },
|
| 39 | {
|
| 40 | sizeof(dwc_ep_descriptor_t), //bLength
|
| 41 | ENDPOINT_DESCRIPTOR, //bDescriptorType
|
| 42 | 0x1, //bEndpointAddress
|
| 43 | EP_ATTR_TRANSFER_TYPE_BULK, //bmAttributes
|
| 44 | USB_HIGHSPEED_BULK_MAXSIZE, //wMaxPacketSize
|
| 45 | 0, //bInterval
|
| 46 | },
|
| 47 | //T_INTERFACE_DESCRIPTOR
|
| 48 | {
|
| 49 | sizeof(dwc_interface_descriptor_t), //bLength
|
| 50 | INTERFACE_DESCRIPTOR, //bDescriptorType
|
| 51 | 1, //bInterfaceNumber
|
| 52 | 0, //bAlternateSetting
|
| 53 | 0x02, //bNumEndpoints
|
| 54 | VERDOR_SPECIFIC, //bInterfaceClass
|
| 55 | 0xff, //bInterfaceSubClass
|
| 56 | 0xff, //bInterfaceProtocol
|
| 57 | 0x05, //iInterface×Ö·û´®ÃèÊöµÄË÷Òý
|
| 58 | },
|
| 59 |
|
| 60 | {
|
| 61 | sizeof(dwc_ep_descriptor_t), //bLength
|
| 62 | ENDPOINT_DESCRIPTOR, //bDescriptorType
|
| 63 | EP_ADDRESS_DIRECTION_IN |0x2, //bEndpointAddress
|
| 64 | EP_ATTR_TRANSFER_TYPE_BULK, //bmAttributes
|
| 65 | USB_HIGHSPEED_BULK_MAXSIZE, //wMaxPacketSize
|
| 66 | 0, //bInterval
|
| 67 | },
|
| 68 |
|
| 69 | {
|
| 70 | sizeof(dwc_ep_descriptor_t), //bLength
|
| 71 | ENDPOINT_DESCRIPTOR, //bDescriptorType
|
| 72 | 0x2, //bEndpointAddress
|
| 73 | EP_ATTR_TRANSFER_TYPE_BULK, //bmAttributes
|
| 74 | USB_HIGHSPEED_BULK_MAXSIZE, //wMaxPacketSize
|
| 75 | 0, //bInterval
|
| 76 | },
|
| 77 | };
|
| 78 |
|
| 79 |
|
| 80 | struct g_data global;
|
| 81 |
|
| 82 | __align(4) dwc_config_all_t g_config_desc;
|
| 83 |
|
| 84 | void data_init(void)
|
| 85 | {
|
| 86 | int i;
|
| 87 | char *src = (char*)&desc;
|
| 88 | char *dst = (char*)&g_config_desc;
|
| 89 |
|
| 90 | for(i = 0; i < sizeof(dwc_config_all_t); i++)
|
| 91 | {
|
| 92 | *dst++ = *src++;
|
| 93 | }
|
| 94 | }
|
| 95 |
|
| 96 |
|