1 #ifndef DEVICES_USB_CDC_H
    2 #define DEVICES_USB_CDC_H
    3 /*
    4 **	$VER: usb_cdc.h 2.0 (15.12.07)
    5 **
    6 **	usb definitions include file
    7 **
    8 **	(C) Copyright 2002-2007 Chris Hodges
    9 **	    All Rights Reserved
   10 */
   11 
   12 #include <exec/types.h>
   13 
   14 #if defined(__GNUC__)
   15 # pragma pack(1)
   16 #endif
   17 
   18 /* Usb CDC Requests (all of these target to an interface) */
   19 #define UCDCR_SEND_ENCAPSULATED_COMMAND  0x00
   20 #define UCDCR_GET_ENCAPSULATED_RESPONSE  0x01
   21 #define UCDCR_SET_COMM_FEATURE           0x02
   22 #define UCDCR_GET_COMM_FEATURE           0x03
   23 #define UCDCR_CLEAR_COMM_FEATURE         0x04
   24 #define UCDCR_SET_AUX_LINE_STATE         0x10
   25 #define UCDCR_SET_HOOK_STATE             0x11
   26 #define UCDCR_PULSE_SETUP                0x12
   27 #define UCDCR_SEND_PULSE                 0x13
   28 #define UCDCR_SET_PULSE_TIME             0x14
   29 #define UCDCR_RING_AUX_JACK              0x15
   30 #define UCDCR_SET_LINE_CODING            0x20
   31 #define UCDCR_GET_LINE_CODING            0x21
   32 #define UCDCR_SET_CONTROL_LINE_STATE     0x22
   33 #define UCDCR_SEND_BREAK                 0x23
   34 #define UCDCR_SET_RINGER_PARMS           0x30
   35 #define UCDCR_GET_RINGER_PARMS           0x31
   36 #define UCDCR_SET_OPERATION_PARMS        0x32
   37 #define UCDCR_GET_OPERATION_PARMS        0x33
   38 #define UCDCR_SET_LINE_PARMS             0x34
   39 #define UCDCR_GET_LINE_PARMS             0x35
   40 #define UCDCR_DIAL_DIGITS                0x36
   41 #define UCDCR_SET_UNIT_PARAMETER         0x37
   42 #define UCDCR_GET_UNIT_PARAMETER         0x38
   43 #define UCDCR_CLEAR_UNIT_PARAMETER       0x39
   44 #define UCDCR_GET_PROFILE                0x3A
   45 #define UCDCR_SET_ETHERNET_MULTICAST_FILTERS 0x40
   46 #define UCDCR_SET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER 0x41
   47 #define UCDCR_GET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER 0x42
   48 #define UCDCR_SET_ETHERNET_PACKET_FILTER 0x43
   49 #define UCDCR_GET_ETHERNET_STATISTIC     0x44
   50 #define UCDCR_SET_ATM_DATA_FORMAT        0x50
   51 #define UCDCR_GET_ATM_DEVICE_STATISTICS  0x51
   52 #define UCDCR_SET_ATM_DEFAULT_VC         0x52
   53 #define UCDCR_GET_ATM_VC_STATISTICS      0x53
   54 
   55 /* Usb CDC Notify Requests */
   56 #define UCDCR_NETWORK_CONNECTION         0x00
   57 #define UCDCR_RESPONSE_AVAILABLE         0x01
   58 #define UCDCR_AUX_JACK_HOOK_STATE        0x08
   59 #define UCDCR_RING_DETECT                0x09
   60 #define UCDCR_SERIAL_STATE               0x20
   61 #define UCDCR_CALL_STATE_CHANGE          0x28
   62 #define UCDCR_LINE_STATE_CHANGE          0x29
   63 #define UCDCR_CONNECTION_SPEED_CHANGE    0x2A
   64 
   65 /* CDC WMC class specific descriptor subtypes */
   66 #define UDST_CDC_HEADER       0x00 /* Header Functional Descriptor */
   67 #define UDST_CDC_CALLMGM      0x01 /* Call Management Functional Descriptor */
   68 #define UDST_CDC_ACM          0x02 /* Abstract Control Management Functional Descriptor */
   69 #define UDST_CDC_DIRECTLINE   0x03 /* Direct Line Management Functional Descriptor */
   70 #define UDST_CDC_PHONERING    0x04 /* Telephone Ringer Functional Descriptor */
   71 #define UDST_CDC_PHONECALL    0x05 /* Telephone Call and Line State Reporting Capabilities Functional Descriptor */
   72 #define UDST_CDC_UNION        0x06 /* Union Functional descriptor */
   73 #define UDST_CDC_COUNTRY      0x07 /* Country Selection Functional Descriptor */
   74 #define UDST_CDC_PHONEOP      0x08 /* Telephone Operational Modes Functional Descriptor */
   75 #define UDST_CDC_TERMINAL     0x09 /* USB Terminal Functional Descriptor */
   76 #define UDST_CDC_NETWORK      0x0a /* Network Channel Terminal Descriptor */
   77 #define UDST_CDC_PROTOCOL     0x0b /* Protocol Unit Functional Descriptor */
   78 #define UDST_CDC_EXTENSION    0x0c /* Extension Unit Functional Descriptor */
   79 #define UDST_CDC_MCM          0x0d /* Multi-Channel Management Functional Descriptor */
   80 #define UDST_CDC_CAPICTRL     0x0e /* CAPI Control Management Functional Descriptor */
   81 #define UDST_CDC_ETHERNET     0x0f /* Ethernet Networking Functional Descriptor */
   82 #define UDST_CDC_ATM          0x10 /* ATM Networking Functional Descriptor */
   83 #define UDST_CDC_WMC          0x11 /* Wireless Handset Control Model Functional Descriptor */
   84 #define UDST_CDC_MDLM         0x12 /* Mobile Direct Line Model Functional Descriptor */
   85 #define UDST_CDC_MDLMDETAIL   0x13 /* MDLM Detail Functional Descriptor */
   86 #define UDST_CDC_DEVMANGM     0x14 /* Device Management Model Functional Descriptor */
   87 #define UDST_CDC_OBEX         0x15 /* OBEX Functional Descriptor */
   88 #define UDST_CDC_CMDSET       0x16 /* Command Set Functional Descriptor */
   89 #define UDST_CDC_CMDSETDETAIL 0x17 /* Command Set Detail Functional Descriptor */
   90 #define UDST_CDC_TCM          0x18 /* Telephone Control Model Functional Descriptor */
   91 
   92 /* CDC Control Interface subclasses */
   93 #define CDC_DLCM_SUBCLASS     0x01 /* Direct Line Control Model */
   94 #define CDC_ACM_SUBCLASS      0x02 /* Abstract Control Model */
   95 #define CDC_TCM_SUBCLASS      0x03 /* Telephone Control Model */
   96 #define CDC_MCCM_SUBCLASS     0x04 /* Multi-Channel Control Model */
   97 #define CDC_CAPICM_SUBCLASS   0x05 /* CAPI Control Model */
   98 #define CDC_ETHCM_SUBCLASS    0x06 /* Ethernet Networking Control Model */
   99 #define CDC_ATMCM_SUBCLASS    0x07 /* ATM Networking Control Model */
  100 #define CDC_WHCM_SUBCLASS     0x08 /* Wireless Handset Control Model */
  101 #define CDC_DEVMANGM_SUBCLASS 0x09 /* Device Management Model */
  102 #define CDC_MDLM_SUBCLASS     0x0a /* Mobile Direct Line Model */
  103 #define CDC_OBEX_SUBCLASS     0x0b /* OBEX Model */
  104 
  105 /* CDC Control Interface protocols */
  106 #define CDC_PROTO_USB         0x00 /* no class specific protocol */
  107 #define CDC_PROTO_HAYES       0x01 /* common AT commands */
  108 #define CDC_PROTO_PCCA101     0x02 /* AT Commands defined by [PCCA101] */
  109 #define CDC_PROTO_PCCA101O    0x03 /* AT Commands defined by [PCCA101] + [PCCA101-O] */
  110 #define CDC_PROTO_GSM0707     0x04 /* AT Commands defined by [GSM07.07] */
  111 #define CDC_PROTO_3GPP27007   0x05 /* AT Commands defined by [3GPP27.007] */
  112 #define CDC_PROTO_CS00170     0x06 /* AT Commands defined by [C-S0017-0] */
  113 #define CDC_PROTO_EXTERNAL    0xfe /* External Protocol: Commands defined by Command Set functional descriptor */
  114 
  115 /* CDC Data Interface protocols */
  116 #define CDC_PROTO_ISDNBRI     0x30 /* I.430 Physical interface protocol for ISDN BRI */
  117 #define CDC_PROTO_HDLC        0x31 /* ISO/IEC 3309-1993 HDLC */
  118 #define CDC_PROTO_TRANSP      0x32 /* Transparent */
  119 #define CDC_PROTO_Q921M       0x50 /* Management protocol for Q.921 data link protocol */
  120 #define CDC_PROTO_Q921D       0x51 /* Data link protocol for Q.931 */
  121 #define CDC_PROTO_Q921TM      0x52 /* TEI-multiplexor for Q.921 data link protocol */
  122 #define CDC_PROTO_V42BIS      0x90 /* V.42bis Data compression procedures */
  123 #define CDC_PROTO_EUROISDN    0x91 /* Q.931 Euro ISDN */
  124 #define CDC_PROTO_V120        0x92 /* V.24 rate adaption to ISDN */
  125 #define CDC_PROTO_CAPI20      0x93 /* CAPI Commands */
  126 #define CDC_PROTO_HOST        0xFD /* host based driver */
  127 #define CDC_PROTO_CDC         0xFE /* protocol described using protocol unit descriptors */
  128 
  129 /* Usb CDC Class specific stuff */
  130 
  131 /* actual descriptors */
  132 
  133 struct UsbCDCHeaderDesc
  134 {
  135     UBYTE bFunctionLength;     /* total size of the descriptor */
  136     UBYTE bDescriptorType;     /* Descriptor Type */
  137     UBYTE bDescriptorSubtype;  /* Descriptor Subtype (CDC_FD_HEADER) */
  138     UBYTE bcdCDC0;             /* BCD Version lowbyte */
  139     UBYTE bcdCDC1;             /* BCD Version highbyte */
  140 };
  141 
  142 struct UsbCDCCallMgmDesc
  143 {
  144     UBYTE bFunctionLength;     /* total size of the descriptor */
  145     UBYTE bDescriptorType;     /* Descriptor Type */
  146     UBYTE bDescriptorSubtype;  /* Descriptor Subtype (CDC_FD_CALLMGM) */
  147     UBYTE bmCapabilities;      /* Capabilities (bit 0 handles cm, bit 1 data interface) */
  148     UBYTE bDataInterface;      /* interface number for call management */
  149 };
  150 
  151 struct UsbCDCACMDesc
  152 {
  153     UBYTE bFunctionLength;     /* total size of the descriptor */
  154     UBYTE bDescriptorType;     /* Descriptor Type */
  155     UBYTE bDescriptorSubtype;  /* Descriptor Subtype (CDC_FD_ACM) */
  156     UBYTE bmCapabilities;      /* Capabilities */
  157 };
  158 
  159 struct UsbCDCDLDesc
  160 {
  161     UBYTE bFunctionLength;     /* total size of the descriptor */
  162     UBYTE bDescriptorType;     /* Descriptor Type */
  163     UBYTE bDescriptorSubtype;  /* Descriptor Subtype (CDC_FD_DirectLine) */
  164     UBYTE bmCapabilities;      /* Capabilities */
  165 };
  166 
  167 struct UsbCDCRingerDesc
  168 {
  169     UBYTE bFunctionLength;     /* total size of the descriptor */
  170     UBYTE bDescriptorType;     /* Descriptor Type */
  171     UBYTE bDescriptorSubtype;  /* Descriptor Subtype (CDC_FD_PHONERING) */
  172     UBYTE bRingerVolSteps;     /* Volume scale */
  173     UBYTE bNumRingerPatterns;  /* Number of ring patterns supported */
  174 };
  175 
  176 struct UsbCDCPhoneOpDesc
  177 {
  178     UBYTE bFunctionLength;     /* total size of the descriptor */
  179     UBYTE bDescriptorType;     /* Descriptor Type */
  180     UBYTE bDescriptorSubtype;  /* Descriptor Subtype (CDC_FD_PHONEOP) */
  181     UBYTE bmCapabilities;      /* Capabilities */
  182 };
  183 
  184 struct UsbCDCPhoneCallDesc
  185 {
  186     UBYTE bFunctionLength;     /* total size of the descriptor */
  187     UBYTE bDescriptorType;     /* Descriptor Type */
  188     UBYTE bDescriptorSubtype;  /* Descriptor Subtype (CDC_FD_PHONECALL) */
  189     ULONG bmCapabilities;      /* Capabilities */
  190 };
  191 
  192 struct UsbCDCUnionDesc
  193 {
  194     UBYTE bFunctionLength;     /* total size of the descriptor */
  195     UBYTE bDescriptorType;     /* Descriptor Type */
  196     UBYTE bDescriptorSubtype;  /* Descriptor Subtype (CDC_FD_UNION) */
  197     UBYTE bMasterInterface;    /* interface number of master interface */
  198     UBYTE bSlaveInterface0;    /* interface number of the first slave */
  199 };
  200 
  201 struct UsbCDCCountryDesc
  202 {
  203     UBYTE bFunctionLength;     /* total size of the descriptor */
  204     UBYTE bDescriptorType;     /* Descriptor Type */
  205     UBYTE bDescriptorSubtype;  /* Descriptor Subtype (CDC_FD_COUNTRY) */
  206     UBYTE iCountryCodeRelDate; /* Index of a release date string */
  207     UWORD wCountryCode0;       /* Country code in hex */
  208 };
  209 
  210 struct UsbCDCTerminalDesc
  211 {
  212     UBYTE bFunctionLength;     /* total size of the descriptor */
  213     UBYTE bDescriptorType;     /* Descriptor Type */
  214     UBYTE bDescriptorSubtype;  /* Descriptor Subtype (CDC_FD_TERMINAL) */
  215     UBYTE bEntityId;           /* constant identifying the terminal */
  216     UBYTE iName;               /* string index */
  217     UBYTE bChannelIndex;       /* channel index of associated network channel */
  218     UBYTE bPhysicalInterface;  /* type of physical interface (0=None, 1=ISDN) */
  219 };
  220 
  221 struct UsbCDCProtocolDesc
  222 {
  223     UBYTE bFunctionLength;     /* total size of the descriptor */
  224     UBYTE bDescriptorType;     /* Descriptor Type */
  225     UBYTE bDescriptorSubtype;  /* Descriptor Subtype (CDC_FD_PROTOCOL) */
  226     UBYTE bEntityId;           /* constant identifying the unit */
  227     UBYTE bProtocol;           /* Protocol code */
  228     UBYTE bChildId0;           /* first ID of lower terminal or unit */
  229 };
  230 
  231 struct UsbCDCExtensionDesc
  232 {
  233     UBYTE bFunctionLength;     /* total size of the descriptor */
  234     UBYTE bDescriptorType;     /* Descriptor Type */
  235     UBYTE bDescriptorSubtype;  /* Descriptor Subtype (CDC_FD_EXTENSION) */
  236     UBYTE bEntityId;           /* constant identifying the unit */
  237     UBYTE bExtensionCode;      /* vendor specific code */
  238     UBYTE iName;               /* string index */
  239     UBYTE bChildId0;           /* first ID of lower terminal or unit */
  240 };
  241 
  242 struct UsbCDCMCMDesc
  243 {
  244     UBYTE bFunctionLength;     /* total size of the descriptor */
  245     UBYTE bDescriptorType;     /* Descriptor Type */
  246     UBYTE bDescriptorSubtype;  /* Descriptor Subtype (CDC_FD_MCM) */
  247     UBYTE bmCapabilities;      /* Capabilities */
  248 };
  249 
  250 struct UsbCDCCAPICtrlDesc
  251 {
  252     UBYTE bFunctionLength;     /* total size of the descriptor */
  253     UBYTE bDescriptorType;     /* Descriptor Type */
  254     UBYTE bDescriptorSubtype;  /* Descriptor Subtype (CDC_FD_CAPICTRL) */
  255     UBYTE bmCapabilities;      /* Capabilities */
  256 };
  257 
  258 struct UsbCDCEthernetDesc
  259 {
  260     UBYTE bFunctionLength;     /* total size of the descriptor */
  261     UBYTE bDescriptorType;     /* Descriptor Type */
  262     UBYTE bDescriptorSubtype;  /* Descriptor Subtype (CDC_FD_ETHERNET) */
  263     UBYTE iMACAddress;         /* index of string descriptor with MAC */
  264     ULONG bmEthernetStatistics; /* bitmap of statistics supported */
  265     UWORD wMaxSegmentSize;     /* MTU */
  266     UWORD wNumberMCFilters;    /* Number of multicast filters */
  267     UBYTE bNumberPowerFilters; /* Number of pattern filters for wake-up */
  268 };
  269 
  270 struct UsbCDCATMDesc
  271 {
  272     UBYTE bFunctionLength;     /* total size of the descriptor */
  273     UBYTE bDescriptorType;     /* Descriptor Type */
  274     UBYTE bDescriptorSubtype;  /* Descriptor Subtype (CDC_FD_ATM) */
  275     UBYTE iEndSystemIdentifier; /* string index */
  276     UBYTE bmDataCapabilities;  /* Capabilities */
  277     UBYTE bmATMDeviceStatistics; /* bitmap of statistics supported */
  278     UWORD wType2MaxSegmentSize; /* MTU of Type 2 segments */
  279     UWORD wType3MaxSegmentSize; /* MTU of Type 3 segments */
  280     UWORD wMaxVC;              /* max number of virtual circuits */
  281 };
  282 
  283 /* CDC ACM specific stuff */
  284 
  285 struct UsbCDCLineCoding
  286 {
  287     ULONG dwDTERate;           /* Baud rate */
  288     UBYTE bCharFormat;         /* Stop bits 0->1, 1->1.5, 2->2 */
  289     UBYTE bParityType;         /* Party (0=None, 1=Odd, 2=Even, 3=Mark, 4=Space) */
  290     UBYTE bDataBits;           /* Databits (5,6,7,8 or 16) */
  291 };
  292 
  293 #if defined(__GNUC__)
  294 # pragma pack()
  295 #endif
  296 
  297 #endif /* DEVICES_USB_CDC_H */