From owner-freebsd-hackers Tue Sep 9 19:30:37 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id TAA27195 for hackers-outgoing; Tue, 9 Sep 1997 19:30:37 -0700 (PDT) Received: from alpo.whistle.com (alpo.whistle.com [207.76.204.38]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id TAA27179 for ; Tue, 9 Sep 1997 19:30:31 -0700 (PDT) Received: (from daemon@localhost) by alpo.whistle.com (8.8.5/8.8.5) id TAA20222; Tue, 9 Sep 1997 19:23:05 -0700 (PDT) Received: from current1.whistle.com(207.76.205.22) via SMTP by alpo.whistle.com, id smtpd020212; Wed Sep 10 02:22:51 1997 Message-ID: <3416045E.446B9B3D@whistle.com> Date: Tue, 09 Sep 1997 19:22:22 -0700 From: Julian Elischer Organization: Whistle Communications X-Mailer: Mozilla 3.0Gold (X11; I; FreeBSD 2.2-CURRENT i386) MIME-Version: 1.0 To: "Jamil J. Weatherbee" CC: freebsd-hackers@FreeBSD.ORG Subject: Re: Realtime Programming Under FreeBSD? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Jamil J. Weatherbee wrote: > > Can someone give a code snippet of the BEST way of running a 1000HZ for > loop under freebsd, without consuming massive amounts of cpu time. > > Thank You In advance. check the pcaudio driver. it sets the hardware interrupt speed to 16000 Hz (!) using the routines in the kernel, you can get a function (in the kernel) to be called at each H/W interrupt, and you can make the H/w interrupts be a multiple of the hz value (normally 100) the pcaudio claims all the timers, (2 timers are used to control the audio hardware in PCs (pitch and beep-duration) you don't need to do that, just look at how it changes the timer.. 1000Hz, not a real problem compared to 16000. :) julian