sanguino/firmwares/arduino-usbdfu/Descriptors.h

Fri, 17 Nov 2017 10:13:31 +0100

author
mdd
date
Fri, 17 Nov 2017 10:13:31 +0100
changeset 3
770b218a4931
parent 2
b373b0288715
permissions
-rw-r--r--

proper configuration, homing and planner optimization

2
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
1 /*
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
2 LUFA Library
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
3 Copyright (C) Dean Camera, 2010.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
4
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
5 dean [at] fourwalledcubicle [dot] com
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
6 www.fourwalledcubicle.com
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
7 */
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
8
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
9 /*
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
10 Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
11
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
12 Permission to use, copy, modify, distribute, and sell this
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
13 software and its documentation for any purpose is hereby granted
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
14 without fee, provided that the above copyright notice appear in
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
15 all copies and that both that the copyright notice and this
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
16 permission notice and warranty disclaimer appear in supporting
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
17 documentation, and that the name of the author not be used in
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
18 advertising or publicity pertaining to distribution of the
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
19 software without specific, written prior permission.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
20
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
21 The author disclaim all warranties with regard to this
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
22 software, including all implied warranties of merchantability
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
23 and fitness. In no event shall the author be liable for any
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
24 special, indirect or consequential damages or any damages
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
25 whatsoever resulting from loss of use, data or profits, whether
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
26 in an action of contract, negligence or other tortious action,
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
27 arising out of or in connection with the use or performance of
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
28 this software.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
29 */
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
30
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
31 /** \file
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
32 *
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
33 * Header file for Descriptors.c.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
34 */
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
35
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
36 #ifndef _DESCRIPTORS_H_
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
37 #define _DESCRIPTORS_H_
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
38
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
39 /* Includes: */
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
40 #include <LUFA/Drivers/USB/USB.h>
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
41
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
42 /* Product-specific definitions: */
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
43 #define ARDUINO_UNO_PID 0x0001
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
44 #define ARDUINO_MEGA2560_PID 0x0010
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
45
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
46 /* Macros: */
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
47 /** Descriptor type value for a DFU class functional descriptor. */
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
48 #define DTYPE_DFUFunctional 0x21
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
49
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
50 /** DFU attribute mask, indicating that the DFU device will detach and re-attach when a DFU_DETACH
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
51 * command is issued, rather than the host issuing a USB Reset.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
52 */
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
53 #define ATTR_WILL_DETATCH (1 << 3)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
54
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
55 /** DFU attribute mask, indicating that the DFU device can communicate during the manifestation phase
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
56 * (memory programming phase).
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
57 */
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
58 #define ATTR_MANEFESTATION_TOLLERANT (1 << 2)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
59
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
60 /** DFU attribute mask, indicating that the DFU device can accept DFU_UPLOAD requests to send data from
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
61 * the device to the host.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
62 */
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
63 #define ATTR_CAN_UPLOAD (1 << 1)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
64
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
65 /** DFU attribute mask, indicating that the DFU device can accept DFU_DNLOAD requests to send data from
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
66 * the host to the device.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
67 */
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
68 #define ATTR_CAN_DOWNLOAD (1 << 0)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
69
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
70 #if defined(__AVR_AT90USB1287__)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
71 #define PRODUCT_ID_CODE 0x2FFB
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
72 #define AVR_SIGNATURE_1 0x1E
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
73 #define AVR_SIGNATURE_2 0x97
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
74 #define AVR_SIGNATURE_3 0x82
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
75 #elif defined(__AVR_AT90USB1286__)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
76 #define PRODUCT_ID_CODE 0x2FFB
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
77 #define AVR_SIGNATURE_1 0x1E
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
78 #define AVR_SIGNATURE_2 0x97
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
79 #define AVR_SIGNATURE_3 0x82
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
80 #elif defined(__AVR_AT90USB647__)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
81 #define PRODUCT_ID_CODE 0x2FF9
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
82 #define AVR_SIGNATURE_1 0x1E
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
83 #define AVR_SIGNATURE_2 0x96
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
84 #define AVR_SIGNATURE_3 0x82
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
85 #elif defined(__AVR_AT90USB646__)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
86 #define PRODUCT_ID_CODE 0x2FF9
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
87 #define AVR_SIGNATURE_1 0x1E
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
88 #define AVR_SIGNATURE_2 0x96
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
89 #define AVR_SIGNATURE_3 0x82
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
90 #elif defined(__AVR_ATmega32U6__)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
91 #define PRODUCT_ID_CODE 0x2FFB
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
92 #define AVR_SIGNATURE_1 0x1E
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
93 #define AVR_SIGNATURE_2 0x95
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
94 #define AVR_SIGNATURE_3 0x88
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
95 #elif defined(__AVR_ATmega32U4__)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
96 #define PRODUCT_ID_CODE 0x2FF4
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
97 #define AVR_SIGNATURE_1 0x1E
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
98 #define AVR_SIGNATURE_2 0x95
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
99 #define AVR_SIGNATURE_3 0x87
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
100 #elif defined(__AVR_ATmega32U2__)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
101 #define PRODUCT_ID_CODE 0x2FF0
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
102 #define AVR_SIGNATURE_1 0x1E
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
103 #define AVR_SIGNATURE_2 0x95
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
104 #define AVR_SIGNATURE_3 0x8A
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
105 #elif defined(__AVR_ATmega16U4__)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
106 #define PRODUCT_ID_CODE 0x2FF3
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
107 #define AVR_SIGNATURE_1 0x1E
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
108 #define AVR_SIGNATURE_2 0x94
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
109 #define AVR_SIGNATURE_3 0x88
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
110 #elif defined(__AVR_ATmega16U2__)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
111 #define PRODUCT_ID_CODE 0x2FEF
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
112 #define AVR_SIGNATURE_1 0x1E
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
113 #define AVR_SIGNATURE_2 0x94
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
114 #define AVR_SIGNATURE_3 0x89
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
115 #elif defined(__AVR_AT90USB162__)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
116 #define PRODUCT_ID_CODE 0x2FFA
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
117 #define AVR_SIGNATURE_1 0x1E
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
118 #define AVR_SIGNATURE_2 0x94
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
119 #define AVR_SIGNATURE_3 0x82
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
120 #elif defined(__AVR_AT90USB82__)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
121 #define PRODUCT_ID_CODE 0x2FEE
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
122 #define AVR_SIGNATURE_1 0x1E
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
123 #define AVR_SIGNATURE_2 0x93
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
124 #define AVR_SIGNATURE_3 0x89
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
125 #elif defined(__AVR_ATmega8U2__)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
126 #define PRODUCT_ID_CODE 0x2FF7
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
127 #define AVR_SIGNATURE_1 0x1E
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
128 #define AVR_SIGNATURE_2 0x93
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
129 #define AVR_SIGNATURE_3 0x82
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
130 #else
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
131 #error The selected AVR part is not currently supported by this bootloader.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
132 #endif
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
133
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
134 #if !defined(PRODUCT_ID_CODE)
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
135 #error Current AVR model is not supported by this bootloader.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
136 #endif
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
137
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
138 /* Type Defines: */
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
139 /** Type define for a DFU class function descriptor. This descriptor gives DFU class information
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
140 * to the host when read, indicating the DFU device's capabilities.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
141 */
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
142 typedef struct
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
143 {
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
144 USB_Descriptor_Header_t Header; /**< Standard descriptor header structure */
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
145
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
146 uint8_t Attributes; /**< DFU device attributes, a mask comprising of the
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
147 * ATTR_* macros listed in this source file
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
148 */
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
149 uint16_t DetachTimeout; /**< Timeout in milliseconds between a USB_DETACH
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
150 * command being issued and the device detaching
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
151 * from the USB bus
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
152 */
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
153 uint16_t TransferSize; /**< Maximum number of bytes the DFU device can accept
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
154 * from the host in a transaction
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
155 */
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
156 uint16_t DFUSpecification; /**< BCD packed DFU specification number this DFU
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
157 * device complies with
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
158 */
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
159 } USB_DFU_Functional_Descriptor_t;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
160
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
161 /** Type define for the device configuration descriptor structure. This must be defined in the
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
162 * application code, as the configuration descriptor contains several sub-descriptors which
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
163 * vary between devices, and which describe the device's usage to the host.
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
164 */
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
165 typedef struct
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
166 {
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
167 USB_Descriptor_Configuration_Header_t Config;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
168 USB_Descriptor_Interface_t DFU_Interface;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
169 USB_DFU_Functional_Descriptor_t DFU_Functional;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
170 } USB_Descriptor_Configuration_t;
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
171
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
172 /* Function Prototypes: */
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
173 uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
174 const uint8_t wIndex,
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
175 void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
176
b373b0288715 added missing sanguino files
mbayer
parents:
diff changeset
177 #endif

mercurial