From 4ac0025c84d4c0a88cdfee534bd0d2ac43165c20 Mon Sep 17 00:00:00 2001 From: Leandro Lanzieri Date: Wed, 9 Mar 2022 09:11:27 +0100 Subject: [PATCH] drivers/at86rf215: model Kconfig --- drivers/at86rf215/Kconfig | 446 +++++++++++++++++++++++++------------- 1 file changed, 300 insertions(+), 146 deletions(-) diff --git a/drivers/at86rf215/Kconfig b/drivers/at86rf215/Kconfig index 8a2d2458a9..bdbe60810a 100644 --- a/drivers/at86rf215/Kconfig +++ b/drivers/at86rf215/Kconfig @@ -1,127 +1,74 @@ # Copyright (c) 2020 Freie Universitaet Berlin +# 2022 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_USEMODULE_AT86RF215 - bool "Configure AT86RF215 driver" - depends on USEMODULE_AT86RF215 - help - Configure the AT86RF215 driver using Kconfig. -if KCONFIG_USEMODULE_AT86RF215 +menuconfig MODULE_AT86RF215 + bool + prompt "AT86RF215 radio" if !(HAVE_AT86RF215 && MODULE_NETDEV_DEFAULT) + default (HAVE_AT86RF215 && MODULE_NETDEV_DEFAULT) + depends on TEST_KCONFIG + depends on HAS_PERIPH_GPIO + depends on HAS_PERIPH_GPIO_IRQ + depends on HAS_PERIPH_SPI + select MODULE_NETDEV + select MODULE_NETDEV_IEEE802154 + select MODULE_PERIPH_GPIO + select MODULE_PERIPH_GPIO_IRQ + select MODULE_PERIPH_SPI + select MODULE_XTIMER -menuconfig KCONFIG_USEMODULE_AT86RF215_BATMON - bool "AT86RF215 Battery Monitor" - depends on USEMODULE_AT86RF215 - help - Configure the AT86RF215 battery monitor using Kconfig. +if MODULE_AT86RF215 -config AT86RF215_BATMON_THRESHOLD - int "Treshold voltage (in mV) of the battery monitor" - range 1700 3675 - default 1800 - depends on KCONFIG_USEMODULE_AT86RF215_BATMON - help - If the supply voltage falls below the configured threshold - a SYS_BUS_POWER_EVENT_LOW_VOLTAGE event is generated on the - SYS_BUS_POWER bus. +menu "Modulations" - Battery Monitoring is disabled when the device is in Deep Sleep. +menuconfig AT86RF215_OQPSK + bool "O-QPSK support" + select MODULE_NETDEV_IEEE802154_OQPSK + default y -config AT86RF215_USE_CLOCK_OUTPUT - bool "Enable clock output" - help - Enable this to enable the clock output pin of the AT86RF215 chip. - This way it can be used as a clock source in place of a separate crystal. - You also have to enable this if you want to measure the clock frequency - for trimming. After proper trim value is applied this may be disabled - if not used otherwise. - By Default it is turned off to save energy. - -config AT86RF215_TRIM_VAL_EN - bool "Enable crystal oscillator trimming" - help - Enable crystal oscillator trimming. - -config AT86RF215_RPC_EN - bool "Enable Reduced Power Consumption" - help - Reduce Power Consumption in RX IDLE by duty-cycling the RF circuitry. - -config AT86RF215_TRIM_VAL - int "Trim value for the crystal oscillator" - range 0 15 - default 0 - depends on AT86RF215_TRIM_VAL_EN - help - Each increment adds 300nF capacitance between the crystal oscillator pins - TCXO and XTAL2.Tweak the value until the measured clock output matches - 26 MHz the best. - For more information Refer Table 6-25 TRIM in Datasheet - -config AT86RF215_RESET_PULSE_WIDTH_US - int "Width of the reset pulse (µs)" - range 16 1000 - default 16 - help - If your board design includes a filtering capacitor on the reset line, this raises - the rise time of the reset pulse. - To accommodate for this, select a larger reset pulse width here. - - If unsure, leave this at the default value of 16 µs. +if AT86RF215_OQPSK choice - prompt "Default Modulation" - -config AT86RF215_DEFAULT_LEGACY_OQPSK - bool "legacy O-QPSK" - help - O-QPSK compatible with IEEE 802.15.4-2003 devices - -config AT86RF215_DEFAULT_MR_OQPSK - bool "MR-O-QPSK" - help - MR-O-QPSK according to IEEE 802.15.4g - -config AT86RF215_DEFAULT_MR_OFDM - bool "MR-OFDM" - help - MR-O-OFDM according to IEEE 802.15.4g - -config AT86RF215_DEFAULT_MR_FSK - bool "MR-FSK" - help - MR-FSK according to IEEE 802.15.4g - -endchoice - -menu "O-QPSK (802.15.4) configuration" - depends on AT86RF215_DEFAULT_LEGACY_OQPSK - -config AT86RF215_DEFAULT_OQPSK_RATE - int "Default (legacy) O-QPSK rate mode" - range 0 1 - default 0 + bool "Default (legacy) O-QPSK rate mode" + default AT86RF215_OQPSK_RATE_LOW help The at86rf215 supports proprietary high data rates that are compatible with the at86rf2xx parts. - Set this to 1 to configure the proprietary high-data rate option as default. - If unsure, leave this at 0. + If unsure, select low rate. -endmenu # legacy O-QPSK +config AT86RF215_OQPSK_RATE_LOW + bool "Low rate mode (compatible)" -menu "MR-O-QPSK (802.15.4g) configuration" - depends on AT86RF215_DEFAULT_MR_OQPSK +config AT86RF215_OQPSK_RATE_HIGH + bool "High rate mode (proprietary)" + +endchoice + +config AT86RF215_DEFAULT_OQPSK_RATE + int + default 0 if AT86RF215_OQPSK_RATE_LOW + default 1 if AT86RF215_OQPSK_RATE_HIGH + +endif # AT86RF215_OQPSK + +menuconfig AT86RF215_MR_OQPSK + bool "MR-O-QPSK support" + select MODULE_NETDEV_IEEE802154_MR_OQPSK + default y + +if AT86RF215_MR_OQPSK config AT86RF215_DEFAULT_MR_OQPSK_RATE int "Default MR-O-QPSK rate mode" range 0 3 default 2 help - Default Rate Mode of the MR-O-QPSK PHY - Each increment doubles the PSDU data rate. + Default Rate Mode of the MR-O-QPSK PHY. Each increment doubles the PSDU + data rate. choice prompt "Default MR-O-QPSK Chip Rate" @@ -140,10 +87,14 @@ config AT86RF215_DEFAULT_MR_OQPSK_CHIPS_2000 endchoice -endmenu # MR-O-QPSK +endif # AT86RF215_MR_OQPSK -menu "MR-OFDM (802.15.4g) configuration" - depends on AT86RF215_DEFAULT_MR_OFDM +menuconfig AT86RF215_MR_OFDM + bool "MR-OFDM support" + select MODULE_NETDEV_IEEE802154_MR_OFDM + default y + +if AT86RF215_MR_OFDM config AT86RF215_DEFAULT_MR_OFDM_OPT int "Default MR-OFDM option" @@ -153,40 +104,89 @@ config AT86RF215_DEFAULT_MR_OFDM_OPT Default Option of the MR-OFDM PHY Each increment halves the PSDU data rate. -config AT86RF215_DEFAULT_MR_OFDM_MCS - int "Default MR-OFDM Modulation & Coding Scheme" - range 0 6 - default 2 +choice + bool "Default MR-OFDM Modulation & Coding Scheme" + default AT86RF215_MR_OFDM_MCS_QPSK_R12_FR2 help Default Modulation & Coding Scheme of the MR-OFDM PHY. Higher schemes correspond to higher data rates and lower range. - 0: BPSK, rate 1⁄2, 4 x frequency repetition - 1: BPSK, rate 1⁄2, 2 x frequency repetition - 2: QPSK, rate 1⁄2, 2 x frequency repetition - 3: QPSK, rate 1⁄2 - 4: QPSK, rate 3⁄4 - 5: 16-QAM, rate 1⁄2 - 6: 16-QAM, rate 3⁄4 +config AT86RF215_MR_OFDM_MCS_BPSK_R12_FR4 + bool "BPSK, rate 1⁄2, 4 x frequency repetition" -endmenu +config AT86RF215_MR_OFDM_MCS_BPSK_R12_FR2 + bool "BPSK, rate 1⁄2, 2 x frequency repetition" -menu "MR-FSK (802.15.4g) configuration" - depends on AT86RF215_DEFAULT_MR_FSK +config AT86RF215_MR_OFDM_MCS_QPSK_R12_FR2 + bool "QPSK, rate 1⁄2, 2 x frequency repetition" + +config AT86RF215_MR_OFDM_MCS_QPSK_R12_FR0 + bool "QPSK, rate 1⁄2" + +config AT86RF215_MR_OFDM_MCS_QPSK_R34_FR0 + bool "QPSK, rate 3⁄4" + +config AT86RF215_MR_OFDM_MCS_16QAM_R12_FR0 + bool "16-QAM, rate 1⁄2" + +config AT86RF215_MR_OFDM_MCS_16QAM_R34_FR0 + bool "16-QAM, rate 3⁄4" + +endchoice + +config AT86RF215_DEFAULT_MR_OFDM_MCS + int + default 0 if AT86RF215_MR_OFDM_MCS_BPSK_R12_FR4 + default 1 if AT86RF215_MR_OFDM_MCS_BPSK_R12_FR2 + default 2 if AT86RF215_MR_OFDM_MCS_QPSK_R12_FR2 + default 3 if AT86RF215_MR_OFDM_MCS_QPSK_R12_FR0 + default 4 if AT86RF215_MR_OFDM_MCS_QPSK_R34_FR0 + default 5 if AT86RF215_MR_OFDM_MCS_16QAM_R12_FR0 + default 6 if AT86RF215_MR_OFDM_MCS_16QAM_R34_FR0 + +endif # AT86RF215_MR_OFDM + +menuconfig AT86RF215_MR_FSK + bool "MR-FSK support" + select MODULE_NETDEV_IEEE802154_MR_FSK + default y + +if AT86RF215_MR_FSK + +choice + bool "Default MR-FSK Symbol Rate" + default AT86RF215_MR_FSK_SRATE_200K + help + Default Symbol Rate of the MR-FSK PHY. + +config AT86RF215_MR_FSK_SRATE_50K + bool "50 KHz" + +config AT86RF215_MR_FSK_SRATE_100K + bool "100 KHz" + +config AT86RF215_MR_FSK_SRATE_150K + bool "150 KHz" + +config AT86RF215_MR_FSK_SRATE_200K + bool "200 KHz" + +config AT86RF215_MR_FSK_SRATE_300K + bool "300 KHz" + +config AT86RF215_MR_FSK_SRATE_400K + bool "400 KHz" + +endchoice config AT86RF215_DEFAULT_MR_FSK_SRATE - int "Default MR-FSK Symbol Rate" - range 0 5 - default 3 - help - Default Symbol Rate of the MR-FSK PHY - - 0: 50 kHz - 1: 100 kHZ - 2: 150 kHZ - 3: 200 kHZ - 4: 300 kHZ - 5: 400 kHZ + int + default 0 if AT86RF215_MR_FSK_SRATE_50K + default 1 if AT86RF215_MR_FSK_SRATE_100K + default 2 if AT86RF215_MR_FSK_SRATE_150K + default 3 if AT86RF215_MR_FSK_SRATE_200K + default 4 if AT86RF215_MR_FSK_SRATE_300K + default 5 if AT86RF215_MR_FSK_SRATE_400K config AT86RF215_DEFAULT_MR_FSK_MOD_IDX int "Default MR-FSK Modulation Index" @@ -196,27 +196,181 @@ config AT86RF215_DEFAULT_MR_FSK_MOD_IDX Default Modulation Index of the MR-FSK PHY as a fraction of 64. (32/64 = 0.5; 64/64 = 1 …) -config AT86RF215_DEFAULT_MR_FSK_MORD - int "Default MR-FSK Modulation Order" - range 0 1 - default 1 - help - Default FSK Modulation Order +choice + bool "Default MR-FSK Modulation Order" + default AT86RF215_MR_FSK_MORD_4 - 0: 2-FSK - 1: 4-FSk +config AT86RF215_MR_FSK_MORD_4 + bool "2-FSK" + +config AT86RF215_MR_FSK_MORD_4 + bool "4-FSK" + +endchoice + +config AT86RF215_DEFAULT_MR_FSK_MORD + int + default 0 if AT86RF215_MR_FSK_MORD_4 + default 1 if AT86RF215_MR_FSK_MORD_4 + +choice + bool "Default MR-FSK Forward Error Correction Scheme" + default AT86RF215_MR_FSK_FEC_NONE + +config AT86RF215_MR_FSK_FEC_NONE + bool "No forward error correction" + +config AT86RF215_MR_FSK_FEC_NRNS + bool "Non-recursive and non-systematic code" + +config AT86RF215_MR_FSK_FEC_RS + bool "Recursive and systematic code" + +endchoice config AT86RF215_DEFAULT_MR_FSK_FEC - int "Default MR-FSK Forward Error Correction Scheme" - range 0 2 - default 0 + int + default 0 if AT86RF215_MR_FSK_FEC_NONE + default 1 if AT86RF215_MR_FSK_FEC_NRNS + default 2 if AT86RF215_MR_FSK_FEC_RS + +endif # AT86RF215_MR_FSK + +choice + prompt "Default Modulation" + +config AT86RF215_DEFAULT_LEGACY_OQPSK + bool "legacy O-QPSK" + depends on AT86RF215_OQPSK help - Default Settings for Forward Error Correction + O-QPSK compatible with IEEE 802.15.4-2003 devices - 0: No Forward Error Correction - 1: Non-recursive and non-systematic code - 2: Recursive and systematic code +config AT86RF215_DEFAULT_MR_OQPSK + bool "MR-O-QPSK" + depends on AT86RF215_MR_OQPSK + help + MR-O-QPSK according to IEEE 802.15.4g -endmenu +config AT86RF215_DEFAULT_MR_OFDM + bool "MR-OFDM" + depends on AT86RF215_MR_OFDM + help + MR-O-OFDM according to IEEE 802.15.4g -endif # KCONFIG_USEMODULE_AT86RF215 +config AT86RF215_DEFAULT_MR_FSK + bool "MR-FSK" + depends on AT86RF215_MR_FSK + help + MR-FSK according to IEEE 802.15.4g + +endchoice + +endmenu # Modulations + +config MODULE_AUTO_INIT_AT86RF215 + bool "Auto-initialize the driver on startup" + depends on MODULE_AUTO_INIT + default y + +config MODULE_AT86RF215_BATMON + bool "Enable battery monitor" + select MODULE_SYS_BUS + select MODULE_SYS_BUS_POWER + +config AT86RF215_BATMON_THRESHOLD + int "Treshold voltage (in mV) of the battery monitor" + range 1700 3675 + default 1800 + depends on MODULE_AT86RF215_BATMON + help + If the supply voltage falls below the configured threshold + a SYS_BUS_POWER_EVENT_LOW_VOLTAGE event is generated on the + SYS_BUS_POWER bus. + + Battery Monitoring is disabled when the device is in Deep Sleep. + +config AT86RF215_USE_CLOCK_OUTPUT + bool "Enable clock output" + help + Enable this to enable the clock output pin of the AT86RF215 chip. + This way it can be used as a clock source in place of a separate crystal. + You also have to enable this if you want to measure the clock frequency + for trimming. After proper trim value is applied this may be disabled + if not used otherwise. + By Default it is turned off to save energy. + +menuconfig AT86RF215_TRIM_VAL_EN + bool "Enable crystal oscillator trimming" + help + Enable crystal oscillator trimming. + +config AT86RF215_TRIM_VAL + int "Trim value for the crystal oscillator" + range 0 15 + default 0 + depends on AT86RF215_TRIM_VAL_EN + help + Each increment adds 300nF capacitance between the crystal oscillator pins + TCXO and XTAL2.Tweak the value until the measured clock output matches + 26 MHz the best. + For more information Refer Table 6-25 TRIM in Datasheet + +config AT86RF215_RPC_EN + bool "Enable Reduced Power Consumption" + help + Reduce Power Consumption in RX IDLE by duty-cycling the RF circuitry. + +config MODULE_AT86RF215_TIMESTAMP + bool "Enable timestamp frame information" + +config MODULE_AT86RF215_BLOCKING_SEND + bool "Block while sending" + +config MODULE_AT86RF215_SUBGHZ + bool + prompt "Sub-GHz support" if !HAVE_AT86RF215M + default y + help + Sub-GHz support. + +config MODULE_AT86RF215_24GHZ + bool + prompt "2.4 GHz support" + default y + help + 2.4 GHz support. + +config AT86RF215_MULTIMODE + bool "Allow multiple physical layer modes" + default y + select MODULE_NETDEV_IEEE802154_MULTIMODE + +config AT86RF215_RESET_PULSE_WIDTH_US + int "Width of the reset pulse (µs)" + range 16 1000 + default 16 + help + If your board design includes a filtering capacitor on the reset line, this raises + the rise time of the reset pulse. + To accommodate for this, select a larger reset pulse width here. + + If unsure, leave this at the default value of 16 µs. + +endif # MODULE_AT86RF215 + +config HAVE_AT86RF215 + bool + help + Indicates that a AT86RF215 radio is present. + +config HAVE_AT86RF215IQ + bool + select HAVE_AT86RF215 + help + Indicates that a AT86RF215IQ radio is present. + +config HAVE_AT86RF215M + bool + select HAVE_AT86RF215 + help + Indicates that a AT86RF215IM radio is present.