1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/drivers
Marian Buschsieweke 36e8526046
drivers/periph_gpio_ll: change API to access GPIO ports
The API was based on the assumption that GPIO ports are mapped in memory
sanely, so that a `GPIO_PORT(num)` macro would work allow for constant
folding when `num` is known and still be efficient when it is not.

Some MCUs, however, will need a look up tables to efficiently translate
GPIO port numbers to the port's base address. This will prevent the use
of such a `GPIO_PORT(num)` macro in constant initializers.

As a result, we rather provide `GPIO_PORT_0`, `GPIO_PORT_1`, etc. macros
for each GPIO port present (regardless of MCU naming scheme), as well as
`GPIO_PORT_A`, `GPIO_PORT_B`, etc. macros if (and only if) the MCU port
naming scheme uses letters rather than numbers.

These can be defined as macros to the peripheral base address even when
those are randomly mapped into the address space. In addition, a C
function `gpio_port()` replaces the role of the `GPIO_PORT()` and
`gpio_port_num()` the `GPIO_PORT_NUM()` macro. Those functions will
still be implemented as efficient as possible and will allow constant
folding where it was formerly possible. Hence, there is no downside for
MCUs with sane peripheral memory mapping, but it is highly beneficial
for the crazy ones.

There are also two benefits for the non-crazy MCUs:
1. We can now test for valid port numbers with `#ifdef GPIO_PORT_<NUM>`
    - This directly benefits the test in `tests/periph/gpio_ll`, which
      can now provide a valid GPIO port for each and every board
    - Writing to invalid memory mapped I/O addresses was treated as
      triggering undefined behavior by the compiler and used as a
      optimization opportunity
2. We can now detect at compile time if the naming scheme of the MCU
   uses letters or numbers, and produce more user friendly output.
    - This is directly applied in the test app
2024-08-02 09:55:24 +02:00
..
ad7746 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
adcxx1c *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
ads101x *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
adt7310 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
adxl345 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
aip31068 drivers: don't call i2c_init() 2024-05-16 14:55:30 +02:00
apa102 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
apds99xx *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
at drivers/at: expose some internal API 2024-05-28 12:20:54 +02:00
at24cxxx drivers/at24cxxx: add documentation about driver usage 2024-04-16 18:06:03 +02:00
at24mac *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
at25xxx drivers/at25xxx: s/PAGE_SIZE/AT25_PAGE_SIZE/ 2024-06-05 21:56:29 +02:00
at30tse75x *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
at86rf2xx *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
at86rf215 drivers/at86rf215: port to new netdev API 2024-05-15 17:24:42 +02:00
ata8520e *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
atwinc15x0 drivers: Added PRIuSIZE print format specifier 2024-01-12 17:17:33 +01:00
bh1750fvi *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
bh1900nux *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
bme680 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
bmp180 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
bmx055 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
bmx280 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
bq2429x *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
can_trx *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
cc1xxx_common drivers: Use size_t print format specifier 2023-12-21 12:02:28 +01:00
cc110x *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
cc2420 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
ccs811 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
cst816s *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
dac_dds *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
dcf77 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
dfplayer *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
dht *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
disp_dev *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
dose *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
ds18 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
ds75lx *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
ds1307 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
ds3231 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
ds3234 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
dsp0401 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
dynamixel *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
edbg_eui *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
enc28j60 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
encx24j600 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
epd_bw_spi epd_bw_spi: add implementation for disp_dev 2023-01-31 19:50:11 +01:00
ethos *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
feetech *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
ft5x06 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
fxos8700 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
gp2y10xx *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
grove_ledbar *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
hd44780 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
hdc1000 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
hih6130 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
hm330x *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
hmc5883l *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
hsc *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
hts221 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
ili9341 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
ina2xx *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
ina3221 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
include drivers/periph_gpio_ll: change API to access GPIO ports 2024-08-02 09:55:24 +02:00
io1_xplained *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
ir_nec *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
isl29020 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
isl29125 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
itg320x *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
jc42 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
kw2xrf *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
kw41zrf drivers/kw41zrf: kw41zrf implements the legacy netdev API 2024-04-30 08:41:07 +02:00
l3g4200d *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
l3gxxxx *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
lc709203f *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
lcd *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
lis2dh12 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
lis3dh *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
lis3mdl *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
lm75 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
lpd8808 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
lpsxxx *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
lsm6dsxx Merge pull request #20438 from MrKevinWeiss/pr/kconfig/dep/removal 2024-03-27 16:39:56 +00:00
lsm303agr *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
lsm303dlhc *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
ltc4150 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
mag3110 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
matrix_keypad *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
max31855 drivers: add max31855 2024-06-12 13:11:45 +02:00
mcp47xx *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
mcp2515 Merge branch 'master' into cpu/samd5x-write-CAN-driver 2024-03-28 09:52:26 +01:00
mfrc522 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
mhz19 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
mma8x5x *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
mma7660 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
motor_driver *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
mpl3115a2 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
mpu9x50 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
mq3 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
mrf24j40 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
mtd *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
mtd_emulated drivers/mtd: Add check for interger overflow 2024-04-18 12:23:50 +02:00
mtd_flashpage drivers/mtd_flashpage: fix comperror when compiling without asserts 2024-03-19 14:36:01 +00:00
mtd_mapper *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
mtd_mci drivers/mtd_{mci,sdcard}: Pages need to be written at once 2022-03-31 10:58:52 +02:00
mtd_sdcard *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
mtd_sdmmc *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
mtd_spi_nor drivers/mtd_spi_nor: make use of busy_wait() 2024-01-15 14:56:35 +01:00
my9221 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
ncv7356 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
netdev *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
netdev_ieee802154_submac *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
nrf24l01p *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
nrf24l01p_ng drivers: Added PRIuSIZE print format specifier 2024-01-12 17:17:33 +01:00
nvram *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
nvram_spi *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
opt3001 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
pca9633 drivers: don't call i2c_init() 2024-05-16 14:55:30 +02:00
pca9685 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
pcd8544 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
pcf857x *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
periph_common drivers/periph_wdt: fix auto starting of watchdog timer 2024-06-19 12:25:02 -04:00
ph_oem *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
pir *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
pn532 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
pulse_counter *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
qmc5883l *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
rn2xx3 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
rtt_rtc *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
saul drivers: add max31855 2024-06-12 13:11:45 +02:00
scd30 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
sdcard_spi *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
sdmmc *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
sdp3x drivers: don't call i2c_init() 2024-05-16 14:55:30 +02:00
sds011 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
seesaw_soil *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
servo *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
sgp30 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
sht1x *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
sht2x *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
sht3x *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
shtcx *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
si70xx *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
si114x *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
si1133 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
slipdev *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
sm_pwm_01c *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
soft_spi *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
soft_uart *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
sps30 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
srf02 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
srf04 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
srf08 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
st77xx *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
stmpe811 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
sx126x *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
sx127x *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
sx1280 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
tcs37727 *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
tja1042 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
tmp00x *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
touch_dev *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
touch_dev_gestures *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
tps6274x *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
tsl2561 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
tsl4531x *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
uart_half_duplex *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
usbdev_mock *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
usbdev_synopsys_dwc2 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
vcnl40x0 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
veml6070 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
vl6180x *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
w5100 *Kconfig*: Remove dep-only Kconfig files 2024-03-26 14:54:22 +01:00
w5500 drivers/w5500: enable polling in interrupt mode 2024-06-05 16:30:59 +02:00
ws281x drivers/ws281x: Return correct number of written elements 2024-06-05 22:41:40 +02:00
xbee drivers: Use size_t print format specifier 2023-12-21 12:02:28 +01:00
doc.txt drivers/shield_w5100: add module for the W5100 Ethernet Shield 2023-07-08 08:36:41 +02:00
Kconfig *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
Kconfig.net *Kconfig*: Modify Kconfig to remove dep model 2024-03-27 10:28:12 +01:00
Makefile sys/auto_init: allow delayed initialisation of SAUL 2020-03-04 16:13:40 +01:00
Makefile.dep drivers/at24cxxx: add defines for M24C01 2024-04-16 18:06:03 +02:00