1 | /* dpmem.h |
---|
2 | * |
---|
3 | * This include file contains all the constants and structures associated |
---|
4 | * with the Dual Ported Memory Manager. This manager provides a mechanism |
---|
5 | * for converting addresses between internal and external representations |
---|
6 | * for multiple dual-ported memory areas. |
---|
7 | * |
---|
8 | * Directives provided are: |
---|
9 | * |
---|
10 | * + create a port |
---|
11 | * + get ID of a port |
---|
12 | * + delete a port |
---|
13 | * + convert external to internal address |
---|
14 | * + convert internal to external address |
---|
15 | * |
---|
16 | * |
---|
17 | * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. |
---|
18 | * On-Line Applications Research Corporation (OAR). |
---|
19 | * All rights assigned to U.S. Government, 1994. |
---|
20 | * |
---|
21 | * This material may be reproduced by or for the U.S. Government pursuant |
---|
22 | * to the copyright license under the clause at DFARS 252.227-7013. This |
---|
23 | * notice must appear in all copies of this file and its derivatives. |
---|
24 | * |
---|
25 | * $Id$ |
---|
26 | */ |
---|
27 | |
---|
28 | #ifndef __RTEMS_DUAL_PORTED_MEMORY_h |
---|
29 | #define __RTEMS_DUAL_PORTED_MEMORY_h |
---|
30 | |
---|
31 | #ifdef __cplusplus |
---|
32 | extern "C" { |
---|
33 | #endif |
---|
34 | |
---|
35 | #include <rtems/score/object.h> |
---|
36 | |
---|
37 | /* |
---|
38 | * The following structure defines the port control block. Each port |
---|
39 | * has a control block associated with it. This control block contains |
---|
40 | * all information required to support the port related operations. |
---|
41 | */ |
---|
42 | |
---|
43 | typedef struct { |
---|
44 | Objects_Control Object; |
---|
45 | void *internal_base; /* base internal address */ |
---|
46 | void *external_base; /* base external address */ |
---|
47 | unsigned32 length; /* length of dual-ported area */ |
---|
48 | } Dual_ported_memory_Control; |
---|
49 | |
---|
50 | /* |
---|
51 | * The following define the internal Dual Ported Memory information. |
---|
52 | */ |
---|
53 | |
---|
54 | EXTERN Objects_Information _Dual_ported_memory_Information; |
---|
55 | |
---|
56 | /* |
---|
57 | * _Dual_ported_memory_Manager_initialization |
---|
58 | * |
---|
59 | * DESCRIPTION: |
---|
60 | * |
---|
61 | * This routine performs the initialization necessary for this manager. |
---|
62 | */ |
---|
63 | |
---|
64 | void _Dual_ported_memory_Manager_initialization( |
---|
65 | unsigned32 maximum_ports |
---|
66 | ); |
---|
67 | |
---|
68 | /* |
---|
69 | * rtems_port_create |
---|
70 | * |
---|
71 | * DESCRIPTION: |
---|
72 | * |
---|
73 | * This routine implements the rtems_port_create directive. The port |
---|
74 | * will have the name name. The port maps onto an area of dual ported |
---|
75 | * memory of length bytes which has internal_start and external_start |
---|
76 | * as the internal and external starting addresses, respectively. |
---|
77 | * It returns the id of the created port in ID. |
---|
78 | */ |
---|
79 | |
---|
80 | rtems_status_code rtems_port_create( |
---|
81 | rtems_name name, |
---|
82 | void *internal_start, |
---|
83 | void *external_start, |
---|
84 | unsigned32 length, |
---|
85 | Objects_Id *id |
---|
86 | ); |
---|
87 | |
---|
88 | /* |
---|
89 | * rtems_port_ident |
---|
90 | * |
---|
91 | * DESCRIPTION: |
---|
92 | * |
---|
93 | * This routine implements the rtems_port_ident directive. This directive |
---|
94 | * returns the port ID associated with name. If more than one port is |
---|
95 | * named name, then the port to which the ID belongs is arbitrary. |
---|
96 | */ |
---|
97 | |
---|
98 | rtems_status_code rtems_port_ident( |
---|
99 | rtems_name name, |
---|
100 | Objects_Id *id |
---|
101 | ); |
---|
102 | |
---|
103 | /* |
---|
104 | * rtems_port_delete |
---|
105 | * |
---|
106 | * DESCRIPTION: |
---|
107 | * |
---|
108 | * This routine implements the rtems_port_delete directive. It deletes |
---|
109 | * the port associated with ID. |
---|
110 | */ |
---|
111 | |
---|
112 | rtems_status_code rtems_port_delete( |
---|
113 | Objects_Id id |
---|
114 | ); |
---|
115 | |
---|
116 | /* |
---|
117 | * rtems_port_external_to_internal |
---|
118 | * |
---|
119 | * DESCRIPTION: |
---|
120 | * |
---|
121 | * This routine implements the rtems_port_external_to_internal directive. |
---|
122 | * It returns the internal port address which maps to the provided |
---|
123 | * external port address for the specified port ID. |
---|
124 | */ |
---|
125 | |
---|
126 | rtems_status_code rtems_port_external_to_internal( |
---|
127 | Objects_Id id, |
---|
128 | void *external, |
---|
129 | void **internal |
---|
130 | ); |
---|
131 | |
---|
132 | /* |
---|
133 | * rtems_port_internal_to_external |
---|
134 | * |
---|
135 | * DESCRIPTION: |
---|
136 | * |
---|
137 | * This routine implements the Port_internal_to_external directive. |
---|
138 | * It returns the external port address which maps to the provided |
---|
139 | * internal port address for the specified port ID. |
---|
140 | */ |
---|
141 | |
---|
142 | rtems_status_code rtems_port_internal_to_external( |
---|
143 | Objects_Id id, |
---|
144 | void *internal, |
---|
145 | void **external |
---|
146 | ); |
---|
147 | |
---|
148 | /* |
---|
149 | * _Dual_ported_memory_Allocate |
---|
150 | * |
---|
151 | * DESCRIPTION: |
---|
152 | * |
---|
153 | * This routine allocates a port control block from the inactive chain |
---|
154 | * of free port control blocks. |
---|
155 | */ |
---|
156 | |
---|
157 | STATIC INLINE Dual_ported_memory_Control |
---|
158 | *_Dual_ported_memory_Allocate ( void ); |
---|
159 | |
---|
160 | /* |
---|
161 | * _Dual_ported_memory_Free |
---|
162 | * |
---|
163 | * DESCRIPTION: |
---|
164 | * |
---|
165 | * This routine frees a port control block to the inactive chain |
---|
166 | * of free port control blocks. |
---|
167 | */ |
---|
168 | |
---|
169 | STATIC INLINE void _Dual_ported_memory_Free ( |
---|
170 | Dual_ported_memory_Control *the_port |
---|
171 | ); |
---|
172 | |
---|
173 | /* |
---|
174 | * _Dual_ported_memory_Get |
---|
175 | * |
---|
176 | * DESCRIPTION: |
---|
177 | * |
---|
178 | * This function maps port IDs to port control blocks. If ID |
---|
179 | * corresponds to a local port, then it returns the_port control |
---|
180 | * pointer which maps to ID and location is set to OBJECTS_LOCAL. |
---|
181 | * Global ports are not supported, thus if ID does not map to a |
---|
182 | * local port, location is set to OBJECTS_ERROR and the_port is |
---|
183 | * undefined. |
---|
184 | */ |
---|
185 | |
---|
186 | STATIC INLINE Dual_ported_memory_Control *_Dual_ported_memory_Get ( |
---|
187 | Objects_Id id, |
---|
188 | Objects_Locations *location |
---|
189 | ); |
---|
190 | |
---|
191 | /* |
---|
192 | * _Dual_ported_memory_Is_null |
---|
193 | * |
---|
194 | * DESCRIPTION: |
---|
195 | * |
---|
196 | * This function returns TRUE if the_port is NULL and FALSE otherwise. |
---|
197 | */ |
---|
198 | |
---|
199 | STATIC INLINE boolean _Dual_ported_memory_Is_null( |
---|
200 | Dual_ported_memory_Control *the_port |
---|
201 | ); |
---|
202 | |
---|
203 | #include <rtems/rtems/dpmem.inl> |
---|
204 | |
---|
205 | #ifdef __cplusplus |
---|
206 | } |
---|
207 | #endif |
---|
208 | |
---|
209 | #endif |
---|
210 | /* end of include file */ |
---|