summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/timerreset.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-02-18 08:36:26 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-03-04 13:36:10 +0100
commit03b900d3ed120ea919ea3eded7edbece3488cff3 (patch)
tree182781fc14fe15fd67caeb80e46f1c58495839c2 /cpukit/rtems/src/timerreset.c
parentscore: Distribute clock tick to all online CPUs (diff)
downloadrtems-03b900d3ed120ea919ea3eded7edbece3488cff3.tar.bz2
score: Replace watchdog handler implementation
Use a red-black tree instead of delta chains. Close #2344. Update #2554. Update #2555. Close #2606.
Diffstat (limited to 'cpukit/rtems/src/timerreset.c')
-rw-r--r--cpukit/rtems/src/timerreset.c41
1 files changed, 15 insertions, 26 deletions
diff --git a/cpukit/rtems/src/timerreset.c b/cpukit/rtems/src/timerreset.c
index 7ab172ea4f..72c912baa3 100644
--- a/cpukit/rtems/src/timerreset.c
+++ b/cpukit/rtems/src/timerreset.c
@@ -44,40 +44,29 @@ rtems_status_code rtems_timer_reset(
{
Timer_Control *the_timer;
Objects_Locations location;
- rtems_status_code status = RTEMS_SUCCESSFUL;
+ ISR_lock_Context lock_context;
+ Per_CPU_Control *cpu;
+ rtems_status_code status;
- the_timer = _Timer_Get( id, &location );
+ the_timer = _Timer_Get( id, &location, &lock_context );
switch ( location ) {
case OBJECTS_LOCAL:
- if ( the_timer->the_class == TIMER_INTERVAL ) {
- _Watchdog_Reset_ticks( &the_timer->Ticker );
- } else if ( the_timer->the_class == TIMER_INTERVAL_ON_TASK ) {
- Timer_server_Control *timer_server = _Timer_server;
+ cpu = _Timer_Acquire_critical( the_timer, &lock_context );
- /*
- * 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 ) {
- _Objects_Put( &the_timer->Object );
- return RTEMS_INCORRECT_STATE;
- }
- #endif
- (*timer_server->cancel)( timer_server, the_timer );
- (*timer_server->schedule_operation)( timer_server, the_timer );
+ if ( _Timer_Is_interval_class( the_timer->the_class ) ) {
+ _Timer_Cancel( cpu, the_timer );
+ _Watchdog_Insert(
+ &cpu->Watchdog.Header[ PER_CPU_WATCHDOG_RELATIVE ],
+ &the_timer->Ticker,
+ cpu->Watchdog.ticks + the_timer->initial
+ );
+ status = RTEMS_SUCCESSFUL;
} 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;
}
- _Objects_Put( &the_timer->Object );
+
+ _Timer_Release( cpu, &lock_context );
return status;
#if defined(RTEMS_MULTIPROCESSING)