static void idle_thread(void) { while (1) { if (lpm_prevent_sleep) { lpm_set(LPM_IDLE); } else { lpm_set(LPM_IDLE); /* lpm_set(LPM_SLEEP); */ /* lpm_set(LPM_POWERDOWN); */ } } }
/* WARNING: this function NEVER returns! */ NORETURN void core_panic(int crash_code, const char *message) { /* copy panic datas to "public" global variables */ panic_code = crash_code; strncpy(panic_str, message, 80); /* print panic message to console (if possible) */ if (crashed == 0) { crashed = 1; puts("******** SYSTEM FAILURE ********\n"); puts(message); #if DEVELHELP puts("******** RIOT HALTS HERE ********\n"); #else puts("******** RIOT WILL REBOOT ********\n"); #endif puts("\n\n"); } /* disable watchdog and all possible sources of interrupts */ //TODO dINT(); #if DEVELHELP /* enter infinite loop, into deepest possible sleep mode */ while (1) { lpm_set(LPM_OFF); } #else /* DEVELHELP not set => reboot system */ /* use dummy mode until used */ reboot(1); #endif }
/* WARNING: this function NEVER returns! */ NORETURN void core_panic(int crash_code, const char *message) { /* copy panic datas to "public" global variables */ panic_code = crash_code; strncpy(panic_str, message, 80); /* (try to) print panic message to console */ if (crashed == 0) { crashed = 1; puts("******** SYSTEM FAILURE ********\n"); puts(message); #if DEVELHELP puts("******** RIOT HALTS HERE ********\n"); #else puts("******** RIOT WILL REBOOT ********\n"); #endif puts("\n\n"); } /* disable watchdog and all possible sources of interrupts */ WDTCTL = WDTPW | WDTHOLD; dINT(); #if DEVELHELP /* enter infinite loop, into deepest possible sleep mode */ while (1) { lpm_set(LPM_OFF); } #else /* DEVELHELP not set => reboot system */ (void) reboot(RB_AUTOBOOT); #endif /* tell the compiler that we won't return from this function (even if we actually won't even get here...) */ UNREACHABLE(); }
static void *idle_thread(void *arg) { (void) arg; while (1) { if (lpm_prevent_sleep) { lpm_set(LPM_IDLE); } else { lpm_set(LPM_IDLE); /* lpm_set(LPM_SLEEP); */ /* lpm_set(LPM_POWERDOWN); */ } } return NULL; }
static void native_shutdown(int sig, siginfo_t *info, void *context) { (void)sig; (void)info; (void)context; lpm_set(LPM_OFF); }
int sol_platform_impl_set_target(const char *target) { if (!strncasecmp(target, SOL_PLATFORM_TARGET_POWEROFF, strlen(SOL_PLATFORM_TARGET_POWEROFF))) { lpm_set(LPM_POWERDOWN); return 0; } if (!strncasecmp(target, SOL_PLATFORM_TARGET_SUSPEND, strlen(SOL_PLATFORM_TARGET_SUSPEND))) { lpm_set(LPM_SLEEP); return 0; } if (!strncasecmp(target, SOL_PLATFORM_TARGET_DEFAULT, strlen(SOL_PLATFORM_TARGET_DEFAULT))) { lpm_set(LPM_ON); return 0; } SOL_CRI("Unsupported set target %s.", target); return -ENOTSUP; }
void panic_arch(void) { /* disable watchdog and all possible sources of interrupts */ WDTCTL = WDTPW | WDTHOLD; #ifdef DEVELHELP /* enter infinite loop, into deepest possible sleep mode */ while (1) { lpm_set(LPM_OFF); } #endif }
int main(void) { #ifdef OUTPUT TextUIRunner_setOutputter(OUTPUTTER); #endif TESTS_START(); #ifndef NO_TEST_SUITES UNCURRY(RUN_TEST_SUITES, TEST_SUITES) #endif TESTS_END(); lpm_set(LPM_POWERDOWN); return 0; }
int main(void) { kernel_pid_t thr_id = KERNEL_PID_UNDEF; puts("Start spawning\n"); do { thr_id = thread_create( dummy_stack, sizeof(dummy_stack), THREAD_PRIORITY_MAIN - 1, THREAD_CREATE_SLEEPING | THREAD_CREATE_STACKTEST, thread_func, NULL, "dummy"); } while (-EOVERFLOW != thr_id); if (-EOVERFLOW == thr_id) { puts("Thread creation successful aborted\n"); } lpm_set(LPM_OFF); return 0; }
void sol_platform_impl_shutdown(void) { lpm_set(LPM_POWERDOWN); }