summaryrefslogtreecommitdiffstats
path: root/positioning/client/include/Vehicle_API_private.h
blob: dfe082dd37293919004a82cd1a4b6aa82836e446 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
 * @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 POSITIONING_CLIENT_INCLUDE_VEHICLE_API_PRIVATE_H_
#define POSITIONING_CLIENT_INCLUDE_VEHICLE_API_PRIVATE_H_
/******************************************************************************
 * File name        :Vehicle_API_private.h
 * System name        :GPF
 * Subsystem name    :Vehicle I/F library
 ******************************************************************************/
#include <vehicle_service/POS_sensor_API.h>
#include "Vehicle_API.h"

/************************************************************************
*            Macro definitions                                                 *
************************************************************************/

/*----------------------------------------------------------------------*
 *    Shared Memory Related Extensions                                                     *
 *----------------------------------------------------------------------*/
#define VEHICLE_SHARE_LOCK           0xFF                            /* Locking */
#define VEHICLE_SHARE_UNLOCK         0x00                            /* Unlocking */

#define VEHICLE_SHARE_BLOCK_MNUM     1                               /* Number of shared memory control blocks */
#define VEHICLE_SHARE_BLOCK_DNUM     10                              /* Number of shared memory data blocks */
/* Number of shared memory blocks */
#define VEHICLE_SHARE_BLOCK_NUM      (VEHICLE_SHARE_BLOCK_MNUM+VEHICLE_SHARE_BLOCK_DNUM)

#define VEHICLE_SHARE_BLOCK_SIZE     512                             /* Shared Memory Block Size(byte) */
#define VEHICLE_SHARE_BLOCK_DSIZE    SENSOR_MSG_VSINFO_DSIZE         /* Shared Memory Data Size */
/* Size of shared memory allocation area */
#define VEHICLE_SHARE_SIZE           (VEHICLE_SHARE_BLOCK_SIZE * VEHICLE_SHARE_BLOCK_NUM)

#define VEHICLE_SEMAPHO_NAME         ("VEHICLE_SHARE_SEMAPHO")       /* Semaphore name */

#define VEHICLE_INVALID              0                               /* Disabled */
#define VEHICLE_EFFECTIVE            1                               /* Enabled */
#define VEHICLE_BIT31                0x80000000

/* ++ PastModel002 compliant_error compliant */
/* Message Data Size(byte) */
#define VEHICLE_VSINFO_DSIZE         504                             /* Vehicle sensor information        */
/* -- PastModel002 compliant_error compliant */

/*----------------------------------------------------------------------*
 *    Event Related Extensions                                                       *
 *----------------------------------------------------------------------*/
#define VEHICLE_EVENT_VAL_INIT       (VEHICLE_RET_ERROR_MIN-1)       /* Event initial value        */

/*----------------------------------------------------------------------*
 *    Shared Memory Related Extensions                                                       *
 *----------------------------------------------------------------------*/
#define VEHICLE_SHARE_NAME           ("POS_VEHICLE_SHARE_MEMORY")    /* Shared memory name */

/************************************************************************
*            Typedef definitions                                                *
************************************************************************/

/************************************************************************
*            Struct definitions                                                 *
************************************************************************/

/* ++ PastModel002 compliant_error compliant */

/************************************************************************
* TAG       : VEHICLE_MSG_VSINFO_DAT
* ABSTRACT  : Vehicle sensor information notification message(-> User)
************************************************************************/
typedef struct {
    T_APIMSG_MSGBUF_HEADER     hdr;                                   /* Message header    */
    VEHICLE_MSG_VSINFO_DAT     data;                                  /* Message data    */
} VEHICLE_MSG_VSINFO;

/* -- PastModel002 compliant_error compliant */

/************************************************************************
* TAG       : VEHICLE_SHARE_MNG
* ABSTRACT  : Shared memory management area
************************************************************************/
typedef struct {
    u_int8                     lock_info[VEHICLE_SHARE_BLOCK_NUM];    /* Usages    */
    u_int8                     reserve[501];
} VEHICLE_SHARE_MNG;

/************************************************************************
* TAG       : VEHICLE_SHARE_BLOCK_DAT
* ABSTRACT  : Shared memory data area(One block)
************************************************************************/
typedef struct {
    u_int16                    size;                                  /* Size of the data    */
    u_int8                     reserve[2];
    u_int8                     data[VEHICLE_SHARE_BLOCK_DSIZE];       /* Data        */
} VEHICLE_SHARE_BLOCK_DAT;

/************************************************************************
* TAG       : VEHICLE_SHARE_BLOCK_MNG
* ABSTRACT  : Areas of memory that are shared
************************************************************************/
typedef struct {
    VEHICLE_SHARE_MNG          mng;                                   /* Shared memory management information */
    VEHICLE_SHARE_BLOCK_DAT    data[VEHICLE_SHARE_BLOCK_DNUM];        /* Shared memory data portion */
} VEHICLE_SHARE;

/************************************************************************
*            Function prototype                                              *
************************************************************************/
RET_API VehicleDeleteEvent(EventID event_id);
RET_API VehicleLinkShareData(void **share_top, u_int32 *share_size, u_int16 *offset);
RET_API VehicleUnLinkShareData(VEHICLE_SHARE *share_top, u_int16 offset);
EventID VehicleCreateEvent(PNO pno);
void PosSetShareData(void *share_top, u_int16 offset, const void *data_src, u_int16 size_src);
RET_API VehicleSndMsg(PNO pno_src, PNO pno_dest, CID cid, u_int16 msg_len, const void *msg_data);

SENSOR_RET_API PosRegisterListenerProc(PCSTR notify_name, DID did, u_int8 ctrl_flg, u_int8 delivery_timing);

#endif  // POSITIONING_CLIENT_INCLUDE_VEHICLE_API_PRIVATE_H_ */