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: [Xenomai-help] Re: RTDM and udelay
Date: Thu, 26 Jan 2006 09:32:29 +0100	[thread overview]
Message-ID: <43D8891D.7000405@domain.hid> (raw)
In-Reply-To: <43D81B11.2020809@domain.hid>

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

Rodrigo Rosenfeld Rosas wrote:
> Rodrigo Rosenfeld Rosas wrote:
> 
>>> Is there any alternative to udelay on RTDM?
>>>
>>> Or should I do something like:
>>>
>>> void rt_udelay(unsigned int usec) {
>>>  uint64_t timeout = rtdm_clock_read () + usec;
>>>  while (rtdm_clock_read () < timeout);
>>> }
>>>   
>>
>> You mean something like this: =:)
>>
>> http://www.rts.uni-hannover.de/xenomai/lxr/source/ksrc/skins/rtdm/drvlib.c?v=SVN-trunk#L366
>>
>>  
>>
> Yes, but it seemed too complex for me, since it disables IRQ and I do
> not need this feature. It will no problem if, instead of waiting 2us, I

Are we talking about the same function??? Don't think so.

> have to wait 100us because some interrupt has occurred. After I write to
> the board i2c registers, I need to wait *at least*, say, 2us before
> writing another i2c cycle.

Then this is the perfect choice for you.

> 
> One more thing: although the name of the function has the word "task", I
> think it is not task specific. Documentation even says it can be called
> from initialization/cleanup code. But it doesn't say if it can be called
> from an ioctl handler or any other context, although I see no problem
> when reviewing the code. Thus, I think a better name would be something
> like rtdm_busy_sleep() or rtdm_ns_delay(). Just a suggestion.

The idea is to put most functions into some related group. As
rtdm_task_busy_sleep() is an alternative to rtdm_task_sleep(), I placed
them close to each other in the doc, i.e. in the same group (rtdm_task_xxx).

Note that an ioctl handler (just like any device operation handler) has
no separate context. Depending on if we are talking about the _rt or the
_nrt handler, it either executes in a RT task or in non-RT context,
invoked by a user space or kernel space caller. All this is covered by
the environments listed for rtdm_task_busy_sleep.

> 
>>> Or maybe my design is wrong.
>>>
>>> I have a function, say WriteI2C(...). Should I create it as a task
>>> and call rtdm_task_sleep?
>>>   
>>
>> Depending on how long you would like to sleep and if you are not inside
>> an IRQ handler, a re-scheduling call like rtdm_task_sleep() can be
>> better. If it's just about a few microseconds, busy sleeping should be
>> preferred.
>>  
>>
> Exactly what I had in mind, thanks.
> 
> Best regards,
> 
> Rodrigo.
> 

Jan


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

  reply	other threads:[~2006-01-26  8:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-25 17:52 [Xenomai-help] RTDM and udelay Rodrigo Rosenfeld Rosas
2006-01-25 19:56 ` [Xenomai-help] " Jan Kiszka
2006-01-26  0:42   ` Rodrigo Rosenfeld Rosas
2006-01-26  8:32     ` Jan Kiszka [this message]
2006-01-26 10:49       ` Rodrigo Rosenfeld Rosas
2006-01-26 15:17         ` Jan Kiszka
2006-01-27  9:41           ` Rodrigo Rosenfeld Rosas

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=43D8891D.7000405@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.