4.115
Last change
on this file since fe7cc1ea was
18657d1,
checked in by Sebastian Huber <sebastian.huber@…>, on 12/16/10 at 14:50:12
|
2010-12-16 Sebastian Huber <sebastian.huber@…>
- score/src/watchdognanoseconds.c: New file.
- score/Makefile.am: Reflect change above.
- score/include/rtems/score/watchdog.h, score/src/coretodget.c,
score/src/coretodgetuptime.c: Do not allow NULL as nanoseconds since
last tick handler pointer.
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | /* |
---|
2 | * Time of Day (TOD) Handler - get TOD |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 1989-2008. |
---|
5 | * On-Line Applications Research Corporation (OAR). |
---|
6 | * |
---|
7 | * The license and distribution terms for this file may be |
---|
8 | * found in the file LICENSE in this distribution or at |
---|
9 | * http://www.rtems.com/license/LICENSE. |
---|
10 | * |
---|
11 | * $Id$ |
---|
12 | */ |
---|
13 | |
---|
14 | #if HAVE_CONFIG_H |
---|
15 | #include "config.h" |
---|
16 | #endif |
---|
17 | |
---|
18 | #include <rtems/system.h> |
---|
19 | #include <rtems/score/isr.h> |
---|
20 | #include <rtems/score/timespec.h> |
---|
21 | #include <rtems/score/timestamp.h> |
---|
22 | #include <rtems/score/tod.h> |
---|
23 | #include <rtems/score/watchdog.h> |
---|
24 | |
---|
25 | /* |
---|
26 | * _TOD_Get |
---|
27 | * |
---|
28 | * This routine is used to obtain the current date and time. |
---|
29 | * |
---|
30 | * Input parameters: |
---|
31 | * time - pointer to the time and date structure |
---|
32 | * |
---|
33 | * Output parameters: NONE |
---|
34 | */ |
---|
35 | |
---|
36 | void _TOD_Get( |
---|
37 | struct timespec *time |
---|
38 | ) |
---|
39 | { |
---|
40 | ISR_Level level; |
---|
41 | Timestamp_Control offset; |
---|
42 | Timestamp_Control now; |
---|
43 | long nanoseconds; |
---|
44 | |
---|
45 | /* assume time checked for NULL by caller */ |
---|
46 | |
---|
47 | /* _TOD_Now is the native current time */ |
---|
48 | _ISR_Disable( level ); |
---|
49 | now = _TOD_Now; |
---|
50 | nanoseconds = (*_Watchdog_Nanoseconds_since_tick_handler)(); |
---|
51 | _ISR_Enable( level ); |
---|
52 | |
---|
53 | _Timestamp_Set( &offset, 0, nanoseconds ); |
---|
54 | _Timestamp_Add_to( &now, &offset ); |
---|
55 | _Timestamp_To_timespec( &now, time ); |
---|
56 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.