summaryrefslogtreecommitdiff
path: root/driver_sirf.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2010-04-14 00:22:36 -0700
committerGary E. Miller <gem@rellim.com>2010-04-14 00:22:36 -0700
commit377f18439013d69c049cc0a3c8941d2351476658 (patch)
tree5490da7540a27365adee75ef9830d971d24b5df7 /driver_sirf.c
parent00acffa2b1f2290bc1bb301d8110dbca3bf84111 (diff)
downloadgpsd-377f18439013d69c049cc0a3c8941d2351476658.tar.gz
Tweak the 50BPS inversion algorith.
Diffstat (limited to 'driver_sirf.c')
-rw-r--r--driver_sirf.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/driver_sirf.c b/driver_sirf.c
index 44e90ea3..d6ccf1a4 100644
--- a/driver_sirf.c
+++ b/driver_sirf.c
@@ -433,27 +433,24 @@ static gps_mask_t sirf_msg_navdata(struct gps_device_t *session, unsigned char *
preamble = words[0] >> 16;
if (preamble == 0x8b){
preamble ^= 0xff;
- words[0] ^= 0xffffff;
}
parity1 = parity9 = 0;
- for (i = 1; i < 10; i++) {
+ for (i = 0; i < 10; i++) {
int invert;
words[i] = (unsigned int)getbeul(buf, 4*i + 3);
invert = (words[i] & 0x40000000) ? 1 : 0;
- if (i == 1) {
- parity1 = words[1] & 0x3;
- if (!invert)
- parity1 ^= 0x3;
- }
- if (i == 9) {
- parity9 = words[9] & 0x3;
- if (!invert)
- parity9 ^= 0x3;
- }
/* inverted the data, invert it back */
if (invert)
words[i] ^= 0xffffffff;
+ switch( i ) {
+ case 1:
+ parity1 = words[1] & 0x3;
+ break;
+ case 9:
+ parity9 = words[9] & 0x3;
+ break;
+ }
words[i] = (words[i] & 0x3fffffff) >> 6;
}
gpsd_report(LOG_PROG, "SiRF: 50BPS 0x08: %2d %2d "