Re-organized sub-directory by category
[staging/basesystem.git] / service / vehicle / positioning_base_library / library / include / _pbEvent_Internal.h
1 /*
2  * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /*******************************************************************************
18 * $Header::                                                                   $
19 * $Revision::                                                                 $
20 *******************************************************************************/
21
22 /****************************************************************************
23  * File name        : _pbEvent_Internal.h
24  * System name      : GPF
25  * Subsystem name   : _CWORD64_API Events Feature
26  * Title            : Internal definition file for event function
27  ****************************************************************************/
28 #ifndef POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBEVENT_INTERNAL_H_
29 #define POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBEVENT_INTERNAL_H_
30
31 #include <other_service/ev_lib.h>
32
33 /*
34  Constant definition
35 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
36 #define MAX_PB_EVENTS                16
37 #define MAX_EVENT_NAME_LEN           32
38 #define MIN_EVENT_VAL                0x80000000   /* Minimum event value(-2147483648) */
39 #define MAX_EVENT_VAL                0x7FFFFFFF   /* Maximum event value( 2147483647) */
40 #define EVENT_BIT_ZERO               0x00000000   /* Event value All Bit Zero Definition */
41 #define MAX_PB_EVENT_WAIT_THREADS    1            /* Values other than 1 are not designed while the EV library is being used. */
42 #define EVSET_ABSOLUTE               1            /* Absolute setting */
43 #define EVSET_RELATE                 2            /* Relative value setting */
44 #define EVSET_AND                    3            /* AND value setting */
45 #define EVSET_OR                     4            /* OR setting */
46 #define EVWAIT_VAL                   1            /* Waiting mode for an event by specifying a range */
47 #define EVWAIT_ALLCLR                2            /* Mode to wait for an event when the specified bit is cleared */
48 #define EVWAIT_ANYSET                3            /* Mode to wait for an event with a specified set of bits */
49
50 #define _CWORD64_EVENT_MAXOPEN_IN_PROCESS    0x7FFFFFFF    /* Maximum number of open events in the same process    */
51 #define _CWORD64_EVENT_MAXOPEN_IN_SYSTEM     0x7FFFFFFF    /* Maximum number of the same event open in the system        */
52
53 #define MAX_EVENT_PROC_NUM (32) /* EVENT Max Processes Used */
54
55 /*
56  Structure Definition
57 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
58 /*****************************************************************************
59  * TAG      : WAITING_CONDITION
60  * ABSTRACT : Event Status Settings
61 ******************************************************************************/
62 typedef struct {
63     u_int8                   uc_use_flag;        /* Table Usage Flags(TRUE:Use FALSE:Not used) */
64     u_int8                   uc_waiting;        /* Event Waiting Flag */
65     /* TRUE        Waiting for event */
66     /* FALSE    Release Event Wait */
67     u_int16                  us_mode;            /* Waiting mode */
68     /* EVWAIT_VAL        Wait for Value Range */
69     /* EVWAIT_ALLCLR    Wait for specified bit to be cleared */
70     /* EVWAIT_ANYSET    Waiting for setting the specified bit */
71     u_int32                  ul_mask;            /* Mask value when waiting for specified bit */
72     int32                    l_min_val;        /* Minimum value of condition when waiting for value range */
73     int32                    l_max_val;        /* Maximum value of condition when waiting for value range */
74     int32                    l_last_val;        /* Events at WaitEvent Return */
75     EV_ID                    flag_id[MAX_EVENT_PROC_NUM];            /* Event flags(CLS event library) */
76 } WAITING_CONDITION;                        /* Total 28 Bytes. */
77
78 /*****************************************************************************
79  * TAG      : WAITING_CONDITION
80  * ABSTRACT : Event information storage area
81 ******************************************************************************/
82 typedef struct {
83     TCHAR                    event_name[MAX_EVENT_NAME_LEN];            /* Maximum number of characters + NULL area */
84     int32                    l_event_val;
85     WAITING_CONDITION        st_condition[MAX_PB_EVENT_WAIT_THREADS];
86     int32                    l_process_ref;
87     int32                    l_reset_data;
88     u_int8                   uc_manual_reset;
89     u_int8                   uc_reserve[3];
90     char                     name_of_mutex[NAME_MAX];
91     /* TODO: Members for the following EV library use:Structurely strange, but borrowed shared space.Correction is required. */
92     u_int8                   proc_cnt;
93 } PB_EVENT;
94
95 /*****************************************************************************
96  * TAG      : PB_EVENT_OPEN_HANDLE
97  * ABSTRACT : Generated event management information
98 ******************************************************************************/
99 typedef struct {
100     HANDLE                   h_heap;
101     PB_EVENT*                p_sys_event;
102     DWORD                    index;
103     int32                    l_thread_ref;
104 } PB_EVENT_OPEN_HANDLE;
105
106 /*****************************************************************************
107  * TAG      : PB_EVENT_INSTANCE
108  * ABSTRACT : Event management table
109 ******************************************************************************/
110 typedef struct {
111     PB_EVENT_OPEN_HANDLE*    p_handle_table[MAX_PB_EVENTS];
112     HANDLE                   h_shared_memory;
113     SemID                    id_event_table_sem;
114     PB_EVENT*                p_event_table;
115 } PB_EVENT_INSTANCE;
116
117 /*
118  Prototype declaration
119 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
120 #ifdef    __cplusplus
121 extern "C" {
122 #endif
123
124 #ifdef    __cplusplus
125 }
126 #endif
127
128 #endif   // POSITIONING_BASE_LIBRARY_LIBRARY_INCLUDE__PBEVENT_INTERNAL_H_