diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-06-13 14:18:58 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-06-13 14:18:58 +0000 |
commit | b241c6c58c59176c372980435b2620276568f72a (patch) | |
tree | d8e9f100b152ad4cb5292a46b0ea781b7bcc17ac /classic_api | |
parent | 2011-06-13 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-examples-b241c6c58c59176c372980435b2620276568f72a.tar.bz2 |
2011-06-13 Joel Sherrill <joel.sherrill@oarcorp.com>
* classic_signal/test.c, triple_period/init.c, triple_period/system.h,
triple_period/tasks.c: Eliminate use of obsolete rtems_clock_get().
Diffstat (limited to 'classic_api')
-rw-r--r-- | classic_api/ChangeLog | 5 | ||||
-rw-r--r-- | classic_api/classic_signal/test.c | 6 | ||||
-rw-r--r-- | classic_api/triple_period/init.c | 4 | ||||
-rw-r--r-- | classic_api/triple_period/system.h | 11 | ||||
-rw-r--r-- | classic_api/triple_period/tasks.c | 46 |
5 files changed, 39 insertions, 33 deletions
diff --git a/classic_api/ChangeLog b/classic_api/ChangeLog index e15e71b..a2cc052 100644 --- a/classic_api/ChangeLog +++ b/classic_api/ChangeLog @@ -1,3 +1,8 @@ +2011-06-13 Joel Sherrill <joel.sherrill@oarcorp.com> + + * classic_signal/test.c, triple_period/init.c, triple_period/system.h, + triple_period/tasks.c: Eliminate use of obsolete rtems_clock_get(). + 2011-04-01 Joel Sherrill <joel.sherrill@oarcorp.com> * Makefile: Update to account for movement of .cfg files. diff --git a/classic_api/classic_signal/test.c b/classic_api/classic_signal/test.c index 94a8b43..d75b3cd 100644 --- a/classic_api/classic_signal/test.c +++ b/classic_api/classic_signal/test.c @@ -64,8 +64,7 @@ rtems_task Init( /* * Get starting time */ - status = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start ); - assert( status == RTEMS_SUCCESSFUL ); + start = rtems_clock_get_ticks_since_boot(); status = rtems_signal_catch( signal_handler, RTEMS_DEFAULT_MODES ); assert( status == RTEMS_SUCCESSFUL ); @@ -80,8 +79,7 @@ rtems_task Init( assert( status == RTEMS_SUCCESSFUL ); while (1) { - status = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now ); - assert( status == RTEMS_SUCCESSFUL ); + now = rtems_clock_get_ticks_since_boot(); if ( (now-start) > 100 ) { puts( "Signal from ISR did not get processed\n" ); exit( 0 ); diff --git a/classic_api/triple_period/init.c b/classic_api/triple_period/init.c index f35494a..cd049f9 100644 --- a/classic_api/triple_period/init.c +++ b/classic_api/triple_period/init.c @@ -33,9 +33,9 @@ rtems_task Init( puts( "*** This demo shows three different ways of running periodic tasks ***" ); puts( "*** It also demonstrates the CPU usage and Rate Monotonic statitistics utilities ***" ); - rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second ); + ticks_per_second = rtems_clock_get_ticks_per_second(); printf("\nTicks per second in your system: %" PRIu32 "\n", ticks_per_second); - rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &ticks_since_boot ); + ticks_since_boot = rtems_clock_get_ticks_since_boot(); printf("Ticks since boot: %" PRIu32 "\n\n", ticks_since_boot); time.year = 1988; diff --git a/classic_api/triple_period/system.h b/classic_api/triple_period/system.h index 4538bf8..ae7fe99 100644 --- a/classic_api/triple_period/system.h +++ b/classic_api/triple_period/system.h @@ -109,17 +109,6 @@ extern rtems_name Task_name[ 4 ]; /* array of task names */ } while (0) /* - * static inline routine to make obtaining ticks per second easier. - */ - -static inline uint32_t get_ticks_per_second( void ) -{ - rtems_interval ticks_per_second; - (void) rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticks_per_second ); return ticks_per_second; -} - - -/* * This allows us to view the "Test_task" instantiations as a set * of numbered tasks by eliminating the number of application * tasks created. diff --git a/classic_api/triple_period/tasks.c b/classic_api/triple_period/tasks.c index dbf1f6e..3670e4e 100644 --- a/classic_api/triple_period/tasks.c +++ b/classic_api/triple_period/tasks.c @@ -43,7 +43,7 @@ rtems_task Task_Absolute_Period( rtems_cpu_usage_reset(); while( 1 ) { - status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + status = rtems_clock_get_tod( &time ); count++; // sets end criteria for demo application (60 seconds) @@ -57,8 +57,8 @@ rtems_task Task_Absolute_Period( "absolute time (rtems_task_wake_when)\n", PERIOD_TASK_ABSOLUTE ); - print_time( " - rtems_clock_get - ", &time, "\n" ); - rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &ticks_since_boot ); + print_time( " - rtems_clock_get_tod - ", &time, "\n" ); + ticks_since_boot = rtems_clock_get_ticks_since_boot(); printf(" - Ticks since boot: %" PRIu32 "\n", ticks_since_boot); rtems_time_of_day time; @@ -101,12 +101,12 @@ rtems_task Task_Rate_Monotonic_Period( count = 0; while( 1 ) { - status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + status = rtems_clock_get_tod( &time ); count++; printf( "\n\nTask 2 - activating every %d second using rate monotonic manager to schedule (rtems_rate_monotonic_period)\n", PERIOD_TASK_RATE_MONOTONIC); - print_time( " - rtems_clock_get - ", &time, "\n" ); - rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &ticks_since_boot ); + print_time( " - rtems_clock_get_tod - ", &time, "\n" ); + ticks_since_boot = rtems_clock_get_ticks_since_boot(); printf(" - Ticks since boot: %" PRIu32 "\n", ticks_since_boot); if( TRUE != is_RM_created ) { @@ -117,8 +117,11 @@ rtems_task Task_Rate_Monotonic_Period( printf("RM failed with status: %d\n", status); exit(1); } - // Initiate RM periode - status = rtems_rate_monotonic_period( RM_period, get_ticks_per_second() * PERIOD_TASK_RATE_MONOTONIC ); // Every N2 seconds + // Initiate RM period -- every N2 seconds + status = rtems_rate_monotonic_period( + RM_period, + rtems_clock_get_ticks_per_second() * PERIOD_TASK_RATE_MONOTONIC + ); if( RTEMS_SUCCESSFUL != status ) { printf("RM failed with status: %d\n", status); exit(1); @@ -126,8 +129,11 @@ rtems_task Task_Rate_Monotonic_Period( is_RM_created = TRUE; } - // Block until RM period has expired - status = rtems_rate_monotonic_period( RM_period, get_ticks_per_second() * PERIOD_TASK_RATE_MONOTONIC ); // Every N2 seconds + // Block until RM period has expired -- every N2 seconds + status = rtems_rate_monotonic_period( + RM_period, + rtems_clock_get_ticks_per_second() * PERIOD_TASK_RATE_MONOTONIC + ); if( RTEMS_SUCCESSFUL != status ) { if( RTEMS_TIMEOUT != status ) { printf("RM missed period!\n"); @@ -157,14 +163,22 @@ rtems_task Task_Relative_Period( uint32_t ticks_since_boot; while( 1 ) { - status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + status = rtems_clock_get_tod( &time ); - printf( "\n\nTask 3 - activating after every %d second using relative time (rtems_task_wake_after)\n", PERIOD_TASK_RELATIVE); - print_time( " - rtems_clock_get - ", &time, "\n" ); - rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &ticks_since_boot ); - printf(" - Ticks since boot: %" PRIu32 "\n", ticks_since_boot); // Note how the ticks are drifting with this method + printf( + "\n\nTask 3 - activating after every %d second using relative " + "time (rtems_task_wake_after)\n", + PERIOD_TASK_RELATIVE + ); + print_time( " - rtems_clock_get_tod - ", &time, "\n" ); + ticks_since_boot = rtems_clock_get_ticks_since_boot(); + // Note how the ticks are drifting with this method + printf(" - Ticks since boot: %" PRIu32 "\n", ticks_since_boot); - status = rtems_task_wake_after( get_ticks_per_second() * PERIOD_TASK_RELATIVE ); // Every N3 seconds + // Every N3 seconds + status = rtems_task_wake_after( + rtems_clock_get_ticks_per_second() * PERIOD_TASK_RELATIVE + ); } } |