Define wait() in fusee-primary/secondary

This commit is contained in:
Luke Street 2018-07-29 12:17:51 -04:00 committed by SciresM
parent 674a91db8c
commit a3d53fbb2c
2 changed files with 14 additions and 0 deletions

View file

@ -13,6 +13,13 @@
#include <inttypes.h> #include <inttypes.h>
void wait(uint32_t microseconds) {
uint32_t old_time = TIMERUS_CNTR_1US_0;
while (TIMERUS_CNTR_1US_0 - old_time <= microseconds) {
/* Spin-lock. */
}
}
__attribute__((noreturn)) void watchdog_reboot(void) { __attribute__((noreturn)) void watchdog_reboot(void) {
volatile watchdog_timers_t *wdt = GET_WDT(4); volatile watchdog_timers_t *wdt = GET_WDT(4);
wdt->PATTERN = WDT_REBOOT_PATTERN; wdt->PATTERN = WDT_REBOOT_PATTERN;

View file

@ -12,6 +12,13 @@
#include <stdio.h> #include <stdio.h>
#include <inttypes.h> #include <inttypes.h>
void wait(uint32_t microseconds) {
uint32_t old_time = TIMERUS_CNTR_1US_0;
while (TIMERUS_CNTR_1US_0 - old_time <= microseconds) {
/* Spin-lock. */
}
}
__attribute__((noreturn)) void watchdog_reboot(void) { __attribute__((noreturn)) void watchdog_reboot(void) {
volatile watchdog_timers_t *wdt = GET_WDT(4); volatile watchdog_timers_t *wdt = GET_WDT(4);
wdt->PATTERN = WDT_REBOOT_PATTERN; wdt->PATTERN = WDT_REBOOT_PATTERN;