2 * fw/descr.c - USB descriptors
4 * Written 2008-2011, 2014 by Werner Almesberger
5 * Copyright 2008-2011, 2014 Werner Almesberger
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
19 #define LE(x) ((uint16_t) (x) & 0xff), ((uint16_t) (x) >> 8)
25 const uint8_t device_descriptor[18] = {
27 USB_DT_DEVICE, /* bDescriptorType */
28 LE(0x200), /* bcdUSB */
29 USB_CLASS_VENDOR_SPEC, /* bDeviceClass */
30 0x00, /* bDeviceSubClass */
31 0x00, /* bDeviceProtocol */
32 EP0_SIZE, /* bMaxPacketSize */
33 LE(USB_VENDOR), /* idVendor */
34 LE(USB_PRODUCT), /* idProduct */
35 LE(0x0001), /* bcdDevice */
36 0, /* iManufacturer */
38 #ifdef HAS_BOARD_SERNUM
39 1, /* iSerialNumber */
41 0, /* iSerialNumber */
43 1 /* bNumConfigurations */
50 * We're always bus-powered.
53 const uint8_t config_descriptor[] = {
55 USB_DT_CONFIG, /* bDescriptorType */
57 LE(9+9+7+7), /* wTotalLength */
59 LE(9+9+7+9), /* wTotalLength */
61 2, /* bNumInterfaces */
62 1, /* bConfigurationValue (> 0 !) */
63 0, /* iConfiguration */
64 USB_ATTR_BUS_POWERED, /* bmAttributes */
65 ((BOARD_MAX_mA)+1)/2, /* bMaxPower */
70 USB_DT_INTERFACE, /* bDescriptorType */
71 0, /* bInterfaceNumber */
72 0, /* bAlternateSetting */
73 1, /* bNumEndpoints */
74 USB_CLASS_VENDOR_SPEC, /* bInterfaceClass */
75 0, /* bInterfaceSubClass */
76 0, /* bInterfaceProtocol */
83 USB_DT_ENDPOINT, /* bDescriptorType */
84 0x01, /* bEndPointAddress */
85 0x02, /* bmAttributes (bulk) */
86 LE(EP1_SIZE), /* wMaxPacketSize */
94 USB_DT_ENDPOINT, /* bDescriptorType */
95 0x81, /* bEndPointAddress */
96 0x02, /* bmAttributes (bulk) */
97 LE(EP1_SIZE), /* wMaxPacketSize */
103 DFU_ITF_DESCR(1, 0, dfu_proto_runtime, 0)