source: rtems-docs/c-user/dual_ports_memory_manager.rst @ 12dccfe

5
Last change on this file since 12dccfe was 12dccfe, checked in by Sebastian Huber <sebastian.huber@…>, on 01/09/19 at 15:14:05

Remove superfluous "All rights reserved."

  • Property mode set to 100644
File size: 9.1 KB
Line 
1.. comment SPDX-License-Identifier: CC-BY-SA-4.0
2
3.. Copyright (C) 1988, 2008 On-Line Applications Research Corporation (OAR)
4
5.. index:: ports
6.. index:: dual ported memory
7
8Dual-Ported Memory Manager
9**************************
10
11Introduction
12============
13
14The dual-ported memory manager provides a mechanism for converting addresses
15between internal and external representations for multiple dual-ported memory
16areas (DPMA).  The directives provided by the dual-ported memory manager are:
17
18- rtems_port_create_ - Create a port
19
20- rtems_port_ident_ - Get ID of a port
21
22- rtems_port_delete_ - Delete a port
23
24- rtems_port_external_to_internal_ - Convert external to internal address
25
26- rtems_port_internal_to_external_ - Convert internal to external address
27
28.. index:: dual ported memory, definition
29.. index:: external addresses, definition
30.. index:: internal addresses, definition
31
32Background
33==========
34
35A dual-ported memory area (DPMA) is an contiguous block of RAM owned by a
36particular processor but which can be accessed by other processors in the
37system.  The owner accesses the memory using internal addresses, while other
38processors must use external addresses.  RTEMS defines a port as a particular
39mapping of internal and external addresses.
40
41There are two system configurations in which dual-ported memory is commonly
42found.  The first is tightly-coupled multiprocessor computer systems where the
43dual-ported memory is shared between all nodes and is used for inter-node
44communication.  The second configuration is computer systems with intelligent
45peripheral controllers.  These controllers typically utilize the DPMA for
46high-performance data transfers.
47
48Operations
49==========
50
51Creating a Port
52---------------
53
54The ``rtems_port_create`` directive creates a port into a DPMA with the
55user-defined name.  The user specifies the association between internal and
56external representations for the port being created.  RTEMS allocates a
57Dual-Ported Memory Control Block (DPCB) from the DPCB free list to maintain the
58newly created DPMA.  RTEMS also generates a unique dual-ported memory port ID
59which is returned to the calling task.  RTEMS does not initialize the
60dual-ported memory area or access any memory within it.
61
62Obtaining Port IDs
63------------------
64
65When a port is created, RTEMS generates a unique port ID and assigns it to the
66created port until it is deleted.  The port ID may be obtained by either of two
67methods.  First, as the result of an invocation of the``rtems_port_create``
68directive, the task ID is stored in a user provided location.  Second, the port
69ID may be obtained later using the ``rtems_port_ident`` directive.  The port ID
70is used by other dual-ported memory manager directives to access this port.
71
72Converting an Address
73---------------------
74
75The ``rtems_port_external_to_internal`` directive is used to convert an address
76from external to internal representation for the specified port.  The
77``rtems_port_internal_to_external`` directive is used to convert an address
78from internal to external representation for the specified port.  If an attempt
79is made to convert an address which lies outside the specified DPMA, then the
80address to be converted will be returned.
81
82Deleting a DPMA Port
83--------------------
84
85A port can be removed from the system and returned to RTEMS with the
86``rtems_port_delete`` directive.  When a port is deleted, its control block is
87returned to the DPCB free list.
88
89Directives
90==========
91
92This section details the dual-ported memory manager's directives.  A subsection
93is dedicated to each of this manager's directives and describes the calling
94sequence, related constants, usage, and status codes.
95
96.. raw:: latex
97
98   \clearpage
99
100.. index:: create a port
101.. index:: rtems_port_create
102
103.. _rtems_port_create:
104
105PORT_CREATE - Create a port
106---------------------------
107
108CALLING SEQUENCE:
109    .. code-block:: c
110
111        rtems_status_code rtems_port_create(
112            rtems_name  name,
113            void       *internal_start,
114            void       *external_start,
115            uint32_t    length,
116            rtems_id   *id
117        );
118
119DIRECTIVE STATUS CODES:
120    .. list-table::
121     :class: rtems-table
122
123     * - ``RTEMS_SUCCESSFUL``
124       - port created successfully
125     * - ``RTEMS_INVALID_NAME``
126       - invalid port name
127     * - ``RTEMS_INVALID_ADDRESS``
128       - address not on four byte boundary
129     * - ``RTEMS_INVALID_ADDRESS``
130       - ``id`` is NULL
131     * - ``RTEMS_TOO_MANY``
132       - too many DP memory areas created
133
134DESCRIPTION:
135    This directive creates a port which resides on the local node for the
136    specified DPMA.  The assigned port id is returned in id.  This port id is
137    used as an argument to other dual-ported memory manager directives to
138    convert addresses within this DPMA.
139
140    For control and maintenance of the port, RTEMS allocates and initializes an
141    DPCB from the DPCB free pool.  Thus memory from the dual-ported memory area
142    is not used to store the DPCB.
143
144NOTES:
145    The internal_address and external_address parameters must be on a four byte
146    boundary.
147
148    This directive will not cause the calling task to be preempted.
149
150.. raw:: latex
151
152   \clearpage
153
154.. index:: get ID of a port
155.. index:: obtain ID of a port
156.. index:: rtems_port_ident
157
158.. _rtems_port_ident:
159
160PORT_IDENT - Get ID of a port
161-----------------------------
162
163CALLING SEQUENCE:
164    .. code-block:: c
165
166        rtems_status_code rtems_port_ident(
167            rtems_name  name,
168            rtems_id   *id
169        );
170
171DIRECTIVE STATUS CODES:
172    .. list-table::
173     :class: rtems-table
174
175     * - ``RTEMS_SUCCESSFUL``
176       - port identified successfully
177     * - ``RTEMS_INVALID_ADDRESS``
178       - ``id`` is NULL
179     * - ``RTEMS_INVALID_NAME``
180       - port name not found
181
182DESCRIPTION:
183    This directive obtains the port id associated with the specified name to be
184    acquired.  If the port name is not unique, then the port id will match one
185    of the DPMAs with that name.  However, this port id is not guaranteed to
186    correspond to the desired DPMA.  The port id is used to access this DPMA in
187    other dual-ported memory area related directives.
188
189NOTES:
190    This directive will not cause the running task to be preempted.
191
192.. raw:: latex
193
194   \clearpage
195
196.. index:: delete a port
197.. index:: rtems_port_delete
198
199.. _rtems_port_delete:
200
201PORT_DELETE - Delete a port
202---------------------------
203
204CALLING SEQUENCE:
205    .. code-block:: c
206
207        rtems_status_code rtems_port_delete(
208            rtems_id id
209        );
210
211DIRECTIVE STATUS CODES:
212    .. list-table::
213     :class: rtems-table
214
215     * - ``RTEMS_SUCCESSFUL``
216       - port deleted successfully
217     * - ``RTEMS_INVALID_ID``
218       - invalid port id
219
220DESCRIPTION:
221    This directive deletes the dual-ported memory area specified by id.  The
222    DPCB for the deleted dual-ported memory area is reclaimed by RTEMS.
223
224NOTES:
225    This directive will not cause the calling task to be preempted.
226
227    The calling task does not have to be the task that created the port.  Any
228    local task that knows the port id can delete the port.
229
230.. raw:: latex
231
232   \clearpage
233
234.. index:: convert external to internal address
235.. index:: rtems_port_external_to_internal
236
237.. _rtems_port_external_to_internal:
238
239PORT_EXTERNAL_TO_INTERNAL - Convert external to internal address
240----------------------------------------------------------------
241
242CALLING SEQUENCE:
243    .. code-block:: c
244
245        rtems_status_code rtems_port_external_to_internal(
246            rtems_id   id,
247            void      *external,
248            void     **internal
249        );
250
251DIRECTIVE STATUS CODES:
252    .. list-table::
253     :class: rtems-table
254
255     * - ``RTEMS_INVALID_ADDRESS``
256       - ``internal`` is NULL
257     * - ``RTEMS_SUCCESSFUL``
258       - successful conversion
259
260DESCRIPTION:
261    This directive converts a dual-ported memory address from external to
262    internal representation for the specified port.  If the given external
263    address is invalid for the specified port, then the internal address is set
264    to the given external address.
265
266NOTES:
267    This directive is callable from an ISR.
268
269    This directive will not cause the calling task to be preempted.
270
271.. raw:: latex
272
273   \clearpage
274
275.. index:: convert internal to external address
276.. index:: rtems_port_internal_to_external
277
278.. _rtems_port_internal_to_external:
279
280PORT_INTERNAL_TO_EXTERNAL - Convert internal to external address
281----------------------------------------------------------------
282
283CALLING SEQUENCE:
284    .. code-block:: c
285
286        rtems_status_code rtems_port_internal_to_external(
287            rtems_id   id,
288            void      *internal,
289            void     **external
290        );
291
292DIRECTIVE STATUS CODES:
293    .. list-table::
294     :class: rtems-table
295
296     * - ``RTEMS_INVALID_ADDRESS``
297       - ``external`` is NULL
298     * - ``RTEMS_SUCCESSFUL``
299       - successful conversion
300
301DESCRIPTION:
302    This directive converts a dual-ported memory address from internal to
303    external representation so that it can be passed to owner of the DPMA
304    represented by the specified port.  If the given internal address is an
305    invalid dual-ported address, then the external address is set to the given
306    internal address.
307
308NOTES:
309    This directive is callable from an ISR.
310
311    This directive will not cause the calling task to be preempted.
Note: See TracBrowser for help on using the repository browser.