Port of Keils USBCDC example, compiles ok. Gets stuck at init
Embed:
(wiki syntax)
Show/hide line numbers
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 00022 /*---------------------------------------------------------------------------- 00023 * Definitions based on usbcdc11.pdf (www.usb.org) 00024 *---------------------------------------------------------------------------*/ 00025 // Communication device class specification version 1.10 00026 #define CDC_V1_10 0x0110 00027 00028 // Communication interface class code 00029 // (usbcdc11.pdf, 4.2, Table 15) 00030 #define CDC_COMMUNICATION_INTERFACE_CLASS 0x02 00031 00032 // Communication interface class subclass codes 00033 // (usbcdc11.pdf, 4.3, Table 16) 00034 #define CDC_DIRECT_LINE_CONTROL_MODEL 0x01 00035 #define CDC_ABSTRACT_CONTROL_MODEL 0x02 00036 #define CDC_TELEPHONE_CONTROL_MODEL 0x03 00037 #define CDC_MULTI_CHANNEL_CONTROL_MODEL 0x04 00038 #define CDC_CAPI_CONTROL_MODEL 0x05 00039 #define CDC_ETHERNET_NETWORKING_CONTROL_MODEL 0x06 00040 #define CDC_ATM_NETWORKING_CONTROL_MODEL 0x07 00041 00042 // Communication interface class control protocol codes 00043 // (usbcdc11.pdf, 4.4, Table 17) 00044 #define CDC_PROTOCOL_COMMON_AT_COMMANDS 0x01 00045 00046 // Data interface class code 00047 // (usbcdc11.pdf, 4.5, Table 18) 00048 #define CDC_DATA_INTERFACE_CLASS 0x0A 00049 00050 // Data interface class protocol codes 00051 // (usbcdc11.pdf, 4.7, Table 19) 00052 #define CDC_PROTOCOL_ISDN_BRI 0x30 00053 #define CDC_PROTOCOL_HDLC 0x31 00054 #define CDC_PROTOCOL_TRANSPARENT 0x32 00055 #define CDC_PROTOCOL_Q921_MANAGEMENT 0x50 00056 #define CDC_PROTOCOL_Q921_DATA_LINK 0x51 00057 #define CDC_PROTOCOL_Q921_MULTIPLEXOR 0x52 00058 #define CDC_PROTOCOL_V42 0x90 00059 #define CDC_PROTOCOL_EURO_ISDN 0x91 00060 #define CDC_PROTOCOL_V24_RATE_ADAPTATION 0x92 00061 #define CDC_PROTOCOL_CAPI 0x93 00062 #define CDC_PROTOCOL_HOST_BASED_DRIVER 0xFD 00063 #define CDC_PROTOCOL_DESCRIBED_IN_PUFD 0xFE 00064 00065 // Type values for bDescriptorType field of functional descriptors 00066 // (usbcdc11.pdf, 5.2.3, Table 24) 00067 #define CDC_CS_INTERFACE 0x24 00068 #define CDC_CS_ENDPOINT 0x25 00069 00070 // Type values for bDescriptorSubtype field of functional descriptors 00071 // (usbcdc11.pdf, 5.2.3, Table 25) 00072 #define CDC_HEADER 0x00 00073 #define CDC_CALL_MANAGEMENT 0x01 00074 #define CDC_ABSTRACT_CONTROL_MANAGEMENT 0x02 00075 #define CDC_DIRECT_LINE_MANAGEMENT 0x03 00076 #define CDC_TELEPHONE_RINGER 0x04 00077 #define CDC_REPORTING_CAPABILITIES 0x05 00078 #define CDC_UNION 0x06 00079 #define CDC_COUNTRY_SELECTION 0x07 00080 #define CDC_TELEPHONE_OPERATIONAL_MODES 0x08 00081 #define CDC_USB_TERMINAL 0x09 00082 #define CDC_NETWORK_CHANNEL 0x0A 00083 #define CDC_PROTOCOL_UNIT 0x0B 00084 #define CDC_EXTENSION_UNIT 0x0C 00085 #define CDC_MULTI_CHANNEL_MANAGEMENT 0x0D 00086 #define CDC_CAPI_CONTROL_MANAGEMENT 0x0E 00087 #define CDC_ETHERNET_NETWORKING 0x0F 00088 #define CDC_ATM_NETWORKING 0x10 00089 00090 // CDC class-specific request codes 00091 // (usbcdc11.pdf, 6.2, Table 46) 00092 // see Table 45 for info about the specific requests. 00093 #define CDC_SEND_ENCAPSULATED_COMMAND 0x00 00094 #define CDC_GET_ENCAPSULATED_RESPONSE 0x01 00095 #define CDC_SET_COMM_FEATURE 0x02 00096 #define CDC_GET_COMM_FEATURE 0x03 00097 #define CDC_CLEAR_COMM_FEATURE 0x04 00098 #define CDC_SET_AUX_LINE_STATE 0x10 00099 #define CDC_SET_HOOK_STATE 0x11 00100 #define CDC_PULSE_SETUP 0x12 00101 #define CDC_SEND_PULSE 0x13 00102 #define CDC_SET_PULSE_TIME 0x14 00103 #define CDC_RING_AUX_JACK 0x15 00104 #define CDC_SET_LINE_CODING 0x20 00105 #define CDC_GET_LINE_CODING 0x21 00106 #define CDC_SET_CONTROL_LINE_STATE 0x22 00107 #define CDC_SEND_BREAK 0x23 00108 #define CDC_SET_RINGER_PARMS 0x30 00109 #define CDC_GET_RINGER_PARMS 0x31 00110 #define CDC_SET_OPERATION_PARMS 0x32 00111 #define CDC_GET_OPERATION_PARMS 0x33 00112 #define CDC_SET_LINE_PARMS 0x34 00113 #define CDC_GET_LINE_PARMS 0x35 00114 #define CDC_DIAL_DIGITS 0x36 00115 #define CDC_SET_UNIT_PARAMETER 0x37 00116 #define CDC_GET_UNIT_PARAMETER 0x38 00117 #define CDC_CLEAR_UNIT_PARAMETER 0x39 00118 #define CDC_GET_PROFILE 0x3A 00119 #define CDC_SET_ETHERNET_MULTICAST_FILTERS 0x40 00120 #define CDC_SET_ETHERNET_PMP_FILTER 0x41 00121 #define CDC_GET_ETHERNET_PMP_FILTER 0x42 00122 #define CDC_SET_ETHERNET_PACKET_FILTER 0x43 00123 #define CDC_GET_ETHERNET_STATISTIC 0x44 00124 #define CDC_SET_ATM_DATA_FORMAT 0x50 00125 #define CDC_GET_ATM_DEVICE_STATISTICS 0x51 00126 #define CDC_SET_ATM_DEFAULT_VC 0x52 00127 #define CDC_GET_ATM_VC_STATISTICS 0x53 00128 00129 // Communication feature selector codes 00130 // (usbcdc11.pdf, 6.2.2..6.2.4, Table 47) 00131 #define CDC_ABSTRACT_STATE 0x01 00132 #define CDC_COUNTRY_SETTING 0x02 00133 00134 // Feature Status returned for ABSTRACT_STATE Selector 00135 // (usbcdc11.pdf, 6.2.3, Table 48) 00136 #define CDC_IDLE_SETTING (1 << 0) 00137 #define CDC_DATA_MULTPLEXED_STATE (1 << 1) 00138 00139 00140 // Control signal bitmap values for the SetControlLineState request 00141 // (usbcdc11.pdf, 6.2.14, Table 51) 00142 #define CDC_DTE_PRESENT (1 << 0) 00143 #define CDC_ACTIVATE_CARRIER (1 << 1) 00144 00145 // CDC class-specific notification codes 00146 // (usbcdc11.pdf, 6.3, Table 68) 00147 // see Table 67 for Info about class-specific notifications 00148 #define CDC_NOTIFICATION_NETWORK_CONNECTION 0x00 00149 #define CDC_RESPONSE_AVAILABLE 0x01 00150 #define CDC_AUX_JACK_HOOK_STATE 0x08 00151 #define CDC_RING_DETECT 0x09 00152 #define CDC_NOTIFICATION_SERIAL_STATE 0x20 00153 #define CDC_CALL_STATE_CHANGE 0x28 00154 #define CDC_LINE_STATE_CHANGE 0x29 00155 #define CDC_CONNECTION_SPEED_CHANGE 0x2A 00156 00157 // UART state bitmap values (Serial state notification). 00158 // (usbcdc11.pdf, 6.3.5, Table 69) 00159 #define CDC_SERIAL_STATE_OVERRUN (1 << 6) // receive data overrun error has occurred 00160 #define CDC_SERIAL_STATE_PARITY (1 << 5) // parity error has occurred 00161 #define CDC_SERIAL_STATE_FRAMING (1 << 4) // framing error has occurred 00162 #define CDC_SERIAL_STATE_RING (1 << 3) // state of ring signal detection 00163 #define CDC_SERIAL_STATE_BREAK (1 << 2) // state of break detection 00164 #define CDC_SERIAL_STATE_TX_CARRIER (1 << 1) // state of transmission carrier 00165 #define CDC_SERIAL_STATE_RX_CARRIER (1 << 0) // state of receiver carrier 00166 00167 00168 /*---------------------------------------------------------------------------- 00169 * Structures based on usbcdc11.pdf (www.usb.org) 00170 *---------------------------------------------------------------------------*/ 00171 00172 // Header functional descriptor 00173 // (usbcdc11.pdf, 5.2.3.1) 00174 // This header must precede any list of class-specific descriptors. 00175 typedef __packed struct _CDC_HEADER_DESCRIPTOR{ 00176 uint8_t bFunctionLength; // size of this descriptor in bytes 00177 uint8_t bDescriptorType; // CS_INTERFACE descriptor type 00178 uint8_t bDescriptorSubtype; // Header functional descriptor subtype 00179 uint16_t bcdCDC; // USB CDC specification release version 00180 } CDC_HEADER_DESCRIPTOR; 00181 00182 //Call management functional descriptor 00183 // (usbcdc11.pdf, 5.2.3.2) 00184 // Describes the processing of calls for the communication class interface. 00185 typedef __packed struct _CDC_CALL_MANAGEMENT_DESCRIPTOR { 00186 uint8_t bFunctionLength; // size of this descriptor in bytes 00187 uint8_t bDescriptorType; // CS_INTERFACE descriptor type 00188 uint8_t bDescriptorSubtype; // call management functional descriptor subtype 00189 uint8_t bmCapabilities; // capabilities that this configuration supports 00190 uint8_t bDataInterface; // interface number of the data class interface used for call management (optional) 00191 } CDC_CALL_MANAGEMENT_DESCRIPTOR; 00192 00193 // Abstract control management functional descriptor 00194 // (usbcdc11.pdf, 5.2.3.3) 00195 // Describes the command supported by the communication interface class with the Abstract Control Model subclass code. 00196 typedef __packed struct _CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR { 00197 uint8_t bFunctionLength; // size of this descriptor in bytes 00198 uint8_t bDescriptorType; // CS_INTERFACE descriptor type 00199 uint8_t bDescriptorSubtype; // abstract control management functional descriptor subtype 00200 uint8_t bmCapabilities; // capabilities supported by this configuration 00201 } CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR; 00202 00203 // Union functional descriptors 00204 // (usbcdc11.pdf, 5.2.3.8) 00205 // Describes the relationship between a group of interfaces that can be considered to form a functional unit. 00206 typedef __packed struct _CDC_UNION_DESCRIPTOR { 00207 uint8_t bFunctionLength; // size of this descriptor in bytes 00208 uint8_t bDescriptorType; // CS_INTERFACE descriptor type 00209 uint8_t bDescriptorSubtype; // union functional descriptor subtype 00210 uint8_t bMasterInterface; // interface number designated as master 00211 } CDC_UNION_DESCRIPTOR; 00212 00213 // Union functional descriptors with one slave interface 00214 // (usbcdc11.pdf, 5.2.3.8) 00215 typedef __packed struct _CDC_UNION_1SLAVE_DESCRIPTOR { 00216 CDC_UNION_DESCRIPTOR sUnion; // Union functional descriptor 00217 uint8_t bSlaveInterfaces[1]; // Slave interface 0 00218 } CDC_UNION_1SLAVE_DESCRIPTOR; 00219 00220 // Line coding structure 00221 // Format of the data returned when a GetLineCoding request is received 00222 // (usbcdc11.pdf, 6.2.13) 00223 typedef __packed struct _CDC_LINE_CODING { 00224 uint32_t dwDTERate; // Data terminal rate in bits per second 00225 uint8_t bCharFormat; // Number of stop bits 00226 uint8_t bParityType; // Parity bit type 00227 uint8_t bDataBits; // Number of data bits 00228 } CDC_LINE_CODING; 00229 00230 // Notification header 00231 // Data sent on the notification endpoint must follow this header. 00232 // see USB_SETUP_PACKET in file usb.h 00233 typedef USB_SETUP_PACKET CDC_NOTIFICATION_HEADER; 00234 00235 #endif /* __CDC_H */ 00236
Generated on Thu Jul 14 2022 04:45:41 by
1.7.2