1 | /** |
---|
2 | * @file rtems/rtems/dpmem.inl |
---|
3 | * |
---|
4 | * This include file contains the inline routine used in conjunction |
---|
5 | * with the Dual Ported Memory Manager |
---|
6 | */ |
---|
7 | |
---|
8 | /* COPYRIGHT (c) 1989-2008. |
---|
9 | * On-Line Applications Research Corporation (OAR). |
---|
10 | * |
---|
11 | * The license and distribution terms for this file may be |
---|
12 | * found in the file LICENSE in this distribution or at |
---|
13 | * http://www.rtems.com/license/LICENSE. |
---|
14 | * |
---|
15 | * $Id$ |
---|
16 | */ |
---|
17 | |
---|
18 | #ifndef _RTEMS_RTEMS_DPMEM_H |
---|
19 | # error "Never use <rtems/rtems/dpmem.inl> directly; include <rtems/rtems/dpmem.h> instead." |
---|
20 | #endif |
---|
21 | |
---|
22 | #ifndef _RTEMS_RTEMS_DPMEM_INL |
---|
23 | #define _RTEMS_RTEMS_DPMEM_INL |
---|
24 | |
---|
25 | /** |
---|
26 | * @addtogroup ClassicDPMEM |
---|
27 | * @{ |
---|
28 | */ |
---|
29 | |
---|
30 | /** |
---|
31 | * @brief Dual_ported_memory_Allocate |
---|
32 | * |
---|
33 | * This routine allocates a port control block from the inactive chain |
---|
34 | * of free port control blocks. |
---|
35 | */ |
---|
36 | RTEMS_INLINE_ROUTINE Dual_ported_memory_Control |
---|
37 | *_Dual_ported_memory_Allocate ( void ) |
---|
38 | { |
---|
39 | return (Dual_ported_memory_Control *) |
---|
40 | _Objects_Allocate( &_Dual_ported_memory_Information ); |
---|
41 | } |
---|
42 | |
---|
43 | /** |
---|
44 | * @brief Dual_ported_memory_Free |
---|
45 | * |
---|
46 | * This routine frees a port control block to the inactive chain |
---|
47 | * of free port control blocks. |
---|
48 | */ |
---|
49 | RTEMS_INLINE_ROUTINE void _Dual_ported_memory_Free ( |
---|
50 | Dual_ported_memory_Control *the_port |
---|
51 | ) |
---|
52 | { |
---|
53 | _Objects_Free( &_Dual_ported_memory_Information, &the_port->Object ); |
---|
54 | } |
---|
55 | |
---|
56 | /** |
---|
57 | * @brief Dual_ported_memory_Get |
---|
58 | * |
---|
59 | * This function maps port IDs to port control blocks. If ID |
---|
60 | * corresponds to a local port, then it returns the_port control |
---|
61 | * pointer which maps to ID and location is set to OBJECTS_LOCAL. |
---|
62 | * Global ports are not supported, thus if ID does not map to a |
---|
63 | * local port, location is set to OBJECTS_ERROR and the_port is |
---|
64 | * undefined. |
---|
65 | */ |
---|
66 | RTEMS_INLINE_ROUTINE Dual_ported_memory_Control *_Dual_ported_memory_Get ( |
---|
67 | Objects_Id id, |
---|
68 | Objects_Locations *location |
---|
69 | ) |
---|
70 | { |
---|
71 | return (Dual_ported_memory_Control *) |
---|
72 | _Objects_Get( &_Dual_ported_memory_Information, id, location ); |
---|
73 | } |
---|
74 | |
---|
75 | /** |
---|
76 | * @brief Dual_ported_memory_Is_null |
---|
77 | * |
---|
78 | * This function returns true if the_port is NULL and false otherwise. |
---|
79 | */ |
---|
80 | RTEMS_INLINE_ROUTINE bool _Dual_ported_memory_Is_null( |
---|
81 | Dual_ported_memory_Control *the_port |
---|
82 | ) |
---|
83 | { |
---|
84 | return ( the_port == NULL ); |
---|
85 | } |
---|
86 | |
---|
87 | /**@}*/ |
---|
88 | |
---|
89 | #endif |
---|
90 | /* end of include file */ |
---|