mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
usb: Move configuration macros to 'CONFIG_' namespace
Macros that changed: USB_CONFIG_VID -> CONFIG_USB_VID USB_CONFIG_PID -> CONFIG_USB_PID USB_CONFIG_MANUF_STR -> CONFIG_USB_MANUF_STR USB_CONFIG_PRODUCT_STR -> CONFIG_USB_PRODUCT_STR USB_CONFIG_CONFIGURATION_STR -> CONFIG_USB_CONFIGURATION_STR USB_CONFIG_PRODUCT_BCDVERSION -> CONFIG_USB_PRODUCT_BCDVERSION USB_CONFIG_SPEC_BCDVERSION -> CONFIG_USB_SPEC_BCDVERSION USB_CONFIG_SELF_POWERED -> CONFIG_USB_SELF_POWERED USB_CONFIG_MAX_POWER -> CONFIG_USB_MAX_POWER USB_CONFIG_DEFAULT_LANGID -> CONFIG_USB_DEFAULT_LANGID
This commit is contained in:
parent
50f1b1423a
commit
15bd4897c1
@ -24,7 +24,7 @@ USB_PID ?= $(DEFAULT_PID)
|
||||
# Change this to 0 show compiler invocation lines by default:
|
||||
QUIET ?= 1
|
||||
|
||||
CFLAGS += -DUSB_CONFIG_VID=0x$(USB_VID) -DUSB_CONFIG_PID=0x$(USB_PID)
|
||||
CFLAGS += -DCONFIG_USB_VID=0x$(USB_VID) -DCONFIG_USB_PID=0x$(USB_PID)
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
||||
|
@ -8,7 +8,7 @@ RIOT doesn't own any USB vendor and product ID. To compile this example, add
|
||||
your own vendor and product ID to the makefile:
|
||||
|
||||
```
|
||||
CFLAGS += -DUSB_CONFIG_VID=0xYOURVID -DUSB_CONFIG_PID=0xYOURPID
|
||||
CFLAGS += -DCONFIG_USB_VID=0xYOURVID -DCONFIG_USB_PID=0xYOURPID
|
||||
```
|
||||
|
||||
The example demonstrates basic USB communication between a host and a RIOT
|
||||
|
@ -35,11 +35,11 @@ extern "C" {
|
||||
* @note You must provide your own VID/PID combination when manufacturing a
|
||||
* device with USB.
|
||||
*/
|
||||
#ifndef USB_CONFIG_VID
|
||||
#ifndef CONFIG_USB_VID
|
||||
#ifdef DOXYGEN
|
||||
#define USB_CONFIG_VID
|
||||
#define CONFIG_USB_VID
|
||||
#else
|
||||
#error Please supply your vendor ID by setting USB_CONFIG_VID
|
||||
#error Please supply your vendor ID by setting CONFIG_USB_VID
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -49,33 +49,33 @@ extern "C" {
|
||||
* @note You must provide your own VID/PID combination when manufacturing a
|
||||
* device with USB.
|
||||
*/
|
||||
#ifndef USB_CONFIG_PID
|
||||
#ifndef CONFIG_USB_PID
|
||||
#ifdef DOXYGEN
|
||||
#define USB_CONFIG_PID
|
||||
#define CONFIG_USB_PID
|
||||
#else
|
||||
#error Please supply your vendor ID by setting USB_CONFIG_PID
|
||||
#error Please supply your vendor ID by setting CONFIG_USB_PID
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USB peripheral manufacturer string
|
||||
*/
|
||||
#ifndef USB_CONFIG_MANUF_STR
|
||||
#define USB_CONFIG_MANUF_STR "RIOT-os.org"
|
||||
#ifndef CONFIG_USB_MANUF_STR
|
||||
#define CONFIG_USB_MANUF_STR "RIOT-os.org"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USB peripheral product string
|
||||
*/
|
||||
#ifndef USB_CONFIG_PRODUCT_STR
|
||||
#define USB_CONFIG_PRODUCT_STR "USB device"
|
||||
#ifndef CONFIG_USB_PRODUCT_STR
|
||||
#define CONFIG_USB_PRODUCT_STR "USB device"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USB peripheral configuration string
|
||||
*/
|
||||
#ifndef USB_CONFIG_CONFIGURATION_STR
|
||||
#define USB_CONFIG_CONFIGURATION_STR "USB config"
|
||||
#ifndef CONFIG_USB_CONFIGURATION_STR
|
||||
#define CONFIG_USB_CONFIGURATION_STR "USB config"
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -84,36 +84,36 @@ extern "C" {
|
||||
* This is the version number of this peripheral
|
||||
* @note Not to be be confused with the USB version number
|
||||
*/
|
||||
#ifndef USB_CONFIG_PRODUCT_BCDVERSION
|
||||
#define USB_CONFIG_PRODUCT_BCDVERSION 0x0100
|
||||
#ifndef CONFIG_USB_PRODUCT_BCDVERSION
|
||||
#define CONFIG_USB_PRODUCT_BCDVERSION 0x0100
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USB specification version
|
||||
*/
|
||||
#ifndef USB_CONFIG_SPEC_BCDVERSION
|
||||
#define USB_CONFIG_SPEC_BCDVERSION 0x0200
|
||||
#ifndef CONFIG_USB_SPEC_BCDVERSION
|
||||
#define CONFIG_USB_SPEC_BCDVERSION 0x0200
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USB peripheral setting to indicate self powered devices.
|
||||
*/
|
||||
#ifndef USB_CONFIG_SELF_POWERED
|
||||
#define USB_CONFIG_SELF_POWERED (0)
|
||||
#ifndef CONFIG_USB_SELF_POWERED
|
||||
#define CONFIG_USB_SELF_POWERED (0)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief USB device max power draw in mA, between 0 and 500mA
|
||||
*/
|
||||
#ifndef USB_CONFIG_MAX_POWER
|
||||
#define USB_CONFIG_MAX_POWER (100)
|
||||
#ifndef CONFIG_USB_MAX_POWER
|
||||
#define CONFIG_USB_MAX_POWER (100)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Default LANG ID reported to the host
|
||||
*/
|
||||
#ifndef USB_CONFIG_DEFAULT_LANGID
|
||||
#define USB_CONFIG_DEFAULT_LANGID 0x0409 /* EN-US */
|
||||
#ifndef CONFIG_USB_DEFAULT_LANGID
|
||||
#define CONFIG_USB_DEFAULT_LANGID 0x0409 /* EN-US */
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
|
@ -237,9 +237,9 @@ static void *_usbus_thread(void *args)
|
||||
usbdev_init(dev);
|
||||
|
||||
usbus_add_string_descriptor(usbus, &usbus->config,
|
||||
USB_CONFIG_CONFIGURATION_STR);
|
||||
usbus_add_string_descriptor(usbus, &usbus->product, USB_CONFIG_PRODUCT_STR);
|
||||
usbus_add_string_descriptor(usbus, &usbus->manuf, USB_CONFIG_MANUF_STR);
|
||||
CONFIG_USB_CONFIGURATION_STR);
|
||||
usbus_add_string_descriptor(usbus, &usbus->product, CONFIG_USB_PRODUCT_STR);
|
||||
usbus_add_string_descriptor(usbus, &usbus->manuf, CONFIG_USB_MANUF_STR);
|
||||
|
||||
usbus->state = USBUS_STATE_DISCONNECT;
|
||||
|
||||
|
@ -123,7 +123,7 @@ static int _req_str(usbus_t *usbus, uint16_t idx)
|
||||
desc.length = sizeof(uint16_t) + sizeof(usb_descriptor_string_t);
|
||||
usbus_control_slicer_put_bytes(usbus, (uint8_t *)&desc, sizeof(desc));
|
||||
/* Only one language ID supported */
|
||||
uint16_t us = USB_CONFIG_DEFAULT_LANGID;
|
||||
uint16_t us = CONFIG_USB_DEFAULT_LANGID;
|
||||
usbus_control_slicer_put_bytes(usbus, (uint8_t *)&us, sizeof(uint16_t));
|
||||
res = 1;
|
||||
}
|
||||
|
@ -248,12 +248,12 @@ size_t usbus_fmt_descriptor_conf(usbus_t *usbus)
|
||||
conf.total_length = sizeof(usb_descriptor_configuration_t);
|
||||
conf.val = 1;
|
||||
conf.attributes = USB_CONF_ATTR_RESERVED;
|
||||
if (USB_CONFIG_SELF_POWERED) {
|
||||
if (CONFIG_USB_SELF_POWERED) {
|
||||
conf.attributes |= USB_CONF_ATTR_SELF_POWERED;
|
||||
}
|
||||
/* TODO: upper bound */
|
||||
/* USB max power is reported in increments of 2 mA */
|
||||
conf.max_power = USB_CONFIG_MAX_POWER / 2;
|
||||
conf.max_power = CONFIG_USB_MAX_POWER / 2;
|
||||
conf.num_interfaces = _num_ifaces(usbus);
|
||||
len += sizeof(usb_descriptor_configuration_t);
|
||||
conf.total_length = _gen_config_descriptor_size(usbus);
|
||||
@ -272,10 +272,10 @@ size_t usbus_fmt_descriptor_dev(usbus_t *usbus)
|
||||
memset(&desc, 0, sizeof(usb_descriptor_device_t));
|
||||
desc.length = sizeof(usb_descriptor_device_t);
|
||||
desc.type = USB_TYPE_DESCRIPTOR_DEVICE;
|
||||
desc.bcd_usb = USB_CONFIG_SPEC_BCDVERSION;
|
||||
desc.bcd_usb = CONFIG_USB_SPEC_BCDVERSION;
|
||||
desc.max_packet_size = USBUS_EP0_SIZE;
|
||||
desc.vendor_id = USB_CONFIG_VID;
|
||||
desc.product_id = USB_CONFIG_PID;
|
||||
desc.vendor_id = CONFIG_USB_VID;
|
||||
desc.product_id = CONFIG_USB_PID;
|
||||
desc.manufacturer_idx = usbus->manuf.idx;
|
||||
desc.product_idx = usbus->product.idx;
|
||||
/* USBUS supports only a single config at the moment */
|
||||
|
@ -9,7 +9,7 @@ DEFAULT_PID = 0001
|
||||
USB_VID ?= $(DEFAULT_VID)
|
||||
USB_PID ?= $(DEFAULT_PID)
|
||||
|
||||
CFLAGS += -DUSB_CONFIG_VID=0x$(USB_VID) -DUSB_CONFIG_PID=0x$(USB_PID)
|
||||
CFLAGS += -DCONFIG_USB_VID=0x$(USB_VID) -DCONFIG_USB_PID=0x$(USB_PID)
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
||||
|
@ -13,7 +13,7 @@ DEFAULT_PID = 0001
|
||||
USB_VID ?= $(DEFAULT_VID)
|
||||
USB_PID ?= $(DEFAULT_PID)
|
||||
|
||||
CFLAGS += -DUSB_CONFIG_VID=0x$(USB_VID) -DUSB_CONFIG_PID=0x$(USB_PID)
|
||||
CFLAGS += -DCONFIG_USB_VID=0x$(USB_VID) -DCONFIG_USB_PID=0x$(USB_PID)
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
||||
|
@ -20,7 +20,7 @@ DEFAULT_PID = 0001
|
||||
USB_VID ?= $(DEFAULT_VID)
|
||||
USB_PID ?= $(DEFAULT_PID)
|
||||
|
||||
CFLAGS += -DUSB_CONFIG_VID=0x$(USB_VID) -DUSB_CONFIG_PID=0x$(USB_PID)
|
||||
CFLAGS += -DCONFIG_USB_VID=0x$(USB_VID) -DCONFIG_USB_PID=0x$(USB_PID)
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user