]> git.donarmstrong.com Git - kiibohd-controller.git/blob - Bootloader/dfu.desc.c
Setting bootloader max power to 100 mA
[kiibohd-controller.git] / Bootloader / dfu.desc.c
1 // Originally Generated from MCHCK Toolkit
2 /* Copyright (c) Jacob Alexander 2014-2016 <haata@kiibohd.com>
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17
18 // ----- Local Includes -----
19
20 #include "dfu.desc.h"
21
22
23
24 // ----- Generated Includes -----
25
26 #include <buildvars.h>
27
28
29
30 // ----- Structs -----
31
32 static const struct usb_config_1 usb_config_1 = {
33         .config = {
34                 .bLength = sizeof(struct usb_desc_config_t),
35                 .bDescriptorType = USB_DESC_CONFIG,
36                 .wTotalLength = sizeof(struct usb_config_1),
37                 .bNumInterfaces = 1,
38                 .bConfigurationValue = 1,
39                 .iConfiguration = 0,
40                 .one = 1,
41                 .bMaxPower = 50
42         },
43         .usb_function_0 = {
44                 .iface = {
45                         .bLength = sizeof(struct usb_desc_iface_t),
46                         .bDescriptorType = USB_DESC_IFACE,
47                         .bInterfaceNumber = 0,
48                         .bAlternateSetting = 0,
49                         .bNumEndpoints = 0,
50                         .bInterfaceClass = USB_DEV_CLASS_APP,
51                         .bInterfaceSubClass = USB_DEV_SUBCLASS_APP_DFU,
52                         .bInterfaceProtocol = USB_DEV_PROTO_DFU_DFU,
53                         .iInterface = 4
54                 },
55
56         .dfu = {
57                 .bLength = sizeof(struct dfu_desc_functional),
58                 .bDescriptorType = {
59                         .id = 0x1,
60                         .type_type = USB_DESC_TYPE_CLASS
61                 },
62                 .will_detach = 1,
63                 .manifestation_tolerant = 0,
64                 .can_upload = 0,
65                 .can_download = 1,
66                 .wDetachTimeOut = 0,
67                 .wTransferSize = USB_DFU_TRANSFER_SIZE,
68                 .bcdDFUVersion = { .maj = 1, .min = 1 }
69         }
70 },
71
72 };
73
74 static const struct usbd_config usbd_config_1 = {
75         .init = init_usb_bootloader,
76         .suspend = NULL,
77         .resume = NULL,
78         .desc = &usb_config_1.config,
79         .function = {&dfu_function},
80 };
81
82 static const struct usb_desc_dev_t dfu_device_dev_desc = {
83         .bLength = sizeof(struct usb_desc_dev_t),
84         .bDescriptorType = USB_DESC_DEV,
85         .bcdUSB = { .maj = 2 },
86         .bDeviceClass = USB_DEV_CLASS_SEE_IFACE,
87         .bDeviceSubClass = USB_DEV_SUBCLASS_SEE_IFACE,
88         .bDeviceProtocol = USB_DEV_PROTO_SEE_IFACE,
89         .bMaxPacketSize0 = EP0_BUFSIZE,
90         .idVendor = VENDOR_ID,
91         .idProduct = PRODUCT_ID,
92         .bcdDevice = { .raw = 0 },
93         .iManufacturer = 1,
94         .iProduct = 2,
95         .iSerialNumber = 3,
96         .bNumConfigurations = 1,
97 };
98
99 static const struct usb_desc_string_t * const dfu_device_str_desc[] = {
100         USB_DESC_STRING_LANG_ENUS,
101         USB_DESC_STRING(STR_MANUFACTURER),
102         USB_DESC_STRING(STR_PRODUCT),
103         USB_DESC_STRING(STR_SERIAL),
104         USB_DESC_STRING(STR_ALTNAME),
105         NULL
106 };
107
108 const struct usbd_device dfu_device = {
109         .dev_desc = &dfu_device_dev_desc,
110         .string_descs = dfu_device_str_desc,
111         .configs = {
112                 &usbd_config_1,
113                 NULL
114         }
115 };
116