Hooking a kernelmodule-function into a timer interrupt

Michiel Overtoom michiel at motoom.org
Mon Nov 19 16:16:22 PST 2007

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 


"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

More information about the freebsd-hackers mailing list