All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] How can I now when it will be next periodic task release point?
@ 2006-07-25 20:35 Rodrigo Rosenfeld Rosas
  2006-07-25 21:00 ` Hannes Mayer
  2006-07-25 21:52 ` Jan Kiszka
  0 siblings, 2 replies; 7+ messages in thread
From: Rodrigo Rosenfeld Rosas @ 2006-07-25 20:35 UTC (permalink / raw)
  To: xenomai

I want to capture and process images each 300 ms. The processing routines take 
a (fixed, but unknown) time. I'd like to request a new image about 50 ms 
before next release point, like this:

for(;;)
{
	rt_task_wait_period(NULL);
	ProcessImage();
	rt_task_sleep(XXX); // until 50 ms before next release point
	RequestNewImage();
}

I could use rt_task_inquire() if RT_TASK_INFO was documented. From 
source-code:
  RTIME relpoint;             /* !< Periodic release point. */

The question is which release point? Next or the last reached?
Anyway, a new function like rt_task_getnextrelpoint() would be very welcome...

rt_task_sleep(rt_task_getnextrelpoint() - 50*1000*1000);

Thanks in advance,

Rodrigo.


		
_______________________________________________________ 
Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho agora! 
http://br.mobile.yahoo.com/mailalertas/ 
 




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Xenomai-help] How can I now when it will be next periodic task release point?
  2006-07-25 20:35 [Xenomai-help] How can I now when it will be next periodic task release point? Rodrigo Rosenfeld Rosas
@ 2006-07-25 21:00 ` Hannes Mayer
  2006-07-26 15:07   ` Rodrigo Rosenfeld Rosas
  2006-07-25 21:52 ` Jan Kiszka
  1 sibling, 1 reply; 7+ messages in thread
From: Hannes Mayer @ 2006-07-25 21:00 UTC (permalink / raw)
  To: Rodrigo Rosenfeld Rosas; +Cc: xenomai

Ciao Rodrigo!

Rodrigo Rosenfeld Rosas wrote:
> I want to capture and process images each 300 ms. The processing routines take 
> a (fixed, but unknown) time. I'd like to request a new image about 50 ms 
> before next release point, like this:
> 
> for(;;)
> {
> 	rt_task_wait_period(NULL);
> 	ProcessImage();
> 	rt_task_sleep(XXX); // until 50 ms before next release point
> 	RequestNewImage();
> }
> 
> I could use rt_task_inquire() if RT_TASK_INFO was documented. From 
> source-code:
>   RTIME relpoint;             /* !< Periodic release point. */
> 
> The question is which release point? Next or the last reached?
> Anyway, a new function like rt_task_getnextrelpoint() would be very welcome...
> 
> rt_task_sleep(rt_task_getnextrelpoint() - 50*1000*1000);

Just trying to understand your problem:
If you wanna capture a image every 300ms, the processing must not take
longer than 300ms, otherwise you have some kind over overrun (?)
So you capture an image, process it within 300ms and then capture
the next one, right ?

OK, wait a sec. I think I got it.
I guess your problem is having both capturing and processing in one loop ?
Why not make 2 threads, one for capturing, and one for processing ?

I may be totally wrong - just trying to understand and maybe help :-)

Best regards,
Hannes.

PS.: Why do all replies go only to the sender ? This hasn't been that
way in the (far) past, right ?




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Xenomai-help] How can I now when it will be next periodic task release point?
  2006-07-25 20:35 [Xenomai-help] How can I now when it will be next periodic task release point? Rodrigo Rosenfeld Rosas
  2006-07-25 21:00 ` Hannes Mayer
@ 2006-07-25 21:52 ` Jan Kiszka
  2006-07-26 10:08   ` Philippe Gerum
  2006-07-26 15:15   ` Rodrigo Rosenfeld Rosas
  1 sibling, 2 replies; 7+ messages in thread
From: Jan Kiszka @ 2006-07-25 21:52 UTC (permalink / raw)
  To: Rodrigo Rosenfeld Rosas; +Cc: xenomai


[-- Attachment #1.1: Type: text/plain, Size: 1106 bytes --]

Rodrigo Rosenfeld Rosas wrote:
> I want to capture and process images each 300 ms. The processing routines take 
> a (fixed, but unknown) time. I'd like to request a new image about 50 ms 
> before next release point, like this:
> 
> for(;;)
> {
> 	rt_task_wait_period(NULL);
> 	ProcessImage();
> 	rt_task_sleep(XXX); // until 50 ms before next release point
> 	RequestNewImage();
> }
> 
> I could use rt_task_inquire() if RT_TASK_INFO was documented. From 
> source-code:
>   RTIME relpoint;             /* !< Periodic release point. */
> 
> The question is which release point? Next or the last reached?

Looks like you managed to dig out dead/broken code here: RT_TASK.timer,
the timer returned in relpoint, is nowhere else used than in
rt_task_inquire.

> Anyway, a new function like rt_task_getnextrelpoint() would be very welcome...
> 
> rt_task_sleep(rt_task_getnextrelpoint() - 50*1000*1000);

See my attached patch. It should fix rt_task_inquire in a way that meets
your requirements. It also clarifies the doc. Only compile tested.

Philippe, is it correct?

Jan

[-- Attachment #1.2: return-ptimer-in-rt_task_inquire.patch --]
[-- Type: text/plain, Size: 1824 bytes --]

Index: include/native/task.h
===================================================================
--- include/native/task.h	(Revision 1374)
+++ include/native/task.h	(Arbeitskopie)
@@ -76,7 +76,7 @@ typedef struct rt_task_info {
 
     unsigned status;		/* !< Status. */
 
-    RTIME relpoint;		/* !< Periodic release point. */
+    RTIME relpoint;		/* !< Next periodic release point. */
 
     char name[XNOBJECT_NAME_LEN]; /* !< Symbolic name. */
 
@@ -109,8 +109,6 @@ typedef struct rt_task {
 #define link2rtask(laddr) \
 ((RT_TASK *)(((char *)laddr) - (int)(&((RT_TASK *)0)->link)))
 
-    xntimer_t timer;
-
     xnthread_t thread_base;
 
     char rname[XNOBJECT_NAME_LEN]; /* !< Name in registry. Not the same as
Index: ChangeLog
===================================================================
--- ChangeLog	(Revision 1374)
+++ ChangeLog	(Arbeitskopie)
@@ -1,3 +1,8 @@
+2006-07-25  Jan Kiszka  <jan.kiszka@domain.hid>
+
+	* include/native/task.h, ksrc/native/task.c: Kill unused timer field
+	in RT_TASK. Return ptimer of the underlying thread on rt_task_inquire.
+
 2006-07-23  Jan Kiszka  <jan.kiszka@domain.hid>
 
 	* ksrc/skins/native/Makefile: Fixed typo that messed up modularised
Index: ksrc/skins/native/task.c
===================================================================
--- ksrc/skins/native/task.c	(Revision 1374)
+++ ksrc/skins/native/task.c	(Arbeitskopie)
@@ -1118,7 +1118,7 @@ int rt_task_inquire(RT_TASK *task, RT_TA
 	info->bprio = xnthread_base_priority(&task->thread_base);
 	info->cprio = xnthread_current_priority(&task->thread_base);
 	info->status = xnthread_status_flags(&task->thread_base);
-	info->relpoint = xntimer_get_date(&task->timer);
+	info->relpoint = xntimer_get_date(&task->thread_base.ptimer);
 
       unlock_and_exit:
 

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Xenomai-help] How can I now when it will be next periodic task release point?
  2006-07-25 21:52 ` Jan Kiszka
@ 2006-07-26 10:08   ` Philippe Gerum
  2006-07-26 15:15   ` Rodrigo Rosenfeld Rosas
  1 sibling, 0 replies; 7+ messages in thread
From: Philippe Gerum @ 2006-07-26 10:08 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

On Tue, 2006-07-25 at 23:52 +0200, Jan Kiszka wrote:
> Rodrigo Rosenfeld Rosas wrote:
> > I want to capture and process images each 300 ms. The processing routines take 
> > a (fixed, but unknown) time. I'd like to request a new image about 50 ms 
> > before next release point, like this:
> > 
> > for(;;)
> > {
> > 	rt_task_wait_period(NULL);
> > 	ProcessImage();
> > 	rt_task_sleep(XXX); // until 50 ms before next release point
> > 	RequestNewImage();
> > }
> > 
> > I could use rt_task_inquire() if RT_TASK_INFO was documented. From 
> > source-code:
> >   RTIME relpoint;             /* !< Periodic release point. */
> > 
> > The question is which release point? Next or the last reached?
> 
> Looks like you managed to dig out dead/broken code here: RT_TASK.timer,
> the timer returned in relpoint, is nowhere else used than in
> rt_task_inquire.
> 
> > Anyway, a new function like rt_task_getnextrelpoint() would be very welcome...
> > 
> > rt_task_sleep(rt_task_getnextrelpoint() - 50*1000*1000);
> 
> See my attached patch. It should fix rt_task_inquire in a way that meets
> your requirements. It also clarifies the doc. Only compile tested.
> 
> Philippe, is it correct?
> 

Indeed it is, applied; thanks.

> Jan
> plain text document attachment
> (return-ptimer-in-rt_task_inquire.patch)
> Index: include/native/task.h
> ===================================================================
> --- include/native/task.h	(Revision 1374)
> +++ include/native/task.h	(Arbeitskopie)
> @@ -76,7 +76,7 @@ typedef struct rt_task_info {
>  
>      unsigned status;		/* !< Status. */
>  
> -    RTIME relpoint;		/* !< Periodic release point. */
> +    RTIME relpoint;		/* !< Next periodic release point. */
>  
>      char name[XNOBJECT_NAME_LEN]; /* !< Symbolic name. */
>  
> @@ -109,8 +109,6 @@ typedef struct rt_task {
>  #define link2rtask(laddr) \
>  ((RT_TASK *)(((char *)laddr) - (int)(&((RT_TASK *)0)->link)))
>  
> -    xntimer_t timer;
> -
>      xnthread_t thread_base;
>  
>      char rname[XNOBJECT_NAME_LEN]; /* !< Name in registry. Not the same as
> Index: ChangeLog
> ===================================================================
> --- ChangeLog	(Revision 1374)
> +++ ChangeLog	(Arbeitskopie)
> @@ -1,3 +1,8 @@
> +2006-07-25  Jan Kiszka  <jan.kiszka@domain.hid>
> +
> +	* include/native/task.h, ksrc/native/task.c: Kill unused timer field
> +	in RT_TASK. Return ptimer of the underlying thread on rt_task_inquire.
> +
>  2006-07-23  Jan Kiszka  <jan.kiszka@domain.hid>
>  
>  	* ksrc/skins/native/Makefile: Fixed typo that messed up modularised
> Index: ksrc/skins/native/task.c
> ===================================================================
> --- ksrc/skins/native/task.c	(Revision 1374)
> +++ ksrc/skins/native/task.c	(Arbeitskopie)
> @@ -1118,7 +1118,7 @@ int rt_task_inquire(RT_TASK *task, RT_TA
>  	info->bprio = xnthread_base_priority(&task->thread_base);
>  	info->cprio = xnthread_current_priority(&task->thread_base);
>  	info->status = xnthread_status_flags(&task->thread_base);
> -	info->relpoint = xntimer_get_date(&task->timer);
> +	info->relpoint = xntimer_get_date(&task->thread_base.ptimer);
>  
>        unlock_and_exit:
>  
-- 
Philippe.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Xenomai-help] How can I now when it will be next periodic task release point?
  2006-07-25 21:00 ` Hannes Mayer
@ 2006-07-26 15:07   ` Rodrigo Rosenfeld Rosas
  0 siblings, 0 replies; 7+ messages in thread
From: Rodrigo Rosenfeld Rosas @ 2006-07-26 15:07 UTC (permalink / raw)
  To: Hannes Mayer; +Cc: xenomai

Hannes Mayer escreveu:
> Ciao Rodrigo!
> ...
>
> Just trying to understand your problem:
> If you wanna capture a image every 300ms, the processing must not take
> longer than 300ms, otherwise you have some kind over overrun (?)
> So you capture an image, process it within 300ms and then capture
> the next one, right ?
The processing takes something like 20 ms, but I don't need to process 
at a higher rate than 300 ms...
>
> OK, wait a sec. I think I got it.
> I guess your problem is having both capturing and processing in one 
> loop ?
> Why not make 2 threads, one for capturing, and one for processing ?
Because I don't really need it... It is much simpler the way I'm 
doing... Let me explain better what happen... When I make a request to 
capture an image to the framegrabber, the process will start on the 
beggining of the next field. Each field takes about 17 ms to complete 
for a NTSC camera... I would not like to wait for the field end, so I 
want to request a frame 33 ms before next release point so that a new 
image will be already present for sure on next release point. I could do 
some better design for better precision but I really don't need it. The 
process is far too simple... I can do it right now. The question is that 
I would like a cleaner way to do it. I would like to make clear that I 
want to request a frame 33 ms before next release point...
> I may be totally wrong - just trying to understand and maybe help :-)
I think I've explained it better now, didn't I?
> Best regards,
> Hannes.
>
> PS.: Why do all replies go only to the sender ? This hasn't been that
> way in the (far) past, right ?
As far as I recall it was always like that, unfortunately. I also would 
like that the reply-to was to the list. Sometimes I forget to press the 
reply-to-all button on my e-mail client...

Thank you Hannes,
Best Regards

Rodrigo.


		
_______________________________________________________ 
Novidade no Yahoo! Mail: receba alertas de novas mensagens no seu celular. Registre seu aparelho agora! 
http://br.mobile.yahoo.com/mailalertas/ 
 




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Xenomai-help] How can I now when it will be next periodic task release point?
  2006-07-25 21:52 ` Jan Kiszka
  2006-07-26 10:08   ` Philippe Gerum
@ 2006-07-26 15:15   ` Rodrigo Rosenfeld Rosas
  2006-07-26 15:29     ` Jan Kiszka
  1 sibling, 1 reply; 7+ messages in thread
From: Rodrigo Rosenfeld Rosas @ 2006-07-26 15:15 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

Jan Kiszka escreveu:
> See my attached patch. It should fix rt_task_inquire in a way that meets
> your requirements. It also clarifies the doc. Only compile tested.
>   
Thank you Jan.
Anyway, I couldn't find the modifications to clarify the doc. It 
clarified the comment inside the header but RT_TASK_INFO is not 
documented yet from the html documentation generated by Doxygen (at 
least I couldn't find it).

Best Regards,

Rodrigo.


		
_______________________________________________________ 
Yahoo! Acesso Grátis - Internet rápida e grátis. Instale 
o discador agora! 
http://br.acesso.yahoo.com



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Xenomai-help] How can I now when it will be next periodic task release point?
  2006-07-26 15:15   ` Rodrigo Rosenfeld Rosas
@ 2006-07-26 15:29     ` Jan Kiszka
  0 siblings, 0 replies; 7+ messages in thread
From: Jan Kiszka @ 2006-07-26 15:29 UTC (permalink / raw)
  To: Rodrigo Rosenfeld Rosas; +Cc: xenomai

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

Rodrigo Rosenfeld Rosas wrote:
> Jan Kiszka escreveu:
>> See my attached patch. It should fix rt_task_inquire in a way that meets
>> your requirements. It also clarifies the doc. Only compile tested.
>>   
> Thank you Jan.
> Anyway, I couldn't find the modifications to clarify the doc. It
> clarified the comment inside the header but RT_TASK_INFO is not
> documented yet from the html documentation generated by Doxygen (at
> least I couldn't find it).

Well, true. Don't know ATM what prevents such structures being included
in the Doxygen run, but this should be fixed in my eyes. Probably it's
"just" about adding the related header parts to the right Doxygen group.
Any volunteers around?

Jan


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-07-26 15:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-25 20:35 [Xenomai-help] How can I now when it will be next periodic task release point? Rodrigo Rosenfeld Rosas
2006-07-25 21:00 ` Hannes Mayer
2006-07-26 15:07   ` Rodrigo Rosenfeld Rosas
2006-07-25 21:52 ` Jan Kiszka
2006-07-26 10:08   ` Philippe Gerum
2006-07-26 15:15   ` Rodrigo Rosenfeld Rosas
2006-07-26 15:29     ` Jan Kiszka

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.