Looking for "Hello world"
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?
Thank you in advance,
Krisztian
Quoted 9 lines · Vucsics Krisztian
Hello Everybody,
I've checked the
RT_PREEMPT_HOWTObut 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.
Quoted 9 lines
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
Signature · 3 lines
Darren Hart IBM Linux Technology Center Realtime Linux Team
Quoted 9 lines · Vucsics Krisztian
Hello Everybody,
I've checked the
RT_PREEMPT_HOWTObut 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?
Also, if you are looking for code examples, I suggest taking a look at the numerous test cases provided here (linked off the wiki):
http://www.kernel.org/pub/linux/kernel/people/dvhart/realtime/tests/
These tests use a simple pthread/realtime wrapper called librt.h. You will find numerous uses of clock_gettime() and clock_nanosleep() as well as the pthread_cond_* routines.
Quoted 9 lines
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
Signature · 3 lines
Darren Hart IBM Linux Technology Center Realtime Linux Team
Hi Darren,
I've downloaded your testcases but some of them cannot be compiled, e.g.
func/prio-preempt:../../include/librt.h:597: error: `PTHREAD_PRIO_INHERIT' undeclared (first use in this function)
I've google'd this error and I've found some bug reports for that at January 2006 -- those bugs are reported as "fix in mext versions" but I have the same problem with the most recent kernel also.
coms01:~ # uname -a
Linux coms01 2.6.19 #1 PREEMPT Tue Dec 5 14:51:33 PST 2006 i686 i686 i386 GNU/Linux
Do I need perhaps a patch for that?
Thanks,
Krisztian
Quoted 8 lines · Vucsics Krisztian
Hi Darren,
I've downloaded your testcases but some of them cannot be compiled, e.g.
func/prio-preempt:../../include/librt.h:597: error: `PTHREAD_PRIO_INHERIT' undeclared (first use in this function)
You will need an updated glibc to get this. I am not sure what most folks are doing to get this now a days. Can s omeone chip in here and share with Vucsics how to go about getting the glibc? If this isn't on the wiki somewhere I can add it once I know what the common practice is.
Thanks,
--Darren
Quoted 13 lines
I've google'd this error and I've found some bug reports for that at January 2006 -- those bugs are reported as "fix in mext versions" but I have the same problem with the most recent kernel also.
coms01:~ # uname -a
Linux coms01 2.6.19 #1 PREEMPT Tue Dec 5 14:51:33 PST 2006 i686 i686 i386 GNU/LinuxDo I need perhaps a patch for that?
Thanks,
Krisztian
Signature · 3 lines
Darren Hart IBM Linux Technology Center Realtime Linux Team
Quoted 10 lines · Darren Hart
Quoted 8 lines · Vucsics Krisztian
Hi Darren,
I've downloaded your testcases but some of them cannot be compiled, e.g.
func/prio-preempt:../../include/librt.h:597: error: `PTHREAD_PRIO_INHERIT' undeclared (first use in this function)
Quoted 4 lines
You will need an updated glibc to get this. I am not sure what most folks are doing to get this now a days. Can s omeone chip in here and share with Vucsics how to go about getting the glibc? If this isn't on the wiki somewhere I can add it once I know what the common practice is.
Install glibc2.5. All major distros have a package for it.
tglx