From owner-freebsd-hackers@FreeBSD.ORG Tue Oct 23 06:05:36 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 4D21B16A417 for ; Tue, 23 Oct 2007 06:05:36 +0000 (UTC) (envelope-from Danovitsch@vitsch.net) Received: from VM01.Vitsch.net (vm01.vitsch.net [85.17.51.140]) by mx1.freebsd.org (Postfix) with ESMTP id D89F613C4A5 for ; Tue, 23 Oct 2007 06:05:35 +0000 (UTC) (envelope-from Danovitsch@vitsch.net) Received: from Tuinhuisje.Vitsch.net ([217.166.176.2]) by VM01.Vitsch.net (8.13.8/8.13.8) with ESMTP id l9N63O48063455; Tue, 23 Oct 2007 08:03:25 +0200 (CEST) (envelope-from Danovitsch@vitsch.net) Received: from [192.168.45.230] (dhcp-077-250-050-082.chello.nl [77.250.50.82]) (authenticated bits=0) by Tuinhuisje.Vitsch.net (8.13.1/8.13.1) with ESMTP id l9N64oSX014811; Tue, 23 Oct 2007 08:04:51 +0200 (CEST) (envelope-from Danovitsch@vitsch.net) From: "Daan Vreeken [PA4DAN]" Organization: Vitsch Electronics To: soralx@cydem.org Date: Tue, 23 Oct 2007 08:04:33 +0200 User-Agent: KMail/1.9.7 References: <200710222211.51590.Danovitsch@vitsch.net> <20071022183509.3bdbc65d@soralx> In-Reply-To: <20071022183509.3bdbc65d@soralx> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200710230804.33120.Danovitsch@vitsch.net> Cc: FreeBSD-Hackers@freebsd.org Subject: Re: Floating point in interrupt handler 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, 23 Oct 2007 06:05:36 -0000 Hi SorAlx On Tuesday 23 October 2007 03:35:09 you wrote: > > As a first test I've created a simple loop that uses integer > > arithmetic and a lookup table to create a sine wave on one of the DAC > > outputs. This works like a charm, but I really would like to be able > > to use floating point instructions to create more advanced control > > loops. So I've added asm inline functions to use the FPU's fsin and > > fcos operands. At the start of my loop function I (try to) save the > > FPU state with the following code : > > why do you need floating point? Your ADCs and DACs are probably no more > than 16 bit anyway. Because of several reasons. The most important one being that it's a work related project. I'm the one developing the driver, not the one that's going to write the control loop. I need this driver to be usable by anyone with basic mathematical/programming skills. The second reason would be : "because I know it can be done". The code I currently have successfully uses floating point instructions in the kernel. Any modern CPU can execute extreme amounts of floating point instructions per second. Please lets not try to discuss the (dis)advantages of integer math vs. floating point. I know how to write integer math, but it's not what I'm looking for for this project. Thanks, -- Daan