diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-07-26 13:49:01 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-07-26 13:49:01 +0000 |
commit | 7eef54e1ff5f705204cadbe50670bf06a3667a4b (patch) | |
tree | e44f1af70e9c6fde57fcdc0de60a30b393a12980 /cpukit | |
parent | Regenerate. (diff) | |
download | rtems-7eef54e1ff5f705204cadbe50670bf06a3667a4b.tar.bz2 |
2010-07-26 Joel Sherrill <joel.sherrilL@OARcorp.com>
* rtems/src/ratemonperiod.c: Use if not switch since all cases of enum
are not valid and switch was generating dead code.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/ChangeLog | 5 | ||||
-rw-r--r-- | cpukit/rtems/src/ratemonperiod.c | 159 |
2 files changed, 82 insertions, 82 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 68118ea72a..fc660c09e2 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,8 @@ +2010-07-26 Joel Sherrill <joel.sherrilL@OARcorp.com> + + * rtems/src/ratemonperiod.c: Use if not switch since all cases of enum + are not valid and switch was generating dead code. + 2010-07-25 Joel Sherrill <joel.sherrill@oarcorp.com> * sapi/include/rtems/init.h: Mark rtems_shutdown_executive as a diff --git a/cpukit/rtems/src/ratemonperiod.c b/cpukit/rtems/src/ratemonperiod.c index eea939ee7c..47023041b4 100644 --- a/cpukit/rtems/src/ratemonperiod.c +++ b/cpukit/rtems/src/ratemonperiod.c @@ -1,7 +1,7 @@ /* * Rate Monotonic Manager - Period Blocking and Status * - * COPYRIGHT (c) 1989-2009. + * COPYRIGHT (c) 1989-2010. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -280,94 +280,89 @@ rtems_status_code rtems_rate_monotonic_period( } _ISR_Disable( level ); - switch ( the_period->state ) { - case RATE_MONOTONIC_INACTIVE: { + if ( the_period->state == RATE_MONOTONIC_INACTIVE ) { + _ISR_Enable( level ); - _ISR_Enable( level ); + /* + * Baseline statistics information for the beginning of a period. + */ + _Rate_monotonic_Initiate_statistics( the_period ); - /* - * Baseline statistics information for the beginning of a period. - */ - _Rate_monotonic_Initiate_statistics( the_period ); + the_period->state = RATE_MONOTONIC_ACTIVE; + _Watchdog_Initialize( + &the_period->Timer, + _Rate_monotonic_Timeout, + id, + NULL + ); - the_period->state = RATE_MONOTONIC_ACTIVE; - _Watchdog_Initialize( - &the_period->Timer, - _Rate_monotonic_Timeout, - id, - NULL - ); - - the_period->next_length = length; - - _Watchdog_Insert_ticks( &the_period->Timer, length ); - _Thread_Enable_dispatch(); - return RTEMS_SUCCESSFUL; - } - case RATE_MONOTONIC_ACTIVE: - - /* - * Update statistics from the concluding period. - */ - _Rate_monotonic_Update_statistics( the_period ); - - /* - * This tells the _Rate_monotonic_Timeout that this task is - * in the process of blocking on the period and that we - * may be changing the length of the next period. - */ - the_period->state = RATE_MONOTONIC_OWNER_IS_BLOCKING; - the_period->next_length = length; - - _ISR_Enable( level ); - - _Thread_Executing->Wait.id = the_period->Object.id; - _Thread_Set_state( _Thread_Executing, STATES_WAITING_FOR_PERIOD ); - - /* - * Did the watchdog timer expire while we were actually blocking - * on it? - */ - _ISR_Disable( level ); - local_state = the_period->state; - the_period->state = RATE_MONOTONIC_ACTIVE; - _ISR_Enable( level ); - - /* - * If it did, then we want to unblock ourself and continue as - * if nothing happen. The period was reset in the timeout routine. - */ - if ( local_state == RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING ) - _Thread_Clear_state( _Thread_Executing, STATES_WAITING_FOR_PERIOD ); - - _Thread_Enable_dispatch(); - return RTEMS_SUCCESSFUL; - break; - - case RATE_MONOTONIC_EXPIRED: - - /* - * Update statistics from the concluding period - */ - _Rate_monotonic_Update_statistics( the_period ); - - _ISR_Enable( level ); + the_period->next_length = length; + + _Watchdog_Insert_ticks( &the_period->Timer, length ); + _Thread_Enable_dispatch(); + return RTEMS_SUCCESSFUL; + } + if ( the_period->state == RATE_MONOTONIC_ACTIVE ) { + /* + * Update statistics from the concluding period. + */ + _Rate_monotonic_Update_statistics( the_period ); + + /* + * This tells the _Rate_monotonic_Timeout that this task is + * in the process of blocking on the period and that we + * may be changing the length of the next period. + */ + the_period->state = RATE_MONOTONIC_OWNER_IS_BLOCKING; + the_period->next_length = length; + + _ISR_Enable( level ); + + _Thread_Executing->Wait.id = the_period->Object.id; + _Thread_Set_state( _Thread_Executing, STATES_WAITING_FOR_PERIOD ); + + /* + * Did the watchdog timer expire while we were actually blocking + * on it? + */ + _ISR_Disable( level ); + local_state = the_period->state; the_period->state = RATE_MONOTONIC_ACTIVE; - the_period->next_length = length; - - _Watchdog_Insert_ticks( &the_period->Timer, length ); - _Thread_Enable_dispatch(); - return RTEMS_TIMEOUT; - - case RATE_MONOTONIC_OWNER_IS_BLOCKING: - case RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING: - /* - * These should never happen. - */ - break; + _ISR_Enable( level ); + + /* + * If it did, then we want to unblock ourself and continue as + * if nothing happen. The period was reset in the timeout routine. + */ + if ( local_state == RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING ) + _Thread_Clear_state( _Thread_Executing, STATES_WAITING_FOR_PERIOD ); + + _Thread_Enable_dispatch(); + return RTEMS_SUCCESSFUL; } + if ( the_period->state == RATE_MONOTONIC_EXPIRED ) { + /* + * Update statistics from the concluding period + */ + _Rate_monotonic_Update_statistics( the_period ); + + _ISR_Enable( level ); + + the_period->state = RATE_MONOTONIC_ACTIVE; + the_period->next_length = length; + + _Watchdog_Insert_ticks( &the_period->Timer, length ); + _Thread_Enable_dispatch(); + return RTEMS_TIMEOUT; + } + + /* + * These should never happen so just return invalid Id. + * - RATE_MONOTONIC_OWNER_IS_BLOCKING: + * - RATE_MONOTONIC_EXPIRED_WHILE_BLOCKING: + */ #if defined(RTEMS_MULTIPROCESSING) case OBJECTS_REMOTE: /* should never return this */ #endif |