1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

65 Commits

Author SHA1 Message Date
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
Marian Buschsieweke
2a00ec13e5
drivers/periph/gpio_ll: shrink gpio_conf_t
This commit optimizes the `gpio_conf_t` type in the following
regards:

- The "base" `gpio_conf_t` is stripped from members that only some
  platforms support, e.g. drive strength, slew rate, and disabling of
  the Schmitt Trigger are no longer universally available but
  platform-specific extensions
- The `gpio_conf_t` is now crammed into a bit-field that is 8 bit or
  16 bit wide. This allows for storing lots of them e.g. in
  `driver_foo_params_t` or `uart_conf_t` etc.
- A `union` of the `struct` with bit-field members and a `bits` is used
  to allow accessing all bits in a simple C statement and to ensure
  alignment for efficient handling of the type

Co-authored-by: Gunar Schorcht <gunar@schorcht.net>
2024-01-21 08:38:40 +01:00
Gunar Schorcht
92657f5fd2 cpu/esp32: add SDMMC support 2024-01-05 07:22:27 +01:00
Gunar Schorcht
0de2570802 cpu/esp32: fix compilation with gcc 12.2 2023-04-17 07:32:48 +02:00
Gunar Schorcht
d4d4bc4df1 cpu/esp32: add RMT configuration type 2023-03-29 00:47:35 +02:00
Gunar Schorcht
7230299575 cpu/esp32: use same UART device in stdio_uart and bootloader 2023-01-06 16:43:51 +01:00
Benjamin Valentin
2b2298b796 cpu/esp32: implement periph_spi_reconfigure 2022-10-08 22:02:49 +02:00
Gunar Schorcht
9d5a7ac083 cpu/esp32: use usbdev_synopsys_dwc2 driver as periph_usbdev 2022-09-27 01:00:57 +02:00
Gunar Schorcht
94b4f03b47 cpu/esp32: implement periph/gpio_ll_irq 2022-09-02 15:03:45 +02:00
Gunar Schorcht
581c2dd9be cpu/esp32: implement periph/gpio_ll 2022-09-02 15:03:45 +02:00
Gunar Schorcht
af719f9c3b cpu/esp32: fix doc for gpio_flank_t 2022-08-31 12:21:46 +02:00
Gunar Schorcht
dac197031e cpu/esp32: add ESP32-S2 specific configuration header files 2022-08-29 17:19:39 +02:00
Gunar Schorcht
55e1f88a60 cpu/esp32: add ESP32-S3 specific configuration header files 2022-08-17 02:04:07 +02:00
Gunar Schorcht
d0b3c20d88 cpu/esp32: add ESP32-C3 specific configuration header files 2022-08-05 22:26:22 +02:00
Gunar Schorcht
3919e8f6df cpu/esp32: split periph_cpu.h into ESP32x and ESP32 parts
Split the defintions for peripherals in periph_conf.h into a part that is common for all ESP32x SoCs and a part that is specific for ESP32.
2022-07-19 06:05:03 +02:00
benpicco
365fbed906
Merge pull request #18279 from gschorcht/cpu/esp32/periph_hal_esp32_i2c
cpu/esp32: use ESP-IDF i2c HAL for ESP32 periph/i2c
2022-07-17 22:24:54 +02:00
Gunar Schorcht
c0becd2819 cpu/esp32: port periph/i2c_hw to ESP-IDF i2c HAL 2022-07-17 18:48:23 +02:00
Gunar Schorcht
43d2340eea cpu/esp32: port periph/dac to ESP-IDF dac API 2022-07-17 17:16:49 +02:00
Gunar Schorcht
11c9703675 cpu/esp32: port periph/adc to ESP-IDF interface API 2022-07-17 17:16:49 +02:00
benpicco
dd806ce72e
Merge pull request #18270 from gschorcht/cpu/esp32/periph_hal_esp32_gpio
cpu/esp32: use ESP-IDF gpio HAL for periph/gpio
2022-07-15 15:44:13 +02:00
benpicco
295f4a5b04
Merge pull request #18281 from gschorcht/cpu/esp32/periph_hal_esp32_spi
cpu/esp32: use ESP-IDF spi HAL for periph/spi
2022-07-15 13:25:50 +02:00
Gunar Schorcht
d6eef52766 cpu/esp32: port periph/gpio to ESP-IDF gpio HAL 2022-07-15 11:03:32 +02:00
benpicco
1e8f3871fb
Merge pull request #18274 from gschorcht/cpu/esp32/periph_hal_esp32_uart
cpu/esp32: use ESP-IDF interrupt HAL for periph/uart
2022-07-15 10:58:46 +02:00
Gunar Schorcht
9142edce03 cpu/esp32: port periph/spi to ESP-IDF spi LL API 2022-07-15 08:57:31 +02:00
benpicco
94e9116c04
Merge pull request #18276 from gschorcht/cpu/esp32/periph_hal_esp32_pwm
cpu/esp32: use ESP-IDF ledc HAL for periph/pwm
2022-07-14 18:09:01 +02:00
Gunar Schorcht
2ae2facf90 cpu/esp32: port periph/pwm to ESP-IDF ledc HAL 2022-07-14 15:50:47 +02:00
benpicco
ba37e93bd6
Merge pull request #18267 from gschorcht/cpu/esp32/periph_hal_esp32_timer
cpu/esp32: use ESP-IDF timer HAL for system timer and watchdog
2022-07-10 23:08:57 +02:00
Marian Buschsieweke
d337997e5a
Merge pull request #18277 from gschorcht/cpu/esp/periph_hal_esp32_hwrng
cpu/esp_common: use ESP-IDF random API for ESP32
2022-07-04 19:02:58 +02:00
Gunar Schorcht
02310b1148 cpu/esp_common: port periph/hwrng to ESP-IDF random API 2022-06-30 11:10:02 +02:00
Gunar Schorcht
0482eb1c90 cpu/esp32: use ESP-IDF timer HAL for peripheral timer definition 2022-06-29 08:35:38 +02:00
Gunar Schorcht
81caeb1bb1 cpu/esp32: add uart to ESP-IDF interface API 2022-06-28 16:25:10 +02:00
Gunar Schorcht
9065dcff14 cpu/esp32: port periph/cpu_id to ESP-IDF read_mac 2022-06-28 16:09:03 +02:00
Gunar Schorcht
d7382ab063 cpu/esp32: fix compilation problems with ESP-IDF v4.4 2022-06-01 13:27:31 +02:00
Benjamin Valentin
0340ac6129 cpu: include IDLE in PM_NUM_MODES 2022-04-06 12:29:25 +02:00
2e74e5e3b9
cpu/esp32: include sdk_conf.h in periph_cpu.h
This allows access to CLOCK_CORECLOCK from periph_conf.h which is used by clk.h
2021-12-15 13:14:19 +01:00
Jan Romann
4384795cb9
treewide: Remove excessive newlines 2021-08-13 19:50:38 +02:00
189f7d862d
cpu/esp32: fix typo in timer documentation 2021-01-08 12:04:24 +01:00
b4458e73f2
cpu/esp32: fix typo in Doxygen comment
depenend => depend
2021-01-08 10:15:32 +01:00
Vincent Dupont
c498bbdc83 esp32/can: include can_esp.h from periph_cpu.h 2020-09-30 12:59:03 +02:00
Benjamin Valentin
5da1a9e577 cpu/esp*: use TIMER_CHANNEL_NUMOF 2020-06-24 00:45:35 +02:00
Gunar Schorcht
f67cb48f6d cpu/esp32: add RTT counter implementation
fixup! cpu/esp32: add RTT counter implementation
2020-04-07 09:12:44 +02:00
Gunar Schorcht
dff74a3278 cpu/esp32: add pm_layered support 2020-03-23 12:38:36 +01:00
Gunar Schorcht
0292f8b6a3 cpu/esp*: move periph/hwrng to cpu/esp_common 2020-02-21 09:09:34 +01:00
Gunar Schorcht
b0517c6733 cpu/esp*: move periph/uart to cpu/esp_common
tmp
2020-02-21 09:09:34 +01:00
Kevin "Tristate Tom" Weiss
be39169bd4
Merge pull request #11108 from gschorcht/cpu/esp8266/esp-idf/pr
cpu/esp8266: complete reimplementation based on ESP8266 RTOS SDK
2019-11-18 09:34:49 +01:00
Yegor Yefremov
df7e760588 doxygen/I2C: don't include overridden typedefs
Add missing #ifndefs to overridden I2C typedefs.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2019-11-15 10:35:33 +01:00
Yegor Yefremov
cf65070b06 doxygen/GPIO: don't include overridden typedefs
Add missing #ifndefs to overridden GPIO typedefs.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2019-11-15 10:35:33 +01:00
Yegor Yefremov
5b0252b150 doxygen/ADC: don't include overridden typedefs
Add missing #ifndefs to overridden ADC resolution typedefs.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2019-11-15 10:35:32 +01:00
Gunar Schorcht
4f4d882f68 cpu/esp32: changes for RTOS SDK 2019-11-14 13:58:25 +01:00
3da6593a54 esp32: define PERIPH_TIMER_PROVIDES_SET 2019-07-19 22:28:27 +02:00