]> git.sur5r.net Git - armstart-ibdap/blobdiff - inc/usbd/usbd_cdc.h
initial commit
[armstart-ibdap] / inc / usbd / usbd_cdc.h
diff --git a/inc/usbd/usbd_cdc.h b/inc/usbd/usbd_cdc.h
new file mode 100644 (file)
index 0000000..010e941
--- /dev/null
@@ -0,0 +1,249 @@
+/***********************************************************************\r
+* $Id:: mw_usbd_cdc.h 165 2011-04-14 17:41:11Z usb10131                       $\r
+*\r
+* Project: USB device ROM Stack\r
+*\r
+* Description:\r
+*     USB Communication Device Class User module Definitions.\r
+*\r
+***********************************************************************\r
+*   Copyright(C) 2011, NXP Semiconductor\r
+*   All rights reserved.\r
+*\r
+* Software that is described herein is for illustrative purposes only\r
+* which provides customers with programming information regarding the\r
+* products. This software is supplied "AS IS" without any warranties.\r
+* NXP Semiconductors assumes no responsibility or liability for the\r
+* use of the software, conveys no license or title under any patent,\r
+* copyright, or mask work right to the product. NXP Semiconductors\r
+* reserves the right to make changes in the software without\r
+* notification. NXP Semiconductors also make no representation or\r
+* warranty that such application will be suitable for the specified\r
+* use without further testing or modification.\r
+**********************************************************************/\r
+#ifndef __CDC_H\r
+#define __CDC_H\r
+\r
+#include "usbd.h"\r
+\r
+/*----------------------------------------------------------------------------\r
+ *      Definitions  based on usbcdc11.pdf (www.usb.org)\r
+ *---------------------------------------------------------------------------*/\r
+/* Communication device class specification version 1.10 */\r
+#define CDC_V1_10                               0x0110\r
+\r
+/* Communication interface class code */\r
+/* (usbcdc11.pdf, 4.2, Table 15) */\r
+#define CDC_COMMUNICATION_INTERFACE_CLASS       0x02\r
+\r
+/* Communication interface class subclass codes */\r
+/* (usbcdc11.pdf, 4.3, Table 16) */\r
+#define CDC_DIRECT_LINE_CONTROL_MODEL           0x01\r
+#define CDC_ABSTRACT_CONTROL_MODEL              0x02\r
+#define CDC_TELEPHONE_CONTROL_MODEL             0x03\r
+#define CDC_MULTI_CHANNEL_CONTROL_MODEL         0x04\r
+#define CDC_CAPI_CONTROL_MODEL                  0x05\r
+#define CDC_ETHERNET_NETWORKING_CONTROL_MODEL   0x06\r
+#define CDC_ATM_NETWORKING_CONTROL_MODEL        0x07\r
+\r
+/* Communication interface class control protocol codes */\r
+/* (usbcdc11.pdf, 4.4, Table 17) */\r
+#define CDC_PROTOCOL_COMMON_AT_COMMANDS         0x01\r
+\r
+/* Data interface class code */\r
+/* (usbcdc11.pdf, 4.5, Table 18) */\r
+#define CDC_DATA_INTERFACE_CLASS                0x0A\r
+\r
+/* Data interface class protocol codes */\r
+/* (usbcdc11.pdf, 4.7, Table 19) */\r
+#define CDC_PROTOCOL_ISDN_BRI                   0x30\r
+#define CDC_PROTOCOL_HDLC                       0x31\r
+#define CDC_PROTOCOL_TRANSPARENT                0x32\r
+#define CDC_PROTOCOL_Q921_MANAGEMENT            0x50\r
+#define CDC_PROTOCOL_Q921_DATA_LINK             0x51\r
+#define CDC_PROTOCOL_Q921_MULTIPLEXOR           0x52\r
+#define CDC_PROTOCOL_V42                        0x90\r
+#define CDC_PROTOCOL_EURO_ISDN                  0x91\r
+#define CDC_PROTOCOL_V24_RATE_ADAPTATION        0x92\r
+#define CDC_PROTOCOL_CAPI                       0x93\r
+#define CDC_PROTOCOL_HOST_BASED_DRIVER          0xFD\r
+#define CDC_PROTOCOL_DESCRIBED_IN_PUFD          0xFE\r
+\r
+/* Type values for bDescriptorType field of functional descriptors */\r
+/* (usbcdc11.pdf, 5.2.3, Table 24) */\r
+#define CDC_CS_INTERFACE                        0x24\r
+#define CDC_CS_ENDPOINT                         0x25\r
+\r
+/* Type values for bDescriptorSubtype field of functional descriptors */\r
+/* (usbcdc11.pdf, 5.2.3, Table 25) */\r
+#define CDC_HEADER                              0x00\r
+#define CDC_CALL_MANAGEMENT                     0x01\r
+#define CDC_ABSTRACT_CONTROL_MANAGEMENT         0x02\r
+#define CDC_DIRECT_LINE_MANAGEMENT              0x03\r
+#define CDC_TELEPHONE_RINGER                    0x04\r
+#define CDC_REPORTING_CAPABILITIES              0x05\r
+#define CDC_UNION                               0x06\r
+#define CDC_COUNTRY_SELECTION                   0x07\r
+#define CDC_TELEPHONE_OPERATIONAL_MODES         0x08\r
+#define CDC_USB_TERMINAL                        0x09\r
+#define CDC_NETWORK_CHANNEL                     0x0A\r
+#define CDC_PROTOCOL_UNIT                       0x0B\r
+#define CDC_EXTENSION_UNIT                      0x0C\r
+#define CDC_MULTI_CHANNEL_MANAGEMENT            0x0D\r
+#define CDC_CAPI_CONTROL_MANAGEMENT             0x0E\r
+#define CDC_ETHERNET_NETWORKING                 0x0F\r
+#define CDC_ATM_NETWORKING                      0x10\r
+\r
+/* CDC class-specific request codes */\r
+/* (usbcdc11.pdf, 6.2, Table 46) */\r
+/* see Table 45 for info about the specific requests. */\r
+#define CDC_SEND_ENCAPSULATED_COMMAND           0x00\r
+#define CDC_GET_ENCAPSULATED_RESPONSE           0x01\r
+#define CDC_SET_COMM_FEATURE                    0x02\r
+#define CDC_GET_COMM_FEATURE                    0x03\r
+#define CDC_CLEAR_COMM_FEATURE                  0x04\r
+#define CDC_SET_AUX_LINE_STATE                  0x10\r
+#define CDC_SET_HOOK_STATE                      0x11\r
+#define CDC_PULSE_SETUP                         0x12\r
+#define CDC_SEND_PULSE                          0x13\r
+#define CDC_SET_PULSE_TIME                      0x14\r
+#define CDC_RING_AUX_JACK                       0x15\r
+#define CDC_SET_LINE_CODING                     0x20\r
+#define CDC_GET_LINE_CODING                     0x21\r
+#define CDC_SET_CONTROL_LINE_STATE              0x22\r
+#define CDC_SEND_BREAK                          0x23\r
+#define CDC_SET_RINGER_PARMS                    0x30\r
+#define CDC_GET_RINGER_PARMS                    0x31\r
+#define CDC_SET_OPERATION_PARMS                 0x32\r
+#define CDC_GET_OPERATION_PARMS                 0x33\r
+#define CDC_SET_LINE_PARMS                      0x34\r
+#define CDC_GET_LINE_PARMS                      0x35\r
+#define CDC_DIAL_DIGITS                         0x36\r
+#define CDC_SET_UNIT_PARAMETER                  0x37\r
+#define CDC_GET_UNIT_PARAMETER                  0x38\r
+#define CDC_CLEAR_UNIT_PARAMETER                0x39\r
+#define CDC_GET_PROFILE                         0x3A\r
+#define CDC_SET_ETHERNET_MULTICAST_FILTERS      0x40\r
+#define CDC_SET_ETHERNET_PMP_FILTER             0x41\r
+#define CDC_GET_ETHERNET_PMP_FILTER             0x42\r
+#define CDC_SET_ETHERNET_PACKET_FILTER          0x43\r
+#define CDC_GET_ETHERNET_STATISTIC              0x44\r
+#define CDC_SET_ATM_DATA_FORMAT                 0x50\r
+#define CDC_GET_ATM_DEVICE_STATISTICS           0x51\r
+#define CDC_SET_ATM_DEFAULT_VC                  0x52\r
+#define CDC_GET_ATM_VC_STATISTICS               0x53\r
+\r
+/* Communication feature selector codes */\r
+/* (usbcdc11.pdf, 6.2.2..6.2.4, Table 47) */\r
+#define CDC_ABSTRACT_STATE                      0x01\r
+#define CDC_COUNTRY_SETTING                     0x02\r
+\r
+/* Feature Status returned for ABSTRACT_STATE Selector */\r
+/* (usbcdc11.pdf, 6.2.3, Table 48) */\r
+#define CDC_IDLE_SETTING                        (1 << 0)\r
+#define CDC_DATA_MULTPLEXED_STATE               (1 << 1)\r
+\r
+\r
+/* Control signal bitmap values for the SetControlLineState request */\r
+/* (usbcdc11.pdf, 6.2.14, Table 51) */\r
+#define CDC_DTE_PRESENT                         (1 << 0)\r
+#define CDC_ACTIVATE_CARRIER                    (1 << 1)\r
+\r
+/* CDC class-specific notification codes */\r
+/* (usbcdc11.pdf, 6.3, Table 68) */\r
+/* see Table 67 for Info about class-specific notifications */\r
+#define CDC_NOTIFICATION_NETWORK_CONNECTION     0x00\r
+#define CDC_RESPONSE_AVAILABLE                  0x01\r
+#define CDC_AUX_JACK_HOOK_STATE                 0x08\r
+#define CDC_RING_DETECT                         0x09\r
+#define CDC_NOTIFICATION_SERIAL_STATE           0x20\r
+#define CDC_CALL_STATE_CHANGE                   0x28\r
+#define CDC_LINE_STATE_CHANGE                   0x29\r
+#define CDC_CONNECTION_SPEED_CHANGE             0x2A\r
+\r
+/* UART state bitmap values (Serial state notification). */\r
+/* (usbcdc11.pdf, 6.3.5, Table 69) */\r
+#define CDC_SERIAL_STATE_OVERRUN                (1 << 6)  /* receive data overrun error has occurred */\r
+#define CDC_SERIAL_STATE_PARITY                 (1 << 5)  /* parity error has occurred */\r
+#define CDC_SERIAL_STATE_FRAMING                (1 << 4)  /* framing error has occurred */\r
+#define CDC_SERIAL_STATE_RING                   (1 << 3)  /* state of ring signal detection */\r
+#define CDC_SERIAL_STATE_BREAK                  (1 << 2)  /* state of break detection */\r
+#define CDC_SERIAL_STATE_TX_CARRIER             (1 << 1)  /* state of transmission carrier */\r
+#define CDC_SERIAL_STATE_RX_CARRIER             (1 << 0)  /* state of receiver carrier */\r
+\r
+\r
+/*----------------------------------------------------------------------------\r
+ *      Structures  based on usbcdc11.pdf (www.usb.org)\r
+ *---------------------------------------------------------------------------*/\r
+\r
+/* Header functional descriptor */\r
+/* (usbcdc11.pdf, 5.2.3.1) */\r
+/* This header must precede any list of class-specific descriptors. */\r
+PRE_PACK struct POST_PACK _CDC_HEADER_DESCRIPTOR{\r
+  uint8_t  bFunctionLength;                      /* size of this descriptor in bytes */\r
+  uint8_t  bDescriptorType;                      /* CS_INTERFACE descriptor type */\r
+  uint8_t  bDescriptorSubtype;                   /* Header functional descriptor subtype */\r
+  uint16_t bcdCDC;                               /* USB CDC specification release version */\r
+};\r
+typedef struct _CDC_HEADER_DESCRIPTOR CDC_HEADER_DESCRIPTOR;\r
+\r
+/* Call management functional descriptor */\r
+/* (usbcdc11.pdf, 5.2.3.2) */\r
+/* Describes the processing of calls for the communication class interface. */\r
+PRE_PACK struct POST_PACK _CDC_CALL_MANAGEMENT_DESCRIPTOR {\r
+  uint8_t  bFunctionLength;                      /* size of this descriptor in bytes */\r
+  uint8_t  bDescriptorType;                      /* CS_INTERFACE descriptor type */\r
+  uint8_t  bDescriptorSubtype;                   /* call management functional descriptor subtype */\r
+  uint8_t  bmCapabilities;                       /* capabilities that this configuration supports */\r
+  uint8_t  bDataInterface;                       /* interface number of the data class interface used for call management (optional) */\r
+};\r
+typedef struct _CDC_CALL_MANAGEMENT_DESCRIPTOR CDC_CALL_MANAGEMENT_DESCRIPTOR;\r
+\r
+/* Abstract control management functional descriptor */\r
+/* (usbcdc11.pdf, 5.2.3.3) */\r
+/* Describes the command supported by the communication interface class with the Abstract Control Model subclass code. */\r
+PRE_PACK struct POST_PACK _CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR {\r
+  uint8_t  bFunctionLength;                      /* size of this descriptor in bytes */\r
+  uint8_t  bDescriptorType;                      /* CS_INTERFACE descriptor type */\r
+  uint8_t  bDescriptorSubtype;                   /* abstract control management functional descriptor subtype */\r
+  uint8_t  bmCapabilities;                       /* capabilities supported by this configuration */\r
+};\r
+typedef struct _CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR CDC_ABSTRACT_CONTROL_MANAGEMENT_DESCRIPTOR;\r
+\r
+/* Union functional descriptors */\r
+/* (usbcdc11.pdf, 5.2.3.8) */\r
+/* Describes the relationship between a group of interfaces that can be considered to form a functional unit. */\r
+PRE_PACK struct POST_PACK _CDC_UNION_DESCRIPTOR {\r
+  uint8_t  bFunctionLength;                      /* size of this descriptor in bytes */\r
+  uint8_t  bDescriptorType;                      /* CS_INTERFACE descriptor type */\r
+  uint8_t  bDescriptorSubtype;                   /* union functional descriptor subtype */\r
+  uint8_t  bMasterInterface;                     /* interface number designated as master */\r
+};\r
+typedef struct _CDC_UNION_DESCRIPTOR CDC_UNION_DESCRIPTOR;\r
+\r
+/* Union functional descriptors with one slave interface */\r
+/* (usbcdc11.pdf, 5.2.3.8) */\r
+PRE_PACK struct POST_PACK _CDC_UNION_1SLAVE_DESCRIPTOR {\r
+  CDC_UNION_DESCRIPTOR sUnion;              /* Union functional descriptor */\r
+  uint8_t              bSlaveInterfaces[1]; /* Slave interface 0 */\r
+};\r
+typedef struct _CDC_UNION_1SLAVE_DESCRIPTOR CDC_UNION_1SLAVE_DESCRIPTOR;\r
+\r
+/* Line coding structure */\r
+/* Format of the data returned when a GetLineCoding request is received */\r
+/* (usbcdc11.pdf, 6.2.13) */\r
+PRE_PACK struct POST_PACK _CDC_LINE_CODING {\r
+  uint32_t dwDTERate;                            /* Data terminal rate in bits per second */\r
+  uint8_t  bCharFormat;                          /* Number of stop bits */\r
+  uint8_t  bParityType;                          /* Parity bit type */\r
+  uint8_t  bDataBits;                            /* Number of data bits */\r
+};\r
+typedef struct _CDC_LINE_CODING CDC_LINE_CODING;\r
+\r
+/* Notification header */\r
+/* Data sent on the notification endpoint must follow this header. */\r
+/* see  USB_SETUP_PACKET in file usb.h */\r
+typedef USB_SETUP_PACKET CDC_NOTIFICATION_HEADER;\r
+\r
+#endif /* __CDC_H */\r
+\r