I'm trying to port GRBL 1.1 to the STM32F746 chip. Tell me the solution, thanks.

Committer:
Sergunb
Date:
Mon Sep 04 12:03:42 2017 +0000
Revision:
0:f1834a63f7c1
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Sergunb 0:f1834a63f7c1 1 /**
Sergunb 0:f1834a63f7c1 2 ******************************************************************************
Sergunb 0:f1834a63f7c1 3 * @file usb_desc.c
Sergunb 0:f1834a63f7c1 4 * @author MCD Application Team
Sergunb 0:f1834a63f7c1 5 * @version V4.0.0
Sergunb 0:f1834a63f7c1 6 * @date 21-January-2013
Sergunb 0:f1834a63f7c1 7 * @brief Descriptors for Virtual Com Port Demo
Sergunb 0:f1834a63f7c1 8 ******************************************************************************
Sergunb 0:f1834a63f7c1 9 * @attention
Sergunb 0:f1834a63f7c1 10 *
Sergunb 0:f1834a63f7c1 11 * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2>
Sergunb 0:f1834a63f7c1 12 *
Sergunb 0:f1834a63f7c1 13 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
Sergunb 0:f1834a63f7c1 14 * You may not use this file except in compliance with the License.
Sergunb 0:f1834a63f7c1 15 * You may obtain a copy of the License at:
Sergunb 0:f1834a63f7c1 16 *
Sergunb 0:f1834a63f7c1 17 * http://www.st.com/software_license_agreement_liberty_v2
Sergunb 0:f1834a63f7c1 18 *
Sergunb 0:f1834a63f7c1 19 * Unless required by applicable law or agreed to in writing, software
Sergunb 0:f1834a63f7c1 20 * distributed under the License is distributed on an "AS IS" BASIS,
Sergunb 0:f1834a63f7c1 21 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Sergunb 0:f1834a63f7c1 22 * See the License for the specific language governing permissions and
Sergunb 0:f1834a63f7c1 23 * limitations under the License.
Sergunb 0:f1834a63f7c1 24 *
Sergunb 0:f1834a63f7c1 25 ******************************************************************************
Sergunb 0:f1834a63f7c1 26 */
Sergunb 0:f1834a63f7c1 27
Sergunb 0:f1834a63f7c1 28
Sergunb 0:f1834a63f7c1 29 /* Includes ------------------------------------------------------------------*/
Sergunb 0:f1834a63f7c1 30 #include "usb_lib.h"
Sergunb 0:f1834a63f7c1 31 #include "usb_desc.h"
Sergunb 0:f1834a63f7c1 32
Sergunb 0:f1834a63f7c1 33 /* USB Standard Device Descriptor */
Sergunb 0:f1834a63f7c1 34 const uint8_t Virtual_Com_Port_DeviceDescriptor[] =
Sergunb 0:f1834a63f7c1 35 {
Sergunb 0:f1834a63f7c1 36 0x12, /* bLength */
Sergunb 0:f1834a63f7c1 37 USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */
Sergunb 0:f1834a63f7c1 38 0x00,
Sergunb 0:f1834a63f7c1 39 0x02, /* bcdUSB = 2.00 */
Sergunb 0:f1834a63f7c1 40 0x02, /* bDeviceClass: CDC */
Sergunb 0:f1834a63f7c1 41 0x00, /* bDeviceSubClass */
Sergunb 0:f1834a63f7c1 42 0x00, /* bDeviceProtocol */
Sergunb 0:f1834a63f7c1 43 0x40, /* bMaxPacketSize0 */
Sergunb 0:f1834a63f7c1 44 0x83,
Sergunb 0:f1834a63f7c1 45 0x04, /* idVendor = 0x0483 */
Sergunb 0:f1834a63f7c1 46 0x40,
Sergunb 0:f1834a63f7c1 47 0x57, /* idProduct = 0x7540 */
Sergunb 0:f1834a63f7c1 48 0x00,
Sergunb 0:f1834a63f7c1 49 0x02, /* bcdDevice = 2.00 */
Sergunb 0:f1834a63f7c1 50 1, /* Index of string descriptor describing manufacturer */
Sergunb 0:f1834a63f7c1 51 2, /* Index of string descriptor describing product */
Sergunb 0:f1834a63f7c1 52 3, /* Index of string descriptor describing the device's serial number */
Sergunb 0:f1834a63f7c1 53 0x01 /* bNumConfigurations */
Sergunb 0:f1834a63f7c1 54 };
Sergunb 0:f1834a63f7c1 55
Sergunb 0:f1834a63f7c1 56 const uint8_t Virtual_Com_Port_ConfigDescriptor[] =
Sergunb 0:f1834a63f7c1 57 {
Sergunb 0:f1834a63f7c1 58 /*Configuration Descriptor*/
Sergunb 0:f1834a63f7c1 59 0x09, /* bLength: Configuration Descriptor size */
Sergunb 0:f1834a63f7c1 60 USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType: Configuration */
Sergunb 0:f1834a63f7c1 61 VIRTUAL_COM_PORT_SIZ_CONFIG_DESC, /* wTotalLength:no of returned bytes */
Sergunb 0:f1834a63f7c1 62 0x00,
Sergunb 0:f1834a63f7c1 63 0x02, /* bNumInterfaces: 2 interface */
Sergunb 0:f1834a63f7c1 64 0x01, /* bConfigurationValue: Configuration value */
Sergunb 0:f1834a63f7c1 65 0x00, /* iConfiguration: Index of string descriptor describing the configuration */
Sergunb 0:f1834a63f7c1 66 0xC0, /* bmAttributes: self powered */
Sergunb 0:f1834a63f7c1 67 0x32, /* MaxPower 0 mA */
Sergunb 0:f1834a63f7c1 68 /*Interface Descriptor*/
Sergunb 0:f1834a63f7c1 69 0x09, /* bLength: Interface Descriptor size */
Sergunb 0:f1834a63f7c1 70 USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType: Interface */
Sergunb 0:f1834a63f7c1 71 /* Interface descriptor type */
Sergunb 0:f1834a63f7c1 72 0x00, /* bInterfaceNumber: Number of Interface */
Sergunb 0:f1834a63f7c1 73 0x00, /* bAlternateSetting: Alternate setting */
Sergunb 0:f1834a63f7c1 74 0x01, /* bNumEndpoints: One endpoints used */
Sergunb 0:f1834a63f7c1 75 0x02, /* bInterfaceClass: Communication Interface Class */
Sergunb 0:f1834a63f7c1 76 0x02, /* bInterfaceSubClass: Abstract Control Model */
Sergunb 0:f1834a63f7c1 77 0x01, /* bInterfaceProtocol: Common AT commands */
Sergunb 0:f1834a63f7c1 78 0x00, /* iInterface: */
Sergunb 0:f1834a63f7c1 79 /*Header Functional Descriptor*/
Sergunb 0:f1834a63f7c1 80 0x05, /* bLength: Endpoint Descriptor size */
Sergunb 0:f1834a63f7c1 81 0x24, /* bDescriptorType: CS_INTERFACE */
Sergunb 0:f1834a63f7c1 82 0x00, /* bDescriptorSubtype: Header Func Desc */
Sergunb 0:f1834a63f7c1 83 0x10, /* bcdCDC: spec release number */
Sergunb 0:f1834a63f7c1 84 0x01,
Sergunb 0:f1834a63f7c1 85 /*Call Management Functional Descriptor*/
Sergunb 0:f1834a63f7c1 86 0x05, /* bFunctionLength */
Sergunb 0:f1834a63f7c1 87 0x24, /* bDescriptorType: CS_INTERFACE */
Sergunb 0:f1834a63f7c1 88 0x01, /* bDescriptorSubtype: Call Management Func Desc */
Sergunb 0:f1834a63f7c1 89 0x00, /* bmCapabilities: D0+D1 */
Sergunb 0:f1834a63f7c1 90 0x01, /* bDataInterface: 1 */
Sergunb 0:f1834a63f7c1 91 /*ACM Functional Descriptor*/
Sergunb 0:f1834a63f7c1 92 0x04, /* bFunctionLength */
Sergunb 0:f1834a63f7c1 93 0x24, /* bDescriptorType: CS_INTERFACE */
Sergunb 0:f1834a63f7c1 94 0x02, /* bDescriptorSubtype: Abstract Control Management desc */
Sergunb 0:f1834a63f7c1 95 0x02, /* bmCapabilities */
Sergunb 0:f1834a63f7c1 96 /*Union Functional Descriptor*/
Sergunb 0:f1834a63f7c1 97 0x05, /* bFunctionLength */
Sergunb 0:f1834a63f7c1 98 0x24, /* bDescriptorType: CS_INTERFACE */
Sergunb 0:f1834a63f7c1 99 0x06, /* bDescriptorSubtype: Union func desc */
Sergunb 0:f1834a63f7c1 100 0x00, /* bMasterInterface: Communication class interface */
Sergunb 0:f1834a63f7c1 101 0x01, /* bSlaveInterface0: Data Class Interface */
Sergunb 0:f1834a63f7c1 102 /*Endpoint 2 Descriptor*/
Sergunb 0:f1834a63f7c1 103 0x07, /* bLength: Endpoint Descriptor size */
Sergunb 0:f1834a63f7c1 104 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */
Sergunb 0:f1834a63f7c1 105 0x82, /* bEndpointAddress: (IN2) */
Sergunb 0:f1834a63f7c1 106 0x03, /* bmAttributes: Interrupt */
Sergunb 0:f1834a63f7c1 107 VIRTUAL_COM_PORT_INT_SIZE, /* wMaxPacketSize: */
Sergunb 0:f1834a63f7c1 108 0x00,
Sergunb 0:f1834a63f7c1 109 0xFF, /* bInterval: */
Sergunb 0:f1834a63f7c1 110 /*Data class interface descriptor*/
Sergunb 0:f1834a63f7c1 111 0x09, /* bLength: Endpoint Descriptor size */
Sergunb 0:f1834a63f7c1 112 USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType: */
Sergunb 0:f1834a63f7c1 113 0x01, /* bInterfaceNumber: Number of Interface */
Sergunb 0:f1834a63f7c1 114 0x00, /* bAlternateSetting: Alternate setting */
Sergunb 0:f1834a63f7c1 115 0x02, /* bNumEndpoints: Two endpoints used */
Sergunb 0:f1834a63f7c1 116 0x0A, /* bInterfaceClass: CDC */
Sergunb 0:f1834a63f7c1 117 0x00, /* bInterfaceSubClass: */
Sergunb 0:f1834a63f7c1 118 0x00, /* bInterfaceProtocol: */
Sergunb 0:f1834a63f7c1 119 0x00, /* iInterface: */
Sergunb 0:f1834a63f7c1 120 /*Endpoint 3 Descriptor*/
Sergunb 0:f1834a63f7c1 121 0x07, /* bLength: Endpoint Descriptor size */
Sergunb 0:f1834a63f7c1 122 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */
Sergunb 0:f1834a63f7c1 123 0x03, /* bEndpointAddress: (OUT3) */
Sergunb 0:f1834a63f7c1 124 0x02, /* bmAttributes: Bulk */
Sergunb 0:f1834a63f7c1 125 VIRTUAL_COM_PORT_DATA_SIZE, /* wMaxPacketSize: */
Sergunb 0:f1834a63f7c1 126 0x00,
Sergunb 0:f1834a63f7c1 127 0x00, /* bInterval: ignore for Bulk transfer */
Sergunb 0:f1834a63f7c1 128 /*Endpoint 1 Descriptor*/
Sergunb 0:f1834a63f7c1 129 0x07, /* bLength: Endpoint Descriptor size */
Sergunb 0:f1834a63f7c1 130 USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */
Sergunb 0:f1834a63f7c1 131 0x81, /* bEndpointAddress: (IN1) */
Sergunb 0:f1834a63f7c1 132 0x02, /* bmAttributes: Bulk */
Sergunb 0:f1834a63f7c1 133 VIRTUAL_COM_PORT_DATA_SIZE, /* wMaxPacketSize: */
Sergunb 0:f1834a63f7c1 134 0x00,
Sergunb 0:f1834a63f7c1 135 0x00 /* bInterval */
Sergunb 0:f1834a63f7c1 136 };
Sergunb 0:f1834a63f7c1 137
Sergunb 0:f1834a63f7c1 138 /* USB String Descriptors */
Sergunb 0:f1834a63f7c1 139 const uint8_t Virtual_Com_Port_StringLangID[VIRTUAL_COM_PORT_SIZ_STRING_LANGID] =
Sergunb 0:f1834a63f7c1 140 {
Sergunb 0:f1834a63f7c1 141 VIRTUAL_COM_PORT_SIZ_STRING_LANGID,
Sergunb 0:f1834a63f7c1 142 USB_STRING_DESCRIPTOR_TYPE,
Sergunb 0:f1834a63f7c1 143 0x09,
Sergunb 0:f1834a63f7c1 144 0x04 /* LangID = 0x0409: U.S. English */
Sergunb 0:f1834a63f7c1 145 };
Sergunb 0:f1834a63f7c1 146
Sergunb 0:f1834a63f7c1 147 const uint8_t Virtual_Com_Port_StringVendor[VIRTUAL_COM_PORT_SIZ_STRING_VENDOR] =
Sergunb 0:f1834a63f7c1 148 {
Sergunb 0:f1834a63f7c1 149 VIRTUAL_COM_PORT_SIZ_STRING_VENDOR, /* Size of Vendor string */
Sergunb 0:f1834a63f7c1 150 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType*/
Sergunb 0:f1834a63f7c1 151 /* Manufacturer: "tomeko.net" */
Sergunb 0:f1834a63f7c1 152 't', 0, 'o', 0, 'm', 0, 'e', 0, 'k', 0, 'o', 0, ' ', 0, 'n', 0,
Sergunb 0:f1834a63f7c1 153 'e', 0, 't', 0
Sergunb 0:f1834a63f7c1 154 };
Sergunb 0:f1834a63f7c1 155
Sergunb 0:f1834a63f7c1 156 const uint8_t Virtual_Com_Port_StringProduct[VIRTUAL_COM_PORT_SIZ_STRING_PRODUCT] =
Sergunb 0:f1834a63f7c1 157 {
Sergunb 0:f1834a63f7c1 158 VIRTUAL_COM_PORT_SIZ_STRING_PRODUCT, /* bLength */
Sergunb 0:f1834a63f7c1 159 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
Sergunb 0:f1834a63f7c1 160 /* Product name: "STM32F103C8T6" */
Sergunb 0:f1834a63f7c1 161 'S', 0, 'T', 0, 'M', 0, '3', 0, '2', 0, 'F', 0, '1', 0, '0', 0,
Sergunb 0:f1834a63f7c1 162 '3', 0, 'C', 0, '8', 0, 'T', 0, '6', 0
Sergunb 0:f1834a63f7c1 163 };
Sergunb 0:f1834a63f7c1 164
Sergunb 0:f1834a63f7c1 165 uint8_t Virtual_Com_Port_StringSerial[VIRTUAL_COM_PORT_SIZ_STRING_SERIAL] =
Sergunb 0:f1834a63f7c1 166 {
Sergunb 0:f1834a63f7c1 167 VIRTUAL_COM_PORT_SIZ_STRING_SERIAL, /* bLength */
Sergunb 0:f1834a63f7c1 168 USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
Sergunb 0:f1834a63f7c1 169 'S', 0, 'T', 0, 'M', 0, '3', 0, '2', 0
Sergunb 0:f1834a63f7c1 170 };
Sergunb 0:f1834a63f7c1 171
Sergunb 0:f1834a63f7c1 172 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/