summaryrefslogtreecommitdiffstats
path: root/cpukit/rtems/src/timerserverfireafter.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/timerserverfireafter.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/timerserverfireafter.c')
-rw-r--r--cpukit/rtems/src/timerserverfireafter.c68
1 files changed, 11 insertions, 57 deletions
diff --git a/cpukit/rtems/src/timerserverfireafter.c b/cpukit/rtems/src/timerserverfireafter.c
index 0636782ae0..ce1fd05848 100644
--- a/cpukit/rtems/src/timerserverfireafter.c
+++ b/cpukit/rtems/src/timerserverfireafter.c
@@ -18,12 +18,7 @@
#include "config.h"
#endif
-#include <rtems/system.h>
-#include <rtems/rtems/status.h>
-#include <rtems/rtems/support.h>
-#include <rtems/score/thread.h>
#include <rtems/rtems/timerimpl.h>
-#include <rtems/score/watchdogimpl.h>
rtems_status_code rtems_timer_server_fire_after(
rtems_id id,
@@ -32,60 +27,19 @@ rtems_status_code rtems_timer_server_fire_after(
void *user_data
)
{
- Timer_Control *the_timer;
- Objects_Locations location;
- ISR_Level level;
- Timer_server_Control *timer_server = _Timer_server;
+ Timer_server_Control *timer_server;
+
+ timer_server = _Timer_server;
if ( !timer_server )
return RTEMS_INCORRECT_STATE;
- if ( !routine )
- return RTEMS_INVALID_ADDRESS;
-
- if ( ticks == 0 )
- return RTEMS_INVALID_NUMBER;
-
- the_timer = _Timer_Get( id, &location );
- switch ( location ) {
-
- case OBJECTS_LOCAL:
- _Timer_Cancel( the_timer );
-
- _ISR_Disable( level );
-
- /*
- * Check to see if the watchdog has just been inserted by a
- * higher priority interrupt. If so, abandon this insert.
- */
-
- if ( the_timer->Ticker.state != WATCHDOG_INACTIVE ) {
- _ISR_Enable( level );
- _Objects_Put( &the_timer->Object );
- return RTEMS_SUCCESSFUL;
- }
-
- /*
- * OK. Now we now the timer was not rescheduled by an interrupt
- * so we can atomically initialize it as in use.
- */
-
- the_timer->the_class = TIMER_INTERVAL_ON_TASK;
- _Watchdog_Initialize( &the_timer->Ticker, routine, id, user_data );
- the_timer->Ticker.initial = ticks;
- _ISR_Enable( level );
-
- (*timer_server->schedule_operation)( timer_server, the_timer );
-
- _Objects_Put( &the_timer->Object );
- return RTEMS_SUCCESSFUL;
-
-#if defined(RTEMS_MULTIPROCESSING)
- case OBJECTS_REMOTE: /* should never return this */
-#endif
- case OBJECTS_ERROR:
- break;
- }
-
- return RTEMS_INVALID_ID;
+ return _Timer_Fire_after(
+ id,
+ ticks,
+ routine,
+ user_data,
+ TIMER_INTERVAL_ON_TASK,
+ _Timer_server_Routine_adaptor
+ );
}