コード例 #1
0
ファイル: kernel_init.c プロジェクト: 4120976/RIOT
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); */
        }
    }
}
コード例 #2
0
ファイル: crash.c プロジェクト: chrisjn52/thirdparty_cpu
/* 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
}
コード例 #3
0
ファイル: crash.c プロジェクト: A-L-E-X/RIOT
/* 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();
}
コード例 #4
0
ファイル: kernel_init.c プロジェクト: AnonMall/RIOT
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;
}
コード例 #5
0
ファイル: irq_cpu.c プロジェクト: JMR-b/RIOT
static void native_shutdown(int sig, siginfo_t *info, void *context)
{
    (void)sig;
    (void)info;
    (void)context;

    lpm_set(LPM_OFF);
}
コード例 #6
0
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;
}
コード例 #7
0
ファイル: panic.c プロジェクト: AdamRLukaitis/RIOT
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

}
コード例 #8
0
ファイル: main.c プロジェクト: AnonMall/RIOT
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;
}
コード例 #9
0
ファイル: main.c プロジェクト: AdamRLukaitis/RIOT
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;
}
コード例 #10
0
void
sol_platform_impl_shutdown(void)
{
    lpm_set(LPM_POWERDOWN);
}