These are the examples provided for [[/users/frank26080115/libraries/LPC1700CMSIS_Lib/]] Note, the entire "program" is not compilable!
cdc.h
00001 /*---------------------------------------------------------------------------- 00002 * U S B - K e r n e l 00003 *---------------------------------------------------------------------------- 00004 * Name: CDC.h 00005 * Purpose: USB Communication Device Class Definitions 00006 * Version: V1.20 00007 *---------------------------------------------------------------------------- 00008 * This software is supplied "AS IS" without any warranties, express, 00009 * implied or statutory, including but not limited to the implied 00010 * warranties of fitness for purpose, satisfactory quality and 00011 * noninfringement. Keil extends you a royalty-free right to reproduce 00012 * and distribute executable files created using this software for use 00013 * on NXP Semiconductors LPC family microcontroller devices only. Nothing 00014 * else gives you the right to use this software. 00015 * 00016 * Copyright (c) 2009 Keil - An ARM Company. All rights reserved. 00017 *---------------------------------------------------------------------------*/ 00018 00019 #ifndef __CDC_H 00020 #define __CDC_H 00021 #include "lpc_types.h" 00022 00023 #if defined ( __GNUC__ ) 00024 #define __packed __attribute__((__packed__)) 00025 #endif 00026 /*---------------------------------------------------------------------------- 00027 * Definitions based on usbcdc11.pdf (www.usb.org) 00028 *---------------------------------------------------------------------------*/ 00029 // Communication device class specification version 1.10 00030 #define CDC_V1_10 0x0110 00031 00032 // Communication interface class code 00033 // (usbcdc11.pdf, 4.2, Table 15) 00034 #define CDC_COMMUNICATION_INTERFACE_CLASS 0x02 00035 00036 // Communication interface class subclass codes 00037 // (usbcdc11.pdf, 4.3, Table 16) 00038 #define CDC_DIRECT_LINE_CONTROL_MODEL 0x01 00039 #define CDC_ABSTRACT_CONTROL_MODEL 0x02 00040 #define CDC_TELEPHONE_CONTROL_MODEL 0x03 00041 #define CDC_MULTI_CHANNEL_CONTROL_MODEL 0x04 00042 #define CDC_CAPI_CONTROL_MODEL 0x05 00043 #define CDC_ETHERNET_NETWORKING_CONTROL_MODEL 0x06 00044 #define CDC_ATM_NETWORKING_CONTROL_MODEL 0x07 00045 00046 // Communication interface class control protocol codes 00047 // (usbcdc11.pdf, 4.4, Table 17) 00048 #define CDC_PROTOCOL_COMMON_AT_COMMANDS 0x01 00049 00050 // Data interface class code 00051 // (usbcdc11.pdf, 4.5, Table 18) 00052 #define CDC_DATA_INTERFACE_CLASS 0x0A 00053 00054 // Data interface class protocol codes 00055 // (usbcdc11.pdf, 4.7, Table 19) 00056 #define CDC_PROTOCOL_ISDN_BRI 0x30 00057 #define CDC_PROTOCOL_HDLC 0x31 00058 #define CDC_PROTOCOL_TRANSPARENT 0x32 00059 #define CDC_PROTOCOL_Q921_MANAGEMENT 0x50 00060 #define CDC_PROTOCOL_Q921_DATA_LINK 0x51 00061 #define CDC_PROTOCOL_Q921_MULTIPLEXOR 0x52 00062 #define CDC_PROTOCOL_V42 0x90 00063 #define CDC_PROTOCOL_EURO_ISDN 0x91 00064 #define CDC_PROTOCOL_V24_RATE_ADAPTATION 0x92 00065 #define CDC_PROTOCOL_CAPI 0x93 00066 #define CDC_PROTOCOL_HOST_BASED_DRIVER 0xFD 00067 #define CDC_PROTOCOL_DESCRIBED_IN_PUFD 0xFE 00068 00069 // Type values for bDescriptorType field of functional descriptors 00070 // (usbcdc11.pdf, 5.2.3, Table 24) 00071 #define CDC_CS_INTERFACE 0x24 00072 #define CDC_CS_ENDPOINT 0x25 00073 00074 // Type values for bDescriptorSubtype field of functional descriptors 00075 // (usbcdc11.pdf, 5.2.3, Table 25) 00076 #define CDC_HEADER 0x00 00077 #define CDC_CALL_MANAGEMENT 0x01 00078 #define CDC_ABSTRACT_CONTROL_MANAGEMENT 0x02 00079 #define CDC_DIRECT_LINE_MANAGEMENT 0x03 00080 #define CDC_TELEPHONE_RINGER 0x04 00081 #define CDC_REPORTING_CAPABILITIES 0x05 00082 #define CDC_UNION 0x06 00083 #define CDC_COUNTRY_SELECTION 0x07 00084 #define CDC_TELEPHONE_OPERATIONAL_MODES 0x08 00085 #define CDC_USB_TERMINAL 0x09 00086 #define CDC_NETWORK_CHANNEL 0x0A 00087 #define CDC_PROTOCOL_UNIT 0x0B 00088 #define CDC_EXTENSION_UNIT 0x0C 00089 #define CDC_MULTI_CHANNEL_MANAGEMENT 0x0D 00090 #define CDC_CAPI_CONTROL_MANAGEMENT 0x0E 00091 #define CDC_ETHERNET_NETWORKING 0x0F 00092 #define CDC_ATM_NETWORKING 0x10 00093 00094 // CDC class-specific request codes 00095 // (usbcdc11.pdf, 6.2, Table 46) 00096 // see Table 45 for info about the specific requests. 00097 #define CDC_SEND_ENCAPSULATED_COMMAND 0x00 00098 #define CDC_GET_ENCAPSULATED_RESPONSE 0x01 00099 #define CDC_SET_COMM_FEATURE 0x02 00100 #define CDC_GET_COMM_FEATURE 0x03 00101 #define CDC_CLEAR_COMM_FEATURE 0x04 00102 #define CDC_SET_AUX_LINE_STATE 0x10 00103 #define CDC_SET_HOOK_STATE 0x11 00104 #define CDC_PULSE_SETUP 0x12 00105 #define CDC_SEND_PULSE 0x13 00106 #define CDC_SET_PULSE_TIME 0x14 00107 #define CDC_RING_AUX_JACK 0x15 00108 #define CDC_SET_LINE_CODING 0x20 00109 #define CDC_GET_LINE_CODING 0x21 00110 #define CDC_SET_CONTROL_LINE_STATE 0x22 00111 #define CDC_SEND_BREAK 0x23 00112 #define CDC_SET_RINGER_PARMS 0x30 00113 #define CDC_GET_RINGER_PARMS 0x31 00114 #define CDC_SET_OPERATION_PARMS 0x32 00115 #define CDC_GET_OPERATION_PARMS 0x33 00116 #define CDC_SET_LINE_PARMS 0x34 00117 #define CDC_GET_LINE_PARMS 0x35 00118 #define CDC_DIAL_DIGITS 0x36 00119 #define CDC_SET_UNIT_PARAMETER 0x37 00120 #define CDC_GET_UNIT_PARAMETER 0x38 00121 #define CDC_CLEAR_UNIT_PARAMETER 0x39 00122 #define CDC_GET_PROFILE 0x3A 00123 #define CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40 00124 #define CDC_SET_ETHERNET_PMP_FILTER 0x41 00125 #define CDC_GET_ETHERNET_PMP_FILTER 0x42 00126 #define CDC_SET_ETHERNET_PACKET_FILTER 0x43 00127 #define CDC_GET_ETHERNET_STATISTIC 0x44 00128 #define CDC_SET_ATM_DATA_FORMAT 0x50 00129 #define CDC_GET_ATM_DEVICE_STATISTICS 0x51 00130 #define CDC_SET_ATM_DEFAULT_VC 0x52 00131 #define CDC_GET_ATM_VC_STATISTICS 0x53 00132 00133 // Communication feature selector codes 00134 // (usbcdc11.pdf, 6.2.2..6.2.4, Table 47) 00135 #define CDC_ABSTRACT_STATE 0x01 00136 #define CDC_COUNTRY_SETTING 0x02 00137 00138 // Feature Status returned for ABSTRACT_STATE Selector 00139 // (usbcdc11.pdf, 6.2.3, Table 48) 00140 #define CDC_IDLE_SETTING (1 << 0) 00141 #define CDC_DATA_MULTPLEXED_STATE (1 << 1) 00142 00143 00144 // Control signal bitmap values for the SetControlLineState request 00145 // (usbcdc11.pdf, 6.2.14, Table 51) 00146 #define CDC_DTE_PRESENT (1 << 0) 00147 #define CDC_ACTIVATE_CARRIER (1 << 1) 00148 00149 // CDC class-specific notification codes 00150 // (usbcdc11.pdf, 6.3, Table 68) 00151 // see Table 67 for Info about class-specific notifications 00152 #define CDC_NOTIFICATION_NETWORK_CONNECTION 0x00 00153 #define CDC_RESPONSE_AVAILABLE 0x01 00154 #define CDC_AUX_JACK_HOOK_STATE 0x08 00155 #define CDC_RING_DETECT 0x09 00156 #define CDC_NOTIFICATION_SERIAL_STATE 0x20 00157 #define CDC_CALL_STATE_CHANGE 0x28 00158 #define CDC_LINE_STATE_CHANGE 0x29 00159 #define CDC_CONNECTION_SPEED_CHANGE 0x2A 00160 00161 // UART state bitmap values (Serial state notification). 00162 // (usbcdc11.pdf, 6.3.5, Table 69) 00163 #define CDC_SERIAL_STATE_OVERRUN (1 << 6) // receive data overrun error has occurred 00164 #define CDC_SERIAL_STATE_PARITY (1 << 5) // parity error has occurred 00165 #define CDC_SERIAL_STATE_FRAMING (1 << 4) // framing error has occurred 00166 #define CDC_SERIAL_STATE_RING (1 << 3) // state of ring signal detection 00167 #define CDC_SERIAL_STATE_BREAK (1 << 2) // state of break detection 00168 #define CDC_SERIAL_STATE_TX_CARRIER (1 << 1) // state of transmission carrier 00169 #define CDC_SERIAL_STATE_RX_CARRIER (1 << 0) // state of receiver carrier 00170 00171 00172 /*---------------------------------------------------------------------------- 00173 * Structures based on usbcdc11.pdf (www.usb.org) 00174 *---------------------------------------------------------------------------*/ 00175 00176 // Header functional descriptor 00177 // (usbcdc11.pdf, 5.2.3.1) 00178 // This header must precede any list of class-specific descriptors. 00179 00180 #if defined ( __CC_ARM ) 00181 typedef __packed struct _CDC_HEADER_DESCRIPTOR{ 00182 #elif defined ( __GNUC__ ) 00183 typedef struct __packed _CDC_HEADER_DESCRIPTOR{ 00184 #elif defined ( __IAR_SYSTEMS_ICC__ ) 00185 #pragma pack(1) 00186 typedef struct _CDC_HEADER_DESCRIPTOR { 00187 #endif 00188 uint8_t bFunctionLength; // size of this descriptor in bytes 00189 uint8_t bDescriptorType; // CS_INTERFACE descriptor type 00190 uint8_t bDescriptorSubtype; // Header functional descriptor subtype 00191 uint16_t bcdCDC; // USB CDC specification release version 00192 } CDC_HEADER_DESCRIPTOR; 00193 00194 //Call management functional descriptor 00195 // (usbcdc11.pdf, 5.2.3.2) 00196 // Describes the processing of calls for the communication class interface. 00197 #if defined ( __CC_ARM ) 00198 typedef __packed struct _CDC_CALL_MANAGEMENT_DESCRIPTOR{ 00199 #elif defined ( __GNUC__ ) 00200 typedef struct __packed _CDC_CALL_MANAGEMENT_DESCRIPTOR{ 00201 #elif defined ( __IAR_SYSTEMS_ICC__ ) 00202 #pragma pack(1) 00203 typedef struct _CDC_CALL_MANAGEMENT_DESCRIPTOR { 00204 #endif 00205 uint8_t bFunctionLength; // size of this descriptor in bytes 00206 uint8_t bDescriptorType; // CS_INTERFACE descriptor type 00207 uint8_t bDescriptorSubtype; // call management functional descriptor subtype 00208 uint8_t bmCapabilities; // capabilities that this configuration supports 00209 uint8_t bDataInterface; // interface number of the data class interface used for call management (optional) 00210 } CDC_CALL_MANAGEMENT_DESCRIPTOR; 00211 00212 // Abstract control management functional descriptor 00213 // (usbcdc11.pdf, 5.2.3.3) 00214 // Describes the command supported by the communication interface class with the Abstract Control Model subclass code. 00215 #if defined ( __CC_ARM ) 00216 typedef __packed struct _CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR{ 00217 #elif defined ( __GNUC__ ) 00218 typedef struct __packed _CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR{ 00219 #elif defined ( __IAR_SYSTEMS_ICC__ ) 00220 #pragma pack(1) 00221 typedef struct _CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR { 00222 #endif 00223 uint8_t bFunctionLength; // size of this descriptor in bytes 00224 uint8_t bDescriptorType; // CS_INTERFACE descriptor type 00225 uint8_t bDescriptorSubtype; // abstract control management functional descriptor subtype 00226 uint8_t bmCapabilities; // capabilities supported by this configuration 00227 } CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR; 00228 00229 // Union functional descriptors 00230 // (usbcdc11.pdf, 5.2.3.8) 00231 // Describes the relationship between a group of interfaces that can be considered to form a functional unit. 00232 #if defined ( __CC_ARM ) 00233 typedef __packed struct _CDC_UNION_DESCRIPTOR{ 00234 #elif defined ( __GNUC__ ) 00235 typedef struct __packed _CDC_UNION_DESCRIPTOR{ 00236 #elif defined ( __IAR_SYSTEMS_ICC__ ) 00237 #pragma pack(1) 00238 typedef struct _CDC_UNION_DESCRIPTOR { 00239 #endif 00240 uint8_t bFunctionLength; // size of this descriptor in bytes 00241 uint8_t bDescriptorType; // CS_INTERFACE descriptor type 00242 uint8_t bDescriptorSubtype; // union functional descriptor subtype 00243 uint8_t bMasterInterface; // interface number designated as master 00244 } CDC_UNION_DESCRIPTOR; 00245 00246 // Union functional descriptors with one slave interface 00247 // (usbcdc11.pdf, 5.2.3.8) 00248 #if defined ( __CC_ARM ) 00249 typedef __packed struct _CDC_UNION_1SLAVE_DESCRIPTOR{ 00250 #elif defined ( __GNUC__ ) 00251 typedef struct __packed _CDC_UNION_1SLAVE_DESCRIPTOR{ 00252 #elif defined ( __IAR_SYSTEMS_ICC__ ) 00253 #pragma pack(1) 00254 typedef struct _CDC_UNION_1SLAVE_DESCRIPTOR { 00255 #endif 00256 CDC_UNION_DESCRIPTOR sUnion; // Union functional descriptor 00257 uint8_t bSlaveInterfaces[1]; // Slave interface 0 00258 } CDC_UNION_1SLAVE_DESCRIPTOR; 00259 00260 // Line coding structure 00261 // Format of the data returned when a GetLineCoding request is received 00262 // (usbcdc11.pdf, 6.2.13) 00263 #if defined ( __CC_ARM ) 00264 typedef __packed struct _CDC_LINE_CODING{ 00265 #elif defined ( __GNUC__ ) 00266 typedef struct __packed _CDC_LINE_CODING{ 00267 #elif defined ( __IAR_SYSTEMS_ICC__ ) 00268 #pragma pack(1) 00269 typedef struct _CDC_LINE_CODING { 00270 #endif 00271 uint32_t dwDTERate; // Data terminal rate in bits per second 00272 uint8_t bCharFormat; // Number of stop bits 00273 uint8_t bParityType; // Parity bit type 00274 uint8_t bDataBits; // Number of data bits 00275 } CDC_LINE_CODING; 00276 00277 // Notification header 00278 // Data sent on the notification endpoint must follow this header. 00279 // see USB_SETUP_PACKET in file usb.h 00280 typedef USB_SETUP_PACKET CDC_NOTIFICATION_HEADER; 00281 00282 #endif /* __CDC_H */ 00283
Generated on Tue Jul 12 2022 17:28:08 by 1.7.2