Subversion Repositories NaviCtrl

Rev

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

Rev 41 Rev 275
1
/******************** (C) COPYRIGHT 2006 STMicroelectronics ********************
1
/******************** (C) COPYRIGHT 2008 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/2008 : 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/2008 : 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 "usb_lib.h"
18
#include "usb_lib.h"
19
#include "usb_desc.h"
19
#include "usb_desc.h"
20
/* Private typedef -----------------------------------------------------------*/
20
/* Private typedef -----------------------------------------------------------*/
21
/* Private define ------------------------------------------------------------*/
21
/* Private define ------------------------------------------------------------*/
22
/* Private macro -------------------------------------------------------------*/
22
/* Private macro -------------------------------------------------------------*/
23
/* Private variables ---------------------------------------------------------*/
23
/* Private variables ---------------------------------------------------------*/
24
/* Extern  variables ---------------------------------------------------------*/
24
/* Extern variables ----------------------------------------------------------*/
25
/* Private function prototypes -----------------------------------------------*/
25
/* Private function prototypes -----------------------------------------------*/
26
/* Private functions ---------------------------------------------------------*/
26
/* Private functions ---------------------------------------------------------*/
27
/* USB Standard Device Descriptor */
27
/* USB Standard Device Descriptor */
28
const u8 Virtual_Com_Port_DeviceDescriptor[] = {
28
const u8 Virtual_Com_Port_DeviceDescriptor[] =
-
 
29
  {
29
        0x12,   /* bLength */
30
    0x12, /* bLength */
30
        USB_DEVICE_DESCRIPTOR_TYPE,     /* bDescriptorType */
31
    USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */
31
        0x00,
32
    0x00,
32
        0x02,   /* bcdUSB = 2.00 */
33
    0x02, /* bcdUSB = 2.00 */
33
        0x02,   /* bDeviceClass: CDC */
34
    0x02, /* bDeviceClass: CDC */
34
        0x00,   /* bDeviceSubClass */
35
    0x00, /* bDeviceSubClass */
35
        0x00,   /* bDeviceProtocol */
36
    0x00, /* bDeviceProtocol */
36
        0x40,   /* bMaxPacketSize0 */
37
    0x40, /* bMaxPacketSize0 */
37
        0x83,
38
    0x83,
38
        0x04,   /* idVendor = 0x0483 */
39
    0x04, /* idVendor = 0x0483 */
39
        0x40,
40
    0x40,
40
        0x57,   /* idProduct = 0x7540 */
41
    0x57, /* idProduct = 0x7540 */
-
 
42
    0x00,          /* 2.00 */             /* bcdDevice */
41
        0x00,
43
    0x02,
42
        0x01,   /* bcdDevice = 1.00 */
-
 
43
        1,              /* Index of string descriptor describing manufacturer */
44
    1,  /* Index of string descriptor describing manufacturer */
44
        2,              /* Index of string descriptor describing product */
45
    2,  /* Index of string descriptor describing product */
45
        3,              /* Index of string descriptor describing the device's serial number */
46
    3,  /* Index of string descriptor describing the device's serial number */
46
        0x01    /* bNumConfigurations */
47
    0x01 /* bNumConfigurations */
47
};
48
  };
48
 
49
 
49
 
50
 
-
 
51
const u8 Virtual_Com_Port_ConfigDescriptor[] =
50
const u8 Virtual_Com_Port_ConfigDescriptor[] = {
52
  {
51
/*Configuation Descriptor*/
53
    /*Configuation Descriptor*/
52
        0x09,   /* bLength: Configuation Descriptor size */
54
    0x09, /* bLength: Configuation Descriptor size */
53
        USB_CONFIGURATION_DESCRIPTOR_TYPE,      /* bDescriptorType: Configuration */
55
    USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType: Configuration */
54
        VIRTUAL_COM_PORT_SIZ_CONFIG_DESC,       /* wTotalLength:no of returned bytes */
56
    VIRTUAL_COM_PORT_SIZ_CONFIG_DESC, /* wTotalLength:no of returned bytes */
55
        0x00,
57
    0x00,
56
        0x02,   /* bNumInterfaces: 2 interface */
58
    0x02, /* bNumInterfaces: 2 interface */
57
        0x01,   /* bConfigurationValue: Configuration value */
59
    0x01, /* bConfigurationValue: Configuration value */
58
        0x00,   /* iConfiguration: Index of string descriptor describing the configuration */
60
    0x00, /* iConfiguration: Index of string descriptor describing the configuration */
59
        0xC0,   /* bmAttributes: self powered */
61
    0xC0, /* bmAttributes: self powered */
60
        0x00,   /* MaxPower 0 mA */
62
    0x00, /* MaxPower 0 mA */
61
/*Interface Descriptor*/
63
    /*Interface Descriptor*/
62
        0x09,   /* bLength: Interface Descriptor size */
64
    0x09, /* bLength: Interface Descriptor size */
63
        USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: Interface */
65
    USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType: Interface */
64
                        /* Interface descriptor type */
66
    /* Interface descriptor type */
65
        0x00,   /* bInterfaceNumber: Number of Interface */
67
    0x00, /* bInterfaceNumber: Number of Interface */
66
        0x00,   /* bAlternateSetting: Alternate setting */
68
    0x00, /* bAlternateSetting: Alternate setting */
67
        0x01,   /* bNumEndpoints: One endpoints used */
69
    0x01, /* bNumEndpoints: One endpoints used */
68
        0x02,   /* bInterfaceClass: Communication Interface Class */
70
    0x02, /* bInterfaceClass: Communication Interface Class */
69
        0x02,   /* bInterfaceSubClass: Abstract Control Model */
71
    0x02, /* bInterfaceSubClass: Abstract Control Model */
70
        0x01,   /* bInterfaceProtocol: Common AT commands */
72
    0x01, /* bInterfaceProtocol: Common AT commands */
71
        0x00,   /* iInterface: */
73
    0x00, /* iInterface: */
72
/*Header Functional Descriptor*/
74
    /*Header Functional Descriptor*/
73
        0x05,   /* bLength: Endpoint Descriptor size */
75
    0x05, /* bLength: Endpoint Descriptor size */
74
        0x24,   /* bDescriptorType: CS_INTERFACE */
76
    0x24, /* bDescriptorType: CS_INTERFACE */
75
        0x00,   /* bDescriptorSubtype: Header Func Desc */
77
    0x00, /* bDescriptorSubtype: Header Func Desc */
76
        0x10,   /* bcdCDC: spec release number */
78
    0x10, /* bcdCDC: spec release number */
77
        0x01,
79
    0x01,
78
/*Call Managment Functional Descriptor*/
80
    /*Call Managment Functional Descriptor*/
79
        0x05,   /* bFunctionLength */
81
    0x05, /* bFunctionLength */
80
        0x24,   /* bDescriptorType: CS_INTERFACE */
82
    0x24, /* bDescriptorType: CS_INTERFACE */
81
        0x01,   /* bDescriptorSubtype: Call Management Func Desc */
83
    0x01, /* bDescriptorSubtype: Call Management Func Desc */
82
        0x00,   /* bmCapabilities: D0+D1 */
84
    0x00, /* bmCapabilities: D0+D1 */
83
        0x01,   /* bDataInterface: 1 */
85
    0x01, /* bDataInterface: 1 */
84
/*ACM Functional Descriptor*/
86
    /*ACM Functional Descriptor*/
85
        0x04,   /* bFunctionLength */
87
    0x04, /* bFunctionLength */
86
        0x24,   /* bDescriptorType: CS_INTERFACE */
88
    0x24, /* bDescriptorType: CS_INTERFACE */
87
        0x02,   /* bDescriptorSubtype: Abstract Control Management desc */
89
    0x02, /* bDescriptorSubtype: Abstract Control Management desc */
88
        0x02,   /* bmCapabilities */
90
    0x02, /* bmCapabilities */
89
/*Union Functional Descriptor*/
91
    /*Union Functional Descriptor*/
90
        0x05,   /* bFunctionLength */
92
    0x05, /* bFunctionLength */
91
        0x24,   /* bDescriptorType: CS_INTERFACE */
93
    0x24, /* bDescriptorType: CS_INTERFACE */
92
        0x06,   /* bDescriptorSubtype: Union func desc */
94
    0x06, /* bDescriptorSubtype: Union func desc */
93
        0x00,   /* bMasterInterface: Communication class interface */
95
    0x00, /* bMasterInterface: Communication class interface */
94
        0x01,   /* bSlaveInterface0: Data Class Interface */
96
    0x01, /* bSlaveInterface0: Data Class Interface */
95
/*Endpoint 2 Descriptor*/
97
    /*Endpoint 2 Descriptor*/
96
        0x07,   /* bLength: Endpoint Descriptor size */
98
    0x07,  /* bLength: Endpoint Descriptor size */
97
        USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */
99
    USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */
98
        0x82,   /* bEndpointAddress: (IN2) */
100
    0x82, /* bEndpointAddress: (IN2) */
99
        0x03,   /* bmAttributes: Interrupt */
101
    0x03, /* bmAttributes: Interrupt */
100
        VIRTUAL_COM_PORT_INT_SIZE,      /* wMaxPacketSize: */
102
    VIRTUAL_COM_PORT_INT_SIZE, /* wMaxPacketSize: */
101
        0x00,
103
    0x00,
102
        0xFF,   /* bInterval: */
104
    0xFF, /* bInterval: */
103
/*Data class interface descriptor*/
105
    /*Data class interface descriptor*/
104
        0x09,   /* bLength: Endpoint Descriptor size */
106
    0x09,  /* bLength: Endpoint Descriptor size */
105
        USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: */
107
    USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType: */
106
        0x01,   /* bInterfaceNumber: Number of Interface */
108
    0x01, /* bInterfaceNumber: Number of Interface */
107
        0x00,   /* bAlternateSetting: Alternate setting */
109
    0x00, /* bAlternateSetting: Alternate setting */
108
        0x02,   /* bNumEndpoints: Two endpoints used */
110
    0x02, /* bNumEndpoints: Two endpoints used */
109
        0x0A,   /* bInterfaceClass: CDC */
111
    0x0A, /* bInterfaceClass: CDC */
110
        0x00,   /* bInterfaceSubClass: */
112
    0x00, /* bInterfaceSubClass: */
111
        0x00,   /* bInterfaceProtocol: */
113
    0x00, /* bInterfaceProtocol: */
112
        0x00,   /* iInterface: */
114
    0x00, /* iInterface: */
113
/*Endpoint 3 Descriptor*/
115
    /*Endpoint 3 Descriptor*/
114
        0x07,   /* bLength: Endpoint Descriptor size */
116
    0x07,  /* bLength: Endpoint Descriptor size */
115
        USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */
117
    USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */
116
        0x03,   /* bEndpointAddress: (OUT3) */
118
    0x03, /* bEndpointAddress: (OUT3) */
117
        0x02,   /* bmAttributes: Bulk */
119
    0x02, /* bmAttributes: Bulk */
118
        VIRTUAL_COM_PORT_DATA_SIZE,             /* wMaxPacketSize: */
120
    VIRTUAL_COM_PORT_DATA_SIZE,  /* wMaxPacketSize: */
119
        0x00,
121
    0x00,
120
        0x00,   /* bInterval: ignore for Bulk transfer */
122
    0x00,  /* bInterval: ignore for Bulk transfer */
121
/*Endpoint 1 Descriptor*/
123
    /*Endpoint 1 Descriptor*/
122
        0x07,   /* bLength: Endpoint Descriptor size */
124
    0x07,  /* bLength: Endpoint Descriptor size */
123
        USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */
125
    USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */
124
        0x81,   /* bEndpointAddress: (IN1) */
126
    0x81, /* bEndpointAddress: (IN1) */
125
        0x02,   /* bmAttributes: Bulk */
127
    0x02, /* bmAttributes: Bulk */
126
        VIRTUAL_COM_PORT_DATA_SIZE,             /* wMaxPacketSize: */
128
    VIRTUAL_COM_PORT_DATA_SIZE,  /* wMaxPacketSize: */
127
        0x00,
129
    0x00,
128
        0x00    /* bInterval */
130
    0x00  /* bInterval */
129
};
131
  };
130
 
132
 
131
/* USB String Descriptors*/
133
/* USB String Descriptors*/
132
const u8 Virtual_Com_Port_StringLangID[VIRTUAL_COM_PORT_SIZ_STRING_LANGID] = {
134
const u8 Virtual_Com_Port_StringLangID[VIRTUAL_COM_PORT_SIZ_STRING_LANGID] =
-
 
135
  {
133
        VIRTUAL_COM_PORT_SIZ_STRING_LANGID,
136
    VIRTUAL_COM_PORT_SIZ_STRING_LANGID,
134
        USB_STRING_DESCRIPTOR_TYPE,
137
    USB_STRING_DESCRIPTOR_TYPE,
135
        0x09,
138
    0x09,
136
        0x04
139
    0x04
-
 
140
  }
137
};      /* LangID = 0x0409: U.S. English */
141
  ; /* LangID = 0x0409: U.S. English */
138
 
142
 
-
 
143
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] = {
144
  {
140
        VIRTUAL_COM_PORT_SIZ_STRING_VENDOR,     /* Size of Vendor string */
145
    VIRTUAL_COM_PORT_SIZ_STRING_VENDOR, /* Size of Vendor string */
141
        USB_STRING_DESCRIPTOR_TYPE,             /* bDescriptorType*/
146
    USB_STRING_DESCRIPTOR_TYPE,  /* bDescriptorType*/
142
        /* Manufacturer: "STMicroelectronics" */
147
    /* Manufacturer: "STMicroelectronics" */
143
        'w',0, 'w',0, 'w',0, '.',0, 'M',0, 'i',0, 'k',0, 'r',0,
148
        'w',0, 'w',0, 'w',0, '.',0, 'M',0, 'i',0, 'k',0, 'r',0,
144
        'o',0, 'K',0, 'o',0, 'p',0, 't',0, 'e',0, 'r',0, '.',0,
149
        'o',0, 'K',0, 'o',0, 'p',0, 't',0, 'e',0, 'r',0, '.',0,
145
        'd',0, 'e',0
150
        'd',0, 'e',0
146
};
151
  };
147
 
152
 
-
 
153
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] = {
154
  {
149
        VIRTUAL_COM_PORT_SIZ_STRING_PRODUCT,          /* bLength */
155
    VIRTUAL_COM_PORT_SIZ_STRING_PRODUCT,          /* bLength */
150
        USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
156
    USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
151
        /* Product name: "STR91x Virtual COM Port" */
157
    /* Product name: "STR91x Virtual COM Port" */
152
     'M',0, 'i',0, 'k',0, 'r',0,'o',0, 'K',0, 'o',0, 'p',0, 't',0, 'e',0, 'r',0,
158
        'M',0, 'i',0, 'k',0, 'r',0,'o',0, 'K',0, 'o',0, 'p',0, 't',0, 'e',0, 'r',0,
153
         ' ',0, 'V',0,  'i',0, 'r',0, 't',0, 'u',0, 'a',0, 'l',0, ' ',0,
159
        ' ',0, 'V',0,   'i',0, 'r',0, 't',0, 'u',0, 'a',0, 'l',0, ' ',0,
154
         'C',0, 'O',0, 'M',0, ' ',0, 'P',0, 'o',0, 'r',0, 't',0, ' ',0,
160
        'C',0, 'O',0, 'M',0, ' ',0, 'P',0, 'o',0, 'r',0, 't',0, ' ',0, 
-
 
161
 
155
};
162
  };
156
const u8 Virtual_Com_Port_StringSerial[VIRTUAL_COM_PORT_SIZ_STRING_SERIAL] = {
163
const u8 Virtual_Com_Port_StringSerial[VIRTUAL_COM_PORT_SIZ_STRING_SERIAL] =
-
 
164
  {
157
        VIRTUAL_COM_PORT_SIZ_STRING_SERIAL,           /* bLength */
165
    VIRTUAL_COM_PORT_SIZ_STRING_SERIAL,           /* bLength */
158
        USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
166
    USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */
159
        'M',0, 'K',0, ' ',0, ' ',0, ' ',0, '1',0, '.',0, '0',0,
167
        'M',0, 'K',0, ' ',0, ' ',0, ' ',0, '1',0, '.',0, '0',0,
160
        '0',0, '0',0
168
        '0',0, '0',0
161
};
169
  };
162
/******************* (C) COPYRIGHT 2006 STMicroelectronics *****END OF FILE****/
170
/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
163
 
171
 
164
 
172