Ticket #147: sp31.diff

File sp31.diff, 1.9 KB (added by Joel Sherrill, on 12/03/06 at 13:31:13)

sp31.diff

  • task1.c

    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
     
    1515 *  found in the file LICENSE in this distribution or at
    1616 *  http://www.OARcorp.com/rtems/license.html.
    1717 *
    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 $
    1919 */
    2020
    2121#include "system.h"
    2222
     23volatile int TSR_fired;
     24
     25rtems_timer_service_routine Should_not_fire_TSR(
     26  rtems_id  ignored_id,
     27  void     *ignored_address
     28)
     29{
     30  TSR_fired = 1;
     31}
     32
    2333rtems_task Task_1(
    2434  rtems_task_argument argument
    2535)
     
    4252  directive_failed( status, "rtems_timer_ident" );
    4353  printf( "TA1 - timer 2 has id (0x%x)\n", tmid2 );
    4454
     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  }
    4578/* now check that rescheduling an active timer works OK. */
    4679  puts( "TA1 - rtems_timer_server_fire_after - timer 1 in 30 seconds" );
    4780  status = rtems_timer_server_fire_after(