summaryrefslogtreecommitdiff
path: root/driver_sirf.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2010-04-14 18:21:52 -0700
committerGary E. Miller <gem@rellim.com>2010-04-14 18:21:52 -0700
commitb76cf0e4d564ddbc90e6843adc9ed23df418f7aa (patch)
treef15eb7a0eca7562e537c48054699fccfe506ac20 /driver_sirf.c
parentaefbda88efda49fe26b0dc27c0926be8316d4717 (diff)
downloadgpsd-b76cf0e4d564ddbc90e6843adc9ed23df418f7aa.tar.gz
Try to use isgps_parity() from isgps.c, but not quite right yet.
Diffstat (limited to 'driver_sirf.c')
-rw-r--r--driver_sirf.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/driver_sirf.c b/driver_sirf.c
index 2d02ff7f..2cf8b6b0 100644
--- a/driver_sirf.c
+++ b/driver_sirf.c
@@ -436,7 +436,7 @@ static gps_mask_t sirf_msg_navdata(struct gps_device_t *session,
unsigned char *buf, size_t len)
{
unsigned int i, words[10], chan, svid;
- unsigned int preamble, parity1, parity9;
+ unsigned int preamble, parity, parity1, parity9;
if (len != 43)
return 0;
@@ -459,10 +459,9 @@ static gps_mask_t sirf_msg_navdata(struct gps_device_t *session,
preamble = words[0] >> 16;
if (preamble == 0x8b) {
preamble ^= 0xff;
- words[0] ^= 0xffffff;
+ words[0] ^= 0xffffC0;
}
-
parity1 = parity9 = 0;
for (i = 1; i < 10; i++) {
int invert;
@@ -475,10 +474,18 @@ static gps_mask_t sirf_msg_navdata(struct gps_device_t *session,
parity9 = words[9] & 0x3;
break;
}
+ /* D30* says invert */
invert = (words[i] & 0x40000000) ? 1 : 0;
/* inverted data, invert it back */
if (invert) {
- words[i] ^= 0xffffffff;
+ words[i] ^= 0xffffffC0;
+ }
+ parity = isgps_parity( getbeul(buf, 4 * i + 3));
+ if ( parity != (getbeul(buf, 4 * i + 3) & 0x3f) ) {
+ gpsd_report(LOG_WARN,
+ "SiRF: 50BPS parity fail words[%d] 0x%x != 0x%x\n", i,
+ parity, ( getbeul(buf, 4 * i + 3) & 0x3f));
+ //return 0;
}
words[i] = (words[i] & 0x3fffffff) >> 6;
}
@@ -489,7 +496,8 @@ static gps_mask_t sirf_msg_navdata(struct gps_device_t *session,
words[5], words[6], words[7], words[8], words[9]);
// Look for the preamble in the first byte OR its complement
if (preamble != 0x74) {
- gpsd_report(LOG_WARN, "SiRF: 50BPS bad header 0x%u\n", words[0]);
+ gpsd_report(LOG_WARN, "SiRF: 50BPS bad premable: 0x%x header 0x%x\n"
+ , preamble, words[0]);
return 0;
}
// after inversion corrected, check for mandatory zeros at