sm8450-common: gps: Update to LA.VENDOR.1.0.r1-21900-WAIPIO.0

Change-Id: Ib431364a902ecd9b068e672978f5e24ecbf42160
This commit is contained in:
Arian
2024-02-27 23:45:03 +01:00
parent 36c55874bb
commit f518e7ef8f
29 changed files with 1500 additions and 168 deletions

View File

@@ -40,6 +40,10 @@
namespace loc_core {
#define MSEC_IN_ONE_WEEK 604800000LL
#define REAL_TIME_ESTIMATOR_TIME_UNC_THRESHOLD_MSEC 20.0f
#define UNKNOWN_GPS_WEEK_NUM 65535
#define TO_ALL_LOCADAPTERS(call) TO_ALL_ADAPTERS(mLocAdapters, (call))
#define TO_1ST_HANDLING_LOCADAPTERS(call) TO_1ST_HANDLING_ADAPTER(mLocAdapters, (call))
@@ -330,7 +334,7 @@ void LocApiBase::reportPosition(UlpLocation& location,
LOC_LOGD("flags: %d\n source: %d\n latitude: %f\n longitude: %f\n "
"altitude: %f\n speed: %f\n bearing: %f\n accuracy: %f\n "
"timestamp: %" PRId64 "\n"
"Session status: %d\n Technology mask: %u\n "
"Session status: %d\n Technology mask: %u\n, time bias unc %f msec\n "
"SV used in fix (gps/glo/bds/gal/qzss) : \
(0x%" PRIx64 "/0x%" PRIx64 "/0x%" PRIx64 "/0x%" PRIx64 "/0x%" PRIx64 "/0x%" PRIx64 ")",
location.gpsLocation.flags, location.position_source,
@@ -338,6 +342,7 @@ void LocApiBase::reportPosition(UlpLocation& location,
location.gpsLocation.altitude, location.gpsLocation.speed,
location.gpsLocation.bearing, location.gpsLocation.accuracy,
location.gpsLocation.timestamp, status, loc_technology_mask,
locationExtended.gnssSystemTime.u.gpsSystemTime.systemClkTimeUncMs,
locationExtended.gnss_sv_used_ids.gps_sv_used_ids_mask,
locationExtended.gnss_sv_used_ids.glo_sv_used_ids_mask,
locationExtended.gnss_sv_used_ids.bds_sv_used_ids_mask,
@@ -616,6 +621,10 @@ void LocApiBase::reportLatencyInfo(GnssLatencyInfo& gnssLatencyInfo)
TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportLatencyInfoEvent(gnssLatencyInfo));
}
void LocApiBase::reportEngDebugDataInfo(GnssEngineDebugDataInfo& gnssEngineDebugDataInfo) {
TO_ALL_LOCADAPTERS(mLocAdapters[i]->reportEngDebugDataInfoEvent(gnssEngineDebugDataInfo));
}
enum loc_api_adapter_err LocApiBase::
open(LOC_API_ADAPTER_EVENT_MASK_T /*mask*/)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
@@ -624,12 +633,6 @@ enum loc_api_adapter_err LocApiBase::
close()
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
void LocApiBase::startFix(const LocPosMode& /*posMode*/, LocApiResponse* /*adapterResponse*/)
DEFAULT_IMPL()
void LocApiBase::stopFix(LocApiResponse* /*adapterResponse*/)
DEFAULT_IMPL()
void LocApiBase::
deleteAidingData(const GnssAidingData& /*data*/, LocApiResponse* /*adapterResponse*/)
DEFAULT_IMPL()
@@ -1040,7 +1043,13 @@ void ElapsedRealtimeEstimator::saveGpsTimeAndQtimerPairInPvtReport(
// Use GPS timestamp and qtimer tick for 1Hz PVT report for association
if ((locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_GPS_TIME) &&
// 65535 GPS week from modem means unknown
(locationExtended.gpsTime.gpsWeek != UNKNOWN_GPS_WEEK_NUM) &&
(locationExtended.gpsTime.gpsTimeOfWeekMs % 1000 == 0) &&
(locationExtended.gnssSystemTime.u.gpsSystemTime.validityMask &
GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID) &&
(locationExtended.gnssSystemTime.u.gpsSystemTime.systemClkTimeUncMs <
REAL_TIME_ESTIMATOR_TIME_UNC_THRESHOLD_MSEC) &&
(locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_SYSTEM_TICK) &&
(locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_SYSTEM_TICK_UNC)) {
mTimePairPVTReport.gpsTime.gpsWeek = locationExtended.gpsTime.gpsWeek;
@@ -1062,13 +1071,17 @@ void ElapsedRealtimeEstimator::saveGpsTimeAndQtimerPairInMeasReport(
// Use 1Hz measurement report timestamp and qtimer tick for association
if ((svMeasurementSet.isNhz == false) &&
(svMeasSetHeader.gpsSystemTime.validityMask & GNSS_SYSTEM_TIME_WEEK_VALID) &&
(svMeasSetHeader.gpsSystemTime.validityMask & GNSS_SYSTEM_TIME_WEEK_MS_VALID)) {
// 65535 GPS week from modem means unknown
(svMeasurementSet.svMeasSetHeader.gpsSystemTime.systemWeek != UNKNOWN_GPS_WEEK_NUM) &&
(svMeasSetHeader.gpsSystemTime.validityMask & GNSS_SYSTEM_TIME_WEEK_MS_VALID) &&
(svMeasSetHeader.gpsSystemTime.validityMask & GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID) &&
(svMeasSetHeader.gpsSystemTime.systemClkTimeUncMs <
REAL_TIME_ESTIMATOR_TIME_UNC_THRESHOLD_MSEC)) {
LOC_LOGv("gps time %d %d, meas unc %f, ref cnt tick %" PRIi64 ","
LOC_LOGv("gps time %d %d, ref cnt tick %" PRIi64 ","
"system rtc ms %" PRIi64 ", systemClkTimeUncMs %f",
svMeasurementSet.svMeasSetHeader.gpsSystemTime.systemWeek,
svMeasurementSet.svMeasSetHeader.gpsSystemTime.systemMsec,
svMeasurementSet.svMeasSetHeader.gpsSystemTime.systemClkTimeUncMs,
svMeasurementSet.svMeasSetHeader.refCountTicks,
svMeasurementSet.svMeasSetHeader.gpsSystemTimeExt.systemRtcMs,
svMeasurementSet.svMeasSetHeader.gpsSystemTime.systemClkTimeUncMs);
@@ -1079,16 +1092,12 @@ void ElapsedRealtimeEstimator::saveGpsTimeAndQtimerPairInMeasReport(
mTimePairMeasReport.qtimerTick = svMeasurementSet.svMeasSetHeader.refCountTicks;
mTimePairMeasReport.timeUncMsec = svMeasurementSet.svMeasSetHeader.refCountTicksUnc;
}
LOC_LOGv("gps time (%d, %d), qtimer tick %" PRIi64 ", unc %f",
mTimePairMeasReport.gpsTime.gpsWeek, mTimePairMeasReport.gpsTime.gpsTimeOfWeekMs,
mTimePairMeasReport.qtimerTick, mTimePairMeasReport.timeUncMsec);
}
}
#define MSEC_IN_ONE_WEEK 604800000LL
bool ElapsedRealtimeEstimator::getElapsedRealtimeForGpsTime(
const GPSTimeStruct& gpsTimeAtOrigin, int64_t &bootTimeNsAtOrigin, float & bootTimeUnc) {
const GpsLocationExtended& locationExtended,
int64_t &bootTimeNsAtOrigin, float & bootTimeUnc) {
struct timespec curBootTime = {};
int64_t curBootTimeNs = 0;
int64_t curQTimerNSec = 0;
@@ -1107,6 +1116,23 @@ bool ElapsedRealtimeEstimator::getElapsedRealtimeForGpsTime(
return false;
}
if (((locationExtended.flags & GPS_LOCATION_EXTENDED_HAS_GPS_TIME) == 0) ||
// 65535 GPS week from modem means unknown
(locationExtended.gpsTime.gpsWeek == UNKNOWN_GPS_WEEK_NUM) ||
((locationExtended.gnssSystemTime.u.gpsSystemTime.validityMask &
GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID) == 0) ||
((locationExtended.gnssSystemTime.u.gpsSystemTime.systemClkTimeUncMs >=
REAL_TIME_ESTIMATOR_TIME_UNC_THRESHOLD_MSEC))) {
LOC_LOGd("report has invalid gps time, or no time bias unc or large time bias unc, "
"gps week %d, gps system time mask 0x%x, clk bias unc %f",
locationExtended.gpsTime.gpsWeek,
locationExtended.gnssSystemTime.u.gpsSystemTime.validityMask,
locationExtended.gnssSystemTime.u.gpsSystemTime.systemClkTimeUncMs);
return false;
}
const GPSTimeStruct& gpsTimeAtOrigin = locationExtended.gpsTime;
int64_t originMsec = (int64_t)gpsTimeAtOrigin.gpsWeek * (int64_t)MSEC_IN_ONE_WEEK +
(int64_t)gpsTimeAtOrigin.gpsTimeOfWeekMs;
int64_t timePairMsec = (int64_t)timePair.gpsTime.gpsWeek * (int64_t)MSEC_IN_ONE_WEEK +
@@ -1131,7 +1157,11 @@ bool ElapsedRealtimeEstimator::getElapsedRealtimeForGpsTime(
timePair.qtimerTick * 100000 / 192,
curQTimerNSec, qtimerNsecAtOrigin, curBootTimeNs, bootTimeNsAtOrigin, bootTimeUnc);
return true;
if (bootTimeNsAtOrigin > 0) {
return true;
} else {
return false;
}
}