MakingThings
  • Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List
  • Globals

descriptors.h

00001 /*********************************************************************************
00002 
00003  Copyright 2006-2008 MakingThings
00004 
00005  Licensed under the Apache License, 
00006  Version 2.0 (the "License"); you may not use this file except in compliance 
00007  with the License. You may obtain a copy of the License at
00008 
00009  http://www.apache.org/licenses/LICENSE-2.0 
00010  
00011  Unless required by applicable law or agreed to in writing, software distributed
00012  under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
00013  CONDITIONS OF ANY KIND, either express or implied. See the License for
00014  the specific language governing permissions and limitations under the License.
00015 
00016 *********************************************************************************/
00017 
00018 /*
00019   - DESCRIPTOR DEFINITIONS -
00020 */
00021 
00022 /* String descriptors used during the enumeration process.
00023 These take the form:
00024 
00025 {
00026   Length of descriptor,
00027   Descriptor type,
00028   Data
00029 }
00030 */
00031 
00032 const portCHAR pxLanguageStringDescriptor[] =
00033 {
00034   4,
00035   usbDESCRIPTOR_TYPE_STRING,
00036   0x09, 0x04
00037 };
00038 
00039 const portCHAR pxManufacturerStringDescriptor[] = 
00040 {
00041   26,
00042   usbDESCRIPTOR_TYPE_STRING,
00043 
00044   'M', 0x00, 'a', 0x00, 'k', 0x00, 'i', 0x00, 'n', 0x00, 'g', 0x00, 
00045   'T', 0x00, 'h', 0x00, 'i', 0x00, 'n', 0x00, 'g', 0x00, 's', 0x00
00046 };
00047 
00048 const portCHAR pxProductStringDescriptor[] = 
00049 {
00050   39,
00051   usbDESCRIPTOR_TYPE_STRING,
00052 
00053   'M', 0x00, 'a', 0x00, 'k', 0x00, 'e', 0x00, ' ', 0x00, 
00054   'C', 0x00, 'o', 0x00, 'n', 0x00,  't', 0x00, 'r', 0x00, 'o', 0x00, 'l', 0x00, 'l', 0x00, 'e', 0x00, 'r', 0x00, ' ', 0x00,
00055   'K', 0x00, 'i', 0x00, 't', 0x00
00056 };
00057 
00058 const portCHAR pxConfigurationStringDescriptor[] = 
00059 {
00060   38,
00061   usbDESCRIPTOR_TYPE_STRING,
00062 
00063   'C', 0x00, 'o', 0x00, 'n', 0x00, 'f', 0x00, 'i', 0x00, 'g', 0x00, 'u', 0x00, 'r', 0x00, 'a', 0x00, 't', 0x00, 'i', 0x00,
00064   'o', 0x00, 'n', 0x00, ' ', 0x00, 'N', 0x00, 'a', 0x00, 'm', 0x00, 'e', 0x00
00065 };
00066 
00067 const portCHAR pxInterfaceStringDescriptor[] = 
00068 {
00069   30,
00070   usbDESCRIPTOR_TYPE_STRING,
00071 
00072   'I', 0x00, 'n', 0x00, 't', 0x00, 'e', 0x00, 'r', 0x00, 'f', 0x00, 'a', 0x00, 'c', 0x00, 'e', 0x00, ' ', 0x00, 'N', 0x00,
00073   'a', 0x00, 'm', 0x00, 'e', 0x00
00074 };
00075 
00076 /* Device should properly be 0x134A:0x9001, using 0x05F9:0xFFFF for Linux testing */
00077 const char pxDeviceDescriptor[] = 
00078 {
00079   /* Device descriptor */
00080   0x12,               /* bLength        */
00081   0x01,               /* bDescriptorType    */
00082   0x10, 0x01,             /* bcdUSBL        */
00083   0x02,               /* bDeviceClass:    */
00084   0x00,               /* bDeviceSubclass:   */
00085   0x00,               /* bDeviceProtocol:   */
00086   0x08,               /* bMaxPacketSize0    */
00087   0x03, 0xEB,             /* idVendorL      */
00088   0x20, 0x09,             /* idProductL     */
00089   0x10, 0x01,             /* bcdDeviceL     */
00090   usbMANUFACTURER_STRING,       /* iManufacturer    */
00091   usbPRODUCT_STRING,          /* iProduct       */
00092   0x00,               /* SerialNumber     */
00093   0x01                /* bNumConfigs      */
00094 };
00095 
00096 const char pxConfigDescriptor[] = {
00097 
00098   /* Configuration 1 descriptor
00099   Here we define two interfaces (0 and 1) and a total of 3 endpoints.
00100   Interface 0 is a CDC Abstract Control Model interface with one interrupt-in endpoint.
00101   Interface 1 is a CDC Data Interface class, with a bulk-in and bulk-out endpoint.
00102   Endpoint 0 gets used as the CDC management element.
00103   */
00104   0x09,       /* CbLength               */
00105   0x02,       /* CbDescriptorType             */
00106   0x43, 0x00,     /* CwTotalLength 2 EP + Control   ? */
00107   0x02,       /* CbNumInterfaces              */
00108   0x01,       /* CbConfigurationValue         */
00109   usbCONFIGURATION_STRING,/* CiConfiguration          */
00110   usbBUS_POWERED,   /* CbmAttributes Bus powered + Remote Wakeup*/
00111   0x32,       /* CMaxPower: 100mA           */
00112 
00113   /* Communication Class Interface Descriptor Requirement   */
00114   0x09,       /* bLength                */
00115   0x04,       /* bDescriptorType            */
00116   0x00,       /* bInterfaceNumber           */
00117   0x00,       /* bAlternateSetting          */
00118   0x01,       /* bNumEndpoints            */
00119   0x02,       /* bInterfaceClass: Comm Interface Class */
00120   0x02,       /* bInterfaceSubclass: Abstract Control Model*/
00121   0x01,       /* bInterfaceProtocol         */                      //LIAM experimenting here.
00122   usbINTERFACE_STRING,/* iInterface             */
00123 
00124   /* Header Functional Descriptor               */
00125   0x05,       /* bLength                */
00126   0x24,       /* bDescriptor type: CS_INTERFACE   */
00127   0x01,       /* bDescriptor subtype: Header Func Desc*/        //LIAM experimenting here.
00128   0x01, 0x01,     /* bcdCDC:1.1               */                //LIAM experimenting here.
00129 
00130   /* ACM Functional Descriptor                */
00131   0x04,       /* bFunctionLength            */
00132   0x24,       /* bDescriptor type: CS_INTERFACE   */
00133   0x02,       /* bDescriptor subtype: ACM Func Desc */
00134   0x06,       /* bmCapabilities: We don't support squat*/             //LIAM experimenting here.
00135 
00136   /* Union Functional Descriptor                */
00137   0x05,       /* bFunctionLength            */
00138   0x24,       /* bDescriptor type: CS_INTERFACE   */
00139   0x06,       /* bDescriptor subtype: Union Func Desc */
00140   0x00,       /* bMasterInterface: CDC Interface    */
00141   0x01,       /* bSlaveInterface0: Data Class Interface*/
00142 
00143   /* Call Management Functional Descriptor
00144   0 in D1 and D0 indicates that device does not handle call management*/
00145   0x05,       /* bFunctionLength            */
00146   0x24,       /* bDescriptor type: CS_INTERFACE   */
00147   0x01,       /* bDescriptor subtype: Call Management Func*/
00148   0x01,       /* bmCapabilities: D1 + D0        */              //LIAM experimenting here.
00149   0xFF,       /* bDataInterface: Data Class Interface 1*/       //LIAM experimenting here.
00150 
00151   /* CDC Control - Endpoint 3 descriptor
00152   This endpoint serves as a notification element.       */
00153 
00154   0x07,       /* bLength                */
00155   0x05,       /* bDescriptorType            */
00156   0x83,       /* bEndpointAddress, Endpoint 03 - IN */
00157   0x03,       /* bmAttributes   INT         */
00158   0x08, 0x00,     /* wMaxPacketSize: 8 bytes          */
00159   0xFF,       /* bInterval              */
00160 
00161   /* Data Class Interface Descriptor Requirement        */
00162   0x09,       /* bLength                */
00163   0x04,       /* bDescriptorType            */
00164   0x01,       /* bInterfaceNumber           */
00165   0x00,       /* bAlternateSetting          */
00166   0x02,       /* bNumEndPoints            */
00167   0x0A,       /* bInterfaceClass            */
00168   0x00,       /* bInterfaceSubclass         */
00169   0x01,       /* bInterfaceProtocol         */
00170   0x00,       /* iInterface             */
00171 
00172   /* CDC Data - Endpoint 1 descriptor */
00173   0x07,       /* bLenght                */
00174   0x05,       /* bDescriptorType            */
00175   0x01,       /* bEndPointAddress, Endpoint 01 - OUT  */
00176   0x02,       /* bmAttributes BULK          */
00177   64,         /* wMaxPacketSize           */
00178   0x00,
00179   0x00,       /* bInterval              */
00180 
00181   /* CDC Data - Endpoint 2 descriptor */
00182   0x07,       /* bLength                */
00183   0x05,       /* bDescriptorType            */
00184   0x82,       /* bEndPointAddress, Endpoint 02 - IN */
00185   0x02,       /* bmAttributes BULK          */
00186   64,         /* wMaxPacketSize           */
00187   0x00,
00188   0x00        /* bInterval              */
00189 };
00190 

The Make Controller Kit is an open source project maintained by MakingThings.
MakingThings code is released under the Apache 2.0 license.
Bug tracker, development wiki and status can be found at http://dev.makingthings.com.
This document was last updated on 18 May 2009.