Floating point in interrupt handler
Daan Vreeken [PA4DAN]
Danovitsch at vitsch.net
Mon Oct 22 23:05:36 PDT 2007
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
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.
More information about the freebsd-hackers