mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-24 22:13:52 +01:00
Merge pull request #13839 from leandrolanzieri/pr/kconfig_migrate/sys/usbus_ecm
usbus/cdc/ecm: Expose configurations to Kconfig
This commit is contained in:
commit
40cb065a45
@ -43,22 +43,22 @@ extern "C" {
|
||||
* peripheral will report this to the host. This doesn't affect the actual
|
||||
* throughput, only what the peripheral reports to the host.
|
||||
*/
|
||||
#ifndef USBUS_CDC_ECM_CONFIG_SPEED
|
||||
#define USBUS_CDC_ECM_CONFIG_SPEED 1000000
|
||||
#ifndef CONFIG_USBUS_CDC_ECM_CONFIG_SPEED
|
||||
#define CONFIG_USBUS_CDC_ECM_CONFIG_SPEED 1000000
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Link download speed as reported by the peripheral
|
||||
*/
|
||||
#ifndef USBUS_CDC_ECM_CONFIG_SPEED_DOWNSTREAM
|
||||
#define USBUS_CDC_ECM_CONFIG_SPEED_DOWNSTREAM USBUS_CDC_ECM_CONFIG_SPEED
|
||||
#ifndef CONFIG_USBUS_CDC_ECM_CONFIG_SPEED_DOWNSTREAM
|
||||
#define CONFIG_USBUS_CDC_ECM_CONFIG_SPEED_DOWNSTREAM CONFIG_USBUS_CDC_ECM_CONFIG_SPEED
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Link upload speed as reported by the peripheral
|
||||
*/
|
||||
#ifndef USBUS_CDC_ECM_CONFIG_SPEED_UPSTREAM
|
||||
#define USBUS_CDC_ECM_CONFIG_SPEED_UPSTREAM USBUS_CDC_ECM_CONFIG_SPEED
|
||||
#ifndef CONFIG_USBUS_CDC_ECM_CONFIG_SPEED_UPSTREAM
|
||||
#define CONFIG_USBUS_CDC_ECM_CONFIG_SPEED_UPSTREAM CONFIG_USBUS_CDC_ECM_CONFIG_SPEED
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
@ -1 +1,2 @@
|
||||
rsource "acm/Kconfig"
|
||||
rsource "ecm/Kconfig"
|
||||
|
||||
43
sys/usb/usbus/cdc/ecm/Kconfig
Normal file
43
sys/usb/usbus/cdc/ecm/Kconfig
Normal file
@ -0,0 +1,43 @@
|
||||
# Copyright (c) 2020 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_MODULE_USBUS_CDC_ECM
|
||||
bool "Configure USBUS CDC ECM"
|
||||
depends on MODULE_USBUS_CDC_ECM
|
||||
help
|
||||
Configure the USBUS CDC ECM module via Kconfig.
|
||||
|
||||
if KCONFIG_MODULE_USBUS_CDC_ECM
|
||||
|
||||
config USBUS_CDC_ECM_CONFIG_SPEED_IND
|
||||
bool "Configure upload and download speeds independently"
|
||||
|
||||
config USBUS_CDC_ECM_CONFIG_SPEED
|
||||
int
|
||||
prompt "Link throughput (bits/second)" if !USBUS_CDC_ECM_CONFIG_SPEED_IND
|
||||
default 1000000
|
||||
help
|
||||
This defines a common up and down link throughput in bits/second. The
|
||||
USB peripheral will report this to the host. This doesn't affect the
|
||||
actual throughput, only what the peripheral reports to the host.
|
||||
|
||||
config USBUS_CDC_ECM_CONFIG_SPEED_DOWNSTREAM
|
||||
int
|
||||
prompt "Link download speed (bits/second)" if USBUS_CDC_ECM_CONFIG_SPEED_IND
|
||||
default USBUS_CDC_ECM_CONFIG_SPEED
|
||||
help
|
||||
This is the link download speed, defined in bits/second, that the USB
|
||||
peripheral will report to the host.
|
||||
|
||||
config USBUS_CDC_ECM_CONFIG_SPEED_UPSTREAM
|
||||
int
|
||||
prompt "Link upload speed (bits/second)" if USBUS_CDC_ECM_CONFIG_SPEED_IND
|
||||
default USBUS_CDC_ECM_CONFIG_SPEED
|
||||
help
|
||||
This is the link upload speed, defined in bits/second, that the USB
|
||||
peripheral will report to the host.
|
||||
|
||||
endif # KCONFIG_MODULE_USBUS_CDC_ECM
|
||||
@ -124,8 +124,8 @@ static void _notify_link_speed(usbus_cdcecm_device_t *cdcecm)
|
||||
notification->setup.index = cdcecm->iface_ctrl.idx;
|
||||
notification->setup.length = 8;
|
||||
|
||||
notification->down = USBUS_CDC_ECM_CONFIG_SPEED_DOWNSTREAM;
|
||||
notification->up = USBUS_CDC_ECM_CONFIG_SPEED_UPSTREAM;
|
||||
notification->down = CONFIG_USBUS_CDC_ECM_CONFIG_SPEED_DOWNSTREAM;
|
||||
notification->up = CONFIG_USBUS_CDC_ECM_CONFIG_SPEED_UPSTREAM;
|
||||
usbdev_ep_ready(cdcecm->ep_ctrl->ep,
|
||||
sizeof(usb_desc_cdcecm_speed_t));
|
||||
cdcecm->notif = USBUS_CDCECM_NOTIF_SPEED;
|
||||
|
||||
5
tests/usbus_cdc_ecm/Kconfig
Normal file
5
tests/usbus_cdc_ecm/Kconfig
Normal file
@ -0,0 +1,5 @@
|
||||
config USB_VID
|
||||
default 0x$(DEFAULT_VID) if KCONFIG_USB
|
||||
|
||||
config USB_PID
|
||||
default 0x$(DEFAULT_PID) if KCONFIG_USB
|
||||
@ -11,15 +11,29 @@ USEMODULE += ps
|
||||
|
||||
# USB device vendor and product ID
|
||||
# pid.codes test VID/PID, not globally unique
|
||||
DEFAULT_VID = 1209
|
||||
DEFAULT_PID = 7D00
|
||||
export DEFAULT_VID = 1209
|
||||
export DEFAULT_PID = 7D00
|
||||
USB_VID ?= $(DEFAULT_VID)
|
||||
USB_PID ?= $(DEFAULT_PID)
|
||||
|
||||
CFLAGS += -DCONFIG_USB_VID=0x$(USB_VID) -DCONFIG_USB_PID=0x$(USB_PID)
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
||||
# Set USB VID/PID via CFLAGS if not being set via Kconfig
|
||||
ifndef CONFIG_USB_VID
|
||||
CFLAGS += -DCONFIG_USB_VID=0x$(USB_VID)
|
||||
else
|
||||
USB_VID = $(patsubst 0x%,%,$(CONFIG_USB_VID))
|
||||
endif
|
||||
|
||||
ifndef CONFIG_USB_PID
|
||||
CFLAGS += -DCONFIG_USB_PID=0x$(USB_PID)
|
||||
else
|
||||
USB_PID = $(patsubst 0x%,%,$(CONFIG_USB_PID))
|
||||
endif
|
||||
|
||||
# There is a Kconfig in the app folder, we need to indicate not to run it by default
|
||||
SHOULD_RUN_KCONFIG ?=
|
||||
|
||||
.PHONY: usb_id_check
|
||||
usb_id_check:
|
||||
@if [ $(USB_VID) = $(DEFAULT_VID) -o $(USB_PID) = $(DEFAULT_PID) ] ; then \
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user