From owner-freebsd-hackers@FreeBSD.ORG Tue Nov 20 00:16:22 2007 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AB2CD16A417 for ; Tue, 20 Nov 2007 00:16:22 +0000 (UTC) (envelope-from michiel@motoom.org) Received: from smtp-vbr16.xs4all.nl (smtp-vbr16.xs4all.nl [194.109.24.36]) by mx1.freebsd.org (Postfix) with ESMTP id 3D77413C465 for ; Tue, 20 Nov 2007 00:16:22 +0000 (UTC) (envelope-from michiel@motoom.org) Received: from [192.168.2.152] (cc351901-a.groni1.gr.home.nl [82.73.85.80]) (authenticated bits=0) by smtp-vbr16.xs4all.nl (8.13.8/8.13.8) with ESMTP id lAJNpj02063212 for ; Tue, 20 Nov 2007 00:51:46 +0100 (CET) (envelope-from michiel@motoom.org) From: Michiel Overtoom To: freebsd-hackers@freebsd.org Date: Tue, 20 Nov 2007 00:51:45 +0100 User-Agent: KMail/1.9.7 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200711200051.45420.michiel@motoom.org> X-Virus-Scanned: by XS4ALL Virus Scanner Subject: Hooking a kernelmodule-function into a timer interrupt X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Nov 2007 00:16:22 -0000 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