linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Toni Van Remortel <t.vanremortel@ha.be>
To: Linuxppc-Embedded <linuxppc-embedded@lists.linuxppc.org>
Subject: Doing floating point calculations in kernel space
Date: Fri, 17 Oct 2003 09:15:39 +0200	[thread overview]
Message-ID: <1066374939.735.45.camel@toni> (raw)


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/

             reply	other threads:[~2003-10-17  7:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-17  7:15 Toni Van Remortel [this message]
2003-10-17  7:33 ` Doing floating point calculations in kernel space 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1066374939.735.45.camel@toni \
    --to=t.vanremortel@ha.be \
    --cc=linuxppc-embedded@lists.linuxppc.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).