diff options
Diffstat (limited to 'firmware/usbstack/usb_core.c')
-rw-r--r-- | firmware/usbstack/usb_core.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c index fdfd049002..a864ac8b3a 100644 --- a/firmware/usbstack/usb_core.c +++ b/firmware/usbstack/usb_core.c | |||
@@ -58,7 +58,7 @@ | |||
58 | #define USB_SC_SCSI 0x06 /* Transparent */ | 58 | #define USB_SC_SCSI 0x06 /* Transparent */ |
59 | #define USB_PROT_BULK 0x50 /* bulk only */ | 59 | #define USB_PROT_BULK 0x50 /* bulk only */ |
60 | 60 | ||
61 | static const struct usb_device_descriptor device_descriptor= { | 61 | static const struct usb_device_descriptor __attribute__((aligned(2))) device_descriptor= { |
62 | .bLength = sizeof(struct usb_device_descriptor), | 62 | .bLength = sizeof(struct usb_device_descriptor), |
63 | .bDescriptorType = USB_DT_DEVICE, | 63 | .bDescriptorType = USB_DT_DEVICE, |
64 | #ifdef USE_HIGH_SPEED | 64 | #ifdef USE_HIGH_SPEED |
@@ -77,9 +77,9 @@ static const struct usb_device_descriptor device_descriptor= { | |||
77 | .iProduct = 2, | 77 | .iProduct = 2, |
78 | .iSerialNumber = 3, | 78 | .iSerialNumber = 3, |
79 | .bNumConfigurations = 1 | 79 | .bNumConfigurations = 1 |
80 | }; | 80 | } ; |
81 | 81 | ||
82 | struct usb_config_descriptor config_descriptor = | 82 | struct usb_config_descriptor __attribute__((aligned(2))) config_descriptor = |
83 | { | 83 | { |
84 | .bLength = sizeof(struct usb_config_descriptor), | 84 | .bLength = sizeof(struct usb_config_descriptor), |
85 | .bDescriptorType = USB_DT_CONFIG, | 85 | .bDescriptorType = USB_DT_CONFIG, |
@@ -93,7 +93,7 @@ struct usb_config_descriptor config_descriptor = | |||
93 | 93 | ||
94 | #ifdef USB_CHARGING_ONLY | 94 | #ifdef USB_CHARGING_ONLY |
95 | /* dummy interface for charging-only */ | 95 | /* dummy interface for charging-only */ |
96 | struct usb_interface_descriptor charging_interface_descriptor = | 96 | struct usb_interface_descriptor __attribute__((aligned(2))) charging_interface_descriptor = |
97 | { | 97 | { |
98 | .bLength = sizeof(struct usb_interface_descriptor), | 98 | .bLength = sizeof(struct usb_interface_descriptor), |
99 | .bDescriptorType = USB_DT_INTERFACE, | 99 | .bDescriptorType = USB_DT_INTERFACE, |
@@ -109,7 +109,7 @@ struct usb_interface_descriptor charging_interface_descriptor = | |||
109 | 109 | ||
110 | #ifdef USB_STORAGE | 110 | #ifdef USB_STORAGE |
111 | /* storage interface */ | 111 | /* storage interface */ |
112 | struct usb_interface_descriptor mass_storage_interface_descriptor = | 112 | struct usb_interface_descriptor __attribute__((aligned(2))) mass_storage_interface_descriptor = |
113 | { | 113 | { |
114 | .bLength = sizeof(struct usb_interface_descriptor), | 114 | .bLength = sizeof(struct usb_interface_descriptor), |
115 | .bDescriptorType = USB_DT_INTERFACE, | 115 | .bDescriptorType = USB_DT_INTERFACE, |
@@ -122,7 +122,7 @@ struct usb_interface_descriptor mass_storage_interface_descriptor = | |||
122 | .iInterface = 0 | 122 | .iInterface = 0 |
123 | }; | 123 | }; |
124 | 124 | ||
125 | struct usb_endpoint_descriptor mass_storage_ep_in_descriptor = | 125 | struct usb_endpoint_descriptor __attribute__((aligned(2))) mass_storage_ep_in_descriptor = |
126 | { | 126 | { |
127 | .bLength = sizeof(struct usb_endpoint_descriptor), | 127 | .bLength = sizeof(struct usb_endpoint_descriptor), |
128 | .bDescriptorType = USB_DT_ENDPOINT, | 128 | .bDescriptorType = USB_DT_ENDPOINT, |
@@ -131,7 +131,7 @@ struct usb_endpoint_descriptor mass_storage_ep_in_descriptor = | |||
131 | .wMaxPacketSize = 16, | 131 | .wMaxPacketSize = 16, |
132 | .bInterval = 0 | 132 | .bInterval = 0 |
133 | }; | 133 | }; |
134 | struct usb_endpoint_descriptor mass_storage_ep_out_descriptor = | 134 | struct usb_endpoint_descriptor __attribute__((aligned(2))) mass_storage_ep_out_descriptor = |
135 | { | 135 | { |
136 | .bLength = sizeof(struct usb_endpoint_descriptor), | 136 | .bLength = sizeof(struct usb_endpoint_descriptor), |
137 | .bDescriptorType = USB_DT_ENDPOINT, | 137 | .bDescriptorType = USB_DT_ENDPOINT, |
@@ -144,7 +144,7 @@ struct usb_endpoint_descriptor mass_storage_ep_out_descriptor = | |||
144 | 144 | ||
145 | #ifdef USB_SERIAL | 145 | #ifdef USB_SERIAL |
146 | /* serial interface */ | 146 | /* serial interface */ |
147 | struct usb_interface_descriptor serial_interface_descriptor = | 147 | struct usb_interface_descriptor __attribute__((aligned(2))) serial_interface_descriptor = |
148 | { | 148 | { |
149 | .bLength = sizeof(struct usb_interface_descriptor), | 149 | .bLength = sizeof(struct usb_interface_descriptor), |
150 | .bDescriptorType = USB_DT_INTERFACE, | 150 | .bDescriptorType = USB_DT_INTERFACE, |
@@ -157,7 +157,7 @@ struct usb_interface_descriptor serial_interface_descriptor = | |||
157 | .iInterface = 0 | 157 | .iInterface = 0 |
158 | }; | 158 | }; |
159 | 159 | ||
160 | struct usb_endpoint_descriptor serial_ep_in_descriptor = | 160 | struct usb_endpoint_descriptor __attribute__((aligned(2))) serial_ep_in_descriptor = |
161 | { | 161 | { |
162 | .bLength = sizeof(struct usb_endpoint_descriptor), | 162 | .bLength = sizeof(struct usb_endpoint_descriptor), |
163 | .bDescriptorType = USB_DT_ENDPOINT, | 163 | .bDescriptorType = USB_DT_ENDPOINT, |
@@ -166,7 +166,7 @@ struct usb_endpoint_descriptor serial_ep_in_descriptor = | |||
166 | .wMaxPacketSize = 16, | 166 | .wMaxPacketSize = 16, |
167 | .bInterval = 0 | 167 | .bInterval = 0 |
168 | }; | 168 | }; |
169 | struct usb_endpoint_descriptor serial_ep_out_descriptor = | 169 | struct usb_endpoint_descriptor __attribute__((aligned(2))) serial_ep_out_descriptor = |
170 | { | 170 | { |
171 | .bLength = sizeof(struct usb_endpoint_descriptor), | 171 | .bLength = sizeof(struct usb_endpoint_descriptor), |
172 | .bDescriptorType = USB_DT_ENDPOINT, | 172 | .bDescriptorType = USB_DT_ENDPOINT, |
@@ -179,7 +179,7 @@ struct usb_endpoint_descriptor serial_ep_out_descriptor = | |||
179 | 179 | ||
180 | #ifdef USB_BENCHMARK | 180 | #ifdef USB_BENCHMARK |
181 | /* bulk test interface */ | 181 | /* bulk test interface */ |
182 | struct usb_interface_descriptor benchmark_interface_descriptor = | 182 | struct usb_interface_descriptor __attribute__((aligned(2))) benchmark_interface_descriptor = |
183 | { | 183 | { |
184 | .bLength = sizeof(struct usb_interface_descriptor), | 184 | .bLength = sizeof(struct usb_interface_descriptor), |
185 | .bDescriptorType = USB_DT_INTERFACE, | 185 | .bDescriptorType = USB_DT_INTERFACE, |
@@ -192,7 +192,7 @@ struct usb_interface_descriptor benchmark_interface_descriptor = | |||
192 | .iInterface = 4 | 192 | .iInterface = 4 |
193 | }; | 193 | }; |
194 | 194 | ||
195 | struct usb_endpoint_descriptor benchmark_ep_in_descriptor = | 195 | struct usb_endpoint_descriptor __attribute__((aligned(2))) benchmark_ep_in_descriptor = |
196 | { | 196 | { |
197 | .bLength = sizeof(struct usb_endpoint_descriptor), | 197 | .bLength = sizeof(struct usb_endpoint_descriptor), |
198 | .bDescriptorType = USB_DT_ENDPOINT, | 198 | .bDescriptorType = USB_DT_ENDPOINT, |
@@ -212,7 +212,7 @@ struct usb_endpoint_descriptor benchmark_ep_out_descriptor = | |||
212 | }; | 212 | }; |
213 | #endif | 213 | #endif |
214 | 214 | ||
215 | static const struct usb_qualifier_descriptor qualifier_descriptor = | 215 | static const struct usb_qualifier_descriptor __attribute__((aligned(2))) qualifier_descriptor = |
216 | { | 216 | { |
217 | .bLength = sizeof(struct usb_qualifier_descriptor), | 217 | .bLength = sizeof(struct usb_qualifier_descriptor), |
218 | .bDescriptorType = USB_DT_DEVICE_QUALIFIER, | 218 | .bDescriptorType = USB_DT_DEVICE_QUALIFIER, |
@@ -224,21 +224,21 @@ static const struct usb_qualifier_descriptor qualifier_descriptor = | |||
224 | .bNumConfigurations = 1 | 224 | .bNumConfigurations = 1 |
225 | }; | 225 | }; |
226 | 226 | ||
227 | static struct usb_string_descriptor usb_string_iManufacturer = | 227 | static struct usb_string_descriptor __attribute__((aligned(2))) usb_string_iManufacturer = |
228 | { | 228 | { |
229 | 24, | 229 | 24, |
230 | USB_DT_STRING, | 230 | USB_DT_STRING, |
231 | {'R','o','c','k','b','o','x','.','o','r','g'} | 231 | {'R','o','c','k','b','o','x','.','o','r','g'} |
232 | }; | 232 | }; |
233 | 233 | ||
234 | static struct usb_string_descriptor usb_string_iProduct = | 234 | static struct usb_string_descriptor __attribute__((aligned(2))) usb_string_iProduct = |
235 | { | 235 | { |
236 | 42, | 236 | 42, |
237 | USB_DT_STRING, | 237 | USB_DT_STRING, |
238 | {'R','o','c','k','b','o','x',' ','m','e','d','i','a',' ','p','l','a','y','e','r'} | 238 | {'R','o','c','k','b','o','x',' ','m','e','d','i','a',' ','p','l','a','y','e','r'} |
239 | }; | 239 | }; |
240 | 240 | ||
241 | static struct usb_string_descriptor usb_string_iSerial = | 241 | static struct usb_string_descriptor __attribute__((aligned(2))) usb_string_iSerial = |
242 | { | 242 | { |
243 | 82, | 243 | 82, |
244 | USB_DT_STRING, | 244 | USB_DT_STRING, |
@@ -250,21 +250,21 @@ static struct usb_string_descriptor usb_string_iSerial = | |||
250 | /* Generic for all targets */ | 250 | /* Generic for all targets */ |
251 | 251 | ||
252 | /* this is stringid #0: languages supported */ | 252 | /* this is stringid #0: languages supported */ |
253 | static struct usb_string_descriptor lang_descriptor = | 253 | static struct usb_string_descriptor __attribute__((aligned(2))) lang_descriptor = |
254 | { | 254 | { |
255 | 4, | 255 | 4, |
256 | USB_DT_STRING, | 256 | USB_DT_STRING, |
257 | {0x0409} /* LANGID US English */ | 257 | {0x0409} /* LANGID US English */ |
258 | }; | 258 | }; |
259 | 259 | ||
260 | static struct usb_string_descriptor usb_string_usb_benchmark = | 260 | static struct usb_string_descriptor __attribute__((aligned(2))) usb_string_usb_benchmark = |
261 | { | 261 | { |
262 | 40, | 262 | 40, |
263 | USB_DT_STRING, | 263 | USB_DT_STRING, |
264 | {'B','u','l','k',' ','t','e','s','t',' ','i','n','t','e','r','f','a','c','e'} | 264 | {'B','u','l','k',' ','t','e','s','t',' ','i','n','t','e','r','f','a','c','e'} |
265 | }; | 265 | }; |
266 | 266 | ||
267 | static struct usb_string_descriptor usb_string_charging_only = | 267 | static struct usb_string_descriptor __attribute__((aligned(2))) usb_string_charging_only = |
268 | { | 268 | { |
269 | 28, | 269 | 28, |
270 | USB_DT_STRING, | 270 | USB_DT_STRING, |
@@ -580,7 +580,7 @@ static void usb_core_control_request_handler(struct usb_ctrlrequest* req) | |||
580 | switch (req->wValue >> 8) { /* type */ | 580 | switch (req->wValue >> 8) { /* type */ |
581 | case USB_DT_DEVICE: | 581 | case USB_DT_DEVICE: |
582 | ptr = &device_descriptor; | 582 | ptr = &device_descriptor; |
583 | size = sizeof device_descriptor; | 583 | size = sizeof(struct usb_device_descriptor); |
584 | break; | 584 | break; |
585 | 585 | ||
586 | case USB_DT_OTHER_SPEED_CONFIG: | 586 | case USB_DT_OTHER_SPEED_CONFIG: |
@@ -606,7 +606,7 @@ static void usb_core_control_request_handler(struct usb_ctrlrequest* req) | |||
606 | } | 606 | } |
607 | config_descriptor.bDescriptorType=USB_DT_OTHER_SPEED_CONFIG; | 607 | config_descriptor.bDescriptorType=USB_DT_OTHER_SPEED_CONFIG; |
608 | } | 608 | } |
609 | size = sizeof(config_descriptor); | 609 | size = sizeof(struct usb_config_descriptor); |
610 | 610 | ||
611 | #ifdef USB_CHARGING_ONLY | 611 | #ifdef USB_CHARGING_ONLY |
612 | if(usb_core_charging_enabled){ | 612 | if(usb_core_charging_enabled){ |
@@ -682,7 +682,7 @@ static void usb_core_control_request_handler(struct usb_ctrlrequest* req) | |||
682 | 682 | ||
683 | case USB_DT_DEVICE_QUALIFIER: | 683 | case USB_DT_DEVICE_QUALIFIER: |
684 | ptr = &qualifier_descriptor; | 684 | ptr = &qualifier_descriptor; |
685 | size = sizeof qualifier_descriptor; | 685 | size = sizeof (struct usb_qualifier_descriptor); |
686 | break; | 686 | break; |
687 | 687 | ||
688 | default: | 688 | default: |