aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/hardware/gps.h147
-rwxr-xr-xrootdir/init.target.rc51
2 files changed, 134 insertions, 64 deletions
diff --git a/include/hardware/gps.h b/include/hardware/gps.h
index 59da5dd..76b6cb7 100644
--- a/include/hardware/gps.h
+++ b/include/hardware/gps.h
@@ -51,7 +51,10 @@ typedef uint32_t GpsPositionMode;
#define GPS_POSITION_MODE_STANDALONE 0
/** AGPS MS-Based mode. */
#define GPS_POSITION_MODE_MS_BASED 1
-/** AGPS MS-Assisted mode. */
+/**
+ * AGPS MS-Assisted mode. This mode is not maintained by the platform anymore.
+ * It is strongly recommended to use GPS_POSITION_MODE_MS_BASE instead.
+ */
#define GPS_POSITION_MODE_MS_ASSISTED 2
/** Requested recurrence mode for GPS operation. */
@@ -117,38 +120,22 @@ typedef uint16_t GpsLocationFlags;
/** Flags used to specify which aiding data to delete
when calling delete_aiding_data(). */
-typedef uint32_t GpsAidingData;
+typedef uint16_t GpsAidingData;
// IMPORTANT: Note that the following values must match
// constants in GpsLocationProvider.java.
-#define GPS_DELETE_EPHEMERIS 0x00000001
-#define GPS_DELETE_ALMANAC 0x00000002
-#define GPS_DELETE_POSITION 0x00000004
-#define GPS_DELETE_TIME 0x00000008
-#define GPS_DELETE_IONO 0x00000010
-#define GPS_DELETE_UTC 0x00000020
-#define GPS_DELETE_HEALTH 0x00000040
-#define GPS_DELETE_SVDIR 0x00000080
-#define GPS_DELETE_SVSTEER 0x00000100
-#define GPS_DELETE_SADATA 0x00000200
-#define GPS_DELETE_RTI 0x00000400
-#define GPS_DELETE_CELLDB_INFO 0x00000800
-#define GPS_DELETE_ALMANAC_CORR 0x00001000
-#define GPS_DELETE_FREQ_BIAS_EST 0x00002000
-#define GLO_DELETE_EPHEMERIS 0x00004000
-#define GLO_DELETE_ALMANAC 0x00008000
-#define GLO_DELETE_SVDIR 0x00010000
-#define GLO_DELETE_SVSTEER 0x00020000
-#define GLO_DELETE_ALMANAC_CORR 0x00040000
-#define GPS_DELETE_TIME_GPS 0x00080000
-#define GLO_DELETE_TIME 0x00100000
-#define BDS_DELETE_SVDIR 0X00200000
-#define BDS_DELETE_SVSTEER 0X00400000
-#define BDS_DELETE_TIME 0X00800000
-#define BDS_DELETE_ALMANAC_CORR 0X01000000
-#define BDS_DELETE_EPHEMERIS 0X02000000
-#define BDS_DELETE_ALMANAC 0X04000000
-
-#define GPS_DELETE_ALL 0xFFFFFFFF
+#define GPS_DELETE_EPHEMERIS 0x0001
+#define GPS_DELETE_ALMANAC 0x0002
+#define GPS_DELETE_POSITION 0x0004
+#define GPS_DELETE_TIME 0x0008
+#define GPS_DELETE_IONO 0x0010
+#define GPS_DELETE_UTC 0x0020
+#define GPS_DELETE_HEALTH 0x0040
+#define GPS_DELETE_SVDIR 0x0080
+#define GPS_DELETE_SVSTEER 0x0100
+#define GPS_DELETE_SADATA 0x0200
+#define GPS_DELETE_RTI 0x0400
+#define GPS_DELETE_CELLDB_INFO 0x8000
+#define GPS_DELETE_ALL 0xFFFF
/** AGPS type */
typedef uint16_t AGpsType;
@@ -309,6 +296,8 @@ typedef uint32_t GpsMeasurementFlags;
#define GPS_MEASUREMENT_HAS_DOPPLER_SHIFT_UNCERTAINTY (1<<16)
/** A valid 'used in fix' flag is stored in the data structure. */
#define GPS_MEASUREMENT_HAS_USED_IN_FIX (1<<17)
+/** The value of 'pseudorange rate' is uncorrected. */
+#define GPS_MEASUREMENT_HAS_UNCORRECTED_PSEUDORANGE_RATE (1<<18)
/**
* Enumeration of the available values for the GPS Measurement's loss of lock.
@@ -334,6 +323,12 @@ typedef uint8_t GpsMultipathIndicator;
/**
* Flags indicating the GPS measurement state.
+ * The expected behavior here is for GPS HAL to set all the flags that applies. For
+ * example, if the state for a satellite is only C/A code locked and bit synchronized,
+ * and there is still millisecond ambiguity, the state should be set as:
+ * GPS_MEASUREMENT_STATE_CODE_LOCK|GPS_MEASUREMENT_STATE_BIT_SYNC|GPS_MEASUREMENT_STATE_MSEC_AMBIGUOUS
+ * If GPS is still searching for a satellite, the corresponding state should be set to
+ * GPS_MEASUREMENT_STATE_UNKNOWN(0).
*/
typedef uint16_t GpsMeasurementState;
#define GPS_MEASUREMENT_STATE_UNKNOWN 0
@@ -341,6 +336,7 @@ typedef uint16_t GpsMeasurementState;
#define GPS_MEASUREMENT_STATE_BIT_SYNC (1<<1)
#define GPS_MEASUREMENT_STATE_SUBFRAME_SYNC (1<<2)
#define GPS_MEASUREMENT_STATE_TOW_DECODED (1<<3)
+#define GPS_MEASUREMENT_STATE_MSEC_AMBIGUOUS (1<<4)
/**
* Flags indicating the Accumulated Delta Range's states.
@@ -352,7 +348,7 @@ typedef uint16_t GpsAccumulatedDeltaRangeState;
#define GPS_ADR_STATE_CYCLE_SLIP (1<<2)
/**
- * Enumeration of available values to indicate the available GPS Natigation message types.
+ * Enumeration of available values to indicate the available GPS Navigation message types.
*/
typedef uint8_t GpsNavigationMessageType;
/** The message type is unknown. */
@@ -366,6 +362,19 @@ typedef uint8_t GpsNavigationMessageType;
/** CNAV-2 message contained in the structure. */
#define GPS_NAVIGATION_MESSAGE_TYPE_CNAV2 4
+/**
+ * Status of Navigation Message
+ * When a message is received properly without any parity error in its navigation words, the
+ * status should be set to NAV_MESSAGE_STATUS_PARITY_PASSED. But if a message is received
+ * with words that failed parity check, but GPS is able to correct those words, the status
+ * should be set to NAV_MESSAGE_STATUS_PARITY_REBUILT.
+ * No need to send any navigation message that contains words with parity error and cannot be
+ * corrected.
+ */
+typedef uint16_t NavigationMessageStatus;
+#define NAV_MESSAGE_STATUS_UNKONW 0
+#define NAV_MESSAGE_STATUS_PARITY_PASSED (1<<0)
+#define NAV_MESSAGE_STATUS_PARITY_REBUILT (1<<1)
/**
* Name for the GPS XTRA interface.
@@ -613,6 +622,12 @@ typedef struct {
* min_interval represents the time between fixes in milliseconds.
* preferred_accuracy represents the requested fix accuracy in meters.
* preferred_time represents the requested time to first fix in milliseconds.
+ *
+ * 'mode' parameter should be one of GPS_POSITION_MODE_MS_BASE
+ * or GPS_POSITION_MODE_STANDALONE.
+ * It is allowed by the platform (and it is recommended) to fallback to
+ * GPS_POSITION_MODE_MS_BASE if GPS_POSITION_MODE_MS_ASSISTED is passed in, and
+ * GPS_POSITION_MODE_MS_BASED is supported.
*/
int (*set_position_mode)(GpsPositionMode mode, GpsPositionRecurrence recurrence,
uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time);
@@ -658,6 +673,12 @@ typedef struct {
size_t (*get_internal_state)(char* buffer, size_t bufferSize);
} GpsDebugInterface;
+#pragma pack(push,4)
+// We need to keep the alignment of this data structure to 4-bytes, to ensure that in 64-bit
+// environments the size of this legacy definition does not collide with _v2. Implementations should
+// be using _v2 and _v3, so it's OK to pay the 'unaligned' penalty in 64-bit if an old
+// implementation is still in use.
+
/** Represents the status of AGPS. */
typedef struct {
/** set to sizeof(AGpsStatus_v1) */
@@ -667,6 +688,8 @@ typedef struct {
AGpsStatusValue status;
} AGpsStatus_v1;
+#pragma pack(pop)
+
/** Represents the status of AGPS augmented with a IPv4 address field. */
typedef struct {
/** set to sizeof(AGpsStatus_v2) */
@@ -1349,6 +1372,9 @@ typedef struct {
*
* The value contains the 'drift uncertainty' in it.
* If the data is available 'flags' must contain GPS_CLOCK_HAS_DRIFT.
+ *
+ * If GpsMeasurement's 'flags' field contains GPS_MEASUREMENT_HAS_UNCORRECTED_PSEUDORANGE_RATE,
+ * it is encouraged that this field is also provided.
*/
double drift_nsps;
@@ -1402,17 +1428,25 @@ typedef struct {
* Received GPS Time-of-Week at the measurement time, in nanoseconds.
* The value is relative to the beginning of the current GPS week.
*
- * Given the sync state of GPS receiver, per each satellite, valid range for this field can be:
- * Searching : [ 0 ] : GPS_MEASUREMENT_STATE_UNKNOWN
- * Ranging code lock : [ 0 1ms ] : GPS_MEASUREMENT_STATE_CODE_LOCK is set
- * Bit sync : [ 0 20ms ] : GPS_MEASUREMENT_STATE_BIT_SYNC is set
- * Subframe sync : [ 0 6ms ] : GPS_MEASUREMENT_STATE_SUBFRAME_SYNC is set
- * TOW decoded : [ 0 1week ] : GPS_MEASUREMENT_STATE_TOW_DECODED is set
+ * Given the highest sync state that can be achieved, per each satellite, valid range for
+ * this field can be:
+ * Searching : [ 0 ] : GPS_MEASUREMENT_STATE_UNKNOWN
+ * C/A code lock : [ 0 1ms ] : GPS_MEASUREMENT_STATE_CODE_LOCK is set
+ * Bit sync : [ 0 20ms ] : GPS_MEASUREMENT_STATE_BIT_SYNC is set
+ * Subframe sync : [ 0 6s ] : GPS_MEASUREMENT_STATE_SUBFRAME_SYNC is set
+ * TOW decoded : [ 0 1week ] : GPS_MEASUREMENT_STATE_TOW_DECODED is set
+ *
+ * However, if there is any ambiguity in integer millisecond,
+ * GPS_MEASUREMENT_STATE_MSEC_AMBIGUOUS should be set accordingly, in the 'state' field.
+ *
+ * This value must be populated if 'state' != GPS_MEASUREMENT_STATE_UNKNOWN.
*/
int64_t received_gps_tow_ns;
/**
* 1-Sigma uncertainty of the Received GPS Time-of-Week in nanoseconds.
+ *
+ * This value must be populated if 'state' != GPS_MEASUREMENT_STATE_UNKNOWN.
*/
int64_t received_gps_tow_uncertainty_ns;
@@ -1426,11 +1460,23 @@ typedef struct {
/**
* Pseudorange rate at the timestamp in m/s.
- * The value also includes the effects of the receiver clock frequency and satellite clock
- * frequency errors.
+ * The correction of a given Pseudorange Rate value includes corrections for receiver and
+ * satellite clock frequency errors.
+ *
+ * If GPS_MEASUREMENT_HAS_UNCORRECTED_PSEUDORANGE_RATE is set in 'flags' field, this field must
+ * be populated with the 'uncorrected' reading.
+ * If GPS_MEASUREMENT_HAS_UNCORRECTED_PSEUDORANGE_RATE is not set in 'flags' field, this field
+ * must be populated with the 'corrected' reading. This is the default behavior.
+ *
+ * It is encouraged to provide the 'uncorrected' 'pseudorange rate', and provide GpsClock's
+ * 'drift' field as well.
*
* The value includes the 'pseudorange rate uncertainty' in it.
- * A positive value indicates that the pseudorange is getting larger.
+ * A positive 'uncorrected' value indicates that the SV is moving away from the receiver.
+ *
+ * The sign of the 'uncorrected' 'pseudorange rate' and its relation to the sign of 'doppler
+ * shift' is given by the equation:
+ * pseudorange rate = -k * doppler shift (where k is a constant)
*
* This is a Mandatory value.
*/
@@ -1454,13 +1500,21 @@ typedef struct {
/**
* Accumulated delta range since the last channel reset in meters.
- * The data is available if 'accumulated delta range state' != GPS_ADR_STATE_UNKNOWN.
+ * A positive value indicates that the SV is moving away from the receiver.
+ *
+ * The sign of the 'accumulated delta range' and its relation to the sign of 'carrier phase'
+ * is given by the equation:
+ * accumulated delta range = -k * carrier phase (where k is a constant)
+ *
+ * This value must be populated if 'accumulated delta range state' != GPS_ADR_STATE_UNKNOWN.
+ * However, it is expected that the data is only accurate when:
+ * 'accumulated delta range state' == GPS_ADR_STATE_VALID.
*/
double accumulated_delta_range_m;
/**
* 1-Sigma uncertainty of the accumulated delta range in meters.
- * The data is available if 'accumulated delta range state' != GPS_ADR_STATE_UNKNOWN.
+ * This value must be populated if 'accumulated delta range state' != GPS_ADR_STATE_UNKNOWN.
*/
double accumulated_delta_range_uncertainty_m;
@@ -1697,6 +1751,13 @@ typedef struct {
GpsNavigationMessageType type;
/**
+ * The status of the received navigation message.
+ * No need to send any navigation message that contains words with parity error and cannot be
+ * corrected.
+ */
+ NavigationMessageStatus status;
+
+ /**
* Message identifier.
* It provides an index so the complete Navigation Message can be assembled. i.e. fo L1 C/A
* subframe 4 and 5, this value corresponds to the 'frame id' of the navigation message.
diff --git a/rootdir/init.target.rc b/rootdir/init.target.rc
index c7caff5..cb033c1 100755
--- a/rootdir/init.target.rc
+++ b/rootdir/init.target.rc
@@ -24,12 +24,21 @@ on post-fs-data
chmod 0664 /data/system/yas.cfg
chmod 0664 /data/system/yas-backup.cfg
-# gpsd
- mkdir /data/system/gps 775 root root
- write /data/system/gps/.gpslogd.pipe 0
- write /data/system/gps/.gpsd.lock 0
- write /data/system/gps/.gps.interface.pipe.to_gpsd 0
- write /data/system/gps/.gps.interface.pipe.to_jni 0
+# GPS
+ chown root system /dev/ttySAC1
+ chmod 0660 /dev/ttySAC1
+ chown root system /sys/class/sec/gps/GPS_PWR_EN/value
+ chmod 0664 /sys/class/sec/gps/GPS_PWR_EN/value
+
+ mkdir /data/system 0771 system system
+ chown system system /data/system
+ mkdir /data/system/gps 0771 system system
+ chown system system /data/system/gps
+
+ rm /data/gps_started
+ rm /data/glonass_started
+ rm /data/smd_started
+ rm /data/sv_cno.info
# bluetooth
write /efs/bluetooth/bt_addr 0
@@ -209,10 +218,10 @@ service at_distributor /system/bin/at_distributor
seclabel u:r:at_distributor:s0
service gpsd /system/bin/gpsd -c /system/etc/gps.xml
- class main
- socket gps seqpacket 0775 root root
- user root
- group system radio inet log cache misc audio net_raw sdcard_rw
+ class late_start
+ socket gps seqpacket 0775 root gps
+ user gps
+ group system radio inet log cache misc audio net_raw sdcard_rw gps
ioprio be 0
seclabel u:r:gpsd:s0
@@ -234,14 +243,14 @@ service geomagneticd /system/bin/geomagneticd
group system radio inet log input cache misc net_raw sdcard_rw
seclabel u:r:geomagneticd:s0
-service SMD-daemon /system/bin/smdexe
- class main
- user root
- group system radio inet log cache misc audio net_raw sdcard_rw
- seclabel u:r:SMD-daemon:s0
-
-service DR-daemon /system/bin/ddexe
- class main
- user root
- group system radio inet log cache misc audio net_raw sdcard_rw
- seclabel u:r:DR-daemon:s0
+#service SMD-daemon /system/bin/smdexe
+# class main
+# user root
+# group system radio inet log cache misc audio net_raw sdcard_rw
+# seclabel u:r:SMD-daemon:s0
+
+#service DR-daemon /system/bin/ddexe
+# class main
+# user root
+# group system radio inet log cache misc audio net_raw sdcard_rw
+# seclabel u:r:DR-daemon:s0