From a1836d36a4c33e43d37c4b3434a296a3dbb46e6b Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 5 Dec 2019 13:22:36 +0100 Subject: [PATCH] Kconfig: Expose USB peripheral configurations --- sys/Kconfig | 1 + sys/include/usb.h | 6 ++++ sys/usb/Kconfig | 82 +++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 sys/usb/Kconfig diff --git a/sys/Kconfig b/sys/Kconfig index b549db481b..9f231128e6 100644 --- a/sys/Kconfig +++ b/sys/Kconfig @@ -7,5 +7,6 @@ menu "System" rsource "net/Kconfig" +rsource "usb/Kconfig" endmenu # System diff --git a/sys/include/usb.h b/sys/include/usb.h index c8b27d68fa..77abd1aed9 100644 --- a/sys/include/usb.h +++ b/sys/include/usb.h @@ -92,7 +92,13 @@ extern "C" { * @brief USB specification version */ #ifndef CONFIG_USB_SPEC_BCDVERSION +#if defined(CONFIG_USB_SPEC_BCDVERSION_1_1) +#define CONFIG_USB_SPEC_BCDVERSION 0x0110 +#elif defined(CONFIG_USB_SPEC_BCDVERSION_2_0) #define CONFIG_USB_SPEC_BCDVERSION 0x0200 +#else +#define CONFIG_USB_SPEC_BCDVERSION 0x0200 +#endif #endif /** diff --git a/sys/usb/Kconfig b/sys/usb/Kconfig new file mode 100644 index 0000000000..f9a2a473f3 --- /dev/null +++ b/sys/usb/Kconfig @@ -0,0 +1,82 @@ +# Copyright (c) 2019 HAW Hamburg +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. +# +menuconfig KCONFIG_USB + bool "Configure USB" + depends on MODULE_USBUS + help + Configure the USB peripheral via Kconfig. + +if KCONFIG_USB + +menu "Power management" + +config USB_MAX_POWER + int "Reported maximum power draw [mA]" + default 100 + range 0 500 + +config USB_SELF_POWERED + bool "Report as self-powered device" + help + When enabled, the device advertises itself as a self-powered device to + the host computer. + +endmenu # Power management + +choice + bool "USB specification version" + +config USB_SPEC_BCDVERSION_2_0 + bool "USB v2.0" + help + The peripheral acts as an USB version 2.0 device. + +config USB_SPEC_BCDVERSION_1_1 + bool "USB v1.1" + help + The peripheral acts as an USB version 1.1 device. + +endchoice + +config USB_PID + hex "Product ID" + range 0x0000 0xFFFF + help + You must provide your own PID. + +config USB_VID + hex "Vendor ID" + range 0x0000 0xFFFF + help + You must provide your own VID. + +config USB_MANUF_STR + string "Manufacturer string" + default "RIOT-os.org" + +config USB_PRODUCT_STR + string "Product string" + default "USB device" + +config USB_CONFIGURATION_STR + string "Configuration string" + default "USB config" + +config USB_PRODUCT_BCDVERSION + hex "Device version" + default 0x0100 + help + This is the version number of this peripheral. Not to be confused with + the USB version number. + +config USB_DEFAULT_LANGID + hex "Reported string Language ID" + default 0x0409 + help + The default value is EN-US (0x0409). + +endif # KCONFIG_USB