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-2008. |
---|
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.org/license/LICENSE. |
---|
19 | -- |
---|
20 | |
---|
21 | package body RTEMS.Timer is |
---|
22 | |
---|
23 | -- |
---|
24 | -- Timer Manager |
---|
25 | -- |
---|
26 | |
---|
27 | procedure Create |
---|
28 | (Name : in RTEMS.Name; |
---|
29 | ID : out RTEMS.ID; |
---|
30 | Result : out RTEMS.Status_Codes) |
---|
31 | is |
---|
32 | function Create_Base |
---|
33 | (Name : RTEMS.Name; |
---|
34 | ID : access RTEMS.ID) |
---|
35 | return RTEMS.Status_Codes; |
---|
36 | pragma Import (C, Create_Base, "rtems_timer_create"); |
---|
37 | ID_Base : aliased RTEMS.ID; |
---|
38 | begin |
---|
39 | |
---|
40 | Result := Create_Base (Name, ID_Base'Access); |
---|
41 | ID := ID_Base; |
---|
42 | |
---|
43 | end Create; |
---|
44 | |
---|
45 | procedure Ident |
---|
46 | (Name : in RTEMS.Name; |
---|
47 | ID : out RTEMS.ID; |
---|
48 | Result : out RTEMS.Status_Codes) |
---|
49 | is |
---|
50 | function Ident_Base |
---|
51 | (Name : RTEMS.Name; |
---|
52 | ID : access RTEMS.ID) |
---|
53 | return RTEMS.Status_Codes; |
---|
54 | pragma Import (C, Ident_Base, "rtems_timer_ident"); |
---|
55 | ID_Base : aliased RTEMS.ID; |
---|
56 | begin |
---|
57 | |
---|
58 | Result := Ident_Base (Name, ID_Base'Access); |
---|
59 | ID := ID_Base; |
---|
60 | |
---|
61 | end Ident; |
---|
62 | |
---|
63 | procedure Delete |
---|
64 | (ID : in RTEMS.ID; |
---|
65 | Result : out RTEMS.Status_Codes) |
---|
66 | is |
---|
67 | function Delete_Base (ID : RTEMS.ID) return RTEMS.Status_Codes; |
---|
68 | pragma Import (C, Delete_Base, "rtems_timer_delete"); |
---|
69 | begin |
---|
70 | |
---|
71 | Result := Delete_Base (ID); |
---|
72 | |
---|
73 | end Delete; |
---|
74 | |
---|
75 | procedure Fire_After |
---|
76 | (ID : in RTEMS.ID; |
---|
77 | Ticks : in RTEMS.Interval; |
---|
78 | Routine : in RTEMS.Timer.Service_Routine; |
---|
79 | User_Data : in RTEMS.Address; |
---|
80 | Result : out RTEMS.Status_Codes) |
---|
81 | is |
---|
82 | function Fire_After_Base |
---|
83 | (ID : RTEMS.ID; |
---|
84 | Ticks : RTEMS.Interval; |
---|
85 | Routine : RTEMS.Timer.Service_Routine; |
---|
86 | User_Data : RTEMS.Address) |
---|
87 | return RTEMS.Status_Codes; |
---|
88 | pragma Import (C, Fire_After_Base, "rtems_timer_fire_after"); |
---|
89 | begin |
---|
90 | |
---|
91 | Result := Fire_After_Base (ID, Ticks, Routine, User_Data); |
---|
92 | |
---|
93 | end Fire_After; |
---|
94 | |
---|
95 | procedure Server_Fire_After |
---|
96 | (ID : in RTEMS.ID; |
---|
97 | Ticks : in RTEMS.Interval; |
---|
98 | Routine : in RTEMS.Timer.Service_Routine; |
---|
99 | User_Data : in RTEMS.Address; |
---|
100 | Result : out RTEMS.Status_Codes) |
---|
101 | is |
---|
102 | function Server_Fire_After_Base |
---|
103 | (ID : RTEMS.ID; |
---|
104 | Ticks : RTEMS.Interval; |
---|
105 | Routine : RTEMS.Timer.Service_Routine; |
---|
106 | User_Data : RTEMS.Address) |
---|
107 | return RTEMS.Status_Codes; |
---|
108 | pragma Import |
---|
109 | (C, |
---|
110 | Server_Fire_After_Base, |
---|
111 | "rtems_timer_server_fire_after"); |
---|
112 | begin |
---|
113 | |
---|
114 | Result := Server_Fire_After_Base (ID, Ticks, Routine, User_Data); |
---|
115 | |
---|
116 | end Server_Fire_After; |
---|
117 | |
---|
118 | procedure Fire_When |
---|
119 | (ID : in RTEMS.ID; |
---|
120 | Wall_Time : in RTEMS.Time_Of_Day; |
---|
121 | Routine : in RTEMS.Timer.Service_Routine; |
---|
122 | User_Data : in RTEMS.Address; |
---|
123 | Result : out RTEMS.Status_Codes) |
---|
124 | is |
---|
125 | function Fire_When_Base |
---|
126 | (ID : RTEMS.ID; |
---|
127 | Wall_Time : RTEMS.Time_Of_Day; |
---|
128 | Routine : RTEMS.Timer.Service_Routine; |
---|
129 | User_Data : RTEMS.Address) |
---|
130 | return RTEMS.Status_Codes; |
---|
131 | pragma Import (C, Fire_When_Base, "rtems_timer_fire_when"); |
---|
132 | begin |
---|
133 | |
---|
134 | Result := Fire_When_Base (ID, Wall_Time, Routine, User_Data); |
---|
135 | |
---|
136 | end Fire_When; |
---|
137 | |
---|
138 | procedure Server_Fire_When |
---|
139 | (ID : in RTEMS.ID; |
---|
140 | Wall_Time : in RTEMS.Time_Of_Day; |
---|
141 | Routine : in RTEMS.Timer.Service_Routine; |
---|
142 | User_Data : in RTEMS.Address; |
---|
143 | Result : out RTEMS.Status_Codes) |
---|
144 | is |
---|
145 | function Server_Fire_When_Base |
---|
146 | (ID : RTEMS.ID; |
---|
147 | Wall_Time : RTEMS.Time_Of_Day; |
---|
148 | Routine : RTEMS.Timer.Service_Routine; |
---|
149 | User_Data : RTEMS.Address) |
---|
150 | return RTEMS.Status_Codes; |
---|
151 | pragma Import |
---|
152 | (C, |
---|
153 | Server_Fire_When_Base, |
---|
154 | "rtems_timer_server_fire_when"); |
---|
155 | begin |
---|
156 | |
---|
157 | Result := |
---|
158 | Server_Fire_When_Base (ID, Wall_Time, Routine, User_Data); |
---|
159 | end Server_Fire_When; |
---|
160 | |
---|
161 | procedure Reset |
---|
162 | (ID : in RTEMS.ID; |
---|
163 | Result : out RTEMS.Status_Codes) |
---|
164 | is |
---|
165 | function Reset_Base (ID : RTEMS.ID) return RTEMS.Status_Codes; |
---|
166 | pragma Import (C, Reset_Base, "rtems_timer_reset"); |
---|
167 | begin |
---|
168 | |
---|
169 | Result := Reset_Base (ID); |
---|
170 | |
---|
171 | end Reset; |
---|
172 | |
---|
173 | procedure Cancel |
---|
174 | (ID : in RTEMS.ID; |
---|
175 | Result : out RTEMS.Status_Codes) |
---|
176 | is |
---|
177 | function Cancel_Base (ID : RTEMS.ID) return RTEMS.Status_Codes; |
---|
178 | pragma Import (C, Cancel_Base, "rtems_timer_cancel"); |
---|
179 | begin |
---|
180 | |
---|
181 | Result := Cancel_Base (ID); |
---|
182 | |
---|
183 | end Cancel; |
---|
184 | |
---|
185 | procedure Initiate_Server |
---|
186 | (Server_Priority : in RTEMS.Tasks.Priority; |
---|
187 | Stack_Size : in RTEMS.Unsigned32; |
---|
188 | Attribute_Set : in RTEMS.Attribute; |
---|
189 | Result : out RTEMS.Status_Codes) |
---|
190 | is |
---|
191 | function Initiate_Server_Base |
---|
192 | (Server_Priority : RTEMS.Tasks.Priority; |
---|
193 | Stack_Size : RTEMS.Unsigned32; |
---|
194 | Attribute_Set : RTEMS.Attribute) |
---|
195 | return RTEMS.Status_Codes; |
---|
196 | pragma Import |
---|
197 | (C, |
---|
198 | Initiate_Server_Base, |
---|
199 | "rtems_timer_initiate_server"); |
---|
200 | begin |
---|
201 | Result := |
---|
202 | Initiate_Server_Base |
---|
203 | (Server_Priority, |
---|
204 | Stack_Size, |
---|
205 | Attribute_Set); |
---|
206 | end Initiate_Server; |
---|
207 | |
---|
208 | end RTEMS.Timer; |
---|