1 | /** |
---|
2 | * @file rtems/itron/object.h |
---|
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_OBJECT_h_ |
---|
17 | #define __RTEMS_ITRON_OBJECT_h_ |
---|
18 | |
---|
19 | #ifdef __cplusplus |
---|
20 | extern "C" { |
---|
21 | #endif |
---|
22 | |
---|
23 | #include <rtems/score/object.h> |
---|
24 | |
---|
25 | typedef Objects_Control ITRON_Objects_Control; |
---|
26 | |
---|
27 | /* |
---|
28 | * Maximum length of an ITRON object name |
---|
29 | * |
---|
30 | * NOTE: Since ITRON objects do not have names, then then length is 0. |
---|
31 | */ |
---|
32 | |
---|
33 | #define ITRON_MAXIMUM_NAME_LENGTH 0 |
---|
34 | |
---|
35 | /* |
---|
36 | * _ITRON_Objects_Open |
---|
37 | * |
---|
38 | * Make this ITRON object visible to the system. |
---|
39 | * |
---|
40 | * NOTE: This macro hides the fact that ITRON objects don't have names. |
---|
41 | */ |
---|
42 | |
---|
43 | #define _ITRON_Objects_Open( _the_information, _the_object ) \ |
---|
44 | _Objects_Open( (_the_information), (_the_object), NULL ) |
---|
45 | |
---|
46 | /* |
---|
47 | * _ITRON_Objects_Close |
---|
48 | * |
---|
49 | * Make this ITRON object invisible from the system. Usually used as |
---|
50 | * the first step of deleting an object. |
---|
51 | */ |
---|
52 | |
---|
53 | #define _ITRON_Objects_Close( _the_information, _the_object ) \ |
---|
54 | _Objects_Close( (_the_information), (_the_object) ) |
---|
55 | |
---|
56 | /* |
---|
57 | * _ITRON_Objects_Allocate_by_index |
---|
58 | * |
---|
59 | * Allocate the ITRON object specified by "_id". The ITRON id is the |
---|
60 | * index portion of the traditional RTEMS ID. The Classic and POSIX |
---|
61 | * APIs do not require that a specific object be allocated. |
---|
62 | */ |
---|
63 | |
---|
64 | #define _ITRON_Objects_Allocate_by_index( _the_information, _id, _sizeof ) \ |
---|
65 | _Objects_Allocate_by_index( (_the_information), (_id), (_sizeof) ) |
---|
66 | |
---|
67 | /* |
---|
68 | * _ITRON_Objects_Clarify_allocation_id_error |
---|
69 | * |
---|
70 | * This function is invoked when an object allocation ID error |
---|
71 | * occurs to determine the specific ITRON error code to return. |
---|
72 | */ |
---|
73 | |
---|
74 | #define _ITRON_Objects_Clarify_allocation_id_error( _the_information, _id ) \ |
---|
75 | (((_id) < -4) ? E_OACV : /* attempt to access a "system object" */ \ |
---|
76 | ((_id) <= 0) ? E_ID : /* bogus index of 0 - -3 */ \ |
---|
77 | ((_id) <= (_the_information)->maximum) ? E_OBJ : /* object is in use */ \ |
---|
78 | E_ID) /* simply a bad id */ |
---|
79 | |
---|
80 | /* |
---|
81 | * _ITRON_Objects_Clarify_get_id_error |
---|
82 | * |
---|
83 | * This function is invoked when an object get ID error |
---|
84 | * occurs to determine the specific ITRON error code to return. |
---|
85 | */ |
---|
86 | |
---|
87 | #define _ITRON_Objects_Clarify_get_id_error( _the_information, _id ) \ |
---|
88 | (((_id) < -4) ? E_OACV : /* attempt to access a "system object" */ \ |
---|
89 | ((_id) <= 0) ? E_ID : /* bogus index of 0 - -3 */ \ |
---|
90 | ((_id) <= (_the_information)->maximum) ? E_NOEXS : /* does not exist */ \ |
---|
91 | E_ID) /* simply a bad id */ |
---|
92 | |
---|
93 | |
---|
94 | /* |
---|
95 | * _ITRON_Objects_Free |
---|
96 | * |
---|
97 | * Free this ITRON object to the pool of inactive objects. This |
---|
98 | * operation is the same as for the Classic and POSIX APIs. |
---|
99 | */ |
---|
100 | |
---|
101 | #define _ITRON_Objects_Free( _the_information, _the_object ) \ |
---|
102 | _Objects_Free( (_the_information), (_the_object) ) |
---|
103 | |
---|
104 | |
---|
105 | /* |
---|
106 | * _ITRON_Objects_Get |
---|
107 | * |
---|
108 | * Obtain (get) the pointer to the control block for the object |
---|
109 | * specified by "id". The ITRON id passed in here is simply |
---|
110 | * the "index" portion of the traditional RTEMS ID. This |
---|
111 | * requires that this operation be slightly different |
---|
112 | * from the object get used by the Classic and POSIX APIs. |
---|
113 | */ |
---|
114 | |
---|
115 | #define _ITRON_Objects_Get( _the_information, _id, _the_object ) \ |
---|
116 | _Objects_Get_by_index( (_the_information), (_id), (_the_object) ) |
---|
117 | |
---|
118 | #ifdef __cplusplus |
---|
119 | } |
---|
120 | #endif |
---|
121 | |
---|
122 | #endif |
---|
123 | /* end of include file */ |
---|