1 | /* |
---|
2 | * The license and distribution terms for this file may be |
---|
3 | * found in the file LICENSE in this distribution or at |
---|
4 | * http://www.OARcorp.com/rtems/license.html. |
---|
5 | * |
---|
6 | * $Id$ |
---|
7 | */ |
---|
8 | |
---|
9 | #ifndef __ITRON_PORT_inl_ |
---|
10 | #define __ITRON_PORT_inl_ |
---|
11 | |
---|
12 | #ifdef __cplusplus |
---|
13 | extern "C" { |
---|
14 | #endif |
---|
15 | |
---|
16 | /* |
---|
17 | * _ITRON_Port_Allocate |
---|
18 | * |
---|
19 | * DESCRIPTION: |
---|
20 | * |
---|
21 | * This routine allocates the port associated with the specified |
---|
22 | * port ID from the pool of inactive ports. |
---|
23 | * |
---|
24 | * Input parameters: |
---|
25 | * porid - id of port to allocate |
---|
26 | * status - pointer to status variable |
---|
27 | * |
---|
28 | * Output parameters: |
---|
29 | * returns - pointer to the port control block |
---|
30 | * *status - status |
---|
31 | */ |
---|
32 | |
---|
33 | RTEMS_INLINE_ROUTINE ITRON_Port_Control *_ITRON_Port_Allocate( |
---|
34 | ID porid |
---|
35 | ) |
---|
36 | { |
---|
37 | return (ITRON_Port_Control *)_ITRON_Objects_Allocate_by_index( |
---|
38 | &_ITRON_Port_Information, |
---|
39 | porid, |
---|
40 | sizeof(ITRON_Port_Control) |
---|
41 | ); |
---|
42 | } |
---|
43 | |
---|
44 | /* |
---|
45 | * _ITRON_Port_Clarify_allocation_id_error |
---|
46 | * |
---|
47 | * This function is invoked when an object allocation ID error |
---|
48 | * occurs to determine the specific ITRON error code to return. |
---|
49 | */ |
---|
50 | |
---|
51 | #define _ITRON_Port_Clarify_allocation_id_error( _id ) \ |
---|
52 | _ITRON_Objects_Clarify_allocation_id_error( \ |
---|
53 | &_ITRON_Port_Information, (_id) ) |
---|
54 | |
---|
55 | /* |
---|
56 | * _ITRON_Port_Clarify_get_id_error |
---|
57 | * |
---|
58 | * This function is invoked when an object get ID error |
---|
59 | * occurs to determine the specific ITRON error code to return. |
---|
60 | */ |
---|
61 | |
---|
62 | #define _ITRON_Port_Clarify_get_id_error( _id ) \ |
---|
63 | _ITRON_Objects_Clarify_get_id_error( &_ITRON_Port_Information, (_id) ) |
---|
64 | |
---|
65 | /* |
---|
66 | * _ITRON_Port_Free |
---|
67 | * |
---|
68 | * DESCRIPTION: |
---|
69 | * |
---|
70 | * This routine frees a port control block to the |
---|
71 | * inactive chain of free port control blocks. |
---|
72 | * |
---|
73 | * Input parameters: |
---|
74 | * the_port - pointer to port control block |
---|
75 | * |
---|
76 | * Output parameters: NONE |
---|
77 | */ |
---|
78 | |
---|
79 | RTEMS_INLINE_ROUTINE void _ITRON_Port_Free ( |
---|
80 | ITRON_Port_Control *the_port |
---|
81 | ) |
---|
82 | { |
---|
83 | _ITRON_Objects_Free( &_ITRON_Port_Information, &the_port->Object ); |
---|
84 | } |
---|
85 | |
---|
86 | /*PAGE |
---|
87 | * |
---|
88 | * _ITRON_Port_Get |
---|
89 | * |
---|
90 | * DESCRIPTION: |
---|
91 | * |
---|
92 | * This function maps port IDs to port control blocks. |
---|
93 | * If ID corresponds to a local port, then it returns |
---|
94 | * the_port control pointer which maps to ID and location |
---|
95 | * is set to OBJECTS_LOCAL. if the port ID is global and |
---|
96 | * resides on a remote node, then location is set to OBJECTS_REMOTE, |
---|
97 | * and the_port is undefined. Otherwise, location is set |
---|
98 | * to OBJECTS_ERROR and the_port is undefined. |
---|
99 | * |
---|
100 | * Input parameters: |
---|
101 | * id - ITRON port ID. |
---|
102 | * the_location - pointer to a location variable |
---|
103 | * |
---|
104 | * Output parameters: |
---|
105 | * *the_location - location of the object |
---|
106 | */ |
---|
107 | |
---|
108 | RTEMS_INLINE_ROUTINE ITRON_Port_Control *_ITRON_Port_Get ( |
---|
109 | ID id, |
---|
110 | Objects_Locations *location |
---|
111 | ) |
---|
112 | { |
---|
113 | return (ITRON_Port_Control *) |
---|
114 | _ITRON_Objects_Get( &_ITRON_Port_Information, id, location ); |
---|
115 | } |
---|
116 | |
---|
117 | /*PAGE |
---|
118 | * |
---|
119 | * _ITRON_Port_Is_null |
---|
120 | * |
---|
121 | * This function returns TRUE if the_port is NULL and FALSE otherwise. |
---|
122 | * |
---|
123 | * Input parameters: |
---|
124 | * the_port - pointer to port control block |
---|
125 | * |
---|
126 | * Output parameters: |
---|
127 | * TRUE - if the_port is NULL |
---|
128 | * FALSE - otherwise |
---|
129 | */ |
---|
130 | |
---|
131 | RTEMS_INLINE_ROUTINE boolean _ITRON_Port_Is_null ( |
---|
132 | ITRON_Port_Control *the_port |
---|
133 | ) |
---|
134 | { |
---|
135 | return ( the_port == NULL ); |
---|
136 | } |
---|
137 | |
---|
138 | /* |
---|
139 | * XXX insert inline routines here |
---|
140 | */ |
---|
141 | |
---|
142 | #ifdef __cplusplus |
---|
143 | } |
---|
144 | #endif |
---|
145 | |
---|
146 | #endif |
---|
147 | /* end of include file */ |
---|
148 | |
---|