From: Jan Kiszka <jan.kiszka@domain.hid>
To: Brandt Erickson <brandt@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] xnpod help
Date: Thu, 01 Jun 2006 23:16:37 +0200 [thread overview]
Message-ID: <447F5935.4090105@domain.hid> (raw)
In-Reply-To: <39455.155.98.4.39.1149195102.squirrel@domain.hid>
Brandt Erickson wrote:
> I think there's a little bit of a misunderstanding. I'm not trying to
> write my own skin. I'm new to xenomai and I'm just trying write a simple
> kernel module that starts a periodic realtime thread.
Ok, things get clearer. But why a kernel module? Are you *that* short on
CPU cycles? The overhead is rather low, see "latency -t0
-p<your-period>" vs. "latency -t1 -p<your-period>" on your box for a
comparison.
> Write now I'm just
> trying to have it write a simple message to printk but eventually I'm
> going to want it to write to a DAC to control a servo. I've been browsing
> the xenomai API linked off the main website and I thought that using the
> nuclues was the prefered method for doing this but I get the feeling now
> that is not the case. My ultimate goal is to have a realtime kernel-space
> thread that acts as a pid-controller that communicates and synchronizes
> with a non-realtime user-space application that displays pertinent
> information to the user. How would you recommend going about doing that?
In any case, do not use the nucleus directly. Its feasible, for sure,
but rather unhandy for application development. Take a look at the
native or the posix API instead.
Again, consider carefully if the inconvenience to go to kernel space is
really required. You will understand what I mean when you start thinking
about how to communicate between the RT and the Linux tasks.
Here is a simple native example which can easily be extended with
pthreads for non-RT jobs, or use main() directly:
#include <signal.h>
#include <sys/mman.h>
#include <native/task.h>
void demo(void *arg)
{
rt_task_set_periodic(NULL, TM_NOW, 200000);
while (1) {
rt_task_wait_period(NULL);
/* real-time jobs */
}
}
void catch_signal(int sig) { }
int main(int argc, char* argv[])
{
RT_TASK demo_task;
signal(SIGINT, catch_signal);
mlockall(MCL_CURRENT|MCL_FUTURE);
rt_task_create(&demo_task, "mydemo", 0, 99, 0);
rt_task_start(&demo_task, &demo, NULL);
pause();
rt_task_delete(&demo_task);
return 0;
}
Jan
next prev parent reply other threads:[~2006-06-01 21:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-01 18:20 [Xenomai-help] xnpod help Brandt Erickson
2006-06-01 19:06 ` Jan Kiszka
2006-06-01 19:56 ` Gilles Chanteperdrix
2006-06-01 20:10 ` Jan Kiszka
2006-06-01 20:51 ` Brandt Erickson
2006-06-01 21:16 ` Jan Kiszka [this message]
2006-06-01 22:09 ` Brandt Erickson
2006-06-01 22:55 ` Jan Kiszka
2006-06-02 20:41 ` Brandt Erickson
2006-06-03 8:26 ` Jan Kiszka
2006-06-02 12:53 ` Gilles Chanteperdrix
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=447F5935.4090105@domain.hid \
--to=jan.kiszka@domain.hid \
--cc=brandt@domain.hid \
--cc=xenomai@xenomai.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.