These are the examples provided for [[/users/frank26080115/libraries/LPC1700CMSIS_Lib/]] Note, the entire "program" is not compilable!
USBDEV/USBCDC/cdc.h@0:bf7b9fba3924, 2011-03-20 (annotated)
- Committer:
- frank26080115
- Date:
- Sun Mar 20 05:38:56 2011 +0000
- Revision:
- 0:bf7b9fba3924
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
frank26080115 | 0:bf7b9fba3924 | 1 | /*---------------------------------------------------------------------------- |
frank26080115 | 0:bf7b9fba3924 | 2 | * U S B - K e r n e l |
frank26080115 | 0:bf7b9fba3924 | 3 | *---------------------------------------------------------------------------- |
frank26080115 | 0:bf7b9fba3924 | 4 | * Name: CDC.h |
frank26080115 | 0:bf7b9fba3924 | 5 | * Purpose: USB Communication Device Class Definitions |
frank26080115 | 0:bf7b9fba3924 | 6 | * Version: V1.20 |
frank26080115 | 0:bf7b9fba3924 | 7 | *---------------------------------------------------------------------------- |
frank26080115 | 0:bf7b9fba3924 | 8 | * This software is supplied "AS IS" without any warranties, express, |
frank26080115 | 0:bf7b9fba3924 | 9 | * implied or statutory, including but not limited to the implied |
frank26080115 | 0:bf7b9fba3924 | 10 | * warranties of fitness for purpose, satisfactory quality and |
frank26080115 | 0:bf7b9fba3924 | 11 | * noninfringement. Keil extends you a royalty-free right to reproduce |
frank26080115 | 0:bf7b9fba3924 | 12 | * and distribute executable files created using this software for use |
frank26080115 | 0:bf7b9fba3924 | 13 | * on NXP Semiconductors LPC family microcontroller devices only. Nothing |
frank26080115 | 0:bf7b9fba3924 | 14 | * else gives you the right to use this software. |
frank26080115 | 0:bf7b9fba3924 | 15 | * |
frank26080115 | 0:bf7b9fba3924 | 16 | * Copyright (c) 2009 Keil - An ARM Company. All rights reserved. |
frank26080115 | 0:bf7b9fba3924 | 17 | *---------------------------------------------------------------------------*/ |
frank26080115 | 0:bf7b9fba3924 | 18 | |
frank26080115 | 0:bf7b9fba3924 | 19 | #ifndef __CDC_H |
frank26080115 | 0:bf7b9fba3924 | 20 | #define __CDC_H |
frank26080115 | 0:bf7b9fba3924 | 21 | #include "lpc_types.h" |
frank26080115 | 0:bf7b9fba3924 | 22 | |
frank26080115 | 0:bf7b9fba3924 | 23 | #if defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 24 | #define __packed __attribute__((__packed__)) |
frank26080115 | 0:bf7b9fba3924 | 25 | #endif |
frank26080115 | 0:bf7b9fba3924 | 26 | /*---------------------------------------------------------------------------- |
frank26080115 | 0:bf7b9fba3924 | 27 | * Definitions based on usbcdc11.pdf (www.usb.org) |
frank26080115 | 0:bf7b9fba3924 | 28 | *---------------------------------------------------------------------------*/ |
frank26080115 | 0:bf7b9fba3924 | 29 | // Communication device class specification version 1.10 |
frank26080115 | 0:bf7b9fba3924 | 30 | #define CDC_V1_10 0x0110 |
frank26080115 | 0:bf7b9fba3924 | 31 | |
frank26080115 | 0:bf7b9fba3924 | 32 | // Communication interface class code |
frank26080115 | 0:bf7b9fba3924 | 33 | // (usbcdc11.pdf, 4.2, Table 15) |
frank26080115 | 0:bf7b9fba3924 | 34 | #define CDC_COMMUNICATION_INTERFACE_CLASS 0x02 |
frank26080115 | 0:bf7b9fba3924 | 35 | |
frank26080115 | 0:bf7b9fba3924 | 36 | // Communication interface class subclass codes |
frank26080115 | 0:bf7b9fba3924 | 37 | // (usbcdc11.pdf, 4.3, Table 16) |
frank26080115 | 0:bf7b9fba3924 | 38 | #define CDC_DIRECT_LINE_CONTROL_MODEL 0x01 |
frank26080115 | 0:bf7b9fba3924 | 39 | #define CDC_ABSTRACT_CONTROL_MODEL 0x02 |
frank26080115 | 0:bf7b9fba3924 | 40 | #define CDC_TELEPHONE_CONTROL_MODEL 0x03 |
frank26080115 | 0:bf7b9fba3924 | 41 | #define CDC_MULTI_CHANNEL_CONTROL_MODEL 0x04 |
frank26080115 | 0:bf7b9fba3924 | 42 | #define CDC_CAPI_CONTROL_MODEL 0x05 |
frank26080115 | 0:bf7b9fba3924 | 43 | #define CDC_ETHERNET_NETWORKING_CONTROL_MODEL 0x06 |
frank26080115 | 0:bf7b9fba3924 | 44 | #define CDC_ATM_NETWORKING_CONTROL_MODEL 0x07 |
frank26080115 | 0:bf7b9fba3924 | 45 | |
frank26080115 | 0:bf7b9fba3924 | 46 | // Communication interface class control protocol codes |
frank26080115 | 0:bf7b9fba3924 | 47 | // (usbcdc11.pdf, 4.4, Table 17) |
frank26080115 | 0:bf7b9fba3924 | 48 | #define CDC_PROTOCOL_COMMON_AT_COMMANDS 0x01 |
frank26080115 | 0:bf7b9fba3924 | 49 | |
frank26080115 | 0:bf7b9fba3924 | 50 | // Data interface class code |
frank26080115 | 0:bf7b9fba3924 | 51 | // (usbcdc11.pdf, 4.5, Table 18) |
frank26080115 | 0:bf7b9fba3924 | 52 | #define CDC_DATA_INTERFACE_CLASS 0x0A |
frank26080115 | 0:bf7b9fba3924 | 53 | |
frank26080115 | 0:bf7b9fba3924 | 54 | // Data interface class protocol codes |
frank26080115 | 0:bf7b9fba3924 | 55 | // (usbcdc11.pdf, 4.7, Table 19) |
frank26080115 | 0:bf7b9fba3924 | 56 | #define CDC_PROTOCOL_ISDN_BRI 0x30 |
frank26080115 | 0:bf7b9fba3924 | 57 | #define CDC_PROTOCOL_HDLC 0x31 |
frank26080115 | 0:bf7b9fba3924 | 58 | #define CDC_PROTOCOL_TRANSPARENT 0x32 |
frank26080115 | 0:bf7b9fba3924 | 59 | #define CDC_PROTOCOL_Q921_MANAGEMENT 0x50 |
frank26080115 | 0:bf7b9fba3924 | 60 | #define CDC_PROTOCOL_Q921_DATA_LINK 0x51 |
frank26080115 | 0:bf7b9fba3924 | 61 | #define CDC_PROTOCOL_Q921_MULTIPLEXOR 0x52 |
frank26080115 | 0:bf7b9fba3924 | 62 | #define CDC_PROTOCOL_V42 0x90 |
frank26080115 | 0:bf7b9fba3924 | 63 | #define CDC_PROTOCOL_EURO_ISDN 0x91 |
frank26080115 | 0:bf7b9fba3924 | 64 | #define CDC_PROTOCOL_V24_RATE_ADAPTATION 0x92 |
frank26080115 | 0:bf7b9fba3924 | 65 | #define CDC_PROTOCOL_CAPI 0x93 |
frank26080115 | 0:bf7b9fba3924 | 66 | #define CDC_PROTOCOL_HOST_BASED_DRIVER 0xFD |
frank26080115 | 0:bf7b9fba3924 | 67 | #define CDC_PROTOCOL_DESCRIBED_IN_PUFD 0xFE |
frank26080115 | 0:bf7b9fba3924 | 68 | |
frank26080115 | 0:bf7b9fba3924 | 69 | // Type values for bDescriptorType field of functional descriptors |
frank26080115 | 0:bf7b9fba3924 | 70 | // (usbcdc11.pdf, 5.2.3, Table 24) |
frank26080115 | 0:bf7b9fba3924 | 71 | #define CDC_CS_INTERFACE 0x24 |
frank26080115 | 0:bf7b9fba3924 | 72 | #define CDC_CS_ENDPOINT 0x25 |
frank26080115 | 0:bf7b9fba3924 | 73 | |
frank26080115 | 0:bf7b9fba3924 | 74 | // Type values for bDescriptorSubtype field of functional descriptors |
frank26080115 | 0:bf7b9fba3924 | 75 | // (usbcdc11.pdf, 5.2.3, Table 25) |
frank26080115 | 0:bf7b9fba3924 | 76 | #define CDC_HEADER 0x00 |
frank26080115 | 0:bf7b9fba3924 | 77 | #define CDC_CALL_MANAGEMENT 0x01 |
frank26080115 | 0:bf7b9fba3924 | 78 | #define CDC_ABSTRACT_CONTROL_MANAGEMENT 0x02 |
frank26080115 | 0:bf7b9fba3924 | 79 | #define CDC_DIRECT_LINE_MANAGEMENT 0x03 |
frank26080115 | 0:bf7b9fba3924 | 80 | #define CDC_TELEPHONE_RINGER 0x04 |
frank26080115 | 0:bf7b9fba3924 | 81 | #define CDC_REPORTING_CAPABILITIES 0x05 |
frank26080115 | 0:bf7b9fba3924 | 82 | #define CDC_UNION 0x06 |
frank26080115 | 0:bf7b9fba3924 | 83 | #define CDC_COUNTRY_SELECTION 0x07 |
frank26080115 | 0:bf7b9fba3924 | 84 | #define CDC_TELEPHONE_OPERATIONAL_MODES 0x08 |
frank26080115 | 0:bf7b9fba3924 | 85 | #define CDC_USB_TERMINAL 0x09 |
frank26080115 | 0:bf7b9fba3924 | 86 | #define CDC_NETWORK_CHANNEL 0x0A |
frank26080115 | 0:bf7b9fba3924 | 87 | #define CDC_PROTOCOL_UNIT 0x0B |
frank26080115 | 0:bf7b9fba3924 | 88 | #define CDC_EXTENSION_UNIT 0x0C |
frank26080115 | 0:bf7b9fba3924 | 89 | #define CDC_MULTI_CHANNEL_MANAGEMENT 0x0D |
frank26080115 | 0:bf7b9fba3924 | 90 | #define CDC_CAPI_CONTROL_MANAGEMENT 0x0E |
frank26080115 | 0:bf7b9fba3924 | 91 | #define CDC_ETHERNET_NETWORKING 0x0F |
frank26080115 | 0:bf7b9fba3924 | 92 | #define CDC_ATM_NETWORKING 0x10 |
frank26080115 | 0:bf7b9fba3924 | 93 | |
frank26080115 | 0:bf7b9fba3924 | 94 | // CDC class-specific request codes |
frank26080115 | 0:bf7b9fba3924 | 95 | // (usbcdc11.pdf, 6.2, Table 46) |
frank26080115 | 0:bf7b9fba3924 | 96 | // see Table 45 for info about the specific requests. |
frank26080115 | 0:bf7b9fba3924 | 97 | #define CDC_SEND_ENCAPSULATED_COMMAND 0x00 |
frank26080115 | 0:bf7b9fba3924 | 98 | #define CDC_GET_ENCAPSULATED_RESPONSE 0x01 |
frank26080115 | 0:bf7b9fba3924 | 99 | #define CDC_SET_COMM_FEATURE 0x02 |
frank26080115 | 0:bf7b9fba3924 | 100 | #define CDC_GET_COMM_FEATURE 0x03 |
frank26080115 | 0:bf7b9fba3924 | 101 | #define CDC_CLEAR_COMM_FEATURE 0x04 |
frank26080115 | 0:bf7b9fba3924 | 102 | #define CDC_SET_AUX_LINE_STATE 0x10 |
frank26080115 | 0:bf7b9fba3924 | 103 | #define CDC_SET_HOOK_STATE 0x11 |
frank26080115 | 0:bf7b9fba3924 | 104 | #define CDC_PULSE_SETUP 0x12 |
frank26080115 | 0:bf7b9fba3924 | 105 | #define CDC_SEND_PULSE 0x13 |
frank26080115 | 0:bf7b9fba3924 | 106 | #define CDC_SET_PULSE_TIME 0x14 |
frank26080115 | 0:bf7b9fba3924 | 107 | #define CDC_RING_AUX_JACK 0x15 |
frank26080115 | 0:bf7b9fba3924 | 108 | #define CDC_SET_LINE_CODING 0x20 |
frank26080115 | 0:bf7b9fba3924 | 109 | #define CDC_GET_LINE_CODING 0x21 |
frank26080115 | 0:bf7b9fba3924 | 110 | #define CDC_SET_CONTROL_LINE_STATE 0x22 |
frank26080115 | 0:bf7b9fba3924 | 111 | #define CDC_SEND_BREAK 0x23 |
frank26080115 | 0:bf7b9fba3924 | 112 | #define CDC_SET_RINGER_PARMS 0x30 |
frank26080115 | 0:bf7b9fba3924 | 113 | #define CDC_GET_RINGER_PARMS 0x31 |
frank26080115 | 0:bf7b9fba3924 | 114 | #define CDC_SET_OPERATION_PARMS 0x32 |
frank26080115 | 0:bf7b9fba3924 | 115 | #define CDC_GET_OPERATION_PARMS 0x33 |
frank26080115 | 0:bf7b9fba3924 | 116 | #define CDC_SET_LINE_PARMS 0x34 |
frank26080115 | 0:bf7b9fba3924 | 117 | #define CDC_GET_LINE_PARMS 0x35 |
frank26080115 | 0:bf7b9fba3924 | 118 | #define CDC_DIAL_DIGITS 0x36 |
frank26080115 | 0:bf7b9fba3924 | 119 | #define CDC_SET_UNIT_PARAMETER 0x37 |
frank26080115 | 0:bf7b9fba3924 | 120 | #define CDC_GET_UNIT_PARAMETER 0x38 |
frank26080115 | 0:bf7b9fba3924 | 121 | #define CDC_CLEAR_UNIT_PARAMETER 0x39 |
frank26080115 | 0:bf7b9fba3924 | 122 | #define CDC_GET_PROFILE 0x3A |
frank26080115 | 0:bf7b9fba3924 | 123 | #define CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40 |
frank26080115 | 0:bf7b9fba3924 | 124 | #define CDC_SET_ETHERNET_PMP_FILTER 0x41 |
frank26080115 | 0:bf7b9fba3924 | 125 | #define CDC_GET_ETHERNET_PMP_FILTER 0x42 |
frank26080115 | 0:bf7b9fba3924 | 126 | #define CDC_SET_ETHERNET_PACKET_FILTER 0x43 |
frank26080115 | 0:bf7b9fba3924 | 127 | #define CDC_GET_ETHERNET_STATISTIC 0x44 |
frank26080115 | 0:bf7b9fba3924 | 128 | #define CDC_SET_ATM_DATA_FORMAT 0x50 |
frank26080115 | 0:bf7b9fba3924 | 129 | #define CDC_GET_ATM_DEVICE_STATISTICS 0x51 |
frank26080115 | 0:bf7b9fba3924 | 130 | #define CDC_SET_ATM_DEFAULT_VC 0x52 |
frank26080115 | 0:bf7b9fba3924 | 131 | #define CDC_GET_ATM_VC_STATISTICS 0x53 |
frank26080115 | 0:bf7b9fba3924 | 132 | |
frank26080115 | 0:bf7b9fba3924 | 133 | // Communication feature selector codes |
frank26080115 | 0:bf7b9fba3924 | 134 | // (usbcdc11.pdf, 6.2.2..6.2.4, Table 47) |
frank26080115 | 0:bf7b9fba3924 | 135 | #define CDC_ABSTRACT_STATE 0x01 |
frank26080115 | 0:bf7b9fba3924 | 136 | #define CDC_COUNTRY_SETTING 0x02 |
frank26080115 | 0:bf7b9fba3924 | 137 | |
frank26080115 | 0:bf7b9fba3924 | 138 | // Feature Status returned for ABSTRACT_STATE Selector |
frank26080115 | 0:bf7b9fba3924 | 139 | // (usbcdc11.pdf, 6.2.3, Table 48) |
frank26080115 | 0:bf7b9fba3924 | 140 | #define CDC_IDLE_SETTING (1 << 0) |
frank26080115 | 0:bf7b9fba3924 | 141 | #define CDC_DATA_MULTPLEXED_STATE (1 << 1) |
frank26080115 | 0:bf7b9fba3924 | 142 | |
frank26080115 | 0:bf7b9fba3924 | 143 | |
frank26080115 | 0:bf7b9fba3924 | 144 | // Control signal bitmap values for the SetControlLineState request |
frank26080115 | 0:bf7b9fba3924 | 145 | // (usbcdc11.pdf, 6.2.14, Table 51) |
frank26080115 | 0:bf7b9fba3924 | 146 | #define CDC_DTE_PRESENT (1 << 0) |
frank26080115 | 0:bf7b9fba3924 | 147 | #define CDC_ACTIVATE_CARRIER (1 << 1) |
frank26080115 | 0:bf7b9fba3924 | 148 | |
frank26080115 | 0:bf7b9fba3924 | 149 | // CDC class-specific notification codes |
frank26080115 | 0:bf7b9fba3924 | 150 | // (usbcdc11.pdf, 6.3, Table 68) |
frank26080115 | 0:bf7b9fba3924 | 151 | // see Table 67 for Info about class-specific notifications |
frank26080115 | 0:bf7b9fba3924 | 152 | #define CDC_NOTIFICATION_NETWORK_CONNECTION 0x00 |
frank26080115 | 0:bf7b9fba3924 | 153 | #define CDC_RESPONSE_AVAILABLE 0x01 |
frank26080115 | 0:bf7b9fba3924 | 154 | #define CDC_AUX_JACK_HOOK_STATE 0x08 |
frank26080115 | 0:bf7b9fba3924 | 155 | #define CDC_RING_DETECT 0x09 |
frank26080115 | 0:bf7b9fba3924 | 156 | #define CDC_NOTIFICATION_SERIAL_STATE 0x20 |
frank26080115 | 0:bf7b9fba3924 | 157 | #define CDC_CALL_STATE_CHANGE 0x28 |
frank26080115 | 0:bf7b9fba3924 | 158 | #define CDC_LINE_STATE_CHANGE 0x29 |
frank26080115 | 0:bf7b9fba3924 | 159 | #define CDC_CONNECTION_SPEED_CHANGE 0x2A |
frank26080115 | 0:bf7b9fba3924 | 160 | |
frank26080115 | 0:bf7b9fba3924 | 161 | // UART state bitmap values (Serial state notification). |
frank26080115 | 0:bf7b9fba3924 | 162 | // (usbcdc11.pdf, 6.3.5, Table 69) |
frank26080115 | 0:bf7b9fba3924 | 163 | #define CDC_SERIAL_STATE_OVERRUN (1 << 6) // receive data overrun error has occurred |
frank26080115 | 0:bf7b9fba3924 | 164 | #define CDC_SERIAL_STATE_PARITY (1 << 5) // parity error has occurred |
frank26080115 | 0:bf7b9fba3924 | 165 | #define CDC_SERIAL_STATE_FRAMING (1 << 4) // framing error has occurred |
frank26080115 | 0:bf7b9fba3924 | 166 | #define CDC_SERIAL_STATE_RING (1 << 3) // state of ring signal detection |
frank26080115 | 0:bf7b9fba3924 | 167 | #define CDC_SERIAL_STATE_BREAK (1 << 2) // state of break detection |
frank26080115 | 0:bf7b9fba3924 | 168 | #define CDC_SERIAL_STATE_TX_CARRIER (1 << 1) // state of transmission carrier |
frank26080115 | 0:bf7b9fba3924 | 169 | #define CDC_SERIAL_STATE_RX_CARRIER (1 << 0) // state of receiver carrier |
frank26080115 | 0:bf7b9fba3924 | 170 | |
frank26080115 | 0:bf7b9fba3924 | 171 | |
frank26080115 | 0:bf7b9fba3924 | 172 | /*---------------------------------------------------------------------------- |
frank26080115 | 0:bf7b9fba3924 | 173 | * Structures based on usbcdc11.pdf (www.usb.org) |
frank26080115 | 0:bf7b9fba3924 | 174 | *---------------------------------------------------------------------------*/ |
frank26080115 | 0:bf7b9fba3924 | 175 | |
frank26080115 | 0:bf7b9fba3924 | 176 | // Header functional descriptor |
frank26080115 | 0:bf7b9fba3924 | 177 | // (usbcdc11.pdf, 5.2.3.1) |
frank26080115 | 0:bf7b9fba3924 | 178 | // This header must precede any list of class-specific descriptors. |
frank26080115 | 0:bf7b9fba3924 | 179 | |
frank26080115 | 0:bf7b9fba3924 | 180 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 181 | typedef __packed struct _CDC_HEADER_DESCRIPTOR{ |
frank26080115 | 0:bf7b9fba3924 | 182 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 183 | typedef struct __packed _CDC_HEADER_DESCRIPTOR{ |
frank26080115 | 0:bf7b9fba3924 | 184 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 185 | #pragma pack(1) |
frank26080115 | 0:bf7b9fba3924 | 186 | typedef struct _CDC_HEADER_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 187 | #endif |
frank26080115 | 0:bf7b9fba3924 | 188 | uint8_t bFunctionLength; // size of this descriptor in bytes |
frank26080115 | 0:bf7b9fba3924 | 189 | uint8_t bDescriptorType; // CS_INTERFACE descriptor type |
frank26080115 | 0:bf7b9fba3924 | 190 | uint8_t bDescriptorSubtype; // Header functional descriptor subtype |
frank26080115 | 0:bf7b9fba3924 | 191 | uint16_t bcdCDC; // USB CDC specification release version |
frank26080115 | 0:bf7b9fba3924 | 192 | } CDC_HEADER_DESCRIPTOR; |
frank26080115 | 0:bf7b9fba3924 | 193 | |
frank26080115 | 0:bf7b9fba3924 | 194 | //Call management functional descriptor |
frank26080115 | 0:bf7b9fba3924 | 195 | // (usbcdc11.pdf, 5.2.3.2) |
frank26080115 | 0:bf7b9fba3924 | 196 | // Describes the processing of calls for the communication class interface. |
frank26080115 | 0:bf7b9fba3924 | 197 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 198 | typedef __packed struct _CDC_CALL_MANAGEMENT_DESCRIPTOR{ |
frank26080115 | 0:bf7b9fba3924 | 199 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 200 | typedef struct __packed _CDC_CALL_MANAGEMENT_DESCRIPTOR{ |
frank26080115 | 0:bf7b9fba3924 | 201 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 202 | #pragma pack(1) |
frank26080115 | 0:bf7b9fba3924 | 203 | typedef struct _CDC_CALL_MANAGEMENT_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 204 | #endif |
frank26080115 | 0:bf7b9fba3924 | 205 | uint8_t bFunctionLength; // size of this descriptor in bytes |
frank26080115 | 0:bf7b9fba3924 | 206 | uint8_t bDescriptorType; // CS_INTERFACE descriptor type |
frank26080115 | 0:bf7b9fba3924 | 207 | uint8_t bDescriptorSubtype; // call management functional descriptor subtype |
frank26080115 | 0:bf7b9fba3924 | 208 | uint8_t bmCapabilities; // capabilities that this configuration supports |
frank26080115 | 0:bf7b9fba3924 | 209 | uint8_t bDataInterface; // interface number of the data class interface used for call management (optional) |
frank26080115 | 0:bf7b9fba3924 | 210 | } CDC_CALL_MANAGEMENT_DESCRIPTOR; |
frank26080115 | 0:bf7b9fba3924 | 211 | |
frank26080115 | 0:bf7b9fba3924 | 212 | // Abstract control management functional descriptor |
frank26080115 | 0:bf7b9fba3924 | 213 | // (usbcdc11.pdf, 5.2.3.3) |
frank26080115 | 0:bf7b9fba3924 | 214 | // Describes the command supported by the communication interface class with the Abstract Control Model subclass code. |
frank26080115 | 0:bf7b9fba3924 | 215 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 216 | typedef __packed struct _CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR{ |
frank26080115 | 0:bf7b9fba3924 | 217 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 218 | typedef struct __packed _CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR{ |
frank26080115 | 0:bf7b9fba3924 | 219 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 220 | #pragma pack(1) |
frank26080115 | 0:bf7b9fba3924 | 221 | typedef struct _CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 222 | #endif |
frank26080115 | 0:bf7b9fba3924 | 223 | uint8_t bFunctionLength; // size of this descriptor in bytes |
frank26080115 | 0:bf7b9fba3924 | 224 | uint8_t bDescriptorType; // CS_INTERFACE descriptor type |
frank26080115 | 0:bf7b9fba3924 | 225 | uint8_t bDescriptorSubtype; // abstract control management functional descriptor subtype |
frank26080115 | 0:bf7b9fba3924 | 226 | uint8_t bmCapabilities; // capabilities supported by this configuration |
frank26080115 | 0:bf7b9fba3924 | 227 | } CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR; |
frank26080115 | 0:bf7b9fba3924 | 228 | |
frank26080115 | 0:bf7b9fba3924 | 229 | // Union functional descriptors |
frank26080115 | 0:bf7b9fba3924 | 230 | // (usbcdc11.pdf, 5.2.3.8) |
frank26080115 | 0:bf7b9fba3924 | 231 | // Describes the relationship between a group of interfaces that can be considered to form a functional unit. |
frank26080115 | 0:bf7b9fba3924 | 232 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 233 | typedef __packed struct _CDC_UNION_DESCRIPTOR{ |
frank26080115 | 0:bf7b9fba3924 | 234 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 235 | typedef struct __packed _CDC_UNION_DESCRIPTOR{ |
frank26080115 | 0:bf7b9fba3924 | 236 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 237 | #pragma pack(1) |
frank26080115 | 0:bf7b9fba3924 | 238 | typedef struct _CDC_UNION_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 239 | #endif |
frank26080115 | 0:bf7b9fba3924 | 240 | uint8_t bFunctionLength; // size of this descriptor in bytes |
frank26080115 | 0:bf7b9fba3924 | 241 | uint8_t bDescriptorType; // CS_INTERFACE descriptor type |
frank26080115 | 0:bf7b9fba3924 | 242 | uint8_t bDescriptorSubtype; // union functional descriptor subtype |
frank26080115 | 0:bf7b9fba3924 | 243 | uint8_t bMasterInterface; // interface number designated as master |
frank26080115 | 0:bf7b9fba3924 | 244 | } CDC_UNION_DESCRIPTOR; |
frank26080115 | 0:bf7b9fba3924 | 245 | |
frank26080115 | 0:bf7b9fba3924 | 246 | // Union functional descriptors with one slave interface |
frank26080115 | 0:bf7b9fba3924 | 247 | // (usbcdc11.pdf, 5.2.3.8) |
frank26080115 | 0:bf7b9fba3924 | 248 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 249 | typedef __packed struct _CDC_UNION_1SLAVE_DESCRIPTOR{ |
frank26080115 | 0:bf7b9fba3924 | 250 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 251 | typedef struct __packed _CDC_UNION_1SLAVE_DESCRIPTOR{ |
frank26080115 | 0:bf7b9fba3924 | 252 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 253 | #pragma pack(1) |
frank26080115 | 0:bf7b9fba3924 | 254 | typedef struct _CDC_UNION_1SLAVE_DESCRIPTOR { |
frank26080115 | 0:bf7b9fba3924 | 255 | #endif |
frank26080115 | 0:bf7b9fba3924 | 256 | CDC_UNION_DESCRIPTOR sUnion; // Union functional descriptor |
frank26080115 | 0:bf7b9fba3924 | 257 | uint8_t bSlaveInterfaces[1]; // Slave interface 0 |
frank26080115 | 0:bf7b9fba3924 | 258 | } CDC_UNION_1SLAVE_DESCRIPTOR; |
frank26080115 | 0:bf7b9fba3924 | 259 | |
frank26080115 | 0:bf7b9fba3924 | 260 | // Line coding structure |
frank26080115 | 0:bf7b9fba3924 | 261 | // Format of the data returned when a GetLineCoding request is received |
frank26080115 | 0:bf7b9fba3924 | 262 | // (usbcdc11.pdf, 6.2.13) |
frank26080115 | 0:bf7b9fba3924 | 263 | #if defined ( __CC_ARM ) |
frank26080115 | 0:bf7b9fba3924 | 264 | typedef __packed struct _CDC_LINE_CODING{ |
frank26080115 | 0:bf7b9fba3924 | 265 | #elif defined ( __GNUC__ ) |
frank26080115 | 0:bf7b9fba3924 | 266 | typedef struct __packed _CDC_LINE_CODING{ |
frank26080115 | 0:bf7b9fba3924 | 267 | #elif defined ( __IAR_SYSTEMS_ICC__ ) |
frank26080115 | 0:bf7b9fba3924 | 268 | #pragma pack(1) |
frank26080115 | 0:bf7b9fba3924 | 269 | typedef struct _CDC_LINE_CODING { |
frank26080115 | 0:bf7b9fba3924 | 270 | #endif |
frank26080115 | 0:bf7b9fba3924 | 271 | uint32_t dwDTERate; // Data terminal rate in bits per second |
frank26080115 | 0:bf7b9fba3924 | 272 | uint8_t bCharFormat; // Number of stop bits |
frank26080115 | 0:bf7b9fba3924 | 273 | uint8_t bParityType; // Parity bit type |
frank26080115 | 0:bf7b9fba3924 | 274 | uint8_t bDataBits; // Number of data bits |
frank26080115 | 0:bf7b9fba3924 | 275 | } CDC_LINE_CODING; |
frank26080115 | 0:bf7b9fba3924 | 276 | |
frank26080115 | 0:bf7b9fba3924 | 277 | // Notification header |
frank26080115 | 0:bf7b9fba3924 | 278 | // Data sent on the notification endpoint must follow this header. |
frank26080115 | 0:bf7b9fba3924 | 279 | // see USB_SETUP_PACKET in file usb.h |
frank26080115 | 0:bf7b9fba3924 | 280 | typedef USB_SETUP_PACKET CDC_NOTIFICATION_HEADER; |
frank26080115 | 0:bf7b9fba3924 | 281 | |
frank26080115 | 0:bf7b9fba3924 | 282 | #endif /* __CDC_H */ |
frank26080115 | 0:bf7b9fba3924 | 283 |