3 * @brief Event library -- User kernel common data structure
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 #include <agldd/ev_id.h>
26 /** @brief Maximum number of bytes for message event */
27 #define EV_MAX_MESSAGE_LENGTH 2048
29 /** @brief -Maximum number of flag queue that can be created within a thread */
30 #define EV_MAX_IDS_IN_THREAD 24
32 /** @brief -Muximum number of threads that can be registered to the EV in a process */
33 #define EV_MAX_THREADS_IN_PROCESS 16
35 /** @brief -Maximum number of flag queue that can be creat within a process
37 #define EV_MAX_IDS_IN_PROCESS \
38 (EV_MAX_IDS_IN_THREAD * EV_MAX_THREADS_IN_PROCESS)
40 /** @brief Return values for even library function
46 EV_OK = 0, /**< Normal completion */
47 EV_ERR_Exist, /**< The specified flag message queue does exist */
48 EV_ERR_Invalid_ID, /**< The specified flag message queue does not exist */
49 EV_ERR_Busy, /**< Message queue full failed to send */
50 EV_ERR_Interrupted, /**< Waiting function was interrupted by an interrupt */
51 EV_ERR_Thread_Over, /**< Exceeding the number of threads in the process */
52 EV_ERR_Invalid_Thread, /**< Invalid thread ID */
53 EV_ERR_Fatal, /**< Fatal error */
55 /** @brief Return values type for even library function
63 * Use in the type of EV_Event structs
66 typedef UINT32 EV_Type;
68 /** @brief Bit value representing the type of event */
70 EV_EVENT_None = 0x00000000,
72 /** Flag event: Judged by EV_EVENT_IS_FLAG() */
73 EV_EVENT_Flag = 0x0001,
74 #define EV_EVENT_IS_FLAG(tp) (((tp) & EV_EVENT_Flag) != 0)
76 /** Message event: Judged by EV_EVENT_IS_MESSAGE() */
77 EV_EVENT_Message = 0x0002,
78 #define EV_EVENT_IS_MESSAGE(tp) (((tp) & EV_EVENT_Message) != 0)
80 /** 64bit flag event: Judged by EV_EVENT_IS_FLAG64() */
81 EV_EVENT_Flag64 = 0x0003,
82 #define EV_EVENT_IS_FLAG64(tp) (((tp) & EV_EVENT_Flag64) != 0)
86 /** @brief Flag event structure */
88 EV_ID flagID;/**< Flag ID */
89 UINT32 bits;/**< Bit pattern */
92 /** @brief 64bit flag event structure */
94 EV_ID flagID;/**< Flag ID */
95 UINT64 bits;/**< Bit pattern */
98 /** @brief Message event structure */
100 EV_ID queueID;/**< queue ID */
101 UINT32 senderInfo;/**< Source information */
102 UINT32 length;/**< Number of bytes in the message */
103 UINT32 dummy;/** dummy for pading */
104 UINT8 message[EV_MAX_MESSAGE_LENGTH];/**< Message */
107 /** @brief Event structure */
109 EV_Type type; /**< Event type */
111 EV_Flag flag; /**< Flag event structure */
112 EV_Flag64 flag64; /**< Flag event structure */
113 EV_Message message; /**< Message event structure */
114 } u; /**< Union of structures per event type */
117 /** @brief Message event queue type
119 * Specify the action to be taken when the queue overflows (more events are received when the queue is full).
121 enum ev_message_queue_type {
122 EV_MESSAGE_QUEUE_TYPE_BUSY,/**< Return a BUSY to the source */
123 EV_MESSAGE_QUEUE_TYPE_FIFO,/**< Delete the oldest event */
124 EV_MESSAGE_QUEUE_TYPE_REPLACE,/**< Replace the most recent event */
127 /** @brief Messge event queue type
129 * @see ev_message_queue_type
131 typedef UINT8 EV_Message_Queue_Type;
135 #endif /* !_ev_common_h_ */