3 * @brief Event library(kernel) -- Defining flag queue ID
5 * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 /** @addtogroup EV_ID_spec
25 /** @brief Flag ID and queue ID types used when sending and receiving events
27 * Assign a 32-bit value as follows
29 * - Most significant 8 bits: Reserved
30 * - Next 16 bits: Modue ID
31 * - Lower 8 bits: Define in module
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
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
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))
60 /** @brief Macros for defining flag ID
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)
66 * - #define XXX_Flag_foo (XXX_Flag_ID_Base + 1)
67 * - #define XXX_Flag_bar (XXX_Flag_ID_Base + 2)
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.
72 #define EV_Flag_ID_Base(mod) (EV_ID_BIT|EV_FLAG_BIT|((mod)<<8))
74 /** @brief Macros for defining 64 bits flag ID
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)
80 * - #define XXX_Flag64_foo (XXX_Flag64_ID_Base + 1)
81 * - #define XXX_Flag64_bar (XXX_Flag64_ID_Base + 2)
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.
86 #define EV_Flag64_ID_Base(mod) (EV_ID_BIT|EV_FLAG64_BIT|((mod)<<8))
88 /** @brief Macros for defining mesage queue ID
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)
94 * - #define XXX_Queue_foo (XXX_Queue_ID_Base + 1)
95 * - #define XXX_Queue_bar (XXX_Queue_ID_Base + 2)
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.
100 #define EV_Queue_ID_Base(mod) (EV_ID_BIT|EV_QUEUE_BIT|((mod)<<8))
104 #endif /* ! _ev_id_h_ */