2 * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_COMMON_H_
18 #define POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_COMMON_H_
19 /****************************************************************************
20 * File name :VehicleSens_Common.h
21 * System name :_CWORD107_
22 * Subsystem name :Vehicle sensor process
23 ****************************************************************************/
25 #include "Vehicle_API_Dummy.h"
26 #include "Vehicle_API_private.h"
28 #include "positioning_hal.h"
30 /************************************************************************
32 ************************************************************************/
33 #define VEHICLESENS_ZERO 0
34 #define VEHICLESENS_BIT0 0x00000001
35 #define VEHICLESENS_BIT1 0x00000002
36 #define VEHICLESENS_BIT2 0x00000004
37 #define VEHICLESENS_BIT3 0x00000008
38 #define VEHICLESENS_BIT4 0x00000010
39 #define VEHICLESENS_BIT5 0x00000020
40 #define VEHICLESENS_BIT6 0x00000040
41 #define VEHICLESENS_BIT7 0x00000080
42 #define VEHICLESENS_BIT29 0x20000000
43 #define VEHICLESENS_BIT30 0x40000000
44 #define VEHICLESENS_BIT31 0x80000000
45 #define VEHICLESENS_NEQ 1
46 #define VEHICLESENS_EQ 0
47 #define VEHICLESENS_INVALID 0
48 #define VEHICLESENS_EFFECTIVE 1
49 #define VEHICLESENS_CHGTYPE_NCHG VEHICLESENS_EQ
50 #define VEHICLESENS_CHGTYPE_CHG VEHICLESENS_NEQ
51 #define VEHICLESENS_GETMETHOD_CAN 0 /* Data collection way: CAN communication */
52 #define VEHICLESENS_GETMETHOD_LINE 1 /* Data collection way: LineSensor drivers */
53 #define VEHICLESENS_GETMETHOD_NO_DETECTION 2 /* Data collection way: Not downloaded */
54 #define VEHICLESENS_GETMETHOD_GPS 3 /* Data collection way: GPS */
55 #define VEHICLESENS_GETMETHOD_NAVI 4 /* Data collection way: NAVI */
56 #define VEHICLESENS_GETMETHOD_CLOCK 5 /* Data collection way: Clock Information */
57 #define VEHICLESENS_GETMETHOD_INTERNAL 6 /* Data collection way: Internal calculation */
58 #define VEHICLESENS_GETMETHOD_OTHER 7 /* Data collection way: Others */
60 /* Offset value of normal data of vehicle sensor */
61 #define VEHICLESENS_OFFSET_NORMAL 32
62 /* Offset value of normal data of vehicle sensor */
63 #define VEHICLESENS_OFFSET_GPS_FORMAT 268 /* 8 + 260 */
64 /* Offset value of normal data of vehicle sensor */
65 #define VEHICLESENS_OFFSET_GPS_BINARY 368 /* 8 + 360 */
66 /* ++ GPS _CWORD82_ support */
67 #define VEHICLESENS_OFFSET_GPS_NMEA 460 /* 8 + 452 Packaged delivery offset */
68 /* -- GPS _CWORD82_ support */
70 /* ++ PastModel002 support */
71 /* U-Blox GPS offsets */
72 #define VEHICLESENS_OFFSET_GPS_UBLOX 220 /* 220 */
73 /* -- PastModel002 support */
75 #if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
76 #define VEHICLESENS_OFFSET_10WORD_PKG_EXT 208 /* Offset value of 10 initial deliveries(WORD) 8 + (20 * 10) */
77 #define VEHICLESENS_OFFSET_WORD_PKG_EXT 28 /* Offset value of 10 initial deliveries(WORD) 8 + 20 */
78 #define VEHICLESENS_OFFSET_BYTE_PKG_EXT 18 /* Offset value of 10 initial deliveries(BYTE) 8 + 10 */
79 #define VEHICLESENS_OFFSET_32LONG_PKG_EXT 1328 /* Offset value of 10 initial deliveries(LONG) 8 + (132 * 10) */
80 #define VEHICLESENS_OFFSET_20WORD 48 /* Offset value of 20 sensor data(WORD) 8 + 40 */
81 #define VEHICLESENS_OFFSET_20WORD_FST 408 /* Offset value of 20 initial sensor data(WORD) 8 + 400 */
82 #define VEHICLESENS_DNUM_4 4 /* Number of sensor data */
83 #define VEHICLESENS_DNUM_5 5 /* Number of sensor data */
84 #define VEHICLESENS_DNUM_7 7 /* Number of sensor data */
86 #define VEHICLESENS_EXT_OFF 0 /* Normal delivery */
87 #define VEHICLESENS_EXT_ON 1 /* Extended delivery */
89 #if CONFIG_HW_PORTSET_TYPE_C
90 #define VEHICLESENS_OFFSET_GPS_NMEA 248 /* 8 + 240 */
93 /************************************************************************
94 * Typedef definitions *
95 ************************************************************************/
96 /* typedef u_int32 DID; */ /* Data ID */
98 /* Data Master Set Notification Function */
99 typedef void (*PFUNC_DMASTER_SET_N) (DID, u_int8, u_int8);
100 typedef void (*PFUNC_DMASTER_SET_SHARED_MEMORY) (DID, u_int8);
102 /************************************************************************
103 * Struct definitions *
104 ************************************************************************/
105 /*********************************************************************
106 * TAG : VEHICLESENS_DID_OFFSET_TBL
107 * ABSTRACT : Vehicle sensor data ID,Structure of each data in the offset table
108 ***********************************************************************/
110 DID ul_did; /* Data ID */
111 u_int16 us_offset; /* Offset value */
112 u_int8 uc_reserve[2]; /* Reserved */
113 } VEHICLESENS_DID_OFFSET_TBL;
115 /*********************************************************************
118 ***********************************************************************/
120 /************************************************************************
121 * Function prototype *
122 ************************************************************************/
123 u_int8 VehicleSensmemcmp(const void *, const void *, size_t);
124 int32 VehicleSensCheckDid(DID);
125 u_int16 VehicleSensGetDataMasterOffset(DID);
126 #if CONFIG_SENSOR_EXT_VALID /* Initial Sensor Support */
127 u_int16 VehicleSensGetDataMasterExtOffset(DID);
129 void VehicleSensSetGpsVersion(const SENSOR_MSG_GPSDATA_DAT *pstData);
130 void VehicleSensGetDebugPosDate(void* pBuf, u_int8 uc_get_method);
131 #endif // POSITIONING_SERVER_INCLUDE_SENSOR_VEHICLESENS_COMMON_H_