rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
usbdescriptors.h
Go to the documentation of this file.
1/*******************************************************************************
2* Copyright (C) 2013-2016, Cypress Semiconductor Corporation or a *
3* subsidiary of Cypress Semiconductor Corporation. All rights reserved. *
4* *
5* This software, including source code, documentation and related *
6* materials ("Software"), is owned by Cypress Semiconductor Corporation or *
7* one of its subsidiaries ("Cypress") and is protected by and subject to *
8* worldwide patent protection (United States and foreign), United States *
9* copyright laws and international treaty provisions. Therefore, you may use *
10* this Software only as provided in the license agreement accompanying the *
11* software package from which you obtained this Software ("EULA"). *
12* *
13* If no EULA applies, Cypress hereby grants you a personal, non-exclusive, *
14* non-transferable license to copy, modify, and compile the *
15* Software source code solely for use in connection with Cypress's *
16* integrated circuit products. Any reproduction, modification, translation, *
17* compilation, or representation of this Software except as specified *
18* above is prohibited without the express written permission of Cypress. *
19* *
20* Disclaimer: THIS SOFTWARE IS PROVIDED AS-IS, WITH NO *
21* WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING, *
22* BUT NOT LIMITED TO, NONINFRINGEMENT, IMPLIED *
23* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
24* PARTICULAR PURPOSE. Cypress reserves the right to make *
25* changes to the Software without notice. Cypress does not assume any *
26* liability arising out of the application or use of the Software or any *
27* product or circuit described in the Software. Cypress does not *
28* authorize its products for use in any products where a malfunction or *
29* failure of the Cypress product may reasonably be expected to result in *
30* significant property damage, injury or death ("High Risk Product"). By *
31* including Cypress's product in a High Risk Product, the manufacturer *
32* of such system or application assumes all risk of such use and in doing *
33* so agrees to indemnify Cypress against all liability. *
34*******************************************************************************/
35/******************************************************************************/
36/** \file UsbDescriptors.h
37 **
38 ** USB Descriptors File
39 **
40 ** History:
41 ** - 2020-1-27 1.0 MSc Automatically Created by Spansion USB Wizard
42 *****************************************************************************/
43
44#ifndef __USBDESCRIPTORS_H__
45#define __USBDESCRIPTORS_H__
46
47/*****************************************************************************/
48/* Include files */
49/*****************************************************************************/
50
51
52
53/*****************************************************************************/
54/* Global pre-processor symbols/macros ('#define') */
55/*****************************************************************************/
56
57#define USB_DEVDESC_SIZE 18
58#define USB_CNFGDESC_SIZE 53
59#define USB_FUNC_EP0_SIZE 64
60#define CLASSNAME "UsbDeviceCdcCom"
61
62
63/*****************************************************************************/
64/* Global type definitions ('typedef') */
65/*****************************************************************************/
66
67#define USBDESCRIPTORS_STRINGDESCRIPTOR_COUNT (uint32_t)(sizeof(pstcStringDescriptors) / sizeof(pstcStringDescriptors[0]))
68
69
70
71
72/*****************************************************************************/
73/* Global variable declarations ('extern', definition in C source) */
74/*****************************************************************************/
75// [andreika]: use ST-compatible vendor+product IDs
76const uint8_t au8DeviceDescriptor[18] =
77{
78 ///DEVICE DESCRIPTOR
79 0x12, ///bLength: Length of this descriptor
80 0x01, ///bDescriptorType: Device Descriptor Type
81 0x10, ///bcdUSB: USB Version
82 0x01, ///bcdUSB: USB Version
83 0x02, ///bDeviceClass: Class Code: COMMUNICATIONS_AND_CDC_CONTROL
84 0x00, ///bDeviceSubClass: Sub Class Code
85 0x00, ///bDeviceProtocol: Protocol Code
86 0x40, ///bMaxPacketSize0: Maximum size of endpoint 0
87 0x83, ///idVendor: Vendor ID
88 0x04, ///idVendor: Vendor ID
89 0x40, ///idProduct: Product ID
90 0x57, ///idProduct: Product ID
91 0x00, ///bcdDevice: Release Number
92 0x02, ///bcdDevice: Release Number
93 0x01, ///iManufacture: String-Index of Manufacture
94 0x02, ///iProduct: String-Index of Product
95 0x03, ///iSerialNumber: String-Index of Serial Number
96 0x01 ///bNumConfigurations: Number of possible configurations
97};
98
99const uint8_t au8ConfigDescriptor[53] =
100{ ///NEW CONFIG DESCRIPTOR(1)
101 0x09, ///bLength: Length of this descriptor
102 0x02, ///bDescriptorType: Config Descriptor Type
103 0x35, ///wTotalLength: Total Length with all interface- and endpoint descriptors
104 0x00, ///wTotalLength: Total Length with all interface- and endpoint descriptors
105 0x02, ///bNumInterfaces: Number of interfaces
106 0x01, ///iConfigurationValue: Number of this configuration
107 0x00, ///iConfiguration: String index of this configuration
108 0xC0, ///bmAttributes: Bus-Powered, Remote-Wakeup not supported
109 0xFA, ///MaxPower: (in 2mA)
110 ///NEW INTERFACE DESCRIPTOR(0)
111 0x09, ///bLength: Length of this descriptor
112 0x04, ///bDescriptorType: Interface Descriptor Type
113 0x00, ///bInterfaceNumber: Interface Number
114 0x00, ///bAlternateSetting: Alternate setting for this interface
115 0x01, ///bNumEndpoints: Number of endpoints in this interface excluding endpoint 0
116 0x02, ///iInterfaceClass: Class Code: COMMUNICATIONS_AND_CDC_CONTROL
117 0x02, ///iInterfaceSubClass: SubClass Code
118 0x01, ///bInterfaceProtocol: Protocol Code
119 0x00, ///iInterface: String index
120 ///NEW FUNCTION DESCRIPTOR(0)
121 0x05, ///bLength: Length of this descriptor
122 0x24, ///bDescriptorType: Class Specific Interface Descriptor Type
123 0x06, ///bDescriptorSubtype: Union Functional descriptor
124 0x00, ///Master Interface (Control)
125 0x01, ///Slave Interface (Data)
126 ///NEW ENDPOINT DESCRIPTOR(1)
127 0x07, ///bLength: Length of this descriptor
128 0x05, ///bDescriptorType: Endpoint Descriptor Type
129 0x82, ///bEndpointAddress: Endpoint address (IN,EP2)
130 0x03, ///bmAttributes: Transfer Type: INTERRUPT_TRANSFER
131 0x40, ///wMaxPacketSize: Endpoint Size
132 0x00, ///wMaxPacketSize: Endpoint Size
133 0xFF, ///bIntervall: Polling Intervall
134 ///NEW INTERFACE DESCRIPTOR(1)
135 0x09, ///bLength: Length of this descriptor
136 0x04, ///bDescriptorType: Interface Descriptor Type
137 0x01, ///bInterfaceNumber: Interface Number
138 0x00, ///bAlternateSetting: Alternate setting for this interface
139 0x02, ///bNumEndpoints: Number of endpoints in this interface excluding endpoint 0
140 0x0A, ///iInterfaceClass: Class Code: CDC_DATA
141 0x00, ///iInterfaceSubClass: SubClass Code
142 0x00, ///bInterfaceProtocol: Protocol Code
143 0x00, ///iInterface: String index
144 ///NEW ENDPOINT DESCRIPTOR(0)
145 0x07, ///bLength: Length of this descriptor
146 0x05, ///bDescriptorType: Endpoint Descriptor Type
147 0x03, ///bEndpointAddress: Endpoint address (OUT,EP3)
148 0x02, ///bmAttributes: Transfer Type: BULK_TRANSFER
149 0x40, ///wMaxPacketSize: Endpoint Size
150 0x00, ///wMaxPacketSize: Endpoint Size
151 0x00, ///bIntervall: Polling Intervall
152 ///NEW ENDPOINT DESCRIPTOR(1)
153 0x07, ///bLength: Length of this descriptor
154 0x05, ///bDescriptorType: Endpoint Descriptor Type
155 0x81, ///bEndpointAddress: Endpoint address (IN,EP1)
156 0x02, ///bmAttributes: Transfer Type: BULK_TRANSFER
157 0x40, ///wMaxPacketSize: Endpoint Size
158 0x00, ///wMaxPacketSize: Endpoint Size
159 0x00 ///bIntervall: Polling Intervall
160};
161
162const uint8_t au8ReportDescriptor0[1] = { 0 }; // Not used
163const uint8_t au8ReportDescriptor1[1] = { 0 }; // Not used
164const uint8_t au8ReportDescriptor2[1] = { 0 }; // Not used
165
166
167const stc_usbdevice_stringdescriptor_t pstcStringDescriptors[] =
168{
169{(uint8_t*)"Spansion International Inc.",NULL}, //Manufacturer String
170{(uint8_t*)"rusEFI ECU Comm Port",NULL}, //Product String
171{(uint8_t*)"1.0",NULL}, //Serial Number String
172};
173
174
175const stc_usbdevice_reportdescriptor_t astcReportDescriptors[3] =
176{
177 {(uint8_t*)au8ReportDescriptor0,sizeof(au8ReportDescriptor0)},
178 {(uint8_t*)au8ReportDescriptor1,sizeof(au8ReportDescriptor1)},
179 {(uint8_t*)au8ReportDescriptor2,sizeof(au8ReportDescriptor2)},
180};
181
182/*****************************************************************************/
183/* Global function prototypes ('extern', definition in C source) */
184/*****************************************************************************/
185
186
187
188
189
190#endif /* __USBDESCRIPTORS_H__ */
const uint8_t au8ReportDescriptor0[1]
const uint8_t au8ConfigDescriptor[53]
const stc_usbdevice_stringdescriptor_t pstcStringDescriptors[]
const stc_usbdevice_reportdescriptor_t astcReportDescriptors[3]
const uint8_t au8ReportDescriptor2[1]
const uint8_t au8DeviceDescriptor[18]
const uint8_t au8ReportDescriptor1[1]