Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Nov 2007 00:51:45 +0100
From:      Michiel Overtoom <michiel@motoom.org>
To:        freebsd-hackers@freebsd.org
Subject:   Hooking a kernelmodule-function into a timer interrupt
Message-ID:  <200711200051.45420.michiel@motoom.org>

next in thread | raw e-mail | index | archive | help

I'm interfacing an analog-digital converter to the parallel port and I'm able 
to make it work from userland using the ppio driver.  But now I want to move 
the conversion software into a loadable kernel module, and have the 
conversion routine called many times per second, for example 1000 times per 
second.  If would be nice if it gets called at the kern.clockrate.  I have no 
clear idea how to proceed, I suspect I have to install a pointer to my 
conversion function into some list of functions which get called each clock 
tick, but I don't know where, or how. Any tips would be very welcome.

Some more background info: the chip is a ADC08031, hooked up directly to some 
input and output pins on the parallel port. The ADC has a serial output, and 
I use one pin on the parport to clock it. I want to have the clocking code 
executed in some low level timer interrupt handler. I inserted some test code 
into 'hardclock()' in 'kern_clock.c' to toggle a bit on the parport, which 
worked nicely: it got called 1000 times per second, which I could actually 
verify with a frequency meter hooked up to the parport; but stuffing the 
conversion software directly into kern_clock.c would not be an elegant 
solution.

Greetings,

-- 
"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Vallopillil
http://www.catb.org/~esr/halloween/halloween4.html




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200711200051.45420.michiel>