All of lore.kernel.org
 help / color / mirror / Atom feed
From: gohlx002@domain.hid
To: xenomai@xenomai.org
Subject: [Xenomai-help] using the RTAI skin
Date: 21 Jan 2010 09:59:43 -0600	[thread overview]
Message-ID: <Gophermail.2.0.1001210959431.7980@domain.hid> (raw)

Hello all,

I'm doing some investigation on migrating my application from RTAI to 
Xenomai. From the description of a Xenomai skin, it seems like I might be 
able to use the RTAI skin to run my application "as is". Along this line, I 
put together a small test application in RTAI that would be very 
illustrative if I can get it to run in Xenomai. The first step is of course 
compiling it which I haven't been able to do because of missing references 
to all the RTAI functions (e.g. rt_task_init_schmod). If someone feels like 
helping out, we could work through this whole process (from an RTAI app to 
running on Xenomai) and turn this into another example to add to the 
examples folder for future reference. Here's the application I'm trying to 
compile (the Makefile I just adapted from the native examples folder and 
changed the application name):

<CODE SNIP>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>

#include <rtai_lxrt.h>

int main(int argc, char *argv[])
{

	RT_TASK *rttsk;
	RTIME period;
	int  hrt = 1;
	int idx, end = 0;
	
	rt_allow_nonroot_hrt();

         if (!(rttsk = rt_task_init_schmod(nam2num("RTTSK"), 2, 0, 0, 
SCHED_FIFO, 0xF))) {
		printf("CANNOT INIT THE TASK\n");
		exit(1);
	}

	/*****************************************************************/
	/* start the scheduler */
	
	rt_set_oneshot_mode();
	start_rt_timer(0);
	
	/*****************************************************************/
	/***********************************************************/
	/* run the task */
	
	mlockall(MCL_CURRENT | MCL_FUTURE);
	
	printf("\nSTARTING TASK\n\n");
	if (hrt) rt_make_hard_real_time();  
	
	if (hrt) {
		rt_printk("\nTASK RUNNING\n\n");
	}else{
		printf("\nTASK RUNNING\n\n");
	}

	period = nano2count(1e8);
	
	rt_task_make_periodic(rttsk, rt_get_time(), period);

	for (idx = 0; idx < 10 && !end; idx++) {	
		if (hrt) {
			rt_printk("Finished step %d\n", idx);
			printf("Finished step %d\n", idx);
		} else {
			printf("Finished step %d\n", idx);
		}
	
		/* pause */
		rt_task_wait_period();
	}
	

	rt_sleep(nano2count(1E8));	
	rt_make_soft_real_time();
	
	/***********************************************************/

	stop_rt_timer();	
	rt_task_delete(rttsk);
	printf("\nTASK STOPPED\n");
	return 0;
}
</CODE SNIP>


             reply	other threads:[~2010-01-21 15:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-21 15:59 gohlx002 [this message]
2010-01-21 16:13 ` [Xenomai-help] using the RTAI skin Gilles Chanteperdrix
2010-01-21 17:12   ` gohlx002
2010-01-21 17:40     ` Gilles Chanteperdrix
2010-01-21 17:56       ` Philippe Gerum

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=Gophermail.2.0.1001210959431.7980@domain.hid \
    --to=gohlx002@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.