All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Rosenfeld Rosas <lbocseg@domain.hid>
To: Jan Kiszka <jan.kiszka@domain.hid>
Cc: xenomai@xenomai.org
Subject: [Xenomai-help] Re: RTDM and udelay
Date: Wed, 25 Jan 2006 22:42:57 -0200	[thread overview]
Message-ID: <43D81B11.2020809@domain.hid> (raw)
In-Reply-To: <43D7D7E3.3040804@domain.hid>

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

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.

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


	

	
		
_______________________________________________________ 
Yahoo! doce lar. Faça do Yahoo! sua homepage. 
http://br.yahoo.com/homepageset.html 




  reply	other threads:[~2006-01-26  0:42 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 [this message]
2006-01-26  8:32     ` Jan Kiszka
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=43D81B11.2020809@domain.hid \
    --to=lbocseg@domain.hid \
    --cc=jan.kiszka@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.