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

62 Commits

Author SHA1 Message Date
Gerson Fernando Budke
699248c65f makefiles/arch/atmega.inc.mk: Rename to avr8.inc.mk
Atmel AVR-8 CPU was reworked to accomodate variants like ATxmega.
This rename to atmega.inc.mk to avr8.inc.mk to be compliant with
new directory structure.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-03-15 20:16:10 -03:00
Gerson Fernando Budke
aa3af4e2fa cpu/avr8_common/avr8_cpu: Add xmega clock
ATxmega have many clock options.  This introduce clk_init into cpu_init
to allow user select between a default configuration or perform fine
clock tune.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-03-15 20:16:10 -03:00
Gerson Fernando Budke
f1eaa4caf3 cpu/avr8_common/avr8_cpu: Enable xmega pmic
The XMEGA CPU have a Programmable Multilevel Interrupt Controller.
This enables all three PMIC levels.  By default, all interrupts are
preconfigured as LOW Level without Round Robin queue.  This works
as any MCU with interrupt enabled.

In order to get benefit from Multilevel Interrupts user need increase
the interrupt level by own.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-03-15 20:16:10 -03:00
Gerson Fernando Budke
70c597620f cpu/avr8_common: Differentiate avr8 cpu cores
Current there is no way to split code between ATmega and ATxmega in
drivers.  This differentiate AVR8 cores into MEGAs and XMEGAs.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-03-15 20:16:10 -03:00
Gerson Fernando Budke
facede13fd cpu/avr8_common: Rework and add xmega registers
The current context switch and thread stack init don't have a generic
way to save/restore registers for all AVR-8 variations.  This add
defines to check flash/data sizes and rework:

 - thread_stack_init
 - avr8_context_save
 - avr8_context_restore

The new implementation add missing RAMP D/X/Y registers that are used
by XMEGA variations.

The rules to add EIND, RAMP(D,X,Y,Z) register are:

 - EIND must be added if device have more than 128k flash.  This means,
   device can access more than 64k words in flash.
 - RAMP D/X/Y must be added if device have or can address more than
   64k data.
 - RAMPZ must be added if device can address more than 64k bytes of
   flash or data.

With above rules there is no necessity to check by device because it is
mandatory the registers for those MCU variations.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-03-15 20:16:10 -03:00
Gerson Fernando Budke
8c1203c646 cpu/avr8_common: Add xmega reset cause register
Add missing ATxmega reset cause register.  This shares same definitions
from ATmega CPU.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-03-15 20:16:10 -03:00
Gerson Fernando Budke
d041199825 cpu/avr8_common: Move irq_enable from board to cpu
Some mega boards enabling global irq at board_init.  This moves that
responsability to cpu/avr8_common to create a common point to all
variants.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-03-15 20:16:10 -03:00
Gerson Fernando Budke
9081a3b7c7 cpu/avr8_common/include/cpu.h: Increase number of uart
The ATxmega can have up to 8 UARTs.  This increase from 2 up to 7 to
keep avr8_state flags with 8 bits wide.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-03-15 20:16:10 -03:00
Hauke Petersen
71e9a9e216 cpu/atmega_common: add dbgpin initialization 2021-02-26 11:34:52 +01:00
0d43c96ac7
cpu/avr8_common: Add dummy thread_arch.h header
The thread_yield_higher function is complex enough to not inline it for
the avr8 cpu
2021-01-19 11:03:21 +01:00
Gerson Fernando Budke
1426e15679 cpu/avr8_common: Normalize method prefix name
Refactor atmega_ prefix to avr8_ prefix and update copyrights.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-01-07 16:29:42 -03:00
Gerson Fernando Budke
4cbd311196 cpu: Refact atmega_common into avr8_common
Split atmega_common code into avr8_common folder.  This moves common
avr8 code to be used for all avr8 variants: tiny, mega and xmega.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-01-07 16:29:22 -03:00