All of lore.kernel.org
 help / color / mirror / Atom feed
From: Darren Hart <dvhltc@us.ibm.com>
To: Vucsics Krisztian <krisztian.vucsics@evosoft.com>
Cc: linux-rt-users@vger.kernel.org
Subject: Re: Looking for "Hello world"
Date: Mon, 4 Dec 2006 08:10:37 -0800	[thread overview]
Message-ID: <200612040810.38126.dvhltc@us.ibm.com> (raw)
In-Reply-To: <45743DAF.6020205@evosoft.com>

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

  reply	other threads:[~2006-12-04 16:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-04 15:24 Looking for "Hello world" Vucsics Krisztian
2006-12-04 16:10 ` Darren Hart [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200612040810.38126.dvhltc@us.ibm.com \
    --to=dvhltc@us.ibm.com \
    --cc=krisztian.vucsics@evosoft.com \
    --cc=linux-rt-users@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.