On Monday 04 December 2006 07:24, Vucsics Krisztian wrote:
> Hello Everybody,
>
> I've checked the RT_PREEMPT_HOWTO but there is no "Hello World" example
> at the moment. I don't know, whether and how it is possible to send
> something via the serial port exactly scheduled, "without changing the
> given programming APIs". I would like to send at least a single 'H' :-)
> to a given serial port, precisely scheduled.
>
> Could you please send me an example for that?

The general approach would be to setup an event that wakes a thread to do the 
writing to the serial port at a specific time.  There are several ways to 
accomplish this.  The simplest approach would be to check the time using 
clock_gettime() (using CLOCK_MONOTONIC) and then sleep for the exact interval 
between that time and the time you want to write your 'H' using 
clock_nanosleep (again with CLOCK_MONOTONIC).  The clock routines have 
nanosecond resolution (and probably 10s of microsecond accuracy, depending on 
your platform).  When you wakeup, write the 'H', then repeat to schedule the 
next write.  There are certainly more advanced approaches using 
pthread_cond_wait() and pthread_cond_signal() from master and slave threads, 
etc.

>
> Thank you in advance,
> Krisztian
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-rt-users"
> in the body of a message to [EMAIL PROTECTED]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Darren Hart
IBM Linux Technology Center
Realtime Linux Team
-
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to