diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-08-18 15:35:51 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-08-18 15:35:51 +0000 |
commit | 63b3dff5ec0a1db667b60c58c14d50469564a4f4 (patch) | |
tree | f4e9a79172e734a7baa7b6268a52db6a60402dff | |
parent | 2009-08-18 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-63b3dff5ec0a1db667b60c58c14d50469564a4f4.tar.bz2 |
2009-08-18 Joel Sherrill <joel.sherrill@OARcorp.com>
* rtems/src/timerreset.c: Rework to ease analysis.
-rw-r--r-- | cpukit/ChangeLog | 4 | ||||
-rw-r--r-- | cpukit/rtems/src/timerreset.c | 54 |
2 files changed, 31 insertions, 27 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 80842bee06..3abd82fcd4 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,7 @@ +2009-08-18 Joel Sherrill <joel.sherrill@OARcorp.com> + + * rtems/src/timerreset.c: Rework to ease analysis. + 2009-08-17 Joel Sherrill <joel.sherrill@oarcorp.com> * aclocal/check-networking.m4: Disable BSD TCP/IP for small memory diff --git a/cpukit/rtems/src/timerreset.c b/cpukit/rtems/src/timerreset.c index 913c10f569..43f41b50ba 100644 --- a/cpukit/rtems/src/timerreset.c +++ b/cpukit/rtems/src/timerreset.c @@ -45,40 +45,40 @@ rtems_status_code rtems_timer_reset( { Timer_Control *the_timer; Objects_Locations location; + rtems_status_code status = RTEMS_SUCCESSFUL; the_timer = _Timer_Get( id, &location ); switch ( location ) { case OBJECTS_LOCAL: - switch ( the_timer->the_class ) { - case TIMER_INTERVAL: - _Watchdog_Remove( &the_timer->Ticker ); - _Watchdog_Insert( &_Watchdog_Ticks_chain, &the_timer->Ticker ); - break; - case TIMER_INTERVAL_ON_TASK: - /* - * There is no way for a timer to have this class unless - * it was scheduled as a server fire. That requires that - * the Timer Server be initiated. So this error cannot - * occur unless something is internally wrong. - */ - #if defined(RTEMS_DEBUG) - if ( !_Timer_Server_schedule_operation ) { - _Thread_Enable_dispatch(); - return RTEMS_INCORRECT_STATE; - } - #endif - _Watchdog_Remove( &the_timer->Ticker ); - (*_Timer_Server_schedule_operation)( the_timer ); - break; - case TIMER_TIME_OF_DAY: - case TIMER_TIME_OF_DAY_ON_TASK: - case TIMER_DORMANT: - _Thread_Enable_dispatch(); - return RTEMS_NOT_DEFINED; + if ( the_timer->the_class == TIMER_INTERVAL ) { + _Watchdog_Remove( &the_timer->Ticker ); + _Watchdog_Insert( &_Watchdog_Ticks_chain, &the_timer->Ticker ); + } else if ( the_timer->the_class == TIMER_INTERVAL_ON_TASK ) { + /* + * There is no way for a timer to have this class unless + * it was scheduled as a server fire. That requires that + * the Timer Server be initiated. So this error cannot + * occur unless something is internally wrong. + */ + #if defined(RTEMS_DEBUG) + if ( !_Timer_Server_schedule_operation ) { + _Thread_Enable_dispatch(); + return RTEMS_INCORRECT_STATE; + } + #endif + _Watchdog_Remove( &the_timer->Ticker ); + (*_Timer_Server_schedule_operation)( the_timer ); + } else { + /* + * Must be dormant or time of day timer (e.g. TIMER_DORMANT, + * TIMER_TIME_OF_DAY, or TIMER_TIME_OF_DAY_ON_TASK). We + * can only reset active interval timers. + */ + status = RTEMS_NOT_DEFINED; } _Thread_Enable_dispatch(); - return RTEMS_SUCCESSFUL; + return status; #if defined(RTEMS_MULTIPROCESSING) case OBJECTS_REMOTE: /* should never return this */ |