2001-03-29 Joel Sherrill <joel@OARcorp.com>

* Per PR147 addressed problems when reseting and inserting a timer
	into a timer chain that did not honor time passage since the last
	time the timer server was scheduled and the new insertion.
	* sp31/sp31.scn, sp31/task1.c: Added test code to detect this case.
This commit is contained in:
Joel Sherrill
2002-03-29 15:32:08 +00:00
parent 82e1e997ca
commit 5729f62e12
6 changed files with 156 additions and 10 deletions

View File

@@ -1,3 +1,10 @@
2001-03-29 Joel Sherrill <joel@OARcorp.com>
* Per PR147 addressed problems when reseting and inserting a timer
into a timer chain that did not honor time passage since the last
time the timer server was scheduled and the new insertion.
* sp31/sp31.scn, sp31/task1.c: Added test code to detect this case.
2001-03-28 Joel Sherrill <joel@OARcorp.com>
* Side-effect of PR132.

View File

@@ -1,18 +1,41 @@
*** TEST 31 ***
INIT - rtems_timer_create - creating timer 1
INIT - timer 1 has id (0x14010001)
INIT - rtems_timer_create - creating timer 2
INIT - timer 2 has id (0x14010002)
TA1 - rtems_timer_ident - identing timer 1
TA1 - timer 1 has id (0x14010001)
TA1 - rtems_clock_get - 09:00:00 12/31/1988
TA1 - rtems_timer_ident - identing timer 2
TA1 - timer 2 has id (0x14010002)
TA1 - rtems_timer_server_fire_after - 1 second
TA1 - rtems_task_wake_after - 1/2 second
TA1 - rtems_timer_server_fire_after - timer 2 in 1/2 second
TA1 - rtems_timer_cancel - timer 1
TA1 - rtems_timer_cancel - timer 2
TA1 - rtems_timer_server_fire_after - timer 1 in 30 seconds
TA1 - rtems_timer_server_fire_after - timer 2 in 60 seconds
Timer 1 scheduled for 3050 ticks since boot
Timer Server scheduled for 3050 ticks since boot
TA1 - rtems_task_wake_after - 1 second
TA1 - rtems_timer_server_fire_after - timer 2 in 60 seconds
Timer 1 scheduled for 3050 ticks since boot
Timer Server scheduled for 3050 ticks since boot
TA1 - rtems_task_wake_after - 1 second
TA1 - rtems_timer_server_fire_after - timer 2 in 60 seconds
Timer 1 scheduled for 3050 ticks since boot
Timer Server scheduled for 3050 ticks since boot
TA1 - rtems_timer_cancel - timer 1
TA1 - rtems_timer_cancel - timer 2
TA1 - rtems_clock_get - 09:00:02 12/31/1988
TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds
TA1 - rtems_task_suspend( RTEMS_SELF )
TA1 - rtems_clock_get - 09:00:03 12/31/1988
TA1 - rtems_clock_get - 09:00:05 12/31/1988
TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds
TA1 - rtems_task_wake_after - 1 second
TA1 - rtems_clock_get - 09:00:04 12/31/1988
TA1 - rtems_clock_get - 09:00:06 12/31/1988
TA1 - rtems_timer_reset - timer 1
TA1 - rtems_task_suspend( RTEMS_SELF )
TA1 - rtems_clock_get - 09:00:07 12/31/1988
TA1 - rtems_clock_get - 09:00:09 12/31/1988
<pause>
TA1 - rtems_timer_server_fire_after - timer 1 in 3 seconds
TA1 - rtems_timer_cancel - timer 1
@@ -26,4 +49,4 @@ TA1 - rtems_clock_get - 09:00:11 12/31/1988
TA1 - rtems_timer_cancel - timer 1
TA1 - rtems_task_wake_after - YIELD (only task at priority)
TA1 - timer_deleting - timer 1
*** END OF TEST 31 ***
*** END OF TEST 31 ***

View File

@@ -20,6 +20,16 @@
#include "system.h"
volatile int TSR_fired;
rtems_timer_service_routine Should_not_fire_TSR(
rtems_id ignored_id,
void *ignored_address
)
{
TSR_fired = 1;
}
rtems_task Task_1(
rtems_task_argument argument
)
@@ -42,6 +52,39 @@ rtems_task Task_1(
directive_failed( status, "rtems_timer_ident" );
printf( "TA1 - timer 2 has id (0x%x)\n", tmid2 );
/* make sure insertion does not unintentionally fire a timer per PR147 */
TSR_fired = 0;
puts( "TA1 - rtems_timer_server_fire_after - 1 second" );
status = rtems_timer_server_fire_after(
tmid, TICKS_PER_SECOND, Should_not_fire_TSR, NULL );
directive_failed( status, "rtems_timer_server_fire_after" );
puts( "TA1 - rtems_task_wake_after - 1/2 second" );
status = rtems_task_wake_after( TICKS_PER_SECOND / 2 );
directive_failed( status, "rtems_timer_server_fire_after" );
directive_failed( status, "rtems_timer_server_fire_after" );
puts( "TA1 - rtems_timer_server_fire_after - timer 2 in 1/2 second" );
status = rtems_timer_server_fire_after(
tmid2, TICKS_PER_SECOND / 2, Should_not_fire_TSR, NULL );
directive_failed( status, "rtems_timer_server_fire_after" );
if ( TSR_fired ) {
puts( "TA1 - TSR fired and should not have!" );
exit(1);
}
puts( "TA1 - rtems_timer_cancel - timer 1" );
status = rtems_timer_cancel( tmid );
directive_failed( status, "rtems_timer_cancel" );
puts( "TA1 - rtems_timer_cancel - timer 2" );
status = rtems_timer_cancel( tmid2 );
directive_failed( status, "rtems_timer_cancel" );
/* now check that rescheduling an active timer works OK. */
puts( "TA1 - rtems_timer_server_fire_after - timer 1 in 30 seconds" );
status = rtems_timer_server_fire_after(