rtems_rate_monotonic_period bug?

Joel Sherrill joel.sherrill at OARcorp.com
Wed Sep 27 15:55:51 UTC 2000


My reading of the code agrees with yours.  I have a fairly 
simple fix in mind and can describe it to you.  You should 
be able to implement it based on that. 

I would like a simple test application to demonstrate this.  I think 
something like this is enough:

    create the period
    Time0 = _Watchdog_Ticks_since_boot;
    rtems_rate_monotonic_period(periodId, 10);
    Time1 = _Watchdog_Ticks_since_boot;
    rtems_rate_monotonic_period(periodId, 90);
    Time2 = _Watchdog_Ticks_since_boot;
    print all the times

This can be a simple non-loop init.c based on hello world.

The fix is to add a "next_length" to the period structure in
exec/rtems/include/rtems/rtems/ratemon.h.  Then set that 
field where appropriate in the ratemon code including the 
path in ratemonperiod.c you identified.

The key change is that the code in ratemontimeout.c should
not use _Watchdog_Reset any longer.  The watchdog timer
is already off the chain and we need to do that 1/2 of 
reset.  The reset calls should be changed to this:

  _Watchdog_Insert_ticks( 
    &the_period->Timer, the_period->Timer.next_length );

That should do it.  It really shoudl not be that many changes.
I would appreciate a test case and patch.

If given just a test case, I can't say when a patch would show
up.  

--joel


Stephan Merker wrote:
> 
> It seems to me that rtems_rate_monotonic_period() doesn't work as expected
> if I'm using changing period lengths (e.g. as done in the example at page
> 181 of the C users manual). The first period is used throughout the lifetime
> of the period.
> E.g.:
> while (1) {
>     rtems_rate_monotonic_period(periodId, 10);
>     do1();
>     rtems_rate_monotonic_period(periodId, 90);
>     do2();
> }
> I would expect do1() to be executed at 0 ticks and do2() at 10 ticks.
> Overall cycle would be 100 ticks. What I get is do1() at 0 ticks, do2() at
> 10 ticks, overall cycle is 20 ticks.
> 
> Having a look in the source ratemonperiod.c, there is no reference to the
> length parameter in state RATE_MONOTONIC_ACTIVE. A bug?
> 
> I'm using RTEMS 4.5 beta3 on Linux.
> 
> Please send a replay to my email directly.
> 
> Thanks,
> Stephan
> 
> ---
> | Stephan Merker                merker at decrc.abb.de |
> | DECRC/A4                                          |
> | ABB Corporate Research    http://www.decrc.abb.de |
> | Speyerer Strasse 4,  D-69115 Heidelberg,  Germany |
> | Phone:+49-6221-596218         Fax:+49-6221-596253 |

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985



More information about the users mailing list