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