source: rtems/cpukit/itron/inline/rtems/itron/port.inl @ ef49476

4.104.114.95
Last change on this file since ef49476 was ef49476, checked in by Ralf Corsepius <ralf.corsepius@…>, on 08/19/08 at 08:32:59

Add header guard to force indirect inclusion.

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