1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup ClassicDPMEMImpl |
---|
5 | * |
---|
6 | * @brief Dual Ported Memory Manager Implementation |
---|
7 | */ |
---|
8 | |
---|
9 | /* COPYRIGHT (c) 1989-2008. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #ifndef _RTEMS_RTEMS_DPMEM_INL |
---|
18 | #define _RTEMS_RTEMS_DPMEM_INL |
---|
19 | |
---|
20 | #include <rtems/rtems/dpmem.h> |
---|
21 | #include <rtems/score/objectimpl.h> |
---|
22 | |
---|
23 | /** |
---|
24 | * @defgroup ClassicDPMEMImpl Dual Ported Memory Manager Implementation |
---|
25 | * |
---|
26 | * @ingroup ClassicDPMEM |
---|
27 | * |
---|
28 | * @{ |
---|
29 | */ |
---|
30 | |
---|
31 | /** |
---|
32 | * This constant is defined to extern most of the time when using |
---|
33 | * this header file. However by defining it to nothing, the data |
---|
34 | * declared in this header file can be instantiated. This is done |
---|
35 | * in a single per manager file. |
---|
36 | */ |
---|
37 | #ifndef RTEMS_DPMEM_EXTERN |
---|
38 | #define RTEMS_DPMEM_EXTERN extern |
---|
39 | #endif |
---|
40 | |
---|
41 | /** |
---|
42 | * @brief Define the internal Dual Ported Memory information |
---|
43 | * The following define the internal Dual Ported Memory information. |
---|
44 | */ |
---|
45 | RTEMS_DPMEM_EXTERN Objects_Information _Dual_ported_memory_Information; |
---|
46 | |
---|
47 | /** |
---|
48 | * @brief Dual Ported Memory Manager Initialization |
---|
49 | * |
---|
50 | * This routine performs the initialization necessary for this manager. |
---|
51 | */ |
---|
52 | void _Dual_ported_memory_Manager_initialization(void); |
---|
53 | |
---|
54 | /** |
---|
55 | * @brief Allocates a port control block from the inactive chain |
---|
56 | * of free port control blocks. |
---|
57 | * |
---|
58 | * This routine allocates a port control block from the inactive chain |
---|
59 | * of free port control blocks. |
---|
60 | */ |
---|
61 | RTEMS_INLINE_ROUTINE Dual_ported_memory_Control |
---|
62 | *_Dual_ported_memory_Allocate ( void ) |
---|
63 | { |
---|
64 | return (Dual_ported_memory_Control *) |
---|
65 | _Objects_Allocate( &_Dual_ported_memory_Information ); |
---|
66 | } |
---|
67 | |
---|
68 | /** |
---|
69 | * @brief Frees a port control block to the inactive chain |
---|
70 | * of free port control blocks. |
---|
71 | * |
---|
72 | * This routine frees a port control block to the inactive chain |
---|
73 | * of free port control blocks. |
---|
74 | */ |
---|
75 | RTEMS_INLINE_ROUTINE void _Dual_ported_memory_Free ( |
---|
76 | Dual_ported_memory_Control *the_port |
---|
77 | ) |
---|
78 | { |
---|
79 | _Objects_Free( &_Dual_ported_memory_Information, &the_port->Object ); |
---|
80 | } |
---|
81 | |
---|
82 | /** |
---|
83 | * @brief Maps port IDs to port control blocks. |
---|
84 | * |
---|
85 | * This function maps port IDs to port control blocks. If ID |
---|
86 | * corresponds to a local port, then it returns the_port control |
---|
87 | * pointer which maps to ID and location is set to OBJECTS_LOCAL. |
---|
88 | * Global ports are not supported, thus if ID does not map to a |
---|
89 | * local port, location is set to OBJECTS_ERROR and the_port is |
---|
90 | * undefined. |
---|
91 | */ |
---|
92 | RTEMS_INLINE_ROUTINE Dual_ported_memory_Control *_Dual_ported_memory_Get ( |
---|
93 | Objects_Id id, |
---|
94 | Objects_Locations *location |
---|
95 | ) |
---|
96 | { |
---|
97 | return (Dual_ported_memory_Control *) |
---|
98 | _Objects_Get( &_Dual_ported_memory_Information, id, location ); |
---|
99 | } |
---|
100 | |
---|
101 | /**@}*/ |
---|
102 | |
---|
103 | #ifdef __cplusplus |
---|
104 | } |
---|
105 | #endif |
---|
106 | |
---|
107 | #endif |
---|
108 | /* end of include file */ |
---|