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:
|
# Change this to 0 show compiler invocation lines by default:
|
||||||
QUIET ?= 1
|
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
|
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:
|
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
|
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
|
* @note You must provide your own VID/PID combination when manufacturing a
|
||||||
* device with USB.
|
* device with USB.
|
||||||
*/
|
*/
|
||||||
#ifndef USB_CONFIG_VID
|
#ifndef CONFIG_USB_VID
|
||||||
#ifdef DOXYGEN
|
#ifdef DOXYGEN
|
||||||
#define USB_CONFIG_VID
|
#define CONFIG_USB_VID
|
||||||
#else
|
#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
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -49,33 +49,33 @@ extern "C" {
|
|||||||
* @note You must provide your own VID/PID combination when manufacturing a
|
* @note You must provide your own VID/PID combination when manufacturing a
|
||||||
* device with USB.
|
* device with USB.
|
||||||
*/
|
*/
|
||||||
#ifndef USB_CONFIG_PID
|
#ifndef CONFIG_USB_PID
|
||||||
#ifdef DOXYGEN
|
#ifdef DOXYGEN
|
||||||
#define USB_CONFIG_PID
|
#define CONFIG_USB_PID
|
||||||
#else
|
#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
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief USB peripheral manufacturer string
|
* @brief USB peripheral manufacturer string
|
||||||
*/
|
*/
|
||||||
#ifndef USB_CONFIG_MANUF_STR
|
#ifndef CONFIG_USB_MANUF_STR
|
||||||
#define USB_CONFIG_MANUF_STR "RIOT-os.org"
|
#define CONFIG_USB_MANUF_STR "RIOT-os.org"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief USB peripheral product string
|
* @brief USB peripheral product string
|
||||||
*/
|
*/
|
||||||
#ifndef USB_CONFIG_PRODUCT_STR
|
#ifndef CONFIG_USB_PRODUCT_STR
|
||||||
#define USB_CONFIG_PRODUCT_STR "USB device"
|
#define CONFIG_USB_PRODUCT_STR "USB device"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief USB peripheral configuration string
|
* @brief USB peripheral configuration string
|
||||||
*/
|
*/
|
||||||
#ifndef USB_CONFIG_CONFIGURATION_STR
|
#ifndef CONFIG_USB_CONFIGURATION_STR
|
||||||
#define USB_CONFIG_CONFIGURATION_STR "USB config"
|
#define CONFIG_USB_CONFIGURATION_STR "USB config"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,36 +84,36 @@ extern "C" {
|
|||||||
* This is the version number of this peripheral
|
* This is the version number of this peripheral
|
||||||
* @note Not to be be confused with the USB version number
|
* @note Not to be be confused with the USB version number
|
||||||
*/
|
*/
|
||||||
#ifndef USB_CONFIG_PRODUCT_BCDVERSION
|
#ifndef CONFIG_USB_PRODUCT_BCDVERSION
|
||||||
#define USB_CONFIG_PRODUCT_BCDVERSION 0x0100
|
#define CONFIG_USB_PRODUCT_BCDVERSION 0x0100
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief USB specification version
|
* @brief USB specification version
|
||||||
*/
|
*/
|
||||||
#ifndef USB_CONFIG_SPEC_BCDVERSION
|
#ifndef CONFIG_USB_SPEC_BCDVERSION
|
||||||
#define USB_CONFIG_SPEC_BCDVERSION 0x0200
|
#define CONFIG_USB_SPEC_BCDVERSION 0x0200
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief USB peripheral setting to indicate self powered devices.
|
* @brief USB peripheral setting to indicate self powered devices.
|
||||||
*/
|
*/
|
||||||
#ifndef USB_CONFIG_SELF_POWERED
|
#ifndef CONFIG_USB_SELF_POWERED
|
||||||
#define USB_CONFIG_SELF_POWERED (0)
|
#define CONFIG_USB_SELF_POWERED (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief USB device max power draw in mA, between 0 and 500mA
|
* @brief USB device max power draw in mA, between 0 and 500mA
|
||||||
*/
|
*/
|
||||||
#ifndef USB_CONFIG_MAX_POWER
|
#ifndef CONFIG_USB_MAX_POWER
|
||||||
#define USB_CONFIG_MAX_POWER (100)
|
#define CONFIG_USB_MAX_POWER (100)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Default LANG ID reported to the host
|
* @brief Default LANG ID reported to the host
|
||||||
*/
|
*/
|
||||||
#ifndef USB_CONFIG_DEFAULT_LANGID
|
#ifndef CONFIG_USB_DEFAULT_LANGID
|
||||||
#define USB_CONFIG_DEFAULT_LANGID 0x0409 /* EN-US */
|
#define CONFIG_USB_DEFAULT_LANGID 0x0409 /* EN-US */
|
||||||
#endif
|
#endif
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
@ -237,9 +237,9 @@ static void *_usbus_thread(void *args)
|
|||||||
usbdev_init(dev);
|
usbdev_init(dev);
|
||||||
|
|
||||||
usbus_add_string_descriptor(usbus, &usbus->config,
|
usbus_add_string_descriptor(usbus, &usbus->config,
|
||||||
USB_CONFIG_CONFIGURATION_STR);
|
CONFIG_USB_CONFIGURATION_STR);
|
||||||
usbus_add_string_descriptor(usbus, &usbus->product, USB_CONFIG_PRODUCT_STR);
|
usbus_add_string_descriptor(usbus, &usbus->product, CONFIG_USB_PRODUCT_STR);
|
||||||
usbus_add_string_descriptor(usbus, &usbus->manuf, USB_CONFIG_MANUF_STR);
|
usbus_add_string_descriptor(usbus, &usbus->manuf, CONFIG_USB_MANUF_STR);
|
||||||
|
|
||||||
usbus->state = USBUS_STATE_DISCONNECT;
|
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);
|
desc.length = sizeof(uint16_t) + sizeof(usb_descriptor_string_t);
|
||||||
usbus_control_slicer_put_bytes(usbus, (uint8_t *)&desc, sizeof(desc));
|
usbus_control_slicer_put_bytes(usbus, (uint8_t *)&desc, sizeof(desc));
|
||||||
/* Only one language ID supported */
|
/* 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));
|
usbus_control_slicer_put_bytes(usbus, (uint8_t *)&us, sizeof(uint16_t));
|
||||||
res = 1;
|
res = 1;
|
||||||
}
|
}
|
||||||
|
@ -248,12 +248,12 @@ size_t usbus_fmt_descriptor_conf(usbus_t *usbus)
|
|||||||
conf.total_length = sizeof(usb_descriptor_configuration_t);
|
conf.total_length = sizeof(usb_descriptor_configuration_t);
|
||||||
conf.val = 1;
|
conf.val = 1;
|
||||||
conf.attributes = USB_CONF_ATTR_RESERVED;
|
conf.attributes = USB_CONF_ATTR_RESERVED;
|
||||||
if (USB_CONFIG_SELF_POWERED) {
|
if (CONFIG_USB_SELF_POWERED) {
|
||||||
conf.attributes |= USB_CONF_ATTR_SELF_POWERED;
|
conf.attributes |= USB_CONF_ATTR_SELF_POWERED;
|
||||||
}
|
}
|
||||||
/* TODO: upper bound */
|
/* TODO: upper bound */
|
||||||
/* USB max power is reported in increments of 2 mA */
|
/* 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);
|
conf.num_interfaces = _num_ifaces(usbus);
|
||||||
len += sizeof(usb_descriptor_configuration_t);
|
len += sizeof(usb_descriptor_configuration_t);
|
||||||
conf.total_length = _gen_config_descriptor_size(usbus);
|
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));
|
memset(&desc, 0, sizeof(usb_descriptor_device_t));
|
||||||
desc.length = sizeof(usb_descriptor_device_t);
|
desc.length = sizeof(usb_descriptor_device_t);
|
||||||
desc.type = USB_TYPE_DESCRIPTOR_DEVICE;
|
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.max_packet_size = USBUS_EP0_SIZE;
|
||||||
desc.vendor_id = USB_CONFIG_VID;
|
desc.vendor_id = CONFIG_USB_VID;
|
||||||
desc.product_id = USB_CONFIG_PID;
|
desc.product_id = CONFIG_USB_PID;
|
||||||
desc.manufacturer_idx = usbus->manuf.idx;
|
desc.manufacturer_idx = usbus->manuf.idx;
|
||||||
desc.product_idx = usbus->product.idx;
|
desc.product_idx = usbus->product.idx;
|
||||||
/* USBUS supports only a single config at the moment */
|
/* USBUS supports only a single config at the moment */
|
||||||
|
@ -9,7 +9,7 @@ DEFAULT_PID = 0001
|
|||||||
USB_VID ?= $(DEFAULT_VID)
|
USB_VID ?= $(DEFAULT_VID)
|
||||||
USB_PID ?= $(DEFAULT_PID)
|
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
|
include $(RIOTBASE)/Makefile.include
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ DEFAULT_PID = 0001
|
|||||||
USB_VID ?= $(DEFAULT_VID)
|
USB_VID ?= $(DEFAULT_VID)
|
||||||
USB_PID ?= $(DEFAULT_PID)
|
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
|
include $(RIOTBASE)/Makefile.include
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ DEFAULT_PID = 0001
|
|||||||
USB_VID ?= $(DEFAULT_VID)
|
USB_VID ?= $(DEFAULT_VID)
|
||||||
USB_PID ?= $(DEFAULT_PID)
|
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
|
include $(RIOTBASE)/Makefile.include
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user