Changeset b241c6c in examples-v2


Ignore:
Timestamp:
Jun 13, 2011, 2:18:58 PM (8 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.11, 286403d7a3d0e521179e677c0d2fd7549c9ceab4
Children:
1547d8a
Parents:
10715f5
Message:

2011-06-13 Joel Sherrill <joel.sherrill@…>

  • classic_signal/test.c, triple_period/init.c, triple_period/system.h, triple_period/tasks.c: Eliminate use of obsolete rtems_clock_get().
Location:
classic_api
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • classic_api/ChangeLog

    r10715f5 rb241c6c  
     12011-06-13      Joel Sherrill <joel.sherrill@oarcorp.com>
     2
     3        * classic_signal/test.c, triple_period/init.c, triple_period/system.h,
     4        triple_period/tasks.c: Eliminate use of obsolete rtems_clock_get().
     5
    162011-04-01      Joel Sherrill <joel.sherrill@oarcorp.com>
    27
  • classic_api/classic_signal/test.c

    r10715f5 rb241c6c  
    6565   *  Get starting time
    6666   */
    67   status = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start );
    68   assert( status == RTEMS_SUCCESSFUL );
     67  start = rtems_clock_get_ticks_since_boot();
    6968
    7069  status = rtems_signal_catch( signal_handler, RTEMS_DEFAULT_MODES );
     
    8180
    8281  while (1) {
    83     status = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now );
    84     assert( status == RTEMS_SUCCESSFUL );
     82    now = rtems_clock_get_ticks_since_boot();
    8583    if ( (now-start) > 100 ) {
    8684      puts( "Signal from ISR did not get processed\n" );
  • classic_api/triple_period/init.c

    r10715f5 rb241c6c  
    3434  puts( "*** It also demonstrates the CPU usage and Rate Monotonic statitistics utilities ***" );
    3535
    36   rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second );
     36  ticks_per_second = rtems_clock_get_ticks_per_second();
    3737  printf("\nTicks per second in your system: %" PRIu32 "\n", ticks_per_second);
    38   rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &ticks_since_boot );
     38  ticks_since_boot = rtems_clock_get_ticks_since_boot();
    3939  printf("Ticks since boot: %" PRIu32 "\n\n", ticks_since_boot);
    4040
  • classic_api/triple_period/system.h

    r10715f5 rb241c6c  
    110110
    111111/*
    112  *  static inline routine to make obtaining ticks per second easier.
    113  */
    114 
    115 static inline uint32_t get_ticks_per_second( void )
    116 {
    117   rtems_interval ticks_per_second;
    118   (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second );  return ticks_per_second;
    119 }
    120 
    121 
    122 /*
    123112 *  This allows us to view the "Test_task" instantiations as a set
    124113 *  of numbered tasks by eliminating the number of application
  • classic_api/triple_period/tasks.c

    r10715f5 rb241c6c  
    4444
    4545  while( 1 ) {
    46     status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
     46    status = rtems_clock_get_tod( &time );
    4747    count++;
    4848
     
    5858      PERIOD_TASK_ABSOLUTE
    5959    );
    60     print_time( " - rtems_clock_get - ", &time, "\n" );
    61     rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &ticks_since_boot );
     60    print_time( " - rtems_clock_get_tod - ", &time, "\n" );
     61    ticks_since_boot = rtems_clock_get_ticks_since_boot();
    6262    printf(" - Ticks since boot: %" PRIu32 "\n", ticks_since_boot);
    6363
     
    102102
    103103  while( 1 ) {
    104     status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
     104    status = rtems_clock_get_tod( &time );
    105105    count++;
    106106
    107107    printf( "\n\nTask 2 - activating every %d second using rate monotonic manager to schedule (rtems_rate_monotonic_period)\n", PERIOD_TASK_RATE_MONOTONIC);
    108     print_time( " - rtems_clock_get - ", &time, "\n" );
    109     rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &ticks_since_boot );
     108    print_time( " - rtems_clock_get_tod - ", &time, "\n" );
     109    ticks_since_boot = rtems_clock_get_ticks_since_boot();
    110110    printf(" - Ticks since boot: %" PRIu32 "\n", ticks_since_boot);
    111111
     
    118118        exit(1);
    119119      }
    120       // Initiate RM periode
    121       status = rtems_rate_monotonic_period( RM_period, get_ticks_per_second() * PERIOD_TASK_RATE_MONOTONIC ); // Every N2 seconds
     120      // Initiate RM period -- every N2 seconds
     121      status = rtems_rate_monotonic_period(
     122        RM_period,
     123        rtems_clock_get_ticks_per_second() * PERIOD_TASK_RATE_MONOTONIC
     124      );
    122125      if( RTEMS_SUCCESSFUL != status ) {
    123126        printf("RM failed with status: %d\n", status);
     
    127130      is_RM_created = TRUE;
    128131    }
    129     // Block until RM period has expired
    130     status = rtems_rate_monotonic_period( RM_period, get_ticks_per_second() * PERIOD_TASK_RATE_MONOTONIC ); // Every N2 seconds
     132    // Block until RM period has expired -- every N2 seconds
     133    status = rtems_rate_monotonic_period(
     134      RM_period,
     135      rtems_clock_get_ticks_per_second() * PERIOD_TASK_RATE_MONOTONIC
     136    );
    131137    if( RTEMS_SUCCESSFUL != status ) {
    132138      if( RTEMS_TIMEOUT != status ) {
     
    158164
    159165  while( 1 ) {
    160     status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
     166    status = rtems_clock_get_tod( &time );
    161167
    162     printf( "\n\nTask 3 - activating after every %d second using relative time (rtems_task_wake_after)\n", PERIOD_TASK_RELATIVE);
    163     print_time( " - rtems_clock_get - ", &time, "\n" );
    164     rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &ticks_since_boot );
    165     printf(" - Ticks since boot: %" PRIu32 "\n", ticks_since_boot);   // Note how the ticks are drifting with this method
     168    printf(
     169      "\n\nTask 3 - activating after every %d second using relative "
     170        "time (rtems_task_wake_after)\n",
     171      PERIOD_TASK_RELATIVE
     172    );
     173    print_time( " - rtems_clock_get_tod - ", &time, "\n" );
     174    ticks_since_boot = rtems_clock_get_ticks_since_boot();
     175    // Note how the ticks are drifting with this method
     176    printf(" - Ticks since boot: %" PRIu32 "\n", ticks_since_boot);
    166177
    167     status = rtems_task_wake_after( get_ticks_per_second() * PERIOD_TASK_RELATIVE ); // Every N3 seconds
     178    // Every N3 seconds
     179    status = rtems_task_wake_after(
     180      rtems_clock_get_ticks_per_second() * PERIOD_TASK_RELATIVE
     181    );
    168182  }
    169183}
Note: See TracChangeset for help on using the changeset viewer.