|
RTEMS CPU Kit with SuperCore
4.10.99.0
|
00001 00030 /* 00031 * COPYRIGHT (c) 1989-2011. 00032 * On-Line Applications Research Corporation (OAR). 00033 * 00034 * Copyright (c) 2009 embedded brains GmbH. 00035 * 00036 * The license and distribution terms for this file may be 00037 * found in the file LICENSE in this distribution or at 00038 * http://www.rtems.com/license/LICENSE. 00039 */ 00040 00041 #ifndef _RTEMS_RTEMS_TIMER_H 00042 #define _RTEMS_RTEMS_TIMER_H 00043 00052 #ifndef RTEMS_TIMER_EXTERN 00053 #define RTEMS_TIMER_EXTERN extern 00054 #endif 00055 00056 #ifdef __cplusplus 00057 extern "C" { 00058 #endif 00059 00060 #include <rtems/score/object.h> 00061 #include <rtems/score/watchdog.h> 00062 #include <rtems/score/thread.h> 00063 #include <rtems/score/chain.h> 00064 #include <rtems/rtems/clock.h> 00065 #include <rtems/rtems/attr.h> 00066 00085 typedef enum { 00090 TIMER_INTERVAL, 00091 00096 TIMER_INTERVAL_ON_TASK, 00097 00102 TIMER_TIME_OF_DAY, 00103 00108 TIMER_TIME_OF_DAY_ON_TASK, 00109 00113 TIMER_DORMANT 00114 } Timer_Classes; 00115 00119 typedef void rtems_timer_service_routine; 00120 00126 typedef rtems_timer_service_routine ( *rtems_timer_service_routine_entry )( 00127 rtems_id, 00128 void * 00129 ); 00130 00135 typedef struct { 00137 Objects_Control Object; 00139 Watchdog_Control Ticker; 00141 Timer_Classes the_class; 00142 } Timer_Control; 00143 00144 typedef struct Timer_server_Control Timer_server_Control; 00145 00149 typedef void (*Timer_server_Schedule_operation)( 00150 Timer_server_Control *timer_server, 00151 Timer_Control *timer 00152 ); 00153 00154 typedef struct { 00159 Watchdog_Control System_watchdog; 00160 00164 Chain_Control Chain; 00165 00171 Watchdog_Interval volatile last_snapshot; 00172 } Timer_server_Watchdogs; 00173 00174 struct Timer_server_Control { 00178 Thread_Control *thread; 00179 00183 Timer_server_Schedule_operation schedule_operation; 00184 00188 Timer_server_Watchdogs Interval_watchdogs; 00189 00193 Timer_server_Watchdogs TOD_watchdogs; 00194 00203 Chain_Control *volatile insert_chain; 00204 00213 bool volatile active; 00214 }; 00215 00221 RTEMS_TIMER_EXTERN Timer_server_Control *volatile _Timer_server; 00222 00227 RTEMS_TIMER_EXTERN Objects_Information _Timer_Information; 00228 00234 void _Timer_Manager_initialization(void); 00235 00248 rtems_status_code rtems_timer_create( 00249 rtems_name name, 00250 rtems_id *id 00251 ); 00252 00267 rtems_status_code rtems_timer_ident( 00268 rtems_name name, 00269 rtems_id *id 00270 ); 00271 00278 rtems_status_code rtems_timer_cancel( 00279 rtems_id id 00280 ); 00281 00294 rtems_status_code rtems_timer_delete( 00295 rtems_id id 00296 ); 00297 00316 rtems_status_code rtems_timer_fire_after( 00317 rtems_id id, 00318 rtems_interval ticks, 00319 rtems_timer_service_routine_entry routine, 00320 void *user_data 00321 ); 00322 00341 rtems_status_code rtems_timer_server_fire_after( 00342 rtems_id id, 00343 rtems_interval ticks, 00344 rtems_timer_service_routine_entry routine, 00345 void *user_data 00346 ); 00347 00366 rtems_status_code rtems_timer_fire_when( 00367 rtems_id id, 00368 rtems_time_of_day *wall_time, 00369 rtems_timer_service_routine_entry routine, 00370 void *user_data 00371 ); 00372 00384 rtems_status_code rtems_timer_server_fire_when( 00385 rtems_id id, 00386 rtems_time_of_day *wall_time, 00387 rtems_timer_service_routine_entry routine, 00388 void *user_data 00389 ); 00390 00401 rtems_status_code rtems_timer_reset( 00402 rtems_id id 00403 ); 00404 00412 rtems_status_code rtems_timer_initiate_server( 00413 uint32_t priority, 00414 uint32_t stack_size, 00415 rtems_attribute attribute_set 00416 ); 00417 00423 #define RTEMS_TIMER_SERVER_DEFAULT_PRIORITY (uint32_t) -1 00424 00429 typedef struct { 00431 Timer_Classes the_class; 00433 Watchdog_Interval initial; 00435 Watchdog_Interval start_time; 00437 Watchdog_Interval stop_time; 00438 } rtems_timer_information; 00439 00452 rtems_status_code rtems_timer_get_information( 00453 rtems_id id, 00454 rtems_timer_information *the_info 00455 ); 00456 00457 #ifndef __RTEMS_APPLICATION__ 00458 #include <rtems/rtems/timer.inl> 00459 #endif 00460 00461 #ifdef __cplusplus 00462 } 00463 #endif 00464 00467 #endif 00468 /* end of include file */
1.7.5