summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/timerreset.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-08-18 15:35:51 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-08-18 15:35:51 +0000
commit63b3dff5ec0a1db667b60c58c14d50469564a4f4 (patch)
treef4e9a79172e734a7baa7b6268a52db6a60402dff /cpukit/rtems/src/timerreset.c
parent2009-08-18 Joel Sherrill <joel.sherrill@OARcorp.com> (diff)
downloadrtems-63b3dff5ec0a1db667b60c58c14d50469564a4f4.tar.bz2
2009-08-18 Joel Sherrill <joel.sherrill@OARcorp.com>
* rtems/src/timerreset.c: Rework to ease analysis.
Diffstat (limited to '')
-rw-r--r--cpukit/rtems/src/timerreset.c54
1 files changed, 27 insertions, 27 deletions
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 */