Working RTAI LXRT example

Add README's for RTDM examples
This commit is contained in:
Andreas Stewering-Bone 2011-03-23 08:06:58 +01:00
parent ca28aa60e2
commit 9699c81876
8 changed files with 126 additions and 11 deletions

View File

@ -27,6 +27,7 @@ General Features:
* Supports any realtime environment through independent architecture.
- RTAI, Xenomai, RT-Preempt, etc.
- RTDM Interface for userspace realtime enviroments
- Operation possible without any realtime extension at all.
* Common API for Realtime-Applications in kernel- and userspace.

View File

@ -33,8 +33,8 @@ AM_CFLAGS = -Wall
noinst_PROGRAMS = ec_rtai_rtdm_example
ec_rtai_rtdm_example_SOURCES = main.c
ec_rtai_rtdm_example_CFLAGS = -I. -I/opt/etherlab/rtai/include -O2 -I/home/ab/Download/rtai/linux-2.6.32.11/include -Wall -Wstrict-prototypes -pipe -I$(top_srcdir)/include
ec_rtai_rtdm_example_LDFLAGS = -L/opt/etherlab/rtai/lib -llxrt -lrtdm -lpthread -L$(top_builddir)/lib/.libs -lethercat
ec_rtai_rtdm_example_CFLAGS = -I. -I"$(RTAI_DIR)"/include -O2 -I"$(LINUX_SOURCE_DIR)"/include -Wall -Wstrict-prototypes -pipe -I$(top_srcdir)/include
ec_rtai_rtdm_example_LDFLAGS = -L"$(RTAI_DIR)"/lib -llxrt -lrtdm -lpthread -L$(top_builddir)/lib/.libs -lethercat
#------------------------------------------------------------------------------

40
examples/rtai_rtdm/README Normal file
View File

@ -0,0 +1,40 @@
-------------------------------------------------------------------------------
$Id$
-------------------------------------------------------------------------------
This is a minimal example application for the use of the EtherCAT
master realtime RTDM interface with an RTAI-LXRT thread.
The application expects an RTAI installation. Configure the master sources
specifying --enable-rtdm --with-rtai-dir to have the right include paths.
Most probably you'll have different EtherCAT slaves present. Try adjusting the
section "process data" in main.c to your bus configuration.
There are some features that can be disabled by commenting out the respective
defines at the head of main.c.
---
To build the example, call:
make
To run it, load the appropriate RTAI modules:
insmod $(RTAI_DIR)/modules/rtai_hal.ko
insmod $(RTAI_DIR)/modules/rtai_lxrt.ko
insmod $(RTAI_DIR)/modules/rtai_sem.ko
insmod $(RTAI_DIR)/modules/rtai_rtdm.ko
Preload the EtherCAT RTDM module:
modprobe ec_rtdm
and call as root:
./ec_rtai_rtdm_example
...and watch the system logs for the outputs.
-------------------------------------------------------------------------------

View File

@ -447,16 +447,17 @@ void rt_check_master_state(void)
void rt_sync()
void rt_sync(void)
{
uint64_t now_ns;
now_ns = rt_get_real_time_ns();
RTIME now_ns;
uint64_t now;
now_ns = rt_get_cpu_time_ns();
now = (uint64_t)now_ns;
if (rt_fd>=0)
{
ecrt_rtdm_master_application_time(rt_fd, &now_ns);
ecrt_rtdm_master_application_time(rt_fd, &now);
}
if (sync_ref_counter) {
@ -503,6 +504,8 @@ void my_cyclic(void)
period = (int) nano2count((RTIME)cycle*1000);
start_rt_timer(period);
rt_make_hard_real_time();
rt_task_make_periodic(task, rt_get_time() + 10*period, period);
while(1) {
@ -517,6 +520,7 @@ void my_cyclic(void)
if(run == 0) {
rt_make_soft_real_time();
stop_rt_timer();
return;
}

View File

@ -33,7 +33,7 @@ AM_CFLAGS = -Wall
noinst_PROGRAMS = ec_xenomai_example
ec_xenomai_example_SOURCES = main.c
ec_xenomai_example_CFLAGS = -I/opt/etherlab/xenomai/include -D_GNU_SOURCE -D_REENTRANT -Wall -pipe -D__XENO__ -I$(top_srcdir)/include
ec_xenomai_example_LDFLAGS = -lrtdm -L$(top_builddir)/lib/.libs -lethercat -lnative -L/opt/etherlab/xenomai/lib -lrtdk -lxenomai -lpthread
ec_xenomai_example_CFLAGS = -I"$(XENOMAI_DIR)"/include -D_GNU_SOURCE -D_REENTRANT -Wall -pipe -D__XENO__ -I$(top_srcdir)/include
ec_xenomai_example_LDFLAGS = -lrtdm -L$(top_builddir)/lib/.libs -lethercat -lnative -L"$(XENOMAI_DIR)"/lib -lrtdk -lxenomai -lpthread
#------------------------------------------------------------------------------

35
examples/xenomai/README Normal file
View File

@ -0,0 +1,35 @@
-------------------------------------------------------------------------------
$Id$
-------------------------------------------------------------------------------
This is a minimal example application for the use of the EtherCAT
master realtime RTDM interface with an XENOMAI NATIVE thread.
The application expects an XENOMAI installation. Configure the master sources
specifying --enable-rtdm --with-xenomai-dir to have the right include paths.
Most probably you'll have different EtherCAT slaves present. Try adjusting the
section "process data" in main.c to your bus configuration.
There are some features that can be disabled by commenting out the respective
defines at the head of main.c.
---
To build the example, call:
make
To run it, preload the EtherCAT RTDM module:
modprobe ec_rtdm
and call as root:
./ec_xenomai_example
...and watch the system logs for the outputs.
-------------------------------------------------------------------------------

View File

@ -33,8 +33,8 @@ AM_CFLAGS = -Wall
noinst_PROGRAMS = ec_xenomai_posix_example
ec_xenomai_posix_example_SOURCES = main.c
ec_xenomai_posix_example_CFLAGS = -I/opt/etherlab/xenomai/include -D_GNU_SOURCE -D_REENTRANT -Wall -pipe -D__XENO__ -I/opt/etherlab/xenomai/include/posix -I$(top_srcdir)/include
ec_xenomai_posix_example_LDFLAGS = -Wl,@/opt/etherlab/xenomai/lib/posix.wrappers -L/opt/etherlab/xenomai/lib -lpthread_rt -lrtdm -L$(top_builddir)/lib/.libs -lethercat -L/opt/etherlab/xenomai/lib -lrtdk -lxenomai -lpthread
ec_xenomai_posix_example_CFLAGS = -I"$(XENOMAI_DIR)"/include -D_GNU_SOURCE -D_REENTRANT -Wall -pipe -D__XENO__ -I"$(XENOMAI_DIR)"/include/posix -I$(top_srcdir)/include
ec_xenomai_posix_example_LDFLAGS = -Wl,@"$(XENOMAI_DIR)"/lib/posix.wrappers -L"$(XENOMAI_DIR)"/lib -lpthread_rt -lrtdm -L$(top_builddir)/lib/.libs -lethercat -lrtdk -lxenomai -lpthread
#------------------------------------------------------------------------------

View File

@ -0,0 +1,35 @@
-------------------------------------------------------------------------------
$Id$
-------------------------------------------------------------------------------
This is a minimal example application for the use of the EtherCAT
master realtime RTDM interface with an XENOMAI POSIX thread.
The application expects an XENOMAI installation. Configure the master sources
specifying --enable-rtdm --with-xenomai-dir to have the right include paths.
Most probably you'll have different EtherCAT slaves present. Try adjusting the
section "process data" in main.c to your bus configuration.
There are some features that can be disabled by commenting out the respective
defines at the head of main.c.
---
To build the example, call:
make
To run it, preload the EtherCAT RTDM module:
modprobe ec_rtdm
and call as root:
./ec_xenomai_posix_example
...and watch the system logs for the outputs.
-------------------------------------------------------------------------------