1 | /** |
---|
2 | * @file rtems/rtems/dpmem.h |
---|
3 | * |
---|
4 | * This include file contains all the constants and structures associated |
---|
5 | * with the Dual Ported Memory Manager. This manager provides a mechanism |
---|
6 | * for converting addresses between internal and external representations |
---|
7 | * for multiple dual-ported memory areas. |
---|
8 | * |
---|
9 | * Directives provided are: |
---|
10 | * |
---|
11 | * - create a port |
---|
12 | * - get ID of a port |
---|
13 | * - delete a port |
---|
14 | * - convert external to internal address |
---|
15 | * - convert internal to external address |
---|
16 | * |
---|
17 | */ |
---|
18 | |
---|
19 | /* COPYRIGHT (c) 1989-2008. |
---|
20 | * On-Line Applications Research Corporation (OAR). |
---|
21 | * |
---|
22 | * The license and distribution terms for this file may be |
---|
23 | * found in the file LICENSE in this distribution or at |
---|
24 | * http://www.rtems.com/license/LICENSE. |
---|
25 | */ |
---|
26 | |
---|
27 | #ifndef _RTEMS_RTEMS_DPMEM_H |
---|
28 | #define _RTEMS_RTEMS_DPMEM_H |
---|
29 | |
---|
30 | /** |
---|
31 | * This constant is defined to extern most of the time when using |
---|
32 | * this header file. However by defining it to nothing, the data |
---|
33 | * declared in this header file can be instantiated. This is done |
---|
34 | * in a single per manager file. |
---|
35 | */ |
---|
36 | #ifndef RTEMS_DPMEM_EXTERN |
---|
37 | #define RTEMS_DPMEM_EXTERN extern |
---|
38 | #endif |
---|
39 | |
---|
40 | #ifdef __cplusplus |
---|
41 | extern "C" { |
---|
42 | #endif |
---|
43 | |
---|
44 | #include <rtems/score/object.h> |
---|
45 | #include <rtems/rtems/support.h> |
---|
46 | #include <rtems/rtems/status.h> |
---|
47 | |
---|
48 | /** |
---|
49 | * @defgroup ClassicDPMEM Dual Ported Memory |
---|
50 | * |
---|
51 | * @ingroup ClassicRTEMS |
---|
52 | * |
---|
53 | * This encapsulates functionality related to the |
---|
54 | * Classic API Dual Ported Memory Manager. |
---|
55 | */ |
---|
56 | /**@{*/ |
---|
57 | |
---|
58 | /** |
---|
59 | * The following structure defines the port control block. Each port |
---|
60 | * has a control block associated with it. This control block contains |
---|
61 | * all information required to support the port related operations. |
---|
62 | */ |
---|
63 | typedef struct { |
---|
64 | /** This field is the object management portion of a Port instance. */ |
---|
65 | Objects_Control Object; |
---|
66 | /** This field is the base internal address of the port. */ |
---|
67 | void *internal_base; |
---|
68 | /** This field is the base external address of the port. */ |
---|
69 | void *external_base; |
---|
70 | /** This field is the length of dual-ported area of the port. */ |
---|
71 | uint32_t length; |
---|
72 | } Dual_ported_memory_Control; |
---|
73 | |
---|
74 | /** |
---|
75 | * The following define the internal Dual Ported Memory information. |
---|
76 | */ |
---|
77 | RTEMS_DPMEM_EXTERN Objects_Information _Dual_ported_memory_Information; |
---|
78 | |
---|
79 | /** |
---|
80 | * @brief Dual Ported Memory Manager Initialization |
---|
81 | * |
---|
82 | * This routine performs the initialization necessary for this manager. |
---|
83 | */ |
---|
84 | void _Dual_ported_memory_Manager_initialization(void); |
---|
85 | |
---|
86 | /** |
---|
87 | * @brief rtems_port_create |
---|
88 | * |
---|
89 | * This routine implements the rtems_port_create directive. The port |
---|
90 | * will have the name name. The port maps onto an area of dual ported |
---|
91 | * memory of length bytes which has internal_start and external_start |
---|
92 | * as the internal and external starting addresses, respectively. |
---|
93 | * It returns the id of the created port in ID. |
---|
94 | */ |
---|
95 | rtems_status_code rtems_port_create( |
---|
96 | rtems_name name, |
---|
97 | void *internal_start, |
---|
98 | void *external_start, |
---|
99 | uint32_t length, |
---|
100 | rtems_id *id |
---|
101 | ); |
---|
102 | |
---|
103 | /** |
---|
104 | * @brief RTEMS Port Name to Id |
---|
105 | * |
---|
106 | * This routine implements the rtems_port_ident directive. This directive |
---|
107 | * returns the port ID associated with name. If more than one port is |
---|
108 | * named name, then the port to which the ID belongs is arbitrary. |
---|
109 | * |
---|
110 | * @param[in] name is the user defined port name |
---|
111 | * @param[out] id is the pointer to port id |
---|
112 | * |
---|
113 | * @return RTEMS_SUCCESSFUL if successful or error code if unsuccessful |
---|
114 | */ |
---|
115 | rtems_status_code rtems_port_ident( |
---|
116 | rtems_name name, |
---|
117 | rtems_id *id |
---|
118 | ); |
---|
119 | |
---|
120 | /** |
---|
121 | * @brief rtems_port_delete |
---|
122 | * |
---|
123 | * This routine implements the rtems_port_delete directive. It deletes |
---|
124 | * the port associated with ID. |
---|
125 | */ |
---|
126 | rtems_status_code rtems_port_delete( |
---|
127 | rtems_id id |
---|
128 | ); |
---|
129 | |
---|
130 | /** |
---|
131 | * @brief RTEMS Port External to Internal |
---|
132 | * |
---|
133 | * This routine implements the rtems_port_external_to_internal directive. |
---|
134 | * It returns the internal port address which maps to the provided |
---|
135 | * external port address for the specified port ID.If the given external |
---|
136 | * address is an invalid dual-ported address, then the internal address is |
---|
137 | * set to the given external address. |
---|
138 | * |
---|
139 | * @param[in] id is the id of dp memory object |
---|
140 | * @param[in] external is the external address |
---|
141 | * @param[out] internal is the pointer of internal address to set |
---|
142 | * |
---|
143 | * @return RTEMS_SUCCESSFUL |
---|
144 | */ |
---|
145 | rtems_status_code rtems_port_external_to_internal( |
---|
146 | rtems_id id, |
---|
147 | void *external, |
---|
148 | void **internal |
---|
149 | ); |
---|
150 | |
---|
151 | /** |
---|
152 | * @brief rtems_port_internal_to_external |
---|
153 | * |
---|
154 | * This routine implements the Port_internal_to_external directive. |
---|
155 | * It returns the external port address which maps to the provided |
---|
156 | * internal port address for the specified port ID. |
---|
157 | */ |
---|
158 | rtems_status_code rtems_port_internal_to_external( |
---|
159 | rtems_id id, |
---|
160 | void *internal, |
---|
161 | void **external |
---|
162 | ); |
---|
163 | |
---|
164 | #ifndef __RTEMS_APPLICATION__ |
---|
165 | #include <rtems/rtems/dpmem.inl> |
---|
166 | #endif |
---|
167 | |
---|
168 | #ifdef __cplusplus |
---|
169 | } |
---|
170 | #endif |
---|
171 | |
---|
172 | /**@}*/ |
---|
173 | |
---|
174 | #endif |
---|
175 | /* end of include file */ |
---|