int *int_handler_0c(int *esp){ struct CONSOLE *cons = (struct CONSOLE *)*((int *)0x0fec); struct TASK *task = task_now(); char s[30]; sprintf(s,"\nEIP = 0x%08X", esp[11]); cons_puts(cons, s); cons_puts(cons,"\nInt 0x0C :\n\tStack Exception\n"); return &(task->tss.esp0); }
static void pm_timeout(void *arg) { struct pm_softc *sc = arg; int s, reload; s = splhigh(); sc->idlecnt++; splx(s); DPRINTF(("pm: idlecnt=%d\n", sc->idlecnt)); if (sc->sustime != 0 && sc->idlecnt >= sc->sustime) { #ifdef CONFIG_CONS cons_puts("\nThe system is about to suspend..."); #endif pm_suspend(); } else { reload = 0; if (sc->dimtime != 0 && sc->idlecnt >= sc->dimtime) { pm_lcd_off(); if (sc->sustime != 0) reload = 1; } else reload = 1; if (reload) timer_callout(&sc->timer, 1000, &pm_timeout, sc); } }
void *_talloc_zero(void *ctx, unsigned int size, const char *name) { unsigned long flags; unsigned int i; local_firq_save(flags); if (size > sizeof(struct msgb) + MSGB_DATA_SIZE) goto panic; for (i = 0; i < ARRAY_SIZE(msgs); i++) { if (!msgs[i].allocated) { msgs[i].allocated = 1; memset(&msgs[i].msg, 0, sizeof(msgs[i].msg)); memset(&msgs[i].buf, 0, sizeof(msgs[i].buf)); local_irq_restore(flags); return &msgs[i].msg; } } panic: cons_puts("unable to allocate msgb\n"); while (1); return NULL; /* not reached */ }
void cons_putchar(char c) { char buf[2]; buf[0] = c; buf[1] = 0; cons_puts(buf,1); }
static int pm_poweroff(void) { DPRINTF(("pm: power off...\n")); pm_stop_timer(); device_broadcast(DEVCTL_PM_POWERDOWN, NULL, 1); driver_shutdown(); #ifdef CONFIG_CONS cons_puts("\nThe system is halted. You can turn off power."); #endif machine_powerdown(PWR_OFF); /* NOTREACHED */ return 0; }
void *_talloc_zero(void *ctx, unsigned int size, const char *name) { unsigned int i; if (size > sizeof(struct msgb) + MSGB_DATA_SIZE) goto panic; while (1) { for (i = 0; i < ARRAY_SIZE(msgs); i++) { if (!msgs[i].allocated) { msgs[i].allocated = 1; memset(&msgs[i].msg, 0, sizeof(&msgs[i].msg)); memset(&msgs[i].buf, 0, sizeof(&msgs[i].buf)); return &msgs[i].msg; } } cons_puts("unable to allocate msgb\n"); bl_level(++i % 50); delay_ms(50); } panic: return NULL; }
void cons_putsln(const char *s) { cons_puts(s); cons_puts("\r\n"); }
void app_1hz(void) { cons_puts("1hz\r\n"); }