subsys: usb: Set Zephyr project USB Vendor and Product IDs

Document USB Vendor and Product IDs and their intended usage.
Set the Vendor and Product IDs and define the USB bcdDevice
Device Descriptor Device Release Number to be the binary
coded decimal representation of the Zephyr major and minor
kernel version number.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
This commit is contained in:
Patrik Flykt 2018-01-12 09:30:34 +02:00 committed by Anas Nashif
commit 010fb40b95
4 changed files with 31 additions and 10 deletions

View file

@ -39,9 +39,13 @@
* This file contains useful constants and macros for the USB applications.
*/
#include <version.h>
#ifndef USB_COMMON_H_
#define USB_COMMON_H_
#define BCD(x) ((((x) / 10) << 4) | ((x) / 10))
/* Descriptor size in bytes */
#define USB_DEVICE_DESC_SIZE 18
#define USB_CONFIGURATION_DESC_SIZE 9
@ -72,7 +76,8 @@
/* Set USB version to 2.1 so that the host will request the BOS descriptor */
#define USB_2_1 0x0210
#define BCDDEVICE_RELNUM 0x0100
#define BCDDEVICE_RELNUM (BCD(KERNEL_VERSION_MAJOR) << 8 | \
BCD(KERNEL_VERSION_MINOR))
/* 100mA max power, per 2mA units */
/* USB 1.1 spec indicates 100mA(max) per unit load, up to 5 loads */