Warning, /cpukit/include/adainclude/rtems-clock.adb is written in an unsupported language. File is not indexed.
0001 -- SPDX-License-Identifier: BSD-2-Clause
0002
0003 --
0004 -- RTEMS / Body
0005 --
0006 -- DESCRIPTION:
0007 --
0008 -- This package provides the interface to the RTEMS API.
0009 --
0010 --
0011 -- DEPENDENCIES:
0012 --
0013 --
0014 --
0015 -- COPYRIGHT (c) 1997-2011.
0016 -- On-Line Applications Research Corporation (OAR).
0017 --
0018 -- Redistribution and use in source and binary forms, with or without
0019 -- modification, are permitted provided that the following conditions
0020 -- are met:
0021 -- 1. Redistributions of source code must retain the above copyright
0022 -- notice, this list of conditions and the following disclaimer.
0023 -- 2. Redistributions in binary form must reproduce the above copyright
0024 -- notice, this list of conditions and the following disclaimer in the
0025 -- documentation and/or other materials provided with the distribution.
0026 --
0027 -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0028 -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0029 -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0030 -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0031 -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0032 -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0033 -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0034 -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0035 -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0036 -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0037 -- POSSIBILITY OF SUCH DAMAGE.
0038 --
0039
0040 package body RTEMS.Clock is
0041
0042 --
0043 -- Clock Manager
0044 --
0045
0046 procedure Set
0047 (Time_Buffer : in RTEMS.Time_Of_Day;
0048 Result : out RTEMS.Status_Codes)
0049 is
0050 function Set_Base
0051 (Time_Buffer : access RTEMS.Time_Of_Day)
0052 return RTEMS.Status_Codes;
0053 pragma Import (C, Set_Base, "rtems_clock_set");
0054
0055 Tmp_Time : aliased RTEMS.Time_Of_Day;
0056 begin
0057
0058 Tmp_Time := Time_Buffer;
0059 Result := Set_Base (Tmp_Time'Access);
0060
0061 end Set;
0062
0063 procedure Get_TOD
0064 (Time : out RTEMS.Time_Of_Day;
0065 Result : out RTEMS.Status_Codes)
0066 is
0067 function Get_TOD_Base
0068 (Time : access RTEMS.Time_Of_Day)
0069 return RTEMS.Status_Codes;
0070 pragma Import (C, Get_TOD_Base, "rtems_clock_get_tod");
0071
0072 Tmp_Time : aliased RTEMS.Time_Of_Day;
0073 begin
0074 Result := Get_TOD_Base (Tmp_Time'Access);
0075 Time := Tmp_Time;
0076 end Get_TOD;
0077
0078 procedure Get_TOD_Time_Value
0079 (Time : out RTEMS.Time_Value;
0080 Result : out RTEMS.Status_Codes)
0081 is
0082 function Get_TOD_Time_Value_Base
0083 (Time : access RTEMS.Time_Value)
0084 return RTEMS.Status_Codes;
0085 pragma Import
0086 (C,
0087 Get_TOD_Time_Value_Base,
0088 "rtems_clock_get_tod_timeval");
0089
0090 Tmp_Time : aliased RTEMS.Time_Value;
0091 begin
0092 Result := Get_TOD_Time_Value_Base (Tmp_Time'Access);
0093 Time := Tmp_Time;
0094 end Get_TOD_Time_Value;
0095
0096 procedure Get_Seconds_Since_Epoch
0097 (The_Interval : out RTEMS.Interval;
0098 Result : out RTEMS.Status_Codes)
0099 is
0100 function Get_Seconds_Since_Epoch_Base
0101 (The_Interval : access RTEMS.Interval)
0102 return RTEMS.Status_Codes;
0103 pragma Import
0104 (C,
0105 Get_Seconds_Since_Epoch_Base,
0106 "rtems_clock_get_seconds_since_epoch");
0107
0108 Tmp_Interval : aliased RTEMS.Interval;
0109 begin
0110 Result :=
0111 Get_Seconds_Since_Epoch_Base (Tmp_Interval'Access);
0112 The_Interval := Tmp_Interval;
0113 end Get_Seconds_Since_Epoch;
0114
0115 -- Get_Ticks_Per_Second is in rtems.ads
0116
0117 -- Get_Ticks_Since_Boot is in rtems.ads
0118
0119 procedure Get_Uptime
0120 (Uptime : out RTEMS.Timespec;
0121 Result : out RTEMS.Status_Codes)
0122 is
0123 function Get_Uptime_Base
0124 (Uptime : access RTEMS.Timespec)
0125 return RTEMS.Status_Codes;
0126 pragma Import (C, Get_Uptime_Base, "rtems_clock_get_uptime");
0127 Uptime_Base : aliased RTEMS.Timespec;
0128 begin
0129
0130 Result := Get_Uptime_Base (Uptime_Base'Access);
0131 Uptime := Uptime_Base;
0132
0133 end Get_Uptime;
0134
0135 procedure Tick (Result : out RTEMS.Status_Codes) is
0136 function Tick_Base return RTEMS.Status_Codes;
0137 pragma Import (C, Tick_Base, "rtems_clock_tick");
0138 begin
0139
0140 Result := Tick_Base;
0141
0142 end Tick;
0143
0144 function Get_Ticks_Since_Boot
0145 return RTEMS.Interval
0146 is
0147 Watchdog_Ticks_since_boot : RTEMS.Interval;
0148 pragma Import (
0149 C,
0150 Watchdog_Ticks_since_boot,
0151 "_Watchdog_Ticks_since_boot"
0152 );
0153 begin
0154
0155 return Watchdog_Ticks_since_boot;
0156
0157 end Get_Ticks_Since_Boot;
0158
0159 end RTEMS.Clock;