From 4648329c66f9def3f410fb97454ffbfe64e26f7b Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Mon, 31 Aug 2020 12:53:01 +0200 Subject: [PATCH] drivers/periph_common: remove redundant entry - Use same file for MODULE inclusion and configuration - Fix guard - Add Kconfig.wdt --- drivers/periph_common/Kconfig | 47 +++-------------------------- drivers/periph_common/Kconfig.timer | 18 +++++++++-- drivers/periph_common/Kconfig.wdt | 40 ++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 45 deletions(-) create mode 100644 drivers/periph_common/Kconfig.wdt diff --git a/drivers/periph_common/Kconfig b/drivers/periph_common/Kconfig index 3e0fd1acb8..f9ea06b6e2 100644 --- a/drivers/periph_common/Kconfig +++ b/drivers/periph_common/Kconfig @@ -4,37 +4,7 @@ # General Public License v2.1. See the file LICENSE in the top level # directory for more details. -menuconfig KCONFIG_USEMODULE_PERIPH_TIMER - bool "Configure timer peripheral" - depends on USEMODULE_PERIPH_TIMER - help - Configure Timer peripheral using Kconfig. - -orsource "$(RIOTCPU)/$(CPU)/periph/Kconfig" - -menuconfig KCONFIG_USEMODULE_PERIPH_WDT - bool "Configure Watchdog peripheral" - depends on USEMODULE_PERIPH_WDT - help - Configure Watchdog peripheral using Kconfig. - -if KCONFIG_USEMODULE_PERIPH_WDT - -config WDT_WARNING_PERIOD - int "Warning period (in ms)" - depends on HAS_PERIPH_WDT_WARNING_PERIOD - help - Period in ms before reboot where wdt_cb() is executed. - -endif # KCONFIG_USEMODULE_PERIPH_WDT - -config HAS_PERIPH_WDT_WARNING_PERIOD - bool - help - Indicates that a CPU provides a warning period configuration option. - -menu "Peripheral drivers" - depends on TEST_KCONFIG +if TEST_KCONFIG config MODULE_PERIPH_COMMON bool @@ -167,8 +137,6 @@ config MODULE_PERIPH_INIT_RTT rsource "Kconfig.spi" -rsource "Kconfig.timer" - rsource "Kconfig.uart" config MODULE_PERIPH_USBDEV @@ -181,14 +149,7 @@ config MODULE_PERIPH_INIT_USBDEV default y if MODULE_PERIPH_INIT depends on MODULE_PERIPH_USBDEV -menuconfig MODULE_PERIPH_WDT - bool "Watchdog Timer peripheral driver" - depends on HAS_PERIPH_WDT - select MODULE_PERIPH_COMMON +endif # TEST_KCONFIG -config MODULE_PERIPH_INIT_WDT - bool "Auto initialize the Watchdog Timer peripheral" - default y if MODULE_PERIPH_INIT - depends on MODULE_PERIPH_WDT - -endmenu # Peripheral drivers +rsource "Kconfig.timer" +rsource "Kconfig.wdt" diff --git a/drivers/periph_common/Kconfig.timer b/drivers/periph_common/Kconfig.timer index d347683c0f..3ad9359fd0 100644 --- a/drivers/periph_common/Kconfig.timer +++ b/drivers/periph_common/Kconfig.timer @@ -3,10 +3,11 @@ # 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. -# + +if TEST_KCONFIG menuconfig MODULE_PERIPH_TIMER - bool "Timer peripheral driver" + bool "Configure timer peripheral driver" depends on HAS_PERIPH_TIMER select MODULE_PERIPH_COMMON @@ -30,3 +31,16 @@ config MODULE_PERIPH_INIT_TIMER_PERIODIC default y if MODULE_PERIPH_INIT endif # MODULE_PERIPH_TIMER + +endif # TEST_KCONFIG + +menuconfig KCONFIG_USEMODULE_PERIPH_TIMER + bool "Configure timer peripheral driver" + depends on USEMODULE_PERIPH_TIMER + help + Configure Timer peripheral using Kconfig. + +# Include CPU specific configurations +if KCONFIG_USEMODULE_PERIPH_TIMER +osource "$(RIOTCPU)/$(CPU)/periph/Kconfig.timer" +endif diff --git a/drivers/periph_common/Kconfig.wdt b/drivers/periph_common/Kconfig.wdt new file mode 100644 index 0000000000..3b7eba431a --- /dev/null +++ b/drivers/periph_common/Kconfig.wdt @@ -0,0 +1,40 @@ +# 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. + +if TEST_KCONFIG + +menuconfig MODULE_PERIPH_WDT + bool "Watchdog Timer peripheral driver" + depends on HAS_PERIPH_WDT + select MODULE_PERIPH_COMMON + +config MODULE_PERIPH_INIT_WDT + bool "Auto initialize the Watchdog Timer peripheral" + default y if MODULE_PERIPH_INIT + depends on MODULE_PERIPH_WDT + +endif # TEST_KCONFIG + +menuconfig KCONFIG_USEMODULE_PERIPH_WDT + bool "Configure Watchdog peripheral" + depends on USEMODULE_PERIPH_WDT + help + Configure Watchdog peripheral using Kconfig. + +if KCONFIG_USEMODULE_PERIPH_WDT + +config WDT_WARNING_PERIOD + int "Warning period (in ms)" + depends on HAS_PERIPH_WDT_WARNING_PERIOD + help + Period in ms before reboot where wdt_cb() is executed. + +endif # KCONFIG_USEMODULE_PERIPH_WDT + +config HAS_PERIPH_WDT_WARNING_PERIOD + bool + help + Indicates that a CPU provides a warning period configuration option.