Root/atusb/fw/descr.c

Source at commit 0db361d49da04eef1f4dd77996450d54e900e083 created 8 years 8 months ago.
By Werner Almesberger, atusb/fw/Makefile (dfu): pass transfer size to hide DFU non-compliance
1/*
2 * fw/descr.c - USB descriptors
3 *
4 * Written 2008-2011 by Werner Almesberger
5 * Copyright 2008-2011 Werner Almesberger
6 *
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.
11 */
12
13
14#include "usb.h"
15#include "board.h"
16
17
18#define LE(x) ((uint16_t) (x) & 0xff), ((uint16_t) (x) >> 8)
19
20/*
21 * Device descriptor
22 */
23
24const uint8_t device_descriptor[18] = {
25    18, /* bLength */
26    USB_DT_DEVICE, /* bDescriptorType */
27    LE(0x200), /* bcdUSB */
28    USB_CLASS_VENDOR_SPEC, /* bDeviceClass */
29    0x00, /* bDeviceSubClass */
30    0x00, /* bDeviceProtocol */
31    EP0_SIZE, /* bMaxPacketSize */
32    LE(USB_VENDOR), /* idVendor */
33    LE(USB_PRODUCT), /* idProduct */
34    LE(0x0001), /* bcdDevice */
35    0, /* iManufacturer */
36    0, /* iProduct */
37    0, /* iSerialNumber */
38    1 /* bNumConfigurations */
39};
40
41
42/*
43 * Our configuration
44 *
45 * We're always bus-powered.
46 */
47
48const uint8_t config_descriptor[] = {
49    9, /* bLength */
50    USB_DT_CONFIG, /* bDescriptorType */
51#if 0
52    LE(9+9+7+7), /* wTotalLength */
53#else
54    LE(9+9), /* wTotalLength */
55#endif
56    1, /* bNumInterfaces */
57    1, /* bConfigurationValue (> 0 !) */
58    0, /* iConfiguration */
59    USB_ATTR_BUS_POWERED, /* bmAttributes */
60    50/2, /* bMaxPower (50 mA) */
61
62    /* Interface #0 */
63
64    9, /* bLength */
65    USB_DT_INTERFACE, /* bDescriptorType */
66    0, /* bInterfaceNumber */
67    0, /* bAlternateSetting */
68#if 0
69    2, /* bNumEndpoints */
70#else
71    0,
72#endif
73    USB_CLASS_VENDOR_SPEC, /* bInterfaceClass */
74    0, /* bInterfaceSubClass */
75    0, /* bInterfaceProtocol */
76    0, /* iInterface */
77
78#if 0
79    /* EP OUT */
80
81    7, /* bLength */
82    USB_DT_ENDPOINT, /* bDescriptorType */
83    0x01, /* bEndPointAddress */
84    0x02, /* bmAttributes (bulk) */
85    LE(EP1_SIZE), /* wMaxPacketSize */
86    0, /* bInterval */
87
88    /* EP IN */
89
90    7, /* bLength */
91    USB_DT_ENDPOINT, /* bDescriptorType */
92    0x81, /* bEndPointAddress */
93    0x02, /* bmAttributes (bulk) */
94    LE(EP1_SIZE), /* wMaxPacketSize */
95    0, /* bInterval */
96#endif
97};
98

Archive Download this file



interactive