4.115
Last change
on this file since 18657d1 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
|
Rev | Line | |
---|
[812da54] | 1 | /* |
---|
| 2 | * Time of Day (TOD) Handler - get TOD |
---|
| 3 | * |
---|
[6a614160] | 4 | * COPYRIGHT (c) 1989-2008. |
---|
[812da54] | 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> |
---|
[412dbff6] | 20 | #include <rtems/score/timespec.h> |
---|
[c16bcc0] | 21 | #include <rtems/score/timestamp.h> |
---|
[812da54] | 22 | #include <rtems/score/tod.h> |
---|
[6a614160] | 23 | #include <rtems/score/watchdog.h> |
---|
[812da54] | 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 | { |
---|
[c16bcc0] | 40 | ISR_Level level; |
---|
| 41 | Timestamp_Control offset; |
---|
| 42 | Timestamp_Control now; |
---|
| 43 | long nanoseconds; |
---|
[812da54] | 44 | |
---|
[c16bcc0] | 45 | /* assume time checked for NULL by caller */ |
---|
[812da54] | 46 | |
---|
[c16bcc0] | 47 | /* _TOD_Now is the native current time */ |
---|
[812da54] | 48 | _ISR_Disable( level ); |
---|
[c16bcc0] | 49 | now = _TOD_Now; |
---|
[18657d1] | 50 | nanoseconds = (*_Watchdog_Nanoseconds_since_tick_handler)(); |
---|
[812da54] | 51 | _ISR_Enable( level ); |
---|
| 52 | |
---|
[c16bcc0] | 53 | _Timestamp_Set( &offset, 0, nanoseconds ); |
---|
| 54 | _Timestamp_Add_to( &now, &offset ); |
---|
| 55 | _Timestamp_To_timespec( &now, time ); |
---|
[812da54] | 56 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.