cdc.h 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980
  1. /*****************************************************************************
  2. * include/nuttx/usb/cdc.h
  3. *
  4. * Licensed to the Apache Software Foundation (ASF) under one or more
  5. * contributor license agreements. See the NOTICE file distributed with
  6. * this work for additional information regarding copyright ownership. The
  7. * ASF licenses this file to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance with the
  9. * License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  16. * License for the specific language governing permissions and limitations
  17. * under the License.
  18. *
  19. *****************************************************************************/
  20. #ifndef __INCLUDE_NUTTX_USB_CDC_H
  21. #define __INCLUDE_NUTTX_USB_CDC_H
  22. /*****************************************************************************
  23. * Included Files
  24. *****************************************************************************/
  25. #include <nuttx/config.h>
  26. /*****************************************************************************
  27. * Pre-processor Definitions
  28. *****************************************************************************/
  29. /* Device Class Codes ********************************************************/
  30. /* Table 14: Communication Device Class Code (see definition USB_CLASS_CDC in
  31. * usb.h)
  32. */
  33. /* Table 18: Data Interface Class Code (see definition USB_CLASS_CDC_DATA in
  34. * usb.h)
  35. */
  36. /* Communication Interface Class Codes ***************************************/
  37. /* Table 15: Communication Interface Class Code */
  38. #define CDC_CLASS_COMM 0x02 /* Communication Interface Class */
  39. /* Communication Interface Sub-Class Codes ***********************************/
  40. #define CDC_SUBCLASS_NONE 0x00 /* Reserved */
  41. #define CDC_SUBCLASS_DLC 0x01 /* Direct Line Control Model */
  42. #define CDC_SUBCLASS_ACM 0x02 /* Abstract Control Model */
  43. #define CDC_SUBCLASS_TCM 0x03 /* Telephone Control Model */
  44. #define CDC_SUBCLASS_MCM 0x04 /* Multi-Channel Control Model */
  45. #define CDC_SUBCLASS_CAPI 0x05 /* CAPI Control Model */
  46. #define CDC_SUBCLASS_ECM 0x06 /* Ethernet Networking Control Model */
  47. #define CDC_SUBCLASS_ATM 0x07 /* ATM Networking Control Model */
  48. /* 0x08-0x0d Reserved (future use) */
  49. #define CDC_SUBCLASS_MBIM 0x0e /* MBIM Control Model */
  50. /* 0x0f-0x7f Reserved (future use) */
  51. /* 0x80-0xfe Reserved (vendor specific) */
  52. /* Communication Interface Class Protocol Codes ******************************/
  53. /* Table 17: Communication Interface Class Control Protocol Codes */
  54. #define CDC_PROTO_NONE 0x00 /* No class specific protocol required */
  55. #define CDC_PROTO_ATM 0x01 /* Common AT commands (also known as Hayes
  56. * compatible)
  57. */
  58. /* 0x02-0xfe Reserved (future use) */
  59. #define CDC_PROTO_VENDOR 0xff /* Vendor-specific */
  60. /* Data Interface Sub-Class Codes ********************************************/
  61. /* None defined, should be zero */
  62. #define CDC_DATA_SUBCLASS_NONE 0x00
  63. /* Date Interface Class Protocol Codes ***************************************/
  64. /* Table 19: Data Interface Class Protocol Codes */
  65. #define CDC_DATA_PROTO_NONE 0x00 /* No class specific protocol required */
  66. /* 0x01-0x2f Reserved (future use) */
  67. #define CDC_DATA_PROTO_NTB 0x02 /* Network Transfer Block protocol */
  68. #define CDC_DATA_PROTO_ISDN 0x30 /* Physical interface protocol for ISDN BRI */
  69. #define CDC_DATA_PROTO_HDLC 0x31 /* HDLC */
  70. #define CDC_DATA_PROTO_TRANSP 0x32 /* Transparent */
  71. /* 0x33-0x4f Reserved (future use) */
  72. #define CDC_DATA_PROTO_Q921M 0x50 /* Management protocol for Q.921 data link protocol */
  73. #define CDC_DATA_PROTO_Q921 0x51 /* Data link protocol for Q.931 */
  74. #define CDC_DATA_PROTO_Q921TM 0x52 /* TEI-multiplexor for Q.921 data link protocol */
  75. /* 0x53-0x8f Reserved (future use) */
  76. #define CDC_DATA_PROTO_V42BIS 0x90 /* Data compression procedures */
  77. #define CDC_DATA_PROTO_EUROISDN 0x91 /* Euro-ISDN protocol control */
  78. #define CDC_DATA_PROTO_V120 0x92 /* V.24 rate adaptation to ISDN */
  79. #define CDC_DATA_PROTO_CAPI 0x93 /* CAPI Commands */
  80. /* 0x94-0xfc Reserved (future use) */
  81. #define CDC_DATA_PROTO_HBD 0xfd /* Host based driver. */
  82. #define CDC_DATA_PROTO_PUFD 0xfe /* The protocol(s) are described using a Protocol Unit
  83. * Functional Descriptors on Communication Class
  84. * Interface.
  85. */
  86. #define CDC_DATA_PROTO_VENDOR 0xff /* Vendor-specific */
  87. /* Requests and Notifications ************************************************/
  88. /* Table 2: Requests, Direct Line Control Model */
  89. #define DLC_SET_AUX_LINE_STATE 0x10 /* Request to connect or disconnect secondary jack from
  90. * POTS circuit or CODEC, depending on hook state.
  91. * (Optional).
  92. */
  93. #define DLC_SET_HOOK_STATE 0x11 /* Select relay setting for on-hook, off-hook, and caller
  94. * ID. (Required)
  95. */
  96. #define DLC_PULSE_SETUP 0x12 /* Initiate pulse dialing preparation. (Optional).
  97. */
  98. #define DLC_SEND_PULSE 0x13 /* Request number of make/break cycles to generate.
  99. * (Optional)
  100. */
  101. #define DLC_SET_PULSE_TIME 0x14 /* Setup value for time of make and break periods when
  102. * pulse dialing. (Optional)
  103. */
  104. #define DLC_RING_AUX_JACK 0x15 /* Request for a ring signal to be generated on secondary
  105. * phone jack. (Optional)
  106. */
  107. /* Table 3: Notifications, Direct Line Control Model */
  108. #define DLC_AUX_JACK_HOOK_STATE 0x08 /* Indicates hook state of secondary device plugged
  109. * into the auxiliary phone jack. (Optional)
  110. */
  111. #define DLC_RING_DETECT 0x09 /* Message to notify host that ring voltage was
  112. * detected on POTS interface. (Required)
  113. */
  114. /* Table 4: Requests, Abstract Control Model */
  115. #define ACM_SEND_COMMAND 0x00 /* Issues a command in the format of the supported
  116. * control protocol. (Required)
  117. */
  118. #define ACM_GET_RESPONSE 0x01 /* Requests a response in the format of the
  119. * supported control protocol. (Required)
  120. */
  121. #define ACM_SET_COMM_FEATURE 0x02 /* Controls the settings for a particular
  122. * communication feature. (Optional)
  123. */
  124. #define ACM_GET_COMM_FEATURE 0x03 /* Returns the current settings for the
  125. * communication feature. (Optional)
  126. */
  127. #define ACM_CLEAR_COMM_FEATURE 0x04 /* Clears the settings for a particular
  128. * communication feature. (Optional)
  129. */
  130. #define ACM_SET_LINE_CODING 0x20 /* Configures DTE rate, stop-bits, parity, and
  131. * number-of-character bits. (Optional)
  132. */
  133. #define ACM_GET_LINE_CODING 0x21 /* Requests current DTE rate, stop-bits, parity, and
  134. * number-of-character bits. (Optional)
  135. */
  136. #define ACM_SET_CTRL_LINE_STATE 0x22 /* RS-232 signal used to tell the DCE device the
  137. * DTE device is now present. (Optional)
  138. */
  139. #define ACM_SEND_BREAK 0x23 /* Sends special carrier
  140. */
  141. /* Table 5: Notifications, Abstract Control Model */
  142. #define ACM_NETWORK_CONNECTION 0x00 /* Notification to host of network connection status.
  143. * (Optional)
  144. */
  145. #define ACM_RESPONSE_AVAILABLE 0x01 /* Notification to host to issue a GET_ENCAPSULATED_RESPONSE
  146. * request. (Required)
  147. */
  148. #define ACM_SERIAL_STATE 0x20 /* Returns the current state of the carrier detect, DSR,
  149. * break, and ring signal. (Optional)
  150. */
  151. /* Table 6: Requests, Telephone Control Model */
  152. #define TCM_SET_COMM_FEATURE 0x02 /* Used to set a unique communication feature, which is
  153. * normally specific to a particular device.
  154. * (Optional)
  155. */
  156. #define TCM_GET_COMM_FEATURE 0x03 /* Returns the current settings for the communication
  157. * feature. (Optional)
  158. */
  159. #define TCM_CLEAR_COMM_FEATURE 0x04 /* Clears the settings for a particular communication
  160. * feature. (Optional)
  161. */
  162. #define TCM_SET_RINGER_PARMS 0x30 /* Configures the ringer for a telephone device.
  163. * (Optional)
  164. */
  165. #define TCM_GET_RINGER_PARMS 0x31 /* Gets the current ringer configuration for a telephone
  166. * device. (Required)
  167. */
  168. #define TCM_SET_OPERATION_PARMS 0x32 /* Configures the operational mode of the telephone.
  169. * (Optional)
  170. */
  171. #define TCM_GET_OPERATION_PARMS 0x33 /* Gets the current operational mode of the telephone.
  172. * (Optional)
  173. */
  174. #define TCM_SET_LINE_PARMS 0x34 /* Allows changing the current state of the line
  175. * associated with the interface, providing basic call
  176. * capabilities, such as dialing and answering calls.
  177. * (Required)
  178. */
  179. #define TCM_GET_LINE_PARMS 0x35 /* Gets current status of the line. (Required)
  180. */
  181. #define TCM_DIAL_DIGITS 0x36 /* Dials digits on the network connection. (Required)
  182. */
  183. /* Table 7: Notifications, Telephone Control Model */
  184. #define TCM_CALL_STATE_CHANGE 0x28 /* DReports a state change on a call. (Required)
  185. */
  186. #define TCM_LINE_STATE_CHANGE 0x29 /* DReports a state change on a line. (Optional)
  187. */
  188. /* Table 8: Requests, Multi-Channel Model */
  189. #define MCM_SET_UNIT_PARAM 0x37 /* Used to set a Unit specific parameter (Optional)
  190. */
  191. #define MCM_GET_UNIT_PARAM 0x38 /* Used to retrieve a Unit specific parameter (Required)
  192. */
  193. #define MCM_CLEAR_UNIT_PARAM 0x39 /* Used to set a Unit specific parameter to its default
  194. * state. (Optional)
  195. */
  196. /* Table 9: Request, CAPI Control Model */
  197. #define CAPI_GET_PROFILE 0x3a /* Returns the implemented capabilities of the device
  198. * (Required)
  199. */
  200. /* Table 10: Requests, Ethernet Networking Control Model */
  201. #define ECM_SEND_COMMAND 0x00 /* Issues a command in the format of the supported
  202. * control protocol. The intent of this mechanism is
  203. * to support networking devices (e.g., host-based
  204. * cable modems) that require an additional vendor-
  205. * defined interface for media specific hardware
  206. * configuration and management. (Optional)
  207. */
  208. #define ECM_GET_RESPONSE 0x01 /* equests a response in the format of the supported
  209. * control protocol.
  210. * (Optional)
  211. */
  212. #define ECM_SET_MCAST_FILTERS 0x40 /* As applications are loaded and unloaded on the host,
  213. * the networking transport will instruct the device's MAC
  214. * driver to change settings of the Networking device's
  215. * multicast filters. (Optional)
  216. */
  217. #define ECM_SET_PM_PAT_FILTER 0x41 /* Some hosts are able to conserve energy and stay quiet
  218. * in a "sleeping" state while not being used. USB
  219. * Networking devices may provide special pattern filtering
  220. * hardware that enables it to wake up the attached host
  221. * on demand when something is attempting to contact the
  222. * host (e.g., an incoming web browser connection).
  223. * Primitives are needed in management plane to negotiate
  224. * the setting of these special filters
  225. * (Optional)
  226. */
  227. #define ECM_GET_PM_PAT_FILTER 0x42 /* Retrieves the status of the above power management
  228. * pattern filter setting
  229. * (Optional)
  230. */
  231. #define ECM_SET_PACKET_FILTER 0x43 /* Sets device filter for running a network analyzer
  232. * application on the host machine (Required)
  233. */
  234. #define ECM_GET_STATISTIC 0x44 /* Retrieves Ethernet device statistics such as frames
  235. * transmitted, frames received, and bad frames received.
  236. * (Optional)
  237. */
  238. /* Table 11: Notifications, Ethernet Networking Control Model */
  239. #define ECM_NETWORK_CONNECTION 0x00 /* Reports whether or not the physical layer (modem,
  240. * Ethernet PHY, etc.) link is up. (Required)
  241. */
  242. #define ECM_RESPONSE_AVAILABLE 0x01 /* Notification to host to issue a
  243. * GET_ENCAPSULATED_RESPONSE request. (Optional)
  244. */
  245. #define ECM_SPEED_CHANGE 0x2a /* Reports a change in upstream or downstream (Required)
  246. */
  247. /* Table 12: Requests, ATM Networking Control Model */
  248. #define ATM_SEND_COMMAND 0x00 /* Issues a command in the format of the supported control
  249. * protocol. The intent of this mechanism is to support
  250. * networking devices (e.g., host-based cable modems)
  251. * that require an additional vendor-defined interface for
  252. * media specific hardware configuration and
  253. * management. (Optional)
  254. */
  255. #define ATM_GET_RESPONSE 0x01 /* Requests a response in the format of the supported
  256. * control protocol. (Optional)
  257. */
  258. #define ATM_SET_DATA_FORMAT 0x50 /* Chooses which ATM data format will be exchanged
  259. * between the host and the ATM Networking device.
  260. * (Required)
  261. */
  262. #define ATM_GET_DEV_STATISTICS 0x51 /* Retrieves global statistics from the ATM Networking
  263. * device. (Required)
  264. */
  265. #define ATM_SET_DEFAULT_VC 0x52 /* Pre-selects the VPI/VCI value for subsequent
  266. * GetATMVCStatistics requests (Optional)
  267. */
  268. #define ATM_GET_VC_STATISTICS 0x53 /* Retrieves statistics from the ATM Networking device for
  269. * a particular VPI/VCI. (Optional)
  270. */
  271. /* Table 13: Requests, Ethernet and ATM Networking Control Model */
  272. #define ATM_NETWORK_CONNECTION 0x00 /* Reports whether or not the physical layer (modem,
  273. * Ethernet PHY, etc.) link is up. (Required)
  274. */
  275. #define ECM_NETWORK_CONNECTION ATM_NETWORK_CONNECTION
  276. #define ATM_RESPONSE_AVAILABLE 0x01 /* Notification to host to issue a
  277. * GET_ENCAPSULATED_RESPONSE request. (Optional)
  278. */
  279. #define ECM_RESPONSE_AVAILABLE ATM_RESPONSE_AVAILABLE
  280. #define ATM_SPEED_CHANGE 0x2a /* Reports a change in upstream or downstream speed of the
  281. * networking device connection. (Required)
  282. */
  283. #define ECM_SPEED_CHANGE ATM_SPEED_CHANGE
  284. /* Descriptors ***************************************************************/
  285. /* Table 25: bDescriptor SubType in Functional Descriptors */
  286. #define CDC_DSUBTYPE_HDR 0x00 /* Header Functional Descriptor, which marks the
  287. * beginning of the concatenated set of functional
  288. * descriptors for the interface. */
  289. #define CDC_DSUBTYPE_CALLMGMT 0x01 /* Call Management Functional Descriptor */
  290. #define CDC_DSUBTYPE_ACM 0x02 /* Abstract Control Management Functional Descriptor */
  291. #define CDC_DSUBTYPE_DLC 0x03 /* Direct Line Management Functional Descriptor */
  292. #define CDC_DSUBTYPE_TCMRINGER 0x04 /* Telephone Ringer Functional Descriptor */
  293. #define CDC_DSUBTYPE_TCMCALL 0x05 /* Telephone Call and Line State Reporting Capabilities
  294. * Functional Descriptor. */
  295. #define CDC_DSUBTYPE_UNION 0x06 /* Union Functional descriptor */
  296. #define CDC_DSUBTYPE_COUNTRY 0x07 /* Country Selection Functional Descriptor */
  297. #define CDC_DSUBTYPE_TCMOPS 0x08 /* Telephone Operational Modes Functional Descriptor */
  298. #define CDC_DSUBTYPE_USBTERM 0x09 /* USB Terminal Functional Descriptor */
  299. #define CDC_DSUBTYPE_NETCHAN 0x0a /* Network Channel Terminal Descriptor */
  300. #define CDC_DSUBTYPE_PROTOUNIT 0x0b /* Protocol Unit Functional Descriptor */
  301. #define CDC_DSUBTYPE_EXTUNIT 0x0c /* Extension Unit Functional Descriptor */
  302. #define CDC_DSUBTYPE_MCM 0x0d /* Multi-Channel Management Functional Descriptor */
  303. #define CDC_DSUBTYPE_CAPI 0x0e /* CAPI Control Management Functional Descriptor */
  304. #define CDC_DSUBTYPE_ECM 0x0f /* Ethernet Networking Functional Descriptor */
  305. #define CDC_DSUBTYPE_ATM 0x10 /* ATM Networking Functional Descriptor */
  306. #define CDC_DSUBTYPE_MBIM 0x1b /* MBIM Functional Descriptor */
  307. /* 0x11-0xff Reserved (future use) */
  308. /* Table 42: Ethernet Statistics Capabilities */
  309. #define ECMCAP_XMIT_OK (1 << 0) /* Frames transmitted without errors */
  310. #define ECMCAP_RVC_OK (1 << 1) /* Frames received without errors */
  311. #define ECMCAP_XMIT_ERROR (1 << 2) /* Frames not transmitted, or transmitted with errors */
  312. #define ECMCAP_RCV_ERROR (1 << 3) /* Frames received with errors that are not delivered
  313. * to the USB host
  314. */
  315. #define ECMCAP_RCV_NO_BUFFER (1 << 4) /* Frame missed, no buffers */
  316. #define ECMCAP_DIR_BYTES_XMIT (1 << 5) /* Directed bytes transmitted without errors */
  317. #define ECMCAP_DIR_FRAMES_XMIT (1 << 6) /* Directed frames transmitted without errors */
  318. #define ECMCAP_MCAST_BYTES_XMIT (1 << 7) /* Multicast bytes transmitted without errors */
  319. #define ECMCAP_MCAST_FRAMES_XMIT (1 << 8) /* Multicast frames transmitted without errors */
  320. #define ECMCAP_BCAST_BYTES_XMIT (1 << 9) /* Broadcast bytes transmitted without errors */
  321. #define ECMCAP_BCAST_FRAMES_XMIT (1 << 10) /* Broadcast frames transmitted without errors */
  322. #define ECMCAP_DIR_BYTES_RCV (1 << 11) /* Directed bytes received without errors */
  323. #define ECMCAP_DIR_FRAMES_RCV (1 << 12) /* Directed frames received without errors */
  324. #define ECMCAP_MCAST_BYTES_RCV (1 << 13) /* Multicast bytes received without errors */
  325. #define ECMCAP_MCAST_FRAMES_RCV (1 << 14) /* Multicast frames received without errors */
  326. #define ECMCAP_BCAST_BYTES_RCV (1 << 15) /* Broadcast bytes received without errors */
  327. #define ECMCAP_BCAST_FRAMES_RCV (1 << 16) /* Broadcast frames received without errors */
  328. #define ECMCAP_RCV_CRC_ERROR (1 << 17) /* Frames received with circular redundancy check
  329. * (CRC) or frame check sequence (FCS) error
  330. */
  331. #define ECMCAP_TRANSMIT_QUEUE_LENG (1 << 18) /* Length of transmit queue */
  332. #define ECMCAP_RCV_ERROR_ALIGNMENT (1 << 19) /* Frames received with alignment error */
  333. #define ECMCAP_XMIT_ONE_COLL (1 << 20) /* Frames transmitted with one collision */
  334. #define ECMCAP_XMIT_MORE_COLLS (1 << 21) /* Frames transmitted with more than one collision */
  335. #define ECMCAP_XMIT_DEFERRED (1 << 22) /* Frames transmitted after deferral */
  336. #define ECMCAP_XMIT_MAX_COLLS (1 << 23) /* Frames not transmitted due to collisions */
  337. #define ECMCAP_RCV_OVERRUN (1 << 24) /* Frames not received due to overrun */
  338. #define ECMCAP_XMIT_UNDERRUN (1 << 25) /* Frames not transmitted due to underrun */
  339. #define ECMCAP_XMIT_HB_FAILURE (1 << 26) /* Frames transmitted with heartbeat failure */
  340. #define ECMCAP_XMIT_TIMES_CRS_LOST (1 << 27) /* Times carrier sense signal lost during
  341. * transmission
  342. */
  343. #define ECMCAP_XMIT_LATE_COLLS (1 << 28) /* Late collisions detected */
  344. /* Bits 29-31 Reserved, Must be set to zero */
  345. /* Table 47: Communication Feature Selector Codes */
  346. #define FEATURE_ABSTRACT_STATE 0x01 /* Two bytes of data describing multiplexed state
  347. * and idle state for this Abstract Model
  348. * communications device
  349. */
  350. #define FEATURE_COUNTRY_SETTING 0x02 /* Country code in hexadecimal format as defined in
  351. * ISO 3166
  352. */
  353. /* Table 49: POTS Relay Configuration Values */
  354. #define POTS_ON_HOOK 0x0000
  355. #define POTS_OFF_HOOK 0x0001
  356. #define POTS_SNOOPING 0x0002
  357. /* Table 50: Line Coding Structure */
  358. #define CDC_CHFMT_STOP1 0 /* One stop bit */
  359. #define CDC_CHFMT_STOP1p5 1 /* 1.5 stop bits */
  360. #define CDC_CHFMT_STOP2 2 /* 2 stop bits */
  361. #define CDC_PARITY_NONE 0 /* No parity */
  362. #define CDC_PARITY_ODD 1 /* Odd parity */
  363. #define CDC_PARITY_EVEN 2 /* Even parity */
  364. #define CDC_PARITY_MARK 3 /* Mark parity */
  365. #define CDC_PARITY_SPACE 4 /* Space parity */
  366. /* Table 51: Control Signal Bitmap Values for SetControlLineState */
  367. #define CDC_DTE_PRESENT (1 << 0) /* Indicates to DCE if DTE is present or not.
  368. * This signal corresponds to V.24 signal
  369. * 108/2 and RS-232 signal DTR.
  370. */
  371. #define CDC_ACTIVATE_CARRIER (1 << 1) /* Carrier control for half duplex modems.
  372. * This signal corresponds to V.24 signal
  373. * 105 and RS-232 signal RTS.
  374. */
  375. /* CDC/ACM friendly naming */
  376. #define CDCACM_UART_DTR CDC_DTE_PRESENT
  377. #define CDCACM_UART_RTS CDC_ACTIVATE_CARRIER
  378. /* Table 58: Call State Value Definitions */
  379. #define CDC_CALLST_IDLE 0x00 /* Call is idle */
  380. #define CDC_CALLST_DIAL 0x01 /* Typical dial tone */
  381. #define CDC_CALLST_INTDIAL 0x02 /* Interrupted dial tone */
  382. #define CDC_CALLST_DIALING 0x03 /* Dialing is in progress */
  383. #define CDC_CALLST_RINGBACK 0x04 /* Ringback */
  384. #define CDC_CALLST_CONNECTED 0x05 /* Connected */
  385. #define CDC_CALLSTINCOMING 0x06 /* Incoming call */
  386. /* Table 62: Ethernet Packet Filter Bitmap */
  387. #define PACKET_TYPE_PROMISCUOUS (1 << 0)
  388. #define PACKET_TYPE_ALL_MULTICAST (1 << 1)
  389. #define PACKET_TYPE_DIRECTED (1 << 2)
  390. #define PACKET_TYPE_BROADCAST (1 << 3)
  391. #define PACKET_TYPE_MULTICAST (1 << 4)
  392. /* Table 63: Ethernet Statistics Feature Selector Codes */
  393. #define ECM_XMIT_OK 0x01 /* Frames transmitted without errors */
  394. #define ECM_RVC_OK 0x02 /* Frames received without errors */
  395. #define ECM_XMIT_ERROR 0x03 /* Frames not transmitted, or transmitted with errors */
  396. #define ECM_RCV_ERROR 0x04 /* Frames received with errors that are not delivered
  397. * to the USB host
  398. */
  399. #define ECM_RCV_NO_BUFFER 0x05 /* Frame missed, no buffers */
  400. #define ECM_DIR_BYTES_XMIT 0x06 /* Directed bytes transmitted without errors */
  401. #define ECM_DIR_FRAMES_XMIT 0x07 /* Directed frames transmitted without errors */
  402. #define ECM_MCAST_BYTES_XMIT 0x08 /* Multicast bytes transmitted without errors */
  403. #define ECM_MCAST_FRAMES_XMIT 0x09 /* Multicast frames transmitted without errors */
  404. #define ECM_BCAST_BYTES_XMIT 0x0a /* Broadcast bytes transmitted without errors */
  405. #define ECM_BCAST_FRAMES_XMIT 0x0b /* Broadcast frames transmitted without errors */
  406. #define ECM_DIR_BYTES_RCV 0x0c /* Directed bytes received without errors */
  407. #define ECM_DIR_FRAMES_RCV 0x0d /* Directed frames received without errors */
  408. #define ECM_MCAST_BYTES_RCV 0x0e /* Multicast bytes received without errors */
  409. #define ECM_MCAST_FRAMES_RCV 0x0f /* Multicast frames received without errors */
  410. #define ECM_BCAST_BYTES_RCV 0x10 /* Broadcast bytes received without errors */
  411. #define ECM_BCAST_FRAMES_RCV 0x11 /* Broadcast frames received without errors */
  412. #define ECM_RCV_CRC_ERROR 0x12 /* Frames received with circular redundancy check
  413. * (CRC) or frame check sequence (FCS) error
  414. */
  415. #define ECM_TRANSMIT_QUEUE_LENG 0x13 /* Length of transmit queue */
  416. #define ECM_RCV_ERROR_ALIGNMENT 0x14 /* Frames received with alignment error */
  417. #define ECM_XMIT_ONE_COLL 0x15 /* Frames transmitted with one collision */
  418. #define ECM_XMIT_MORE_COLLS 0x16 /* Frames transmitted with more than one collision */
  419. #define ECM_XMIT_DEFERRED 0x17 /* Frames transmitted after deferral */
  420. #define ECM_XMIT_MAX_COLLS 0x18 /* Frames not transmitted due to collisions */
  421. #define ECM_RCV_OVERRUN 0x19 /* Frames not received due to overrun */
  422. #define ECM_XMIT_UNDERRUN 0x1a /* Frames not transmitted due to underrun */
  423. #define ECM_XMIT_HB_FAILURE 0x1b /* Frames transmitted with heartbeat failure */
  424. #define ECM_XMIT_TIMES_CRS_LOST 0x1c /* Times carrier sense signal lost during
  425. * transmission
  426. */
  427. #define ECM_XMIT_LATE_COLLS 0x1d /* Late collisions detected */
  428. /* Table 64: ATM Data Format */
  429. #define ATM_FMT_TYPE1 1 /* Type 1 format: concatenated ATM cells */
  430. #define ATM_FMT_TYPE1 2 /* Type 2 format: ATM header template + concatenated ATM
  431. * cell payloads
  432. */
  433. #define ATM_FMT_TYPE1 3 /* Type 3 format: AAL 5 SDU */
  434. /* Table 65: ATM Device Statistics Feature Selector Codes */
  435. #define US_CELLS_SENT 0x01h /* The number of cells that have been sent
  436. * upstream to the WAN link by the ATM layer.
  437. */
  438. #define DS_CELLS_RECEIVED 0x02h /* The number of cells that have been received
  439. * downstream from the WAN link by the ATM
  440. * layer.
  441. */
  442. #define DS_CELLS_USB_CONGESTION 0x03h /* The number of cells that have been received
  443. * downstream from the WAN link by the ATM
  444. * layer and discarded due to congestion on the
  445. * USB link.
  446. */
  447. #define DS_CELLS_AAL5_CRC_ERROR 0x04h /* The number of cells that have been received
  448. * downstream from the WAN link by the ATM
  449. * layer and discarded due to AAL5 CRC errors.
  450. */
  451. #define DS_CELLS_HEC_ERROR 0x05h /* The number of cells that have been received
  452. * downstream from the WAN link and discarded
  453. * due to HEC errors in the cell header.
  454. */
  455. #define DS_CELLS_HEC_ERROR_CORRECTED 0x06h /* The number of cells that have been received
  456. * downstream from the WAN link and have
  457. * been detected with HEC errors in the cell
  458. * header and successfully corrected.
  459. */
  460. /* Table 66: ATM VC Selector Codes */
  461. #define VC_US_CELLS_SENT 0x01 /* The number of cells that have been
  462. * sent upstream to the WAN link for the
  463. * specified VPI/VCI since the device
  464. * has been powered on or reset
  465. */
  466. #define VC_DS_CELLS_RECEIVED 0x02 /* The number of cells that have been
  467. * received downstream from the WAN link
  468. * for the specified VPI/VCI since the
  469. * device has been powered on or reset
  470. */
  471. /* Notifications *************************************************************/
  472. /* Table 69: UART State Bitmap Values */
  473. #define CDC_UART_RXCARRIER (1 << 0) /* bRxCarrier State of receiver carrier detection
  474. * mechanism of device. This signal corresponds to
  475. * V.24 signal 109 and RS-232 signal DCD.
  476. */
  477. #define CDC_UART_TXCARRIER (1 << 1) /* bTxCarrier State of transmission carrier. This
  478. * signal corresponds to V.24 signal 106 and RS-232
  479. * signal DSR.
  480. */
  481. #define CDC_UART_BREAK (1 << 2) /* bBreak State of break detection mechanism of the
  482. * device.
  483. */
  484. #define CDC_UART_RING (1 << 3) /* bRingSignal State of ring signal detection of the
  485. * device.
  486. */
  487. #define CDC_UART_FRAMING (1 << 4) /* bFraming A framing error has occurred */
  488. #define CDC_UART_PARITY (1 << 5) /* bParity A parity error has occurred */
  489. #define CDC_UART_OVERRUN (1 << 6) /* bOverRun Received data has been discarded due to
  490. * overrun in the device.
  491. */
  492. /* CDC/ACM friendly naming */
  493. #define CDCACM_UART_DCD CDC_UART_RXCARRIER
  494. #define CDCACM_UART_DSR CDC_UART_TXCARRIER
  495. /* "SerialState is used like a real interrupt status register. Once a
  496. * notification has been sent, the device will reset and reevaluate the
  497. * different signals. For the consistent signals like carrier detect or
  498. * transmission carrier, this will mean another notification will not be
  499. * generated until there is a state change. For the irregular signals like
  500. * break, the incoming ring signal, or the overrun error state, this will
  501. * reset their values to zero and again will not send another notification
  502. * until their state changes."
  503. */
  504. #define CDC_UART_CONSISTENT (CDC_UART_RXCARRIER | CDC_UART_TXCARRIER)
  505. /* Table 70: Call State Change Value Definitions */
  506. #define CDC_CALLST_IDLE 0x01 /* Call has become idle */
  507. #define CDC_CALLST_DIALING 0x02 /* Dialing */
  508. #define CDC_CALLST_RINGBACK 0x03 /* Ringback, with an extra byte of data provided to
  509. * describe the type of ringback signaling
  510. */
  511. #define CDC_CALLST_CONNECTED 0x04 /* Connected, with an extra byte of data provided to
  512. * describe the type of connection
  513. */
  514. #define CDC_CALLST_INCOMING 0x05 /* Incoming Call, with the extra bytes of data */
  515. /* Table 71: Line State Change Values */
  516. #define CDC_LINEST_IDLE 0x0000 /* Line has become idle */
  517. #define CDC_LINEST_HOLD 0x0001 /* Line connected to hold position */
  518. #define CDC_LINEST_OFFHOOK 0x0002 /* Hook-switch has gone off hook */
  519. #define CDC_LINEST_ONHOOK 0x0003 /* Hook-switch has gone on hook */
  520. /*****************************************************************************
  521. * Public Types
  522. *****************************************************************************/
  523. /* Table 1: Data Class Protocol Wrapper */
  524. struct cdc_protowrapper_s
  525. {
  526. uint8_t size[2]; /* Size of wrapper in bytes */
  527. uint8_t dstproto; /* bDstProtocol, Destination protocol ID */
  528. uint8_t srcproto; /* bSrcProtocol, Source protocol ID */
  529. uint8_t data[1]; /* Data payload, actual size depends of size of the
  530. * wrapper
  531. */
  532. };
  533. /* Functional Descriptors ****************************************************/
  534. /* Table 23: Functional Descriptor General Format */
  535. struct cdc_funcdesc_s
  536. {
  537. uint8_t size; /* bFunctionLength, Size of this descriptor */
  538. uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */
  539. uint8_t data[1]; /* Function-specific data follows */
  540. };
  541. /* Table 26: Class-Specific Descriptor Header Format */
  542. struct cdc_hdr_funcdesc_s
  543. {
  544. uint8_t size; /* bFunctionLength, Size of this descriptor */
  545. uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */
  546. uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_HDR as defined in Table 25 */
  547. uint8_t cdc[2]; /* bcdCDC, USB Class Definitions for Communication Devices Specification
  548. * release number in binary-coded decimal. */
  549. };
  550. #define SIZEOF_HDR_FUNCDESC 5
  551. /* Table 27: Call Management Functional Descriptor */
  552. struct cdc_callmgmt_funcdesc_s
  553. {
  554. uint8_t size; /* bFunctionLength, Size of this descriptor */
  555. uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */
  556. uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_CALLMGMT as defined in Table 25 */
  557. uint8_t caps; /* bmCapabilities: Bit encoded */
  558. uint8_t ifno; /* bDataInterface, Interface number of Data Class interface
  559. * optionally used for call management
  560. */
  561. };
  562. #define SIZEOF_CALLMGMT_FUNCDESC 5
  563. /* Table 28: Abstract Control Management Functional Descriptor */
  564. struct cdc_acm_funcdesc_s
  565. {
  566. uint8_t size; /* bFunctionLength, Size of this descriptor */
  567. uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */
  568. uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_ACM as defined in Table 25 */
  569. uint8_t caps; /* bmCapabilities: Bit encoded */
  570. };
  571. #define SIZEOF_ACM_FUNCDESC 4
  572. /* Table 29: Direct Line Management Functional Descriptor */
  573. struct cdc_dlc_funcdesc_s
  574. {
  575. uint8_t size; /* bFunctionLength, Size of this descriptor */
  576. uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */
  577. uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_DLC as defined in Table 25 */
  578. uint8_t caps; /* bmCapabilities: Bit encoded */
  579. };
  580. #define SIZEOF_DLC_FUNCDESC 4
  581. /* Table 30: Telephone Ringer Functional Descriptor */
  582. struct cdc_tcmr_funcdesc_s
  583. {
  584. uint8_t size; /* bFunctionLength, Size of this descriptor */
  585. uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */
  586. uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_TCMRINGER as defined in Table 25 */
  587. uint8_t volsteps; /* bRingerVolSteps, Number of discrete steps in volume supported
  588. * by the ringer.
  589. */
  590. uint8_t npats; /* bNumRingerPatterns: Number of ringer patterns supported. */
  591. };
  592. #define SIZEOF_TCMR_FUNCDESC 5
  593. /* Table 31: Telephone Operational Modes Functional Descriptor */
  594. struct cdc_tcmops_funcdesc_s
  595. {
  596. uint8_t size; /* bFunctionLength, Size of this descriptor */
  597. uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */
  598. uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_TCMOPS as defined in Table 25 */
  599. uint8_t caps; /* bmCapabilities: Bit encoded */
  600. };
  601. #define SIZEOF_TCMOPS_FUNCDESC 4
  602. /* Table 32: Telephone Call State Reporting Capabilities Descriptor */
  603. struct cdc_tcmc_funcdesc_s
  604. {
  605. uint8_t size; /* bFunctionLength, Size of this descriptor */
  606. uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */
  607. uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_TCMCALL as defined in Table 25 */
  608. uint8_t caps; /* bmCapabilities: Bit encoded */
  609. };
  610. #define SIZEOF_TCMC_FUNCDESC 4
  611. /* Table 33: Union Interface Functional Descriptor */
  612. struct cdc_union_funcdesc_s
  613. {
  614. uint8_t size; /* bFunctionLength, Size of this descriptor */
  615. uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */
  616. uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_UNION as defined in Table 25 */
  617. uint8_t master; /* bMasterInterface: The interface number of the Communication or Data
  618. * Class interface, designated as the master or controlling interface
  619. * for the union
  620. */
  621. uint8_t slave[1]; /* bSlaveInterfaceN: Interface number of N slave or associated
  622. * interface in the union
  623. */
  624. };
  625. #define SIZEOF_UNION_FUNCDESC(n) ((n) + 4)
  626. /* Table 34: Country Selection Functional Descriptor */
  627. struct cdc_country_funcdesc_s
  628. {
  629. uint8_t size; /* bFunctionLength, Size of this descriptor */
  630. uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */
  631. uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_COUNTRY as defined in Table 25 */
  632. uint8_t reldate; /* iCountryCodeRelDate: Index of a string giving the release date for the
  633. * implemented ISO 3166 Country Codes
  634. */
  635. uint16_t code[1]; /* wCountryCodeN: Country code in hexadecimal format as defined in ISO 3166,
  636. * release date as specified in offset 3 for Nth country supported
  637. */
  638. };
  639. #define SIZEOF_COUNTRY_FUNCDESC(n) (sizeof(uint16_t) * (n) + 4)
  640. /* Table 35: USB Terminal Functional Descriptor */
  641. struct cdc_usbterm_funcdesc_s
  642. {
  643. uint8_t size; /* bFunctionLength, Size of this descriptor */
  644. uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */
  645. uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_USBTERM as defined in Table 25 */
  646. uint8_t id; /* bEntityId, Constant uniquely identifying the Terminal */
  647. uint8_t ifno; /* bInInterfaceNo, The input interface number of the associated
  648. * USB interface
  649. */
  650. uint8_t outif; /* bOutInterfaceNo, The output interface number of the associated
  651. * USB interface
  652. */
  653. uint8_t options; /* bmOptions, bit-encoded options */
  654. uint8_t child[1]; /* Nth ID of lower Terminal or Unit to which this Terminal is connected. */
  655. };
  656. #define SIZEOF_USBTERM_FUNCDESC(n) ((n) + 7)
  657. /* Table 36: Network Channel Terminal Functional Descriptor */
  658. struct cdc_netchan_funcdesc_s
  659. {
  660. uint8_t size; /* bFunctionLength, Size of this descriptor */
  661. uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */
  662. uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_NETCHAN as defined in
  663. * Table 25 */
  664. uint8_t id; /* bEntityId, Constant uniquely identifying the
  665. * Terminal */
  666. uint8_t name; /* iName, Index of string descriptor, describing the name
  667. * of the Network Channel Terminal
  668. */
  669. uint8_t index; /* bChannelIndex, The channel index of the associated
  670. * network channel
  671. */
  672. uint8_t phyif; /* bPhysicalInterface, Type of physical interface */
  673. };
  674. #define SIZEOF_NETCHAN_FUNCDESC 7
  675. /* Table 37: Protocol Unit Functional Descriptor */
  676. struct cdc_protounit_funcdesc_s
  677. {
  678. uint8_t size; /* bFunctionLength, Size of this descriptor */
  679. uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */
  680. uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_PROTOUNIT as defined in Table 25 */
  681. uint8_t id; /* bEntityId, Constant uniquely identifying the Unit */
  682. uint8_t proto; /* bProtocol, Protocol code as defined in Table 19 */
  683. uint8_t child[1]; /* Nth ID of lower Terminal or Unit to which this Terminal is connected */
  684. };
  685. #define SIZEOF_PROTOUNIT_FUNCDESC(n) ((n) + 5)
  686. /* Table 38: Extension Unit Functional Descriptor */
  687. struct cdc_extunit_funcdesc_s
  688. {
  689. uint8_t size; /* bFunctionLength, Size of this descriptor */
  690. uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */
  691. uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_EXTUNIT as defined in Table 25 */
  692. uint8_t id; /* bEntityId, Constant uniquely identifying the Extension Unit */
  693. uint8_t code; /* bExtensionCode, Vendor specific code identifying the Extension Unit */
  694. uint8_t name; /* iName, Index of string descriptor, describing the name of the Extension Unit */
  695. uint8_t child[1]; /* Nth ID of lower Terminal or Unit to which this Terminal is connected */
  696. };
  697. #define SIZEOF_EXTUNIT_FUNCDESC(n) ((n) + 6)
  698. /* Table 39: Multi-Channel Management Functional Descriptor */
  699. struct cdc_mcm_funcdesc_s
  700. {
  701. uint8_t size; /* bFunctionLength, Size of this descriptor */
  702. uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */
  703. uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_MCM as defined in Table 25 */
  704. uint8_t caps; /* bmCapabilities: Bit encoded */
  705. };
  706. #define SIZEOF_MCM_FUNCDESC 4
  707. /* Table 40: CAPI Control Management Functional Descriptor */
  708. struct cdc_capi_funcdesc_s
  709. {
  710. uint8_t size; /* bFunctionLength, Size of this descriptor */
  711. uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */
  712. uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_CAPI as defined in Table 25 */
  713. uint8_t caps; /* bmCapabilities: Bit encoded */
  714. };
  715. #define SIZEOF_CAPI_FUNCDESC 4
  716. /* Table 41: Ethernet Networking Functional Descriptor */
  717. struct cdc_ecm_funcdesc_s
  718. {
  719. uint8_t size; /* bFunctionLength, Size of this descriptor */
  720. uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */
  721. uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_ECM as defined in
  722. * Table 25.
  723. */
  724. uint8_t mac; /* iMACAddress, Index of the 48bit Ethernet MAC address
  725. * string descriptor.
  726. */
  727. uint8_t stats[4]; /* bmEthernetStatistics, Indicates which Ethernet
  728. * statistics functions the device collects.
  729. * See Table 42.
  730. */
  731. uint8_t maxseg[2]; /* wMaxSegmentSize, The maximum segment size that the
  732. * Ethernet device is capable of supporting.
  733. */
  734. uint8_t nmcflts[2]; /* wNumberMCFilters, Contains the number of multicast
  735. * filters that can be configured by the host.
  736. */
  737. uint8_t npwrflts; /* bNumberPowerFilters, Contains the number of pattern
  738. * filters that are available for causing wake-up of
  739. * the host.
  740. */
  741. };
  742. #define SIZEOF_ECM_FUNCDESC 13
  743. /* Table 43: ATM Networking Functional Descriptor */
  744. struct cdc_atm_funcdesc_s
  745. {
  746. uint8_t size; /* bFunctionLength, Size of this descriptor */
  747. uint8_t type; /* bDescriptorType, USB_DESC_TYPE_CSINTERFACE */
  748. uint8_t subtype; /* bDescriptorSubType, CDC_DSUBTYPE_ATM as defined in
  749. * Table 25.
  750. */
  751. uint8_t endid; /* iEndSystemIdentifier, Index of End System Identifier
  752. * string descriptor.
  753. */
  754. uint8_t datacaps; /* bmDataCapabilities, The ATM data types the device
  755. * supports.
  756. */
  757. uint8_t devstats; /* bmATMDeviceStatistics, Indicates which optional
  758. * statistics functions the device collects.
  759. */
  760. uint8_t mxseg2[2]; /* wType2MaxSegmentSize, The maximum segment size that
  761. * the Type 2 device is capable of supporting.
  762. */
  763. uint8_t mxseg3[2]; /* wType3MaxSegmentSize, The maximum segment size that
  764. * the Type 3 device is capable of supporting
  765. */
  766. uint8_t mxvc[2]; /* wMaxVC, The maximum number of simultaneous virtual
  767. * circuits the device is capable of supporting
  768. */
  769. };
  770. #define SIZEOF_ATM_FUNCDESC 12
  771. /* Descriptor Data Structures ************************************************/
  772. /* Table 50: Line Coding Structure */
  773. struct cdc_linecoding_s
  774. {
  775. uint8_t baud[4]; /* dwDTERate, Data terminal rate, in bits per second */
  776. uint8_t stop; /* bCharFormat 0=1, 1=1.5, 2=2 stop bits */
  777. uint8_t parity; /* bParityType, 0=None, 1=Odd, 2=Even, 3=Mark, 4=Space */
  778. uint8_t nbits; /* bDataBits, Data bits (5,6,7,8, or 16) */
  779. };
  780. #define SIZEOF_CDC_LINECODING 7
  781. /* Table 55: Line Status Information Structure */
  782. struct cdc_linestatus_s
  783. {
  784. uint8_t size[2]; /* wLength, Size of this structure, in bytes */
  785. uint8_t ringer[4]; /* dwRingerBitmap, Ringer Configuration bitmap for this
  786. * line
  787. */
  788. uint8_t line[4]; /* dwLineState, Defines current state of the line */
  789. uint32_t call[1]; /* dwCallStateN, Current state of call N on the line */
  790. };
  791. /* Messages are formatted as a standardized 8-byte header, followed by a
  792. * variable-length data field. The header identifies the kind of notification,
  793. * and the interface associated with the notification; it also indicates the
  794. * length of the variable length portion of the message
  795. */
  796. struct cdc_notification_s
  797. {
  798. uint8_t type; /* bmRequestType */
  799. uint8_t notification; /* bNotification */
  800. uint8_t value[2]; /* wValue */
  801. uint8_t index[2]; /* wIndex - interface */
  802. uint8_t len[2]; /* wLength - length of variable data */
  803. uint8_t data[1]; /* Variable length data begins here */
  804. };
  805. #define SIZEOF_NOTIFICATION_S(n) (sizeof(struct cdc_notification_s) + (n) - 1)
  806. /* Table 60: Unit Parameter Structure */
  807. struct cdc_unitparm_s
  808. {
  809. uint8_t id; /* bEntityId, Unit ID */
  810. uint8_t index; /* bParameterIndex, A zero based value indicating Unit
  811. * parameter index
  812. */
  813. };
  814. /* Table 61: Power Management Pattern Filter Structure */
  815. /* Notification Data Structures **********************************************/
  816. /* Table 72: ConnectionSpeedChange Data Structure */
  817. struct cdc_speedchange_s
  818. {
  819. uint8_t us[4]; /* Contains the upstream bit rate, in bits per second */
  820. uint8_t ds[4]; /* Contains the downstream bit rate, in bits per second */
  821. };
  822. #endif /* __INCLUDE_NUTTX_USB_CDC_H */