Sonochan II 0.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
usb_descriptors.h
Go to the documentation of this file.
1 /* -*- mode: c++; tab-width: 4; c-basic-offset: 4 -*- */
2 /* This header file is part of the ATMEL AVR32-SoftwareFramework-AT32UC3-1.5.0 Release */
3
4 /*This file is prepared for Doxygen automatic documentation generation.*/
21 /* Copyright (c) 2009 Atmel Corporation. All rights reserved.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions are met:
25 *
26 * 1. Redistributions of source code must retain the above copyright notice, this
27 * list of conditions and the following disclaimer.
28 *
29 * 2. Redistributions in binary form must reproduce the above copyright notice,
30 * this list of conditions and the following disclaimer in the documentation
31 * and/or other materials provided with the distribution.
32 *
33 * 3. The name of Atmel may not be used to endorse or promote products derived
34 * from this software without specific prior written permission.
35 *
36 * 4. This software may only be redistributed and used in connection with an Atmel
37 * AVR product.
38 *
39 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
40 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
41 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
42 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
43 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
44 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
45 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
46 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
47 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
48 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
49 *
50 * Additions and Modifications to ATMEL AVR32-SoftwareFramework-AT32UC3 are:
51 *
52 * Copyright (C) Alex Lee
53 *
54 * This program is free software; you can redistribute it and/or
55 * modify it under the terms of the GNU General Public License
56 * as published by the Free Software Foundation; either version 2
57 * of the License, or (at your option) any later version.
58 *
59 * This program is distributed in the hope that it will be useful,
60 * but WITHOUT ANY WARRANTY; without even the implied warranty of
61 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
62 * GNU General Public License for more details.
63 *
64 * You should have received a copy of the GNU General Public License
65 * along with this program; if not, write to the Free Software
66 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
67 *
68 * Modified by Alex Lee 20 Feb 2010
69 * To enumerate as a USB composite device with 4 interfaces:
70 * CDC
71 * HID (generic HID interface, compatible with Jan Axelson's generichid.exe test programs
72 * DG8SAQ (libusb API compatible interface for implementing DG8SAQ EP0 type of interface)
73 * Audio (USB Audio Class V2)
74 *
75 * For SDR-Widget and SDR-Widget-lite, custom boards based on the AT32UC3A3256
76 *
77 * See http://code.google.com/p/sdr-widget/
78 *
79 */
80
81 #ifndef _USB_DESCRIPTORS_H_
82 #define _USB_DESCRIPTORS_H_
83
84
85 //_____ I N C L U D E S ____________________________________________________
86
87 #include "conf_usb.h"
88
89 #if USB_DEVICE_FEATURE == DISABLED
90 #error usb_descriptors.h is #included although USB_DEVICE_FEATURE is disabled
91 #endif
92
93
94 #include "usb_standard_request.h"
95 #include "usb_task.h"
96 #include "image.h"
97
98 //_____ functions ________________________________________________________
99
100 //_____ M A C R O S ________________________________________________________
101
102 #define Usb_unicode(c) (Usb_format_mcu_to_usb_data(16, (U16)(c)))
103 #define Usb_get_dev_desc_pointer() image_get_dev_desc_pointer()
104 #define Usb_get_dev_desc_length() image_get_dev_desc_length()
105 #define Usb_get_conf_desc_pointer() image_get_conf_desc_fs_pointer()
106 #define Usb_get_conf_desc_length() image_get_conf_desc_fs_length()
107 #define Usb_get_conf_desc_hs_pointer() image_get_conf_desc_hs_pointer()
108 #define Usb_get_conf_desc_hs_length() image_get_conf_desc_hs_length()
109 #define Usb_get_conf_desc_fs_pointer() image_get_conf_desc_fs_pointer()
110 #define Usb_get_conf_desc_fs_length() image_get_conf_desc_fs_length()
111 #define Usb_get_qualifier_desc_pointer() image_get_qualifier_desc_pointer()
112 #define Usb_get_qualifier_desc_length() image_get_qualifier_desc_length()
113
114
115 //_____ U S B D E F I N E S _____________________________________________
116
117 // USB Device descriptor
118 #define USB_SPECIFICATION 0x0200
119 #define DEVICE_CLASS 0xef
120 #define DEVICE_SUB_CLASS 0x02
121 #define DEVICE_PROTOCOL 0x01
122 #define EP_CONTROL_LENGTH 64
123
124 #define AUDIO_VENDOR_ID 0x16d0
125 //#define AUDIO_PRODUCT_ID_1 0x0761
126 #define AUDIO_PRODUCT_ID_1 0x0763
127 #define AUDIO_PRODUCT_ID_2 0x0762
128
129 #define RELEASE_NUMBER 0x1000
130 #define MAN_INDEX 0x01
131 #define PROD_INDEX 0x02
132 #define SN_INDEX 0x03
133 #define CLOCK_SOURCE_1_INDEX 0x04
134 #define CLOCK_SOURCE_2_INDEX 0x05
135 #define CLOCK_SELECTOR_INDEX 0x06
136
137
138 #define WL_INDEX 0x07
139 #define AIT_INDEX 0x08
140 #define AOT_INDEX 0x09
141 #define AIN_INDEX 0x0A
142 #define AIA_INDEX 0x0B
143
144
145 #define NB_CONFIGURATION 1
146
147 // image specific information moved to *_usb_descriptors.h
148
149 #define DEVICE_STATUS SELF_POWERED
150 #define INTERFACE_STATUS 0x00 // TBD
151
152 #define LANG_ID 0x00
153
154 #define USB_MN_LENGTH 4
155 #define USB_MANUFACTURER_NAME \
156 {\
157 Usb_unicode('A'),\
158 Usb_unicode('L'),\
159 Usb_unicode('C'),\
160 Usb_unicode('Z')\
161 }
162
163 #define USB_PN_LENGTH 13
164 #define USB_PRODUCT_NAME {\
165 Usb_unicode('S'), Usb_unicode('o'), Usb_unicode('n'), Usb_unicode('o'), Usb_unicode('c'),\
166 Usb_unicode('h'), Usb_unicode('a'), Usb_unicode('n'), Usb_unicode(' '), \
167 Usb_unicode('m'), Usb_unicode('k'), Usb_unicode('I'), Usb_unicode('I')\
168 }
169
170
171 #define USB_SN_LENGTH 13
172 #define USB_SERIAL_NUMBER \
173 {\
174 Usb_unicode('0'),\
175 Usb_unicode('.'),\
176 Usb_unicode('0'),\
177 Usb_unicode('.'),\
178 Usb_unicode('0'),\
179 Usb_unicode('.'),\
180 Usb_unicode('0'),\
181 Usb_unicode('.'),\
182 Usb_unicode('0'),\
183 Usb_unicode('.'),\
184 Usb_unicode('0'),\
185 Usb_unicode('.'),\
186 Usb_unicode('1') \
187 }
188
189 #define USB_CS1_LENGTH 7
190 #define USB_CLOCK_SOURCE_1 \
191 {\
192 Usb_unicode('C'),\
193 Usb_unicode('l'),\
194 Usb_unicode('o'),\
195 Usb_unicode('c'),\
196 Usb_unicode('k'),\
197 Usb_unicode(' '),\
198 Usb_unicode('1') \
199 }
200
201 #define USB_CS2_LENGTH 7
202 #define USB_CLOCK_SOURCE_2 \
203 {\
204 Usb_unicode('C'),\
205 Usb_unicode('l'),\
206 Usb_unicode('o'),\
207 Usb_unicode('c'),\
208 Usb_unicode('k'),\
209 Usb_unicode(' '),\
210 Usb_unicode('2')\
211 }
212
213 #define USB_CX_LENGTH 12
214 #define USB_CLOCK_SELECTOR \
215 {\
216 Usb_unicode('S'),\
217 Usb_unicode('e'),\
218 Usb_unicode('l'),\
219 Usb_unicode('e'),\
220 Usb_unicode('c'),\
221 Usb_unicode('t'),\
222 Usb_unicode(' '),\
223 Usb_unicode('c'),\
224 Usb_unicode('l'),\
225 Usb_unicode('o'),\
226 Usb_unicode('c'),\
227 Usb_unicode('k')\
228 }
229
230
231 #define USB_WL_LENGTH 10
232 #define USB_WL \
233 {\
234 Usb_unicode('S'),\
235 Usb_unicode('D'),\
236 Usb_unicode('R'),\
237 Usb_unicode('-'),\
238 Usb_unicode('W'),\
239 Usb_unicode('i'),\
240 Usb_unicode('d'),\
241 Usb_unicode('g'),\
242 Usb_unicode('e'),\
243 Usb_unicode('t')\
244 }
245 #define USB_AIT_LENGTH 12
246 #define USB_AIT \
247 {\
248 Usb_unicode('A'),\
249 Usb_unicode('u'),\
250 Usb_unicode('d'),\
251 Usb_unicode('i'),\
252 Usb_unicode('o'),\
253 Usb_unicode(' '),\
254 Usb_unicode('I'),\
255 Usb_unicode('n'),\
256 Usb_unicode(' '),\
257 Usb_unicode('T'),\
258 Usb_unicode('r'),\
259 Usb_unicode('m')\
260 }
261 #define USB_AOT_LENGTH 13
262 #define USB_AOT \
263 {\
264 Usb_unicode('A'),\
265 Usb_unicode('u'),\
266 Usb_unicode('d'),\
267 Usb_unicode('i'),\
268 Usb_unicode('o'),\
269 Usb_unicode(' '),\
270 Usb_unicode('O'),\
271 Usb_unicode('u'),\
272 Usb_unicode('t'),\
273 Usb_unicode(' '),\
274 Usb_unicode('T'),\
275 Usb_unicode('r'),\
276 Usb_unicode('m')\
277 }
278 #define USB_AIN_LENGTH 11
279 #define USB_AIN \
280 {\
281 Usb_unicode('W'),\
282 Usb_unicode('i'),\
283 Usb_unicode('d'),\
284 Usb_unicode('g'),\
285 Usb_unicode('e'),\
286 Usb_unicode('t'),\
287 Usb_unicode('-'),\
288 Usb_unicode('L'),\
289 Usb_unicode('i'),\
290 Usb_unicode('t'),\
291 Usb_unicode('e')\
292 }
293 #define USB_AIA_LENGTH 12
294 #define USB_AIA \
295 {\
296 Usb_unicode('A'),\
297 Usb_unicode('u'),\
298 Usb_unicode('d'),\
299 Usb_unicode('i'),\
300 Usb_unicode('o'),\
301 Usb_unicode(' '),\
302 Usb_unicode('I'),\
303 Usb_unicode('n'),\
304 Usb_unicode(' '),\
305 Usb_unicode('A'),\
306 Usb_unicode('l'),\
307 Usb_unicode('t')\
308 }
309
310 //_____ U S B Widget-Lite D E S C R I P T O R _____________
311
313 typedef
314 #if (defined __ICCAVR32__)
315 #pragma pack(1)
316 #endif
317 struct
318 #if (defined __GNUC__)
319 __attribute__((__packed__))
320 #endif
321 {
322 U8 bLength;
323 U8 bDescriptorType;
324 U16 wstring[USB_WL_LENGTH];
325 }
326 #if (defined __ICCAVR32__)
327 #pragma pack()
328 #endif
329 S_usb_wl;
330
331 //_____ U S B Audio IN Terminal D E S C R I P T O R _____________
332
334 typedef
335 #if (defined __ICCAVR32__)
336 #pragma pack(1)
337 #endif
338 struct
339 #if (defined __GNUC__)
340 __attribute__((__packed__))
341 #endif
342 {
343 U8 bLength;
344 U8 bDescriptorType;
345 U16 wstring[USB_AIT_LENGTH];
346 }
347 #if (defined __ICCAVR32__)
348 #pragma pack()
349 #endif
350 S_usb_ait;
351
352 //_____ U S B Audio OUT Terminal D E S C R I P T O R _____________
353
355 typedef
356 #if (defined __ICCAVR32__)
357 #pragma pack(1)
358 #endif
359 struct
360 #if (defined __GNUC__)
361 __attribute__((__packed__))
362 #endif
363 {
364 U8 bLength;
365 U8 bDescriptorType;
366 U16 wstring[USB_AOT_LENGTH];
367 }
368 #if (defined __ICCAVR32__)
369 #pragma pack()
370 #endif
371 S_usb_aot;
372
373 //_____ U S B Audio IN D E S C R I P T O R _____________
374
376 typedef
377 #if (defined __ICCAVR32__)
378 #pragma pack(1)
379 #endif
380 struct
381 #if (defined __GNUC__)
382 __attribute__((__packed__))
383 #endif
384 {
385 U8 bLength;
386 U8 bDescriptorType;
387 U16 wstring[USB_AIN_LENGTH];
388 }
389 #if (defined __ICCAVR32__)
390 #pragma pack()
391 #endif
392 S_usb_ain;
393
394 //_____ U S B Audio IN Alt D E S C R I P T O R _____________
395
397 typedef
398 #if (defined __ICCAVR32__)
399 #pragma pack(1)
400 #endif
401 struct
402 #if (defined __GNUC__)
403 __attribute__((__packed__))
404 #endif
405 {
406 U8 bLength;
407 U8 bDescriptorType;
408 U16 wstring[USB_AIA_LENGTH];
409 }
410 #if (defined __ICCAVR32__)
411 #pragma pack()
412 #endif
413 S_usb_aia;
414
415 // Stop test
416 #define LANGUAGE_ID 0x0409
417
418
420 typedef
421 #if (defined __ICCAVR32__)
422 #pragma pack(1)
423 #endif
424 struct
425 #if (defined __GNUC__)
426 __attribute__((__packed__))
427 #endif
428 {
429 U8 bmRequestType;
430 U8 bRequest;
431 U16 wValue;
432 U16 wIndex;
433 U16 wLength;
434 }
435 #if (defined __ICCAVR32__)
436 #pragma pack()
437 #endif
438 S_UsbRequest;
439
440
442 typedef
443 #if (defined __ICCAVR32__)
444 #pragma pack(1)
445 #endif
446 struct
447 #if (defined __GNUC__)
448 __attribute__((__packed__))
449 #endif
450 {
451 U8 bLength;
452 U8 bDescriptorType;
453 U16 bscUSB;
454 U8 bDeviceClass;
455 U8 bDeviceSubClass;
456 U8 bDeviceProtocol;
457 U8 bMaxPacketSize0;
458 U16 idVendor;
459 U16 idProduct;
460 U16 bcdDevice;
461 U8 iManufacturer;
462 U8 iProduct;
463 U8 iSerialNumber;
464 U8 bNumConfigurations;
465 }
466 #if (defined __ICCAVR32__)
467 #pragma pack()
468 #endif
469 S_usb_device_descriptor;
470
471
473 typedef
474 #if (defined __ICCAVR32__)
475 #pragma pack(1)
476 #endif
477 struct
478 #if (defined __GNUC__)
479 __attribute__((__packed__))
480 #endif
481 {
482 U8 bLength;
483 U8 bDescriptorType;
484 U16 wTotalLength;
485 U8 bNumInterfaces;
486 U8 bConfigurationValue;
487 U8 iConfiguration;
488 U8 bmAttributes;
489 U8 MaxPower;
490 }
491 #if (defined __ICCAVR32__)
492 #pragma pack()
493 #endif
494 S_usb_configuration_descriptor;
495
496
498 typedef
499 #if (defined __ICCAVR32__)
500 #pragma pack(1)
501 #endif
502 struct
503 #if (defined __GNUC__)
504 __attribute__((__packed__))
505 #endif
506 {
507 U8 bLength;
508 U8 bDescriptorType;
509 U8 bInterfaceNumber;
510 U8 bAlternateSetting;
511 U8 bNumEndpoints;
512 U8 bInterfaceClass;
513 U8 bInterfaceSubClass;
514 U8 bInterfaceProtocol;
515 U8 iInterface;
516 }
517 #if (defined __ICCAVR32__)
518 #pragma pack()
519 #endif
520 S_usb_interface_descriptor;
521
522
524 typedef
525 #if (defined __ICCAVR32__)
526 #pragma pack(1)
527 #endif
528 struct
529 #if (defined __GNUC__)
530 __attribute__((__packed__))
531 #endif
532 {
533 U8 bLength;
534 U8 bDescriptorType;
535 U8 bEndpointAddress;
536 U8 bmAttributes;
537 U16 wMaxPacketSize;
538 U8 bInterval;
539 }
540 #if (defined __ICCAVR32__)
541 #pragma pack()
542 #endif
543 S_usb_endpoint_descriptor;
544
545
547 typedef
548 #if (defined __ICCAVR32__)
549 #pragma pack(1)
550 #endif
551 struct
552 #if (defined __GNUC__)
553 __attribute__((__packed__))
554 #endif
555 {
556 U8 bLength; // Size of this Descriptor in BYTEs
557 U8 bDescriptorType; // INTERFACE_ASSOCIATION Descriptor Type (0x0B)
558 U8 bFirstInterface; // Interface number of the first one associated with this function
559 U8 bInterfaceCount; // Number of contiguous interface associated with this function
560 U8 bFunctionClass; // The class triad of this interface,
561 U8 bFunctionSubClass; // usually same as the triad of the first interface
562 U8 bFunctionProcotol;
563 U8 iInterface; // Index of String Desc for this function
564 }
565 #if (defined __ICCAVR32__)
566 #pragma pack()
567 #endif
568 S_usb_interface_association_descriptor;
569
570 //---------------------------------------------
571 // Class specific descriptors for CDC
572 //---------------------------------------------
573 //---------------------------------------------
574 // Header Functional Descriptor
575 //---------------------------------------------
576
577 typedef
578 #if (defined __ICCAVR32__)
579 #pragma pack(1)
580 #endif
581 struct
582 #if (defined __GNUC__)
583 __attribute__((__packed__))
584 #endif
585 {
586 U8 bLength; // Size of this Descriptor in BYTEs
587 U8 bDescriptorType; // CS_INTERFACE Descriptor Type
588 U8 bDescriptorSubtype; // CS_CDC_HEADER subtype
589 U16 bcdCDC; // bcdCDC (CDC spec release number, 1.1
590 }
591 #if (defined __ICCAVR32__)
592 #pragma pack()
593 #endif
594 S_usb_cdc_header_func_descriptor;
595
596 //---------------------------------------------
597 // Call Management Functional Descriptor
598 //---------------------------------------------
599 typedef
600 #if (defined __ICCAVR32__)
601 #pragma pack(1)
602 #endif
603 struct
604 #if (defined __GNUC__)
605 __attribute__((__packed__))
606 #endif
607 {
608 U8 bLength; // Size of this Descriptor in BYTEs
609 U8 bDescriptorType; // CS_INTERFACE Descriptor Type
610 U8 bDescriptorSubtype; // CS_CDC_CALL_MAN subtype
611 U8 bmCapabilities; // Capabilities bitmap
612 U8 bDataInterface; // Interface number
613 }
614 #if (defined __ICCAVR32__)
615 #pragma pack()
616 #endif
617 S_usb_cdc_call_man_func_descriptor;
618
619 //---------------------------------------------
620 // Abstract Control Management Functional Descriptor
621 //---------------------------------------------
622 typedef
623 #if (defined __ICCAVR32__)
624 #pragma pack(1)
625 #endif
626 struct
627 #if (defined __GNUC__)
628 __attribute__((__packed__))
629 #endif
630 {
631 U8 bLength; // Size of this Descriptor in BYTEs
632 U8 bDescriptorType; // CS_INTERFACE Descriptor Type
633 U8 bDescriptorSubtype; // CS_CDC_ABST_CNTRL subtype
634 U8 bmCapabilities; // Capabilities bitmap
635 }
636 #if (defined __ICCAVR32__)
637 #pragma pack()
638 #endif
639 S_usb_cdc_abst_control_mana_descriptor;
640
641 //---------------------------------------------
642 // Union Functional Descriptor
643 //---------------------------------------------
644 typedef
645 #if (defined __ICCAVR32__)
646 #pragma pack(1)
647 #endif
648 struct
649 #if (defined __GNUC__)
650 __attribute__((__packed__))
651 #endif
652 {
653 U8 bLength; // Size of this Descriptor in BYTEs
654 U8 bDescriptorType; // CS_INTERFACE Descriptor Typ
655 U8 bDescriptorSubtype; // CS_CDC_UNION_FUNC subtype
656 U8 bMasterInterface; // Interface number master
657 U8 bSlaveInterface0; // Interface number slave
658 }
659 #if (defined __ICCAVR32__)
660 #pragma pack()
661 #endif
662 S_usb_cdc_union_func_descriptor;
663
664
665
667 typedef
668 #if (defined __ICCAVR32__)
669 #pragma pack(1)
670 #endif
671 struct
672 #if (defined __GNUC__)
673 __attribute__((__packed__))
674 #endif
675 {
676 U8 bLength;
677 U8 bDescriptorType;
678 U16 bscUSB;
679 U8 bDeviceClass;
680 U8 bDeviceSubClass;
681 U8 bDeviceProtocol;
682 U8 bMaxPacketSize0;
683 U8 bNumConfigurations;
684 U8 bReserved;
685 }
686 #if (defined __ICCAVR32__)
687 #pragma pack()
688 #endif
689 S_usb_device_qualifier_descriptor;
690
691
693 typedef
694 #if (defined __ICCAVR32__)
695 #pragma pack(1)
696 #endif
697 struct
698 #if (defined __GNUC__)
699 __attribute__((__packed__))
700 #endif
701 {
702 U8 bLength;
703 U8 bDescriptorType;
704 U16 wlangid;
705 }
706 #if (defined __ICCAVR32__)
707 #pragma pack()
708 #endif
709 S_usb_language_id;
710
711
712 //_____ U S B M A N U F A C T U R E R D E S C R I P T O R _______________
713
715 typedef
716 #if (defined __ICCAVR32__)
717 #pragma pack(1)
718 #endif
719 struct
720 #if (defined __GNUC__)
721 __attribute__((__packed__))
722 #endif
723 {
724 U8 bLength;
725 U8 bDescriptorType;
726 U16 wstring[USB_MN_LENGTH];
727 }
728 #if (defined __ICCAVR32__)
729 #pragma pack()
730 #endif
731 S_usb_manufacturer_string_descriptor;
732
733
734 //_____ U S B P R O D U C T D E S C R I P T O R _________________________
735
737 typedef
738 #if (defined __ICCAVR32__)
739 #pragma pack(1)
740 #endif
741 struct
742 #if (defined __GNUC__)
743 __attribute__((__packed__))
744 #endif
745 {
746 U8 bLength;
747 U8 bDescriptorType;
748 U16 wstring[USB_PN_LENGTH];
749 }
750 #if (defined __ICCAVR32__)
751 #pragma pack()
752 #endif
753 S_usb_product_string_descriptor;
754
755
756 //_____ U S B S E R I A L N U M B E R D E S C R I P T O R _____________
757
759 typedef
760 #if (defined __ICCAVR32__)
761 #pragma pack(1)
762 #endif
763 struct
764 #if (defined __GNUC__)
765 __attribute__((__packed__))
766 #endif
767 {
768 U8 bLength;
769 U8 bDescriptorType;
770 U16 wstring[USB_SN_LENGTH];
771 }
772 #if (defined __ICCAVR32__)
773 #pragma pack()
774 #endif
775 S_usb_serial_number;
776
777 //_____ U S B CLOCK SELECTOR D E S C R I P T O R _____________
778
780 typedef
781 #if (defined __ICCAVR32__)
782 #pragma pack(1)
783 #endif
784 struct
785 #if (defined __GNUC__)
786 __attribute__((__packed__))
787 #endif
788 {
789 U8 bLength;
790 U8 bDescriptorType;
791 U16 wstring[USB_CX_LENGTH];
792 }
793 #if (defined __ICCAVR32__)
794 #pragma pack()
795 #endif
796 S_usb_clock_selector;
797
798 //_____ U S B D E V I C E H I D D E S C R I P T O R ___________________
799
801 typedef
802 #if (defined __ICCAVR32__)
803 #pragma pack(1)
804 #endif
805 struct
806 #if (defined __GNUC__)
807 __attribute__((__packed__))
808 #endif
809 {
810 U8 bLength;
811 U8 bDescriptorType;
812 U16 bcdHID;
813 U8 bCountryCode;
814 U8 bNumDescriptors;
815 U8 bRDescriptorType;
816 U16 wItemLength;
817 }
818 #if (defined __ICCAVR32__)
819 #pragma pack()
820 #endif
821 S_usb_hid_descriptor;
822
823
824
827 typedef
828 #if (defined __ICCAVR32__)
829 #pragma pack(1)
830 #endif
831 struct
832 #if (defined __GNUC__)
833 __attribute__((__packed__))
834 #endif
835 {
836 U8 bLength; /* Size of this descriptor in bytes */
837 U8 bDescriptorType; /* CS interface*/
838 U8 bDescritorSubtype; /* HEADER Subtype */
839 U16 bcdADC; /* Revision of class spec */
840 U16 wTotalLength; /* Total size of class specific descriptor */
841 U8 bInCollection; /* Number of streaming interface */
842 U8 baInterfaceNr0; /* Streaming interface number 0*/
843 U8 baInterfaceNr1; // Streaming interface number 1
844 } S_usb_ac_interface_descriptor_1;
845
847 typedef
848 #if (defined __ICCAVR32__)
849 #pragma pack(1)
850 #endif
851 struct
852 #if (defined __GNUC__)
853 __attribute__((__packed__))
854 #endif
855 {
856 U8 bLenght;
857 U8 bDescriptorType;
858 U8 bDescriptorSubType;
859 U8 bTerminalID;
860 U16 wTerminalType;
861 U8 bAssocTerminal;
862 U8 bNrChannels;
863 U16 wChannelConfig;
864 U8 iChannelNames;
865 U8 iTerminal;
866 } S_usb_in_ter_descriptor_1;
867
868
870 typedef
871 #if (defined __ICCAVR32__)
872 #pragma pack(1)
873 #endif
874 struct
875 #if (defined __GNUC__)
876 __attribute__((__packed__))
877 #endif
878 {
879 U8 bLenght;
880 U8 bDescriptorType;
881 U8 bDescriptorSubType;
882 U8 bUnitID;
883 U8 bSourceID;
884 U8 bControSize;
885 U16 bmaControls_0;
886 U16 bmaControls_1;
887 U16 bmsCnotrols_2;
888 U8 iTerminal;
889 } S_usb_feature_unit_descriptor_1;
890
892 typedef
893 #if (defined __ICCAVR32__)
894 #pragma pack(1)
895 #endif
896 struct
897 #if (defined __GNUC__)
898 __attribute__((__packed__))
899 #endif
900 {
901 U8 bLenght;
902 U8 bDescriptorType;
903 U8 bDescriptorSubType;
904 U8 bTerminalID;
905 U16 wTerminalType;
906 U8 bAssocTerminal;
907 U8 bSourceID;
908 U8 iTerminal;
909 } S_usb_out_ter_descriptor_1;
910
911
913 // common across 1 and 2
914 // typedef
915 // #if (defined __ICCAVR32__)
916 // #pragma pack(1)
917 // #endif
918 // struct
919 // #if (defined __GNUC__)
920 // __attribute__((__packed__))
921 // #endif
922 // {
923 // U8 bLenght;
924 // U8 bDescriptorType;
925 // U8 bInterfaceNumber;
926 // U8 bAlternateSetting;
927 // U8 bNumEndpoints;
928 // U8 bInterfaceClass;
929 // U8 bInterfaceSubclass;
930 // U8 bInterfaceProtocol;
931 // U8 iInterface;
932 // } S_usb_as_interface_descriptor_1;
933
934
936 typedef
937 #if (defined __ICCAVR32__)
938 #pragma pack(1)
939 #endif
940 struct
941 #if (defined __GNUC__)
942 __attribute__((__packed__))
943 #endif
944 {
945 U8 bLenght;
946 U8 bDescriptorType;
947 U8 bDescriptorSubType;
948 U8 bTerminalLink;
949 U8 bDelay;
950 U16 wFormatTag;
951 } S_usb_as_g_interface_descriptor_1;
952
953
955 typedef
956 #if (defined __ICCAVR32__)
957 #pragma pack(1)
958 #endif
959 struct
960 #if (defined __GNUC__)
961 __attribute__((__packed__))
962 #endif
963 {
964 U8 bLenght;
965 U8 bDescriptorType;
966 U8 bDescriptorSubType;
967 U8 bFormatType;
968 U8 bNrChannels;
969 U8 bSubFrameSize;
970 U8 bBitResolution;
971 U8 bSampleFreqType;
972 U16 wLsbyteiSamFreq_1;
973 U8 bMsbyteiSamFreq_1;
974 U16 wLsbyteiSamFreq_2;
975 U8 bMsbyteiSamFreq_2;
976 U16 wLsbyteiSamFreq_3;
977 U8 bMsbyteiSamFreq_3;
978 U16 wLsbyteiSamFreq_4;
979 U8 bMsbyteiSamFreq_4;
980 U16 wLsbyteiSamFreq_5;
981 U8 bMsbyteiSamFreq_5;
982 U16 wLsbyteiSamFreq_6;
983 U8 bMsbyteiSamFreq_6;
984 U16 wLsbyteiSamFreq_7;
985 U8 bMsbyteiSamFreq_7;
986 U16 wLsbyteiSamFreq_8;
987 U8 bMsbyteiSamFreq_8;
988 } S_usb_format_type_1;
989
991 typedef
992 #if (defined __ICCAVR32__)
993 #pragma pack(1)
994 #endif
995 struct
996 #if (defined __GNUC__)
997 __attribute__((__packed__))
998 #endif
999 {
1000 U8 bLenght;
1001 U8 bDescriptorType;
1002 U8 bDescriptorSubType;
1003 U8 bFormatType;
1004 U8 bNrChannels;
1005 U8 bSubFrameSize;
1006 U8 bBitResolution;
1007 U8 bSampleFreqType;
1008 U16 wLsbyteiSamFreq_1;
1009 U8 bMsbyteiSamFreq_1;
1010 } S_usb_format_type_1_one_freq;
1011
1013 typedef
1014 #if (defined __ICCAVR32__)
1015 #pragma pack(1)
1016 #endif
1017 struct
1018 #if (defined __GNUC__)
1019 __attribute__((__packed__))
1020 #endif
1021 {
1022 U8 bLenght;
1023 U8 bDescriptorType;
1024 U8 bDescriptorSubType;
1025 U8 bmAttributes;
1026 U8 bLockDelayUnits;
1027 U16 wLockDelay;
1028 }S_usb_endpoint_audio_specific_1;
1029
1031 typedef
1032 #if (defined __ICCAVR32__)
1033 #pragma pack(1)
1034 #endif
1035 struct
1036 #if (defined __GNUC__)
1037 __attribute__((__packed__))
1038 #endif
1039 {
1040 U8 bLength;
1041 U8 bDescriptorType;
1042 U8 bEndpointAddress;
1043 U8 bmAttributes;
1044 U16 wMaxPacketSize;
1045 U8 bInterval;
1046 U8 bRefresh;
1047 U8 bSynAddress;
1048 } S_usb_endpoint_audio_descriptor_1;
1049
1050
1053 typedef
1054 #if (defined __ICCAVR32__)
1055 #pragma pack(1)
1056 #endif
1057 struct
1058 #if (defined __GNUC__)
1059 __attribute__((__packed__))
1060 #endif
1061 {
1062 U8 bLength; /* Size of this descriptor in bytes */
1063 U8 bDescriptorType; /* CS_INTERFACE descriptor type */
1064 U8 bDescritorSubtype; /* HEADER subtype */
1065 U16 bcdADC; /* Revision of class spec */
1066 U8 bCategory; /* Primary use of this function */
1067 U16 wTotalLength; /* Total size of class specific descriptor */
1068 U8 bmControls; /* Latency Control Bitmap */
1069 } S_usb_ac_interface_descriptor_2;
1070
1071
1073 typedef
1074 #if (defined __ICCAVR32__)
1075 #pragma pack(1)
1076 #endif
1077 struct
1078 #if (defined __GNUC__)
1079 __attribute__((__packed__))
1080 #endif
1081 {
1082 U8 bLength; /* Size of this descriptor in bytes */
1083 U8 bDescriptorType; /* CS_INTERFACE descriptor type */
1084 U8 bDescritorSubtype; /* CLOCK_SOURCE subtype */
1085 U8 bClockID; /* Clock Source ID */
1086 U8 bmAttributes; /* Clock Type Bitmap */
1087 U8 bmControls; /* Clock control bitmap */
1088 U8 bAssocTerminal; /* Terminal ID associated with this source */
1089 U8 iClockSource; /* String descriptor of this clock source */
1090 } S_usb_clock_source_descriptor;
1091
1092
1094 typedef
1095 #if (defined __ICCAVR32__)
1096 #pragma pack(1)
1097 #endif
1098 struct
1099 #if (defined __GNUC__)
1100 __attribute__((__packed__))
1101 #endif
1102 {
1103 U8 bLength; /* Size of this descriptor in bytes */
1104 U8 bDescriptorType; /* CS_INTERFACE descriptor type */
1105 U8 bDescritorSubtype; /* CLOCK_SELECTOR subtype */
1106 U8 bClockID; /* Clock Selector ID */
1107 U8 bNrInPins; /* Number of Input Pins */
1108 U8 baCSourceID1; /* variable length */
1109 U8 baCSourceID2;
1110 U8 bmControls; /* Clock selector control bitmap */
1111 U8 iClockSelector; /* String descriptor of this clock selector */
1112 } S_usb_clock_selector_descriptor;
1113
1114
1116 typedef
1117 #if (defined __ICCAVR32__)
1118 #pragma pack(1)
1119 #endif
1120 struct
1121 #if (defined __GNUC__)
1122 __attribute__((__packed__))
1123 #endif
1124 {
1125 U8 bLength; /* Size of this descriptor in bytes */
1126 U8 bDescriptorType; /* CS_INTERFACE descriptor type */
1127 U8 bDescritorSubtype; /* CLOCK_MULTIPLIER subtype */
1128 U8 bClockID; /* Clock Multiplier ID */
1129 U8 bCSourceID; /* ID of clock entity */
1130 U8 bmControls; /* Clock Multiplier control bitmap */
1131 U8 iClockMultiplier; /* String descriptor of this clock multiplier */
1132 } S_usb_clock_multiplier_descriptor;
1133
1134
1136 typedef
1137 #if (defined __ICCAVR32__)
1138 #pragma pack(1)
1139 #endif
1140 struct
1141 #if (defined __GNUC__)
1142 __attribute__((__packed__))
1143 #endif
1144 {
1145 U8 bLength; /* Size of this descriptor in bytes */
1146 U8 bDescriptorType; /* CS_INTERFACE descriptor type */
1147 U8 bDescriptorSubType; /* INPUT_TERMINAL subtype */
1148 U8 bTerminalID; /* Input Terminal ID */
1149 U16 wTerminalType; /* Terminal type */
1150 U8 bAssocTerminal; /* Output terminal this input is associated with */
1151 U8 bCSourceID; /* ID of Clock entity to which this terminal is connected */
1152 U8 bNrChannels; /* Number of Logical output channels */
1153 U32 bmChannelConfig; /* Spatial location of logical channels */
1154 U8 iChannelNames; /* String descriptor of first logical channel */
1155 U16 bmControls; /* Paired Bitmap of controls */
1156 U8 iTerminal; /* String descriptor of this Input Terminal */
1157 } S_usb_in_ter_descriptor_2;
1158
1159
1161 typedef
1162 #if (defined __ICCAVR32__)
1163 #pragma pack(1)
1164 #endif
1165 struct
1166 #if (defined __GNUC__)
1167 __attribute__((__packed__))
1168 #endif
1169 {
1170 U8 bLength; /* Size of this descriptor in bytes */
1171 U8 bDescriptorType; /* CS_INTERFACE descriptor type */
1172 U8 bDescriptorSubType; /* OUTPUT_TERMINAL subtype */
1173 U8 bTerminalID; /* Output Terminal ID */
1174 U16 wTerminalType; /* Terminal type */
1175 U8 bAssocTerminal; /* Input Terminal this output is associated with */
1176 U8 bSourceID; /* ID of the Unit or Terminal to which this teminal is connected to */
1177 U8 bCSourceID; /* ID od the Clock Entity to which this terminal is connected */
1178 U16 bmControls; /* Paired Bitmap of controls */
1179 U8 iTerminal; /* String descriptor of this Output Terminal */
1180 } S_usb_out_ter_descriptor_2;
1181
1184
1185
1187 typedef
1188 #if (defined __ICCAVR32__)
1189 #pragma pack(1)
1190 #endif
1191 struct
1192 #if (defined __GNUC__)
1193 __attribute__((__packed__))
1194 #endif
1195 {
1196 U8 bLength; /* Size of this descriptor in bytes */
1197 U8 bDescriptorType; /* CS_INTERFACE descriptor type */
1198 U8 bDescriptorSubType; /* FEATURE_UNIT subtype */
1199 U8 bUnitID; /* Feature unit ID */
1200 U8 bSourceID; /* ID of the Unit or Terminal to which this teminal is connected to */
1201 U32 bmaControls; /* Master Channel 0*/
1202 U32 bmaControls_1; // Channel 1
1203 U32 bmaControls_2; // Channel 2
1204 U8 iFeature; /* String Descriptor of this Feature Unit */
1205 } S_usb_feature_unit_descriptor_2;
1206
1207
1219
1227
1228
1230
1232 typedef
1233 #if (defined __ICCAVR32__)
1234 #pragma pack(1)
1235 #endif
1236 struct
1237 #if (defined __GNUC__)
1238 __attribute__((__packed__))
1239 #endif
1240 {
1241 U8 bLength; /* Size of this descriptor in bytes */
1242 U8 bDescriptorType; /* INTERFACE descriptor type */
1243 U8 bInterfaceNumber; /* Number of the interface (0 based) */
1244 U8 bAlternateSetting;
1245 U8 bNumEndpoints; /* Number of endpoints in this interface */
1246 U8 bInterfaceClass; /* AUDIO Interface class code */
1247 U8 bInterfaceSubclass; /* AUDIO_STREAMING Interface subclass code */
1248 U8 bInterfaceProtocol; /* IP_VERSION_02_00 Interface protocol code */
1249 U8 iInterface; /* String descriptor of this Interface */
1250 } S_usb_as_interface_descriptor;
1251
1252
1254 typedef
1255 #if (defined __ICCAVR32__)
1256 #pragma pack(1)
1257 #endif
1258 struct
1259 #if (defined __GNUC__)
1260 __attribute__((__packed__))
1261 #endif
1262 {
1263 U8 bLength; /* Size of this descriptor in bytes */
1264 U8 bDescriptorType; /* CS_INTERFACE descriptor type */
1265 U8 bDescriptorSubType; /* AS_GENERAL subtype */
1266 U8 bTerminalLink; /* Terminal ID to which this interface is connected */
1267 U8 bmControls; /* Bitmap of controls */
1268 U8 bFormatType; /* Format type the interface is using */
1269 U32 bmFormats; /* Bitmap of Formats this interface supports */
1270 U8 bNrChannels; /* Number of Physical channels in this interface cluster */
1271 U32 bmChannelConfig; /* Bitmap of spatial locations of the physical channels */
1272 U8 iChannelNames; /* String descriptor of the first physical channel */
1273 } S_usb_as_g_interface_descriptor_2;
1274
1275
1277 typedef
1278 #if (defined __ICCAVR32__)
1279 #pragma pack(1)
1280 #endif
1281 struct
1282 #if (defined __GNUC__)
1283 __attribute__((__packed__))
1284 #endif
1285 {
1286 U8 bLength; /* Size of this descriptor in bytes */
1287 U8 bDescriptorType; /* CS_INTERFACE descriptor type */
1288 U8 bDescriptorSubType; /* FORMAT_TYPE subtype */
1289 U8 bFormatType; /* Format Type this streaming interface is using */
1290 U8 bSubslotSize; /* Number of bytes in one audio subslot */
1291 U8 bBitResolution; /* Number of bits used from the available bits in the subslot */
1292 } S_usb_format_type_2;
1293
1294
1302
1303
1305 typedef
1306 #if (defined __ICCAVR32__)
1307 #pragma pack(1)
1308 #endif
1309 struct
1310 #if (defined __GNUC__)
1311 __attribute__((__packed__))
1312 #endif
1313 {
1314 U8 bLength; /* Size of this descriptor in bytes */
1315 U8 bDescriptorType; /* CS_ENDPOINT descriptor type */
1316 U8 bEndpointAddress; /* Address of the endpoint */
1317 U8 bmAttributes; /* Endpoint's attributes */
1318 U16 wMaxPacketSize; /* Maximum packet size for this EP */
1319 U8 bInterval; /* Interval for polling EP in ms */
1320 } S_usb_endpoint_audio_descriptor_2;
1321
1322
1324 typedef
1325 #if (defined __ICCAVR32__)
1326 #pragma pack(1)
1327 #endif
1328 struct
1329 #if (defined __GNUC__)
1330 __attribute__((__packed__))
1331 #endif
1332 {
1333 U8 bLength; /* Size of this descriptor in bytes */
1334 U8 bDescriptorType; /* CS_ENDPOINT descriptor type*/
1335 U8 bDescriptorSubType; /* EP_GENERAL subtype */
1336 U8 bmAttributes; /* Bitmap of attributes 8 */
1337 U8 bmControls; /* Paired bitmap of controls */
1338 U8 bLockDelayUnits; /* units for wLockDelay */
1339 U16 wLockDelay; /* time to lock endpoint */
1340 } S_usb_endpoint_audio_specific_2;
1341
1343 typedef
1344 #if (defined __ICCAVR32__)
1345 #pragma pack(1)
1346 #endif
1347 struct
1348 #if (defined __GNUC__)
1349 __attribute__((__packed__))
1350 #endif
1351 {
1352 U8 bLength; /* Size of this descriptor in bytes */
1353 U8 bDescriptorType; /* ENDPOINT descriptor type*/
1354 U8 bEndpointAddress; /* Endpoint Address */
1355 U8 bmAttributes; /* Bitmap of attributes 8 */
1356 U8 bmControls; /* Paired bitmap of controls */
1357 U16 wMaxPacketSize; /* Maximum packet size for this EP */
1358 U8 bInterval; /* Interval for polling EP in ms */
1359 } S_usb_endpoint_audio_feedback;
1360
1361 // task specific structure definitions moved to *_usb_descriptors.h
1362
1363 extern const S_usb_manufacturer_string_descriptor usb_user_manufacturer_string_descriptor;
1364 extern const S_usb_product_string_descriptor usb_user_product_string_descriptor;
1365 extern const S_usb_serial_number usb_user_serial_number;
1366 extern const S_usb_language_id usb_user_language_id;
1367
1368 extern const S_usb_wl usb_user_wl;
1369 extern const S_usb_ait usb_user_ait;
1370 extern const S_usb_aot usb_user_aot;
1371 extern const S_usb_ain usb_user_ain;
1372 extern const S_usb_aia usb_user_aia;
1373
1374 #define USB_HID_REPORT_DESC 47
1375 extern const U8 usb_hid_report_descriptor[USB_HID_REPORT_DESC];
1376
1377 extern U16 configTSK_USB_DEV_PERIOD;
1378
1379 #endif // _USB_DESCRIPTORS_H_