1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/drivers/Makefile.dep
Marian Buschsieweke 276ad5716a
sys/net/gnrc/netif: allow checking if a netdev is legacy or new API
A if `netdev_driver_t::confirm_send()` is provided, it provides the
new netdev API. However, detecting the API at runtime and handling
both API styles comes at a cost. This can be optimized in case only
new or only old style netdevs are in use.

To do so, this adds the pseudo modules `netdev_legacy_api` and
`netdev_new_api`. As right now no netdev actually implements the new
API, all netdevs pull in `netdev_legacy_api`. If `netdev_legacy_api` is
in used but `netdev_new_api` is not, we can safely assume at compile
time that only legacy netdevs are in use. Similar, if only
`netdev_new_api` is used, only support for the new API is needed. Only
when both are in use, run time checks are needed.

This provides two helper function to check for a netif if the
corresponding netdev implements the old or the new API. (With one
being the inverse of the other.) They are suitable for constant folding
when only new or only legacy devices are in use. Consequently, dead
branches should be eliminated by the optimizer.
2022-08-17 12:56:07 +02:00

253 lines
5.1 KiB
Makefile

# driver pseudo-modules dependencies (in alphabetical order)
ifneq (,$(filter adc%1c,$(USEMODULE)))
USEMODULE += adcxx1c
endif
ifneq (,$(filter ads101%,$(USEMODULE)))
USEMODULE += ads101x
endif
ifneq (,$(filter apds99%,$(USEMODULE)))
USEMODULE += apds99xx
endif
ifneq (,$(filter at24c%,$(USEMODULE)))
USEMODULE += at24cxxx
endif
ifneq (,$(filter at86rf215%,$(USEMODULE)))
USEMODULE += at86rf215
endif
ifneq (,$(filter at86rf%, $(filter-out at86rf215%, $(USEMODULE))))
USEMODULE += at86rf2xx
endif
ifneq (,$(filter bme680_%,$(USEMODULE)))
USEMODULE += bme680
endif
ifneq (,$(filter bm%280_i2c,$(USEMODULE)))
USEMODULE += bmx280
endif
ifneq (,$(filter bm%280_spi,$(USEMODULE)))
USEMODULE += bmx280
endif
ifneq (,$(filter bq2429x_int,$(USEMODULE)))
USEMODULE += bq2429x
endif
ifneq (,$(filter cc110%,$(USEMODULE)))
USEMODULE += cc110x
endif
ifneq (,$(filter ccs811_%,$(USEMODULE)))
USEMODULE += ccs811
endif
ifneq (,$(filter ethos_%,$(USEMODULE)))
USEMODULE += ethos
endif
ifneq (,$(filter ft6% ft5% ft3%,$(USEMODULE)))
USEMODULE += ft5x06
endif
ifneq (,$(filter hmc5883l_%,$(USEMODULE)))
USEMODULE += hmc5883l
endif
ifneq (,$(filter hm330%,$(USEMODULE)))
USEMODULE += hm330x
endif
ifneq (,$(filter ina2%,$(USEMODULE)))
USEMODULE += ina2xx
endif
ifneq (,$(filter ina3221_%,$(USEMODULE)))
USEMODULE += ina3221
endif
ifneq (,$(filter itg320x_%,$(USEMODULE)))
USEMODULE += itg320x
endif
ifneq (,$(filter l3gxxxx_%,$(USEMODULE)))
USEMODULE += l3gxxxx
endif
ifneq (,$(filter lis2dh12%,$(USEMODULE)))
USEMODULE += lis2dh12
endif
ifneq (,$(filter llcc68,$(USEMODULE)))
USEMODULE += sx126x
endif
ifneq (,$(filter tmp1075 lm75%,$(USEMODULE)))
USEMODULE += lm75
endif
ifneq (,$(filter lps331ap lps2%,$(USEMODULE)))
USEMODULE += lpsxxx
endif
ifneq (,$(filter ltc4150_%,$(USEMODULE)))
USEMODULE += ltc4150
endif
ifneq (,$(filter mhz19_%,$(USEMODULE)))
USEMODULE += mhz19
endif
ifneq (,$(filter mpu9%50,$(USEMODULE)))
USEMODULE += mpu9x50
endif
ifneq (,$(filter mrf24j40m%,$(USEMODULE)))
USEMODULE += mrf24j40
endif
ifneq (,$(filter mtd_%,$(USEMODULE)))
USEMODULE += mtd
endif
# nrfmin is a concrete module but comes from cpu/nrf5x_common. Due to limitations
# in the dependency resolution mechanism it's not possible to move its
# dependency resolution at cpu level.
ifneq (,$(filter nrfmin,$(USEMODULE)))
FEATURES_REQUIRED += radio_nrfmin
FEATURES_REQUIRED += periph_cpuid
USEMODULE += netif
endif
ifneq (,$(filter nrf24l01p_ng_%,$(USEMODULE)))
USEMODULE += nrf24l01p_ng
endif
ifneq (,$(filter pcf857%,$(USEMODULE)))
USEMODULE += pcf857x
endif
ifneq (,$(filter periph_ptp_timer periph_ptp_speed_adjustment,$(FEATURES_USED)))
FEATURES_REQUIRED += periph_ptp
endif
ifneq (,$(filter pn532_i2c,$(USEMODULE)))
FEATURES_REQUIRED += periph_i2c
USEMODULE += pn532
endif
ifneq (,$(filter pn532_spi,$(USEMODULE)))
FEATURES_REQUIRED += periph_spi
USEMODULE += pn532
endif
ifneq (,$(filter qmc5883l_%,$(USEMODULE)))
USEMODULE += qmc5883l
endif
ifneq (,$(filter rn2%3,$(USEMODULE)))
USEMODULE += rn2xx3
endif
ifneq (,$(filter sdp3x_%,$(USEMODULE)))
USEMODULE += sdp3x
endif
ifneq (,$(filter sht1%,$(USEMODULE)))
USEMODULE += sht1x
endif
ifneq (,$(filter shtc%,$(USEMODULE)))
USEMODULE += shtcx
endif
ifneq (,$(filter si114%,$(USEMODULE)))
USEMODULE += si114x
endif
ifneq (,$(filter si70%,$(USEMODULE)))
USEMODULE += si70xx
endif
ifneq (,$(filter slipdev_%,$(USEMODULE)))
USEMODULE += slipdev
endif
ifneq (,$(filter stmpe811_%,$(USEMODULE)))
USEMODULE += stmpe811
endif
ifneq (,$(filter sx126%,$(USEMODULE)))
USEMODULE += sx126x
endif
ifneq (,$(filter sx127%,$(USEMODULE)))
USEMODULE += sx127x
endif
ifneq (,$(filter tmp00%,$(USEMODULE)))
USEMODULE += tmp00x
endif
ifneq (,$(filter vcnl40%0,$(USEMODULE)))
USEMODULE += vcnl40x0
endif
ifneq (,$(filter ws281x_%,$(USEMODULE)))
USEMODULE += ws281x
endif
ifneq (,$(filter saul_adc,$(USEMODULE)))
FEATURES_REQUIRED += periph_adc
endif
ifneq (,$(filter saul_gpio,$(USEMODULE)))
FEATURES_REQUIRED += periph_gpio
endif
ifneq (,$(filter saul_pwm,$(USEMODULE)))
FEATURES_REQUIRED += periph_pwm
endif
ifneq (,$(filter saul,$(USEMODULE)))
USEMODULE += phydat
endif
ifneq (,$(filter saul_nrf_temperature,$(USEMODULE)))
FEATURES_REQUIRED += periph_temperature
endif
# Enable periph_uart when periph_uart_nonblocking is enabled
ifneq (,$(filter periph_uart_nonblocking,$(USEMODULE)))
FEATURES_REQUIRED += periph_uart
endif
# Enable periph_gpio when periph_gpio_irq is enabled
ifneq (,$(filter periph_gpio_irq,$(USEMODULE)))
FEATURES_REQUIRED += periph_gpio
endif
ifneq (,$(filter periph_timer_periodic,$(USEMODULE)))
FEATURES_REQUIRED += periph_timer
endif
ifneq (,$(filter-out netdev_default netdev_new_api netdev_legacy_api, $(filter netdev_%,$(USEMODULE))))
USEMODULE += netdev
# Don't register netdevs if there is only a single one of them
ifeq (,$(filter gnrc_netif_single,$(USEMODULE)))
USEMODULE += netdev_register
endif
endif
ifneq (,$(filter gnrc_netif_timestamp,$(USEMODULE)))
ifneq (,$(filter netdev_ieee802154,$(USEMODULE)))
USEMODULE += netdev_ieee802154_rx_timestamp
endif
endif