Port of Keils USBCDC example, compiles ok. Gets stuck at init

Dependencies:   mbed

Committer:
tecnosys
Date:
Mon Jul 05 10:16:57 2010 +0000
Revision:
0:0b777ff85deb

        

Who changed what in which revision?

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