1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 22:13:52 +01:00

544 Commits

Author SHA1 Message Date
Benjamin Valentin
54a744635c cpu/sam0_common: eth: delay init by 10ms for more stable Ethernet 2025-08-04 16:31:43 +02:00
benpicco
55c2061a42
Merge pull request #21555 from HendrikVE/hendrik/dac-changes
cpu/sam0_common: enable static voltages
2025-06-23 09:19:41 +00:00
Hendrik van Essen
b157d5ca3e cpu/sam0_common/periph/dac.c: do conversion refresh by default 2025-06-23 10:03:54 +02:00
Hendrik van Essen
4af71d9bc7 cpu/sam0_common/periph/dac.c: add option to keep DAC running in standby 2025-06-23 10:03:49 +02:00
crasbe
3d7b5b017c
Merge pull request #14999 from benpicco/cpu/sam0_common-pm_off
cpu/sam0_common: implement pm_off()
2025-06-20 13:58:41 +00:00
Benjamin Valentin
fea0e0f34c cpu/sam0_common: implement pm_off() 2025-06-20 15:32:55 +02:00
Hendrik van Essen
3c74301718 cpu/sam0_common/periph/dac.c: dont use DAC_CTRLA_SWRST
DAC_CTRLA_SWRST clears all registers, so it also clears the config
of the first DAC line after configuring the second DAC line.
2025-06-20 09:53:08 +02:00
Daniel Lockau
763dbccc78 cpu/sam0_common/periph/i2c.c: attempt to unblock bus after error 2025-06-19 13:00:16 +02:00
Benjamin Valentin
d86b75a4a6 cpu/sam0_common: fix DAC on SAM D5x/E5x 2025-06-11 13:06:50 +02:00
Marian Buschsieweke
cac44edec7
tree-wide: replace multiple empty lines with one
For each C source/header `$file`: `sed -e '/^$/N;/^\n$/D' -i $file`.
2025-05-21 22:51:04 +02:00
KSKNico
fe821eaa1d cpu: replace header guards with #pragma once 2025-05-21 17:13:37 +02:00
Marian Buschsieweke
e29bfedf44
cpu/sam*: update style to coding convention
- Use `#pragma once`
- Indent preprocessor directives inside conditional compilation
- Drop unused `#include`s
2025-05-05 08:59:00 +02:00
Marian Buschsieweke
1ff982a664
tree wide: various doc fixes
This fixes a batch of incorrect Doxygen comments that building with
LLVM/clang and `-Wdocumentation` uncovered.
2025-04-04 11:44:53 +02:00
Mihai Renea
f6b99603db Revert "cpu/sam0_common: flashpage: don't disable interruipts while writing"
This reverts commit fd49d16cbab8f9046374f07d2008c0fb2d2593ea.
2025-03-26 11:12:01 +01:00
fabian18
8bbeba10cb
Merge pull request #21169 from fabian18/pr/mtd_sdmmc_remove_MTD_DRIVER_FLAG_DIRECT_WRITE
{cpu/sam0_common/sam0_sdhc,drivers/mtd}: do not allocate `work_area` twice
2025-02-19 17:02:42 +00:00
Fabian Hüßler
452f75fa3c cpu/sam0_common/sam0_sdhc: prevent work_area double allocation 2025-02-12 16:25:31 +01:00
Benjamin Valentin
c791ff278f cpu/sam0_eth: fix hang with broken PHY 2025-01-30 11:16:18 +01:00
Benjamin Valentin
7fab445e94 cpu/samd5x: add support for SAM E51 2025-01-07 11:36:45 +01:00
Benjamin Valentin
2a511e47e1 cpu/sam0_common: fix same51 vendor header files
cpu/sam0_common/include/vendor/fix_headers.sh
2025-01-07 11:36:45 +01:00
Benjamin Valentin
d0d62bf181 cpu/sam0_common: import vendor files for same51
Atmel Software Framework (ASF) provides a set of low-level header
files that give access to different hardware peripherals of Atmel's
ICs.

Origin: Atmel SAME51 Series Device Support (1.1.139)
License: Apache-2.0
URL: http://packs.download.atmel.com/Atmel.SAME51_DFP.1.1.139.atpack
2025-01-07 11:36:45 +01:00
Dylan Laduranty
808827c325
Merge pull request #21043 from benpicco/cpu/sam0-flashpage/cachedis
cpu/sam0_common: flashpage: disable cache while writing
2024-12-15 10:57:10 +00:00
Marian Buschsieweke
0dfd83938f
{cpu,drivers}/periph_gpio_ll: add missing include
For `gpio_ll_print_conf()` we need to include `<stdio.h>`, when not
using `fmt.h`.
2024-11-27 09:06:56 +01:00
Benjamin Valentin
fd49d16cba cpu/sam0_common: flashpage: don't disable interruipts while writing 2024-11-26 14:04:35 +01:00
Benjamin Valentin
1320d97e89 cpu/sam0_common: flashpage: disable cache while writing
fix errata 2.14.1: NVM Read Corruption
2024-11-26 14:02:08 +01:00
Benjamin Valentin
4eb1c35fe3 cpu/sam0_eth: fix return values of sam0_eth_send() 2024-11-20 18:17:22 +01:00
Marian Buschsieweke
0222b8c54c
cpu/sam0_common/periph_gpio_ll: fix gpio_query_conf()
For the other MCUs, we take the input register state instead of the
output register state when the pin is configured as input. Let's do
the same here, as this is a lot more useful and intuitive.
2024-11-18 14:27:14 +01:00
Marian Buschsieweke
72d0b2b180
cpu/sam0_common/periph_gpio_ll: fix gpio_get_port()
It turns out that the legacy GPIO API and GPIO LL may disagree on what
the GPIO base address is: GPIO LL will use the IOBUS as base address
no matter what, the legacy GPIO API will use the APB as base address
unless `periph_gpio_fast_read` is used.

If the APIs disagree, we need to do impedance matching.
2024-11-18 12:50:25 +01:00
Marian Buschsieweke
f5f6b41bf8
Merge pull request #20994 from maribu/cpu/sam0_common/periph_adc/errata-2.1.6
cpu/sam0_common/periph_adc: add work around for errata 2.1.6
2024-11-17 13:55:12 +00:00
Benjamin Valentin
08fc52b53a cpu/sam0_common: eth: collision should return -EBUSY 2024-11-15 14:18:58 +01:00
Marian Buschsieweke
a89c924682
cpu/sam0_common/periph_adc: add work around for errata 2.1.6
This adds a delay between enabling the ADC and starting to sample
on the SAMD5x MCUs when the internal bandgap reference is used.

Co-authored-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-11-14 22:44:23 +01:00
Dylan Laduranty
6401abbd92
Merge pull request #20850 from dylad/pr/cpu/saml21/compat_headers
cpu/saml21: add compatibily headers for vendor files migration
2024-11-08 08:14:28 +00:00
Dylan Laduranty
a9cb19dcc5 cpu/samr30: create compatibility headers for vendor files migration
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-11-07 21:25:03 +01:00
Dylan Laduranty
7d83c7a9d2 cpu/samr34: create compatibility headers for vendor files migration
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-11-07 21:22:23 +01:00
Marian Buschsieweke
c2c2cc8592
drivers/periph_gpio: let gpio_read() return bool
Since https://github.com/RIOT-OS/RIOT/pull/20935 gpio_write()
uses a `bool` instead of an `int`. This does the same treatment for
`gpio_read()`.

This does indeed add an instruction to `gpio_read()` implementations.
However, users caring about an instruction more are better served with
`gpio_ll_read()` anyway. And `gpio_read() == 1` is often seen in
newcomer's code, which would now work as expected.
2024-10-23 13:24:09 +02:00
Benjamin Valentin
4627f66caa drivers/periph/gpio: make gpio_write() take a bool 2024-10-22 16:39:48 +02:00
Marian Buschsieweke
702ad02b33
cpu/sam0_common/periph_dma: Fix API mismatch
Match the signature of the implementation of the dma_prepare() with the
declaration to fix:

    /home/marian.buschsieweke@ml-pa.loc/Repos/software/RIOT/master/cpu/sam0_common/periph/dma.c:172:6: error: conflicting types for 'dma_prepare' due to enum/integer mismatch; have 'void(dma_t,  uint8_t,  const void *, void *, size_t,  uint8_t)' {aka 'void(unsigned int,  unsigned char,  const void *, void *, unsigned int,  unsigned char)'} [-Werror=enum-int-mismatch]
      172 | void dma_prepare(dma_t dma, uint8_t width, const void *src, void *dst,
          |      ^~~~~~~~~~~
    In file included from /home/marian.buschsieweke@ml-pa.loc/Repos/software/RIOT/master/cpu/samd5x/include/periph_cpu.h:26,
                     from /home/marian.buschsieweke@ml-pa.loc/Repos/software/RIOT/master/cpu/sam0_common/periph/dma.c:21:
    /home/marian.buschsieweke@ml-pa.loc/Repos/software/RIOT/master/cpu/sam0_common/include/periph_cpu_common.h:1186:6: note: previous declaration of 'dma_prepare' with type void(dma_t,  uint8_t,  const void *, void *, size_t,  dma_incr_t)' {aka 'void(unsigned int,  unsigned char,  const void *, void *, unsigned int,  dma_incr_t)'}
     1186 | void dma_prepare(dma_t dma, uint8_t width, const void *src, void *dst,
          |      ^~~~~~~~~~~
2024-10-09 23:00:06 +02:00
Dylan Laduranty
fb8473a2ea cpu/saml21: create compatibility headers for vendor files migration
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-09-04 11:38:07 +02:00
mariemC
7df7886a69 cpu/sam0_common/periph: fix rtt reset after hibernation 2024-08-29 17:08:54 +02:00
Marian Buschsieweke
422042bd00
drivers/periph_gpio_ll_irq: make support for both edges optional
The assumption that every MCU has this feature turned out wrong. Hence,
add a feature to allow testing for support of edge triggered IRQs on
both flanks.
2024-08-02 13:41:36 +02:00
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
Dylan Laduranty
ccc155e351 cpu/sam0: remove bitfield usage in sdhc driver
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-06-25 16:13:17 +02:00
Dylan Laduranty
04e4770379 cpu/sam0: remove bitfield usage in headers
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-06-25 16:13:17 +02:00
Dylan Laduranty
25a04e6757 cpu/sam0/periph: remove bitfield usage in watchdog driver
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-06-25 16:13:17 +02:00
Dylan Laduranty
707fecbc38 cpu/sam0/periph: remove bitfield usage in usbdev driver
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-06-25 16:13:17 +02:00
Dylan Laduranty
f31ac8a978 cpu/sam0/periph: remove bitfield usage in UART driver
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-06-25 16:13:16 +02:00
Dylan Laduranty
6ccaca1e76 cpu/sam0/periph: remove bitfield usage in timer driver
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-06-25 16:13:16 +02:00
Dylan Laduranty
925e98b115 cpu/sam0/periph: remove bitfield usage in SPI driver
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-06-25 16:13:16 +02:00
Dylan Laduranty
7c1e66bdae cpu/sam0/periph: remove bitfield usage in RTC/RTT driver
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-06-25 16:13:16 +02:00
Dylan Laduranty
a66eebb8ac cpu/sam0/periph: remove bitfield usage in I2C driver
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-06-25 16:13:16 +02:00
Dylan Laduranty
37b03d8172 cpu/sam0/periph: remove bitfield usage in trng driver
Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
2024-06-25 16:13:16 +02:00