diff options
author | Daniel Friesel <derf@finalrewind.org> | 2020-07-26 11:55:32 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2020-07-26 12:03:45 +0200 |
commit | 8458978ad5512dc813ac700d59983c56917fa205 (patch) | |
tree | 4f34847064c98c5aca0ca0e95ef9f814d2edfb16 /src/arch/stm32f446re-nucleo/arch.cc | |
parent | d0ea0a521a582549dfd9a98b47e7c12d8bcd0de6 (diff) |
Add minimal STM32F446RE Nucleo support. No interrupts yet.
Diffstat (limited to 'src/arch/stm32f446re-nucleo/arch.cc')
-rw-r--r-- | src/arch/stm32f446re-nucleo/arch.cc | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/arch/stm32f446re-nucleo/arch.cc b/src/arch/stm32f446re-nucleo/arch.cc new file mode 100644 index 0000000..12a612a --- /dev/null +++ b/src/arch/stm32f446re-nucleo/arch.cc @@ -0,0 +1,54 @@ +#include "arch.h" + +#ifdef __acweaving +#define __delay_cycles(x) +#endif + +void Arch::setup(void) +{ +} + +#ifdef WITH_WAKEUP +extern void wakeup(); +#endif + +#if defined(WITH_LOOP) +extern void loop(); +volatile char run_loop = 0; +#endif + +void Arch::delay_us(unsigned int const us) +{ + volatile int x = us * 2; + while (x--) { + __asm("nop"); + } +} +void Arch::delay_ms(unsigned int const ms) +{ + for (unsigned int i = 0; i < ms; i++) { + volatile int x = 2000; + while (x--) { + __asm("nop"); + } + } +} + +void Arch::idle_loop(void) +{ + while (1) { + delay_ms(1000); +#ifdef WITH_LOOP + loop(); +#endif + } +} + +void Arch::idle(void) +{ +#ifdef WITH_WAKEUP + wakeup(); +#endif +} + +Arch arch; |