1 | -- |
---|
2 | -- RTEMS / Body |
---|
3 | -- |
---|
4 | -- DESCRIPTION: |
---|
5 | -- |
---|
6 | -- This package provides the interface to the RTEMS API. |
---|
7 | -- |
---|
8 | -- |
---|
9 | -- DEPENDENCIES: |
---|
10 | -- |
---|
11 | -- |
---|
12 | -- |
---|
13 | -- COPYRIGHT (c) 1997-2011. |
---|
14 | -- On-Line Applications Research Corporation (OAR). |
---|
15 | -- |
---|
16 | -- The license and distribution terms for this file may in |
---|
17 | -- the file LICENSE in this distribution or at |
---|
18 | -- http://www.rtems.com/license/LICENSE. |
---|
19 | -- |
---|
20 | -- $Id$ |
---|
21 | -- |
---|
22 | |
---|
23 | package body RTEMS.Clock is |
---|
24 | |
---|
25 | -- |
---|
26 | -- Clock Manager |
---|
27 | -- |
---|
28 | |
---|
29 | procedure Set |
---|
30 | (Time_Buffer : in RTEMS.Time_Of_Day; |
---|
31 | Result : out RTEMS.Status_Codes) |
---|
32 | is |
---|
33 | function Set_Base |
---|
34 | (Time_Buffer : access RTEMS.Time_Of_Day) |
---|
35 | return RTEMS.Status_Codes; |
---|
36 | pragma Import (C, Set_Base, "rtems_clock_set"); |
---|
37 | |
---|
38 | Tmp_Time : aliased RTEMS.Time_Of_Day; |
---|
39 | begin |
---|
40 | |
---|
41 | Tmp_Time := Time_Buffer; |
---|
42 | Result := Set_Base (Tmp_Time'Access); |
---|
43 | |
---|
44 | end Set; |
---|
45 | |
---|
46 | procedure Get |
---|
47 | (Option : in RTEMS.Clock.Get_Options; |
---|
48 | Time_Buffer : in RTEMS.Address; |
---|
49 | Result : out RTEMS.Status_Codes) |
---|
50 | is |
---|
51 | function Get_Base |
---|
52 | (Option : RTEMS.Clock.Get_Options; |
---|
53 | Time_Buffer : RTEMS.Address) |
---|
54 | return RTEMS.Status_Codes; |
---|
55 | pragma Import (C, Get_Base, "rtems_clock_get"); |
---|
56 | begin |
---|
57 | |
---|
58 | Result := Get_Base (Option, Time_Buffer); |
---|
59 | |
---|
60 | end Get; |
---|
61 | |
---|
62 | procedure Get_TOD |
---|
63 | (Time : out RTEMS.Time_Of_Day; |
---|
64 | Result : out RTEMS.Status_Codes) |
---|
65 | is |
---|
66 | function Get_TOD_Base |
---|
67 | (Time : access RTEMS.Time_Of_Day) |
---|
68 | return RTEMS.Status_Codes; |
---|
69 | pragma Import (C, Get_TOD_Base, "rtems_clock_get_tod"); |
---|
70 | |
---|
71 | Tmp_Time : aliased RTEMS.Time_Of_Day; |
---|
72 | begin |
---|
73 | Result := Get_TOD_Base (Tmp_Time'Access); |
---|
74 | Time := Tmp_Time; |
---|
75 | end Get_TOD; |
---|
76 | |
---|
77 | procedure Get_TOD_Time_Value |
---|
78 | (Time : out RTEMS.Time_Value; |
---|
79 | Result : out RTEMS.Status_Codes) |
---|
80 | is |
---|
81 | function Get_TOD_Time_Value_Base |
---|
82 | (Time : access RTEMS.Time_Value) |
---|
83 | return RTEMS.Status_Codes; |
---|
84 | pragma Import |
---|
85 | (C, |
---|
86 | Get_TOD_Time_Value_Base, |
---|
87 | "rtems_clock_get_tod_timeval"); |
---|
88 | |
---|
89 | Tmp_Time : aliased RTEMS.Time_Value; |
---|
90 | begin |
---|
91 | Result := Get_TOD_Time_Value_Base (Tmp_Time'Access); |
---|
92 | Time := Tmp_Time; |
---|
93 | end Get_TOD_Time_Value; |
---|
94 | |
---|
95 | procedure Get_Seconds_Since_Epoch |
---|
96 | (The_Interval : out RTEMS.Interval; |
---|
97 | Result : out RTEMS.Status_Codes) |
---|
98 | is |
---|
99 | function Get_Seconds_Since_Epoch_Base |
---|
100 | (The_Interval : access RTEMS.Interval) |
---|
101 | return RTEMS.Status_Codes; |
---|
102 | pragma Import |
---|
103 | (C, |
---|
104 | Get_Seconds_Since_Epoch_Base, |
---|
105 | "rtems_clock_get_seconds_since_epoch"); |
---|
106 | |
---|
107 | Tmp_Interval : aliased RTEMS.Interval; |
---|
108 | begin |
---|
109 | Result := |
---|
110 | Get_Seconds_Since_Epoch_Base (Tmp_Interval'Access); |
---|
111 | The_Interval := Tmp_Interval; |
---|
112 | end Get_Seconds_Since_Epoch; |
---|
113 | |
---|
114 | -- Get_Ticks_Per_Second is in rtems.ads |
---|
115 | |
---|
116 | -- Get_Ticks_Since_Boot is in rtems.ads |
---|
117 | |
---|
118 | procedure Get_Uptime |
---|
119 | (Uptime : out RTEMS.Timespec; |
---|
120 | Result : out RTEMS.Status_Codes) |
---|
121 | is |
---|
122 | function Get_Uptime_Base |
---|
123 | (Uptime : access RTEMS.Timespec) |
---|
124 | return RTEMS.Status_Codes; |
---|
125 | pragma Import (C, Get_Uptime_Base, "rtems_clock_get_uptime"); |
---|
126 | Uptime_Base : aliased RTEMS.Timespec; |
---|
127 | begin |
---|
128 | |
---|
129 | Result := Get_Uptime_Base (Uptime_Base'Access); |
---|
130 | Uptime := Uptime_Base; |
---|
131 | |
---|
132 | end Get_Uptime; |
---|
133 | |
---|
134 | procedure Tick (Result : out RTEMS.Status_Codes) is |
---|
135 | function Tick_Base return RTEMS.Status_Codes; |
---|
136 | pragma Import (C, Tick_Base, "rtems_clock_tick"); |
---|
137 | begin |
---|
138 | |
---|
139 | Result := Tick_Base; |
---|
140 | |
---|
141 | end Tick; |
---|
142 | |
---|
143 | end RTEMS.Clock; |
---|