diff --git a/examples/twr_aloha/app.config.test b/examples/twr_aloha/app.config.test new file mode 100644 index 000000000000..ada0fffae12c --- /dev/null +++ b/examples/twr_aloha/app.config.test @@ -0,0 +1,12 @@ +CONFIG_PACKAGE_UWB-CORE=y +CONFIG_PACKAGE_UWB-DW1000=y +CONFIG_MODULE_UWB-CORE_TWR_SS=y +CONFIG_MODULE_UWB-CORE_TWR_SS_ACK=y +CONFIG_MODULE_UWB-CORE_TWR_SS_EXT=y +CONFIG_MODULE_UWB-CORE_TWR_DS=y +CONFIG_MODULE_UWB-CORE_TWR_DS_EXT=y +CONFIG_MODULE_SHELL=y +CONFIG_MODULE_PS=y +CONFIG_MODULE_SHELL_COMMANDS=y +CONFIG_MODULE_ZTIMER=y +CONFIG_MODULE_ZTIMER_USEC=y diff --git a/pkg/Kconfig b/pkg/Kconfig index 04a9f4999666..ed769acc0ee6 100644 --- a/pkg/Kconfig +++ b/pkg/Kconfig @@ -28,6 +28,7 @@ rsource "micro-ecc/Kconfig" rsource "microcoap/Kconfig" rsource "minmea/Kconfig" rsource "monocypher/Kconfig" +rsource "mynewt-core/Kconfig" rsource "nanocbor/Kconfig" rsource "nanopb/Kconfig" rsource "qcbor/Kconfig" @@ -47,6 +48,8 @@ rsource "ubasic/Kconfig" rsource "ucglib/Kconfig" rsource "umorse/Kconfig" rsource "utensor/Kconfig" +rsource "uwb-core/Kconfig" +rsource "uwb-dw1000/Kconfig" rsource "wakaama/Kconfig" rsource "yxml/Kconfig" diff --git a/pkg/mynewt-core/Kconfig b/pkg/mynewt-core/Kconfig new file mode 100644 index 000000000000..11fc88a87c06 --- /dev/null +++ b/pkg/mynewt-core/Kconfig @@ -0,0 +1,41 @@ +# Copyright (c) 2021 INRIA +# +# 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 PACKAGE_MYNEWT-CORE + bool "Apache MyNewt mynewt-core Package" + depends on TEST_KCONFIG + select MODULE_MYNEWT-CORE + select MODULE_SEMA + select MODULE_ZTIMER + select MODULE_ZTIMER_MSEC + select MODULE_EVENT + select MODULE_EVENT_CALLBACK + depends on HAS_PERIPH_GPIO + select MODULE_PERIPH_GPIO + depends on !HAS_ARCH_ESP + + +if PACKAGE_MYNEWT-CORE + +config MODULE_MYNEWT-CORE + bool + +config MODULE_AUTO_INIT_MYNEWT-CORE + bool "Auto-initialize the mynewt-core package" + default y + depends on MODULE_AUTO_INIT + +config MODULE_MYNEWT-CORE_OS + bool "mynewt-core kernel module" + +config MODULE_MYNEWT-CORE_UTIL + bool "mynewt-core utilities modules" + +config MODULE_MYNEWT-CORE_NRF5X_HAL + bool "mynewt-core nrf52 and nrf51 timer hal" + +endif # PACKAGE_MYNEWT-CORE diff --git a/pkg/mynewt-core/Makefile.dep b/pkg/mynewt-core/Makefile.dep index 31480b59b3f3..8131c0359511 100644 --- a/pkg/mynewt-core/Makefile.dep +++ b/pkg/mynewt-core/Makefile.dep @@ -1,17 +1,9 @@ USEMODULE += event_callback USEMODULE += sema -USEMODULE += ztimer USEMODULE += ztimer_msec - USEMODULE += mynewt-core DEFAULT_MODULE += auto_init_mynewt-core -# MyNewt `os_hw_is_in_critical` function needs to know whether ISR are masked -# of if the function is being called in ISR context. There is no such function -# in RIOT except for arm (__get_PRIMASK), therefore unless a similar function -# is provided for other arch, this port is currently only enabled for those arch. -# Note: that this should not be a hindrance since nimble only works on nordic -# and uwb-core breakouts are all arm. -FEATURES_REQUIRED += arch_arm -FEATURES_BLACKLIST += arch_arm7 +# esp frequency is not pow2 so is incompatible with os_cputime +FEATURES_BLACKLIST += arch_esp diff --git a/pkg/mynewt-core/include/os/os.h b/pkg/mynewt-core/include/os/os.h index e39c1e81ace3..0de55584df3f 100644 --- a/pkg/mynewt-core/include/os/os.h +++ b/pkg/mynewt-core/include/os/os.h @@ -117,7 +117,7 @@ static inline void os_hw_exit_critical(uint32_t ctx) */ static inline bool os_hw_is_in_critical(void) { - return (irq_is_in() || __get_PRIMASK()); + return (irq_is_in() || !irq_is_enabled()); } /* Mynewt components (not abstracted in NPL or DPL) */ diff --git a/pkg/uwb-core/Kconfig b/pkg/uwb-core/Kconfig new file mode 100644 index 000000000000..13d69aa280d9 --- /dev/null +++ b/pkg/uwb-core/Kconfig @@ -0,0 +1,80 @@ +# Copyright (c) 2021 INRIA +# +# 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 PACKAGE_UWB-CORE + bool "Decawave uwb-core package" + select MODULE_UWB-CORE_DPL + select MODULE_UWB-CORE_CONTRIB + select MODULE_FMT + depends on HAS_PERIPH_GPIO + select MODULE_PERIPH_GPIO + depends on HAS_PERIPH_GPIO_IRQ + select MODULE_PERIPH_GPIO_IRQ + depends on HAS_PERIPH_SPI + select MODULE_PERIPH_SPI + depends on !HAS_ARCH_NATIVE + depends on !HAS_ARCH_AVR8 + +if PACKAGE_UWB-CORE + +config MODULE_AUTO_INIT_UWB-CORE + bool "Auto-initialize the usb-core package" + default y + depends on MODULE_AUTO_INIT + +config MODULE_UWB-CORE_CONTRIB + bool + +config MODULE_UWB-CORE_DPL + bool + select PACKAGE_MYNEWT-CORE + select MODULE_MYNEWT-CORE_OS + select MODULE_MYNEWT-CORE_NRF5X_HAL if HAS_CPU_NRF52 || HAS_CPU_NRF51 + +config MODULE_UWB-CORE_TWR_SS + bool "uwb-core two-way-ranging single sided" + select MODULE_UWB-CORE_RNG + +config MODULE_UWB-CORE_TWR_SS_ACK + bool "uwb-core two-way-ranging single sided using hardware generated ack as response" + select MODULE_UWB-CORE_RNG + +config MODULE_UWB-CORE_TWR_SS_EXT + bool "uwb-core two-way-ranging single sided with extended frames" + select MODULE_UWB-CORE_RNG + +config MODULE_UWB-CORE_TWR_DS + bool "uwb-core two-way-ranging double sided" + select MODULE_UWB-CORE_RNG + +config MODULE_UWB-CORE_TWR_DS_EXT + bool "uwb-core two-way-ranging double sided with extended frames" + select MODULE_UWB-CORE_RNG + +config MODULE_UWB-CORE_RNG + bool "uwb-core ranging module" + select MODULE_UWB-CORE_RNG_MATH + select MODULE_UWB-CORE_DSP + select MODULE_UWB-CORE_UWB_JSON + +config MODULE_UWB-CORE_UWB_JSON + bool "uwb-core JSON utilities" + +config MODULE_UWB-CORE_DSP + bool "uwb-core DSP module" + +config MODULE_UWB-CORE_RNG_MATH + bool "uwb-core ranging math utilities" + +config MODULE_UWB-CORE_UWBCFG + bool "uwb-core configuration module" + select MODULE_UWB-CORE_CONFIG + +config MODULE_UWB-CORE_CONFIG + bool + +endif # PACKAGE_UWB-CORE diff --git a/pkg/uwb-dw1000/Kconfig b/pkg/uwb-dw1000/Kconfig new file mode 100644 index 000000000000..539e7d9a1890 --- /dev/null +++ b/pkg/uwb-dw1000/Kconfig @@ -0,0 +1,29 @@ +# Copyright (c) 2021 INRIA +# +# 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 PACKAGE_UWB-DW1000 + bool "Decawave dw1000 driver package" + select MODULE_UWB-DW1000_HAL + depends on HAS_PERIPH_GPIO + select MODULE_PERIPH_GPIO + depends on HAS_PERIPH_GPIO_IRQ + select MODULE_PERIPH_GPIO_IRQ + depends on HAS_PERIPH_SPI + select MODULE_PERIPH_SPI + depends on HAS_ARCH_32BIT + +if PACKAGE_UWB-DW1000 + +config MODULE_AUTO_INIT_UWB-DW1000 + bool "Auto-initialize the uwb-dw1000 package" + default y + depends on MODULE_AUTO_INIT + +config MODULE_UWB-DW1000_HAL + bool + +endif # PACKAGE_UWB-DW1000 diff --git a/sys/sema/Kconfig b/sys/sema/Kconfig index 49b7e903f544..c05c224fd151 100644 --- a/sys/sema/Kconfig +++ b/sys/sema/Kconfig @@ -8,4 +8,4 @@ config MODULE_SEMA bool "Semaphore" depends on TEST_KCONFIG - select MODULE_XTIMER + depends on MODULE_XTIMER || MODULE_ZTIMER