All of lore.kernel.org
 help / color / mirror / Atom feed
* Looking for "Hello world"
@ 2006-12-04 15:24 Vucsics Krisztian
  2006-12-04 16:10 ` Darren Hart
  2006-12-04 16:13 ` Darren Hart
  0 siblings, 2 replies; 6+ messages in thread
From: Vucsics Krisztian @ 2006-12-04 15:24 UTC (permalink / raw)
  To: linux-rt-users

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

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

* Re: Looking for "Hello world"
  2006-12-04 15:24 Looking for "Hello world" Vucsics Krisztian
@ 2006-12-04 16:10 ` Darren Hart
  2006-12-04 16:13 ` Darren Hart
  1 sibling, 0 replies; 6+ messages in thread
From: Darren Hart @ 2006-12-04 16:10 UTC (permalink / raw)
  To: Vucsics Krisztian; +Cc: linux-rt-users

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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Darren Hart
IBM Linux Technology Center
Realtime Linux Team

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

* Re: Looking for "Hello world"
  2006-12-04 15:24 Looking for "Hello world" Vucsics Krisztian
  2006-12-04 16:10 ` Darren Hart
@ 2006-12-04 16:13 ` Darren Hart
  2006-12-05 15:27   ` Vucsics Krisztian
  1 sibling, 1 reply; 6+ messages in thread
From: Darren Hart @ 2006-12-04 16:13 UTC (permalink / raw)
  To: Vucsics Krisztian; +Cc: linux-rt-users

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?

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.

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

-- 
Darren Hart
IBM Linux Technology Center
Realtime Linux Team

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

* Re: Looking for "Hello world"
  2006-12-04 16:13 ` Darren Hart
@ 2006-12-05 15:27   ` Vucsics Krisztian
  2006-12-05 16:16     ` Darren Hart
  0 siblings, 1 reply; 6+ messages in thread
From: Vucsics Krisztian @ 2006-12-05 15:27 UTC (permalink / raw)
  To: Darren Hart; +Cc: linux-rt-users

Hi Darren,

> http://www.kernel.org/pub/linux/kernel/people/dvhart/realtime/tests/

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

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

* Re: Looking for "Hello world"
  2006-12-05 15:27   ` Vucsics Krisztian
@ 2006-12-05 16:16     ` Darren Hart
  2006-12-05 16:36       ` Thomas Gleixner
  0 siblings, 1 reply; 6+ messages in thread
From: Darren Hart @ 2006-12-05 16:16 UTC (permalink / raw)
  To: Vucsics Krisztian; +Cc: linux-rt-users

On Tuesday 05 December 2006 07:27, Vucsics Krisztian wrote:
> Hi Darren,
>
> > http://www.kernel.org/pub/linux/kernel/people/dvhart/realtime/tests/
>
> 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

>
> 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

-- 
Darren Hart
IBM Linux Technology Center
Realtime Linux Team

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

* Re: Looking for "Hello world"
  2006-12-05 16:16     ` Darren Hart
@ 2006-12-05 16:36       ` Thomas Gleixner
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Gleixner @ 2006-12-05 16:36 UTC (permalink / raw)
  To: Darren Hart; +Cc: Vucsics Krisztian, linux-rt-users

On Tue, 2006-12-05 at 08:16 -0800, Darren Hart wrote:
> On Tuesday 05 December 2006 07:27, Vucsics Krisztian wrote:
> > Hi Darren,
> >
> > > http://www.kernel.org/pub/linux/kernel/people/dvhart/realtime/tests/
> >
> > 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.

Install glibc2.5. All major distros have a package for it.

	tglx

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

end of thread, other threads:[~2006-12-05 16:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-04 15:24 Looking for "Hello world" Vucsics Krisztian
2006-12-04 16:10 ` Darren Hart
2006-12-04 16:13 ` Darren Hart
2006-12-05 15:27   ` Vucsics Krisztian
2006-12-05 16:16     ` Darren Hart
2006-12-05 16:36       ` Thomas Gleixner

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.