Changeset 422289e in rtems
- Timestamp:
- 01/29/02 18:18:14 (22 years ago)
- Branches:
- 4.10, 4.11, 4.8, 4.9, 5, master
- Children:
- a94c2fbb
- Parents:
- 49d0704
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
c/src/exec/rtems/ChangeLog
r49d0704 r422289e 1 2001-01-29 Joel Sherrill <joel@OARcorp.com> 2 3 * Fixed bug where resetting a timer that was not at the head 4 of one of the task timer chains resulted in the Timer Server 5 task waking up too far in the future. 6 * Added rtems_timer_get_information() directive to support testing. 7 * src/timerserver.c, include/rtems/rtems/timer.h, 8 * src/timergetinfo.c: New file. 9 * src/Makefile.am: Modified to reflect above. 10 1 11 2001-01-22 Joel Sherrill <joel@OARcorp.com> 2 12 -
c/src/exec/rtems/src/Makefile.am
r49d0704 r422289e 27 27 28 28 TIMER_C_FILES = rtemstimer.c timercancel.c timercreate.c timerdelete.c \ 29 timerfireafter.c timerfirewhen.c timer ident.c timerreset.c timerserver.c \30 timerserver fireafter.c timerserverfirewhen.c29 timerfireafter.c timerfirewhen.c timergetinfo.c timerident.c timerreset.c \ 30 timerserver.c timerserverfireafter.c timerserverfirewhen.c 31 31 32 32 MESSAGE_QUEUE_C_FILES = msg.c msgqallocate.c msgqbroadcast.c msgqcreate.c \ -
c/src/exec/rtems/src/timerserver.c
r49d0704 r422289e 40 40 41 41 /* 42 * These variables keep track of the last time the Timer Server actually 43 * processed the chain. 44 */ 45 46 Watchdog_Interval _Timer_Server_seconds_last_time; 47 Watchdog_Interval _Timer_Server_ticks_last_time; 48 49 /* 42 50 * The timer used to control when the Timer Server wakes up to service 43 51 * "when" timers. … … 47 55 48 56 Watchdog_Control _Timer_Seconds_timer; 57 58 /* 59 * prototypes for support routines to process the chains 60 */ 61 62 void _Timer_Process_ticks_chain(void); 63 void _Timer_Process_seconds_chain(void); 49 64 50 65 /*PAGE … … 67 82 ) 68 83 { 69 Watchdog_Interval snapshot;70 Watchdog_Interval ticks_last_time;71 Watchdog_Interval seconds_last_time;72 Watchdog_Interval ticks;73 74 84 /* 75 85 * Initialize the "last time" markers to indicate the timer that … … 77 87 */ 78 88 79 ticks_last_time = _Watchdog_Ticks_since_boot;80 seconds_last_time = _TOD_Seconds_since_epoch;89 _Timer_Server_ticks_last_time = _Watchdog_Ticks_since_boot; 90 _Timer_Server_seconds_last_time = _TOD_Seconds_since_epoch; 81 91 82 92 _Thread_Disable_dispatch(); … … 101 111 102 112 _Thread_Disable_dispatch(); 103 104 /* 105 * Process the ticks chain 106 */ 107 108 snapshot = _Watchdog_Ticks_since_boot; 109 ticks = snapshot - ticks_last_time; 110 ticks_last_time = snapshot; 111 _Watchdog_Adjust( &_Timer_Ticks_chain, WATCHDOG_FORWARD, ticks ); 112 113 /* 114 * Process the seconds chain. Start by checking that the Time 115 * of Day (TOD) has not been set backwards. If it has then 116 * we want to adjust the _Timer_Seconds_chain to indicate this. 117 */ 118 119 snapshot = _TOD_Seconds_since_epoch; 120 if ( snapshot > seconds_last_time ) { 121 /* 122 * This path is for normal forward movement and cases where the 123 * TOD has been set forward. 124 */ 125 126 ticks = snapshot - seconds_last_time; 127 _Watchdog_Adjust( &_Timer_Seconds_chain, WATCHDOG_FORWARD, ticks ); 128 129 } else if ( snapshot < seconds_last_time ) { 130 /* 131 * The current TOD is before the last TOD which indicates that 132 * TOD has been set backwards. 133 */ 134 135 ticks = seconds_last_time - snapshot; 136 _Watchdog_Adjust( &_Timer_Seconds_chain, WATCHDOG_BACKWARD, ticks ); 137 } 138 seconds_last_time = snapshot; 113 _Timer_Process_ticks_chain(); 114 _Timer_Process_seconds_chain(); 139 115 } 140 116 } … … 290 266 switch ( reset_mode ) { 291 267 case TIMER_SERVER_RESET_TICKS: 292 _Watchdog_Remove( &_Timer_Server->Timer ); 293 units = ((Watchdog_Control *)_Timer_Ticks_chain.first)->delta_interval; 294 _Watchdog_Insert_ticks( &_Timer_Server->Timer, units ); 268 _Watchdog_Remove( &_Timer_Server->Timer ); 269 _Timer_Process_ticks_chain(); 270 if ( !_Chain_Is_empty( &_Timer_Ticks_chain ) ) { 271 units = ((Watchdog_Control *)_Timer_Ticks_chain.first)->delta_interval; 272 _Watchdog_Insert_ticks( &_Timer_Server->Timer, units ); 273 } 295 274 break; 296 275 case TIMER_SERVER_RESET_SECONDS: 297 276 _Watchdog_Remove( &_Timer_Seconds_timer ); 298 units = ((Watchdog_Control *)_Timer_Seconds_chain.first)->delta_interval; 299 _Watchdog_Insert_seconds( &_Timer_Seconds_timer, units ); 277 _Timer_Process_seconds_chain(); 278 if ( !_Chain_Is_empty( &_Timer_Seconds_chain ) ) { 279 units = ((Watchdog_Control *)_Timer_Seconds_chain.first)->delta_interval; 280 _Watchdog_Insert_seconds( &_Timer_Seconds_timer, units ); 281 } 300 282 break; 301 283 } 302 284 } 303 285 286 /*PAGE 287 * 288 * _Timer_Server_Process_ticks_chain 289 * 290 * This routine is responsible for adjusting the list of task-based 291 * interval timers to reflect the passage of time. 292 * 293 * Input parameters: NONE 294 * 295 * Output parameters: NONE 296 */ 297 298 void _Timer_Process_ticks_chain(void) 299 { 300 Watchdog_Interval snapshot; 301 Watchdog_Interval ticks; 302 303 snapshot = _Watchdog_Ticks_since_boot; 304 if ( snapshot >= _Timer_Server_ticks_last_time ) 305 ticks = snapshot - _Timer_Server_ticks_last_time; 306 else 307 ticks = (0xFFFFFFFF - _Timer_Server_ticks_last_time) + snapshot; 308 309 _Timer_Server_ticks_last_time = snapshot; 310 _Watchdog_Adjust( &_Timer_Ticks_chain, WATCHDOG_FORWARD, ticks ); 311 } 312 313 /*PAGE 314 * 315 * _Timer_Server_Process_seconds_chain 316 * 317 * This routine is responsible for adjusting the list of task-based 318 * time of day timers to reflect the passage of time. 319 * 320 * Input parameters: NONE 321 * 322 * Output parameters: NONE 323 */ 324 325 void _Timer_Process_seconds_chain(void) 326 { 327 Watchdog_Interval snapshot; 328 Watchdog_Interval ticks; 329 330 /* 331 * Process the seconds chain. Start by checking that the Time 332 * of Day (TOD) has not been set backwards. If it has then 333 * we want to adjust the _Timer_Seconds_chain to indicate this. 334 */ 335 336 snapshot = _TOD_Seconds_since_epoch; 337 if ( snapshot > _Timer_Server_seconds_last_time ) { 338 /* 339 * This path is for normal forward movement and cases where the 340 * TOD has been set forward. 341 */ 342 343 ticks = snapshot - _Timer_Server_seconds_last_time; 344 _Watchdog_Adjust( &_Timer_Seconds_chain, WATCHDOG_FORWARD, ticks ); 345 346 } else if ( snapshot < _Timer_Server_seconds_last_time ) { 347 /* 348 * The current TOD is before the last TOD which indicates that 349 * TOD has been set backwards. 350 */ 351 352 ticks = _Timer_Server_seconds_last_time - snapshot; 353 _Watchdog_Adjust( &_Timer_Seconds_chain, WATCHDOG_BACKWARD, ticks ); 354 } 355 _Timer_Server_seconds_last_time = snapshot; 356 } 357 -
cpukit/rtems/ChangeLog
r49d0704 r422289e 1 2001-01-29 Joel Sherrill <joel@OARcorp.com> 2 3 * Fixed bug where resetting a timer that was not at the head 4 of one of the task timer chains resulted in the Timer Server 5 task waking up too far in the future. 6 * Added rtems_timer_get_information() directive to support testing. 7 * src/timerserver.c, include/rtems/rtems/timer.h, 8 * src/timergetinfo.c: New file. 9 * src/Makefile.am: Modified to reflect above. 10 1 11 2001-01-22 Joel Sherrill <joel@OARcorp.com> 2 12 -
cpukit/rtems/src/Makefile.am
r49d0704 r422289e 27 27 28 28 TIMER_C_FILES = rtemstimer.c timercancel.c timercreate.c timerdelete.c \ 29 timerfireafter.c timerfirewhen.c timer ident.c timerreset.c timerserver.c \30 timerserver fireafter.c timerserverfirewhen.c29 timerfireafter.c timerfirewhen.c timergetinfo.c timerident.c timerreset.c \ 30 timerserver.c timerserverfireafter.c timerserverfirewhen.c 31 31 32 32 MESSAGE_QUEUE_C_FILES = msg.c msgqallocate.c msgqbroadcast.c msgqcreate.c \ -
cpukit/rtems/src/timerserver.c
r49d0704 r422289e 40 40 41 41 /* 42 * These variables keep track of the last time the Timer Server actually 43 * processed the chain. 44 */ 45 46 Watchdog_Interval _Timer_Server_seconds_last_time; 47 Watchdog_Interval _Timer_Server_ticks_last_time; 48 49 /* 42 50 * The timer used to control when the Timer Server wakes up to service 43 51 * "when" timers. … … 47 55 48 56 Watchdog_Control _Timer_Seconds_timer; 57 58 /* 59 * prototypes for support routines to process the chains 60 */ 61 62 void _Timer_Process_ticks_chain(void); 63 void _Timer_Process_seconds_chain(void); 49 64 50 65 /*PAGE … … 67 82 ) 68 83 { 69 Watchdog_Interval snapshot;70 Watchdog_Interval ticks_last_time;71 Watchdog_Interval seconds_last_time;72 Watchdog_Interval ticks;73 74 84 /* 75 85 * Initialize the "last time" markers to indicate the timer that … … 77 87 */ 78 88 79 ticks_last_time = _Watchdog_Ticks_since_boot;80 seconds_last_time = _TOD_Seconds_since_epoch;89 _Timer_Server_ticks_last_time = _Watchdog_Ticks_since_boot; 90 _Timer_Server_seconds_last_time = _TOD_Seconds_since_epoch; 81 91 82 92 _Thread_Disable_dispatch(); … … 101 111 102 112 _Thread_Disable_dispatch(); 103 104 /* 105 * Process the ticks chain 106 */ 107 108 snapshot = _Watchdog_Ticks_since_boot; 109 ticks = snapshot - ticks_last_time; 110 ticks_last_time = snapshot; 111 _Watchdog_Adjust( &_Timer_Ticks_chain, WATCHDOG_FORWARD, ticks ); 112 113 /* 114 * Process the seconds chain. Start by checking that the Time 115 * of Day (TOD) has not been set backwards. If it has then 116 * we want to adjust the _Timer_Seconds_chain to indicate this. 117 */ 118 119 snapshot = _TOD_Seconds_since_epoch; 120 if ( snapshot > seconds_last_time ) { 121 /* 122 * This path is for normal forward movement and cases where the 123 * TOD has been set forward. 124 */ 125 126 ticks = snapshot - seconds_last_time; 127 _Watchdog_Adjust( &_Timer_Seconds_chain, WATCHDOG_FORWARD, ticks ); 128 129 } else if ( snapshot < seconds_last_time ) { 130 /* 131 * The current TOD is before the last TOD which indicates that 132 * TOD has been set backwards. 133 */ 134 135 ticks = seconds_last_time - snapshot; 136 _Watchdog_Adjust( &_Timer_Seconds_chain, WATCHDOG_BACKWARD, ticks ); 137 } 138 seconds_last_time = snapshot; 113 _Timer_Process_ticks_chain(); 114 _Timer_Process_seconds_chain(); 139 115 } 140 116 } … … 290 266 switch ( reset_mode ) { 291 267 case TIMER_SERVER_RESET_TICKS: 292 _Watchdog_Remove( &_Timer_Server->Timer ); 293 units = ((Watchdog_Control *)_Timer_Ticks_chain.first)->delta_interval; 294 _Watchdog_Insert_ticks( &_Timer_Server->Timer, units ); 268 _Watchdog_Remove( &_Timer_Server->Timer ); 269 _Timer_Process_ticks_chain(); 270 if ( !_Chain_Is_empty( &_Timer_Ticks_chain ) ) { 271 units = ((Watchdog_Control *)_Timer_Ticks_chain.first)->delta_interval; 272 _Watchdog_Insert_ticks( &_Timer_Server->Timer, units ); 273 } 295 274 break; 296 275 case TIMER_SERVER_RESET_SECONDS: 297 276 _Watchdog_Remove( &_Timer_Seconds_timer ); 298 units = ((Watchdog_Control *)_Timer_Seconds_chain.first)->delta_interval; 299 _Watchdog_Insert_seconds( &_Timer_Seconds_timer, units ); 277 _Timer_Process_seconds_chain(); 278 if ( !_Chain_Is_empty( &_Timer_Seconds_chain ) ) { 279 units = ((Watchdog_Control *)_Timer_Seconds_chain.first)->delta_interval; 280 _Watchdog_Insert_seconds( &_Timer_Seconds_timer, units ); 281 } 300 282 break; 301 283 } 302 284 } 303 285 286 /*PAGE 287 * 288 * _Timer_Server_Process_ticks_chain 289 * 290 * This routine is responsible for adjusting the list of task-based 291 * interval timers to reflect the passage of time. 292 * 293 * Input parameters: NONE 294 * 295 * Output parameters: NONE 296 */ 297 298 void _Timer_Process_ticks_chain(void) 299 { 300 Watchdog_Interval snapshot; 301 Watchdog_Interval ticks; 302 303 snapshot = _Watchdog_Ticks_since_boot; 304 if ( snapshot >= _Timer_Server_ticks_last_time ) 305 ticks = snapshot - _Timer_Server_ticks_last_time; 306 else 307 ticks = (0xFFFFFFFF - _Timer_Server_ticks_last_time) + snapshot; 308 309 _Timer_Server_ticks_last_time = snapshot; 310 _Watchdog_Adjust( &_Timer_Ticks_chain, WATCHDOG_FORWARD, ticks ); 311 } 312 313 /*PAGE 314 * 315 * _Timer_Server_Process_seconds_chain 316 * 317 * This routine is responsible for adjusting the list of task-based 318 * time of day timers to reflect the passage of time. 319 * 320 * Input parameters: NONE 321 * 322 * Output parameters: NONE 323 */ 324 325 void _Timer_Process_seconds_chain(void) 326 { 327 Watchdog_Interval snapshot; 328 Watchdog_Interval ticks; 329 330 /* 331 * Process the seconds chain. Start by checking that the Time 332 * of Day (TOD) has not been set backwards. If it has then 333 * we want to adjust the _Timer_Seconds_chain to indicate this. 334 */ 335 336 snapshot = _TOD_Seconds_since_epoch; 337 if ( snapshot > _Timer_Server_seconds_last_time ) { 338 /* 339 * This path is for normal forward movement and cases where the 340 * TOD has been set forward. 341 */ 342 343 ticks = snapshot - _Timer_Server_seconds_last_time; 344 _Watchdog_Adjust( &_Timer_Seconds_chain, WATCHDOG_FORWARD, ticks ); 345 346 } else if ( snapshot < _Timer_Server_seconds_last_time ) { 347 /* 348 * The current TOD is before the last TOD which indicates that 349 * TOD has been set backwards. 350 */ 351 352 ticks = _Timer_Server_seconds_last_time - snapshot; 353 _Watchdog_Adjust( &_Timer_Seconds_chain, WATCHDOG_BACKWARD, ticks ); 354 } 355 _Timer_Server_seconds_last_time = snapshot; 356 } 357
Note: See TracChangeset
for help on using the changeset viewer.