From 17cf21bcf8a2e29d2cbcf0a313474d2a4ee44f5d Mon Sep 17 00:00:00 2001 From: Tadao Tanikawa Date: Fri, 20 Nov 2020 23:36:23 +0900 Subject: Re-organized sub-directory by category Since all the sub-directories were placed in the first level, created sub-directories, "hal", "module", and "service" for classification and relocated each component. Signed-off-by: Tadao Tanikawa Change-Id: Ifdf743ac0d1893bd8e445455cf0d2c199a011d5c --- module/kernel-module-evklib/agldd/ev_common.h | 135 ++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100755 module/kernel-module-evklib/agldd/ev_common.h (limited to 'module/kernel-module-evklib/agldd/ev_common.h') diff --git a/module/kernel-module-evklib/agldd/ev_common.h b/module/kernel-module-evklib/agldd/ev_common.h new file mode 100755 index 0000000..0cc1183 --- /dev/null +++ b/module/kernel-module-evklib/agldd/ev_common.h @@ -0,0 +1,135 @@ +/** + * @file ev_common.h + * @brief Event library -- User kernel common data structure + * + * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#ifndef _ev_common_h_ +#define _ev_common_h_ + +#include + +/** @addtogroup EV + * @{ */ +/** @brief Maximum number of bytes for message event */ +#define EV_MAX_MESSAGE_LENGTH 2048 + +/** @brief -Maximum number of flag queue that can be created within a thread */ +#define EV_MAX_IDS_IN_THREAD 24 + +/** @brief -Muximum number of threads that can be registered to the EV in a process */ +#define EV_MAX_THREADS_IN_PROCESS 16 + +/** @brief -Maximum number of flag queue that can be creat within a process + */ +#define EV_MAX_IDS_IN_PROCESS \ + (EV_MAX_IDS_IN_THREAD * EV_MAX_THREADS_IN_PROCESS) + +/** @brief Return values for even library function + * + * @see EV_ERR + */ +enum ev_err +{ + EV_OK = 0, /**< Normal completion */ + EV_ERR_Exist, /**< The specified flag message queue does exist */ + EV_ERR_Invalid_ID, /**< The specified flag message queue does not exist */ + EV_ERR_Busy, /**< Message queue full failed to send */ + EV_ERR_Interrupted, /**< Waiting function was interrupted by an interrupt */ + EV_ERR_Thread_Over, /**< Exceeding the number of threads in the process */ + EV_ERR_Invalid_Thread, /**< Invalid thread ID */ + EV_ERR_Fatal, /**< Fatal error */ +}; +/** @brief Return values type for even library function + * + * @see ev_err + */ +typedef INT32 EV_ERR; + +/** @brief Event type + * + * Use in the type of EV_Event structs + * @see ev_type + */ +typedef UINT32 EV_Type; + +/** @brief Bit value representing the type of event */ +enum ev_type { + EV_EVENT_None = 0x00000000, + + /** Flag event: Judged by EV_EVENT_IS_FLAG() */ + EV_EVENT_Flag = 0x0001, +#define EV_EVENT_IS_FLAG(tp) (((tp) & EV_EVENT_Flag) != 0) + + /** Message event: Judged by EV_EVENT_IS_MESSAGE() */ + EV_EVENT_Message = 0x0002, +#define EV_EVENT_IS_MESSAGE(tp) (((tp) & EV_EVENT_Message) != 0) + + /** 64bit flag event: Judged by EV_EVENT_IS_FLAG64() */ + EV_EVENT_Flag64 = 0x0003, +#define EV_EVENT_IS_FLAG64(tp) (((tp) & EV_EVENT_Flag64) != 0) + +}; + +/** @brief Flag event structure */ +typedef struct { + EV_ID flagID;/**< Flag ID */ + UINT32 bits;/**< Bit pattern */ +} EV_Flag; + +/** @brief 64bit flag event structure */ +typedef struct { + EV_ID flagID;/**< Flag ID */ + UINT64 bits;/**< Bit pattern */ +} EV_Flag64; + +/** @brief Message event structure */ +typedef struct { + EV_ID queueID;/**< queue ID */ + UINT32 senderInfo;/**< Source information */ + UINT32 length;/**< Number of bytes in the message */ + UINT32 dummy;/** dummy for pading */ + UINT8 message[EV_MAX_MESSAGE_LENGTH];/**< Message */ +} EV_Message; + +/** @brief Event structure */ +typedef struct { + EV_Type type; /**< Event type */ + union { + EV_Flag flag; /**< Flag event structure */ + EV_Flag64 flag64; /**< Flag event structure */ + EV_Message message; /**< Message event structure */ + } u; /**< Union of structures per eventtype */ +} EV_Event; + +/** @brief Message event queue type + * + * Specify the action to be taken when the queue overflows (more events are received when the queue is full). + */ +enum ev_message_queue_type { + EV_MESSAGE_QUEUE_TYPE_BUSY,/**< Return a BUSY to the source */ + EV_MESSAGE_QUEUE_TYPE_FIFO,/**< Delete the oldest event */ + EV_MESSAGE_QUEUE_TYPE_REPLACE,/**< Replace the most recent event */ +}; + +/** @brief Messge event queue type + * + * @see ev_message_queue_type + */ +typedef UINT8 EV_Message_Queue_Type; + +/** @} */ + +#endif /* !_ev_common_h_ */ -- cgit 1.2.3-korg