summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
Diffstat (limited to 'module')
-rwxr-xr-xmodule/kernel-module-evklib/Makefile25
-rwxr-xr-xmodule/kernel-module-evklib/agldd/agldd.h94
-rwxr-xr-xmodule/kernel-module-evklib/agldd/ev_common.h135
-rwxr-xr-xmodule/kernel-module-evklib/agldd/ev_id.h104
-rwxr-xr-xmodule/kernel-module-evklib/agldd/evk_lib.h116
-rwxr-xr-xmodule/kernel-module-evklib/agldd/moduleid.h69
-rwxr-xr-xmodule/kernel-module-evklib/evk_lib.c236
7 files changed, 240 insertions, 539 deletions
diff --git a/module/kernel-module-evklib/Makefile b/module/kernel-module-evklib/Makefile
index 33cc273..782cb0d 100755
--- a/module/kernel-module-evklib/Makefile
+++ b/module/kernel-module-evklib/Makefile
@@ -1,19 +1,18 @@
-# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+# @copyright Copyright (c) 2016-2020 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
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of version 2 of the GNU General Public License
+# as published by the Free Software Foundation.
#
-# 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.
-#
-# Makefile for linux/drivers/agl
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+
CFILES = evk_lib.c
obj-m := evk_lib.o
diff --git a/module/kernel-module-evklib/agldd/agldd.h b/module/kernel-module-evklib/agldd/agldd.h
deleted file mode 100755
index 112dbae..0000000
--- a/module/kernel-module-evklib/agldd/agldd.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * adcpf common header
- *
- * @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 _AGLDD_H_
-#define _AGLDD_H_
-#ifdef __KERNEL__
-#include <linux/types.h>
-#else
-#include <stdint.h>
-#if !defined(__cplusplus)
-#include <stdbool.h>
-#endif /* !defined(__cplusplus) */
-#endif /* __KERNEL__ */
-
-#ifndef __KERNEL__
-#define __LINUX_ARM_ARCH__ 7
-#define BITS_PER_LONG 32
-
-#define __AGLDD_TYPEDEF_I64
-typedef long long i64; /* 8-byte signed integer */
-
-#define __AGLDD_TYPEDEF_U64
-typedef unsigned long long u64; /* 8-byte unsigned integer */
-
-#define __AGLDD_TYPEDEF_U32
-typedef unsigned long u32; /* 4-byte unsigned integer */
-
-#define __AGLDD_TYPEDEF_U16
-typedef unsigned short u16; /* 2-byte unsigned integer */
-
-#define __AGLDD_TYPEDEF_I16
-typedef short i16; /* 2-byte signed integer */
-
-#define __AGLDD_TYPEDEF_U8
-typedef unsigned char u8; /* 1-byte unsigned integer */
-
-#define __AGLDD_TYPEDEF_I8
-typedef char i8; /* 1-byte signed integer */
-#endif
-
-#define __AGLDD_TYPEDEF_INT8
-typedef signed char INT8;
-
-#define __AGLDD_TYPEDEF_INT16
-typedef signed short INT16;
-
-#define __AGLDD_TYPEDEF_INT32
-typedef signed int INT32;
-
-#define __AGLDD_TYPEDEF_INT64
-typedef signed long long INT64;
-
-#define __AGLDD_TYPEDEF_UINT8
-typedef unsigned char UINT8;
-
-#define __AGLDD_TYPEDEF_UINT16
-typedef unsigned short UINT16;
-
-#define __AGLDD_TYPEDEF_UINT32
-typedef unsigned int UINT32;
-
-#define __AGLDD_TYPEDEF_UINT64
-typedef unsigned long long UINT64;
-
-#ifndef __KERNEL__
-#if !defined __WIN_TYPEDEF_BOOL
-#define __AGLDD_TYPEDEF_BOOL
-typedef UINT32 BOOL;
-#endif
-#endif
-
-#ifndef TRUE
-#define TRUE true
-#endif
-#ifndef FALSE
-#define FALSE false
-#endif
-
-#endif/* _AGLDD_H_ */
diff --git a/module/kernel-module-evklib/agldd/ev_common.h b/module/kernel-module-evklib/agldd/ev_common.h
deleted file mode 100755
index 0cc1183..0000000
--- a/module/kernel-module-evklib/agldd/ev_common.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * @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 <agldd/ev_id.h>
-
-/** @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_ */
diff --git a/module/kernel-module-evklib/agldd/ev_id.h b/module/kernel-module-evklib/agldd/ev_id.h
deleted file mode 100755
index 2026ef7..0000000
--- a/module/kernel-module-evklib/agldd/ev_id.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * @file ev_id.h
- * @brief Event library(kernel) -- Defining flag queue ID
- *
- * @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_id_h_
-#define _ev_id_h_
-
-/** @addtogroup EV_ID_spec
- * @{ */
-
-/** @brief Flag ID and queue ID types used when sending and receiving events
- *
- * Assign a 32-bit value as follows
- *
- * - Most significant 8 bits: Reserved
- * - Next 16 bits: Modue ID
- * - Lower 8 bits: Define in module
- *
- * Where module is the modules that creates the queue.
- * The modules define ID according to the above assignments using EV_Flag_ID_Base and EV_Queue_ID_Base macros.
- * @see EV_Flag_ID_Base
- * @see EV_Queue_ID_Base
- */
-typedef UINT32 EV_ID;
-
-#define EV_ID_BIT 0x80000000UL
-#define EV_FLAG64_BIT 0x40000000UL
-#define EV_FLAG_BIT 0x20000000UL
-#define EV_QUEUE_BIT 0x10000000UL
-#define EV_AUTO_ID_BIT 0x08000000UL
-#define EV_RESERVED_BIT 0xff000000UL
-#define EV_INVALID_ID EV_ID_BIT
-#define EV_NO_ID EV_INVALID_ID
-
-#define EV_ID_IS_FLAG(queueID) \
- (((queueID) & (EV_ID_BIT|EV_FLAG_BIT)) == (EV_ID_BIT|EV_FLAG_BIT))
-#define EV_ID_IS_FLAG64(queueID) \
- (((queueID) & (EV_ID_BIT|EV_FLAG64_BIT)) == (EV_ID_BIT|EV_FLAG64_BIT))
-#define EV_ID_IS_QUEUE(queueID) \
- (((queueID) & (EV_ID_BIT|EV_QUEUE_BIT)) == (EV_ID_BIT|EV_QUEUE_BIT))
-#define EV_ID_IS_AUTO_ID(queueID) \
- (((queueID) & (EV_ID_BIT|EV_AUTO_ID_BIT)) == (EV_ID_BIT|EV_AUTO_ID_BIT))
-#define EV_ID_IS_VALID(queueID) \
- (EV_ID_IS_FLAG(queueID) || EV_ID_IS_FLAG64(queueID) || EV_ID_IS_QUEUE(queueID))
-
-/** @brief Macros for defining flag ID
- *
- * Define the module ID as an argument as follows.
- * - #define XXX_Module_ID 1
- * - #define XXX_Flag_ID_Base EV_Flag_ID_Base(XXX_Module_ID)
- * -
- * - #define XXX_Flag_foo (XXX_Flag_ID_Base + 1)
- * - #define XXX_Flag_bar (XXX_Flag_ID_Base + 2)
- *
- * The module ID is 16 bits and 0 to 65535 can be specified.
- * In addition, 0 to 255 added to Base can be defined as ID.
- */
-#define EV_Flag_ID_Base(mod) (EV_ID_BIT|EV_FLAG_BIT|((mod)<<8))
-
-/** @brief Macros for defining 64 bits flag ID
- *
- * Define the module ID as an argument as follows.
- * - #define XXX_Module_ID 1
- * - #define XXX_Flag64_ID_Base EV_Flag64_ID_Base(XXX_Module_ID)
- * -
- * - #define XXX_Flag64_foo (XXX_Flag64_ID_Base + 1)
- * - #define XXX_Flag64_bar (XXX_Flag64_ID_Base + 2)
- *
- * The module ID is 16 bits and 0 to 65535 can be specified.
- * In addition, 0 to 255 added to Base can be defined as ID.
- */
-#define EV_Flag64_ID_Base(mod) (EV_ID_BIT|EV_FLAG64_BIT|((mod)<<8))
-
-/** @brief Macros for defining mesage queue ID
- *
- * Define the module ID as an argument as follows.
- * - #define XXX_Module_ID 1
- * - #define XXX_Queue_ID_Base EV_Queue_ID_Base(XXX_Module_ID)
- * -
- * - #define XXX_Queue_foo (XXX_Queue_ID_Base + 1)
- * - #define XXX_Queue_bar (XXX_Queue_ID_Base + 2)
- *
- * The module ID is 16 bits and 0 to 65535 can be specified.
- * In addition, 0 to 255 added to Base can be defined as ID.
- */
-#define EV_Queue_ID_Base(mod) (EV_ID_BIT|EV_QUEUE_BIT|((mod)<<8))
-
-/** @} */
-
-#endif /* ! _ev_id_h_ */
diff --git a/module/kernel-module-evklib/agldd/evk_lib.h b/module/kernel-module-evklib/agldd/evk_lib.h
deleted file mode 100755
index 416fb0f..0000000
--- a/module/kernel-module-evklib/agldd/evk_lib.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- * @file evk_lib.h
- * @brief Event library -- API specifications for kernel modules
- *
- * @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 _evk_lib_h_
-#define _evk_lib_h_
-
-#include <agldd/ev_common.h>
-#include <linux/types.h>
-#include <linux/ioctl.h>
-
-/* API definition */
-
-/** @addtogroup EV
- * @{ */
-#ifdef __KERNEL__
-/* Flag message queue create/delete */
-EV_ERR EVK_create_flag(EV_ID flagID);
-EV_ERR EVK_create_flag64(EV_ID flagID);
-EV_ERR EVK_create_queue(EV_ID queueID,
- UINT8 length,
- UINT16 max_bytes,
- EV_Message_Queue_Type type);
-
-EV_ERR EVK_create_flag_auto_id(/* OUT */EV_ID *flagID);
-EV_ERR EVK_create_flag64_auto_id(/* OUT */EV_ID *flagID);
-EV_ERR EVK_create_queue_auto_id(/* OUT */EV_ID *queueID,
- UINT8 length,
- UINT16 max_bytes,
- EV_Message_Queue_Type type);
-
-EV_ERR EVK_destroy_flag(EV_ID flagID);
-EV_ERR EVK_destroy_queue(EV_ID queueID);
-
-/* Send events */
-EV_ERR EVK_set_flag(EV_ID flagID, UINT32 bits);
-EV_ERR EVK_set_flag64(EV_ID flagID, UINT64 bits);
-EV_ERR EVK_send_message(EV_ID queueID, UINT16 bytes, const void *message,
- UINT32 senderInfo);
-
-/* Get event(with search conditions) */
-EV_ERR EVK_get_flag(EV_ID flagID, /* OUT */EV_Flag *flag);
-EV_ERR EVK_wait_flag(EV_ID flagID, /* OUT */EV_Flag *flag);/* block */
-EV_ERR EVK_peek_flag(EV_ID flagID, /* OUT */EV_Flag *flag);
-EV_ERR EVK_get_flag64(EV_ID flagID, /* OUT */EV_Flag64 *flag);
-EV_ERR EVK_wait_flag64(EV_ID flagID, /* OUT */EV_Flag64 *flag);/* block */
-EV_ERR EVK_peek_flag64(EV_ID flagID, /* OUT */EV_Flag64 *flag);
-
-EV_ERR EVK_get_message(EV_ID queueID, /* OUT */EV_Message *message);
-EV_ERR EVK_wait_message(EV_ID queueID, /* OUT */EV_Message *message);/* block */
-EV_ERR EVK_peek_message(EV_ID queueID, /* OUT */EV_Message *message);
-
-EV_ERR EVK_find_message_by_sender(EV_ID queueID, UINT32 senderInfo,
- /* OUT */EV_Message *message);
-EV_ERR EVK_find_message_by_content(EV_ID queueID, UINT16 length,
- const void *compare_bytes,
- /* OUT */EV_Message *message);
-#endif
-
-/** @} */
-
-/** @addtogroup EVK_in
- * @{ */
-#define EVK_NAME "evk"
-#define EVK_DEV_NAME "/dev/agl/"EVK_NAME
-#define EVK_DEV_MAJOR (1033 % 256)
-#define EVK_IOC_MAGIC 0xE7
-
-#define EVK_IOC_CREATE_FLAG _IO(EVK_IOC_MAGIC, 0x00)
-#define EVK_IOC_CREATE_FLAG64 _IO(EVK_IOC_MAGIC, 0x01)
-#define EVK_IOC_CREATE_MESSAGE_QUEUE _IO(EVK_IOC_MAGIC, 0x02)
-#define EVK_IOC_ALLOC_FLAG_ID _IO(EVK_IOC_MAGIC, 0x03)
-#define EVK_IOC_ALLOC_FLAG64_ID _IO(EVK_IOC_MAGIC, 0x04)
-#define EVK_IOC_ALLOC_QUEUE_ID _IO(EVK_IOC_MAGIC, 0x05)
-#define EVK_IOC_DESTROY_QUEUE _IO(EVK_IOC_MAGIC, 0x06)
-#define EVK_IOC_STORE_FLAG _IO(EVK_IOC_MAGIC, 0x07)
-#define EVK_IOC_STORE_FLAG64 _IO(EVK_IOC_MAGIC, 0x08)
-#define EVK_IOC_STORE_MESSAGE _IO(EVK_IOC_MAGIC, 0x09)
-#define EVK_IOC_SET_POLL _IO(EVK_IOC_MAGIC, 0x0a)
-#define EVK_IOC_GET_EVENT _IO(EVK_IOC_MAGIC, 0x0b)
-#define EVK_IOC_PEEK_EVENT _IO(EVK_IOC_MAGIC, 0x0c)
-#define EVK_IOC_WAIT_EVENT _IO(EVK_IOC_MAGIC, 0x0d)
-#define EVK_IOC_GET_NEXT_EVENT _IO(EVK_IOC_MAGIC, 0x0e)
-#define EVK_IOC_PEEK_NEXT_EVENT _IO(EVK_IOC_MAGIC, 0x0f)
-#define EVK_IOC_DEBUG_LIST _IO(EVK_IOC_MAGIC, 0x10)
-
-typedef struct {
- EV_ID queueID;/**< Queue ID */
- UINT32 max_bytes;/**< Maximum number of bytes for an event */
- UINT8 length;/**< Queue length */
- EV_Message_Queue_Type type;/**< Type */
-} EVK_Message_Queue_Request;
-
-typedef struct {
- INT32 num; /**< Number of queue ID of search */
- EV_ID ids[EV_MAX_IDS_IN_PROCESS]; /**< Queue ID of search */
- EV_Event ev; /**< [OUT] First event that occured */
-} EVK_Next_Event_Query;
-
-/** @} */
-
-#endif /* !_evk_lib_h */
diff --git a/module/kernel-module-evklib/agldd/moduleid.h b/module/kernel-module-evklib/agldd/moduleid.h
deleted file mode 100755
index 248fadc..0000000
--- a/module/kernel-module-evklib/agldd/moduleid.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * @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.
- */
-
-#include <generated/autoconf.h>
-#ifndef _AGLDD_MODULEID_H_
-#define _AGLDD_MODULEID_H_
-
-/*
- * Define module ID to be used by programs in moduleid_id.h .
- * Define in the format of "#define XXX_MID ID number" (XXX is the module name).
- *
- * MID allocation policy shall be as follows.
- * - UI Application : 0xxxh
- * - Application Service : 1xxxh to 2xxxh
- * + HMI : 10xxh
- * + AV : 12xxh
- * + Radio : 14xxh
- * + Connectivity : 16xxh
- * + Navigation/Location: 18xxh
- * + Vehicle : 1Axxh
- * + Communication : 1Cxxh
- * + BasePF : 1Exxh
- * + System : 20xxh
- * + Other : 22xxh
- * - Common Service : 3xxxh
- * - Extension Service : 4xxxh
- * - System/Device Driver : 5xxxh
- */
-
-/* UI Application : 0xxxh */
-
-/* Application Service : 1xxxh to 2xxxh */
-#define MODEMANAGER_MID 0x1000
-#define ACTIVITYMANAGER_MID 0x1001
-
-/* Common Service : 3xxxh */
-#define IPMANAGER_MID 0x3000
-#define DEVICEMANAGER_MID 0x3001
-#define MSGBRK_MID 0x3002
-#define TIMERENTRYDRV_MID 0x3003
-#define SOUNDAGENT_MID 0x3004
-#define CAN_MID 0x3006
-#define _CWORD83__MID 0x3007
-#define SENSOR_MID 0x3008
-#define GPS_MID 0x3009
-#define RESMGR_MID 0x300A
-#define GRAPHICS_MID 0x300B
-
-/* Extension Service : 4xxxh */
-
-/* System/Device Driver : 5xxxh */
-#define EV_MID 0x5001
-#define RPC_MID 0x5002
-#define EVK_MID 0x5801
-
-#endif /* !_AGLDD_MODULEID_H_ */
diff --git a/module/kernel-module-evklib/evk_lib.c b/module/kernel-module-evklib/evk_lib.c
index 05d881a..e6dd238 100755
--- a/module/kernel-module-evklib/evk_lib.c
+++ b/module/kernel-module-evklib/evk_lib.c
@@ -3,11 +3,11 @@
*
* Event library (kernel space part)
*
- * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION.
+ * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License published
- * by the Free Software Foundation.
+ * This file is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License
+ * as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -15,11 +15,10 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#include <generated/autoconf.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/version.h>
@@ -39,6 +38,9 @@
#include <linux/device.h>
#include <linux/cdev.h>
+#include <linux/types.h>
+#include <linux/ioctl.h>
+
#ifndef STANDARD_INT_DEFINITIONS
#define STANDARD_INT_DEFINITIONS
typedef __u8 UINT8;
@@ -53,7 +55,212 @@ typedef __s64 INT64;
#define ENABLE_PROC_FS 1
-#include <agldd/evk_lib.h>
+#define EVK_NAME "evk"
+#define EVK_DEV_NAME "/dev/agl/"EVK_NAME
+#define EVK_DEV_MAJOR (1033 % 256)
+#define EVK_IOC_MAGIC 0xE7
+
+#define EVK_IOC_CREATE_FLAG _IO(EVK_IOC_MAGIC, 0x00)
+#define EVK_IOC_CREATE_FLAG64 _IO(EVK_IOC_MAGIC, 0x01)
+#define EVK_IOC_CREATE_MESSAGE_QUEUE _IO(EVK_IOC_MAGIC, 0x02)
+#define EVK_IOC_ALLOC_FLAG_ID _IO(EVK_IOC_MAGIC, 0x03)
+#define EVK_IOC_ALLOC_FLAG64_ID _IO(EVK_IOC_MAGIC, 0x04)
+#define EVK_IOC_ALLOC_QUEUE_ID _IO(EVK_IOC_MAGIC, 0x05)
+#define EVK_IOC_DESTROY_QUEUE _IO(EVK_IOC_MAGIC, 0x06)
+#define EVK_IOC_STORE_FLAG _IO(EVK_IOC_MAGIC, 0x07)
+#define EVK_IOC_STORE_FLAG64 _IO(EVK_IOC_MAGIC, 0x08)
+#define EVK_IOC_STORE_MESSAGE _IO(EVK_IOC_MAGIC, 0x09)
+#define EVK_IOC_SET_POLL _IO(EVK_IOC_MAGIC, 0x0a)
+#define EVK_IOC_GET_EVENT _IO(EVK_IOC_MAGIC, 0x0b)
+#define EVK_IOC_PEEK_EVENT _IO(EVK_IOC_MAGIC, 0x0c)
+#define EVK_IOC_WAIT_EVENT _IO(EVK_IOC_MAGIC, 0x0d)
+#define EVK_IOC_GET_NEXT_EVENT _IO(EVK_IOC_MAGIC, 0x0e)
+#define EVK_IOC_PEEK_NEXT_EVENT _IO(EVK_IOC_MAGIC, 0x0f)
+#define EVK_IOC_DEBUG_LIST _IO(EVK_IOC_MAGIC, 0x10)
+
+/** @brief Flag ID and queue ID types used when sending and receiving events
+ *
+ * Assign a 32-bit value as follows
+ *
+ * - Most significant 8 bits: Reserved
+ * - Next 16 bits: Modue ID
+ * - Lower 8 bits: Define in module
+ *
+ * Where module is the modules that creates the queue.
+ * The modules define ID according to the above assignments using EV_Flag_ID_Base and EV_Queue_ID_Base macros.
+ * @see EV_Flag_ID_Base
+ * @see EV_Queue_ID_Base
+ */
+typedef UINT32 EV_ID;
+
+#define EV_ID_BIT 0x80000000UL
+#define EV_FLAG64_BIT 0x40000000UL
+#define EV_FLAG_BIT 0x20000000UL
+#define EV_QUEUE_BIT 0x10000000UL
+#define EV_AUTO_ID_BIT 0x08000000UL
+#define EV_RESERVED_BIT 0xff000000UL
+#define EV_INVALID_ID EV_ID_BIT
+#define EV_NO_ID EV_INVALID_ID
+
+#define EV_ID_IS_FLAG(queueID) \
+ (((queueID) & (EV_ID_BIT|EV_FLAG_BIT)) == (EV_ID_BIT|EV_FLAG_BIT))
+#define EV_ID_IS_FLAG64(queueID) \
+ (((queueID) & (EV_ID_BIT|EV_FLAG64_BIT)) == (EV_ID_BIT|EV_FLAG64_BIT))
+#define EV_ID_IS_QUEUE(queueID) \
+ (((queueID) & (EV_ID_BIT|EV_QUEUE_BIT)) == (EV_ID_BIT|EV_QUEUE_BIT))
+#define EV_ID_IS_AUTO_ID(queueID) \
+ (((queueID) & (EV_ID_BIT|EV_AUTO_ID_BIT)) == (EV_ID_BIT|EV_AUTO_ID_BIT))
+#define EV_ID_IS_VALID(queueID) \
+ (EV_ID_IS_FLAG(queueID) || EV_ID_IS_FLAG64(queueID) || EV_ID_IS_QUEUE(queueID))
+
+/** @brief Macros for defining flag ID
+ *
+ * Define the module ID as an argument as follows.
+ * - #define XXX_Module_ID 1
+ * - #define XXX_Flag_ID_Base EV_Flag_ID_Base(XXX_Module_ID)
+ * -
+ * - #define XXX_Flag_foo (XXX_Flag_ID_Base + 1)
+ * - #define XXX_Flag_bar (XXX_Flag_ID_Base + 2)
+ *
+ * The module ID is 16 bits and 0 to 65535 can be specified.
+ * In addition, 0 to 255 added to Base can be defined as ID.
+ */
+#define EV_Flag_ID_Base(mod) (EV_ID_BIT|EV_FLAG_BIT|((mod)<<8))
+
+/** @brief Macros for defining 64 bits flag ID
+ *
+ * Define the module ID as an argument as follows.
+ * - #define XXX_Module_ID 1
+ * - #define XXX_Flag64_ID_Base EV_Flag64_ID_Base(XXX_Module_ID)
+ * -
+ * - #define XXX_Flag64_foo (XXX_Flag64_ID_Base + 1)
+ * - #define XXX_Flag64_bar (XXX_Flag64_ID_Base + 2)
+ *
+ * The module ID is 16 bits and 0 to 65535 can be specified.
+ * In addition, 0 to 255 added to Base can be defined as ID.
+ */
+#define EV_Flag64_ID_Base(mod) (EV_ID_BIT|EV_FLAG64_BIT|((mod)<<8))
+
+/** @brief Macros for defining mesage queue ID
+ *
+ * Define the module ID as an argument as follows.
+ * - #define XXX_Module_ID 1
+ * - #define XXX_Queue_ID_Base EV_Queue_ID_Base(XXX_Module_ID)
+ * -
+ * - #define XXX_Queue_foo (XXX_Queue_ID_Base + 1)
+ * - #define XXX_Queue_bar (XXX_Queue_ID_Base + 2)
+ *
+ * The module ID is 16 bits and 0 to 65535 can be specified.
+ * In addition, 0 to 255 added to Base can be defined as ID.
+ */
+#define EV_Queue_ID_Base(mod) (EV_ID_BIT|EV_QUEUE_BIT|((mod)<<8))
+
+/** @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;
/** @addtogroup EV_in */
/** @{ */
@@ -248,6 +455,19 @@ static EV_ID sequence_id = 0;
/** @brief Number to be assigned in order of occurrence of the event */
static UINT32 sequence_number = 0;
+typedef struct {
+ EV_ID queueID;/**< Queue ID */
+ UINT32 max_bytes;/**< Maximum number of bytes for an event */
+ UINT8 length;/**< Queue length */
+ EV_Message_Queue_Type type;/**< Type */
+} EVK_Message_Queue_Request;
+
+typedef struct {
+ INT32 num; /**< Number of queue ID of search */
+ EV_ID ids[EV_MAX_IDS_IN_PROCESS]; /**< Queue ID of search */
+ EV_Event ev; /**< [OUT] First event that occured */
+} EVK_Next_Event_Query;
+
unsigned int
evk_get_queue_entry(struct list_head **entries)
{