From 03b900d3ed120ea919ea3eded7edbece3488cff3 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 18 Feb 2016 08:36:26 +0100 Subject: score: Replace watchdog handler implementation Use a red-black tree instead of delta chains. Close #2344. Update #2554. Update #2555. Close #2606. --- cpukit/rtems/src/timerserverfireafter.c | 68 ++++++--------------------------- 1 file changed, 11 insertions(+), 57 deletions(-) (limited to 'cpukit/rtems/src/timerserverfireafter.c') 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 -#include -#include -#include #include -#include 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 + ); } -- cgit v1.2.3