Changeset ef70d9b in rtems


Ignore:
Timestamp:
Jan 29, 2002, 6:20:59 PM (19 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
cc43517d
Parents:
a94c2fbb
Message:

2001-01-29 Joel Sherrill <joel@…>

  • Fixed bug where resetting a timer that was not at the head of one of the task timer chains resulted in the Timer Server task waking up too far in the future.
  • Added rtems_timer_get_information() directive to support testing.
  • sp31/init.c, sp31/system.h, sp31/task1.c: Modified to test for above condition.
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • c/src/tests/sptests/ChangeLog

    ra94c2fbb ref70d9b  
     12001-01-29      Joel Sherrill <joel@OARcorp.com>
     2
     3        * Fixed bug where resetting a timer that was not at the head
     4        of one of the task timer chains resulted in the Timer Server
     5        task waking up too far in the future.
     6        * Added rtems_timer_get_information() directive to support testing.
     7        * sp31/init.c, sp31/system.h, sp31/task1.c: Modified to test for
     8        above condition.
     9
    1102001-01-22      Joel Sherrill <joel@OARcorp.com>
    211
  • c/src/tests/sptests/sp31/init.c

    ra94c2fbb ref70d9b  
    4848  Task_name[ 1 ]  = rtems_build_name( 'T', 'A', '1', ' ' );
    4949  Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
     50  Timer_name[ 2 ] = rtems_build_name( 'T', 'M', '2', ' ' );
    5051
    5152  status = rtems_task_create(
     
    6566  status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
    6667  directive_failed( status, "rtems_timer_create" );
     68  printf( "INIT - timer 1 has id (0x%x)\n", Timer_id[ 1 ] );
    6769
    68   printf( "INIT - timer 1 has id (0x%x)\n", Timer_id[ 1 ] );
     70  puts( "INIT - rtems_timer_create - creating timer 2" );
     71  status = rtems_timer_create( Timer_name[ 2 ], &Timer_id[ 2 ] );
     72  directive_failed( status, "rtems_timer_create" );
     73  printf( "INIT - timer 2 has id (0x%x)\n", Timer_id[ 2 ] );
    6974
    7075  status = rtems_task_delete( RTEMS_SELF );
  • c/src/tests/sptests/sp31/system.h

    ra94c2fbb ref70d9b  
    5353TEST_EXTERN rtems_name Task_name[ 4 ];       /* array of task names */
    5454
    55 TEST_EXTERN rtems_id   Timer_id[ 2 ];    /* array of timer ids */
    56 TEST_EXTERN rtems_name Timer_name[ 2 ];  /* array of timer names */
     55TEST_EXTERN rtems_id   Timer_id[ 3 ];    /* array of timer ids */
     56TEST_EXTERN rtems_name Timer_name[ 3 ];  /* array of timer names */
    5757
    5858/* end of include file */
  • c/src/tests/sptests/sp31/task1.c

    ra94c2fbb ref70d9b  
    2525)
    2626{
    27   rtems_id          tmid;
    28   rtems_time_of_day time;
    29   rtems_status_code status;
     27  rtems_id                 tmid;
     28  rtems_id                 tmid2;
     29  rtems_time_of_day        time;
     30  rtems_status_code        status;
     31  rtems_timer_information  info;
    3032
    3133/* Get id */
     
    3537  directive_failed( status, "rtems_timer_ident" );
    3638  printf( "TA1 - timer 1 has id (0x%x)\n", tmid );
     39
     40  puts( "TA1 - rtems_timer_ident - identing timer 2" );
     41  status = rtems_timer_ident( Timer_name[ 2 ], &tmid2 );
     42  directive_failed( status, "rtems_timer_ident" );
     43  printf( "TA1 - timer 2 has id (0x%x)\n", tmid2 );
     44
     45/* now check that rescheduling an active timer works OK. */
     46  puts( "TA1 - rtems_timer_server_fire_after - timer 1 in 30 seconds" );
     47  status = rtems_timer_server_fire_after(
     48    tmid, 30 * TICKS_PER_SECOND, Delayed_resume, NULL );
     49  directive_failed( status, "rtems_timer_server_fire_after" );
     50
     51  puts( "TA1 - rtems_timer_server_fire_after - timer 2 in 60 seconds" );
     52  status = rtems_timer_server_fire_after(
     53    tmid2, 60 * TICKS_PER_SECOND, Delayed_resume, NULL );
     54  directive_failed( status, "rtems_timer_server_fire_after" );
     55
     56  status = rtems_timer_get_information( tmid, &info );
     57  printf( "Timer 1 scheduled for %d ticks since boot\n",
     58    info.start_time + info.initial );
     59  printf( "Timer Server scheduled for %d ticks since boot\n",
     60    _Timer_Server->Timer.initial + _Timer_Server->Timer.start_time );
     61
     62  puts( "TA1 - rtems_task_wake_after - 1 second" );
     63  status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
     64  directive_failed( status, "rtems_timer_wake_after" );
     65
     66  puts( "TA1 - rtems_timer_server_fire_after - timer 2 in 60 seconds" );
     67  status = rtems_timer_server_fire_after(
     68    tmid2, 60 * TICKS_PER_SECOND, Delayed_resume, NULL );
     69  directive_failed( status, "rtems_timer_server_fire_after" );
     70
     71  status = rtems_timer_get_information( tmid, &info );
     72  directive_failed( status, "rtems_timer_get_information" );
     73  printf( "Timer 1 scheduled for %d ticks since boot\n",
     74    info.start_time + info.initial );
     75  printf( "Timer Server scheduled for %d ticks since boot\n",
     76    _Timer_Server->Timer.initial + _Timer_Server->Timer.start_time );
     77  assert(  (info.start_time + info.initial) ==
     78    (_Timer_Server->Timer.initial + _Timer_Server->Timer.start_time) );
     79
     80  puts( "TA1 - rtems_task_wake_after - 1 second" );
     81  status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
     82  directive_failed( status, "rtems_timer_wake_after" );
     83
     84  puts( "TA1 - rtems_timer_server_fire_after - timer 2 in 60 seconds" );
     85  status = rtems_timer_server_fire_after(
     86    tmid2, 60 * TICKS_PER_SECOND, Delayed_resume, NULL );
     87  directive_failed( status, "rtems_timer_server_fire_after" );
     88
     89  status = rtems_timer_get_information( tmid, &info );
     90  directive_failed( status, "rtems_timer_get_information" );
     91  printf( "Timer 1 scheduled for %d ticks since boot\n",
     92    info.start_time + info.initial );
     93  printf( "Timer Server scheduled for %d ticks since boot\n",
     94    _Timer_Server->Timer.initial + _Timer_Server->Timer.start_time );
     95  assert(  (info.start_time + info.initial) ==
     96    (_Timer_Server->Timer.initial + _Timer_Server->Timer.start_time) );
     97
     98  puts( "TA1 - rtems_timer_cancel - timer 1" );
     99  status = rtems_timer_cancel( tmid );
     100  directive_failed( status, "rtems_timer_cancel" );
     101
     102  puts( "TA1 - rtems_timer_cancel - timer 2" );
     103  status = rtems_timer_cancel( tmid2 );
     104  directive_failed( status, "rtems_timer_cancel" );
    37105
    38106/* after which is allowed to fire */
  • testsuites/sptests/ChangeLog

    ra94c2fbb ref70d9b  
     12001-01-29      Joel Sherrill <joel@OARcorp.com>
     2
     3        * Fixed bug where resetting a timer that was not at the head
     4        of one of the task timer chains resulted in the Timer Server
     5        task waking up too far in the future.
     6        * Added rtems_timer_get_information() directive to support testing.
     7        * sp31/init.c, sp31/system.h, sp31/task1.c: Modified to test for
     8        above condition.
     9
    1102001-01-22      Joel Sherrill <joel@OARcorp.com>
    211
  • testsuites/sptests/sp31/init.c

    ra94c2fbb ref70d9b  
    4848  Task_name[ 1 ]  = rtems_build_name( 'T', 'A', '1', ' ' );
    4949  Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' );
     50  Timer_name[ 2 ] = rtems_build_name( 'T', 'M', '2', ' ' );
    5051
    5152  status = rtems_task_create(
     
    6566  status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] );
    6667  directive_failed( status, "rtems_timer_create" );
     68  printf( "INIT - timer 1 has id (0x%x)\n", Timer_id[ 1 ] );
    6769
    68   printf( "INIT - timer 1 has id (0x%x)\n", Timer_id[ 1 ] );
     70  puts( "INIT - rtems_timer_create - creating timer 2" );
     71  status = rtems_timer_create( Timer_name[ 2 ], &Timer_id[ 2 ] );
     72  directive_failed( status, "rtems_timer_create" );
     73  printf( "INIT - timer 2 has id (0x%x)\n", Timer_id[ 2 ] );
    6974
    7075  status = rtems_task_delete( RTEMS_SELF );
  • testsuites/sptests/sp31/system.h

    ra94c2fbb ref70d9b  
    5353TEST_EXTERN rtems_name Task_name[ 4 ];       /* array of task names */
    5454
    55 TEST_EXTERN rtems_id   Timer_id[ 2 ];    /* array of timer ids */
    56 TEST_EXTERN rtems_name Timer_name[ 2 ];  /* array of timer names */
     55TEST_EXTERN rtems_id   Timer_id[ 3 ];    /* array of timer ids */
     56TEST_EXTERN rtems_name Timer_name[ 3 ];  /* array of timer names */
    5757
    5858/* end of include file */
  • testsuites/sptests/sp31/task1.c

    ra94c2fbb ref70d9b  
    2525)
    2626{
    27   rtems_id          tmid;
    28   rtems_time_of_day time;
    29   rtems_status_code status;
     27  rtems_id                 tmid;
     28  rtems_id                 tmid2;
     29  rtems_time_of_day        time;
     30  rtems_status_code        status;
     31  rtems_timer_information  info;
    3032
    3133/* Get id */
     
    3537  directive_failed( status, "rtems_timer_ident" );
    3638  printf( "TA1 - timer 1 has id (0x%x)\n", tmid );
     39
     40  puts( "TA1 - rtems_timer_ident - identing timer 2" );
     41  status = rtems_timer_ident( Timer_name[ 2 ], &tmid2 );
     42  directive_failed( status, "rtems_timer_ident" );
     43  printf( "TA1 - timer 2 has id (0x%x)\n", tmid2 );
     44
     45/* now check that rescheduling an active timer works OK. */
     46  puts( "TA1 - rtems_timer_server_fire_after - timer 1 in 30 seconds" );
     47  status = rtems_timer_server_fire_after(
     48    tmid, 30 * TICKS_PER_SECOND, Delayed_resume, NULL );
     49  directive_failed( status, "rtems_timer_server_fire_after" );
     50
     51  puts( "TA1 - rtems_timer_server_fire_after - timer 2 in 60 seconds" );
     52  status = rtems_timer_server_fire_after(
     53    tmid2, 60 * TICKS_PER_SECOND, Delayed_resume, NULL );
     54  directive_failed( status, "rtems_timer_server_fire_after" );
     55
     56  status = rtems_timer_get_information( tmid, &info );
     57  printf( "Timer 1 scheduled for %d ticks since boot\n",
     58    info.start_time + info.initial );
     59  printf( "Timer Server scheduled for %d ticks since boot\n",
     60    _Timer_Server->Timer.initial + _Timer_Server->Timer.start_time );
     61
     62  puts( "TA1 - rtems_task_wake_after - 1 second" );
     63  status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
     64  directive_failed( status, "rtems_timer_wake_after" );
     65
     66  puts( "TA1 - rtems_timer_server_fire_after - timer 2 in 60 seconds" );
     67  status = rtems_timer_server_fire_after(
     68    tmid2, 60 * TICKS_PER_SECOND, Delayed_resume, NULL );
     69  directive_failed( status, "rtems_timer_server_fire_after" );
     70
     71  status = rtems_timer_get_information( tmid, &info );
     72  directive_failed( status, "rtems_timer_get_information" );
     73  printf( "Timer 1 scheduled for %d ticks since boot\n",
     74    info.start_time + info.initial );
     75  printf( "Timer Server scheduled for %d ticks since boot\n",
     76    _Timer_Server->Timer.initial + _Timer_Server->Timer.start_time );
     77  assert(  (info.start_time + info.initial) ==
     78    (_Timer_Server->Timer.initial + _Timer_Server->Timer.start_time) );
     79
     80  puts( "TA1 - rtems_task_wake_after - 1 second" );
     81  status = rtems_task_wake_after( 1 * TICKS_PER_SECOND );
     82  directive_failed( status, "rtems_timer_wake_after" );
     83
     84  puts( "TA1 - rtems_timer_server_fire_after - timer 2 in 60 seconds" );
     85  status = rtems_timer_server_fire_after(
     86    tmid2, 60 * TICKS_PER_SECOND, Delayed_resume, NULL );
     87  directive_failed( status, "rtems_timer_server_fire_after" );
     88
     89  status = rtems_timer_get_information( tmid, &info );
     90  directive_failed( status, "rtems_timer_get_information" );
     91  printf( "Timer 1 scheduled for %d ticks since boot\n",
     92    info.start_time + info.initial );
     93  printf( "Timer Server scheduled for %d ticks since boot\n",
     94    _Timer_Server->Timer.initial + _Timer_Server->Timer.start_time );
     95  assert(  (info.start_time + info.initial) ==
     96    (_Timer_Server->Timer.initial + _Timer_Server->Timer.start_time) );
     97
     98  puts( "TA1 - rtems_timer_cancel - timer 1" );
     99  status = rtems_timer_cancel( tmid );
     100  directive_failed( status, "rtems_timer_cancel" );
     101
     102  puts( "TA1 - rtems_timer_cancel - timer 2" );
     103  status = rtems_timer_cancel( tmid2 );
     104  directive_failed( status, "rtems_timer_cancel" );
    37105
    38106/* after which is allowed to fire */
Note: See TracChangeset for help on using the changeset viewer.