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

254 Commits

Author SHA1 Message Date
Marian Buschsieweke
125c892c03
drivers/periph/timer: Use uint32_t for frequency
For all currently supported platforms `unsigned long` is 32 bit in width. But
better use `uint32_t` to be safe.
2020-10-30 22:02:12 +01:00
Bas Stottelaar
22243aec7a cpu/*: realign ENABLE_DEBUG 2020-10-23 00:46:26 +02:00
Bas Stottelaar
fb61443bbd cpu/*: remove unused assert.h include 2020-10-22 11:13:09 +02:00
Bas Stottelaar
ab6188cea3 cpu/*: add missing include of assert.h 2020-10-22 11:13:08 +02:00
Leandro Lanzieri
fe6d66d92a
kconfig: add ERROR symbol for conflicting modules 2020-10-09 18:04:17 +02:00
Marian Buschsieweke
4abbda5b3e
cpu/atmega_common: Add architecture_arch.h 2020-09-29 12:33:59 +02:00
Leandro Lanzieri
67aec8392c
cpu/atmega_common: use stdio_uart only when no other is defined 2020-08-19 10:00:26 +02:00
Marian Buschsieweke
fa12d9ad52
cpu/atmega_common: Don't access sched_active_*
Replaced accesses to sched_active_* with API calls in C files
2020-08-17 11:26:19 +02:00
Francisco
7e6fee8260
Merge pull request #14615 from maribu/atmega-idle-stack-size
cpu/atmega_common: Increase idle stack size with xtimer
2020-07-30 14:43:20 +02:00
Marian Buschsieweke
040bad0425
cpu/atmega_common: increase stack size with xtimer
If a timer triggers while the idle thread is running, previously a stack
overflow was triggered. This commit increases the idle threads stack size if
xtimer is used.
2020-07-27 16:52:36 +02:00
Marian Buschsieweke
7b49310147
cpu/atmega_common: Enable cpp feature 2020-07-24 15:22:34 +02:00
Benjamin Valentin
96273b4df0 cpu/atmega_common: use TIMER_CHANNEL_NUMOF 2020-06-24 00:45:35 +02:00
Leandro Lanzieri
873badcd76
cpu/atmega_common: Add ATmega128 family Kconfig symbol 2020-06-22 15:19:35 +02:00
Leandro Lanzieri
19bdb11548
cpu/atmega_common: Add Kconfig symbols 2020-06-17 10:52:23 +02:00
benpicco
49aef1b678
Merge pull request #13902 from benpicco/periph_timer_periodic
periph/timer: add timer_set_periodic()
2020-05-28 18:03:32 +02:00
Benjamin Valentin
c000a77658 cpu/atmega_common: implement timer_set_periodic() 2020-05-28 17:37:42 +02:00
benpicco
2183fb9273
Merge pull request #14155 from maribu/atmega_timer_cleanup
cpu/atmega*: Clean up timer configs
2020-05-28 17:33:31 +02:00
Marian Buschsieweke
fb722b1be7
cpu/atmega_common/periph_timer: Fix style 2020-05-28 16:27:08 +02:00
benpicco
8a2b089cd5
Merge pull request #14098 from maribu/atmega-timer
cpu/atmega_common: Fix periph_timer
2020-05-28 13:23:22 +02:00
Marian Buschsieweke
99bd1c318c
cpu/atmega_common/periph_timer: Add timer_set
Added a low level implementation of timer_set() that allows setting relative
timeouts as short as 0. This results in tests/periph_timer_short_relative_set
no passing.
2020-05-28 11:46:02 +02:00
Francisco
3ef40f3321
Merge pull request #14085 from maribu/atmega_irq
cpu/atmega_common: Update to inlineable IRQ API
2020-05-26 16:33:07 +02:00
Marian Buschsieweke
9e566370bf
cpu/atmega_common: Fixed irq_arch implementation
The inline assembly implementation was badly in need of improvement.

- irq_disable() took 2 CPU cycles more than needed
    - The current interrupt state was stored in a temporary register and
      afterwards copied to the target register, rather than storing it in the
      target register right away
    - The lower bits of the state were cleared (as they have no meaning for the
      interrupt status), but the API purposely never required such things from
      implementations.
- irq_restore() took 5 CPU cycles. This was reduced to 3 CPU cycles (or 2 CPU
  cycles in the best case)
2020-05-26 15:19:14 +02:00
Marian Buschsieweke
067a9c38ae
cpu/atmega_common: Fix race in periph_timer
As AVR is an 8 bit platform, special care needs to be taken when accessing 16
bit registers in an atomic fashion. This commit as just this care.
2020-05-18 21:22:31 +02:00
Marian Buschsieweke
ba5844098d
cpu/atmega_common: Make irq_arch inline-able
- Moved irq_arch.c to irq_arch.h and marked all functions as
  `__attribute__((always_inline)) static inline`
2020-05-17 18:41:11 +02:00
benpicco
cc44992abe
Merge pull request #12827 from maribu/atmega_pwm
cpu/atmega_common/periph/pwm: Minor fix & cleanup
2020-05-16 22:26:58 +02:00
Marian Buschsieweke
506288791d
cpu/atmega_common/periph/pwm: Minor fix & cleanup
- On pwm_poweron, the PWM resolution was not restored. (A custom resolution was
  only usable if, PWM channel 0 is not used. That configuration is not common,
  so this bug was likely never triggered)
- Disabled a work around to prevent flickering:
    - Previously, PWM was disconnected on level 0% and 100%
    - This increases the run time of `pwm_set()`
    - It prevents using the PWM for wave form generation via DDS, as the wave
      noticeably jumps when reaching 0% or 100%
- Slightly reduces memory requirements: 2 Bytes of RAM, 112 Bytes of ROM
    - Tested with avr-gcc 9.2.0 and LTO enabled
2020-05-16 20:43:31 +02:00
Marian Buschsieweke
2f3961690e
cpu/atmega_common: Add feature PUF_SRAM
The feature is implemented in `cpu/atmega_common`, so we can just enable it for
all ATmega boards.
2020-05-15 11:31:23 +02:00
Marian Buschsieweke
355b01ce98
cpu/atmega_common: Moved atmega_state to cpu.c
The global state flags should never have bin in irq_arch.c but in cpu.c. This
is not fixed.
2020-05-15 11:24:29 +02:00
Marian Buschsieweke
4d1a5b9256
cpu/atmega_common: Drop legacy include
Drop `#include "irq.h"` in `cpu.h`, which was there for a legacy work around.
A bunch of missing includes of `irq.h` materialized due to this and were
fixed.
2020-05-15 11:24:28 +02:00
84745365fd cpu: atmega_common: make THREAD_STACKSIZE_IDLE configurable 2020-03-12 13:01:13 +01:00
Benjamin Valentin
93d2068a9e cpu/atmega_common: Implement RTC based on TIM2
This implements a basic Real Time Clock based on TIM2.

As the timer is too fast and wraps around after just 8 bits, it is
not used directly. Instead TIM2 is responsible for providing a 1 Hz
tick by generating an alarm every second.

The current time data is kept in the `.noinit` section, so it will survive
a reboot, but the clock will not be updated while the bootloader runs, so
expect inaccuracies.
2020-03-03 16:26:26 +01:00
Gunar Schorcht
da244ffcaa cpu/atmega_common: fix compile problem with NDEBUG 2020-02-25 09:41:24 +01:00
benpicco
de89f3a459
Merge pull request #13319 from maribu/avr-reboot
cpu/atmega_common: Fix reboot issues
2020-02-11 17:18:12 +01:00
Francisco
e2dc125fb3
Merge pull request #13308 from maribu/atmega_state_cleanup
cpu/atmega_common: Cleanup state flags
2020-02-10 17:37:24 +01:00
Marian Buschsieweke
60ee8cd513
cpu/atmega_common: Fix pm_reboot with LTO
The reboot process for ATmegas is to enable the watchdog timer and loop until
the wdt reboots this MCU. However, this reboot will keep the wdt configuration,
so that the wdt needs to be disabled during boot. This is done in get_mcusr,
but without the attribute "used" it will be optimized out in LTO builds. This
commits adds the attribute "used" to get_mcusr.

Also simplified the backward compatibility with older ATmegas (currently not
supported by RIOT) on outdated versions of avrlibc.
2020-02-10 17:08:09 +01:00
benpicco
24fb7a9aae
Merge pull request #12933 from maribu/atmega_pcint_cleanup
cpu/atmega_common/periph/gpio: Clean up PCINT support
2020-02-06 18:29:15 +01:00
Marian Buschsieweke
1879f58512
cpu/atmega_common: Cleanup state flags
- Use one byte of RAM to track both IRQ and UART TX state
- Fix incorrect use of volatile
2020-02-06 15:41:41 +01:00
Gunar Schorcht
668e05ed4f cpu/atmega: fix PWM compilation error with NDEBUG
When NDEBUG macro is defined during compilation, the assert macro produces empty code. The dev parameter is then unused.
2020-02-03 00:14:32 +01:00
Gunar Schorcht
2051167176 cpu/atmega: fix I2C compilation error with NDEBUG
When NDEBUG macro is defined during compilation, the assert macro produces empty code. The dev parameter is then unused.
2020-01-30 11:46:31 +01:00
Gunar Schorcht
ddd7cb0a7d
Merge pull request #12898 from aabadie/pr/cpu/dependencies_cleanup
cpu: move cpu level dependencies in dedicated Makefile.dep files
2020-01-28 17:57:02 +01:00
Sebastian Meiling
91cff05a15 doc: use @name for doxygen groups 2020-01-28 15:46:09 +01:00
Sebastian Meiling
2eae1952f7 doc: fix doxygen groups for atmega cpus 2020-01-28 15:44:29 +01:00
e969b2fcd5
cpu/atmega_common: move common dependencies 2020-01-28 13:20:53 +01:00
90e10d3009
cpu/atmega_common: move avr-libc-extra dependency to Makefile.dep 2020-01-28 13:20:52 +01:00
76b9cfb677
Merge pull request #12973 from fjmolinas/pr_atmega_tx_isr
cpu/atmega_common/periph/uart: use TX_ISR to check TX end
2020-01-15 11:51:22 +01:00
Francisco Molina
70c6df9330 cpu/atmega_common/periph/uart: use TX_ISR to check TX end
For atmega boards a TX has not actually completed until UDRn is empty
as well as the Transmit Shift Register.

To avoid resetting an UART before a TX has completed we use the TXCn
flash and ISR to set a variables that indicates TX is ongoing. This
allows not reseting the UART while there are ongoing TX pending.

This fixes an issue where part of the last byte is not shifted out
of the TX shift register causing rubish on the first TX following an
uart_init.
2020-01-15 10:02:40 +01:00
Marian Buschsieweke
3c7d95de02
cpu/atmega_common/periph: adc_sample() now returns int32_t 2020-01-10 14:13:13 +01:00
Marian Buschsieweke
3ecd303ed0
cpu/atmega_common/periph: Clean up PCINT support
- Using a enum instead of _COUNTER is easier to read
    - _COUNTER is also a reserved name; so better not use it to avoid issues
- Split out the pcint code into a static inline function for increased
  readability
2019-12-12 11:38:43 +01:00
Marian Buschsieweke
a45066551b
cpu/atmega_common/periph: Fixed bug in PCINT
The bank index and the pin number are not necessarily identical. For all
PCINT banks except for bank 3 bank_idx was used therefore. It was likely
just forgotten to update that for bank 3 as well.
2019-12-12 11:33:19 +01:00
chudov
efa9bb88a2 cpu/atmega256rfr2: symbol counter based RTT support 2019-12-05 22:53:05 +01:00