[BACK]Return to kern_time.c CVS log [TXT][DIR] Up to [local] / funnyos / kern

File: [local] / funnyos / kern / kern_time.c (download)

Revision 1.4, Sun Dec 16 23:25:38 2007 UTC (16 years, 4 months ago) by nbrk
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +3 -3 lines

print seconds as well!

/*
 * $Id: kern_time.c,v 1.4 2007/12/16 23:25:38 nbrk Exp $
 */
#include <sys/types.h>
#include <sys/kern_time.h>
#include <sys/kern_sched.h>

#include <libkern/printf.h>

/*
 * 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.
	 */

	/* update time data */
	systimedata.td_seconds = sysrtcops.ro_getsec();

#ifndef ARCH_SAM7S64
	/* kick scheduler */
	sched_tick();
#else
	printf("sysclock! seconds=%d\n", systimedata.td_seconds);
#endif /* not ARCH_SAM7S64 */

}