From d47a8809157f5d27e910790e7e2b262987cf6b21 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Wed, 13 Jan 2021 20:48:29 +0100 Subject: [PATCH] cpu: add periph_rtt_overflow feature The RTT overflow callback is not available on all RTT implementations. This means it is either a no-op or `rtt_set_overflow_cb()` is a no-op or it will overwrite the alarm set with `rtt_set_alarm()`. This adds a feature to indicate that proper overflow reporting is available. --- cpu/atmega_common/Kconfig | 1 + cpu/atmega_common/Makefile.features | 1 + cpu/cc2538/Kconfig | 1 + cpu/cc2538/Makefile.features | 1 + cpu/efm32/Kconfig | 1 + cpu/efm32/Makefile.features | 1 + cpu/esp32/Kconfig | 1 + cpu/esp32/Makefile.features | 1 + cpu/esp8266/Kconfig | 1 + cpu/esp8266/Makefile.features | 1 + cpu/fe310/Kconfig | 1 + cpu/fe310/Makefile.features | 1 + cpu/kinetis/Kconfig | 1 + cpu/kinetis/Makefile.features | 1 + cpu/nrf5x_common/Kconfig | 1 + cpu/nrf5x_common/Makefile.features | 1 + cpu/sam0_common/Kconfig | 1 + cpu/sam0_common/Makefile.features | 1 + cpu/stm32/Kconfig | 1 + cpu/stm32/Makefile.features | 1 + kconfigs/Kconfig.features | 5 +++++ 21 files changed, 25 insertions(+) diff --git a/cpu/atmega_common/Kconfig b/cpu/atmega_common/Kconfig index 599b319719..7130759aee 100644 --- a/cpu/atmega_common/Kconfig +++ b/cpu/atmega_common/Kconfig @@ -22,6 +22,7 @@ config CPU_COMMON_ATMEGA select HAS_PERIPH_PM select HAS_PERIPH_RTT_SET_COUNTER select HAS_PERIPH_TIMER_PERIODIC + select HAS_PERIPH_RTT_OVERFLOW select HAS_PERIPH_WDT select HAS_PUF_SRAM diff --git a/cpu/atmega_common/Makefile.features b/cpu/atmega_common/Makefile.features index 7b58b012bd..5303f12db8 100644 --- a/cpu/atmega_common/Makefile.features +++ b/cpu/atmega_common/Makefile.features @@ -12,6 +12,7 @@ FEATURES_PROVIDED += periph_gpio periph_gpio_irq FEATURES_PROVIDED += periph_pm FEATURES_PROVIDED += periph_rtt_set_counter FEATURES_PROVIDED += periph_timer_periodic +FEATURES_PROVIDED += periph_rtt_overflow FEATURES_PROVIDED += periph_wdt FEATURES_PROVIDED += puf_sram diff --git a/cpu/cc2538/Kconfig b/cpu/cc2538/Kconfig index c60d306680..104746b8d7 100644 --- a/cpu/cc2538/Kconfig +++ b/cpu/cc2538/Kconfig @@ -19,6 +19,7 @@ config CPU_FAM_CC2538 select HAS_PERIPH_RTT_SET_COUNTER select HAS_PERIPH_UART_MODECFG select HAS_PERIPH_UART_NONBLOCKING + select HAS_PERIPH_RTT_OVERFLOW select HAS_PERIPH_WDT ## CPU Models diff --git a/cpu/cc2538/Makefile.features b/cpu/cc2538/Makefile.features index cafaf3ec9a..0fd7200a4f 100644 --- a/cpu/cc2538/Makefile.features +++ b/cpu/cc2538/Makefile.features @@ -9,6 +9,7 @@ FEATURES_PROVIDED += periph_hwrng FEATURES_PROVIDED += periph_rtt_set_counter FEATURES_PROVIDED += periph_uart_modecfg FEATURES_PROVIDED += periph_uart_nonblocking +FEATURES_PROVIDED += periph_rtt_overflow FEATURES_PROVIDED += periph_wdt FEATURES_PROVIDED += cortexm_mpu diff --git a/cpu/efm32/Kconfig b/cpu/efm32/Kconfig index b807643e82..44a5f2a59b 100644 --- a/cpu/efm32/Kconfig +++ b/cpu/efm32/Kconfig @@ -14,6 +14,7 @@ config CPU_COMMON_EFM32 select HAS_PERIPH_GPIO select HAS_PERIPH_GPIO_IRQ select HAS_PERIPH_RTT_SET_COUNTER + select HAS_PERIPH_RTT_OVERFLOW select HAS_PERIPH_WDT config CPU_EFM32_SERIES0 diff --git a/cpu/efm32/Makefile.features b/cpu/efm32/Makefile.features index 2f6363f8f9..2d182abfda 100644 --- a/cpu/efm32/Makefile.features +++ b/cpu/efm32/Makefile.features @@ -14,6 +14,7 @@ FEATURES_PROVIDED += periph_flashpage FEATURES_PROVIDED += periph_flashpage_pagewise FEATURES_PROVIDED += periph_gpio periph_gpio_irq FEATURES_PROVIDED += periph_rtt_set_counter +FEATURES_PROVIDED += periph_rtt_overflow FEATURES_PROVIDED += periph_wdt FEATURES_CONFLICT += periph_rtc:periph_rtt diff --git a/cpu/esp32/Kconfig b/cpu/esp32/Kconfig index e3c15435df..0ad815e2a0 100644 --- a/cpu/esp32/Kconfig +++ b/cpu/esp32/Kconfig @@ -19,6 +19,7 @@ config CPU_FAM_ESP32 select HAS_PERIPH_RTC select HAS_PERIPH_RTT select HAS_PERIPH_RTT_SET_COUNTER + select HAS_PERIPH_RTT_OVERFLOW ## CPU Models config CPU_MODEL_ESP32_WROOM_32 diff --git a/cpu/esp32/Makefile.features b/cpu/esp32/Makefile.features index 699f7b2126..a2b3f037b3 100644 --- a/cpu/esp32/Makefile.features +++ b/cpu/esp32/Makefile.features @@ -10,3 +10,4 @@ FEATURES_PROVIDED += periph_adc_ctrl FEATURES_PROVIDED += periph_rtc FEATURES_PROVIDED += periph_rtt FEATURES_PROVIDED += periph_rtt_set_counter +FEATURES_PROVIDED += periph_rtt_overflow diff --git a/cpu/esp8266/Kconfig b/cpu/esp8266/Kconfig index f04a07cc21..261e7fb25b 100644 --- a/cpu/esp8266/Kconfig +++ b/cpu/esp8266/Kconfig @@ -16,6 +16,7 @@ config CPU_FAM_ESP8266 select HAS_CPU_ESP8266 select HAS_PERIPH_RTC select HAS_PERIPH_RTT + select HAS_PERIPH_RTT_OVERFLOW select HAS_PERIPH_RTT_SET_COUNTER ## CPU Models diff --git a/cpu/esp8266/Makefile.features b/cpu/esp8266/Makefile.features index a927f8502e..02e6197daa 100644 --- a/cpu/esp8266/Makefile.features +++ b/cpu/esp8266/Makefile.features @@ -7,4 +7,5 @@ include $(RIOTCPU)/esp_common/Makefile.features FEATURES_PROVIDED += arch_esp8266 FEATURES_PROVIDED += periph_rtt FEATURES_PROVIDED += periph_rtc +FEATURES_PROVIDED += periph_rtt_overflow FEATURES_PROVIDED += periph_rtt_set_counter diff --git a/cpu/fe310/Kconfig b/cpu/fe310/Kconfig index a768f0161d..f4db3d974f 100644 --- a/cpu/fe310/Kconfig +++ b/cpu/fe310/Kconfig @@ -13,6 +13,7 @@ config CPU_FAM_FE310 select HAS_PERIPH_GPIO select HAS_PERIPH_GPIO_IRQ select HAS_PERIPH_PM + select HAS_PERIPH_RTT_OVERFLOW select HAS_PERIPH_RTT_SET_COUNTER select HAS_PERIPH_WDT diff --git a/cpu/fe310/Makefile.features b/cpu/fe310/Makefile.features index 0d8c7eca27..f7d14f0f5d 100644 --- a/cpu/fe310/Makefile.features +++ b/cpu/fe310/Makefile.features @@ -1,6 +1,7 @@ FEATURES_PROVIDED += periph_cpuid FEATURES_PROVIDED += periph_gpio periph_gpio_irq FEATURES_PROVIDED += periph_pm +FEATURES_PROVIDED += periph_rtt_overflow FEATURES_PROVIDED += periph_rtt_set_counter FEATURES_PROVIDED += periph_wdt diff --git a/cpu/kinetis/Kconfig b/cpu/kinetis/Kconfig index 8ba10bbc46..40dba05140 100644 --- a/cpu/kinetis/Kconfig +++ b/cpu/kinetis/Kconfig @@ -12,6 +12,7 @@ config CPU_COMMON_KINETIS select HAS_PERIPH_GPIO_IRQ select HAS_PERIPH_PM select HAS_PERIPH_RTT_SET_COUNTER + select HAS_PERIPH_RTT_OVERFLOW config CPU_FAM_EA bool diff --git a/cpu/kinetis/Makefile.features b/cpu/kinetis/Makefile.features index 853bb78bb5..70fb8b87ea 100644 --- a/cpu/kinetis/Makefile.features +++ b/cpu/kinetis/Makefile.features @@ -15,6 +15,7 @@ endif FEATURES_PROVIDED += periph_gpio FEATURES_PROVIDED += periph_gpio_irq FEATURES_PROVIDED += periph_rtt_set_counter +FEATURES_PROVIDED += periph_rtt_overflow # Parse parameters from CPU_MODEL using the kinetis-info.mk script in the same # directory as this Makefile. diff --git a/cpu/nrf5x_common/Kconfig b/cpu/nrf5x_common/Kconfig index 15322b17bf..df6ec6e8bd 100644 --- a/cpu/nrf5x_common/Kconfig +++ b/cpu/nrf5x_common/Kconfig @@ -15,6 +15,7 @@ config CPU_COMMON_NRF5X select HAS_PERIPH_HWRNG select HAS_PERIPH_TEMPERATURE select HAS_PERIPH_TIMER_PERIODIC + select HAS_PERIPH_RTT_OVERFLOW select HAS_PERIPH_UART_MODECFG select HAS_PERIPH_WDT select HAS_PERIPH_WDT_CB diff --git a/cpu/nrf5x_common/Makefile.features b/cpu/nrf5x_common/Makefile.features index 30f8cf3aa7..ae38490add 100644 --- a/cpu/nrf5x_common/Makefile.features +++ b/cpu/nrf5x_common/Makefile.features @@ -6,6 +6,7 @@ FEATURES_PROVIDED += periph_gpio periph_gpio_irq FEATURES_PROVIDED += periph_hwrng FEATURES_PROVIDED += periph_temperature FEATURES_PROVIDED += periph_timer_periodic +FEATURES_PROVIDED += periph_rtt_overflow FEATURES_PROVIDED += periph_uart_modecfg FEATURES_PROVIDED += periph_wdt periph_wdt_cb diff --git a/cpu/sam0_common/Kconfig b/cpu/sam0_common/Kconfig index 24942c4cdb..cb0248f79c 100644 --- a/cpu/sam0_common/Kconfig +++ b/cpu/sam0_common/Kconfig @@ -15,6 +15,7 @@ config CPU_COMMON_SAM0 select HAS_PERIPH_GPIO_IRQ select HAS_PERIPH_I2C_RECONFIGURE select HAS_PERIPH_RTT_SET_COUNTER + select HAS_PERIPH_RTT_OVERFLOW select HAS_PERIPH_SPI_RECONFIGURE select HAS_PERIPH_TIMER_PERIODIC select HAS_PERIPH_UART_MODECFG diff --git a/cpu/sam0_common/Makefile.features b/cpu/sam0_common/Makefile.features index 51d75bdd26..49a6e245e9 100644 --- a/cpu/sam0_common/Makefile.features +++ b/cpu/sam0_common/Makefile.features @@ -13,6 +13,7 @@ FEATURES_PROVIDED += periph_flashpage_rwee FEATURES_PROVIDED += periph_gpio periph_gpio_irq FEATURES_PROVIDED += periph_i2c_reconfigure FEATURES_PROVIDED += periph_rtt_set_counter +FEATURES_PROVIDED += periph_rtt_overflow FEATURES_PROVIDED += periph_spi_reconfigure FEATURES_PROVIDED += periph_timer_periodic # implements timer_set_periodic() FEATURES_PROVIDED += periph_uart_modecfg diff --git a/cpu/stm32/Kconfig b/cpu/stm32/Kconfig index 653249abe9..16572c18dc 100644 --- a/cpu/stm32/Kconfig +++ b/cpu/stm32/Kconfig @@ -12,6 +12,7 @@ config CPU_STM32 select HAS_PERIPH_GPIO select HAS_PERIPH_GPIO_IRQ select HAS_PERIPH_TIMER_PERIODIC + select HAS_PERIPH_RTT_OVERFLOW select HAS_PERIPH_UART_MODECFG select HAS_PERIPH_UART_NONBLOCKING diff --git a/cpu/stm32/Makefile.features b/cpu/stm32/Makefile.features index 2dae21cef1..bcb562bec4 100644 --- a/cpu/stm32/Makefile.features +++ b/cpu/stm32/Makefile.features @@ -8,6 +8,7 @@ FEATURES_PROVIDED += cpu_stm32$(CPU_FAM) FEATURES_PROVIDED += periph_cpuid FEATURES_PROVIDED += periph_gpio periph_gpio_irq FEATURES_PROVIDED += periph_timer_periodic +FEATURES_PROVIDED += periph_rtt_overflow FEATURES_PROVIDED += periph_uart_modecfg FEATURES_PROVIDED += periph_uart_nonblocking diff --git a/kconfigs/Kconfig.features b/kconfigs/Kconfig.features index 99c394b361..f7acc8e560 100644 --- a/kconfigs/Kconfig.features +++ b/kconfigs/Kconfig.features @@ -262,6 +262,11 @@ config HAS_PERIPH_RTT_SET_COUNTER help Indicates that the RTT peripheral implements rtt_set_counter(). +config HAS_PERIPH_RTT_OVERFLOW + bool + help + Indicates that the RTT provides an overflow callback. + config HAS_PERIPH_SPI bool help