Sergey Pastor / grbl1
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers usb_desc.c Source File

usb_desc.c

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    usb_desc.c
00004   * @author  MCD Application Team
00005   * @version V4.0.0
00006   * @date    21-January-2013
00007   * @brief   Descriptors for Virtual Com Port Demo
00008   ******************************************************************************
00009   * @attention
00010   *
00011   * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2>
00012   *
00013   * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
00014   * You may not use this file except in compliance with the License.
00015   * You may obtain a copy of the License at:
00016   *
00017   *        http://www.st.com/software_license_agreement_liberty_v2
00018   *
00019   * Unless required by applicable law or agreed to in writing, software 
00020   * distributed under the License is distributed on an "AS IS" BASIS, 
00021   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00022   * See the License for the specific language governing permissions and
00023   * limitations under the License.
00024   *
00025   ******************************************************************************
00026   */
00027 
00028 
00029 /* Includes ------------------------------------------------------------------*/
00030 #include "usb_lib.h"
00031 #include "usb_desc.h"
00032 
00033 /* USB Standard Device Descriptor */
00034 const uint8_t Virtual_Com_Port_DeviceDescriptor[] =
00035   {
00036     0x12,   /* bLength */
00037     USB_DEVICE_DESCRIPTOR_TYPE,     /* bDescriptorType */
00038     0x00,
00039     0x02,   /* bcdUSB = 2.00 */
00040     0x02,   /* bDeviceClass: CDC */
00041     0x00,   /* bDeviceSubClass */
00042     0x00,   /* bDeviceProtocol */
00043     0x40,   /* bMaxPacketSize0 */
00044     0x83,
00045     0x04,   /* idVendor = 0x0483 */
00046     0x40,
00047     0x57,   /* idProduct = 0x7540 */
00048     0x00,
00049     0x02,   /* bcdDevice = 2.00 */
00050     1,              /* Index of string descriptor describing manufacturer */
00051     2,              /* Index of string descriptor describing product */
00052     3,              /* Index of string descriptor describing the device's serial number */
00053     0x01    /* bNumConfigurations */
00054   };
00055 
00056 const uint8_t Virtual_Com_Port_ConfigDescriptor[] =
00057   {
00058     /*Configuration Descriptor*/
00059     0x09,   /* bLength: Configuration Descriptor size */
00060     USB_CONFIGURATION_DESCRIPTOR_TYPE,      /* bDescriptorType: Configuration */
00061     VIRTUAL_COM_PORT_SIZ_CONFIG_DESC,       /* wTotalLength:no of returned bytes */
00062     0x00,
00063     0x02,   /* bNumInterfaces: 2 interface */
00064     0x01,   /* bConfigurationValue: Configuration value */
00065     0x00,   /* iConfiguration: Index of string descriptor describing the configuration */
00066     0xC0,   /* bmAttributes: self powered */
00067     0x32,   /* MaxPower 0 mA */
00068     /*Interface Descriptor*/
00069     0x09,   /* bLength: Interface Descriptor size */
00070     USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: Interface */
00071     /* Interface descriptor type */
00072     0x00,   /* bInterfaceNumber: Number of Interface */
00073     0x00,   /* bAlternateSetting: Alternate setting */
00074     0x01,   /* bNumEndpoints: One endpoints used */
00075     0x02,   /* bInterfaceClass: Communication Interface Class */
00076     0x02,   /* bInterfaceSubClass: Abstract Control Model */
00077     0x01,   /* bInterfaceProtocol: Common AT commands */
00078     0x00,   /* iInterface: */
00079     /*Header Functional Descriptor*/
00080     0x05,   /* bLength: Endpoint Descriptor size */
00081     0x24,   /* bDescriptorType: CS_INTERFACE */
00082     0x00,   /* bDescriptorSubtype: Header Func Desc */
00083     0x10,   /* bcdCDC: spec release number */
00084     0x01,
00085     /*Call Management Functional Descriptor*/
00086     0x05,   /* bFunctionLength */
00087     0x24,   /* bDescriptorType: CS_INTERFACE */
00088     0x01,   /* bDescriptorSubtype: Call Management Func Desc */
00089     0x00,   /* bmCapabilities: D0+D1 */
00090     0x01,   /* bDataInterface: 1 */
00091     /*ACM Functional Descriptor*/
00092     0x04,   /* bFunctionLength */
00093     0x24,   /* bDescriptorType: CS_INTERFACE */
00094     0x02,   /* bDescriptorSubtype: Abstract Control Management desc */
00095     0x02,   /* bmCapabilities */
00096     /*Union Functional Descriptor*/
00097     0x05,   /* bFunctionLength */
00098     0x24,   /* bDescriptorType: CS_INTERFACE */
00099     0x06,   /* bDescriptorSubtype: Union func desc */
00100     0x00,   /* bMasterInterface: Communication class interface */
00101     0x01,   /* bSlaveInterface0: Data Class Interface */
00102     /*Endpoint 2 Descriptor*/
00103     0x07,   /* bLength: Endpoint Descriptor size */
00104     USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */
00105     0x82,   /* bEndpointAddress: (IN2) */
00106     0x03,   /* bmAttributes: Interrupt */
00107     VIRTUAL_COM_PORT_INT_SIZE,      /* wMaxPacketSize: */
00108     0x00,
00109     0xFF,   /* bInterval: */
00110     /*Data class interface descriptor*/
00111     0x09,   /* bLength: Endpoint Descriptor size */
00112     USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: */
00113     0x01,   /* bInterfaceNumber: Number of Interface */
00114     0x00,   /* bAlternateSetting: Alternate setting */
00115     0x02,   /* bNumEndpoints: Two endpoints used */
00116     0x0A,   /* bInterfaceClass: CDC */
00117     0x00,   /* bInterfaceSubClass: */
00118     0x00,   /* bInterfaceProtocol: */
00119     0x00,   /* iInterface: */
00120     /*Endpoint 3 Descriptor*/
00121     0x07,   /* bLength: Endpoint Descriptor size */
00122     USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */
00123     0x03,   /* bEndpointAddress: (OUT3) */
00124     0x02,   /* bmAttributes: Bulk */
00125     VIRTUAL_COM_PORT_DATA_SIZE,             /* wMaxPacketSize: */
00126     0x00,
00127     0x00,   /* bInterval: ignore for Bulk transfer */
00128     /*Endpoint 1 Descriptor*/
00129     0x07,   /* bLength: Endpoint Descriptor size */
00130     USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */
00131     0x81,   /* bEndpointAddress: (IN1) */
00132     0x02,   /* bmAttributes: Bulk */
00133     VIRTUAL_COM_PORT_DATA_SIZE,             /* wMaxPacketSize: */
00134     0x00,
00135     0x00    /* bInterval */
00136   };
00137 
00138 /* USB String Descriptors */
00139 const uint8_t Virtual_Com_Port_StringLangID[VIRTUAL_COM_PORT_SIZ_STRING_LANGID] =
00140   {
00141     VIRTUAL_COM_PORT_SIZ_STRING_LANGID,
00142     USB_STRING_DESCRIPTOR_TYPE,
00143     0x09,
00144     0x04 /* LangID = 0x0409: U.S. English */
00145   };
00146 
00147 const uint8_t Virtual_Com_Port_StringVendor[VIRTUAL_COM_PORT_SIZ_STRING_VENDOR] =
00148   {
00149     VIRTUAL_COM_PORT_SIZ_STRING_VENDOR,     /* Size of Vendor string */
00150     USB_STRING_DESCRIPTOR_TYPE,             /* bDescriptorType*/
00151     /* Manufacturer: "tomeko.net" */
00152     't', 0, 'o', 0, 'm', 0, 'e', 0, 'k', 0, 'o', 0, ' ', 0, 'n', 0,
00153     'e', 0, 't', 0
00154   };
00155 
00156 const uint8_t Virtual_Com_Port_StringProduct[VIRTUAL_COM_PORT_SIZ_STRING_PRODUCT] =
00157   {
00158     VIRTUAL_COM_PORT_SIZ_STRING_PRODUCT,          /* bLength */
00159     USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
00160     /* Product name: "STM32F103C8T6" */
00161     'S', 0, 'T', 0, 'M', 0, '3', 0, '2', 0, 'F', 0, '1', 0, '0', 0,
00162     '3', 0, 'C', 0, '8', 0, 'T', 0, '6', 0
00163   };
00164 
00165 uint8_t Virtual_Com_Port_StringSerial[VIRTUAL_COM_PORT_SIZ_STRING_SERIAL] =
00166   {
00167     VIRTUAL_COM_PORT_SIZ_STRING_SERIAL,           /* bLength */
00168     USB_STRING_DESCRIPTOR_TYPE,                   /* bDescriptorType */
00169     'S', 0, 'T', 0, 'M', 0, '3', 0, '2', 0
00170   };
00171 
00172 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/