[AVR] Fix code style in AVR demo.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15926 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
parent
2ec3d1629d
commit
0b1d16e646
|
@ -37,18 +37,18 @@ SerialUSBDriver SDU1;
|
|||
* USB Device Descriptor.
|
||||
*/
|
||||
static ROMCONST uint8_t vcom_device_descriptor_data[18] = {
|
||||
USB_DESC_DEVICE (0x0110, /* bcdUSB (1.1). */
|
||||
0x02, /* bDeviceClass (CDC). */
|
||||
0x00, /* bDeviceSubClass. */
|
||||
0x00, /* bDeviceProtocol. */
|
||||
0x40, /* bMaxPacketSize. */
|
||||
0x2341, /* idVendor (Arduino LLC). */
|
||||
0x0036, /* idProduct. */
|
||||
0x0200, /* bcdDevice. */
|
||||
2, /* iManufacturer. */
|
||||
1, /* iProduct. */
|
||||
3, /* iSerialNumber. */
|
||||
1) /* bNumConfigurations. */
|
||||
USB_DESC_DEVICE (0x0110, /* USB specification version (1.1). */
|
||||
0x02, /* Device class (CDC). */
|
||||
0x00, /* Device sub class. */
|
||||
0x00, /* Device protocol. */
|
||||
0x40, /* Max packet size. */
|
||||
0x2341, /* Vendor identifier (Arduino LLC). */
|
||||
0x0036, /* Product identifier. */
|
||||
0x0200, /* Device version. */
|
||||
2, /* Device manufacturer. */
|
||||
1, /* Product descriptor. */
|
||||
3, /* Device serial number. */
|
||||
1) /* Device number of configurations. */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -62,78 +62,78 @@ static ROMCONST USBDescriptor vcom_device_descriptor = {
|
|||
/* Configuration Descriptor tree for a CDC.*/
|
||||
static ROMCONST uint8_t vcom_configuration_descriptor_data[67] = {
|
||||
/* Configuration Descriptor.*/
|
||||
USB_DESC_CONFIGURATION(67, /* wTotalLength. */
|
||||
0x02, /* bNumInterfaces. */
|
||||
0x01, /* bConfigurationValue. */
|
||||
0, /* iConfiguration. */
|
||||
0xC0, /* bmAttributes (self powered). */
|
||||
50), /* bMaxPower (100mA). */
|
||||
USB_DESC_CONFIGURATION(67, /* Total Length. */
|
||||
0x02, /* Number of interfaces. */
|
||||
0x01, /* Configuration Value. */
|
||||
0, /* Configuration. */
|
||||
0xC0, /* Attributes (self powered). */
|
||||
50), /* Max Power (100mA). */
|
||||
/* Interface Descriptor.*/
|
||||
USB_DESC_INTERFACE (0x00, /* bInterfaceNumber. */
|
||||
0x00, /* bAlternateSetting. */
|
||||
0x01, /* bNumEndpoints. */
|
||||
0x02, /* bInterfaceClass (Communications
|
||||
USB_DESC_INTERFACE (0x00, /* Interface number. */
|
||||
0x00, /* Alternate setting. */
|
||||
0x01, /* Number of endpoints. */
|
||||
0x02, /* Interface Class (Communications
|
||||
Interface Class, CDC section
|
||||
4.2). */
|
||||
0x02, /* bInterfaceSubClass (Abstract
|
||||
0x02, /* Interface subclass (Abstract
|
||||
Control Model, CDC section 4.3). */
|
||||
0x01, /* bInterfaceProtocol (AT commands,
|
||||
0x01, /* Interface Protocol (AT commands,
|
||||
CDC section 4.4). */
|
||||
0), /* iInterface. */
|
||||
0), /* Interface. */
|
||||
/* Header Functional Descriptor (CDC section 5.2.3).*/
|
||||
USB_DESC_BYTE (5), /* bLength. */
|
||||
USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x00), /* bDescriptorSubtype (Header
|
||||
USB_DESC_BYTE (5), /* Length. */
|
||||
USB_DESC_BYTE (0x24), /* Descriptor Type (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x00), /* Descriptor Subtype (Header
|
||||
Functional Descriptor. */
|
||||
USB_DESC_BCD (0x0110), /* bcdCDC. */
|
||||
USB_DESC_BCD (0x0110), /* CDC. */
|
||||
/* Call Management Functional Descriptor. */
|
||||
USB_DESC_BYTE (5), /* bFunctionLength. */
|
||||
USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x01), /* bDescriptorSubtype (Call Management
|
||||
USB_DESC_BYTE (5), /* Function Length. */
|
||||
USB_DESC_BYTE (0x24), /* Descriptor Type (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x01), /* Descriptor Subtype (Call Management
|
||||
Functional Descriptor). */
|
||||
USB_DESC_BYTE (0x00), /* bmCapabilities (D0+D1). */
|
||||
USB_DESC_BYTE (0x01), /* bDataInterface. */
|
||||
USB_DESC_BYTE (0x00), /* Capabilities (D0+D1). */
|
||||
USB_DESC_BYTE (0x01), /* Data Interface. */
|
||||
/* ACM Functional Descriptor.*/
|
||||
USB_DESC_BYTE (4), /* bFunctionLength. */
|
||||
USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x02), /* bDescriptorSubtype (Abstract
|
||||
USB_DESC_BYTE (4), /* Function Length. */
|
||||
USB_DESC_BYTE (0x24), /* Descriptor Type (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x02), /* Descriptor Subtype (Abstract
|
||||
Control Management Descriptor). */
|
||||
USB_DESC_BYTE (0x02), /* bmCapabilities. */
|
||||
USB_DESC_BYTE (0x02), /* Capabilities. */
|
||||
/* Union Functional Descriptor.*/
|
||||
USB_DESC_BYTE (5), /* bFunctionLength. */
|
||||
USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x06), /* bDescriptorSubtype (Union
|
||||
USB_DESC_BYTE (5), /* Function Length. */
|
||||
USB_DESC_BYTE (0x24), /* Descriptor Type (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x06), /* Descriptor Subtype (Union
|
||||
Functional Descriptor). */
|
||||
USB_DESC_BYTE (0x00), /* bMasterInterface (Communication
|
||||
USB_DESC_BYTE (0x00), /* Master Interface (Communication
|
||||
Class Interface). */
|
||||
USB_DESC_BYTE (0x01), /* bSlaveInterface0 (Data Class
|
||||
USB_DESC_BYTE (0x01), /* SlaveInterface0 (Data Class
|
||||
Interface). */
|
||||
/* Endpoint 2 Descriptor.*/
|
||||
USB_DESC_ENDPOINT (USBD1_INTERRUPT_REQUEST_EP|0x80,
|
||||
0x03, /* bmAttributes (Interrupt). */
|
||||
0x0008, /* wMaxPacketSize. */
|
||||
0xFF), /* bInterval. */
|
||||
0x03, /* Attributes (Interrupt). */
|
||||
0x0008, /* Max Packet Size. */
|
||||
0xFF), /* Interval. */
|
||||
/* Interface Descriptor.*/
|
||||
USB_DESC_INTERFACE (0x01, /* bInterfaceNumber. */
|
||||
0x00, /* bAlternateSetting. */
|
||||
0x02, /* bNumEndpoints. */
|
||||
0x0A, /* bInterfaceClass (Data Class
|
||||
USB_DESC_INTERFACE (0x01, /* Interface Number. */
|
||||
0x00, /* Alternate Setting. */
|
||||
0x02, /* Number of Endpoints. */
|
||||
0x0A, /* Interface Class (Data Class
|
||||
Interface, CDC section 4.5). */
|
||||
0x00, /* bInterfaceSubClass (CDC section
|
||||
0x00, /* Interface SubClass (CDC section
|
||||
4.6). */
|
||||
0x00, /* bInterfaceProtocol (CDC section
|
||||
0x00, /* Interface Protocol (CDC section
|
||||
4.7). */
|
||||
0x00), /* iInterface. */
|
||||
0x00), /* Interface. */
|
||||
/* Endpoint 3 Descriptor.*/
|
||||
USB_DESC_ENDPOINT (USBD1_DATA_AVAILABLE_EP, /* bEndpointAddress.*/
|
||||
0x02, /* bmAttributes (Bulk). */
|
||||
0x0040, /* wMaxPacketSize. */
|
||||
0x00), /* bInterval. */
|
||||
USB_DESC_ENDPOINT (USBD1_DATA_AVAILABLE_EP, /* Endpoint Address.*/
|
||||
0x02, /* Attributes (Bulk). */
|
||||
0x0040, /* Max PacketSize. */
|
||||
0x00), /* Interval. */
|
||||
/* Endpoint 1 Descriptor.*/
|
||||
USB_DESC_ENDPOINT (USBD1_DATA_REQUEST_EP|0x80, /* bEndpointAddress.*/
|
||||
0x02, /* bmAttributes (Bulk). */
|
||||
0x0040, /* wMaxPacketSize. */
|
||||
0x00) /* bInterval. */
|
||||
USB_DESC_ENDPOINT (USBD1_DATA_REQUEST_EP|0x80, /* Endpoint Address.*/
|
||||
0x02, /* Attributes (Bulk). */
|
||||
0x0040, /* Max Packet Size. */
|
||||
0x00) /* Interval. */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -148,17 +148,17 @@ static ROMCONST USBDescriptor vcom_configuration_descriptor = {
|
|||
* U.S. English language identifier.
|
||||
*/
|
||||
static ROMCONST uint8_t vcom_string0[] = {
|
||||
USB_DESC_BYTE(4), /* bLength. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType. */
|
||||
USB_DESC_WORD(0x0409) /* wLANGID (U.S. English). */
|
||||
USB_DESC_BYTE(4), /* Length. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* Descriptor Type. */
|
||||
USB_DESC_WORD(0x0409) /* LANGID (U.S. English). */
|
||||
};
|
||||
|
||||
/*
|
||||
* Vendor string.
|
||||
*/
|
||||
static ROMCONST uint8_t vcom_string1[] = {
|
||||
USB_DESC_BYTE(24), /* bLength. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType. */
|
||||
USB_DESC_BYTE(24), /* Length. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* Descriptor Type. */
|
||||
'A', 0, 'r', 0, 'd', 0, 'u', 0, 'i', 0, 'n', 0, 'o', 0,
|
||||
' ', 0, 'L', 0, 'L', 0, 'C', 0
|
||||
};
|
||||
|
@ -167,8 +167,8 @@ static ROMCONST uint8_t vcom_string1[] = {
|
|||
* Device Description string.
|
||||
*/
|
||||
static ROMCONST uint8_t vcom_string2[] = {
|
||||
USB_DESC_BYTE(56), /* bLength. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType. */
|
||||
USB_DESC_BYTE(56), /* Length. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* Descriptor Type. */
|
||||
'C', 0, 'h', 0, 'i', 0, 'b', 0, 'i', 0, 'O', 0, 'S', 0, '/', 0,
|
||||
'R', 0, 'T', 0, ' ', 0, 'V', 0, 'i', 0, 'r', 0, 't', 0, 'u', 0,
|
||||
'a', 0, 'l', 0, ' ', 0, 'C', 0, 'O', 0, 'M', 0, ' ', 0, 'P', 0,
|
||||
|
@ -179,8 +179,8 @@ static ROMCONST uint8_t vcom_string2[] = {
|
|||
* Serial Number string.
|
||||
*/
|
||||
static ROMCONST uint8_t vcom_string3[] = {
|
||||
USB_DESC_BYTE(8), /* bLength. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType. */
|
||||
USB_DESC_BYTE(8), /* Length. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* Descriptor Type. */
|
||||
'0' + CH_KERNEL_MAJOR, 0,
|
||||
'0' + CH_KERNEL_MINOR, 0,
|
||||
'0' + CH_KERNEL_PATCH, 0
|
||||
|
@ -290,7 +290,7 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
|
|||
|
||||
/* Enables the endpoints specified into the configuration.
|
||||
Note, this callback is invoked from an ISR so I-Class functions
|
||||
must be used.*/
|
||||
Must be used.*/
|
||||
usbInitEndpointI(usbp, USBD1_DATA_REQUEST_EP, &ep1config);
|
||||
usbInitEndpointI(usbp, USBD1_DATA_AVAILABLE_EP, &ep2config);
|
||||
usbInitEndpointI(usbp, USBD1_INTERRUPT_REQUEST_EP, &ep3config);
|
||||
|
|
|
@ -37,18 +37,18 @@ SerialUSBDriver SDU1;
|
|||
* USB Device Descriptor.
|
||||
*/
|
||||
static ROMCONST uint8_t vcom_device_descriptor_data[18] = {
|
||||
USB_DESC_DEVICE (0x0110, /* bcdUSB (1.1). */
|
||||
0x02, /* bDeviceClass (CDC). */
|
||||
0x00, /* bDeviceSubClass. */
|
||||
0x00, /* bDeviceProtocol. */
|
||||
0x40, /* bMaxPacketSize. */
|
||||
0x1b4f, /* idVendor (Sparkfun). */
|
||||
0x9206, /* idProduct. */
|
||||
0x0200, /* bcdDevice. */
|
||||
1, /* iManufacturer. */
|
||||
2, /* iProduct. */
|
||||
3, /* iSerialNumber. */
|
||||
1) /* bNumConfigurations. */
|
||||
USB_DESC_DEVICE (0x0110, /* USB specification version (1.1). */
|
||||
0x02, /* Device class (CDC). */
|
||||
0x00, /* Device sub class. */
|
||||
0x00, /* Device protocol. */
|
||||
0x40, /* Max packet size. */
|
||||
0x1b4f, /* Vendor identifier (Sparkfun). */
|
||||
0x9206, /* Product identifier. */
|
||||
0x0200, /* Device version. */
|
||||
1, /* Device manufacturer. */
|
||||
2, /* Product description. */
|
||||
3, /* Device serial number. */
|
||||
1) /* Device number of configurations. */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -62,78 +62,78 @@ static ROMCONST USBDescriptor vcom_device_descriptor = {
|
|||
/* Configuration Descriptor tree for a CDC.*/
|
||||
static ROMCONST uint8_t vcom_configuration_descriptor_data[67] = {
|
||||
/* Configuration Descriptor.*/
|
||||
USB_DESC_CONFIGURATION(67, /* wTotalLength. */
|
||||
0x02, /* bNumInterfaces. */
|
||||
0x01, /* bConfigurationValue. */
|
||||
0, /* iConfiguration. */
|
||||
0xC0, /* bmAttributes (self powered). */
|
||||
50), /* bMaxPower (100mA). */
|
||||
USB_DESC_CONFIGURATION(67, /* Total Length. */
|
||||
0x02, /* Number of Interfaces. */
|
||||
0x01, /* Configuration Value. */
|
||||
0, /* Configuration. */
|
||||
0xC0, /* Attributes (self powered). */
|
||||
50), /* Max Power (100mA). */
|
||||
/* Interface Descriptor.*/
|
||||
USB_DESC_INTERFACE (0x00, /* bInterfaceNumber. */
|
||||
0x00, /* bAlternateSetting. */
|
||||
0x01, /* bNumEndpoints. */
|
||||
0x02, /* bInterfaceClass (Communications
|
||||
USB_DESC_INTERFACE (0x00, /* Interface Number. */
|
||||
0x00, /* Alternate Setting. */
|
||||
0x01, /* Number of Endpoints. */
|
||||
0x02, /* Interface Class (Communications
|
||||
Interface Class, CDC section
|
||||
4.2). */
|
||||
0x02, /* bInterfaceSubClass (Abstract
|
||||
0x02, /* Interface Sub Class (Abstract
|
||||
Control Model, CDC section 4.3). */
|
||||
0x01, /* bInterfaceProtocol (AT commands,
|
||||
0x01, /* Interface Protocol (AT commands,
|
||||
CDC section 4.4). */
|
||||
0), /* iInterface. */
|
||||
0), /* Interface. */
|
||||
/* Header Functional Descriptor (CDC section 5.2.3).*/
|
||||
USB_DESC_BYTE (5), /* bLength. */
|
||||
USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x00), /* bDescriptorSubtype (Header
|
||||
USB_DESC_BYTE (5), /* Length. */
|
||||
USB_DESC_BYTE (0x24), /* Descriptor Type (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x00), /* Descriptor Subtype (Header
|
||||
Functional Descriptor. */
|
||||
USB_DESC_BCD (0x0110), /* bcdCDC. */
|
||||
USB_DESC_BCD (0x0110), /* CDC. */
|
||||
/* Call Management Functional Descriptor. */
|
||||
USB_DESC_BYTE (5), /* bFunctionLength. */
|
||||
USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x01), /* bDescriptorSubtype (Call Management
|
||||
USB_DESC_BYTE (5), /* Function Length. */
|
||||
USB_DESC_BYTE (0x24), /* Descriptor Type (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x01), /* Descriptor Subtype (Call Management
|
||||
Functional Descriptor). */
|
||||
USB_DESC_BYTE (0x00), /* bmCapabilities (D0+D1). */
|
||||
USB_DESC_BYTE (0x01), /* bDataInterface. */
|
||||
USB_DESC_BYTE (0x00), /* Capabilities (D0+D1). */
|
||||
USB_DESC_BYTE (0x01), /* Data Interface. */
|
||||
/* ACM Functional Descriptor.*/
|
||||
USB_DESC_BYTE (4), /* bFunctionLength. */
|
||||
USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x02), /* bDescriptorSubtype (Abstract
|
||||
USB_DESC_BYTE (4), /* Function Length. */
|
||||
USB_DESC_BYTE (0x24), /* Descriptor Type (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x02), /* Descriptor Subtype (Abstract
|
||||
Control Management Descriptor). */
|
||||
USB_DESC_BYTE (0x02), /* bmCapabilities. */
|
||||
USB_DESC_BYTE (0x02), /* Capabilities. */
|
||||
/* Union Functional Descriptor.*/
|
||||
USB_DESC_BYTE (5), /* bFunctionLength. */
|
||||
USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x06), /* bDescriptorSubtype (Union
|
||||
USB_DESC_BYTE (5), /* Function Length. */
|
||||
USB_DESC_BYTE (0x24), /* Descriptor Type (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x06), /* Descriptor Subtype (Union
|
||||
Functional Descriptor). */
|
||||
USB_DESC_BYTE (0x00), /* bMasterInterface (Communication
|
||||
USB_DESC_BYTE (0x00), /* Master Interface (Communication
|
||||
Class Interface). */
|
||||
USB_DESC_BYTE (0x01), /* bSlaveInterface0 (Data Class
|
||||
USB_DESC_BYTE (0x01), /* Slave Interface0 (Data Class
|
||||
Interface). */
|
||||
/* Endpoint 2 Descriptor.*/
|
||||
USB_DESC_ENDPOINT (USBD1_INTERRUPT_REQUEST_EP|0x80,
|
||||
0x03, /* bmAttributes (Interrupt). */
|
||||
0x0008, /* wMaxPacketSize. */
|
||||
0xFF), /* bInterval. */
|
||||
0x03, /* Attributes (Interrupt). */
|
||||
0x0008, /* Max Packet Size. */
|
||||
0xFF), /* Interval. */
|
||||
/* Interface Descriptor.*/
|
||||
USB_DESC_INTERFACE (0x01, /* bInterfaceNumber. */
|
||||
0x00, /* bAlternateSetting. */
|
||||
0x02, /* bNumEndpoints. */
|
||||
0x0A, /* bInterfaceClass (Data Class
|
||||
USB_DESC_INTERFACE (0x01, /* Interface Number. */
|
||||
0x00, /* Alternate Setting. */
|
||||
0x02, /* Number of Endpoints. */
|
||||
0x0A, /* Interface Class (Data Class
|
||||
Interface, CDC section 4.5). */
|
||||
0x00, /* bInterfaceSubClass (CDC section
|
||||
0x00, /* Interface SubClass (CDC section
|
||||
4.6). */
|
||||
0x00, /* bInterfaceProtocol (CDC section
|
||||
0x00, /* Interface Protocol (CDC section
|
||||
4.7). */
|
||||
0x00), /* iInterface. */
|
||||
0x00), /* Interface. */
|
||||
/* Endpoint 3 Descriptor.*/
|
||||
USB_DESC_ENDPOINT (USBD1_DATA_AVAILABLE_EP, /* bEndpointAddress.*/
|
||||
0x02, /* bmAttributes (Bulk). */
|
||||
0x0040, /* wMaxPacketSize. */
|
||||
0x00), /* bInterval. */
|
||||
USB_DESC_ENDPOINT (USBD1_DATA_AVAILABLE_EP, /* Endpoint Address.*/
|
||||
0x02, /* Attributes (Bulk). */
|
||||
0x0040, /* Max Packet Size. */
|
||||
0x00), /* Interval. */
|
||||
/* Endpoint 1 Descriptor.*/
|
||||
USB_DESC_ENDPOINT (USBD1_DATA_REQUEST_EP|0x80, /* bEndpointAddress.*/
|
||||
0x02, /* bmAttributes (Bulk). */
|
||||
0x0040, /* wMaxPacketSize. */
|
||||
0x00) /* bInterval. */
|
||||
USB_DESC_ENDPOINT (USBD1_DATA_REQUEST_EP|0x80, /* Endpoint Address.*/
|
||||
0x02, /* Attributes (Bulk). */
|
||||
0x0040, /* Max Packet Size. */
|
||||
0x00) /* Interval. */
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -148,17 +148,17 @@ static ROMCONST USBDescriptor vcom_configuration_descriptor = {
|
|||
* U.S. English language identifier.
|
||||
*/
|
||||
static ROMCONST uint8_t vcom_string0[] = {
|
||||
USB_DESC_BYTE(4), /* bLength. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType. */
|
||||
USB_DESC_WORD(0x0409) /* wLANGID (U.S. English). */
|
||||
USB_DESC_BYTE(4), /* Length. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* Descriptor Type. */
|
||||
USB_DESC_WORD(0x0409) /* LANGID (U.S. English). */
|
||||
};
|
||||
|
||||
/*
|
||||
* Vendor string.
|
||||
*/
|
||||
static ROMCONST uint8_t vcom_string1[] = {
|
||||
USB_DESC_BYTE(18), /* bLength. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType. */
|
||||
USB_DESC_BYTE(18), /* Length . */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* Descriptor Type. */
|
||||
'S', 0, 'p', 0, 'a', 0, 'r', 0, 'k', 0, 'f', 0, 'u', 0, 'n', 0,
|
||||
};
|
||||
|
||||
|
@ -166,8 +166,8 @@ static ROMCONST uint8_t vcom_string1[] = {
|
|||
* Device Description string.
|
||||
*/
|
||||
static ROMCONST uint8_t vcom_string2[] = {
|
||||
USB_DESC_BYTE(56), /* bLength. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType. */
|
||||
USB_DESC_BYTE(56), /* Length. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* Descriptor Type. */
|
||||
'C', 0, 'h', 0, 'i', 0, 'b', 0, 'i', 0, 'O', 0, 'S', 0, '/', 0,
|
||||
'R', 0, 'T', 0, ' ', 0, 'V', 0, 'i', 0, 'r', 0, 't', 0, 'u', 0,
|
||||
'a', 0, 'l', 0, ' ', 0, 'C', 0, 'O', 0, 'M', 0, ' ', 0, 'P', 0,
|
||||
|
@ -178,8 +178,8 @@ static ROMCONST uint8_t vcom_string2[] = {
|
|||
* Serial Number string.
|
||||
*/
|
||||
static ROMCONST uint8_t vcom_string3[] = {
|
||||
USB_DESC_BYTE(8), /* bLength. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType. */
|
||||
USB_DESC_BYTE(8), /* Length. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* Descriptor Type. */
|
||||
'0' + CH_KERNEL_MAJOR, 0,
|
||||
'0' + CH_KERNEL_MINOR, 0,
|
||||
'0' + CH_KERNEL_PATCH, 0
|
||||
|
@ -197,7 +197,7 @@ static ROMCONST USBDescriptor vcom_strings[] = {
|
|||
|
||||
/*
|
||||
* Handles the GET_DESCRIPTOR callback. All required descriptors must be
|
||||
* handled here.
|
||||
* Handled here.
|
||||
*/
|
||||
static const USBDescriptor *get_descriptor(USBDriver *usbp,
|
||||
uint8_t dtype,
|
||||
|
@ -289,7 +289,7 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
|
|||
|
||||
/* Enables the endpoints specified into the configuration.
|
||||
Note, this callback is invoked from an ISR so I-Class functions
|
||||
must be used.*/
|
||||
Must be used.*/
|
||||
usbInitEndpointI(usbp, USBD1_DATA_REQUEST_EP, &ep1config);
|
||||
usbInitEndpointI(usbp, USBD1_DATA_AVAILABLE_EP, &ep2config);
|
||||
usbInitEndpointI(usbp, USBD1_INTERRUPT_REQUEST_EP, &ep3config);
|
||||
|
|
|
@ -35,112 +35,112 @@ SerialUSBDriver SDU1;
|
|||
* USB Device Descriptor.
|
||||
*/
|
||||
static ROMCONST uint8_t vcom_device_descriptor_data[18] = {
|
||||
USB_DESC_DEVICE (0x0110, /* bcdUSB (1.1). */
|
||||
0x02, /* bDeviceClass (CDC). */
|
||||
0x00, /* bDeviceSubClass. */
|
||||
0x00, /* bDeviceProtocol. */
|
||||
0x40, /* bMaxPacketSize. */
|
||||
0x0483, /* idVendor (ST). */
|
||||
0x5740, /* idProduct. */
|
||||
0x0200, /* bcdDevice. */
|
||||
1, /* iManufacturer. */
|
||||
2, /* iProduct. */
|
||||
3, /* iSerialNumber. */
|
||||
1) /* bNumConfigurations. */
|
||||
USB_DESC_DEVICE (0x0110, /* USB specification version (1.1). */
|
||||
0x02, /* Device class (CDC). */
|
||||
0x00, /* Device sub class. */
|
||||
0x00, /* Device protocol. */
|
||||
0x40, /* Max packet size. */
|
||||
0x0483, /* Vendor identifier (ST). */
|
||||
0x5740, /* Product identifier. */
|
||||
0x0200, /* Device version. */
|
||||
1, /* Manufacturer of the device. */
|
||||
2, /* Product descriptor. */
|
||||
3, /* Serial number of the device. */
|
||||
1) /* Device number of Configurations. */
|
||||
};
|
||||
|
||||
/* Configuration Descriptor tree for a CDC.*/
|
||||
static ROMCONST uint8_t vcom_configuration_descriptor_data[67] = {
|
||||
/* Configuration Descriptor.*/
|
||||
USB_DESC_CONFIGURATION(67, /* wTotalLength. */
|
||||
0x02, /* bNumInterfaces. */
|
||||
0x01, /* bConfigurationValue. */
|
||||
0, /* iConfiguration. */
|
||||
0xC0, /* bmAttributes (self powered). */
|
||||
50), /* bMaxPower (100mA). */
|
||||
USB_DESC_CONFIGURATION(67, /* Total Length. */
|
||||
0x02, /* Number of Interfaces. */
|
||||
0x01, /* ConfigurationValue. */
|
||||
0, /* Configuration. */
|
||||
0xC0, /* Attributes (self powered). */
|
||||
50), /* Max Power (100mA). */
|
||||
/* Interface Descriptor.*/
|
||||
USB_DESC_INTERFACE (0x00, /* bInterfaceNumber. */
|
||||
0x00, /* bAlternateSetting. */
|
||||
0x01, /* bNumEndpoints. */
|
||||
0x02, /* bInterfaceClass (Communications
|
||||
USB_DESC_INTERFACE (0x00, /* Interface Number. */
|
||||
0x00, /* Alternate Setting. */
|
||||
0x01, /* Number of Endpoints. */
|
||||
0x02, /* Interface Class (Communications
|
||||
Interface Class, CDC section
|
||||
4.2). */
|
||||
0x02, /* bInterfaceSubClass (Abstract
|
||||
0x02, /* Interface SubClass (Abstract
|
||||
Control Model, CDC section 4.3). */
|
||||
0x01, /* bInterfaceProtocol (AT commands,
|
||||
0x01, /* Interface Protocol (AT commands,
|
||||
CDC section 4.4). */
|
||||
0), /* iInterface. */
|
||||
0), /* Interface. */
|
||||
/* Header Functional Descriptor (CDC section 5.2.3).*/
|
||||
USB_DESC_BYTE (5), /* bLength. */
|
||||
USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x00), /* bDescriptorSubtype (Header
|
||||
USB_DESC_BYTE (5), /* Length. */
|
||||
USB_DESC_BYTE (0x24), /* Descriptor Type (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x00), /* Descriptor Subtype (Header
|
||||
Functional Descriptor. */
|
||||
USB_DESC_BCD (0x0110), /* bcdCDC. */
|
||||
USB_DESC_BCD (0x0110), /* CDC. */
|
||||
/* Call Management Functional Descriptor. */
|
||||
USB_DESC_BYTE (5), /* bFunctionLength. */
|
||||
USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x01), /* bDescriptorSubtype (Call Management
|
||||
USB_DESC_BYTE (5), /* Function Length. */
|
||||
USB_DESC_BYTE (0x24), /* Descriptor Type (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x01), /* Descriptor Subtype (Call Management
|
||||
Functional Descriptor). */
|
||||
USB_DESC_BYTE (0x00), /* bmCapabilities (D0+D1). */
|
||||
USB_DESC_BYTE (0x01), /* bDataInterface. */
|
||||
USB_DESC_BYTE (0x00), /* Capabilities (D0+D1). */
|
||||
USB_DESC_BYTE (0x01), /* Data Interface. */
|
||||
/* ACM Functional Descriptor.*/
|
||||
USB_DESC_BYTE (4), /* bFunctionLength. */
|
||||
USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x02), /* bDescriptorSubtype (Abstract
|
||||
USB_DESC_BYTE (4), /* Function Length. */
|
||||
USB_DESC_BYTE (0x24), /* Descriptor Type (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x02), /* Descriptor Subtype (Abstract
|
||||
Control Management Descriptor). */
|
||||
USB_DESC_BYTE (0x02), /* bmCapabilities. */
|
||||
USB_DESC_BYTE (0x02), /* Capabilities. */
|
||||
/* Union Functional Descriptor.*/
|
||||
USB_DESC_BYTE (5), /* bFunctionLength. */
|
||||
USB_DESC_BYTE (0x24), /* bDescriptorType (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x06), /* bDescriptorSubtype (Union
|
||||
USB_DESC_BYTE (5), /* Function Length. */
|
||||
USB_DESC_BYTE (0x24), /* Descriptor Type (CS_INTERFACE). */
|
||||
USB_DESC_BYTE (0x06), /* Descriptor Subtype (Union
|
||||
Functional Descriptor). */
|
||||
USB_DESC_BYTE (0x00), /* bMasterInterface (Communication
|
||||
USB_DESC_BYTE (0x00), /* MasterInterface (Communication
|
||||
Class Interface). */
|
||||
USB_DESC_BYTE (0x01), /* bSlaveInterface0 (Data Class
|
||||
USB_DESC_BYTE (0x01), /* Slave Interface0 (Data Class
|
||||
Interface). */
|
||||
/* Endpoint 2 Descriptor.*/
|
||||
USB_DESC_ENDPOINT (USBD_INTERRUPT_REQUEST_EP|0x80,
|
||||
0x03, /* bmAttributes (Interrupt). */
|
||||
0x0008, /* wMaxPacketSize. */
|
||||
0xFF), /* bInterval. */
|
||||
0x03, /* Attributes (Interrupt). */
|
||||
0x0008, /* Max Packet Size. */
|
||||
0xFF), /* Interval. */
|
||||
/* Interface Descriptor.*/
|
||||
USB_DESC_INTERFACE (0x01, /* bInterfaceNumber. */
|
||||
0x00, /* bAlternateSetting. */
|
||||
0x02, /* bNumEndpoints. */
|
||||
0x0A, /* bInterfaceClass (Data Class
|
||||
USB_DESC_INTERFACE (0x01, /* Interface Number. */
|
||||
0x00, /* Alternate Setting. */
|
||||
0x02, /* Number of Endpoints. */
|
||||
0x0A, /* Interface Class (Data Class
|
||||
Interface, CDC section 4.5). */
|
||||
0x00, /* bInterfaceSubClass (CDC section
|
||||
0x00, /* Interface SubClass (CDC section
|
||||
4.6). */
|
||||
0x00, /* bInterfaceProtocol (CDC section
|
||||
0x00, /* Interface Protocol (CDC section
|
||||
4.7). */
|
||||
0x00), /* iInterface. */
|
||||
0x00), /* Interface. */
|
||||
/* Endpoint 3 Descriptor.*/
|
||||
USB_DESC_ENDPOINT (USBD_DATA_AVAILABLE_EP, /* bEndpointAddress.*/
|
||||
0x02, /* bmAttributes (Bulk). */
|
||||
0x0040, /* wMaxPacketSize. */
|
||||
0x00), /* bInterval. */
|
||||
USB_DESC_ENDPOINT (USBD_DATA_AVAILABLE_EP, /* Endpoint Address. */
|
||||
0x02, /* Attributes (Bulk). */
|
||||
0x0040, /* Max Packet Size. */
|
||||
0x00), /* Interval. */
|
||||
/* Endpoint 1 Descriptor.*/
|
||||
USB_DESC_ENDPOINT (USBD_DATA_REQUEST_EP|0x80, /* bEndpointAddress.*/
|
||||
0x02, /* bmAttributes (Bulk). */
|
||||
0x0040, /* wMaxPacketSize. */
|
||||
0x00) /* bInterval. */
|
||||
USB_DESC_ENDPOINT (USBD_DATA_REQUEST_EP|0x80, /* Endpoint Address. */
|
||||
0x02, /* Attributes (Bulk). */
|
||||
0x0040, /* Max Packet Size. */
|
||||
0x00) /* Interval. */
|
||||
};
|
||||
|
||||
/*
|
||||
* U.S. English language identifier.
|
||||
*/
|
||||
static ROMCONST uint8_t vcom_string0[] = {
|
||||
USB_DESC_BYTE(4), /* bLength. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType. */
|
||||
USB_DESC_WORD(0x0409) /* wLANGID (U.S. English). */
|
||||
USB_DESC_BYTE(4), /* Length. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* Descriptor Type. */
|
||||
USB_DESC_WORD(0x0409) /* LANGID (U.S. English). */
|
||||
};
|
||||
|
||||
/*
|
||||
* Vendor string.
|
||||
*/
|
||||
static ROMCONST uint8_t vcom_string1[] = {
|
||||
USB_DESC_BYTE(38), /* bLength. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType. */
|
||||
USB_DESC_BYTE(38), /* Length. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* Descriptor Type. */
|
||||
'S', 0, 'T', 0, 'M', 0, 'i', 0, 'c', 0, 'r', 0, 'o', 0, 'e', 0,
|
||||
'l', 0, 'e', 0, 'c', 0, 't', 0, 'r', 0, 'o', 0, 'n', 0, 'i', 0,
|
||||
'c', 0, 's', 0
|
||||
|
@ -150,8 +150,8 @@ static ROMCONST uint8_t vcom_string1[] = {
|
|||
* Device Description string.
|
||||
*/
|
||||
static ROMCONST uint8_t vcom_string2[] = {
|
||||
USB_DESC_BYTE(56), /* bLength. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType. */
|
||||
USB_DESC_BYTE(56), /* Length. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* Descriptor Type. */
|
||||
'C', 0, 'h', 0, 'i', 0, 'b', 0, 'i', 0, 'O', 0, 'S', 0, '/', 0,
|
||||
'R', 0, 'T', 0, ' ', 0, 'V', 0, 'i', 0, 'r', 0, 't', 0, 'u', 0,
|
||||
'a', 0, 'l', 0, ' ', 0, 'C', 0, 'O', 0, 'M', 0, ' ', 0, 'P', 0,
|
||||
|
@ -162,8 +162,8 @@ static ROMCONST uint8_t vcom_string2[] = {
|
|||
* Serial Number string.
|
||||
*/
|
||||
static ROMCONST uint8_t vcom_string3[] = {
|
||||
USB_DESC_BYTE(8), /* bLength. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* bDescriptorType. */
|
||||
USB_DESC_BYTE(8), /* Length. */
|
||||
USB_DESC_BYTE(USB_DESCRIPTOR_STRING), /* Descriptor Type. */
|
||||
'0' + CH_KERNEL_MAJOR, 0,
|
||||
'0' + CH_KERNEL_MINOR, 0,
|
||||
'0' + CH_KERNEL_PATCH, 0
|
||||
|
@ -255,7 +255,7 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
|
|||
|
||||
/* Enables the endpoints specified into the configuration.
|
||||
Note, this callback is invoked from an ISR so I-Class functions
|
||||
must be used.*/
|
||||
Must be used.*/
|
||||
usbInitEndpointI(usbp, USBD_DATA_REQUEST_EP, &ep1config);
|
||||
usbInitEndpointI(usbp, USBD_DATA_AVAILABLE_EP, &ep2config);
|
||||
usbInitEndpointI(usbp, USBD_INTERRUPT_REQUEST_EP, &ep3config);
|
||||
|
|
Loading…
Reference in New Issue