[1987020] | 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 |
---|
[c499856] | 18 | -- http://www.rtems.org/license/LICENSE. |
---|
[1987020] | 19 | -- |
---|
| 20 | |
---|
| 21 | package body RTEMS.Clock is |
---|
| 22 | |
---|
| 23 | -- |
---|
| 24 | -- Clock Manager |
---|
| 25 | -- |
---|
| 26 | |
---|
| 27 | procedure Set |
---|
| 28 | (Time_Buffer : in RTEMS.Time_Of_Day; |
---|
| 29 | Result : out RTEMS.Status_Codes) |
---|
| 30 | is |
---|
| 31 | function Set_Base |
---|
| 32 | (Time_Buffer : access RTEMS.Time_Of_Day) |
---|
| 33 | return RTEMS.Status_Codes; |
---|
| 34 | pragma Import (C, Set_Base, "rtems_clock_set"); |
---|
| 35 | |
---|
| 36 | Tmp_Time : aliased RTEMS.Time_Of_Day; |
---|
| 37 | begin |
---|
| 38 | |
---|
| 39 | Tmp_Time := Time_Buffer; |
---|
| 40 | Result := Set_Base (Tmp_Time'Access); |
---|
| 41 | |
---|
| 42 | end Set; |
---|
| 43 | |
---|
| 44 | procedure Get |
---|
| 45 | (Option : in RTEMS.Clock.Get_Options; |
---|
| 46 | Time_Buffer : in RTEMS.Address; |
---|
| 47 | Result : out RTEMS.Status_Codes) |
---|
| 48 | is |
---|
| 49 | function Get_Base |
---|
| 50 | (Option : RTEMS.Clock.Get_Options; |
---|
| 51 | Time_Buffer : RTEMS.Address) |
---|
| 52 | return RTEMS.Status_Codes; |
---|
| 53 | pragma Import (C, Get_Base, "rtems_clock_get"); |
---|
| 54 | begin |
---|
| 55 | |
---|
| 56 | Result := Get_Base (Option, Time_Buffer); |
---|
| 57 | |
---|
| 58 | end Get; |
---|
| 59 | |
---|
| 60 | procedure Get_TOD |
---|
| 61 | (Time : out RTEMS.Time_Of_Day; |
---|
| 62 | Result : out RTEMS.Status_Codes) |
---|
| 63 | is |
---|
| 64 | function Get_TOD_Base |
---|
| 65 | (Time : access RTEMS.Time_Of_Day) |
---|
| 66 | return RTEMS.Status_Codes; |
---|
| 67 | pragma Import (C, Get_TOD_Base, "rtems_clock_get_tod"); |
---|
| 68 | |
---|
| 69 | Tmp_Time : aliased RTEMS.Time_Of_Day; |
---|
| 70 | begin |
---|
| 71 | Result := Get_TOD_Base (Tmp_Time'Access); |
---|
| 72 | Time := Tmp_Time; |
---|
| 73 | end Get_TOD; |
---|
| 74 | |
---|
| 75 | procedure Get_TOD_Time_Value |
---|
| 76 | (Time : out RTEMS.Time_Value; |
---|
| 77 | Result : out RTEMS.Status_Codes) |
---|
| 78 | is |
---|
| 79 | function Get_TOD_Time_Value_Base |
---|
| 80 | (Time : access RTEMS.Time_Value) |
---|
| 81 | return RTEMS.Status_Codes; |
---|
| 82 | pragma Import |
---|
| 83 | (C, |
---|
| 84 | Get_TOD_Time_Value_Base, |
---|
| 85 | "rtems_clock_get_tod_timeval"); |
---|
| 86 | |
---|
| 87 | Tmp_Time : aliased RTEMS.Time_Value; |
---|
| 88 | begin |
---|
| 89 | Result := Get_TOD_Time_Value_Base (Tmp_Time'Access); |
---|
| 90 | Time := Tmp_Time; |
---|
| 91 | end Get_TOD_Time_Value; |
---|
| 92 | |
---|
| 93 | procedure Get_Seconds_Since_Epoch |
---|
| 94 | (The_Interval : out RTEMS.Interval; |
---|
| 95 | Result : out RTEMS.Status_Codes) |
---|
| 96 | is |
---|
| 97 | function Get_Seconds_Since_Epoch_Base |
---|
| 98 | (The_Interval : access RTEMS.Interval) |
---|
| 99 | return RTEMS.Status_Codes; |
---|
| 100 | pragma Import |
---|
| 101 | (C, |
---|
| 102 | Get_Seconds_Since_Epoch_Base, |
---|
| 103 | "rtems_clock_get_seconds_since_epoch"); |
---|
| 104 | |
---|
| 105 | Tmp_Interval : aliased RTEMS.Interval; |
---|
| 106 | begin |
---|
| 107 | Result := |
---|
| 108 | Get_Seconds_Since_Epoch_Base (Tmp_Interval'Access); |
---|
| 109 | The_Interval := Tmp_Interval; |
---|
| 110 | end Get_Seconds_Since_Epoch; |
---|
| 111 | |
---|
| 112 | -- Get_Ticks_Per_Second is in rtems.ads |
---|
| 113 | |
---|
| 114 | -- Get_Ticks_Since_Boot is in rtems.ads |
---|
| 115 | |
---|
| 116 | procedure Get_Uptime |
---|
| 117 | (Uptime : out RTEMS.Timespec; |
---|
| 118 | Result : out RTEMS.Status_Codes) |
---|
| 119 | is |
---|
| 120 | function Get_Uptime_Base |
---|
| 121 | (Uptime : access RTEMS.Timespec) |
---|
| 122 | return RTEMS.Status_Codes; |
---|
| 123 | pragma Import (C, Get_Uptime_Base, "rtems_clock_get_uptime"); |
---|
| 124 | Uptime_Base : aliased RTEMS.Timespec; |
---|
| 125 | begin |
---|
| 126 | |
---|
| 127 | Result := Get_Uptime_Base (Uptime_Base'Access); |
---|
| 128 | Uptime := Uptime_Base; |
---|
| 129 | |
---|
| 130 | end Get_Uptime; |
---|
| 131 | |
---|
| 132 | procedure Tick (Result : out RTEMS.Status_Codes) is |
---|
| 133 | function Tick_Base return RTEMS.Status_Codes; |
---|
| 134 | pragma Import (C, Tick_Base, "rtems_clock_tick"); |
---|
| 135 | begin |
---|
| 136 | |
---|
| 137 | Result := Tick_Base; |
---|
| 138 | |
---|
| 139 | end Tick; |
---|
| 140 | |
---|
| 141 | end RTEMS.Clock; |
---|