4.104.114.84.95
Line | |
---|
1 | /* |
---|
2 | * Clock Manager |
---|
3 | * |
---|
4 | * COPYRIGHT (c) 1989-1999. |
---|
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/rtems/status.h> |
---|
20 | #include <rtems/rtems/clock.h> |
---|
21 | #include <rtems/score/isr.h> |
---|
22 | #include <rtems/score/thread.h> |
---|
23 | #include <rtems/score/tod.h> |
---|
24 | #include <rtems/score/watchdog.h> |
---|
25 | |
---|
26 | /*PAGE |
---|
27 | * |
---|
28 | * rtems_clock_set |
---|
29 | * |
---|
30 | * This directive sets the date and time for this node. |
---|
31 | * |
---|
32 | * Input parameters: |
---|
33 | * time_buffer - pointer to the time and date structure |
---|
34 | * |
---|
35 | * Output parameters: |
---|
36 | * RTEMS_SUCCESSFUL - if successful |
---|
37 | * error code - if unsuccessful |
---|
38 | */ |
---|
39 | |
---|
40 | rtems_status_code rtems_clock_set( |
---|
41 | rtems_time_of_day *time_buffer |
---|
42 | ) |
---|
43 | { |
---|
44 | rtems_interval seconds; |
---|
45 | |
---|
46 | if ( !time_buffer ) |
---|
47 | return RTEMS_INVALID_ADDRESS; |
---|
48 | |
---|
49 | if ( _TOD_Validate( time_buffer ) ) { |
---|
50 | seconds = _TOD_To_seconds( time_buffer ); |
---|
51 | _Thread_Disable_dispatch(); |
---|
52 | _TOD_Set( time_buffer, seconds ); |
---|
53 | _Thread_Enable_dispatch(); |
---|
54 | return RTEMS_SUCCESSFUL; |
---|
55 | } |
---|
56 | return RTEMS_INVALID_CLOCK; |
---|
57 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.