All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: Rodrigo Rosenfeld Rosas <lbocseg@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-core] RTDM and Timer functions
Date: Tue, 14 Mar 2006 20:00:59 +0100	[thread overview]
Message-ID: <441712EB.5040401@domain.hid> (raw)
In-Reply-To: <200603141545.29301.lbocseg@domain.hid>

[-- Attachment #1: Type: text/plain, Size: 2509 bytes --]

Rodrigo Rosenfeld Rosas wrote:
> Em Terça 14 Março 2006 13:59, Rodrigo Rosenfeld Rosas escreveu:
> 
>> Em Terça 14 Março 2006 13:46, Jan Kiszka escreveu:
>>>>>> ... Another one is for timeouts on short delays. In
>>>>>> those cases, we want a good resolution, but this should be independent
>>>>>> of the user's timer choice IMO.
>>>>> And this is something rtdm_clock_read_tsc() will obviously not be for.
>>>> Please, take a look in my case. The specification recommends wait at
>>>> least Xus before testing a bit. But the time to wait is not constant, it
>>>> can vary a few microseconds. So, I busy wait Xus and then do some code
>>>> like:
>>>>
>>>> rtdm_task_busy_sleep(X*1000);
>>>> start_time = rtdm_clock_read[_tsc]();
>>>> do {
>>>> condition=testbit();
>>>> } while (! condition && (time_passed(start_time) < TIMEOUT));
>>>>
>>>> But if the user specifies a periodic timer, with tickval=1ms, then my
>>>> driver will be too slow. I could busy wait TIMEOUT before testing, and it
>>>> would be faster then the above code in this case. But I would like to go
>>>> away as soon as possible, ie, just after the bit has been set...
>>> This is how the eepr100 driver of RTnet handles it, though RTnet would
>>> not work very well in periodic mode. Actually, this has been ported over
>> >from Linux where you do not have a portable API for reading the TSC, I
>>> think.
>>>
>>> static inline int rt_wait_for_cmd_done(long cmd_ioaddr, const char *cmd)
>>> {
>>>    int wait = CONFIG_RTNET_DRV_EEPRO100_CMDTIMEOUT;
>>>
>>>    while (inb(cmd_ioaddr) != 0) {
>>>        if (wait-- == 0)
>>>            return 1;
>>>        rtdm_task_busy_sleep(1000);
>>>    }
>>>    return 0;
>>> }
>>> (Hmm, BTW, de-inlining might be worth considering...)
>>>
>>> So this works at a polling period of 1 us, but you may also reduce it,
>>> though this would certainly degrade the accuracy further. For sure, the
>>> accuracy is slightly worse than with your pattern. Would this matter to
>>> you?
>> No, in my case it doesn't matter. I'll adopt this way of doing it.
> 
> Thinking better, I would need such a function for registering the timestamp of 
> the captured frame on the irq handler...
> 

What will this timestamp be used for, relative time calculations? I just
would like to remind that the output of rtdm_clock_read_tsc() will not
be in sync with the system clock in periodic mode (one of my major
concern: that driver writers forget this fact).

Jan


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]

  reply	other threads:[~2006-03-14 19:00 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-09 17:43 [Xenomai-core] RTDM and Timer functions Rodrigo Rosenfeld Rosas
2006-03-09 20:33 ` Jan Kiszka
2006-03-10 13:54   ` Rodrigo Rosenfeld Rosas
2006-03-10 18:32     ` Jan Kiszka
2006-03-10 20:00       ` Rodrigo Rosenfeld Rosas
2006-03-13 11:48         ` Jan Kiszka
2006-03-13 14:54           ` Rodrigo Rosenfeld Rosas
2006-03-13 17:15             ` Rodrigo Rosenfeld Rosas
2006-03-13 17:58               ` Rodrigo Rosenfeld Rosas
2006-03-13 18:24                 ` Jan Kiszka
2006-03-13 19:25                   ` Rodrigo Rosenfeld Rosas
2006-03-13 19:19                 ` Rodrigo Rosenfeld Rosas
2006-03-15  4:44                   ` Jim Cromie
2006-03-13 18:12             ` Jan Kiszka
2006-03-14  1:28               ` Rodrigo Rosenfeld Rosas
2006-03-13 17:25       ` Gilles Chanteperdrix
2006-03-13 17:31         ` Rodrigo Rosenfeld Rosas
2006-03-13 18:33           ` Jan Kiszka
2006-03-13 19:31             ` Rodrigo Rosenfeld Rosas
2006-03-13 23:05               ` Jan Kiszka
2006-03-14  1:36                 ` Rodrigo Rosenfeld Rosas
2006-03-14  6:44                   ` Jan Kiszka
2006-03-14 14:27                     ` Rodrigo Rosenfeld Rosas
2006-03-14 16:46                       ` Jan Kiszka
2006-03-14 16:59                         ` Rodrigo Rosenfeld Rosas
2006-03-14 18:45                           ` Rodrigo Rosenfeld Rosas
2006-03-14 19:00                             ` Jan Kiszka [this message]
2006-03-14 19:40                               ` Rodrigo Rosenfeld Rosas
2006-03-14 20:29                                 ` Jan Kiszka
2006-03-14 22:32                                   ` Rodrigo Rosenfeld Rosas
2006-03-14 22:51                                     ` Jan Kiszka
2006-03-15  0:31                                       ` Rodrigo Rosenfeld Rosas
2006-03-15 13:06                                     ` Philippe Gerum
     [not found]                 ` <44167BE9.2090703@domain.hid>
2006-03-14 10:16                   ` Jan Kiszka

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=441712EB.5040401@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=lbocseg@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.