Subversion Repositories NaviCtrl

Rev

Rev 1 | Rev 43 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1 Rev 41
1
/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
1
/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
2
* File Name          : usb_desc.c
2
* File Name          : usb_desc.c
3
* Author             : MCD Application Team
3
* Author             : MCD Application Team
4
* Date First Issued  : 10/01/2006 : V1.0
4
* Date First Issued  : 10/01/2006 : V1.0
5
* Description        : Descriptors for Virtual Com Port Demo
5
* Description        : Descriptors for Virtual Com Port Demo
6
********************************************************************************
6
********************************************************************************
7
* History:
7
* History:
8
* 10/01/2006 : V1.0
8
* 10/01/2006 : V1.0
9
********************************************************************************
9
********************************************************************************
10
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
10
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
11
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
11
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
12
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
12
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
13
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
13
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
14
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
14
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
15
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
15
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
16
*******************************************************************************/
16
*******************************************************************************/
17
/* Includes ------------------------------------------------------------------*/
17
/* Includes ------------------------------------------------------------------*/
18
#include "main.h"
18
#include "usb_lib.h"
-
 
19
#include "usb_desc.h"
19
/* Private typedef -----------------------------------------------------------*/
20
/* Private typedef -----------------------------------------------------------*/
20
/* Private define ------------------------------------------------------------*/
21
/* Private define ------------------------------------------------------------*/
21
/* Private macro -------------------------------------------------------------*/
22
/* Private macro -------------------------------------------------------------*/
22
/* Private variables ---------------------------------------------------------*/
23
/* Private variables ---------------------------------------------------------*/
23
/* Extern variables ----------------------------------------------------------*/
24
/* Extern  variables ---------------------------------------------------------*/
24
/* Private function prototypes -----------------------------------------------*/
25
/* Private function prototypes -----------------------------------------------*/
25
/* Private functions ---------------------------------------------------------*/
26
/* Private functions ---------------------------------------------------------*/
26
/* USB Standard Device Descriptor */
27
/* USB Standard Device Descriptor */
27
const u8 Virtual_Com_Port_DeviceDescriptor[] = {
28
const u8 Virtual_Com_Port_DeviceDescriptor[] = {
28
        0x12,   /* bLength */
29
        0x12,   /* bLength */
29
        USB_DEVICE_DESCRIPTOR_TYPE,     /* bDescriptorType */
30
        USB_DEVICE_DESCRIPTOR_TYPE,     /* bDescriptorType */
30
        0x00,
31
        0x00,
31
        0x02,   /* bcdUSB = 2.00 */
32
        0x02,   /* bcdUSB = 2.00 */
32
        0x02,   /* bDeviceClass: CDC */
33
        0x02,   /* bDeviceClass: CDC */
33
        0x00,   /* bDeviceSubClass */
34
        0x00,   /* bDeviceSubClass */
34
        0x00,   /* bDeviceProtocol */
35
        0x00,   /* bDeviceProtocol */
35
        0x40,   /* bMaxPacketSize0 */
36
        0x40,   /* bMaxPacketSize0 */
36
        0x83,
37
        0x83,
37
        0x04,   /* idVendor = 0x0483 */
38
        0x04,   /* idVendor = 0x0483 */
38
        0x40,
39
        0x40,
39
        0x57,   /* idProduct = 0x7540 */
40
        0x57,   /* idProduct = 0x7540 */
40
        0x00,
41
        0x00,
41
        0x01,   /* bcdDevice = 1.00 */
42
        0x01,   /* bcdDevice = 1.00 */
42
        1,              /* Index of string descriptor describing manufacturer */
43
        1,              /* Index of string descriptor describing manufacturer */
43
        2,              /* Index of string descriptor describing product */
44
        2,              /* Index of string descriptor describing product */
44
        3,              /* Index of string descriptor describing the device's serial number */
45
        3,              /* Index of string descriptor describing the device's serial number */
45
        0x01    /* bNumConfigurations */
46
        0x01    /* bNumConfigurations */
46
};
47
};
47
 
48
 
48
 
49
 
49
const u8 Virtual_Com_Port_ConfigDescriptor[] = {
50
const u8 Virtual_Com_Port_ConfigDescriptor[] = {
50
/*Configuation Descriptor*/
51
/*Configuation Descriptor*/
51
        0x09,   /* bLength: Configuation Descriptor size */
52
        0x09,   /* bLength: Configuation Descriptor size */
52
        USB_CONFIGURATION_DESCRIPTOR_TYPE,      /* bDescriptorType: Configuration */
53
        USB_CONFIGURATION_DESCRIPTOR_TYPE,      /* bDescriptorType: Configuration */
53
        VIRTUAL_COM_PORT_SIZ_CONFIG_DESC,       /* wTotalLength:no of returned bytes */
54
        VIRTUAL_COM_PORT_SIZ_CONFIG_DESC,       /* wTotalLength:no of returned bytes */
54
        0x00,
55
        0x00,
55
        0x02,   /* bNumInterfaces: 2 interface */
56
        0x02,   /* bNumInterfaces: 2 interface */
56
        0x01,   /* bConfigurationValue: Configuration value */
57
        0x01,   /* bConfigurationValue: Configuration value */
57
        0x00,   /* iConfiguration: Index of string descriptor describing the configuration */
58
        0x00,   /* iConfiguration: Index of string descriptor describing the configuration */
58
        0xC0,   /* bmAttributes: self powered */
59
        0xC0,   /* bmAttributes: self powered */
59
        0x00,   /* MaxPower 0 mA */
60
        0x00,   /* MaxPower 0 mA */
60
/*Interface Descriptor*/
61
/*Interface Descriptor*/
61
        0x09,   /* bLength: Interface Descriptor size */
62
        0x09,   /* bLength: Interface Descriptor size */
62
        USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: Interface */
63
        USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: Interface */
63
                        /* Interface descriptor type */
64
                        /* Interface descriptor type */
64
        0x00,   /* bInterfaceNumber: Number of Interface */
65
        0x00,   /* bInterfaceNumber: Number of Interface */
65
        0x00,   /* bAlternateSetting: Alternate setting */
66
        0x00,   /* bAlternateSetting: Alternate setting */
66
        0x01,   /* bNumEndpoints: One endpoints used */
67
        0x01,   /* bNumEndpoints: One endpoints used */
67
        0x02,   /* bInterfaceClass: Communication Interface Class */
68
        0x02,   /* bInterfaceClass: Communication Interface Class */
68
        0x02,   /* bInterfaceSubClass: Abstract Control Model */
69
        0x02,   /* bInterfaceSubClass: Abstract Control Model */
69
        0x01,   /* bInterfaceProtocol: Common AT commands */
70
        0x01,   /* bInterfaceProtocol: Common AT commands */
70
        0x00,   /* iInterface: */
71
        0x00,   /* iInterface: */
71
/*Header Functional Descriptor*/
72
/*Header Functional Descriptor*/
72
        0x05,   /* bLength: Endpoint Descriptor size */
73
        0x05,   /* bLength: Endpoint Descriptor size */
73
        0x24,   /* bDescriptorType: CS_INTERFACE */
74
        0x24,   /* bDescriptorType: CS_INTERFACE */
74
        0x00,   /* bDescriptorSubtype: Header Func Desc */
75
        0x00,   /* bDescriptorSubtype: Header Func Desc */
75
        0x10,   /* bcdCDC: spec release number */
76
        0x10,   /* bcdCDC: spec release number */
76
        0x01,
77
        0x01,
77
/*Call Managment Functional Descriptor*/
78
/*Call Managment Functional Descriptor*/
78
        0x05,   /* bFunctionLength */
79
        0x05,   /* bFunctionLength */
79
        0x24,   /* bDescriptorType: CS_INTERFACE */
80
        0x24,   /* bDescriptorType: CS_INTERFACE */
80
        0x01,   /* bDescriptorSubtype: Call Management Func Desc */
81
        0x01,   /* bDescriptorSubtype: Call Management Func Desc */
81
        0x00,   /* bmCapabilities: D0+D1 */
82
        0x00,   /* bmCapabilities: D0+D1 */
82
        0x01,   /* bDataInterface: 1 */
83
        0x01,   /* bDataInterface: 1 */
83
/*ACM Functional Descriptor*/
84
/*ACM Functional Descriptor*/
84
        0x04,   /* bFunctionLength */
85
        0x04,   /* bFunctionLength */
85
        0x24,   /* bDescriptorType: CS_INTERFACE */
86
        0x24,   /* bDescriptorType: CS_INTERFACE */
86
        0x02,   /* bDescriptorSubtype: Abstract Control Management desc */
87
        0x02,   /* bDescriptorSubtype: Abstract Control Management desc */
87
        0x02,   /* bmCapabilities */
88
        0x02,   /* bmCapabilities */
88
/*Union Functional Descriptor*/
89
/*Union Functional Descriptor*/
89
        0x05,   /* bFunctionLength */
90
        0x05,   /* bFunctionLength */
90
        0x24,   /* bDescriptorType: CS_INTERFACE */
91
        0x24,   /* bDescriptorType: CS_INTERFACE */
91
        0x06,   /* bDescriptorSubtype: Union func desc */
92
        0x06,   /* bDescriptorSubtype: Union func desc */
92
        0x00,   /* bMasterInterface: Communication class interface */
93
        0x00,   /* bMasterInterface: Communication class interface */
93
        0x01,   /* bSlaveInterface0: Data Class Interface */
94
        0x01,   /* bSlaveInterface0: Data Class Interface */
94
/*Endpoint 2 Descriptor*/
95
/*Endpoint 2 Descriptor*/
95
        0x07,   /* bLength: Endpoint Descriptor size */
96
        0x07,   /* bLength: Endpoint Descriptor size */
96
        USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */
97
        USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */
97
        0x82,   /* bEndpointAddress: (IN2) */
98
        0x82,   /* bEndpointAddress: (IN2) */
98
        0x03,   /* bmAttributes: Interrupt */
99
        0x03,   /* bmAttributes: Interrupt */
99
        VIRTUAL_COM_PORT_INT_SIZE,      /* wMaxPacketSize: */
100
        VIRTUAL_COM_PORT_INT_SIZE,      /* wMaxPacketSize: */
100
        0x00,
101
        0x00,
101
        0xFF,   /* bInterval: */
102
        0xFF,   /* bInterval: */
102
/*Data class interface descriptor*/
103
/*Data class interface descriptor*/
103
        0x09,   /* bLength: Endpoint Descriptor size */
104
        0x09,   /* bLength: Endpoint Descriptor size */
104
        USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: */
105
        USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: */
105
        0x01,   /* bInterfaceNumber: Number of Interface */
106
        0x01,   /* bInterfaceNumber: Number of Interface */
106
        0x00,   /* bAlternateSetting: Alternate setting */
107
        0x00,   /* bAlternateSetting: Alternate setting */
107
        0x02,   /* bNumEndpoints: Two endpoints used */
108
        0x02,   /* bNumEndpoints: Two endpoints used */
108
        0x0A,   /* bInterfaceClass: CDC */
109
        0x0A,   /* bInterfaceClass: CDC */
109
        0x00,   /* bInterfaceSubClass: */
110
        0x00,   /* bInterfaceSubClass: */
110
        0x00,   /* bInterfaceProtocol: */
111
        0x00,   /* bInterfaceProtocol: */
111
        0x00,   /* iInterface: */
112
        0x00,   /* iInterface: */
112
/*Endpoint 3 Descriptor*/
113
/*Endpoint 3 Descriptor*/
113
        0x07,   /* bLength: Endpoint Descriptor size */
114
        0x07,   /* bLength: Endpoint Descriptor size */
114
        USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */
115
        USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */
115
        0x03,   /* bEndpointAddress: (OUT3) */
116
        0x03,   /* bEndpointAddress: (OUT3) */
116
        0x02,   /* bmAttributes: Bulk */
117
        0x02,   /* bmAttributes: Bulk */
117
        VIRTUAL_COM_PORT_DATA_SIZE,             /* wMaxPacketSize: */
118
        VIRTUAL_COM_PORT_DATA_SIZE,             /* wMaxPacketSize: */
118
        0x00,
119
        0x00,
119
        0x00,   /* bInterval: ignore for Bulk transfer */
120
        0x00,   /* bInterval: ignore for Bulk transfer */
120
/*Endpoint 1 Descriptor*/
121
/*Endpoint 1 Descriptor*/
121
        0x07,   /* bLength: Endpoint Descriptor size */
122
        0x07,   /* bLength: Endpoint Descriptor size */
122
        USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */
123
        USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */
123
        0x81,   /* bEndpointAddress: (IN1) */
124
        0x81,   /* bEndpointAddress: (IN1) */
124
        0x02,   /* bmAttributes: Bulk */
125
        0x02,   /* bmAttributes: Bulk */
125
        VIRTUAL_COM_PORT_DATA_SIZE,             /* wMaxPacketSize: */
126
        VIRTUAL_COM_PORT_DATA_SIZE,             /* wMaxPacketSize: */
126
        0x00,
127
        0x00,
127
        0x00    /* bInterval */
128
        0x00    /* bInterval */
128
};
129
};
129
 
130
 
130
/* USB String Descriptors*/
131
/* USB String Descriptors*/
131
const u8 Virtual_Com_Port_StringLangID[VIRTUAL_COM_PORT_SIZ_STRING_LANGID] = {
132
const u8 Virtual_Com_Port_StringLangID[VIRTUAL_COM_PORT_SIZ_STRING_LANGID] = {
132
        VIRTUAL_COM_PORT_SIZ_STRING_LANGID,
133
        VIRTUAL_COM_PORT_SIZ_STRING_LANGID,
133
        USB_STRING_DESCRIPTOR_TYPE,
134
        USB_STRING_DESCRIPTOR_TYPE,
134
        0x09,
135
        0x09,
135
        0x04
136
        0x04
136
};      /* LangID = 0x0409: U.S. English */
137
};      /* LangID = 0x0409: U.S. English */
137
 
138
 
138
const u8 Virtual_Com_Port_StringVendor[VIRTUAL_COM_PORT_SIZ_STRING_VENDOR] = {
139
const u8 Virtual_Com_Port_StringVendor[VIRTUAL_COM_PORT_SIZ_STRING_VENDOR] = {
139
        VIRTUAL_COM_PORT_SIZ_STRING_VENDOR,     /* Size of Vendor string */
140
        VIRTUAL_COM_PORT_SIZ_STRING_VENDOR,     /* Size of Vendor string */
140
        USB_STRING_DESCRIPTOR_TYPE,             /* bDescriptorType*/
141
        USB_STRING_DESCRIPTOR_TYPE,             /* bDescriptorType*/
141
        /* Manufacturer: "STMicroelectronics" */
142
        /* Manufacturer: "STMicroelectronics" */
142
        'w',0, 'w',0, 'w',0, '.',0, 'M',0, 'i',0, 'k',0, 'r',0,
143
        'w',0, 'w',0, 'w',0, '.',0, 'M',0, 'i',0, 'k',0, 'r',0,
143
        'o',0, 'K',0, 'o',0, 'p',0, 't',0, 'e',0, 'r',0, '.',0,
144
        'o',0, 'K',0, 'o',0, 'p',0, 't',0, 'e',0, 'r',0, '.',0,
144
        'd',0, 'e',0
145
        'd',0, 'e',0
145
};
146
};
146
 
147
 
147
const u8 Virtual_Com_Port_StringProduct[VIRTUAL_COM_PORT_SIZ_STRING_PRODUCT] = {
148
const u8 Virtual_Com_Port_StringProduct[VIRTUAL_COM_PORT_SIZ_STRING_PRODUCT] = {
148
        VIRTUAL_COM_PORT_SIZ_STRING_PRODUCT,          /* bLength */
149
        VIRTUAL_COM_PORT_SIZ_STRING_PRODUCT,          /* bLength */
149
        USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
150
        USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
150
        /* Product name: "STR91x Virtual COM Port" */
151
        /* Product name: "STR91x Virtual COM Port" */
151
     'M',0, 'i',0, 'k',0, 'r',0,'o',0, 'K',0, 'o',0, 'p',0, 't',0, 'e',0, 'r',0,
152
     'M',0, 'i',0, 'k',0, 'r',0,'o',0, 'K',0, 'o',0, 'p',0, 't',0, 'e',0, 'r',0,
152
         ' ',0, 'V',0,  'i',0, 'r',0, 't',0, 'u',0, 'a',0, 'l',0, ' ',0,
153
         ' ',0, 'V',0,  'i',0, 'r',0, 't',0, 'u',0, 'a',0, 'l',0, ' ',0,
153
         'C',0, 'O',0, 'M',0, ' ',0, 'P',0, 'o',0, 'r',0, 't',0, ' ',0,
154
         'C',0, 'O',0, 'M',0, ' ',0, 'P',0, 'o',0, 'r',0, 't',0, ' ',0,
154
};
155
};
155
const u8 Virtual_Com_Port_StringSerial[VIRTUAL_COM_PORT_SIZ_STRING_SERIAL] = {
156
const u8 Virtual_Com_Port_StringSerial[VIRTUAL_COM_PORT_SIZ_STRING_SERIAL] = {
156
        VIRTUAL_COM_PORT_SIZ_STRING_SERIAL,           /* bLength */
157
        VIRTUAL_COM_PORT_SIZ_STRING_SERIAL,           /* bLength */
157
        USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
158
        USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
158
        'M',0, 'K',0, ' ',0, ' ',0, ' ',0, '1',0, '.',0, '0',0,
159
        'M',0, 'K',0, ' ',0, ' ',0, ' ',0, '1',0, '.',0, '0',0,
159
        '0',0, '0',0
160
        '0',0, '0',0
160
};
161
};
161
/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
162
/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
162
 
163
 
163
 
164