Changeset 96ec8ee8 in rtems for testsuites/sptests/sp37/init.c


Ignore:
Timestamp:
Aug 22, 2014, 3:09:36 PM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 5, master
Children:
9907dde
Parents:
8f1bdcb9
git-author:
Sebastian Huber <sebastian.huber@…> (08/22/14 15:09:36)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/26/14 08:21:27)
Message:

rtems: Add more clock tick functions

Add rtems_clock_tick_later(), rtems_clock_tick_later_usec() and
rtems_clock_tick_before().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/sptests/sp37/init.c

    r8f1bdcb9 r96ec8ee8  
    231231}
    232232
     233static void test_clock_tick_functions( void )
     234{
     235  rtems_interrupt_level level;
     236  Watchdog_Interval saved_ticks;
     237
     238  _Thread_Disable_dispatch();
     239  rtems_interrupt_disable( level );
     240
     241  saved_ticks = _Watchdog_Ticks_since_boot;
     242
     243  _Watchdog_Ticks_since_boot = 0xdeadbeef;
     244  rtems_test_assert( rtems_clock_get_ticks_since_boot() == 0xdeadbeef );
     245
     246  rtems_test_assert( rtems_clock_tick_later( 0 ) == 0xdeadbeef );
     247  rtems_test_assert( rtems_clock_tick_later( 0x8160311e ) == 0x600df00d );
     248
     249  _Watchdog_Ticks_since_boot = 0;
     250  rtems_test_assert( rtems_clock_tick_later_usec( 0 ) == 1 );
     251  rtems_test_assert( rtems_clock_tick_later_usec( 1 ) == 2 );
     252  rtems_test_assert( rtems_clock_tick_later_usec( US_PER_TICK ) == 2 );
     253  rtems_test_assert( rtems_clock_tick_later_usec( US_PER_TICK + 1 ) == 3 );
     254
     255  _Watchdog_Ticks_since_boot = 0;
     256  rtems_test_assert( !rtems_clock_tick_before( 0xffffffff ) );
     257  rtems_test_assert( !rtems_clock_tick_before( 0 ) );
     258  rtems_test_assert( rtems_clock_tick_before( 1 ) );
     259
     260  _Watchdog_Ticks_since_boot = 1;
     261  rtems_test_assert( !rtems_clock_tick_before( 0 ) );
     262  rtems_test_assert( !rtems_clock_tick_before( 1 ) );
     263  rtems_test_assert( rtems_clock_tick_before( 2 ) );
     264
     265  _Watchdog_Ticks_since_boot = 0x7fffffff;
     266  rtems_test_assert( !rtems_clock_tick_before( 0x7ffffffe ) );
     267  rtems_test_assert( !rtems_clock_tick_before( 0x7fffffff ) );
     268  rtems_test_assert( rtems_clock_tick_before( 0x80000000 ) );
     269
     270  _Watchdog_Ticks_since_boot = 0x80000000;
     271  rtems_test_assert( !rtems_clock_tick_before( 0x7fffffff ) );
     272  rtems_test_assert( !rtems_clock_tick_before( 0x80000000 ) );
     273  rtems_test_assert( rtems_clock_tick_before( 0x80000001 ) );
     274
     275  _Watchdog_Ticks_since_boot = 0xffffffff;
     276  rtems_test_assert( !rtems_clock_tick_before( 0xfffffffe ) );
     277  rtems_test_assert( !rtems_clock_tick_before( 0xffffffff ) );
     278  rtems_test_assert( rtems_clock_tick_before( 0 ) );
     279
     280  _Watchdog_Ticks_since_boot = saved_ticks;
     281
     282  rtems_interrupt_enable( level );
     283  _Thread_Enable_dispatch();
     284}
     285
    233286void test_interrupt_inline(void)
    234287{
     
    413466  directive_failed( status, "rtems_clock_tick" );
    414467  puts( "clock_tick from task level" );
     468
     469  test_clock_tick_functions();
    415470
    416471  /*
Note: See TracChangeset for help on using the changeset viewer.