/* * $Id: kern_time.c,v 1.3 2007/11/24 20:55:53 nbrk Exp $ */ #include #include #include #include /* * Kernel time-related stuff. */ struct rtcops sysrtcops = {NULL, NULL, NULL}; /* system will use this to control rtc hardware */ struct timedata systimedata; void sysclock_init(void) { /* * Start system clock. */ /* panic if driver haven't configured rtcops for us */ if (sysrtcops.ro_sethz == NULL) panic("sysclock_init: clock init failed; can't find rtc driver entry points (sysrtcops is null)\n"); /* configure hardware */ sysrtcops.ro_sethz(HZ); } void sysclock(void) { /* * Process one system tick. * RTC interrupt handler will call us; remember that we are in interrupt mode here. */ #ifndef ARCH_SAM7S64 /* update time data */ systimedata.td_seconds = sysrtcops.ro_getsec(); /* kick scheduler */ sched_tick(); #else printf("sysclock!\n"); #endif /* not ARCH_SAM7S64 */ }