Removed unnecessary files.
[staging/basesystem.git] / module / kernel-module-evklib / agldd / ev_id.h
1 /**
2  * @file ev_id.h
3  * @brief Event library(kernel) -- Defining flag queue ID
4  *
5  * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 #ifndef _ev_id_h_
20 #define _ev_id_h_
21
22 /** @addtogroup EV_ID_spec
23  * @{ */
24
25 /** @brief Flag ID and queue ID types used when sending and receiving events
26  *
27  * Assign a 32-bit value as follows
28  *
29  * - Most significant 8 bits: Reserved
30  * - Next 16 bits: Modue ID
31  * - Lower 8 bits: Define in module
32  *
33  * Where module is the modules that creates the queue.
34  * The modules define ID according to the above assignments using EV_Flag_ID_Base and EV_Queue_ID_Base macros.
35  * @see EV_Flag_ID_Base
36  * @see EV_Queue_ID_Base
37  */
38 typedef UINT32 EV_ID;
39
40 #define EV_ID_BIT       0x80000000UL
41 #define EV_FLAG64_BIT   0x40000000UL
42 #define EV_FLAG_BIT     0x20000000UL
43 #define EV_QUEUE_BIT    0x10000000UL
44 #define EV_AUTO_ID_BIT  0x08000000UL
45 #define EV_RESERVED_BIT 0xff000000UL
46 #define EV_INVALID_ID   EV_ID_BIT
47 #define EV_NO_ID        EV_INVALID_ID
48
49 #define EV_ID_IS_FLAG(queueID) \
50   (((queueID) & (EV_ID_BIT|EV_FLAG_BIT)) == (EV_ID_BIT|EV_FLAG_BIT))
51 #define EV_ID_IS_FLAG64(queueID) \
52   (((queueID) & (EV_ID_BIT|EV_FLAG64_BIT)) == (EV_ID_BIT|EV_FLAG64_BIT))
53 #define EV_ID_IS_QUEUE(queueID) \
54   (((queueID) & (EV_ID_BIT|EV_QUEUE_BIT)) == (EV_ID_BIT|EV_QUEUE_BIT))
55 #define EV_ID_IS_AUTO_ID(queueID) \
56   (((queueID) & (EV_ID_BIT|EV_AUTO_ID_BIT)) == (EV_ID_BIT|EV_AUTO_ID_BIT))
57 #define EV_ID_IS_VALID(queueID) \
58   (EV_ID_IS_FLAG(queueID) || EV_ID_IS_FLAG64(queueID) || EV_ID_IS_QUEUE(queueID))
59
60 /** @brief Macros for defining flag ID
61  *
62  * Define the module ID as an argument as follows.
63  * - #define XXX_Module_ID 1
64  * - #define XXX_Flag_ID_Base EV_Flag_ID_Base(XXX_Module_ID)
65  * -
66  * - #define XXX_Flag_foo (XXX_Flag_ID_Base + 1)
67  * - #define XXX_Flag_bar (XXX_Flag_ID_Base + 2)
68  *
69  * The module ID is 16 bits and 0 to 65535 can be specified.
70  * In addition, 0 to 255 added to Base can be defined as ID.
71  */
72 #define EV_Flag_ID_Base(mod) (EV_ID_BIT|EV_FLAG_BIT|((mod)<<8))
73
74 /** @brief Macros for defining 64 bits flag ID
75  *
76  * Define the module ID as an argument as follows.
77  * - #define XXX_Module_ID 1
78  * - #define XXX_Flag64_ID_Base EV_Flag64_ID_Base(XXX_Module_ID)
79  * -
80  * - #define XXX_Flag64_foo (XXX_Flag64_ID_Base + 1)
81  * - #define XXX_Flag64_bar (XXX_Flag64_ID_Base + 2)
82  *
83  * The module ID is 16 bits and 0 to 65535 can be specified.
84  * In addition, 0 to 255 added to Base can be defined as ID.
85  */
86 #define EV_Flag64_ID_Base(mod) (EV_ID_BIT|EV_FLAG64_BIT|((mod)<<8))
87
88 /** @brief Macros for defining mesage queue ID
89  *
90  * Define the module ID as an argument as follows.
91  * - #define XXX_Module_ID 1
92  * - #define XXX_Queue_ID_Base EV_Queue_ID_Base(XXX_Module_ID)
93  * -
94  * - #define XXX_Queue_foo (XXX_Queue_ID_Base + 1)
95  * - #define XXX_Queue_bar (XXX_Queue_ID_Base + 2)
96  *
97  * The module ID is 16 bits and 0 to 65535 can be specified.
98  * In addition, 0 to 255 added to Base can be defined as ID.
99  */
100 #define EV_Queue_ID_Base(mod) (EV_ID_BIT|EV_QUEUE_BIT|((mod)<<8))
101
102 /** @} */
103
104 #endif /* ! _ev_id_h_ */