zephyr/drivers/ieee802154/Kconfig.cc1200
Ulf Magnusson ec3eff57e0 Kconfig: Use the first default with a satisfied condition
Up until now, Zephyr has patched Kconfig to use the last 'default' with
a satisfied condition, instead of the first one. I'm not sure why the
patch was added (it predates Kconfiglib), but I suspect it's related to
Kconfig.defconfig files.

There are at least three problems with the patch:

  1. It's inconsistent with how Kconfig works in other projects, which
     might confuse newcomers.

  2. Due to oversights, earlier 'range' properties are still preferred,
     as well as earlier 'default' properties on choices.

     In addition to being inconsistent, this makes it impossible to
     override 'range' properties and choice 'default' properties if the
     base definition of the symbol/choice already has 'range'/'default'
     properties.

     I've seen errors caused by the inconsistency, and I suspect there
     are more.

  3. A fork of Kconfiglib that adds the patch needs to be maintained.

Get rid of the patch and go back to standard Kconfig behavior, as
follows:

  1. Include the Kconfig.defconfig files first instead of last in
     Kconfig.zephyr.

  2. Include boards/Kconfig and arch/<arch>/Kconfig first instead of
     last in arch/Kconfig.

  3. Include arch/<arch>/soc/*/Kconfig first instead of last in
     arch/<arch>/Kconfig.

  4. Swap a few other 'source's to preserve behavior for some scattered
     symbols with multiple definitions.

     Swap 'source's in some no-op cases too, where it might match the
     intent.

  5. Reverse the defaults on symbol definitions that have more than one
     default.

     Skip defaults that are mutually exclusive, e.g. where each default
     has an 'if <some board>' condition. They are already safe.

  6. Remove the prefer-later-defaults patch from Kconfiglib.

Testing was done with a Python script that lists all Kconfig
symbols/choices with multiple defaults, along with a whitelist of fixed
symbols. The script also verifies that there are no "unreachable"
defaults hidden by defaults without conditions

As an additional test, zephyr/.config was generated before and after the
change for several samples and checked to be identical (after sorting).

This commit includes some default-related cleanups as well:

  - Simplify some symbol definitions, e.g. where a default has 'if FOO'
    when the symbol already has 'depends on FOO'.

  - Remove some redundant 'default ""' for string symbols. This is the
    implicit default.

Piggyback fixes for swapped ranges on BT_L2CAP_RX_MTU and
BT_L2CAP_TX_MTU (caused by confusing inconsistency).

Piggyback some fixes for style nits too, e.g. unindented help texts.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-10 12:38:28 -07:00

184 lines
4.7 KiB
Plaintext

# Kconfig.cc1200 - TI CC1200 configuration options
#
menuconfig IEEE802154_CC1200
bool "TI CC1200 Driver support"
depends on NETWORKING
select NET_L2_IEEE802154_SUB_GHZ
if IEEE802154_CC1200
config IEEE802154_CC1200_DRV_NAME
string "TI CC1200 Driver's name"
default "cc1200"
help
This option sets the driver name
config IEEE802154_CC1200_SPI_DRV_NAME
string "SPI driver's name to use to access CC1200"
help
This option is mandatory to set which SPI controller to use in order
to actually control the CC1200 chip.
config IEEE802154_CC1200_SPI_FREQ
int "SPI system frequency"
default 0
help
This option sets the SPI controller's frequency. Beware this value
depends on the SPI controller being used and also on the system
clock.
config IEEE802154_CC1200_SPI_SLAVE
int "SPI slave linked to CC1200"
default 0
help
This option sets the SPI slave number SPI controller has to switch
to when dealing with CC1200 chip.
config IEEE802154_CC1200_GPIO_SPI_CS
bool "Manage SPI CS through a GPIO pin"
help
This option is useful if one needs to manage SPI CS through a GPIO
pin to by-pass the SPI controller's CS logic.
config IEEE802154_CC1200_GPIO_SPI_CS_DRV_NAME
string "GPIO driver's name to use to drive SPI CS through"
depends on IEEE802154_CC1200_GPIO_SPI_CS
help
This option is mandatory to set which GPIO controller to use in order
to actually emulate the SPI CS.
config IEEE802154_CC1200_GPIO_SPI_CS_PIN
int "GPIO PIN to use to drive SPI CS through"
default 0
depends on IEEE802154_CC1200_GPIO_SPI_CS
help
This option is mandatory to set which GPIO pin to use in order
to actually emulate the SPI CS.
config IEEE802154_CC1200_RX_STACK_SIZE
int "Driver's internal RX thread stack size"
default 800
help
This option sets the driver's stack size for its internal RX thread.
The default value should be sufficient, but in case it proves to be
a too little one, this option makes it easy to play with the size.
config IEEE802154_CC1200_INIT_PRIO
int "CC1200 initialization priority"
default 80
help
Set the initialization priority number. Do not mess with it unless
you know what you are doing. Beware cc1200 requires gpio and spi to
be ready first (and sometime gpio should be the very first as spi
might need it too). And of course it has to start before the net stack.
config IEEE802154_CC1200_RANDOM_MAC
bool "Random MAC address"
default y
help
Generate a random MAC address dynamically.
if ! IEEE802154_CC1200_RANDOM_MAC
config IEEE802154_CC1200_MAC4
hex "MAC Address Byte 4"
default 0
range 0 0xff
help
This is the byte 4 of the MAC address.
config IEEE802154_CC1200_MAC5
hex "MAC Address Byte 5"
default 0
range 0 0xff
help
This is the byte 5 of the MAC address.
config IEEE802154_CC1200_MAC6
hex "MAC Address Byte 6"
default 0
range 0 0xff
help
This is the byte 6 of the MAC address.
config IEEE802154_CC1200_MAC7
hex "MAC Address Byte 7"
default 0
range 0 0xff
help
This is the byte 7 of the MAC address.
endif # IEEE802154_CC1200_RANDOM_MAC
config IEEE802154_CC1200_XOSC
int "Value of the Crystal oscillator in kHz"
default 40000
help
This sets the XOSC value, it must be between 38400 and 40000.
This value should follow what has been set in the RF settings via
SmartRF tool. Do not touch this unless you know what you are doing.
config IEEE802154_CC1200_RF_PRESET
bool "Use TI CC1200 RF pre-sets"
default y
choice
prompt "TI CC1200 RF preset"
default IEEE802154_CC1200_RF_SET_0
depends on IEEE802154_CC1200_RF_PRESET
help
Set the RF preset you want to use.
config IEEE802154_CC1200_RF_SET_0
bool "868MHz - 50Kbps - 2-GFSK - IEEE 802.15.4g compliant - ETSI"
config IEEE802154_CC1200_RF_SET_1
bool "920MHz - 50Kbps - 2-GFSK - IEEE 802.15.4g compliant - ARIB"
config IEEE802154_CC1200_RF_SET_2
bool "434MHz - 50Kbps - 2-GFSK - IEEE 802.15.4g compliant - ETSI"
endchoice
config IEEE802154_CC1200_CCA_THRESHOLD
int "Value in dbm of the CCA threshold"
default -91
help
Set the CCA threshold. See datasheet's AGC_CS_THR register for
more information. Do not touch this unless you know what you are doing.
config IEEE802154_CC1200_RSSI_OFFSET
int "Value in dbm of the RSSI offset"
default -81
help
Set the gain adjustment. See datasheet's AGC_GAIN_ADJUST register for
more information. Do not touch this unless you know what you are doing.
# Do no touch below settings unless you know what you are doing
config IEEE802154_CC1200_SETTLING_CFG
hex
default 0x03
config IEEE802154_CC1200_PKTCFG0
hex
default 0x20
config IEEE802154_CC1200_PKTCFG1
hex
default 0x03
config IEEE802154_CC1200_PKTCFG2
hex
default 0x00
config IEEE802154_CC1200_RFEND_CFG1
hex
default 0x3F
config IEEE802154_CC1200_RFEND_CFG0
hex
default 0x00
endif # IEEE802154_CC1200