All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] using the RTAI skin
@ 2010-01-21 15:59 gohlx002
  2010-01-21 16:13 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 5+ messages in thread
From: gohlx002 @ 2010-01-21 15:59 UTC (permalink / raw)
  To: xenomai

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>


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

end of thread, other threads:[~2010-01-21 17:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-21 15:59 [Xenomai-help] using the RTAI skin gohlx002
2010-01-21 16:13 ` Gilles Chanteperdrix
2010-01-21 17:12   ` gohlx002
2010-01-21 17:40     ` Gilles Chanteperdrix
2010-01-21 17:56       ` Philippe Gerum

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.