All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: ramon costa <ramoncostacastello@domain.hid>
Cc: Xenomai help <xenomai@xenomai.org>
Subject: Re: [Xenomai-help] periodical task in posix skin
Date: Mon, 23 Aug 2010 22:23:35 +0200	[thread overview]
Message-ID: <4C72D8C7.6000303@domain.hid> (raw)
In-Reply-To: <AANLkTik6qbZkrFyWYC4HQten+EcfHLboiSN2eRtTTqnQ@mail.gmail.com>

ramon costa wrote:
> Hi,
> 
> I have developed a very simple task in native code and it works fine
> (included in native.tar.gz). This
> simple task generates a square waveform through the parallel port ( and also
> the speaker).
> 
> Currently I'm trying to transform this code into the POSIX skin (Makefile
> and .c included in posix,tar.gz).
> Unfortunatelly It does not work, although the parallel port shows a square
> waveform its period is not the desired
> one (0.1ms), its period is very small. This makes the system to freeze.
> 
> It seems that pthread_wait_np is not working properly, or may be I'm not
> using pthread_make_periodic_np
> properly. I used it in the following way :
> 
>         #define PERIOD 100000
> 
>         clock_gettime      ( CLOCK_REALTIME, &now);
>         pthread_make_periodic_np (pthread_self(), &now, (struct timespec
> *)PERIOD);

Well, the reason why this does not work is obvious, I am even amazed
that it does not cause a segmentation fault, but you could check
pthread_make_periodic_np return value to have a clue.

> I also have tried
> 
>        struct timespec period;
>        period.tv_sec=0;
>        period.tv_nsec=PERIOD;
> 
>         clock_gettime      ( CLOCK_REALTIME, &now);
>         pthread_make_periodic_np (pthread_self(), &now,&period);
> 
> Although both compile and execute, non of them works fine to me. Any clue ?

Here I have no clue, more exactly, I would need to see the whole code to
see what is going wrong. But again, checking pthread_make_periodic_np
return value, and looking at the documentation would help. My guess
would be that at the time of pthread_make_periodic_np, "now" is a date
in the past.

And pthread_make_periodic_np/pthread_wait_np are supposed to help
porting code from RTLinux, they should not be used in new programs. You
should be using clock_gettime with the TIMER_ABSTIME flag.

-- 
					    Gilles.


  reply	other threads:[~2010-08-23 20:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-23 18:59 [Xenomai-help] periodical task in posix skin ramon costa
2010-08-23 20:23 ` Gilles Chanteperdrix [this message]
2010-08-24 10:25   ` ramon costa
2010-08-24 12:13     ` Gilles Chanteperdrix
2010-08-24 13:09       ` Ramon
2010-08-24 13:11         ` Gilles Chanteperdrix
  -- strict thread matches above, loose matches on Subject: below --
2010-08-24 13:16 Ramon

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=4C72D8C7.6000303@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=ramoncostacastello@domain.hid \
    --cc=xenomai@xenomai.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.