linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Doing floating point calculations in kernel space
@ 2003-10-17  7:15 Toni Van Remortel
  2003-10-17  7:33 ` Wolfgang Grandegger
  0 siblings, 1 reply; 8+ messages in thread
From: Toni Van Remortel @ 2003-10-17  7:15 UTC (permalink / raw)
  To: Linuxppc-Embedded


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@ha.be


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

^ permalink raw reply	[flat|nested] 8+ messages in thread
* RE: Doing floating point calculations in kernel space
@ 2003-10-17 12:16 ARIBAUD Albert
  2003-10-17 12:37 ` Toni Van Remortel
  0 siblings, 1 reply; 8+ messages in thread
From: ARIBAUD Albert @ 2003-10-17 12:16 UTC (permalink / raw)
  To: Linuxppc-Embedded


> -----Message d'origine-----
> De : owner-linuxppc-embedded@lists.linuxppc.org
> [mailto:owner-linuxppc-embedded@lists.linuxppc.org]De la part de Toni
> Van Remortel
> Envoyé : vendredi 17 octobre 2003 09:16
> À : Linuxppc-Embedded
> Objet : Doing floating point calculations in kernel space
>
>
>
> 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.

Hmm... Bit off-topic, but why not use tables tailored to the
precision you need (if you want to compute any sin or cas any time)
or the equivalent of the Bresenham algorithm (if you only want to
draw arcs or ellipes) ?

HTH,

Albert.

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-10-17 12:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-17  7:15 Doing floating point calculations in kernel space Toni Van Remortel
2003-10-17  7:33 ` Wolfgang Grandegger
2003-10-17  7:52   ` Toni Van Remortel
2003-10-17  8:59     ` Toni Van Remortel
2003-10-17 10:06       ` Wolfgang Grandegger
2003-10-17 12:22         ` Gary Thomas
  -- strict thread matches above, loose matches on Subject: below --
2003-10-17 12:16 ARIBAUD Albert
2003-10-17 12:37 ` Toni Van Remortel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).