From 00b71a27083e6a390b7ff16ce2d122e2ff8e904d Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 13 Feb 2020 17:56:27 +0100 Subject: [PATCH 1/8] drivers/wdt: Move WDT_WARNING_PERIOD to 'CONFIG_' namespace --- cpu/sam0_common/periph/wdt.c | 2 +- drivers/include/periph/wdt.h | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cpu/sam0_common/periph/wdt.c b/cpu/sam0_common/periph/wdt.c index dc72954847..abacdbe47a 100644 --- a/cpu/sam0_common/periph/wdt.c +++ b/cpu/sam0_common/periph/wdt.c @@ -193,7 +193,7 @@ void wdt_setup_reboot_with_callback(uint32_t min_time, uint32_t max_time, cb_arg = arg; if (cb != NULL) { - uint32_t warning_offset = ms_to_per(WDT_WARNING_PERIOD); + uint32_t warning_offset = ms_to_per(CONFIG_WDT_WARNING_PERIOD); if (warning_offset == 0) { warning_offset = 1; diff --git a/drivers/include/periph/wdt.h b/drivers/include/periph/wdt.h index 0814c68b5f..324030e98e 100644 --- a/drivers/include/periph/wdt.h +++ b/drivers/include/periph/wdt.h @@ -111,8 +111,8 @@ * This function is highly platform dependent so check the platform documentation * for details on its constraints. * - * The callback will be executed WDT_WARNING_PERIOD before the actual reboot. - * The value of WDT_WARNING_PERIOD may be configurable or a fixed value. But is + * The callback will be executed CONFIG_WDT_WARNING_PERIOD before the actual reboot. + * The value of CONFIG_WDT_WARNING_PERIOD may be configurable or a fixed value. But is * in any case defined at compile time. Specific platform implementation should * assert improper values. * @@ -146,10 +146,10 @@ * * @verbatim * |---------------------MAX_TIME-----------------------| - * |---WDT_WARNING_PERIOD---| - * ^ ^ - * | | - * wdt_cb() reboot + * |---CONFIG_WDT_WARNING_PERIOD---| + * ^ ^ + * | | + * wdt_cb() reboot * @endverbatim * * To include this feature, (If your platform supports it) in your application @@ -276,13 +276,13 @@ void wdt_init(void); * @{ */ /** - * @def WDT_WARNING_PERIOD + * @def CONFIG_WDT_WARNING_PERIOD * * @brief Period (ms) before reboot where wdt_cb() is executed. * Defined per implementation. */ -#ifndef WDT_WARNING_PERIOD -#define WDT_WARNING_PERIOD (1) +#ifndef CONFIG_WDT_WARNING_PERIOD +#define CONFIG_WDT_WARNING_PERIOD (1) #endif /** @} */ From 8cca9bfc28aa89ab13054ffaf53fd0a7d3f2af0e Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Thu, 13 Feb 2020 18:19:56 +0100 Subject: [PATCH 2/8] drivers/wdt: Expose configuration to Kconfig --- drivers/Kconfig | 1 + drivers/periph_common/Kconfig | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 drivers/periph_common/Kconfig diff --git a/drivers/Kconfig b/drivers/Kconfig index caea65be4f..ed6bac1d24 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -6,4 +6,5 @@ menu "Drivers" rsource "Kconfig.net" +rsource "periph_common/Kconfig" endmenu # Drivers diff --git a/drivers/periph_common/Kconfig b/drivers/periph_common/Kconfig new file mode 100644 index 0000000000..3bea44b722 --- /dev/null +++ b/drivers/periph_common/Kconfig @@ -0,0 +1,26 @@ +# 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_PERIPH_WDT + bool "Configure Watchdog peripheral" + depends on MODULE_PERIPH_WDT + help + Configure Watchdog peripheral using Kconfig. + +if KCONFIG_MODULE_PERIPH_WDT + +config WDT_WARNING_PERIOD + int "Warning period (in ms)" + depends on HAS_WDT_WARNING_PERIOD + help + Period in ms before reboot where wdt_cb() is executed. + +endif # KCONFIG_MODULE_PERIPH_WDT + +config HAS_WDT_WARNING_PERIOD + bool + help + Indicates that a CPU provides a warning period configuration option. From e94f4a65a7bfcfb9585323748de64509fe7e2991 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Mon, 23 Mar 2020 13:48:56 +0100 Subject: [PATCH 3/8] Kconfig: Optionally add CPU-specific symbols --- Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Kconfig b/Kconfig index 086360a49a..99f62e79fa 100644 --- a/Kconfig +++ b/Kconfig @@ -9,6 +9,8 @@ mainmenu "RIOT Configuration" # For now, get used modules as macros from this file (see kconfig.mk) osource "$(KCONFIG_GENERATED_DEPENDENCIES)" +orsource "$(RIOTCPU)/$(CPU)/Kconfig" + # The application may declare new symbols as well osource "$(APPDIR)/Kconfig" From cf53a863084143ed2f9460ca126cafcd9aef54ac Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Mon, 23 Mar 2020 13:54:27 +0100 Subject: [PATCH 4/8] cpu/sam0_common: Add CPU-specific WDT peripheral configuration --- cpu/sam0_common/Kconfig | 13 +++++++++++++ cpu/sam0_common/periph/Kconfig | 9 +++++++++ 2 files changed, 22 insertions(+) create mode 100644 cpu/sam0_common/Kconfig create mode 100644 cpu/sam0_common/periph/Kconfig diff --git a/cpu/sam0_common/Kconfig b/cpu/sam0_common/Kconfig new file mode 100644 index 0000000000..5aeba2af99 --- /dev/null +++ b/cpu/sam0_common/Kconfig @@ -0,0 +1,13 @@ +# 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. +# + +config CPU_FAMILY_SAM0 + bool + default y + select HAS_WDT_WARNING_PERIOD + +rsource "periph/Kconfig" diff --git a/cpu/sam0_common/periph/Kconfig b/cpu/sam0_common/periph/Kconfig new file mode 100644 index 0000000000..38c15739e1 --- /dev/null +++ b/cpu/sam0_common/periph/Kconfig @@ -0,0 +1,9 @@ +# 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. + +config WDT_WARNING_PERIOD + depends on HAS_WDT_WARNING_PERIOD && KCONFIG_MODULE_PERIPH_WDT + default 1 From c43543c21a117fc8e638aed88d9c1e9e242aaff2 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Mon, 23 Mar 2020 13:56:59 +0100 Subject: [PATCH 5/8] cpu/samd21: Add Kconfig file --- cpu/samd21/Kconfig | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 cpu/samd21/Kconfig diff --git a/cpu/samd21/Kconfig b/cpu/samd21/Kconfig new file mode 100644 index 0000000000..7b86fbbc19 --- /dev/null +++ b/cpu/samd21/Kconfig @@ -0,0 +1,8 @@ +# 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. +# + +source "$(RIOTCPU)/sam0_common/Kconfig" From daf38f25009eec7c2888a3b5efb6c68069e210a9 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Mon, 23 Mar 2020 13:58:08 +0100 Subject: [PATCH 6/8] cpu/samd5x: Add Kconfig file --- cpu/samd5x/Kconfig | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 cpu/samd5x/Kconfig diff --git a/cpu/samd5x/Kconfig b/cpu/samd5x/Kconfig new file mode 100644 index 0000000000..7b86fbbc19 --- /dev/null +++ b/cpu/samd5x/Kconfig @@ -0,0 +1,8 @@ +# 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. +# + +source "$(RIOTCPU)/sam0_common/Kconfig" From 218f7bfe0ce17d899d00a51d0b711d732bbc60ea Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Mon, 23 Mar 2020 14:01:52 +0100 Subject: [PATCH 7/8] cpu/saml21: Add Kconfig file --- cpu/saml21/Kconfig | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 cpu/saml21/Kconfig diff --git a/cpu/saml21/Kconfig b/cpu/saml21/Kconfig new file mode 100644 index 0000000000..7b86fbbc19 --- /dev/null +++ b/cpu/saml21/Kconfig @@ -0,0 +1,8 @@ +# 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. +# + +source "$(RIOTCPU)/sam0_common/Kconfig" From f69427fcf73707747dedc83312788d4e82712484 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Mon, 23 Mar 2020 14:02:10 +0100 Subject: [PATCH 8/8] cpu/saml1x: Add Kconfig file --- cpu/saml1x/Kconfig | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 cpu/saml1x/Kconfig diff --git a/cpu/saml1x/Kconfig b/cpu/saml1x/Kconfig new file mode 100644 index 0000000000..7b86fbbc19 --- /dev/null +++ b/cpu/saml1x/Kconfig @@ -0,0 +1,8 @@ +# 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. +# + +source "$(RIOTCPU)/sam0_common/Kconfig"