summaryrefslogtreecommitdiffstats
path: root/hal/positioning_hal/inc/GpsCommon
diff options
context:
space:
mode:
authorTadao Tanikawa <tanikawa.tadao@jp.panasonic.com>2020-11-20 23:36:23 +0900
committerTadao Tanikawa <tanikawa.tadao@jp.panasonic.com>2020-11-22 09:02:55 +0900
commit17cf21bcf8a2e29d2cbcf0a313474d2a4ee44f5d (patch)
tree582a9768558d9eaf261ca5df6136e9de54c95816 /hal/positioning_hal/inc/GpsCommon
parent9e86046cdb356913ae026f616e5bf17f6f238aa5 (diff)
Re-organized sub-directory by category
Since all the sub-directories were placed in the first level, created sub-directories, "hal", "module", and "service" for classification and relocated each component. Signed-off-by: Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com> Change-Id: Ifdf743ac0d1893bd8e445455cf0d2c199a011d5c
Diffstat (limited to 'hal/positioning_hal/inc/GpsCommon')
-rwxr-xr-xhal/positioning_hal/inc/GpsCommon/MDev_GpsRecv.h170
-rwxr-xr-xhal/positioning_hal/inc/GpsCommon/MDev_GpsRollOver.h34
-rwxr-xr-xhal/positioning_hal/inc/GpsCommon/MDev_Gps_Common.h187
-rwxr-xr-xhal/positioning_hal/inc/GpsCommon/MDev_Gps_Main.h311
-rwxr-xr-xhal/positioning_hal/inc/GpsCommon/MDev_Gps_Mtrx.h90
-rwxr-xr-xhal/positioning_hal/inc/GpsCommon/MDev_Gps_Nmea.h313
-rwxr-xr-xhal/positioning_hal/inc/GpsCommon/MDev_Gps_TimerCtrl.h113
7 files changed, 1218 insertions, 0 deletions
diff --git a/hal/positioning_hal/inc/GpsCommon/MDev_GpsRecv.h b/hal/positioning_hal/inc/GpsCommon/MDev_GpsRecv.h
new file mode 100755
index 0000000..6ea4787
--- /dev/null
+++ b/hal/positioning_hal/inc/GpsCommon/MDev_GpsRecv.h
@@ -0,0 +1,170 @@
+/*
+ * @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
+ *
+ * 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.
+ */
+/**
+* @file MDev_GpsRecv.h
+*/
+
+#ifndef INC_GPSCOMMON_MDEV_GPSRECV_H_
+#define INC_GPSCOMMON_MDEV_GPSRECV_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "gps_hal.h"
+#include "positioning_def.h"
+
+/*---------------------------------------------------------------------------*/
+// Define
+
+/* ++ GPS _CWORD82_ support */
+#define GPS__CWORD82__CMD_LEN_MAX 200
+/* -- GPS _CWORD82_ support */
+
+/* ++ GPS _CWORD82_ support */
+#define GPS__CWORD82__RET_START_SEQ_NONE 0 /* _CWORD82_ Start Sequence Determination Result = None */
+#define GPS__CWORD82__RET_START_SEQ_NMEA 1 /* _CWORD82_ Start Sequence Determination Result = NMEA */
+#define GPS__CWORD82__RET_START_SEQ_FULL 2 /* _CWORD82_ Start Sequence Determination Result = Full customization */
+#define GPS__CWORD82__RET_START_SEQ_BIN 3 /* _CWORD82_ Start Sequence Determination Result = Standard binary #GPF_60_024 */
+
+#define GPS_UBLOX_RET_START_SEQ_UBX 4 /* Ublox Start Sequence Decision Result = UBX Protocol (binary) */
+#define GPS__CWORD82__FULLBINARY_LEN GPS_CMD_FULLBIN_SZ /* _CWORD82_ Full Customization Instruction Length */
+
+#define GPS__CWORD82__NORMALBINARY_LEN 81 /* _CWORD82_ standard binary instruction length #GPF_60_024 */
+/* -- GPS _CWORD82_ support */
+
+/* Maximum size of serial data read */
+#define GPS_RCV_MAXREADSIZE (2048) /* Changed from 256 -> 2048 #01 */
+
+/* Receive data storage buffer size */
+#define GPS_RCV_RCVBUFSIZE 512 /* Maximum size of the command to be received must be larger than the maximum size */
+
+/* Max-size receive commands ID4:(188+8)byte */
+/* Analysis data buffer size */
+#define GPS_RCV_ANADATABUFSIZE (GPS_RCV_MAXREADSIZE + GPS_RCV_RCVBUFSIZE)
+
+/* Receive frame buffer size */
+#define GPS_RCV_RCVFRAMEBUFSIZE GPS_RCV_RCVBUFSIZE /* Maximum size of the command to be received must be larger than the maximum size */
+
+/* Reception notification data buffer size */
+#define GPS_RCV_SNDCMD_SIZE_MAX
+
+/* Common return values */
+#define GPS_RCV_RET_ERR_EXT (-4) /* External cause error */
+#define GPS_RCV_RET_ERR_SYSTEM (-3) /* System error */
+#define GPS_RCV_RET_ERR (-1) /* Abnormality */
+#define GPS_RCV_RET_NML 0 /* Normal */
+
+// Reception thread reception frame detection result
+#define GPS_RCV_FRMSRCH_ERR_FORMAT (-1) /* Frame format error */
+#define GPS_RCV_FRMSRCH_FIXED 0 /* Frame determination */
+#define GPS_RCV_FRMSRCH_NOT_FIXED 1 /* Frame undetermined */
+#define GPS_RCV_FRMSRCH_NO_DATA 2 /* No analysis data */
+
+// Result of receive thread receive frame analysis
+#define GPS_RCV_FRMANA_ERR_PRM (-3) /* Parameter error */
+#define GPS_RCV_FRMANA_ERR_FORMAT (-2) /* Frame format error */
+#define GPS_RCV_FRMANA_ERR_CS (-1) /* Sumcheck error */
+#define GPS_RCV_FRMANA_OK 0 /* Normal data */
+
+/* Serial reception event determination result */
+enum GpsRcvRet {
+ GPS_RCV_REVT_NML = 0, /* Receiving(Normal) */
+ GPS_RCV_REVT_ERR, /* Receiving(Error) */
+ GPS_RCV_REVT_NUM /* Number of events received */
+};
+
+// Error logging
+#define ERLG_SER_FRAMEERR "Serial Framing Error"
+#define ERLG_SER_OVERRUNERR "Serial Overrun Error"
+#define ERLG_SER_PARITYERR "Serial Parity Error"
+#define ERLG_RCVEV_JDGERR "DEV_Gps_Recv_JdgSerEvt error"
+#define ERLG_RCVDATA_SNDERR "DEV_Gps_Recv_SndRcvData error"
+#define ERLG_COMEVNT_WAITERR "WaitCommEvent error"
+
+/*---------------------------------------------------------------------------*/
+// Struct
+
+// Serial receive buffer structure
+typedef struct GPSRecvData {
+ u_int16 us_read_size; /* Serial data read data size */
+ u_int8 uc_reserve[2]; /* Preliminary */
+ u_int8 uc_read_data[GPS_RCV_MAXREADSIZE]; /* Serial read data */
+} TG_GPS_RECV_RcvData;
+
+// Receive data storage buffer structure
+typedef struct GPSRecvBuf {
+ u_int16 r_size; /* Received size */
+ u_int8 rsv[2]; /* Reserved */
+ u_int8 r_buf[GPS_RCV_RCVBUFSIZE]; /* Receive command data */
+} TG_GPS_RECV_RcvBuf;
+
+// Data analysis buffer
+typedef struct GPSRecvAnaDataBuf {
+ u_int16 datsize; /* Size of the data */
+ u_int16 offset; /* Analysis start offset */
+ u_int8 datbuf[GPS_RCV_ANADATABUFSIZE]; /* Analysis data */
+} TG_GPS_RECV_AnaDataBuf;
+
+// Receive frame buffer
+typedef struct GPSRecvFrameBuf {
+ u_int16 size; /* Frame-size */
+ u_int8 rsv[2]; /* Reserved */
+ u_int8 buf[GPS_RCV_RCVFRAMEBUFSIZE]; /* Command data */
+} TG_GPS_RECV_RcvFrameBuf;
+
+/*---------------------------------------------------------------------------*/
+// External variable
+
+extern TG_GPS_RECV_RcvData g_gps_rcvdata; /* Serial receive buffer */
+extern TG_GPS_RECV_RcvBuf g_gps_rcvbuf; /* Receive data storage buffer */
+extern TG_GPS_RECV_AnaDataBuf g_gps_ana_databuf; /* Analysis data buffer */
+extern TG_GPS_RECV_RcvFrameBuf g_gps_rcv_framebuf; /* Receive frame buffer */
+extern u_int16 g_wrecv_err; /* Number of reception errors */
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+/* Initializing process */
+void DevGpsRecvInit(void);
+
+/* Buffer clear processing */
+void DevGpsRecvClrRcvBuf(void);
+
+/* Receive (normal) receive processing */
+void DevGpsRecvRcvNormal(void);
+
+/* Data reception processing */
+int32 DevGpsRecvReadRcvData(TG_GPS_RECV_RcvData* pst_rcv_data);
+
+/* Frame detection processing */
+int32 DevGpsRecvSearchFrameData(const TG_GPS_RECV_AnaDataBuf *adbuf_p, u_int16 *ana_size);
+
+/* Receive data transmission processing */
+void DevGpsRecvSndRcvData(const TG_GPS_RECV_RcvFrameBuf *p_frame_buf);
+
+/* Acknowledgement */
+RET_API DevRcvData(const TG_GPS_RCV_DATA* ptg_rcv_data);
+
+/* Pos_Gps_Recv Thread Stop Processing */
+void DevGpsRecvThreadStopProcess(void);
+
+EFrameworkunifiedStatus DevGpsRecvThread(HANDLE h_app);
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_GPSCOMMON_MDEV_GPSRECV_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/hal/positioning_hal/inc/GpsCommon/MDev_GpsRollOver.h b/hal/positioning_hal/inc/GpsCommon/MDev_GpsRollOver.h
new file mode 100755
index 0000000..22da3c9
--- /dev/null
+++ b/hal/positioning_hal/inc/GpsCommon/MDev_GpsRollOver.h
@@ -0,0 +1,34 @@
+/*
+ * @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
+ *
+ * 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.
+ */
+/**
+* @file MDev_GpsRollOver.h
+*/
+#ifndef INC_GPSCOMMON_MDEV_GPSROLLOVER_H_
+#define INC_GPSCOMMON_MDEV_GPSROLLOVER_H_
+
+#include <vehicle_service/WPF_STD.h>
+
+typedef struct TimRolovrYMD {
+ u_int16 year;
+ u_int16 month;
+ u_int16 day;
+ u_int8 dummy[2];
+} TG_TIM_ROLOVR_YMD;
+
+
+void GPSRollOverConvTime(TG_TIM_ROLOVR_YMD* base_ymd, TG_TIM_ROLOVR_YMD* conv_ymd, u_int8 gpsweekcorcnt);
+
+#endif // INC_GPSCOMMON_MDEV_GPSROLLOVER_H_
diff --git a/hal/positioning_hal/inc/GpsCommon/MDev_Gps_Common.h b/hal/positioning_hal/inc/GpsCommon/MDev_Gps_Common.h
new file mode 100755
index 0000000..7812858
--- /dev/null
+++ b/hal/positioning_hal/inc/GpsCommon/MDev_Gps_Common.h
@@ -0,0 +1,187 @@
+/*
+ * @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
+ *
+ * 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.
+ */
+/**
+* @file MDev_Gps_Common.h
+*/
+
+#ifndef INC_GPSCOMMON_MDEV_GPS_COMMON_H_
+#define INC_GPSCOMMON_MDEV_GPS_COMMON_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "positioning_def.h"
+#include "MDev_Gps_Main.h"
+
+/*---------------------------------------------------------------------------*/
+// Define
+
+#define NMEA_CHECKSUM_CHAR '*' /* *## (HEX) */
+#define NMEA_DATA_SEPARATOR ','
+
+#define GPS_NMEA_FIELD_LEN_MAX (GPS_NMEA_MAX_SZ)
+
+// NMEA GGA Sentence
+/* Fix Status */
+#define GPS_NMEA_GGA_FIX_STATUS_NON 0 /* invalid */
+#define GPS_NMEA_GGA_FIX_STATUS_GPS 1 /* GPS SPS Mode, Fix valid */
+#define GPS_NMEA_GGA_FIX_STATUS_DGPS 2 /* DGPS SPS Mode, Fix valid */
+#define GPS_NMEA_GGA_FIX_STATUS_DR 6 /* Estimated/Dead Reckoning */
+/* Field No */
+#define GPS_NMEA_FNO_GGA_FS 6
+#define GPS_NMEA_FNO_GGA_MSL 9
+
+/* number of SV Fields */
+#define GPS_NMEA_NUM_GSA_SV 12
+/* Fix Status */
+#define GPS_NMEA_GSA_FIX_STS_NON 1
+#define GPS_NMEA_GSA_FIX_STS_2D 2
+#define GPS_NMEA_GSA_FIX_STS_3D 3
+/* Field No */
+#define GPS_NMEA_FNO_GSA_FS 2
+#define GPS_NMEA_FNO_GSA_SV 3
+
+/* number of Satellite Infomation Fields (sv+elv+az+cno) */
+#define GPS_NMEA_NUM_GSV_SINFO 4
+ /* Field No */
+#define GPS_NMEA_FNO_GSV_NOSV 3
+#define GPS_NMEA_FNO_GSV_SV 4
+#define GPS_NMEA_FNO_GSV_ELV 5
+#define GPS_NMEA_FNO_GSV_AZ 6
+#define GPS_NMEA_FNO_GSV_CNO 7
+
+#define GPS_NMEA_RMC_STS_INVALID 'V'
+#define GPS_NMEA_RMC_STS_VALID 'A'
+#define GPS_NMEA_RMC_IND_NORTH 'N'
+#define GPS_NMEA_RMC_IND_EAST 'E'
+
+/* Field No */
+#define GPS_NMEA_FNO_RMC_UTC 1
+#define GPS_NMEA_FNO_RMC_STATUS 2
+#define GPS_NMEA_FNO_RMC_LATITUDE 3
+#define GPS_NMEA_FNO_RMC_NS 4
+#define GPS_NMEA_FNO_RMC_LONGITUDE 5
+#define GPS_NMEA_FNO_RMC_EW 6
+#define GPS_NMEA_FNO_RMC_SPEED 7
+#define GPS_NMEA_FNO_RMC_COG 8
+#define GPS_NMEA_FNO_RMC_DATE 9
+
+// Diag Fix Count
+#define GPS_DIAG_FIX_COUNT_3D (0x01)
+#define GPS_DIAG_FIX_COUNT_2D (0x02)
+#define GPS_DIAG_FIX_COUNT_ELSE (0x04)
+
+/* GPS time setting related */
+#define GPS_SETTIME_RANGE 5 /* 5 seconds : Valid range of GPS time setting */
+#define GPS_TIME_RANGE 10 /* 10 seconds : GPS time change range */
+
+/* NAV-SVINFO logging status */
+#define GPS_NAVSVINFO_STS_INIT 0
+#define GPS_NAVSVINFO_STS_READY 1
+#define GPS_NAVSVINFO_STS_DONE 2
+#define GPS_NAVSVINFO_STS_SETTING 3
+
+/* Time setting information */
+#define GPS_TIME_RX 0 /* Time not set */
+#define GPS_TIME_ROLOVR 1 /* First GPS reception(for rollover) */
+#define GPS_TIME_SET 2 /* Time setting in progress */
+
+/*!
+ @brief Satellite position information
+*/
+typedef struct GpsSatelliteInfoStr {
+ uint8_t sv; /* Satellite number */
+ uint8_t elv; /* Height 0-99 */
+ uint16_t az; /* Orientation 0-359 */
+ uint8_t cno; /* Signal strength */
+ uint8_t sts; /* Reception status */
+} GpsSatelliteInfo;
+
+/*---------------------------------------------------------------------------*/
+// Global values
+
+extern BOOL g_gps_rcv_thread_stop;
+extern uint8_t g_is_gpstime_sts;
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+void ChangeStatusGpsCommon(u_int32 sts);
+void RtyResetGpsCommon(void);
+void SendRtyResetGpsCommon(void);
+void SendReqGpsCommon(void);
+void GPSResetReqGpsCommon(void);
+void CyclDataTimeOutGpsCommon(void);
+RET_API CheckFrontStringPartGpsCommon(const u_char *p_tartget, const u_char *p_start);
+int32 JudgeFormatGpsCommon(u_char *p_send_data, u_int32 ul_length, TG_GPS_OUTPUT_FORMAT *p_format);
+RET_API CheckSumGpsCommon(const u_int8 p_uc_data[], u_int32 ul_length, TG_GPS_OUTPUT_FORMAT e_cmd_info);
+u_int8 AtoHGpsCommon(u_int8 ascii);
+RET_API DevGpsSaveCmd(TG_GPS_SAVECMD *p_send_data);
+void SendSaveCmdGpsCommon(void);
+void DeleteSaveCmdGpsCommon(void);
+void DeleteAllSaveCmdGpsCommon(void);
+void RcvCyclCmdNmeaGpsCommon(u_int8 *p_uc_data, u_int32 ul_len, TG_GPS_OUTPUT_FORMAT s_output_format);
+int32 CheckSendCmdGpsCommon(const u_char *p_rcv_data, u_int32 ul_length, TG_GPS_OUTPUT_FORMAT *p_format);
+int32_t GetStringFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, char* p_dst, size_t size);
+double GetNumericFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid);
+int32 GetIntegerFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src);
+int32 GetLonLatFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid);
+u_int16 GetHeadingFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid);
+int32 GetAltitudeFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid);
+u_int16 GetSpeedFromNmeaGpsCommon(u_int8 field_number, u_int8 *p_src, BOOL *p_valid);
+void StopThreadGpsCommon(void);
+uint8_t JudgeFormatOrderGpsCommon(TG_GPS_OUTPUT_FORMAT s_format_1, TG_GPS_OUTPUT_FORMAT s_format_2);
+ENUM_GPS_NMEA_INDEX GetNmeaIdxGpsCommon(TG_GPS_OUTPUT_FORMAT s_output_format);
+void SendResetReqGpsCommon(void);
+
+
+void WriteGpsTimeToBackup(uint8_t flag, POS_DATETIME* pst_datetime);
+void DevGpsCommSettingTime(void);
+RET_API GpsSetPosBaseEvent(uint16_t snd_pno, int32_t event_val);
+uint8_t HardResetChkGpsCommon(void);
+void RcvCyclCmdExtGpsCommon(u_int8 *p_data, u_int32 len, TG_GPS_OUTPUT_FORMAT format);
+
+BOOL DevGpsRcvProcGpsResetResp(TG_GPS_RCV_DATA*);
+void DevGpsRcvProcTimeSetResp(TG_GPS_RCV_DATA*);
+void DevGpsRcvProcWknRolloverGetResp(TG_GPS_RCV_DATA* p_data);
+void DevGpsRcvProcNavSvinfoAddResp(TG_GPS_RCV_DATA* p_data);
+void DevGpsReadGpsTime(POS_DATETIME* p_st_datetime);
+RET_API DevGpsRcvProcCmnResp(TG_GPS_RCV_DATA* p_data, uint8_t cmd);
+RET_API DevGpsResetReq(PNO us_pno, RID uc_rid);
+void DevGpsSettingTime(POS_DATETIME* p_st_datetime);
+int DevGpsYMD2JD(int y, int m, int d);
+BOOL DevGpsYMD2GPSTIME(const int32 y, const int32 m, const int32 d,
+ const int32 hh, const int32 mm, const int32 ss,
+ u_int16* gpsw, u_int32* gpsws);
+void DevGpsSetChkSum(u_int8* uc_buffer, u_int32 ul_length);
+RET_API DevGpsCatPollReq(uint8_t *p_ublox_data, uint16_t kind);
+void DevGpsSetGpsweekcorcnt(void);
+RET_API DevGpsNavTimeUTCAddReq(void);
+RET_API DevGpsWknRolloverGetReq(void);
+BOOL DevGpsCheckGpsTime(uint16_t set_gpsw, uint32_t set_gpsws,
+ uint16_t rcv_gpsw, uint32_t rcv_gpsws, int32_t offset_range);
+
+void DevGpsCnvLonLatNavi(SENSORLOCATION_LONLATINFO_DAT* p_lonlat,
+ u_int8 fix_sts, int32 lon, int32 lat);
+void DevGpsCnvAltitudeNavi(SENSORLOCATION_ALTITUDEINFO_DAT* p_altitude,
+ u_int8 fix_sts, int32 alt);
+void DevGpsCnvHeadingNavi(SENSORMOTION_HEADINGINFO_DAT* p_heading,
+ u_int8 fix_sts, u_int16 heading);
+/*---------------------------------------------------------------------------*/
+#endif // INC_GPSCOMMON_MDEV_GPS_COMMON_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/hal/positioning_hal/inc/GpsCommon/MDev_Gps_Main.h b/hal/positioning_hal/inc/GpsCommon/MDev_Gps_Main.h
new file mode 100755
index 0000000..d40cb0c
--- /dev/null
+++ b/hal/positioning_hal/inc/GpsCommon/MDev_Gps_Main.h
@@ -0,0 +1,311 @@
+/*
+ * @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
+ *
+ * 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.
+ */
+/**
+* @file MDev_Gps_Main.h
+*/
+
+#ifndef INC_GPSCOMMON_MDEV_GPS_MAIN_H_
+#define INC_GPSCOMMON_MDEV_GPS_MAIN_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "gps_hal.h"
+#include "positioning_def.h"
+
+// #include "gps_hal.h"
+// #include "MDev_Gps_Nmea.h"
+// #include "LineSensDrv_Api.h"
+
+/*---------------------------------------------------------------------------*/
+// Value define
+
+#define OFF 0 /* OFF */
+#define ON 1 /* ON */
+#define OK 0 /* Normal */
+#define NG (-1L) /* Abnormality */
+#define DAT_END 0xff /* Exit code */
+
+// State
+typedef enum GpsMatrixSts {
+ GPS_STS_STARTUP = 0, /* Startup confirmation */
+ GPS_STS_NORMAL, /* In operation */
+ GPS_STS_SENT, /* Command sent status */
+ GPS_STS_NUM
+}TG_GPS_MATRIX_STS;
+
+// Event
+typedef enum GpsMatrixEvt {
+ GPS_EVT_SENDREQ = 0, /* Transmission request */
+ GPS_EVT_RESETREQ, /* GPS reset request */
+ GPS_EVT_RECVCYCLDAT, /* Cyclic reception command reception */
+ GPS_EVT_RECVRSPDAT, /* Receive response command */
+ GPS_EVT_TIMEOUT_RSPDAT, /* Response monitoring timeout */
+ GPS_EVT_TIMEOUT_CYCLDAT, /* Periodic reception data monitoring timeout */
+ GPS_EVT_TIMEOUT_NAVI, /* Navigation providing data monitoring timeout */
+ GPS_EVT_TIMEOUT_DIAGCLKGUARD, /* Diagnosis provision time guard monitoring timeout*/
+ GPS_EVT_ACC_OFF, /* In-function ACC-OFF instructions */
+ GPS_EVT_NAVI_LOCATIONINFO, /* Providing navigation information */
+ GPS_EVT_NAVI_SPEEDINFO, /* Navigation speed information service */
+ GPS_EVT_TIMESETTING, /* GPS time setting instruction */
+ GPS_EVT_TIMEOUT_NMEADATAGUARD, /* NMEA data-providing guard monitoring timeout*/
+ GPS_EVT_BACKUPDATA_LOAD, /* Backup data read request */
+ GPS_EVT_STOPREQ, /* Thread stop request */
+ GPS_EVT_WEEKCOR_CNT_NOTIFICATIO, /* GPS Week Adjustment Counter Notification */
+ GPS_EVT_TIMEOUT_RECOVERY, /* GPS error monitoring reset timer */
+ GPS_EVT_TIMEOUT_RECEIVERERR, /* GPS receiver anomaly detection timeout */
+ GPS_EVT_NUM
+} TG_GPS_MATRIX_EVT;
+
+typedef enum GpsOutputFormat {
+ GPS_FORMAT_MIN = -1, /* Minimum Receive Format(Initialization) */
+ GPS_FORMAT_BINARY, /* Standard binary */
+ GPS_FORMAT_FULLBIN, /* Full binary */
+ GPS_FORMAT_GGA, /* GGA */
+ GPS_FORMAT_DGGA, /* DGGA */
+ GPS_FORMAT_VTG, /* VTG */
+ GPS_FORMAT_RMC, /* RMC */
+ GPS_FORMAT_DRMC, /* DRMC */
+ GPS_FORMAT_GLL, /* GLL */
+ GPS_FORMAT_DGLL, /* DGLL */
+ GPS_FORMAT_GSA, /* GSA */
+ GPS_FORMAT_GSV1, /* GSV(1) */
+ GPS_FORMAT_GSV2, /* GSV(2) */
+ GPS_FORMAT_GSV3, /* GSV(3) */
+ GPS_FORMAT_GSV4, /* GSV(4) */
+ GPS_FORMAT_GSV5, /* GSV(5) */
+ GPS_FORMAT_GST, /* GST */
+ GPS_FORMAT__CWORD44__GP3, /* _CWORD44_,GP,3 */
+ GPS_FORMAT__CWORD44__GP4, /* _CWORD44_,GP,4 */
+ GPS_FORMAT_P_CWORD82_F_GP0, /* P_CWORD82_F,GP,0 */
+ GPS_FORMAT_P_CWORD82_J_GP1, /* P_CWORD82_J,GP,1 */
+ GPS_FORMAT_P_CWORD82_I_GP, /* P_CWORD82_I,GP */
+ GPS_FORMAT_P_CWORD82_E_GP0, /* P_CWORD82_E,GP,0 */
+ GPS_FORMAT_P_CWORD82_J_GP0, /* P_CWORD82_J,GP,0 */
+ GPS_FORMAT_P_CWORD82_E_GP2, /* P_CWORD82_E,GP,2 */
+ GPS_FORMAT_P_CWORD82_G_GP0, /* P_CWORD82_G,GP,0 */
+ GPS_FORMAT_P_CWORD82_J_GP7, /* P_CWORD82_J,GP,7 */
+ GPS_FORMAT_P_CWORD82_J_GP8, /* P_CWORD82_J,GP,8 */
+ GPS_FORMAT_MON_VER, /* MON-VER */
+ GPS_FORMAT_AID_INI, /* AID-INI */
+ GPS_FORMAT_ACK_ACKNACK, /* ACK-ACKNACK */
+ GPS_FORMAT_NAV_TIMEUTC, /* NAV-TIMEUTC */
+ GPS_FORMAT_NAV_CLOCK, /* NAV-CLOCK */
+ GPS_FORMAT_RXM_RTC5, /* RXM-RTC5 */
+ GPS_FORMAT_NAV_SVINFO, /* NAV-SVINFO */
+ GPS_FORMAT_CFG_NAVX5, /* CFG-NAVX5 */
+ GPS_FORMAT_NMEA, /* NMEA (Sentence unspecified) */
+ GPS_FORMAT_UBX, /* UBX Protocol (binary) */
+ GPS_FORMAT_MAX /* Maximum Receive Format */
+} TG_GPS_OUTPUT_FORMAT;
+
+// Return value
+#define RETRY_OFF 0 /* No retry */
+#define RETRY_ON 1 /* Retry exists */
+#define RETRY_OUT 2 /* Retry out */
+#define NG_RETRYOUT 4 /* Transmission failure retry out */
+
+#define GPSRET_NOPCMD (0) /* Non notification target command #GPF_60_024 */
+#define GPSRET_SNDCMD (1) /* Notification target command #GPF_60_024 */
+#define GPSRET_CMDERR (-1) /* No applicable command #GPF_60_024 */
+
+// Number of Retries
+#define SRSET_MAX 4 /* Maximum serial reset retry value */
+#define HRSET_MAX 3 /* Maximum value of hard reset retry */
+#define SNDNG_MAX 4 /* Maximum retry value of transmission failure */
+
+/* The actual number of retries is SNDNG_MAX-1. */
+#define GPS_RECV_ERR_MAX 5 /* Maximum number of reception errors #GPF_60_024 */
+
+// Others
+#define SAV_MAX 11
+#define GPS_ALTITUDE_INVALID_VAL (-1000000) /* Value when fix altitude is invalid */
+#define GPS_HEADING_INVALID_VAL 36100 /* Value when measurement orientation is invalid */
+
+#define GPS_RECVOK 0 /* Normal reception #13 */
+#define GPS_RECVNG 1 /* Reception error #13 */
+#define GPS_OVERRUN 2 /* Overrun detection #13 */
+#define GPS_PARITY 3 /* Parity detection #13 */
+#define GPS_FRAMING 4 /* Framing detection #13 */
+
+// For the communication management thread
+#define GPS_NON_RECV 0 /* Not received */
+#define GPS_RECV_ACK 1 /* ACK received */
+#define GPS_RECV_DATA 2 /* Receive response command */
+
+#define GPS_SEND_ERR_MAX 5 /* Maximum number of transmission errors */
+#define GPS_CNCT_ERR_MAX 5 /* Maximum number of connection errors */
+
+#define GPS_START_EVT "GPS_EVT" /* Interthread synchronization events */
+#define GPS_EVT_VAL 99 /* Event settings */
+#define GPS_MSGDAT_BUF_SZ 500 /* Receive message buffer size */
+
+// Definition for receive command analysis table #GPF_60_024
+#define SENTENCE_STR_MAX 12 /* Maximum string for judging sentence */
+
+#define SENSOR_MSG_VSINFO_DSIZE 1904 //!< \~english message body max size
+
+/*---------------------------------------------------------------------------*/
+// Structure
+
+/********************************************************************************
+ * TAG :TG_GPS_MNG
+ * ABSTRACT :GPS process management information
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsMng {
+ u_int32 sts; /* Matrix state */
+ u_int32 event; /* Matrix event code */
+ u_int32 rcvsts; /* Response reception status */
+ u_int32 sndcnt; /* Number of transmission attempts */
+ u_int32 hrsetcnt; /* Number of tries before hard reset */
+ u_int32 sndngcnt; /* Number of failed-to-send attempts */
+ TG_GPS_OUTPUT_FORMAT rcv_cmd; /* Types of received GPS commands */
+ TG_GPS_OUTPUT_FORMAT resp_cmd; /* Types of GPS commands during response monitoring */
+ PNO resp_pno; /* Destination PNO */
+ RID resp_rid; /* RID to be notified when responding */
+ u_int8 resp_rst_flag; /* Response command reset flag */
+ BOOL rcv_err_flag; /* GPS receiver error detection flag */
+} TG_GPS_MNG;
+
+/********************************************************************************
+ * TAG :TG_GPS_SAVECMD
+ * ABSTRACT :GPS process pending command
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsSaveCmd {
+ TG_GPS_SND_DATA sndcmd; /* Sending commands(_CWORD82_ command) */
+ PNO us_pno; /* Result notification destination process number(Unused) */
+ RID uc_rid; /* Result Notification Resource ID(Unused) */
+ u_int8 uc_rst; /* Reset flag */
+ TG_GPS_OUTPUT_FORMAT e_cmd_info; /* Command information */
+} TG_GPS_SAVECMD;
+
+/********************************************************************************
+ * TAG :TG_GPS_SAVEBUF
+ * ABSTRACT :GPS process pending buffer management information
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsSaveBuf {
+ u_int32 saveno; /* Current pending index number */
+ u_int32 sendno; /* Current send index number */
+ u_int32 bufsav; /* Number of pending buffers used */
+ TG_GPS_SAVECMD savebuf[SAV_MAX]; /* Pending buffer */
+} TG_GPS_SAVEBUF;
+
+/********************************************************************************
+ * TAG :TG_GPS_MSGRCV
+ * ABSTRACT :Receive message
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsMsgRcv {
+ T_APIMSG_MSGBUF_HEADER header; /* Message header */
+ u_int8 msgdat[SENSOR_MSG_VSINFO_DSIZE + 12];
+} TG_GPS_MSGRCV;
+
+/********************************************************************************
+ * TAG :TG_GPS_MSGEVTCHNG
+ * ABSTRACT :GPS message event translation table
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsMsgEvtChng {
+ u_int32 cid; /* Matrix state */
+ u_int32 event; /* Matrix event code */
+} TG_GPS_MSGEVTCHNG;
+
+/********************************************************************************
+ * TAG :TG_GPS_TIMEVTCHNG
+ * ABSTRACT :GPS timer ID and event translation table
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsTimEvtChng {
+ u_int16 tim_id; /* Timer ID information */
+ u_int16 reserve; /* Reserved */
+ u_int32 event; /* Matrix event code */
+} TG_GPS_TIMEVTCHNG;
+
+/********************************************************************************
+ * TAG :Gps_Jmp_Tbl
+ * ABSTRACT :GPS jump table
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsJmpTbl {
+ void (*func)( void ); /* Jump-to module */
+} TG_GPS_JMP_TBL;
+
+/********************************************************************************
+ * TAG :TG_GPS_CMD_ANA_TBL
+ * ABSTRACT :Receive command analysis table structure
+ * NOTE :
+ ********************************************************************************/
+typedef struct TgGpsCmdAnaTbl {
+ u_char c_sentence[SENTENCE_STR_MAX]; /* Sentence identifier */
+ u_int32 ul_length; /* Length of the command */
+ u_int32 ul_rcv_kind; /* Receiving type */
+ BOOL b_snd_cmd_flg; /* Command notification flag */
+ TG_GPS_OUTPUT_FORMAT e_rcv_format; /* Receive Format */
+} TG_GPS_CMD_ANA_TBL;
+
+/********************************************************************************
+ * TAG :TG_GPS_TIME_BCD
+ * ABSTRACT :Time information (BCD) structure
+ * NOTE :
+ ********************************************************************************/
+typedef struct GpsTimeBCD {
+ u_int8 uc_year; /* Year information */
+ u_int8 uc_month; /* Month information */
+ u_int8 uc_day; /* Day information */
+ u_int8 uc_hour; /* Time information */
+ u_int8 uc_min; /* Minute information */
+ u_int8 uc_sec; /* Second information */
+} TG_GPS_TIME_BCD;
+
+/*---------------------------------------------------------------------------*/
+// Global values
+
+#define MDEV_GPSMSGCHKC_MAX 10
+#define MDEV_PSTIMCHKC_MAX 11
+extern const TG_GPS_MSGEVTCHNG kGpsMsgchkC[MDEV_GPSMSGCHKC_MAX]; /* Ignore -> MISRA-C:2004 Rule 8.12 */
+extern const TG_GPS_TIMEVTCHNG kGpsTimchkC[MDEV_PSTIMCHKC_MAX]; /* Ignore -> MISRA-C:2004 Rule 8.12 */
+extern const TG_GPS_JMP_TBL kGpsMatxC[GPS_STS_NUM][GPS_EVT_NUM];
+
+#define MDEV_GPSCMDANATBLNMEA_MAX 20
+extern const TG_GPS_CMD_ANA_TBL* kGpsCmdAnaTbl;
+extern const TG_GPS_CMD_ANA_TBL kGpsCmdAnaTblUblox[MDEV_GPSCMDANATBLNMEA_MAX];
+
+extern TG_GPS_SAVEBUF g_gps_save_cmdr;
+extern TG_GPS_MSGRCV g_gps_msg_rcvr;
+extern TG_GPS_MNG g_gps_mngr;
+
+extern u_int16 g_wsend_err; /* Number of transmission errors */
+extern u_int16 g_wcnct_err; /* Number of connection errors */
+extern TG_GPS_OUTPUT_FORMAT g_rcv_format; /* Receive Format */
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+EFrameworkunifiedStatus DevGpsMainThread(HANDLE h_app);
+BOOL DevGpsInit(void);
+void DevGpsRcvMsg(void);
+void DevGpsMsgEventCheck(void);
+void DevGpsTimEventCheck(void);
+void DevGpsGpsVersionCheck(void);
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_GPSCOMMON_MDEV_GPS_MAIN_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/hal/positioning_hal/inc/GpsCommon/MDev_Gps_Mtrx.h b/hal/positioning_hal/inc/GpsCommon/MDev_Gps_Mtrx.h
new file mode 100755
index 0000000..610b8d4
--- /dev/null
+++ b/hal/positioning_hal/inc/GpsCommon/MDev_Gps_Mtrx.h
@@ -0,0 +1,90 @@
+/*
+ * @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
+ *
+ * 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.
+ */
+/**
+* @file MDev_Gps_Mtrx.h
+*/
+
+#ifndef INC_GPSCOMMON_MDEV_GPS_MTRX_H_
+#define INC_GPSCOMMON_MDEV_GPS_MTRX_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+void DevGpsNop(void);
+void DevGpsInitStartSendReq(void);
+void DevGpsInitStartGPSResetReq(void);
+void DevGpsInitStartRcvCyclCmd(void);
+void DevGpsInitStartCyclDataTimeOut(void);
+void DevGpsInitStartNaviDataTimeOut(void); /* #GPF_60_077 */
+void DevGpsInitStartDiagClkGuardTimeOut(void); /* #GPF_60_077 */
+void DevGpsInitStartAccOffStart(void); /* #GPF_60_024 */
+void DevGpsInitStartNaviInfoDeliver(void); /* #GPF_60_077 */
+void DevGpsInitStartNaviSpeedDeliver(void); /* #GPF_60_077 */
+void DevGpsInitStartSettingTime(void); /* #GPF_60_077 */
+void DevGpsInitStartNmeaDataGuardTimeOut(void); /* #GPF_60_109 */
+
+void DevGpsInitStartBackupDataLoadReq(void);
+void DevGpsInitStartStopReq(void);
+void DevGpsInitStartGpsweekcorcntNtf(void);
+void DevGpsInitStartRecoveryTimeOut(void);
+void DevGpsInitStartGpsReceiverErrTimeOut(void);
+
+void DevGpsNormalSendReq(void);
+void DevGpsNormalGPSResetReq(void);
+void DevGpsNormalRcvCyclCmd(void);
+void DevGpsNormalCyclDataTimeOut(void);
+void DevGpsNormalNaviDataTimeOut(void); /* #GPF_60_077 */
+void DevGpsNormalDiagClkGuardTimeOut(void); /* #GPF_60_077 */
+void DevGpsNormalAccOffStart(void); /* #GPF_60_024 */
+void DevGpsNormalNaviInfoDeliver(void); /* #GPF_60_077 */
+void DevGpsNormalNaviSpeedDeliver(void); /* #GPF_60_077 */
+void DevGpsNormalSettingTime(void); /* #GPF_60_077 */
+void DevGpsNormalNmeaDataGuardTimeOut(void); /* #GPF_60_109 */
+
+void DevGpsNormalBackupDataLoadReq(void);
+void DevGpsNormalStopReq(void);
+void DevGpsNormalGpsweekcorcntNtf(void);
+void DevGpsNormalRecoveryTimeOut(void);
+void DevGpsNormalGpsReceiverErrTimeOut(void);
+
+void DevGpsSendSendReq(void);
+void DevGpsSendGPSResetReq(void);
+void DevGpsSendRcvCyclCmd(void);
+void DevGpsSendRcvRspCmd(void); /* #GPF_60_040 */
+void DevGpsSendRspDataTimeOut(void); /* #GPF_60_040 */
+void DevGpsSendCyclDataTimeOut(void);
+void DevGpsSendNaviDataTimeOut(void); /* #GPF_60_077 */
+void DevGpsSendDiagClkGuardTimeOut(void); /* #GPF_60_077 */
+void DevGpsSendAccOffStart(void); /* #GPF_60_040 */
+void DevGpsSendNaviInfoDeliver(void); /* #GPF_60_077 */
+void DevGpsSendNaviSpeedDeliver(void); /* #GPF_60_077 */
+void DevGpsSendSettingTime(void); /* #GPF_60_077 */
+void DevGpsSendNmeaDataGuardTimeOut(void); /* #GPF_60_109 */
+
+void DevGpsSendBackupDataLoadReq(void);
+void DevGpsSendStopReq(void);
+void DevGpsSendGpsweekcorcntNtf(void);
+void DevGpsSendRecoveryTimeOut(void);
+void DevGpsSendGpsReceiverErrTimeOut(void);
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_GPSCOMMON_MDEV_GPS_MTRX_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/hal/positioning_hal/inc/GpsCommon/MDev_Gps_Nmea.h b/hal/positioning_hal/inc/GpsCommon/MDev_Gps_Nmea.h
new file mode 100755
index 0000000..a19e3d9
--- /dev/null
+++ b/hal/positioning_hal/inc/GpsCommon/MDev_Gps_Nmea.h
@@ -0,0 +1,313 @@
+/*
+ * @copyright Copyright (c) 2017-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
+ *
+ * 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.
+ */
+/**
+* @file MDev_GpsUblox.h
+*/
+
+#ifndef INC_GPSCOMMON_MDEV_GPS_NMEA_H_
+#define INC_GPSCOMMON_MDEV_GPS_NMEA_H_
+
+/*---------------------------------------------------------------------------*/
+
+#include "gps_hal.h"
+#include "positioning_def.h"
+
+/*---------------------------------------------------------------------------*/
+// Value define
+
+#define TEST_NMEA (0) /* 0:Normal mode 1:Testing mode */
+
+#define GPS_MAX_NUM_VISIBLE_SATELLITES (20) /* Maximum Number of Visible Satellites *Assume the GSV1~GSV5 */
+
+/* UBX command *****************************/
+
+/* CFG */
+#define UBX_CMD_SIZE_CFG_RST (12) /* size of CFG-RST of UBX sentences */
+#define UBX_CMD_SIZE_CFG_MSG (11) /* size of CFG-MSG of UBX sentences */
+#define UBX_CMD_SIZE_CFG_NAV5 (44) /* size of CFG-NAV5 of UBX sentences */
+#define UBX_CMD_SIZE_CFG_NAV5_POLL (8)
+#define UBX_CMD_SIZE_CFG_NAV5_PLUS_POLL (UBX_CMD_SIZE_CFG_NAV5 + UBX_CMD_SIZE_CFG_NAV5_POLL)
+#define UBX_CMD_SIZE_CFG_NAVX5_POLL (8)
+#define UBX_CMD_OFFSET_WKNROLLOVER (18) /* offset from the top of 'payload' */
+
+/* MON */
+#define UBX_CMD_SIZE_MON_VER (108) /* size of MON-VER of UBX sentences */
+#define UBX_CMD_SIZE_MON_VER_POLL (8)
+#define UBX_CMD_SIZE_MON_VER_SW_VER (30)
+
+/* AID */
+#define UBX_CMD_SIZE_AID_INI (56) /* size of AID-INI of UBX sentences */
+#define UBX_CMD_SIZE_AID_INI_POLL (8)
+#define UBX_CMD_SIZE_AID_INI_PLUS_POLL (UBX_CMD_SIZE_AID_INI + UBX_CMD_SIZE_AID_INI_POLL)
+
+/* ACK */
+#define UBX_CMD_OFFSET_ACKNAK (3) /* offset to Ack/Nack Infomation */
+
+/* NAV */
+#define UBX_CMD_MSK_NAV_TIMEUTC_VALID_TOW (1) /* mask bit for 'validTow' of NAV-TIMEUTC */
+#define UBX_CMD_MSK_NAV_TIMEUTC_VALID_WKN (2) /* mask bit for 'validKwn' of NAV-TIMEUTC */
+#define UBX_CMD_MSK_NAV_TIMEUTC_VALID_UTC (4) /* mask bit for 'validUtc' of NAV-TIMEUTC */
+
+/* Common */
+#define UBX_CMD_SIZE_HDR (2) /* size of 'header' of UBX sentence */
+#define UBX_CMD_SIZE_ID (2) /* size of 'id' of UBX sentence */
+#define UBX_CMD_SIZE_LEN (2) /* size of 'length' of UBX sentence */
+#define UBX_CMD_SIZE_MAX (400) /* size of NAV-SVINFO (numCh=32) */
+#define UBX_CMD_OFFSET_PAYLOAD (UBX_CMD_SIZE_HDR + UBX_CMD_SIZE_ID + UBX_CMD_SIZE_LEN)
+ /* offset to 'payload' of UBX sentence */
+
+/* Types of UBX Poll Request Commands ************/
+#define UBX_POLL_CMD_KIND_AID_INI (1)
+#define UBX_POLL_CMD_KIND_CFG_NAV5 (2)
+
+// GPS-command (_CWORD82_ NMEA) related definitions #GPF_60_024
+/* Command identification character string */
+#define GPS_CMD_NMEA_GGA ("$GPGGA") /* GGA/double precision GGAs */
+#define GPS_CMD_NMEA_VTG ("$GPVTG") /* VTG */
+#define GPS_CMD_NMEA_RMC ("$GPRMC") /* RMC/double precision RMCs */
+#define GPS_CMD_NMEA_GLL ("$GPGLL") /* GLL/double precision GLL */
+#define GPS_CMD_NMEA_GSA ("$GPGSA") /* GSA */
+#define GPS_CMD_NMEA_GSV_1 ("$GPGSV,*,1") /* GSV(1) */
+#define GPS_CMD_NMEA_GSV_2 ("$GPGSV,*,2") /* GSV(2) */
+#define GPS_CMD_NMEA_GSV_3 ("$GPGSV,*,3") /* GSV(3) */
+#define GPS_CMD_NMEA__CWORD44__GP_3 ("$_CWORD44_,GP,3") /* _CWORD44_,GP,3 */
+#define GPS_CMD_NMEA__CWORD44__GP_4 ("$_CWORD44_,GP,4") /* _CWORD44_,GP,4 */
+#define GPS_CMD_NMEA_P_CWORD82_F_GP_0 ("$P_CWORD82_F,GP,0") /* P_CWORD82_F,GP,0 */
+#define GPS_CMD_NMEA_P_CWORD82_J_GP_1 ("$P_CWORD82_J,GP,1") /* P_CWORD82_J,GP,1 */
+#define GPS_CMD_NMEA_P_CWORD82_I_GP ("$P_CWORD82_I,GP") /* P_CWORD82_I,GP */
+#define GPS_CMD_NMEA_P_CWORD82_E_GP_0 ("$P_CWORD82_E,GP,0") /* P_CWORD82_E,GP,0 */
+#define GPS_CMD_NMEA_P_CWORD82_J_GP_0 ("$P_CWORD82_J,GP,0") /* P_CWORD82_J,GP,0 */
+#define GPS_CMD_NMEA_P_CWORD82_E_GP_2 ("$P_CWORD82_E,GP,2") /* P_CWORD82_E,GP,2 */
+#define GPS_CMD_NMEA_P_CWORD82_G_GP_0 ("$P_CWORD82_G,GP,0") /* P_CWORD82_G,GP,0 */
+#define GPS_CMD_NMEA_P_CWORD82_J_GP_7 ("$P_CWORD82_J,GP,7") /* P_CWORD82_J,GP,7 */
+#define GPS_CMD_NMEA_P_CWORD82_J_GP_8 ("$P_CWORD82_J,GP,8") /* P_CWORD82_J,GP,8 */
+#define GPS_CMD_NMEA_GST ("$GPGST") /* GST */
+#define GPS_CMD_NMEA_GSV_4 ("$GPGSV,*,4") /* GSV(4) */
+#define GPS_CMD_NMEA_GSV_5 ("$GPGSV,*,5") /* GSV(5) */
+
+/*-------------------------------------------------------------------------------
+ * GPS-command (_CWORD82_ Binary) related definitions #GPF_60_024
+ -------------------------------------------------------------------------------*/
+#define GPS_CMD_BINARY (0xC6) /* Standard binary */
+#define GPS_CMD_FULLBIN (0xB0) /* FULL binaries */
+
+#define ENDMARK "ENDENDEND" /* Table termination */
+#define GPSCMDANATBL_MAX 25 /* Maximum number of elements in table */
+#define RCV_CYCLE 0x01 /* Reception type cycle reception command*/
+#define RCV_RESP 0x02 /* Reception type response command */
+
+// Length of FULLBINARY commands
+#define GPS_CMD_FULLBIN1_SZ 30
+#define GPS_CMD_FULLBIN2_SZ 160
+#define GPS_CMD_FULLBIN3_SZ 25
+#define GPS_CMD_FULLBIN4_SZ 26
+#define GPS_CMD_FULLBIN5_SZ 14
+#define GPS_CMD_FULLBIN6_SZ 61
+
+/* Start offset of FULLBINARY command */
+#define GPS_CMD_FULLBIN1_OFFSET 0
+#define GPS_CMD_FULLBIN2_OFFSET (GPS_CMD_FULLBIN1_OFFSET + GPS_CMD_FULLBIN1_SZ)
+#define GPS_CMD_FULLBIN3_OFFSET (GPS_CMD_FULLBIN2_OFFSET + GPS_CMD_FULLBIN2_SZ)
+#define GPS_CMD_FULLBIN4_OFFSET (GPS_CMD_FULLBIN3_OFFSET + GPS_CMD_FULLBIN3_SZ)
+#define GPS_CMD_FULLBIN5_OFFSET (GPS_CMD_FULLBIN4_OFFSET + GPS_CMD_FULLBIN4_SZ)
+#define GPS_CMD_FULLBIN6_OFFSET (GPS_CMD_FULLBIN5_OFFSET + GPS_CMD_FULLBIN6_SZ)
+
+
+/* SUM value offset of FULLBINARY commands */
+#define GPS_CMD_FULLBIN1_SUMOFFSET (GPS_CMD_FULLBIN1_OFFSET + GPS_CMD_FULLBIN1_SZ - 2)
+#define GPS_CMD_FULLBIN2_SUMOFFSET (GPS_CMD_FULLBIN2_OFFSET + GPS_CMD_FULLBIN2_SZ - 2)
+#define GPS_CMD_FULLBIN3_SUMOFFSET (GPS_CMD_FULLBIN3_OFFSET + GPS_CMD_FULLBIN3_SZ - 2)
+#define GPS_CMD_FULLBIN4_SUMOFFSET (GPS_CMD_FULLBIN4_OFFSET + GPS_CMD_FULLBIN4_SZ - 2)
+#define GPS_CMD_FULLBIN5_SUMOFFSET (GPS_CMD_FULLBIN5_OFFSET + GPS_CMD_FULLBIN5_SZ - 2)
+#define GPS_CMD_FULLBIN6_SUMOFFSET (GPS_CMD_FULLBIN6_OFFSET + GPS_CMD_FULLBIN6_SZ - 2)
+#define GPS_CMD_FULLBIN_MASK 0x8F
+
+#define GPS_CMD_RESET 1 /* Reset request command */
+#define GPS_CMD_TIMESET 2 /* Time setting request command */
+#define GPS_CMD_VERSION 3 /* GPS version request command */
+#define GPS_CMD_SENTENCEADD_NMEAGST 4 /* Add sentence command NMEA GST */
+#define GPS_CMD_SENTENCEADD_NAVTIMEUTC 5 /* Add sentence command NAV-TIMEUTC */
+#define GPS_CMD_SENTENCEADD_NAVCLOCK 6 /* Add sentence command NAV-CLOCK */
+#define GPS_CMD_SENTENCEADD_RXMRTC5 7 /* Add sentence command RXM-RTC5 */
+#define GPS_CMD_SENTENCEADD_NAVSVINFO 8 /* Add sentence command NAV-SVINFO */
+#define GPS_CMD_AUTOMOTIVEMODE 9 /* Automatic mode request command */
+#define GPS_CMD_WKNROLLOVER 10 /* GPS rollover standard week number request command */
+#define GPS_CMD_NOTRST 0 /* Other request command */
+
+/*---------------------------------------------------------------------------*/
+// Struct
+
+/*!
+ @brief UBX command headers
+*/
+typedef struct GpsUbxPacketHeader {
+ u_int8 uc_sync_char1; /* u-blox starts with 2 Bytes 0xB5 0x62 */
+ u_int8 uc_sync_char2; /* u-blox starts with 2 Bytes 0xB5 0x62 */
+ u_int8 uc_class; /* Class */
+ u_int8 uc_id; /* ID */
+ u_int16 us_length; /* Length */
+} TG_GPS_UBX_PACKET_HEADER;
+
+/*!
+ @brief Command-structure without UBX data
+*/
+typedef struct GpsUbxCmdNoData {
+ TG_GPS_UBX_PACKET_HEADER header;
+ u_int8 uc_cka; /* Checksum_A */
+ u_int8 uc_ckb; /* Checksum_B */
+} TG_GPS_UBX_COMMAND_NO_DATA;
+
+/*!
+ @brief
+*/
+typedef struct GpsUbxAidIniPolled {
+ u_int8 uc_sync_char1; /* u-blox starts with 2 Bytes 0xB5 0x62 */
+ u_int8 uc_sync_char2; /* u-blox starts with 2 Bytes 0xB5 0x62 */
+ u_int8 uc_class; /* Class */
+ u_int8 uc_id; /* ID */
+ u_int8 uc_length[2]; /* Length */
+ u_int8 uc_ecefx_or_lat[4]; /* WGS84 ECEF X coordinate or latitude */
+ u_int8 uc_ecefy_or_lon[4]; /* WGS84 ECEF Y coordinate or longitude */
+ u_int8 uc_ecefz_or_alt[4]; /* WGS84 ECEF Z coordinate or altitude */
+ u_int8 uc_pos_acc[4]; /* Position accuracy (stddev) */
+ u_int8 uc_tm_cfg[2]; /* Time mark configuration */
+ u_int8 wn[2]; /* Actual week number */
+ u_int8 tow[4]; /* Actual time of week */
+ u_int8 uc_tow_ns[4]; /* Sub-millisecond part of time of week */
+ u_int8 uc_tacc_ms[4]; /* Milliseconds part of time accuracy */
+ u_int8 uc_tacc_ns[4]; /* Nanoseconds part of time accuracy */
+ u_int8 uc_clk_d_or_freq[4]; /* Clock drift or frequency */
+ u_int8 uc_clk_dacc_or_freqacc[4]; /* Accuracy of clock drift or frequency */
+ u_int8 uc_flags[4]; /* Bitmask with the following flags */
+ u_int8 uc_cka; /* Checksum_A */
+ u_int8 uc_ckb; /* Checksum_B */
+} TG_GPS_UBX_AID_INI_POLLED;
+
+/*!
+ @brief UBX ACK command data structures
+*/
+typedef struct GpsUbxAckData {
+ uint8_t uc_msg_class; /* Message Class */
+ uint8_t uc_msg_id; /* Message Identifier */
+} TG_GPS_UBX_ACK_DATA;
+
+/*!
+ @brief UBX NAV-TIMEUTC command data structures
+*/
+typedef struct GpsUbxNavUTC {
+ uint32_t ul_itow; /* GPS time of week */
+ uint32_t ul_tacc; /* Time accuracy estimate (UTC) */
+ int32_t nano; /* Fraction of second */
+ uint16_t year; /* Year, range 1999..2099 (UTC) */
+ uint8_t month; /* Month, range 1..12 (UTC) */
+ uint8_t day; /* Day of month, range 1..31 (UTC) */
+ uint8_t hour; /* Hour of day, range 0..23 (UTC) */
+ uint8_t min; /* Minute of hour, range 0..59 (UTC) */
+ uint8_t sec; /* Seconds of minute, range 0..60 (UTC) */
+ uint8_t valid; /* Validity Flags */
+} TG_GPS_UBX_NAV_TIMEUTC_DATA;
+
+/*!
+ @brief USB NAV-CLOCK command data structures
+*/
+typedef struct GpsUbxNavClock {
+ uint32_t ul_itow; /**< GPS Time of week */
+ int32_t l_clkb; /**< Clock bias */
+ int32_t l_clkd; /**< Clock drift */
+ uint32_t ul_tacc; /**< Time accuaracy estimate */
+ uint32_t ul_facc; /**< Frequency accuracy estimate */
+} TG_GPS_UBX_NAV_CLOCK;
+
+/*!
+ @brief GPS RXM-RTC5 command data structures
+*/
+typedef struct GpsUbxRxmRtc5 {
+ uint32_t ul_rtag_hw; /**< RTAG high word */
+ uint32_t ul_rtag_lw; /**< RTAG low word */
+ uint32_t freq; /**< Clock frequency */
+ uint32_t ul_freq_frac; /**< Clock frequency fractional part */
+ uint32_t ul_tow_frac; /**< Time of week fractional part */
+ uint32_t tow; /**< Time of week */
+ uint16_t wno; /**< GPS week number */
+ uint8_t uc_tow_valid; /**< TOW is valid flag */
+ uint8_t uc_freq_valid; /**< Frequency is valid flag */
+} TG_GPS_UBX_RXM_RTC5;
+
+/********************************************************************************
+ * TAG :TG_GPS_RCVDATA_NMEA
+ * ABSTRACT :Cyclic data (NMEA) area
+ * NOTE :I/F information between communication management thread and vehicle sensor
+ ********************************************************************************/
+typedef struct GpsRcvDataNMEA {
+ u_int8 uc_rcv_flag[GPS_NMEA_INDEX_MAX]; /* Receive flag */
+ u_int8 u_reserve[3]; /* Reserved */
+ TG_GPS_NMEA_DAT st_nmea[GPS_NMEA_INDEX_MAX]; /* NMEA data area */
+} TG_GPS_RCVDATA_NMEA;
+
+/********************************************************************************
+ * TAG :TG_GPS_RCVDATA_BINARY
+ * ABSTRACT :Cyclic data (standard binary) area
+ * NOTE :I/F information between communication management thread and vehicle sensor
+ ********************************************************************************/
+typedef struct GpsRcvDataBinary {
+ u_int8 uc_rcv_flag; /* Receive flag */
+ u_int8 u_reserve[3]; /* Reserved */
+ u_int8 uc_data[GPS_CMD_BINARY_SZ]; /* Standard binary data area */
+ u_int8 u_reserve2[3]; /* Reserved */
+} TG_GPS_RCVDATA_BINARY;
+
+/********************************************************************************
+ * TAG :TG_GPS_RCVDATA_FULLBIN
+ * ABSTRACT :Cyclic data (full binary) area
+ * NOTE :I/F information between communication management thread and vehicle sensor
+ ********************************************************************************/
+typedef struct GpsRcvDataFullbin {
+ u_int8 uc_rcv_flag; /* Receive flag */
+ u_int8 u_reserve[3]; /* Reserved */
+ u_int8 uc_data[GPS_CMD_FULLBIN_SZ]; /* Full binary data area */
+ u_int8 u_reserve2; /* Reserved */
+} TG_GPS_RCVDATA_FULLBIN;
+
+/********************************************************************************
+ * TAG :TG_GPS_RCVDATA
+ * ABSTRACT :Cyclic data storage area
+ * NOTE :I/F information between communication management thread and vehicle sensor
+ ********************************************************************************/
+typedef struct GpsRcvData {
+ u_int8 uc_sns_cnt; /* Sensor counter value */
+ u_int8 u_reserve[3]; /* Reserved */
+ TG_GPS_RCVDATA_NMEA st_nmea_data; /* NMEA data area */
+ TG_GPS_RCVDATA_BINARY st_binary_data; /* Standard binary region */
+ TG_GPS_RCVDATA_FULLBIN st_fullbin_data; /* Full binary data area */
+} TG_GPS_RCVDATA;
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+void DevGpsSndCycleDataNmea(void);
+void DevGpsRcvCyclCmd(void);
+u_int8 DevGpsGetGpsRcvSts(u_int8 sv);
+void DevGpsAnalyzeNmea(NAVIINFO_ALL* navilocinfo);
+void DevGpsCycleDataClear(void);
+void DevGpsCycleDataSetNmea(const u_int8*, u_int32, ENUM_GPS_NMEA_INDEX);
+BOOL DevGpsCycleDataGetNmea(u_int8*, u_int32, ENUM_GPS_NMEA_INDEX);
+void DevGpsCmdEventCheckNmea(void);
+void DevGpsSetChkSum(u_int8* buffer, u_int32 length);
+/*---------------------------------------------------------------------------*/
+#endif // INC_GPSCOMMON_MDEV_GPS_NMEA_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/
diff --git a/hal/positioning_hal/inc/GpsCommon/MDev_Gps_TimerCtrl.h b/hal/positioning_hal/inc/GpsCommon/MDev_Gps_TimerCtrl.h
new file mode 100755
index 0000000..96616ef
--- /dev/null
+++ b/hal/positioning_hal/inc/GpsCommon/MDev_Gps_TimerCtrl.h
@@ -0,0 +1,113 @@
+/*
+ * @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
+ *
+ * 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.
+ */
+/**
+* @file MDev_Gps_TimerCtrl.h
+*/
+
+#ifndef INC_GPSCOMMON_MDEV_GPS_TIMERCTRL_H_
+#define INC_GPSCOMMON_MDEV_GPS_TIMERCTRL_H_
+
+/*---------------------------------------------------------------------------*/
+// Include files
+
+#include "positioning_def.h"
+
+/*---------------------------------------------------------------------------*/
+// Value define
+
+/* GPS-related timer value */
+#define TIMVAL_GPS_STARTUP 500 /* 5Sec Start confirmation monitoring timer */
+#define TIMVAL_GPS_RCVCYCLDAT 500 /* 5Sec Periodic reception data monitoring timer */
+#define TIMVAL_GPS_RCVACK 500 /* 5Sec ACK reception monitoring timer */
+#define TIMVAL_GPS_RCVDAT 500 /* 5Sec Data reception monitoring timer(Unused) */
+#define TIMVAL_GPS_NAVIFST 3000 /* 30sec Initial navigation monitoring timer */
+#define TIMVAL_GPS_NAVICYCLE 300 /* 3sec Navigation monitoring timer */
+#define TIMVAL_GPS_NAVIDISRPT 1000 /* 10Sec Navigation monitoring disruption log output timer */
+#define TIMVAL_GPS_DIAGCLKGUARD 1000 /* 10sec Diagnosis provision time guard monitoring timer */
+#define TIMVAL_GPS_NMEADATAGUARD 1000 /* 10sec NMEA data-providing guard monitoring timer */
+#define TIMVAL_GPS_RECOVERY 60000 /* 600sec GPS recovery timer */
+#define TIMVAL_GPS_RECEIVERERR 60000 /* 600sec GPS receiver anomaly detection timer */
+
+/* Sensor-related timer value */
+#define TIMVAL_SNS_RCVFSTDAT 3000 /* 30Sec Initial sensor data reception monitoring timer */
+#define TIMVAL_SNS_RCVCYCLDAT 300 /* 3Sec Cyclic sensor data reception monitoring timer */
+#define TIMVAL_SNS_RCVDISRPT 1000 /* 10Sec Cyclic sensor data interruption log output timer */
+
+/* Timer management table */
+#define TIM_NON 0x00 /* Timer counter initial value */
+#define TIM_CNTMIN 0x01 /* Timer counter minimum value */
+#define TIM_CNTMAX 0xff /* Maximum value of timer counter */
+#define TIMER_OFF 0 /* Timer enable flag OFF */
+#define TIMER_ON 1 /* Timer enable flag ON */
+
+/*!
+ @brief Timer type
+ */
+typedef enum GpsTimKind {
+ GPS_STARTUP_TIMER = 0, /* 0 Start confirmation monitoring timer */
+ GPS_CYCL_TIMER, /* 1 Cyclic GPS data reception monitoring timer */
+ GPS_RECV_ACK_TIMER, /* 2 ACK reception monitoring timer */
+ GPS_NAVIFST_TIMER, /* 3 Initial navigation monitoring timer */
+ GPS_NAVICYCLE_TIMER, /* 4 Navigation monitoring timer */
+ GPS_NAVIDISRPT_TIMER, /* 5 Navigation monitoring disruption log output timer */
+ GPS_DIAGCLK_GUARDTIMER, /* 6 Diagnosis provision time guard monitoring timer */
+ GPS_NMEADATA_GUARDTIMER, /* 7 NMEA data-providing guard monitoring timer */
+ GPS_RECOVERY_TIMER, /* 8 GPS recovery timer */
+ GPS_RECEIVERERR_TIMER, /* 9 GPS receiver anomaly detection timer */
+ SNS_FST_TIMER, /* 10 Initial sensor data reception monitoring timer */
+ SNS_CYCLE_TIMER, /* 11 Cyclic sensor data reception monitoring timer */
+ SNS_DISRPT_TIMER, /* 12 Cyclic sensor data interruption log output timer */
+ TIM_NUM /* 13 Number of timer types */
+} GPS_TIM_KIND;
+
+/*!
+ @brief Timer status
+*/
+typedef struct GpsTimSts {
+ u_int8 flag; /**< Timer flag OFF:Stop,ON:Start */
+ u_int8 cnt; /**< Start counter */
+ int8 rsv[2]; /**< Reserved */
+} GPS_TIM_STS;
+
+/*!
+ @brief Timer status management table
+ */
+typedef struct GpsTimMng {
+ GPS_TIM_STS sts[TIM_NUM]; /**< Timer status */
+} GPS_TIM_MNG;
+
+/*!
+ @brief Timer setting information table
+*/
+typedef struct GpsTimInfo {
+ uint32_t timer_val; /**< Timer value */
+ PNO pno; /**< Event notification destination process number */
+} GPS_TIM_INFO;
+
+/*---------------------------------------------------------------------------*/
+// Prototype
+
+void DevGpsTimInit(void);
+BOOL DevGpsTimeSet(GPS_TIM_KIND tim_kind);
+BOOL DevGpsTimeStop(GPS_TIM_KIND tim_kind);
+u_int16 DevGpsTimeMakSeqNo(GPS_TIM_KIND tim_kind);
+BOOL DevGpsTimeJdgKind(u_int16 seqno);
+
+/*---------------------------------------------------------------------------*/
+#endif // INC_GPSCOMMON_MDEV_GPS_TIMERCTRL_H_
+
+/*---------------------------------------------------------------------------*/
+/*EOF*/