Init basesystem source codes.
[staging/basesystem.git] / vehicleservice / positioning / client / include / Vehicle_API_private.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 #ifndef POSITIONING_CLIENT_INCLUDE_VEHICLE_API_PRIVATE_H_
18 #define POSITIONING_CLIENT_INCLUDE_VEHICLE_API_PRIVATE_H_
19 /******************************************************************************
20  * File name        :Vehicle_API_private.h
21  * System name        :GPF
22  * Subsystem name    :Vehicle I/F library
23  ******************************************************************************/
24 #include <vehicle_service/POS_sensor_API.h>
25 #include "Vehicle_API.h"
26
27 /************************************************************************
28 *            Macro definitions                                                 *
29 ************************************************************************/
30
31 /*----------------------------------------------------------------------*
32  *    Shared Memory Related Extensions                                                     *
33  *----------------------------------------------------------------------*/
34 #define VEHICLE_SHARE_LOCK           0xFF                            /* Locking */
35 #define VEHICLE_SHARE_UNLOCK         0x00                            /* Unlocking */
36
37 #define VEHICLE_SHARE_BLOCK_MNUM     1                               /* Number of shared memory control blocks */
38 #define VEHICLE_SHARE_BLOCK_DNUM     10                              /* Number of shared memory data blocks */
39 /* Number of shared memory blocks */
40 #define VEHICLE_SHARE_BLOCK_NUM      (VEHICLE_SHARE_BLOCK_MNUM+VEHICLE_SHARE_BLOCK_DNUM)
41
42 #define VEHICLE_SHARE_BLOCK_SIZE     512                             /* Shared Memory Block Size(byte) */
43 #define VEHICLE_SHARE_BLOCK_DSIZE    SENSOR_MSG_VSINFO_DSIZE         /* Shared Memory Data Size */
44 /* Size of shared memory allocation area */
45 #define VEHICLE_SHARE_SIZE           (VEHICLE_SHARE_BLOCK_SIZE * VEHICLE_SHARE_BLOCK_NUM)
46
47 #define VEHICLE_SEMAPHO_NAME         ("VEHICLE_SHARE_SEMAPHO")       /* Semaphore name */
48
49 #define VEHICLE_INVALID              0                               /* Disabled */
50 #define VEHICLE_EFFECTIVE            1                               /* Enabled */
51 #define VEHICLE_BIT31                0x80000000
52
53 /* ++ PastModel002 compliant_error compliant */
54 /* Message Data Size(byte) */
55 #define VEHICLE_VSINFO_DSIZE         504                             /* Vehicle sensor information        */
56 /* -- PastModel002 compliant_error compliant */
57
58 /*----------------------------------------------------------------------*
59  *    Event Related Extensions                                                       *
60  *----------------------------------------------------------------------*/
61 #define VEHICLE_EVENT_VAL_INIT       (VEHICLE_RET_ERROR_MIN-1)       /* Event initial value        */
62
63 /*----------------------------------------------------------------------*
64  *    Shared Memory Related Extensions                                                       *
65  *----------------------------------------------------------------------*/
66 #define VEHICLE_SHARE_NAME           ("POS_VEHICLE_SHARE_MEMORY")    /* Shared memory name */
67
68 /************************************************************************
69 *            Typedef definitions                                                *
70 ************************************************************************/
71
72 /************************************************************************
73 *            Struct definitions                                                 *
74 ************************************************************************/
75
76 /* ++ PastModel002 compliant_error compliant */
77
78 /************************************************************************
79 * TAG       : VEHICLE_MSG_VSINFO_DAT
80 * ABSTRACT  : Vehicle sensor information notification message(-> User)
81 ************************************************************************/
82 typedef struct {
83     T_APIMSG_MSGBUF_HEADER     hdr;                                   /* Message header    */
84     VEHICLE_MSG_VSINFO_DAT     data;                                  /* Message data    */
85 } VEHICLE_MSG_VSINFO;
86
87 /* -- PastModel002 compliant_error compliant */
88
89 /************************************************************************
90 * TAG       : VEHICLE_SHARE_MNG
91 * ABSTRACT  : Shared memory management area
92 ************************************************************************/
93 typedef struct {
94     u_int8                     lock_info[VEHICLE_SHARE_BLOCK_NUM];    /* Usages    */
95     u_int8                     reserve[501];
96 } VEHICLE_SHARE_MNG;
97
98 /************************************************************************
99 * TAG       : VEHICLE_SHARE_BLOCK_DAT
100 * ABSTRACT  : Shared memory data area(One block)
101 ************************************************************************/
102 typedef struct {
103     u_int16                    size;                                  /* Size of the data    */
104     u_int8                     reserve[2];
105     u_int8                     data[VEHICLE_SHARE_BLOCK_DSIZE];       /* Data        */
106 } VEHICLE_SHARE_BLOCK_DAT;
107
108 /************************************************************************
109 * TAG       : VEHICLE_SHARE_BLOCK_MNG
110 * ABSTRACT  : Areas of memory that are shared
111 ************************************************************************/
112 typedef struct {
113     VEHICLE_SHARE_MNG          mng;                                   /* Shared memory management information */
114     VEHICLE_SHARE_BLOCK_DAT    data[VEHICLE_SHARE_BLOCK_DNUM];        /* Shared memory data portion */
115 } VEHICLE_SHARE;
116
117 /************************************************************************
118 *            Function prototype                                              *
119 ************************************************************************/
120 RET_API VehicleDeleteEvent(EventID event_id);
121 RET_API VehicleLinkShareData(void **share_top, uint32_t *share_size, uint16_t *offset);
122 RET_API VehicleUnLinkShareData(VEHICLE_SHARE *share_top, u_int16 offset);
123 EventID VehicleCreateEvent(PNO pno);
124 void PosSetShareData(void *share_top, u_int16 offset, const void *data_src, u_int16 size_src);
125 RET_API VehicleSndMsg(PNO pno_src, PNO pno_dest, CID cid, u_int16 msg_len, const void *msg_data);
126
127 SENSOR_RET_API PosRegisterListenerProc(PCSTR notify_name, DID did, u_int8 ctrl_flg, u_int8 delivery_timing);
128
129 #endif  // POSITIONING_CLIENT_INCLUDE_VEHICLE_API_PRIVATE_H_ */