libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
cdc.h
Go to the documentation of this file.
1/** @defgroup usb_cdc_defines USB CDC Type Definitions
2
3@brief <b>Defined Constants and Types for the USB CDC Type Definitions</b>
4
5@ingroup USB_defines
6
7@version 1.0.0
8
9@author @htmlonly &copy; @endhtmlonly 2010
10Gareth McMullin <gareth@blacksphere.co.nz>
11
12@date 10 March 2013
13
14LGPL License Terms @ref lgpl_license
15*/
16
17/*
18 * This file is part of the libopencm3 project.
19 *
20 * Copyright (C) 2010 Gareth McMullin <gareth@blacksphere.co.nz>
21 *
22 * This library is free software: you can redistribute it and/or modify
23 * it under the terms of the GNU Lesser General Public License as published by
24 * the Free Software Foundation, either version 3 of the License, or
25 * (at your option) any later version.
26 *
27 * This library is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 * GNU Lesser General Public License for more details.
31 *
32 * You should have received a copy of the GNU Lesser General Public License
33 * along with this library. If not, see <http://www.gnu.org/licenses/>.
34 */
35
36/**@{*/
37
38#ifndef __CDC_H
39#define __CDC_H
40
41#include <stdint.h>
42
43/* Definitions of Communications Device Class from
44 * "Universal Serial Bus Class Definitions for Communications Devices
45 * Revision 1.2"
46 */
47
48/* Table 2: Communications Device Class Code */
49#define USB_CLASS_CDC 0x02
50
51/* Table 4: Class Subclass Code */
52#define USB_CDC_SUBCLASS_DLCM 0x01
53#define USB_CDC_SUBCLASS_ACM 0x02
54/* ... */
55
56/* Table 5 Communications Interface Class Control Protocol Codes */
57#define USB_CDC_PROTOCOL_NONE 0x00
58#define USB_CDC_PROTOCOL_AT 0x01
59/* ... */
60
61/* Table 6: Data Interface Class Code */
62#define USB_CLASS_DATA 0x0A
63
64/* Table 12: Type Values for the bDescriptorType Field */
65#define CS_INTERFACE 0x24
66#define CS_ENDPOINT 0x25
67
68/* Table 13: bDescriptor SubType in Communications Class Functional
69 * Descriptors */
70#define USB_CDC_TYPE_HEADER 0x00
71#define USB_CDC_TYPE_CALL_MANAGEMENT 0x01
72#define USB_CDC_TYPE_ACM 0x02
73/* ... */
74#define USB_CDC_TYPE_UNION 0x06
75/* ... */
76
77/* Table 15: Class-Specific Descriptor Header Format */
82 uint16_t bcdCDC;
83} __attribute__((packed));
84
85/* Table 16: Union Interface Functional Descriptor */
92 /* ... */
93} __attribute__((packed));
94
95
96/* Definitions for Abstract Control Model devices from:
97 * "Universal Serial Bus Communications Class Subclass Specification for
98 * PSTN Devices"
99 */
100
101/* Table 3: Call Management Functional Descriptor */
108} __attribute__((packed));
109
110/* Table 4: Abstract Control Management Functional Descriptor */
116} __attribute__((packed));
117
118/* Table 13: Class-Specific Request Codes for PSTN subclasses */
119/* ... */
120#define USB_CDC_REQ_SET_LINE_CODING 0x20
121/* ... */
122#define USB_CDC_REQ_SET_CONTROL_LINE_STATE 0x22
123/* ... */
124
125/* Table 17: Line Coding Structure */
127 uint32_t dwDTERate;
128 uint8_t bCharFormat;
129 uint8_t bParityType;
130 uint8_t bDataBits;
131} __attribute__((packed));
132
137};
138
145};
146
147/* Table 30: Class-Specific Notification Codes for PSTN subclasses */
148/* ... */
149#define USB_CDC_NOTIFY_SERIAL_STATE 0x20
150/* ... */
151
152/* Notification Structure */
156 uint16_t wValue;
157 uint16_t wIndex;
158 uint16_t wLength;
159} __attribute__((packed));
160
161#endif
162
163/**@}*/
164
usb_cdc_line_coding_bParityType
Definition: cdc.h:139
usb_cdc_line_coding_bCharFormat
Definition: cdc.h:133
@ USB_CDC_EVEN_PARITY
Definition: cdc.h:142
@ USB_CDC_ODD_PARITY
Definition: cdc.h:141
@ USB_CDC_MARK_PARITY
Definition: cdc.h:143
@ USB_CDC_SPACE_PARITY
Definition: cdc.h:144
@ USB_CDC_NO_PARITY
Definition: cdc.h:140
@ USB_CDC_1_STOP_BITS
Definition: cdc.h:134
@ USB_CDC_1_5_STOP_BITS
Definition: cdc.h:135
@ USB_CDC_2_STOP_BITS
Definition: cdc.h:136
uint8_t bFunctionLength
Definition: cdc.h:112
uint8_t bmCapabilities
Definition: cdc.h:115
uint8_t bDescriptorSubtype
Definition: cdc.h:114
uint8_t bDescriptorType
Definition: cdc.h:113
uint8_t bDescriptorSubtype
Definition: cdc.h:81
uint8_t bDescriptorType
Definition: cdc.h:80
uint8_t bFunctionLength
Definition: cdc.h:79
uint8_t bDataBits
Definition: cdc.h:130
uint8_t bCharFormat
Definition: cdc.h:128
uint32_t dwDTERate
Definition: cdc.h:127
uint8_t bParityType
Definition: cdc.h:129
uint16_t wIndex
Definition: cdc.h:157
uint8_t bNotification
Definition: cdc.h:155
uint16_t wLength
Definition: cdc.h:158
uint16_t wValue
Definition: cdc.h:156
uint8_t bmRequestType
Definition: cdc.h:154
uint8_t bDescriptorType
Definition: cdc.h:88
uint8_t bControlInterface
Definition: cdc.h:90
uint8_t bSubordinateInterface0
Definition: cdc.h:91
uint8_t bDescriptorSubtype
Definition: cdc.h:89
uint8_t bFunctionLength
Definition: cdc.h:87