1 | /* |
---|
2 | * Time of Day (TOD) Handler -- Tickle Ticks |
---|
3 | */ |
---|
4 | |
---|
5 | /* COPYRIGHT (c) 1989-2007. |
---|
6 | * On-Line Applications Research Corporation (OAR). |
---|
7 | * |
---|
8 | * The license and distribution terms for this file may be |
---|
9 | * found in the file LICENSE in this distribution or at |
---|
10 | * http://www.rtems.com/license/LICENSE. |
---|
11 | * |
---|
12 | * $Id$ |
---|
13 | */ |
---|
14 | |
---|
15 | #if HAVE_CONFIG_H |
---|
16 | #include "config.h" |
---|
17 | #endif |
---|
18 | |
---|
19 | #include <rtems/system.h> |
---|
20 | #include <rtems/score/object.h> |
---|
21 | #include <rtems/score/thread.h> |
---|
22 | #include <rtems/score/timestamp.h> |
---|
23 | #include <rtems/score/tod.h> |
---|
24 | #include <rtems/score/watchdog.h> |
---|
25 | #include <rtems/config.h> |
---|
26 | |
---|
27 | /*PAGE |
---|
28 | * |
---|
29 | * _TOD_Tickle_ticks |
---|
30 | * |
---|
31 | * This routine processes a clock tick. |
---|
32 | * |
---|
33 | * Input parameters: NONE |
---|
34 | * |
---|
35 | * Output parameters: NONE |
---|
36 | */ |
---|
37 | |
---|
38 | void _TOD_Tickle_ticks( void ) |
---|
39 | { |
---|
40 | Timestamp_Control tick; |
---|
41 | uint32_t seconds; |
---|
42 | |
---|
43 | /* Convert the tick quantum to a timestamp */ |
---|
44 | _Timestamp_Set( &tick, 0, rtems_configuration_get_nanoseconds_per_tick() ); |
---|
45 | |
---|
46 | /* Update the counter of ticks since boot */ |
---|
47 | _Watchdog_Ticks_since_boot += 1; |
---|
48 | |
---|
49 | /* Update the timespec format uptime */ |
---|
50 | _Timestamp_Add_to( &_TOD_Uptime, &tick ); |
---|
51 | /* we do not care how much the uptime changed */ |
---|
52 | |
---|
53 | /* Update the timespec format TOD */ |
---|
54 | seconds = _Timestamp_Add_to_at_tick( &_TOD_Now, &tick ); |
---|
55 | while ( seconds ) { |
---|
56 | _Watchdog_Tickle_seconds(); |
---|
57 | seconds--; |
---|
58 | } |
---|
59 | } |
---|
60 | |
---|