All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] Xenomai serial port c++ code and / or xeno-- (xenomm-0.0.1) install problem
@ 2008-04-22 22:46 Karch, Joshua
  2008-04-23  0:12 ` Gilles Chanteperdrix
       [not found] ` <51B669A8A7D2914E9AB2B3F40AC6553E646F52@domain.hid>
  0 siblings, 2 replies; 30+ messages in thread
From: Karch, Joshua @ 2008-04-22 22:46 UTC (permalink / raw)
  To: xenomai

[-- Attachment #1: Type: text/plain, Size: 2312 bytes --]


Hello,

I recently installed Xenomai on a PC/104 and began writing a C++ program that makes use of the serial port.  I tried using the Xenomai Serial port example program cross-link.c and I was successful in getting that to run. I edited cross-link.c to read only from a device running at 115200 on the serial port.  I have found the standard /dev/ttyS0 serial port to be useless for my application since I get overrun errors on my system.  

My C++ program reads byte at a time from a serial port, processes the byte, then repeats until a checksummed packet is received.  I have two specific questions as to how to get the serial port to work under Xenomai with c++

The way I understand port reading is as follows:

1) Open device using read_fd = rt_dev_open( READ_FILE, 0 ) and set it up
    err = rt_dev_ioctl(read_fd, RTSER_RTIOC_SET_CONFIG, &read_config);
2) It is necessary to create an RT_TASK analogous to a thread to service the serial port task
    err = rt_task_create(&read_task, "read_task", 0, 51, 0);
3) for each byte read, activate the read task with rt_task_start
    err = rt_task_start(&read_task,&read_task_proc,NULL);
    4) Within the Real Time read_task_proc, request one byte at a time within the rt_task_process using
        err = rt_dev_ioctl(read_fd, RTSER_RTIOC_WAIT_EVENT, &rx_event);
        read = rt_dev_read(read_fd, buffer, 1);
5)  read from the buffer into the user application in non-real time mode

6)  close when done

The problem I am having with this method is that 
int 	rt_task_start (RT_TASK *task, void(*fun)(void *cookie), void *cookie)
won't accept a pointer to an object method and requires a pointer to an instance to map into the void(*fun)(void *cookie), void *cookie section.

With Pthreads, I instantiate a threaded main loop within an object as follows:
void * serial::thunk(void * param)
{
	serial *instance = (serial *) param;
	instance->read_task_proc();

}

Is there a similar way to do this with rt_tasks?  In particular, if a c++ based serial read example were available for byte-at-a-time, that would be very useful.

Also, xenomm-0.0.1 failed under ./configure with "checking value of TM_UNSET in native/timer.h"-- any ideas on how to get xenomm (xeno--) working?  Is it useful?

Thank you,

Joshua Karch


[-- Attachment #2: Type: text/html, Size: 3211 bytes --]

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

end of thread, other threads:[~2008-04-30 19:22 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-22 22:46 [Xenomai-help] Xenomai serial port c++ code and / or xeno-- (xenomm-0.0.1) install problem Karch, Joshua
2008-04-23  0:12 ` Gilles Chanteperdrix
     [not found]   ` <51B669A8A7D2914E9AB2B3F40AC6553E646F15@domain.hid>
2008-04-23 13:58     ` [Xenomai-help] Xenomai serial port c++ code and / or xeno--(xenomm-0.0.1) " Gilles Chanteperdrix
2008-04-23 14:25       ` Karch, Joshua
2008-04-23 14:30         ` Gilles Chanteperdrix
2008-04-23 15:43           ` Karch, Joshua
2008-04-23 18:10             ` Gilles Chanteperdrix
     [not found]               ` <51B669A8A7D2914E9AB2B3F40AC6553E646F1D@afsexc01.aurora.aero>
2008-04-23 21:20                 ` [Xenomai-help] FW: " Karch, Joshua
2008-04-23 21:28                 ` [Xenomai-help] " Gilles Chanteperdrix
2008-04-23 21:36                   ` Karch, Joshua
2008-04-23 22:14                   ` [Xenomai-help] serial port overrun problem RT TASK Karch, Joshua
2008-04-24  6:43                     ` Gilles Chanteperdrix
2008-04-24  7:04                       ` Jan Kiszka
2008-04-24 14:16                         ` Karch, Joshua
2008-04-24 14:30                           ` Gilles Chanteperdrix
2008-04-24 16:58                             ` Karch, Joshua
2008-04-24 17:16                               ` Gilles Chanteperdrix
2008-04-24 22:37                                 ` [Xenomai-help] serial port overrun problem RT TASK geode latencies too high Karch, Joshua
2008-04-24 22:59                                   ` Gilles Chanteperdrix
2008-04-25 16:04                                     ` [Xenomai-help] Geode Latency Problem (Was: serial port overrun problem) Karch, Joshua
2008-04-25 16:12                                       ` Gilles Chanteperdrix
2008-04-24 13:59                       ` [Xenomai-help] serial port overrun problem RT TASK Karch, Joshua
2008-04-24 14:01                         ` Gilles Chanteperdrix
     [not found] ` <51B669A8A7D2914E9AB2B3F40AC6553E646F52@domain.hid>
     [not found]   ` <18454.9396.476627.446653@domain.hid>
     [not found]     ` <51B669A8A7D2914E9AB2B3F40AC6553E646F54@domain.hid>
     [not found]       ` <48162C69.6040101@domain.hid>
     [not found]         ` <18454.12323.344999.258031@domain.hid>
     [not found]           ` <51B669A8A7D2914E9AB2B3F40AC6553E646F55@domain.hid>
     [not found]             ` <48163EE7.5000604@domain.hid>
     [not found]               ` <18454.17297.451664.334250@domain.hid>
     [not found]                 ` <48164652.5090102@domain.hid>
     [not found]                   ` <2ff1a98a0804290252j1c9dc444kffb345ebaeb123d@domain.hid>
     [not found]                     ` <48187366.2060006@domain.hid>
2008-04-30 18:13                       ` [Xenomai-help] Segfault Problems with Message Queues Karch, Joshua
2008-04-30 18:31                         ` Philippe Gerum
2008-04-30 18:41                           ` Karch, Joshua
2008-04-30 18:48                             ` Philippe Gerum
2008-04-30 19:22                               ` Karch, Joshua
2008-04-30 18:36                         ` Philippe Gerum
2008-04-30 19:19                         ` Gilles Chanteperdrix

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.