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-help] How can I now when it will be next periodic task release point?
Date: Tue, 25 Jul 2006 23:52:28 +0200	[thread overview]
Message-ID: <44C6929C.5030804@domain.hid> (raw)
In-Reply-To: <200607251735.35500.lbocseg@domain.hid>


[-- 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 --]

  parent reply	other threads:[~2006-07-25 21:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2006-07-26 10:08   ` Philippe Gerum
2006-07-26 15:15   ` Rodrigo Rosenfeld Rosas
2006-07-26 15:29     ` 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=44C6929C.5030804@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.