Commit 25bb75ab authored by Eric S. Raymond's avatar Eric S. Raymond

Added 'baud' option, so far only used by NMEA driver.

This is a model for how to add driver options.
parent a9446b97
......@@ -153,6 +153,8 @@ with the Hayes connection and hang-up commands and result codes.
Not used by this driver.
+mode+::
Not used by this driver.
+baud+::
Not used by this driver.
== Configuration Example ==
......
......@@ -121,6 +121,8 @@ over the last 16 seconds.
Not used by this driver.
+mode+::
Not used by this driver.
+baud+::
Not used by this driver.
== Configuration Example ==
......
......@@ -60,6 +60,8 @@ written as-is to the +clockstats+ file.
Not used by this driver.
+mode+::
Not used by this driver.
+baud+::
Not used by this driver.
== Configuration Examples ==
......
......@@ -393,6 +393,8 @@ alarms are nonfatal; only the data in the burst are discarded.
Not used by this driver.
+mode+::
Select ICOM mode and device speed.
+baud+::
Not used by this driver.
== Configuration Example ==
......
......@@ -461,6 +461,8 @@ screen width and looks similar to:
Used to select the device type and serial parameters.
+mode+::
Synonym for subtype, retained for backward compatibility.
+baud+::
Not used by this driver.
== Configuration Examples ==
......
......@@ -222,6 +222,8 @@ since the last poll.
Control IBT and strict operating modes.
+mode+::
Synonym for subtype, retained for backward compatibility.
+baud+::
Not used by this driver.
[[fn1]]link:#fn1bl[^1^)]Data transmission and decoding is done only once by the
primary unit. The decoded data is then processed independently in both
......
......@@ -89,6 +89,8 @@ http://www.symmetricom.com/[Symmetricom].
Setting mode 1 configures for the HP Z3801A.
+mode+::
Synonym for subtype, retained for backward compatibility.
+baud+::
Not used by this driver.
== Configuration Example ==
......
......@@ -196,6 +196,8 @@ The error flags are defined as follows in hex:
Not used by this driver.
+mode+::
Not used by this driver.
+baud+::
Not used by this driver.
== Configuration Example ==
......
......@@ -388,6 +388,8 @@ filegen clockstats file clockstats type day enable
Used to select a device type and serial parameters.
+mode+::
Synonym for subtype, retained for backward compatibility.
+baud+::
Not used by this driver.
== Configuration Examples ==
......
......@@ -70,6 +70,8 @@ running correctly.
Not used by this driver.
+mode+::
Not used by this driver.
+baud+::
Not used by this driver.
== Configuration Example ==
......
......@@ -60,6 +60,8 @@ No +filegen clockstats+ monitor data are produced by this driver.
Not used by this driver.
+mode+::
Not used by this driver.
+baud+::
Not used by this driver.
== Configuration Example ==
......
......@@ -75,6 +75,8 @@ Format].
Not used by this driver.
+mode+::
Not used by this driver.
+baud+::
Not used by this driver.
== Configuration Example ==
......
......@@ -69,6 +69,9 @@ Default setting is 0 = don't log received data and converted utc time.
+mode+::
Not used by this driver.
+baud+::
Not used by this driver.
== Configuration Example ==
----------------------------------------------------------------------------
......
......@@ -101,12 +101,6 @@ Specific GPS sentences and bitrates may be selected by setting bits of the \'mod
|1 |2 |2 |process +$GPGGA+
|2 |4 |4 |process +$GPGLL+
|3 |8 |8 |process +$GPZDA+ or +$GPZDG+
.+|4-6 |0 |0 |linespeed 4800 bps
| |16 |0x10 |linespeed 9600 bps
| |32 |0x20 |linespeed 19200 bps
| |48 |0x30 |linespeed 38400 bps
| |64 |0x40 |linespeed 57600 bps
| |80 |0x50 |linespeed 115200 bps
|7 |128 |0x80 |
Write the sub-second fraction of the receive time stamp to the clockstat
file for all recognized NMEA sentences. This can be used to get a useful
......@@ -135,7 +129,7 @@ and
filters.
The driver uses 4800 bits per second by default, but faster bitrates can
be selected using bits 4 to 6 of the mode field.
be selected using the +baud+ option.
*Caveat:* Using higher line speeds does not necessarily increase the
precision of the timing device. Higher line speeds are not necessarily
......@@ -244,12 +238,14 @@ switched on by sending the following string.
+subtype+::
Not used by this driver.
+mode+::
Used to control baud rate, GPS sentence selection, and logging.
Used to control GPS sentence selection and logging.
+baud+::
Used to set the baud rate used to talk to the GPS.
== Configuration Example ==
----------------------------------------------------------------------------
refclock nmea mode 17 # GPMRC only at 9600bps
refclock nmea mode baud 9600 # All sentences at 9600 baud
----------------------------------------------------------------------------
== Additional Information ==
......
......@@ -80,6 +80,8 @@ specific receiver in use will be required.
Not used by this driver.
+mode+::
Not used by this driver.
+baud+::
Not used by this driver.
== Configuration Example ==
......
......@@ -244,6 +244,9 @@ link:#refid[+refid string+]::
+mode+ 'number'::
Synonym for subtype, retained for backward compatibility.
+baud+::
Not used by this driver.
== Configuration Example ==
----------------------------------------------------------------------------
......
......@@ -119,6 +119,8 @@ synchronization without needing the Internet at all.
Not used by this driver.
+mode+::
Not used by this driver.
+baud+::
Not used by this driver.
== Configuration Example ==
......
......@@ -182,6 +182,8 @@ for the specific unit.
Not used by this driver.
+mode+::
Can be used to set private mode
+baud+::
Not used by this driver.
== Configuration Example ==
......
......@@ -111,6 +111,8 @@ received.
Not used by this driver.
+mode+::
Not used by this driver.
+baud+::
Not used by this driver.
== Configuration Example ==
......
......@@ -121,6 +121,8 @@ written as-is to the +clockstats+ file.
Not used by this driver.
+mode+::
Not used by this driver.
+baud+::
Not used by this driver.
== Configuration Example ==
......
......@@ -272,6 +272,7 @@ struct peer {
*/
#ifdef REFCLOCK
struct refclockproc *procptr; /* refclock structure pointer */
uint32_t baud; /* baud rate to initialize driver with */
bool is_pps_driver; /* is this the PPS driver? */
uint8_t refclkunit; /* reference clock unit number */
uint8_t sstclktype; /* clock type for system status word */
......
......@@ -103,6 +103,7 @@ struct peer_ctl {
uint8_t maxpoll;
uint32_t ttl;
keyid_t peerkey;
uint32_t baud;
};
typedef struct peer_node_tag peer_node;
......
......@@ -27,6 +27,7 @@ struct key_tok ntp_keywords[] = {
{ "broadcast", T_Broadcast, FOLLBY_STRING },
{ "broadcastclient", T_Broadcastclient, FOLLBY_TOKEN },
{ "broadcastdelay", T_Broadcastdelay, FOLLBY_TOKEN },
{ "baud", T_Baud, FOLLBY_TOKEN },
{ "ctl", T_Ctl, FOLLBY_TOKEN },
{ "disable", T_Disable, FOLLBY_TOKEN },
{ "driftfile", T_Driftfile, FOLLBY_STRING },
......
......@@ -777,6 +777,10 @@ create_peer_node(
break;
#ifdef REFCLOCK
case T_Baud:
my_node->ctl.baud = option->value.u;
break;
/*
* Past this point are options the old syntax
* handled in fudge processing. They're parsed
......@@ -3269,6 +3273,8 @@ config_peers(
clktype = (uint8_t)REFCLOCKTYPE(&peer->srcadr);
unit = REFCLOCKUNIT(&peer->srcadr);
peer->baud = curr_peer->ctl.baud;
msyslog(LOG_ERR, "passed %dbps", peer->baud);
if (refclock_newpeer(clktype,
unit,
peer))
......
......@@ -74,6 +74,7 @@
%token <Integer> T_Allpeers
%token <Integer> T_Auth
%token <Integer> T_Average
%token <Integer> T_Baud
%token <Integer> T_Bclient
%token <Integer> T_Beacon
%token <Integer> T_Broadcast
......@@ -501,6 +502,7 @@ option_int_keyword
| T_Mode
| T_Subtype
| T_Version
| T_Baud
;
option_double
......
......@@ -400,34 +400,44 @@ nmea_start(
const char * baudtext;
/* Get baudrate choice from mode byte bits 4/5/6 */
/* Old style: get baudrate choice from mode byte bits 4/5/6 */
rate = (peer->ttl & NMEA_BAUDRATE_MASK) >> NMEA_BAUDRATE_SHIFT;
/* New style: get baudrate from baud option */
if (peer->baud)
rate = peer->baud;
switch (rate) {
case 0:
case 4800:
baudrate = SPEED232;
baudtext = "4800";
break;
case 1:
case 9600:
baudrate = B9600;
baudtext = "9600";
break;
case 2:
case 19200:
baudrate = B19200;
baudtext = "19200";
break;
case 3:
case 38400:
baudrate = B38400;
baudtext = "38400";
break;
#ifdef B57600
case 4:
case 57600:
baudrate = B57600;
baudtext = "57600";
break;
#endif
#ifdef B115200
case 5:
case 115200:
baudrate = B115200;
baudtext = "115200";
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment