Can I change a flow of system call to device driver which is made by my self ?
From: forman (forman76_at_yahoo.co.kr)
Date: 07/31/03
- Previous message: Johan Joed: "Sweden - Embedded linux programmer wanted"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 31 Jul 2003 03:58:37 -0700
kernel have a sys_gettimeofday system call that use a time of CPU. but I have
a RTC( rtc4513 ) in my board. so, I want to chage it like that system call use
my rtc device driver.
at first, I just try .. sys_gettimeofday function call do_gettimeofday.
so, I modified source of do_gettimeofday in /linux/arch/arm/kernel/time.c
[code]
void do_gettimeofday(struct timeval *tv)
{
int fd;
unsigned long flags;
unsigned long usec, sec;
/* getrid of below original part */
/*
read_lock_irqsave(&xtime_lock, flags);
usec = gettimeoffset();
{
unsigned long lost = jiffies - wall_jiffies;
if (lost)
usec += lost * USECS_PER_JIFFY;
}
sec = xtime.tv_sec;
usec += xtime.tv_usec;
read_unlock_irqrestore(&xtime_lock, flags);
*/
/* usec may have gone up a lot: be safe */
/*
while (usec >= 1000000) {
usec -= 1000000;
sec++;
}
tv->tv_sec = sec;
tv->tv_usec = usec;
*/
/* new code */
fd = sys_open ( "/dev/rtc", O_RDWR, 0 ); <-- to call rtc device driver.
sys_ioctl ( fd, 0x1, tv );
}
I did test after recompiling kernel then kernel write this error message
"unable to handle kernel null pointer ~~"
please, check my code.
Is my thinking is rignt ?? ( kernel system call connect to device drive )
- Previous message: Johan Joed: "Sweden - Embedded linux programmer wanted"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|