summaryrefslogtreecommitdiff
path: root/monitor_sirf.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2010-12-26 18:00:58 -0500
committerEric S. Raymond <esr@thyrsus.com>2010-12-26 18:00:58 -0500
commitcafb272f98f0b66481675743dfd42d6ac30baa47 (patch)
tree4d50a2f8dbae7f62c96320259e791f73a422e78d /monitor_sirf.c
parent5062f7c420c55c8f2c3d51a75539b050536fc103 (diff)
downloadgpsd-cafb272f98f0b66481675743dfd42d6ac30baa47.tar.gz
Rename the bits.h macros to be explicit about operand length.
With most machines being 64-bit now, the assumption that "word" = 16 bits and "long" = 32 bits is increasingly archaic. This commit removes it from our naming conventions.
Diffstat (limited to 'monitor_sirf.c')
-rw-r--r--monitor_sirf.c94
1 files changed, 47 insertions, 47 deletions
diff --git a/monitor_sirf.c b/monitor_sirf.c
index 5ffcf5fc..5944fdd0 100644
--- a/monitor_sirf.c
+++ b/monitor_sirf.c
@@ -298,18 +298,18 @@ static void sirf_update(void)
switch (buf[0]) {
case 0x02: /* Measured Navigation Data */
(void)wmove(mid2win, 1, 6); /* ECEF position */
- (void)wprintw(mid2win, "%8d %8d %8d", getbesl(buf, 1),
- getbesl(buf, 5), getbesl(buf, 9));
+ (void)wprintw(mid2win, "%8d %8d %8d", getbes32(buf, 1),
+ getbes32(buf, 5), getbes32(buf, 9));
(void)wmove(mid2win, 2, 6); /* ECEF velocity */
(void)wprintw(mid2win, "%8.1f %8.1f %8.1f",
- (double)getbesw(buf, 13) / 8, (double)getbesw(buf,
+ (double)getbes16(buf, 13) / 8, (double)getbes16(buf,
15) / 8,
- (double)getbesw(buf, 17) / 8);
- decode_ecef((double)getbesl(buf, 1), (double)getbesl(buf, 5),
- (double)getbesl(buf, 9), (double)getbesw(buf, 13) / 8,
- (double)getbesw(buf, 15) / 8, (double)getbesw(buf,
+ (double)getbes16(buf, 17) / 8);
+ decode_ecef((double)getbes32(buf, 1), (double)getbes32(buf, 5),
+ (double)getbes32(buf, 9), (double)getbes16(buf, 13) / 8,
+ (double)getbes16(buf, 15) / 8, (double)getbes16(buf,
17) / 8);
- decode_time((int)getbeuw(buf, 22), getbesl(buf, 24));
+ decode_time((int)getbeu16(buf, 22), getbes32(buf, 24));
/* line 4 */
(void)wmove(mid2win, 4, 49);
(void)wprintw(mid2win, "%4.1f", (double)getub(buf, 20) / 5); /* HDOP */
@@ -331,7 +331,7 @@ static void sirf_update(void)
break;
case 0x04: /* Measured Tracking Data */
- decode_time((int)getbeuw(buf, 1), getbesl(buf, 3));
+ decode_time((int)getbeu16(buf, 1), getbes32(buf, 3));
ch = (int)getub(buf, 7);
for (i = 0; i < ch; i++) {
int sv, st;
@@ -345,10 +345,10 @@ static void sirf_update(void)
((int)getub(buf, off + 1) * 3) / 2, (int)getub(buf,
off +
2) /
- 2, (int)getbesw(buf, off + 3));
+ 2, (int)getbes16(buf, off + 3));
st = ' ';
- if ((int)getbeuw(buf, off + 3) == 0xbf)
+ if ((int)getbeu16(buf, off + 3) == 0xbf)
st = 'T';
for (j = 0; j < nfix; j++)
if (sv == fix[j]) {
@@ -372,7 +372,7 @@ static void sirf_update(void)
#ifdef __UNUSED__
case 0x05: /* raw track data */
for (off = 1; off < len; off += 51) {
- ch = getbeul(buf, off);
+ ch = getbeu32(buf, off);
(void)wmove(mid4win, ch + 2, 19);
cn = 0;
@@ -381,10 +381,10 @@ static void sirf_update(void)
printw("%5.1f", (double)cn / 10);
- printw("%9d%3d%5d", getbeul(buf, off + 8),
- (int)getbeuw(buf, off + 12), (int)getbeuw(buf, off + 14));
- printw("%8.5f %10.5f", (double)getbeul(buf, off + 16) / 65536,
- (double)getbeul(buf, off + 20) / 1024);
+ printw("%9d%3d%5d", getbeu32(buf, off + 8),
+ (int)getbeu16(buf, off + 12), (int)getbeu16(buf, off + 14));
+ printw("%8.5f %10.5f", (double)getbeu32(buf, off + 16) / 65536,
+ (double)getbeu32(buf, off + 20) / 1024);
}
monitor_log("RTD 0x05=");
break;
@@ -396,11 +396,11 @@ static void sirf_update(void)
break;
case 0x07: /* Response - Clock Status Data */
- decode_time((int)getbeuw(buf, 1), getbesl(buf, 3));
+ decode_time((int)getbeu16(buf, 1), getbes32(buf, 3));
display(mid7win, 1, 5, "%2d", getub(buf, 7)); /* SVs */
- display(mid7win, 1, 16, "%lu", getbeul(buf, 8)); /* Clock drift */
- display(mid7win, 1, 29, "%lu", getbeul(buf, 12)); /* Clock Bias */
- display(mid7win, 2, 21, "%lu", getbeul(buf, 16)); /* Estimated Time */
+ display(mid7win, 1, 16, "%lu", getbeu32(buf, 8)); /* Clock drift */
+ display(mid7win, 1, 29, "%lu", getbeu32(buf, 12)); /* Clock Bias */
+ display(mid7win, 2, 21, "%lu", getbeu32(buf, 16)); /* Estimated Time */
monitor_log("CSD 0x07=");
break;
@@ -412,10 +412,10 @@ static void sirf_update(void)
break;
case 0x09: /* Throughput */
- display(mid9win, 1, 6, "%.3f", (double)getbeuw(buf, 1) / 186); /*SegStatMax */
- display(mid9win, 1, 18, "%.3f", (double)getbeuw(buf, 3) / 186); /*SegStatLat */
- display(mid9win, 1, 31, "%.3f", (double)getbeuw(buf, 5) / 186); /*SegStatTime */
- display(mid9win, 1, 42, "%3d", (int)getbeuw(buf, 7)); /* Last Millisecond */
+ display(mid9win, 1, 6, "%.3f", (double)getbeu16(buf, 1) / 186); /*SegStatMax */
+ display(mid9win, 1, 18, "%.3f", (double)getbeu16(buf, 3) / 186); /*SegStatLat */
+ display(mid9win, 1, 31, "%.3f", (double)getbeu16(buf, 5) / 186); /*SegStatTime */
+ display(mid9win, 1, 42, "%3d", (int)getbeu16(buf, 7)); /* Last Millisecond */
monitor_log("THR 0x09=");
break;
@@ -443,7 +443,7 @@ static void sirf_update(void)
#define YESNO(n) (((int)getub(buf, n) != 0)?'Y':'N')
display(mid19win, 1, 20, "%d", getub(buf, 5)); /* Alt. hold mode */
display(mid19win, 2, 20, "%d", getub(buf, 6)); /* Alt. hold source */
- display(mid19win, 3, 20, "%dm", (int)getbeuw(buf, 7)); /* Alt. source input */
+ display(mid19win, 3, 20, "%dm", (int)getbeu16(buf, 7)); /* Alt. source input */
if (getub(buf, 9) != (uint8_t) '\0')
display(mid19win, 4, 20, "%dsec", getub(buf, 10)); /* Degraded timeout */
else
@@ -453,22 +453,22 @@ static void sirf_update(void)
display(mid19win, 7, 20, "%c", YESNO(13)); /* Static Nav. */
display(mid19win, 8, 20, "0x%x", getub(buf, 14)); /* 3SV Least Squares */
display(mid19win, 9, 20, "0x%x", getub(buf, 19)); /* DOP Mask mode */
- display(mid19win, 10, 20, "0x%x", (int)getbeuw(buf, 20)); /* Nav. Elev. mask */
+ display(mid19win, 10, 20, "0x%x", (int)getbeu16(buf, 20)); /* Nav. Elev. mask */
display(mid19win, 11, 20, "0x%x", getub(buf, 22)); /* Nav. Power mask */
display(mid19win, 12, 20, "0x%x", getub(buf, 27)); /* DGPS Source */
display(mid19win, 13, 20, "0x%x", getub(buf, 28)); /* DGPS Mode */
display(mid19win, 14, 20, "%dsec", getub(buf, 29)); /* DGPS Timeout */
display(mid19win, 1, 42, "%c", YESNO(34)); /* LP Push-to-Fix */
- display(mid19win, 2, 42, "%dms", getbeul(buf, 35)); /* LP On Time */
- display(mid19win, 3, 42, "%d", getbeul(buf, 39)); /* LP Interval */
+ display(mid19win, 2, 42, "%dms", getbeu32(buf, 35)); /* LP On Time */
+ display(mid19win, 3, 42, "%d", getbeu32(buf, 39)); /* LP Interval */
display(mid19win, 4, 42, "%c", YESNO(43)); /* User Tasks enabled */
- display(mid19win, 5, 42, "%d", getbeul(buf, 44)); /* User Task Interval */
+ display(mid19win, 5, 42, "%d", getbeu32(buf, 44)); /* User Task Interval */
display(mid19win, 6, 42, "%c", YESNO(48)); /* LP Power Cycling Enabled */
- display(mid19win, 7, 42, "%d", getbeul(buf, 49)); /* LP Max Acq Search Time */
- display(mid19win, 8, 42, "%d", getbeul(buf, 53)); /* LP Max Off Time */
+ display(mid19win, 7, 42, "%d", getbeu32(buf, 49)); /* LP Max Acq Search Time */
+ display(mid19win, 8, 42, "%d", getbeu32(buf, 53)); /* LP Max Off Time */
display(mid19win, 9, 42, "%c", YESNO(57)); /* APM Enabled */
- display(mid19win, 10, 42, "%d", (int)getbeuw(buf, 58)); /* # of fixes */
- display(mid19win, 11, 42, "%d", (int)getbeuw(buf, 60)); /* Time Between fixes */
+ display(mid19win, 10, 42, "%d", (int)getbeu16(buf, 58)); /* # of fixes */
+ display(mid19win, 11, 42, "%d", (int)getbeu16(buf, 60)); /* Time Between fixes */
display(mid19win, 12, 42, "%d", getub(buf, 62)); /* H/V Error Max */
display(mid19win, 13, 42, "%d", getub(buf, 63)); /* Response Time Max */
display(mid19win, 14, 42, "%d", getub(buf, 64)); /* Time/Accu & Duty Cycle Priority */
@@ -524,7 +524,7 @@ static void sirf_update(void)
//(void) wmove(mid27win, 2, 0);
for (i = j = 0; i < 12; i++) {
if (getub(buf, 16 + 3 * i) != '\0') {
- //(void)wprintw(mid27win, " %d=%d", getub(buf, 16+3*i), getbesw(buf, 16+3*i+1));
+ //(void)wprintw(mid27win, " %d=%d", getub(buf, 16+3*i), getbes16(buf, 16+3*i+1));
j++;
}
}
@@ -553,18 +553,18 @@ static void sirf_update(void)
case 0x62:
attrset(A_BOLD);
move(2, 40);
- printw("%9.5f %9.5f", (double)(RAD_2_DEG * 1e8 * getbesl(buf, 1)),
- (double)(RAD_2_DEG * 1e8 * getbesl(buf, 5)));
+ printw("%9.5f %9.5f", (double)(RAD_2_DEG * 1e8 * getbes32(buf, 1)),
+ (double)(RAD_2_DEG * 1e8 * getbes32(buf, 5)));
move(2, 63);
- printw("%8d", getbesl(buf, 9) / 1000);
+ printw("%8d", getbes32(buf, 9) / 1000);
move(3, 63);
- printw("%8.1f", (double)getbesl(buf, 17) / 1000);
+ printw("%8.1f", (double)getbes32(buf, 17) / 1000);
move(4, 54);
- if (getbeul(buf, 13) > 50) {
- double heading = RAD_2_DEG * 1e8 * getbesl(buf, 21);
+ if (getbeu32(buf, 13) > 50) {
+ double heading = RAD_2_DEG * 1e8 * getbes32(buf, 21);
if (heading < 0)
heading += 360;
printw("%5.1f", heading);
@@ -572,15 +572,15 @@ static void sirf_update(void)
printw(" 0.0");
move(4, 63);
- printw("%8.1f", (double)getbesl(buf, 13) / 1000);
+ printw("%8.1f", (double)getbes32(buf, 13) / 1000);
attrset(A_NORMAL);
move(5, 13);
printw("%04d-%02d-%02d %02d:%02d:%02d.%02d",
- (int)getbeuw(buf, 26), getub(buf, 28), getub(buf, 29),
- getub(buf, 30), getub(buf, 31), (unsigned short)getbeuw(buf,
+ (int)getbeu16(buf, 26), getub(buf, 28), getub(buf, 29),
+ getub(buf, 30), getub(buf, 31), (unsigned short)getbeu16(buf,
32) /
- 1000, ((unsigned short)getbeuw(buf, 32) % 1000) / 10);
+ 1000, ((unsigned short)getbeu16(buf, 32) % 1000) / 10);
{
struct timeval clk, gps;
struct tm tm;
@@ -588,16 +588,16 @@ static void sirf_update(void)
gettimeofday(&clk, NULL);
memset(&tm, 0, sizeof(tm));
- tm.tm_sec = (unsigned short)getbeuw(buf, 32) / 1000;
+ tm.tm_sec = (unsigned short)getbeu16(buf, 32) / 1000;
tm.tm_min = (int)getub(buf, 31);
tm.tm_hour = (int)getub(buf, 30);
tm.tm_mday = (int)getub(buf, 29);
tm.tm_mon = (int)getub(buf, 28) - 1;
- tm.tm_year = (int)getbeuw(buf, 26) - 1900;
+ tm.tm_year = (int)getbeu16(buf, 26) - 1900;
gps.tv_sec = mkgmtime(&tm);
gps.tv_usec =
- (((unsigned short)getbeuw(buf, 32) % 1000) / 10) * 10000;
+ (((unsigned short)getbeu16(buf, 32) % 1000) / 10) * 10000;
move(5, 2);
printw(" ");