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.org/license/LICENSE. |
---|
19 | -- |
---|
20 | |
---|
21 | with Ada; |
---|
22 | with Ada.Unchecked_Conversion; |
---|
23 | with Interfaces; use Interfaces; |
---|
24 | with Interfaces.C; use Interfaces.C; |
---|
25 | with Interfaces.C.Strings; use Interfaces.C.Strings; |
---|
26 | |
---|
27 | package body RTEMS.IO is |
---|
28 | |
---|
29 | -- |
---|
30 | -- Input/Output Manager |
---|
31 | -- |
---|
32 | |
---|
33 | procedure Register_Name |
---|
34 | (Name : in String; |
---|
35 | Major : in RTEMS.Device_Major_Number; |
---|
36 | Minor : in RTEMS.Device_Minor_Number; |
---|
37 | Result : out RTEMS.Status_Codes) |
---|
38 | is |
---|
39 | function Register_Name_Base |
---|
40 | (Name : Interfaces.C.char_array; |
---|
41 | Major : RTEMS.Device_Major_Number; |
---|
42 | Minor : RTEMS.Device_Minor_Number) |
---|
43 | return RTEMS.Status_Codes; |
---|
44 | pragma Import (C, Register_Name_Base, "rtems_io_register_name"); |
---|
45 | begin |
---|
46 | |
---|
47 | Result := Register_Name_Base (Interfaces.C.To_C (Name), Major, Minor); |
---|
48 | |
---|
49 | end Register_Name; |
---|
50 | |
---|
51 | procedure Lookup_Name |
---|
52 | (Name : in String; |
---|
53 | Device_Info : out RTEMS.Driver_Name_t; |
---|
54 | Result : out RTEMS.Status_Codes) |
---|
55 | is |
---|
56 | function Lookup_Name_Base |
---|
57 | (Name : Interfaces.C.char_array; |
---|
58 | Device_Info : access RTEMS.Driver_Name_t) |
---|
59 | return RTEMS.Status_Codes; |
---|
60 | pragma Import (C, Lookup_Name_Base, "rtems_io_lookup_name"); |
---|
61 | Device_Info_Base : aliased RTEMS.Driver_Name_t; |
---|
62 | begin |
---|
63 | |
---|
64 | Result := |
---|
65 | Lookup_Name_Base |
---|
66 | (Interfaces.C.To_C (Name), |
---|
67 | Device_Info_Base'Unchecked_Access); |
---|
68 | Device_Info := Device_Info_Base; |
---|
69 | |
---|
70 | end Lookup_Name; |
---|
71 | |
---|
72 | procedure Open |
---|
73 | (Major : in RTEMS.Device_Major_Number; |
---|
74 | Minor : in RTEMS.Device_Minor_Number; |
---|
75 | Argument : in RTEMS.Address; |
---|
76 | Result : out RTEMS.Status_Codes) |
---|
77 | is |
---|
78 | function Open_Base |
---|
79 | (Major : RTEMS.Device_Major_Number; |
---|
80 | Minor : RTEMS.Device_Minor_Number; |
---|
81 | Argument : RTEMS.Address) |
---|
82 | return RTEMS.Status_Codes; |
---|
83 | pragma Import (C, Open_Base, "rtems_io_open"); |
---|
84 | begin |
---|
85 | |
---|
86 | Result := Open_Base (Major, Minor, Argument); |
---|
87 | |
---|
88 | end Open; |
---|
89 | pragma Inline (Open); |
---|
90 | |
---|
91 | procedure Close |
---|
92 | (Major : in RTEMS.Device_Major_Number; |
---|
93 | Minor : in RTEMS.Device_Minor_Number; |
---|
94 | Argument : in RTEMS.Address; |
---|
95 | Result : out RTEMS.Status_Codes) |
---|
96 | is |
---|
97 | function Close_Base |
---|
98 | (Major : RTEMS.Device_Major_Number; |
---|
99 | Minor : RTEMS.Device_Minor_Number; |
---|
100 | Argument : RTEMS.Address) |
---|
101 | return RTEMS.Status_Codes; |
---|
102 | pragma Import (C, Close_Base, "rtems_io_close"); |
---|
103 | begin |
---|
104 | |
---|
105 | Result := Close_Base (Major, Minor, Argument); |
---|
106 | |
---|
107 | end Close; |
---|
108 | pragma Inline (Close); |
---|
109 | |
---|
110 | procedure Read |
---|
111 | (Major : in RTEMS.Device_Major_Number; |
---|
112 | Minor : in RTEMS.Device_Minor_Number; |
---|
113 | Argument : in RTEMS.Address; |
---|
114 | Result : out RTEMS.Status_Codes) |
---|
115 | is |
---|
116 | function Read_Base |
---|
117 | (Major : RTEMS.Device_Major_Number; |
---|
118 | Minor : RTEMS.Device_Minor_Number; |
---|
119 | Argument : RTEMS.Address) |
---|
120 | return RTEMS.Status_Codes; |
---|
121 | pragma Import (C, Read_Base, "rtems_io_read"); |
---|
122 | begin |
---|
123 | |
---|
124 | Result := Read_Base (Major, Minor, Argument); |
---|
125 | |
---|
126 | end Read; |
---|
127 | pragma Inline (Read); |
---|
128 | |
---|
129 | procedure Write |
---|
130 | (Major : in RTEMS.Device_Major_Number; |
---|
131 | Minor : in RTEMS.Device_Minor_Number; |
---|
132 | Argument : in RTEMS.Address; |
---|
133 | Result : out RTEMS.Status_Codes) |
---|
134 | is |
---|
135 | function Write_Base |
---|
136 | (Major : RTEMS.Device_Major_Number; |
---|
137 | Minor : RTEMS.Device_Minor_Number; |
---|
138 | Argument : RTEMS.Address) |
---|
139 | return RTEMS.Status_Codes; |
---|
140 | pragma Import (C, Write_Base, "rtems_io_write"); |
---|
141 | begin |
---|
142 | |
---|
143 | Result := Write_Base (Major, Minor, Argument); |
---|
144 | |
---|
145 | end Write; |
---|
146 | pragma Inline (Write); |
---|
147 | |
---|
148 | procedure Control |
---|
149 | (Major : in RTEMS.Device_Major_Number; |
---|
150 | Minor : in RTEMS.Device_Minor_Number; |
---|
151 | Argument : in RTEMS.Address; |
---|
152 | Result : out RTEMS.Status_Codes) |
---|
153 | is |
---|
154 | function Control_Base |
---|
155 | (Major : RTEMS.Device_Major_Number; |
---|
156 | Minor : RTEMS.Device_Minor_Number; |
---|
157 | Argument : RTEMS.Address) |
---|
158 | return RTEMS.Status_Codes; |
---|
159 | pragma Import (C, Control_Base, "rtems_io_control"); |
---|
160 | begin |
---|
161 | |
---|
162 | Result := Control_Base (Major, Minor, Argument); |
---|
163 | |
---|
164 | end Control; |
---|
165 | pragma Inline (Control); |
---|
166 | |
---|
167 | end RTEMS.IO; |
---|