Steve and others

I hope I don't have to take Victors suggestion just yet (but maybe).
Here is the pertinent code (obviously a highly edited version). The fifo 
handler is:

int start_fifo_handler(unsigned int)
{
  rtf_get(START_FIFO, &num_events, sizeof(int));
  rt_task_resume(&Task);
  return 1;
}

and the task looks like this:


static void task_fun(int task_arg)
{
  int n;
  RTIME time_incr = 1000000000;

  rt_task_suspend(&Task); /*The task to be resumed through START_FIFO*/

  /* oneshot mode task */
  start_time = rt_get_time();
  for(n=0; n<num_events; n++){
    rt_sleep_until(start_time + nano2count((n+1)*time_incr);
    /* Function to produce beeps on speaker on control an LED an
     the parallel port would go here*/
  }
  rt_task_suspend(&Task);
}

A user-space write to the fifo does start the task and pass the num_events 
value to the kernel-module but the timing is all wrong.
As you can see the task should execute once per second but what I get
is once per 2 seconds. If I remove the first rt_task_suspend the timing
then works fine (but of course I can't start the task in the manner I wanted 
to).

Thanks for any help,
Daniel


>From: Steve Papacharalambous <[EMAIL PROTECTED]>
>To: daniel sheltraw <[EMAIL PROTECTED]>
>CC: [EMAIL PROTECTED]
>Subject: Re: [rtl] oneshot mode timing problem
>Date: Sun, 16 Jul 2000 08:18:14 +0100
>
>Hi Daniel,
>
>Can you send me the pertinent code please,
>
>Best regards,
>
>Steve
>
>
>daniel sheltraw wrote:
> >
> > Hello RT World
> >
> > I wrote to this mailing list previously with a somewhat less clear 
>version
> > of this question. Please let me know if you need to see the pertinent 
>code
> > to help with this problem.
> >
> > In case it influences the answer to the following question let it be 
>known
> > that I am using 0.7 RTAI (I know... I will upgrade soon especially if 
>the
> > 0.7 version is the source of my problem).
> >
> > I am using a fifo which when written to by a user-space program passes a
> > single int and resumes a previously
> > suspended task (by using a fifo handler). The problem is that if I use
> > sleep_until and program certain events to occur at 1 second intervals 
>when I
> > run the code I get 2 second intervals. If I omit the code from 
>user-space
> > and the kernel module that uses the fifo to resume the task the 
>timinging
> > works fine.
> >
> > So I guess my question is how can I properly resume a previous suspended
> > task from within a fifo handler?
> >
> > Thanks all. Please bail me out again.
> > Daniel
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to