[BACK]Return to kern_time.h CVS log [TXT][DIR] Up to [local] / funnyos / sys

File: [local] / funnyos / sys / kern_time.h (download)

Revision 1.1, Tue Nov 6 22:52:39 2007 UTC (16 years, 4 months ago) by init
Branch: MAIN
CVS Tags: HEAD

System time functions/interface.
rtc driver fills struct sysrtcops with its own callbacks, allowing to machine-independent
time-related manipulations.
sysclock_init() programms RTC hardware with HZ;
sysclock() will be called by RTC intr handler (in IRQ mode) and update timedata with seconds past Epoch.

Still more work to do; now it just prints system time from sysclock().

/*
 * $Id: kern_time.h,v 1.1 2007/11/06 22:52:39 init Exp $
 */
#ifndef _SYS_KERN_TIME_H
#define _SYS_KERN_TIME_H

#include <sys/types.h>

#define HZ 		100

/*
 * rtcops is a RTC manipulation abstraction.
 * RTC device drivers should provide this information to kern_time.
 */
struct rtcops {
	void 		(*ro_sethz)(uint8_t hz); 	/* function to set timer hz */
	uint32_t	(*ro_getsec)(void);			/* get seconds past Epoch */
	uint32_t 	(*ro_getusec)(void); 		/* get microseconds */
};

/*
 * Every tick system will update time data.
 */
struct timedata {
	uint32_t 	td_seconds;	/* seconds past Epoch */
	/* XXX */
};

void 	sysclock_init(void);
void 	sysclock(void);

#endif /* not _SYS_KERN_TIME_H */