FreeRTOS-Kernel/FreeRTOS/Demo/AVR_ATMega4809_Atmel_Studio/RTOSDemo/clk_config.h
Yuhui Zheng 915af50524
Add Atmel Studio projects for ATMega4809 and AVR128DA48 (#159)
* Added explicit cast to allow roll over and avoid integer promotion during cycles counters comparison in recmutex.c.

* Fixed type mismatch between declaration and definition of function xAreSemaphoreTasksStillRunning( void ).

* Added Atmel Studio demo projects for ATMega4809 and AVR128DA48.

* Per https://www.freertos.org/upgrading-to-FreeRTOS-V8.html, I'm updating portBASE_TYPE to BaseType_t.

Signed-off-by: Yuhui Zheng <10982575+yuhui-zheng@users.noreply.github.com>

* Update register test for ATmega4809
- to cover r28, r29, r31.
- call public API taskYIELD() instead of portYIELD().

* Update ATmega4809 readme.md to include info for serial port setup, and minor wording fix.

Co-authored-by: Alexandru Niculae - M17336 <alexandru.niculae@microchip.com>
2020-07-27 17:30:53 -07:00

32 lines
No EOL
1,017 B
C

#ifndef CLK_CONFIG_H_
#define CLK_CONFIG_H_
#include <avr/io.h>
#include "FreeRTOSConfig.h"
#if (configCPU_CLOCK_HZ == 20000000)
#define CLK_init() _PROTECTED_WRITE(CLKCTRL.MCLKCTRLA, CLKCTRL_CLKSEL_OSC20M_gc);
#elif (configCPU_CLOCK_HZ == 10000000)
#define CLK_init() _PROTECTED_WRITE(CLKCTRL.MCLKCTRLA, CLKCTRL_CLKSEL_OSC20M_gc); \
_PROTECTED_WRITE(CLKCTRL.MCLKCTRLB, CLKCTRL_PDIV_2X_gc | CLKCTRL_PEN_bm);
#elif (configCPU_CLOCK_HZ == 5000000)
#define CLK_init() _PROTECTED_WRITE(CLKCTRL.MCLKCTRLA, CLKCTRL_CLKSEL_OSC20M_gc); \
_PROTECTED_WRITE(CLKCTRL.MCLKCTRLB, CLKCTRL_PDIV_4X_gc | CLKCTRL_PEN_bm);
#elif (configCPU_CLOCK_HZ == 2000000)
#define CLK_init() _PROTECTED_WRITE(CLKCTRL.MCLKCTRLA, CLKCTRL_CLKSEL_OSC20M_gc); \
_PROTECTED_WRITE(CLKCTRL.MCLKCTRLB, CLKCTRL_PDIV_10X_gc | CLKCTRL_PEN_bm);
#else
#error The selected clock frequency is not supported. Choose a value from the NOTE in FreeRTOSConfig.h.
#endif
#endif /* CLK_CONFIG_H_ */