Doing floating point calculations in kernel space

Toni Van Remortel t.vanremortel at ha.be
Fri Oct 17 17:15:39 EST 2003


Hi all,

When I thought it was a /proc problem, it was a float problem.
The CPU (405GP) has no FPU, but I need to calculate sin and cos in a
kernel module.
Why? Well, we use a formula to draw figures (all deformed circles).
Those figures can be defined with only 6 parameters, which are passed
from the control-panel (in userspace) to the RTAI-powered kernel module.
That module calculates the X and Y positions, creates PWM signals from
it and outputs them to GPIO1 and 2.

I don't see another approach to get this working, because the
control-panel isn't real time, while the kernel module is. So the module
needs to calculate the X and Y positions from the 6 parameters.

To make it short: can I use floating points in kernel space? The info
I've found just tells me 'no', but I'm wondering if there are any
workarounds for this.
I did find some 'faster math functions' which don't require any sin or
cos anymore, but they do require floating points.

A possible solution to me, is using 'unsinged long int' multiplied by
some factor of 10.

Anybody a better solution?

PS: might be a bit off topic here, sorry about that.
--
                           Toni Van Remortel
              Wetenschappelijk Medewerker - D-science lab
  Real time Linux for embedded systems: http://linemb.d-sciencelab.com
              Tel: +32 3 205 61 72 - Fax: +32 3 205 61 95
                      E-mail: t.vanremortel at ha.be


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-embedded mailing list