-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathusb_descriptors.c
More file actions
80 lines (61 loc) · 1.48 KB
/
usb_descriptors.c
File metadata and controls
80 lines (61 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#ifndef USBD_TOP_H_
#define USBD_TOP_H_
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdint.h>
#include <tusb.h>
#include <device/usbd_pvt.h>
static const tusb_desc_device_t XID_DESC_DEVICE =
{
.bLength = sizeof(tusb_desc_device_t),
.bDescriptorType = TUSB_DESC_DEVICE,
.bcdUSB = 0x0110,
.bDeviceClass = 0x00,
.bDeviceSubClass = 0x00,
.bDeviceProtocol = 0x00,
.bMaxPacketSize0 = CFG_TUD_ENDPOINT0_SIZE,
.idVendor = 0x045E,
.idProduct = 0x0280,
.bcdDevice = 0x0121,
.iManufacturer = 0x00,
.iProduct = 0x00,
.iSerialNumber = 0x00,
.bNumConfigurations = 0x01
};
enum
{
ITF_NUM_MSC,
ITF_NUM_TOTAL
};
#define CONFIG_TOTAL_LEN \
(TUD_CONFIG_DESC_LEN) + \
(TUD_MSC_DESC_LEN)
static uint8_t const XID_DESC_CONFIGURATION[] =
{
// Config number, interface count, string index, total length, attribute, power in mA
TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP, 500),
#if (CFG_TUD_MSC >= 1)
TUD_MSC_DESCRIPTOR(ITF_NUM_MSC, 0, ITF_NUM_MSC + 1, 0x80 | (ITF_NUM_MSC + 1), 64),
#endif
};
uint8_t const *tud_descriptor_device_cb(void)
{
return (uint8_t const *)&XID_DESC_DEVICE;
}
uint8_t const *tud_descriptor_configuration_cb(uint8_t index)
{
(void)index;
return XID_DESC_CONFIGURATION;
}
uint16_t const *tud_descriptor_string_cb(uint8_t index, uint16_t langid)
{
(void)index;
(void)langid;
return NULL;
}
#ifdef __cplusplus
}
#endif
#endif //USBD_TOP_H_