Hanna
Sourcecode Kontrollplatine
Descriptors.h
gehe zur Dokumentation dieser Datei
1 
19 /*
20  Copyright 2010 OBinou (obconseil [at] gmail [dot] com)
21  Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)
22 
23  Permission to use, copy, modify, distribute, and sell this
24  software and its documentation for any purpose is hereby granted
25  without fee, provided that the above copyright notice appear in
26  all copies and that both that the copyright notice and this
27  permission notice and warranty disclaimer appear in supporting
28  documentation, and that the name of the author not be used in
29  advertising or publicity pertaining to distribution of the
30  software without specific, written prior permission.
31 
32  The author disclaim all warranties with regard to this
33  software, including all implied warranties of merchantability
34  and fitness. In no event shall the author be liable for any
35  special, indirect or consequential damages or any damages
36  whatsoever resulting from loss of use, data or profits, whether
37  in an action of contract, negligence or other tortious action,
38  arising out of or in connection with the use or performance of
39  this software.
40  */
41 
42 #ifndef _DESCRIPTORS_H_
43 #define _DESCRIPTORS_H_
44 
45 /* Includes: */
46 #include <avr/pgmspace.h>
47 #include "usb_defaults.h"
48 
49 /* Macros: */
50 
52 // Endpoint Macros
54 
55 #define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2)
56 
58 #define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3)
59 
61 #define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 4)
62 
64 #define CDC_NOTIFICATION_EPSIZE 8
65 
67 #define CDC_TXRX_EPSIZE 64
68 
70 // CDC Macros
72 
75 #define CDC_CONTROL_LINE_OUT_DTR (1 << 0)
76 
80 #define CDC_CONTROL_LINE_OUT_RTS (1 << 1)
81 
85 #define CDC_CONTROL_LINE_IN_DCD (1 << 0)
86 
90 #define CDC_CONTROL_LINE_IN_DSR (1 << 1)
91 
95 #define CDC_CONTROL_LINE_IN_BREAK (1 << 2)
96 
100 #define CDC_CONTROL_LINE_IN_RING (1 << 3)
101 
105 #define CDC_CONTROL_LINE_IN_FRAMEERROR (1 << 4)
106 
110 #define CDC_CONTROL_LINE_IN_PARITYERROR (1 << 5)
111 
115 #define CDC_CONTROL_LINE_IN_OVERRUNERROR (1 << 6)
116 
118 // CDC class-specific Macros
120 
127 #define CDC_FUNCTIONAL_DESCRIPTOR(DataSize) \
128  struct \
129  { \
130  USB_Descriptor_Header_t Header; \
131  uint8_t SubType; \
132  uint8_t Data[DataSize]; \
133  }
134 
136 // CDC Enums
138 
142 {
170 };
171 
174 {
181 };
182 
185 {
191 };
192 
195 {
213 };
214 
217 {
221 };
222 
225 {
231 };
232 
234 // CDC typedefs
236 
246 typedef struct
247 {
248  USB_Descriptor_Header_t Header;
249  uint8_t Subtype;
252  uint16_t CDCSpecification;
255 }ATTR_PACKED USB_CDC_Descriptor_FunctionalHeader_t;
256 
268 typedef struct
269 {
270  uint8_t bFunctionLength;
271  uint8_t bDescriptorType;
277  uint16_t bcdCDC;
278 }ATTR_PACKED USB_CDC_StdDescriptor_FunctionalHeader_t;
279 
289 typedef struct
290 {
291  USB_Descriptor_Header_t Header;
292  uint8_t Subtype;
295  uint8_t Capabilities;
299 }ATTR_PACKED USB_CDC_Descriptor_FunctionalACM_t;
300 
311 typedef struct
312 {
313  uint8_t bFunctionLength;
314  uint8_t bDescriptorType;
317  uint8_t bDescriptorSubType;
320  uint8_t bmCapabilities;
324 }ATTR_PACKED USB_CDC_StdDescriptor_FunctionalACM_t;
325 
335 typedef struct
336 {
337  USB_Descriptor_Header_t Header;
338  uint8_t Subtype;
343 }ATTR_PACKED USB_CDC_Descriptor_FunctionalUnion_t;
344 
355 typedef struct
356 {
357  uint8_t bFunctionLength;
358  uint8_t bDescriptorType;
361  uint8_t bDescriptorSubType;
366 }ATTR_PACKED USB_CDC_StdDescriptor_FunctionalUnion_t;
367 
375 typedef struct
376 {
377  uint32_t BaudRateBPS;
378  uint8_t CharFormat;
381  uint8_t ParityType;
384  uint8_t DataBits;
385 }ATTR_PACKED CDC_LineEncoding_t;
386 
387 /* Type Defines: */
392 typedef struct
393 {
394  USB_Descriptor_Configuration_Header_t Config;
395 
396  // CDC Control Interface
397  USB_Descriptor_Interface_t CDC_CCI_Interface;
398  USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header;
399  USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM;
400  USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union;
401  USB_Descriptor_Endpoint_t CDC_NotificationEndpoint;
402 
403  // CDC Data Interface
404  USB_Descriptor_Interface_t CDC_DCI_Interface;
405  USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;
406  USB_Descriptor_Endpoint_t CDC_DataInEndpoint;
408 
410 // CDC Prototypes
412 /* Function Prototypes: */
413 uint16_t CALLBACK_USB_GetDescriptor ( const uint16_t wValue,
414  const uint8_t wIndex, const void** const DescriptorAddress ) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
415 
416 #endif
417 
Bibliothek zur USB-Kommunikation von Jürgen W.
uint8_t bDescriptorSubType
Definition: Descriptors.h:274
CDC_Descriptor_ClassSubclassProtocol_t
Definition: Descriptors.h:141
uint16_t CDCSpecification
Definition: Descriptors.h:252
uint8_t DataBits
Definition: Descriptors.h:384
uint16_t bcdCDC
Definition: Descriptors.h:277
CDC_ClassNotifications_t
Definition: Descriptors.h:184
uint8_t Capabilities
Definition: Descriptors.h:295
uint8_t ParityType
Definition: Descriptors.h:381
CDC_ClassRequests_t
Definition: Descriptors.h:173
uint8_t bFunctionLength
Definition: Descriptors.h:270
uint8_t bMasterInterface
Definition: Descriptors.h:364
uint8_t Subtype
Definition: Descriptors.h:249
uint8_t bDescriptorType
Definition: Descriptors.h:271
CDC_LineEncodingFormats_t
Definition: Descriptors.h:216
uint8_t bSlaveInterface0
Definition: Descriptors.h:365
uint8_t bmCapabilities
Definition: Descriptors.h:320
uint8_t SlaveInterfaceNumber
Definition: Descriptors.h:342
uint32_t BaudRateBPS
Definition: Descriptors.h:377
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, const void **const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3)
Definition: Descriptors.c:182
CDC_LineEncodingParity_t
Definition: Descriptors.h:224
USB_Descriptor_Header_t Header
Definition: Descriptors.h:248
uint8_t MasterInterfaceNumber
Definition: Descriptors.h:341
uint8_t CharFormat
Definition: Descriptors.h:378
CDC_DescriptorSubtypes_t
Definition: Descriptors.h:194