USB: set pid.codes BusVoodoo USB ID and improve description

This commit is contained in:
King Kévin 2018-02-23 11:34:21 +01:00
parent 074546f66e
commit 22932d0135
2 changed files with 33 additions and 36 deletions

View File

@ -15,7 +15,7 @@
/** library for USB CDC ACM communication (code)
* @file usb_cdcacm.c
* @author King Kévin <kingkevin@cuvoodoo.info>
* @date 2016-2017
* @date 2016-2018
*/
/* standard libraries */
@ -24,14 +24,14 @@
#include <stdlib.h> // general utilities
/* STM32 (including CM3) libraries */
#include <libopencmsis/core_cm3.h> // Cortex M3 utilities
#include <libopencm3/cm3/scb.h> // reset utilities
#include <libopencm3/cm3/nvic.h> // interrupt handler
#include <libopencm3/cm3/sync.h> // synchronisation utilities
#include <libopencm3/stm32/rcc.h> // real-time control clock library
#include <libopencm3/stm32/gpio.h> // general purpose input output library
#include <libopencm3/cm3/nvic.h> // interrupt handler
#include <libopencm3/cm3/scb.h> // reset utilities
#include <libopencmsis/core_cm3.h> // Cortex M3 utilities
#include <libopencm3/usb/usbd.h> // USB library
#include <libopencm3/usb/cdc.h> // USB CDC library
#include <libopencm3/cm3/sync.h> // synchronisation utilities
#include <libopencm3/usb/dfu.h> // DFU definitions
#include "global.h" // global utilities
@ -51,12 +51,12 @@ static const struct usb_device_descriptor usb_cdcacm_device_descriptor = {
.bDeviceSubClass = 0, /**< unused */
.bDeviceProtocol = 0, /**< unused */
.bMaxPacketSize0 = 64, /**< packet size for endpoint zero in bytes */
.idVendor = 0xc440, /**< Vendor ID (CuVo...) */
.idProduct = 0x0d00, /**< product ID within the Vendor ID space (...odoo) */
.bcdDevice = 0x0100, /**< version number for the device */
.idVendor = 0x1209, /**< pid.codes vendor ID */
.idProduct = 0x4256, /**< BusVoodo product ID within the Vendor ID space */
.bcdDevice = 0x0000, /**< Device Release Number: board version number */
.iManufacturer = 1, /**< the index of the string in the string table that represents the name of the manufacturer of this device */
.iProduct = 2, /**< the index of the string in the string table that represents the name of the product */
.iSerialNumber = 3, /**< the index of the string in the string table that represents the serial number of this item in string form */
.iSerialNumber = 0, /**< the index of the string in the string table that represents the serial number of this item in string form */
.bNumConfigurations = 1, /**< the number of possible configurations this device has */
};
@ -153,17 +153,16 @@ static const struct usb_interface_descriptor usb_cdcacm_communication_interface
* @note as defined in USB CDC specification section 5.1.3
*/
static const struct usb_interface_descriptor usb_cdcacm_data_interface = {
.bLength = USB_DT_INTERFACE_SIZE,
.bDescriptorType = USB_DT_INTERFACE,
.bInterfaceNumber = 1,
.bAlternateSetting = 0,
.bNumEndpoints = 2,
.bInterfaceClass = USB_CLASS_DATA,
.bInterfaceSubClass = 0,
.bInterfaceProtocol = 0,
.iInterface = 0,
.endpoint = usb_cdcacm_data_endpoints,
.bLength = USB_DT_INTERFACE_SIZE, /**< size of descriptor in byte */
.bDescriptorType = USB_DT_INTERFACE, /**< interface descriptor type */
.bInterfaceNumber = 1, /**< interface number in the list */
.bAlternateSetting = 0, /**< no alternative settings */
.bNumEndpoints = 2, /**< only the control pipe at endpoint 0 is used */
.bInterfaceClass = USB_CLASS_DATA, /**< USB CDC interface class */
.bInterfaceSubClass = 0, /**< USB CDC ACM interface subclass */
.bInterfaceProtocol = 0, /**< USB CDC ACM none protocol */
.iInterface = 0, /**< the index of the string in the string table that represents interface description */
.endpoint = usb_cdcacm_data_endpoints, /**< point to endpoint descriptor */
};
/** USB DFU functional descriptor
@ -190,7 +189,7 @@ static const struct usb_interface_descriptor usb_dfu_interface = {
.bInterfaceClass = 0xFE, /**< DFU interface class (not defined in libopencm3 dfu lib) */
.bInterfaceSubClass = 1, /**< DFU interface subclass (not defined in libopencm3 dfu lib) */
.bInterfaceProtocol = 1, /**< runtime protocol (not defined in libopencm3 dfu lib) */
.iInterface = 4, /**< the index of the string in the string table that represents interface description */
.iInterface = 3, /**< the index of the string in the string table that represents interface description */
.extra = &usb_dfu_functional, /**< point to functional descriptor */
.extralen = sizeof(usb_dfu_functional), /**< size of functional descriptor */
};
@ -216,7 +215,7 @@ static const struct usb_config_descriptor usb_cdcacm_configuration_descriptor =
.bConfigurationValue = 1, /**< the index of this configuration */
.iConfiguration = 0, /**< a string index describing this configuration (zero means not provided) */
.bmAttributes = 0x80, /**< bus powered (1<<7) */
.bMaxPower = 0x32, /**< the maximum amount of current that this device will draw in 2mA units */
.bMaxPower = 0xfa, /**< the maximum amount of current that this device will draw in 2mA units */
// end of header
.interface = usb_cdcacm_interfaces, /**< pointer to an array of interfaces */
};
@ -225,10 +224,9 @@ static const struct usb_config_descriptor usb_cdcacm_configuration_descriptor =
* @note starting with index 1
*/
static const char *usb_strings[] = {
"CuVoodoo",
"STM32F1",
"CDC-ACM",
"CuVoodoo DFU bootloader (runtime mode)",
"CuVoodoo", /**< manufacturer string */
"BusVoodoo multi-protocol debugging adapter", /**< product string */
"DFU bootloader (runtime mode)", /**< DFU interface string */
};
/* output ring buffer, index, and available memory */
@ -422,7 +420,7 @@ static void usb_cdcacm_set_config(usbd_device *usbd_dev, uint16_t wValue)
usbd_register_control_callback( usbd_dev, USB_REQ_TYPE_CLASS | USB_REQ_TYPE_INTERFACE, USB_REQ_TYPE_TYPE | USB_REQ_TYPE_RECIPIENT, usb_cdcacm_control_request);
}
void usb_cdcacm_setup(void)
{
connected = false; // start with USB not connected

View File

@ -55,12 +55,12 @@ static const struct usb_device_descriptor usb_dfu_device = {
.bDeviceSubClass = 0, /**< unused */
.bDeviceProtocol = 0, /**< unused */
.bMaxPacketSize0 = 64, /**< packet size for endpoint zero in bytes */
.idVendor = 0xc440, /**< Vendor ID (CuVo...) */
.idProduct = 0x0d00, /**< product ID within the Vendor ID space (...odoo) */
.bcdDevice = 0x0100, /**< version number for the device */
.idVendor = 0x1209, /**< pid.codes vendor ID */
.idProduct = 0x4256, /**< BusVoodo product ID within the Vendor ID space */
.bcdDevice = 0x0000, /**< Device Release Number: board version number */
.iManufacturer = 1, /**< the index of the string in the string table that represents the name of the manufacturer of this device */
.iProduct = 2, /**< the index of the string in the string table that represents the name of the product */
.iSerialNumber = 3, /**< the index of the string in the string table that represents the serial number of this item in string form */
.iSerialNumber = 0, /**< the index of the string in the string table that represents the serial number of this item in string form */
.bNumConfigurations = 1, /**< the number of possible configurations this device has */
};
@ -88,7 +88,7 @@ static const struct usb_interface_descriptor usb_dfu_interface = {
.bInterfaceClass = 0xFE, /**< DFU interface class (not defined in libopencm3 dfu lib) */
.bInterfaceSubClass = 1, /**< DFU interface subclass (not defined in libopencm3 dfu lib) */
.bInterfaceProtocol = 2, /**< DFU interface mode protocol (not defined in libopencm3 dfu lib) */
.iInterface = 4, /**< the index of the string in the string table that represents interface description */
.iInterface = 3, /**< the index of the string in the string table that represents interface description */
.extra = &usb_dfu_functional, /**< point to functional descriptor */
.extralen = sizeof(usb_dfu_functional), /**< size of functional descriptor */
};
@ -119,10 +119,9 @@ static const struct usb_config_descriptor usb_dfu_configuration = {
* @note starts with index 1
*/
static const char *usb_dfu_strings[] = {
"CuVoodoo",
"STM32F1",
"DFU",
"CuVoodoo DFU bootloader (DFU mode)",
"CuVoodoo", /**< manufacturer string */
"BusVoodoo multi-protocol debugging adapter ", /**< product string */
"DFU bootloader (DFU mode)", /**< DFU interface string */
};
/** disconnect USB to force re-enumerate */