From c55df856aaba12355354374983fc1e69bb60373d Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 16 Jan 2002 22:09:50 +0000 Subject: 2001-01-16 Joel Sherrill * Added task-based timers to the Timer Manager. This added three new directives: - rtems_timer_initiate_server - rtems_timer_server_fire_after - rtems_timer_server_fire_when In the process of doing this, a number of cleanups were made. * src/timerserver.c, src/timerserverfireafter.c, src/timerserverfirewhen.c: New files. * include/timer/timer.h: Added new prototypes and supporting types. * inline/rtems/rtems/timer.h, macros/rtems/rtems/timer.h: Enhanced _Timer_Is_interval_class() to cover the class TIMER_INTERVAL_ON_TASK. * src/Makefile.am: Accounted for new files. * src/rtemstimer.c: Added initialization of _Timer_Server variable. * src/timercancel.c, src/timerreset.c: Account for addition of timer classes. Also corrected the headers. * src/timercreate.c, src/timerdelete.c, src/timerfireafter.c, src/timerfireafter.c, src/timerident.c: Corrected header. --- c/src/exec/rtems/src/Makefile.am | 3 ++- c/src/exec/rtems/src/rtemstimer.c | 9 ++++++++- c/src/exec/rtems/src/timercancel.c | 6 +++--- c/src/exec/rtems/src/timercreate.c | 8 ++++---- c/src/exec/rtems/src/timerdelete.c | 6 +++--- c/src/exec/rtems/src/timerfireafter.c | 13 +++++++------ c/src/exec/rtems/src/timerfirewhen.c | 7 ++++--- c/src/exec/rtems/src/timerident.c | 8 ++++---- c/src/exec/rtems/src/timerreset.c | 26 ++++++++++++++++++-------- 9 files changed, 53 insertions(+), 33 deletions(-) (limited to 'c/src/exec/rtems/src') diff --git a/c/src/exec/rtems/src/Makefile.am b/c/src/exec/rtems/src/Makefile.am index 8b8824876c..f1402ef9de 100644 --- a/c/src/exec/rtems/src/Makefile.am +++ b/c/src/exec/rtems/src/Makefile.am @@ -26,7 +26,8 @@ INTR_C_FILES = intr.c intrbody.c intrcatch.c CLOCK_C_FILES = rtclock.c clockget.c clockset.c clocktick.c TIMER_C_FILES = rtemstimer.c timercancel.c timercreate.c timerdelete.c \ - timerfireafter.c timerfirewhen.c timerident.c timerreset.c + timerfireafter.c timerfirewhen.c timerident.c timerreset.c timerserver.c \ + timerserverfireafter.c timerserverfirewhen.c MESSAGE_QUEUE_C_FILES = msg.c msgqallocate.c msgqbroadcast.c msgqcreate.c \ msgqdelete.c msgqflush.c msgqgetnumberpending.c msgqident.c \ diff --git a/c/src/exec/rtems/src/rtemstimer.c b/c/src/exec/rtems/src/rtemstimer.c index e413681549..6954f1dec6 100644 --- a/c/src/exec/rtems/src/rtemstimer.c +++ b/c/src/exec/rtems/src/rtemstimer.c @@ -2,7 +2,7 @@ * Timer Manager * * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2002. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -47,4 +47,11 @@ void _Timer_Manager_initialization( RTEMS_MAXIMUM_NAME_LENGTH, FALSE ); + + /* + * Initialize the pointer to the Timer Server TCB to NULL indicating + * that task-based timer support is not initialized. + */ + + _Timer_Server = NULL; } diff --git a/c/src/exec/rtems/src/timercancel.c b/c/src/exec/rtems/src/timercancel.c index 9db829d717..a4b2ea60d5 100644 --- a/c/src/exec/rtems/src/timercancel.c +++ b/c/src/exec/rtems/src/timercancel.c @@ -1,8 +1,8 @@ /* - * Timer Manager + * Timer Manager - rtems_timer_cancel directive * * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2002. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -32,7 +32,7 @@ * * Output parameters: * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful + * error code - if unsuccessful */ rtems_status_code rtems_timer_cancel( diff --git a/c/src/exec/rtems/src/timercreate.c b/c/src/exec/rtems/src/timercreate.c index 33e7f00d79..a1734e980f 100644 --- a/c/src/exec/rtems/src/timercreate.c +++ b/c/src/exec/rtems/src/timercreate.c @@ -1,8 +1,8 @@ /* - * Timer Manager + * Timer Manager - rtems_timer_create directive * * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2002. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -32,9 +32,9 @@ * id - pointer to timer id * * Output parameters: - * id - timer id + * id - timer id * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful + * error code - if unsuccessful */ rtems_status_code rtems_timer_create( diff --git a/c/src/exec/rtems/src/timerdelete.c b/c/src/exec/rtems/src/timerdelete.c index c207cb0ab7..87c61941d7 100644 --- a/c/src/exec/rtems/src/timerdelete.c +++ b/c/src/exec/rtems/src/timerdelete.c @@ -1,8 +1,8 @@ /* - * Timer Manager + * Timer Manager - rtems_timer_delete directive * * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2002. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -32,7 +32,7 @@ * * Output parameters: * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful + * error code - if unsuccessful */ rtems_status_code rtems_timer_delete( diff --git a/c/src/exec/rtems/src/timerfireafter.c b/c/src/exec/rtems/src/timerfireafter.c index f31b63ae92..76a3e3a0e6 100644 --- a/c/src/exec/rtems/src/timerfireafter.c +++ b/c/src/exec/rtems/src/timerfireafter.c @@ -1,8 +1,8 @@ /* - * Timer Manager + * Timer Manager - rtems_timer_fire_after directive * * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2002. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -28,13 +28,14 @@ * This directive allows a thread to start a timer. * * Input parameters: - * id - timer id - * ticks - interval until routine is fired - * routine - routine to schedule + * id - timer id + * ticks - interval until routine is fired + * routine - routine to schedule + * user_data - passed as argument to routine when it is fired * * Output parameters: * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful + * error code - if unsuccessful */ rtems_status_code rtems_timer_fire_after( diff --git a/c/src/exec/rtems/src/timerfirewhen.c b/c/src/exec/rtems/src/timerfirewhen.c index 309261351a..c2d9fdc222 100644 --- a/c/src/exec/rtems/src/timerfirewhen.c +++ b/c/src/exec/rtems/src/timerfirewhen.c @@ -1,8 +1,8 @@ /* - * Timer Manager + * Timer Manager - rtems_timer_fire_when directive * * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2002. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -31,10 +31,11 @@ * id - timer id * wall_time - time of day to fire timer * routine - routine to schedule + * user_data - passed as argument to routine when it is fired * * Output parameters: * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful + * error code - if unsuccessful */ rtems_status_code rtems_timer_fire_when( diff --git a/c/src/exec/rtems/src/timerident.c b/c/src/exec/rtems/src/timerident.c index 492f55c6ac..f8cb36bdc6 100644 --- a/c/src/exec/rtems/src/timerident.c +++ b/c/src/exec/rtems/src/timerident.c @@ -1,8 +1,8 @@ /* - * Timer Manager + * Timer Manager - rtems_timer_ident directive * * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2002. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -33,9 +33,9 @@ * id - pointer to timer id * * Output parameters: - * *id - message queue id + * *id - message queue id * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful + * error code - if unsuccessful */ rtems_status_code rtems_timer_ident( diff --git a/c/src/exec/rtems/src/timerreset.c b/c/src/exec/rtems/src/timerreset.c index f538098b1e..33a45e1fc3 100644 --- a/c/src/exec/rtems/src/timerreset.c +++ b/c/src/exec/rtems/src/timerreset.c @@ -1,8 +1,8 @@ /* - * Timer Manager + * Timer Manager - rtems_timer_reset directive * * - * COPYRIGHT (c) 1989-1999. + * COPYRIGHT (c) 1989-2002. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be @@ -32,7 +32,7 @@ * * Output parameters: * RTEMS_SUCCESSFUL - if successful - * error code - if unsuccessful + * error code - if unsuccessful */ rtems_status_code rtems_timer_reset( @@ -51,13 +51,23 @@ rtems_status_code rtems_timer_reset( return RTEMS_INVALID_ID; case OBJECTS_LOCAL: - if ( _Timer_Is_interval_class( the_timer->the_class ) ) { - _Watchdog_Reset( &the_timer->Ticker ); - _Thread_Enable_dispatch(); - return RTEMS_SUCCESSFUL; + 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: + _Watchdog_Remove( &the_timer->Ticker ); + _Watchdog_Insert( &_Timer_Ticks_chain, &the_timer->Ticker ); + break; + case TIMER_TIME_OF_DAY: + case TIMER_TIME_OF_DAY_ON_TASK: + case TIMER_DORMANT: + _Thread_Enable_dispatch(); + return RTEMS_NOT_DEFINED; } _Thread_Enable_dispatch(); - return RTEMS_NOT_DEFINED; + return RTEMS_SUCCESSFUL; } return RTEMS_INTERNAL_ERROR; /* unreached - only to remove warnings */ -- cgit v1.2.3