RCS file: /usr1/CVS/rtems/c/src/tests/sptests/sp31/task1.c,v
retrieving revision 1.1.2.2
diff -u -r1.1.2.2 task1.c
|
|
|
15 | 15 | * found in the file LICENSE in this distribution or at |
16 | 16 | * http://www.OARcorp.com/rtems/license.html. |
17 | 17 | * |
18 | | * $Id: task1.c,v 1.1.2.2 2002/01/29 18:20:46 joel Exp $ |
| 18 | * $Id: task1.c,v 1.3 2002/01/29 18:20:59 joel Exp $ |
19 | 19 | */ |
20 | 20 | |
21 | 21 | #include "system.h" |
22 | 22 | |
| 23 | volatile int TSR_fired; |
| 24 | |
| 25 | rtems_timer_service_routine Should_not_fire_TSR( |
| 26 | rtems_id ignored_id, |
| 27 | void *ignored_address |
| 28 | ) |
| 29 | { |
| 30 | TSR_fired = 1; |
| 31 | } |
| 32 | |
23 | 33 | rtems_task Task_1( |
24 | 34 | rtems_task_argument argument |
25 | 35 | ) |
… |
… |
|
42 | 52 | directive_failed( status, "rtems_timer_ident" ); |
43 | 53 | printf( "TA1 - timer 2 has id (0x%x)\n", tmid2 ); |
44 | 54 | |
| 55 | /* make sure insertion does not unintentionally fire a timer per PR147 */ |
| 56 | |
| 57 | TSR_fired = 0; |
| 58 | |
| 59 | puts( "TA1 - rtems_timer_server_fire_after - 1 second" ); |
| 60 | status = rtems_timer_server_fire_after( |
| 61 | tmid, TICKS_PER_SECOND, Should_not_fire_TSR, NULL ); |
| 62 | directive_failed( status, "rtems_timer_server_fire_after" ); |
| 63 | |
| 64 | puts( "TA1 - rtems_task_wake_after - 1/2 second" ); |
| 65 | status = rtems_task_wake_after( TICKS_PER_SECOND / 2 ); |
| 66 | directive_failed( status, "rtems_timer_server_fire_after" ); |
| 67 | |
| 68 | directive_failed( status, "rtems_timer_server_fire_after" ); |
| 69 | puts( "TA1 - rtems_timer_server_fire_after - timer 2 in 1/2 second" ); |
| 70 | status = rtems_timer_server_fire_after( |
| 71 | tmid2, TICKS_PER_SECOND / 2, Should_not_fire_TSR, NULL ); |
| 72 | directive_failed( status, "rtems_timer_server_fire_after" ); |
| 73 | |
| 74 | if ( TSR_fired ) { |
| 75 | puts( "TA1 - TSR fired and should not have!" ); |
| 76 | exit(1); |
| 77 | } |
45 | 78 | /* now check that rescheduling an active timer works OK. */ |
46 | 79 | puts( "TA1 - rtems_timer_server_fire_after - timer 1 in 30 seconds" ); |
47 | 80 | status = rtems_timer_server_fire_after( |