[Git][NTPsec/ntpsec][master] Remove Magnavox driver.

Eric S. Raymond gitlab at mg.gitlab.com
Sun Sep 17 16:59:39 UTC 2017


Eric S. Raymond pushed to branch master at NTPsec / ntpsec


Commits:
6d2b724a by Eric S. Raymond at 2017-09-17T16:44:14Z
Remove Magnavox driver.

None of these units have been manufactured since 1994, when the
manufacturer was bought by Leica Geosystems.  Original MX4200s shipped
invalid times after the GPS Era 1 rollover in 1999; Leica announced an
update PROM in 1997 but it was to cost $100 and is not even certain it
actually shipped. In 2017 these receivers can't even be found on eBay.

- - - - -


9 changed files:

- docs/copyright.txt
- − docs/driver_magnavox.txt
- − docs/mx4200data.txt
- − docs/pic/9400n.jpg
- docs/refclock.txt
- include/ntp_refclock.h
- ntpd/refclock_conf.c
- − ntpd/refclock_magnavox.c
- wafhelpers/refclock.py


Changes:

=====================================
docs/copyright.txt
=====================================
--- a/docs/copyright.txt
+++ b/docs/copyright.txt
@@ -95,7 +95,7 @@ as authors of this work.
 * mailto:karl at owl.HQ.ileaf.com[Karl Berry <karl at owl.HQ.ileaf.com>]
   syslog to file option
 * mailto:Marc.Brett at westgeo.com[Marc Brett
-  <Marc.Brett at westgeo.com>] Magnavox GPS clock driver
+  <Marc.Brett at westgeo.com>] Magnavox GPS clock driver (removed in NTPsec)
 * mailto:Piete.Brooks at cl.cam.ac.uk[Piete Brooks
   <Piete.Brooks at cl.cam.ac.uk>] Trimble PARSE support
 * mailto:nelson at bolyard.me[Nelson B Bolyard <nelson at bolyard.me>]
@@ -118,7 +118,7 @@ as authors of this work.
 * mailto:neoclock4x at linum.com[Claas Hilbrecht
   <neoclock4x at linum.com>] NeoClock4X clock driver
 * mailto:glenn at herald.usask.ca[Glenn Hollinger
-  <glenn at herald.usask.ca>] GOES clock driver
+  <glenn at herald.usask.ca>] GOES clock driver (removed in NTPsec)
 * mailto:jbj at chatham.usdesign.com[Jeff Johnson
   <jbj at chatham.usdesign.com>] massive prototyping overhaul
 * mailto:Hans.Lambermont at nl.origin-it.com[Hans Lambermont


=====================================
docs/driver_magnavox.txt deleted
=====================================
--- a/docs/driver_magnavox.txt
+++ /dev/null
@@ -1,100 +0,0 @@
-= Magnavox MX4200 and compatible GPS receivers =
-
-== Synopsis ==
-
-["verse",subs="normal"]
-Name: magnavox
-Reference ID: GPS
-Serial Port: /dev/gps__u__; 4800bps 8N1
-Features: +ppsclock+ (required)
-
-== Deprecation warning ==
-
-This refclock is deprecated and obsolete. The NTPsec maintainers plan
-to remove it in a future release.  If you have a requirement for it,
-please make this known to us.
-
-== Description ==
-
-This driver supports the Magnavox MX4200 Navigation Receiver adapted to
-precision timing applications. It also supports all compatible
-receivers such as the 6-channel MX4200, MX4200D, and the 12-channel
-MX9212, MX9012R, and MX9112.
-
-image:pic/9400n.jpg["MX9400N",float="left",caption="Leica MX9400N Navigator"]
-https://web.archive.org/web/19971014210945/http://www.leica-gps.com/[Leica
-Geosystems] acquired the Magnavox commercial GPS technology business in
-February of 1994. They marketed and supported former Magnavox GPS
-products such as the MX4200 and its successors.
-
-== Operating Modes ==
-
-This driver supports two modes of operation, static and mobile,
-controlled by option +flag2+.
-
-In static mode (the default) the driver assumes that the GPS antenna is
-in a fixed location. The receiver is initially placed in a "Static, 3D
-Nav" mode, where latitude, longitude, elevation and time are calculated
-for a fixed station. An average position is calculated from this data.
-After 24 hours, the receiver is placed into a "Known Position" mode,
-initialized with the calculated position, and then solves only for time.
-
-In mobile mode, the driver assumes the GPS antenna is mounted on a
-moving platform such as a car, ship, or aircraft. The receiver is placed
-in "Dynamic, 3D Nav" mode and solves for position, altitude and time
-while moving. No position averaging is performed.
-
-== Monitor Data ==
-
-The driver writes each timecode as received to the +clockstats+ file.
-Documentation for the 'NMEA-0183' proprietary sentences produced by the
-MX4200 can be found in link:mx4200data.html[MX4200 Receiver Data
-Format].
-
-== Driver Options ==
-
-+unit+ 'number'::
-  The driver unit number, defaulting to 0. Used as a distinguishing
-  suffix in the driver device name. 
-+time1+ 'time'::
-   Specifies the time offset calibration factor, in seconds and fraction,
-   with default 0.0.
-+time2' 'time'::
-   Not used by this driver.
-+stratum+ 'number'::
-   Specifies the driver stratum, in decimal from 0 to 15, with default 0.
-+refid+ 'string'::
-   Specifies the driver reference identifier, an ASCII string from one to
-   four characters, with default +GPS+.
-+flag1 {0 | 1}+::
-   Not used by this driver.
-+flag2 {0 | 1}+::
-   Assume GPS receiver is on a mobile platform if set.
-+flag3 {0 | 1}+::
-   Not used by this driver.
-+flag4 {0 | 1}+::
-   Not used by this driver.
-+subtype+::
-   Not used by this driver.
-+mode+::
-   Not used by this driver.
-+path+ 'filename'::
-  Overrides the default device path.
-+ppspath+ 'filename'::
-  Not used by this driver.
-+baud+ 'number'::
-  Overrides the default baud rate.
-
-== Configuration Example ==
-
-----------------------------------------------------------------------------
-refclock magnavox
-----------------------------------------------------------------------------
-
-== Additional Information ==
-
-link:refclock.html[Reference Clock Drivers]
-
-'''''
-
-include::includes/footer.txt[]


=====================================
docs/mx4200data.txt deleted
=====================================
--- a/docs/mx4200data.txt
+++ /dev/null
@@ -1,514 +0,0 @@
-= MX4200 Receiver Data Format =
-
-== Table of Contents ==
-* link:#control[Control Port Sentences]
-* link:#input[Control Port Input Sentences]
-** link:#input_000[$PMVXG,000] Initialization/Mode Control - Part A
-** link:#input_001[$PMVXG,001] Initialization/Mode Control - Part B
-** link:#input_007[$PMVXG,007] Control Port Configuration
-** link:#input_023[$PMVXG,023] Time Recovery Configuration
-** link:#input_gpq[$CDGPQ,YYY] Query From a Remote Device / Request to Output a Sentence
-* link:#output[Control Port Output Sentences]
-** link:#output_000[$PMVXG,000] Receiver Status
-** link:#output_021[$PMVXG,021] Position, Height, Velocity
-** link:#output_022[$PMVXG,022] DOPs
-** link:#output_030[$PMVXG,030] Software Configuration
-** link:#output_101[$PMVXG,101] Control Sentence Accept/Reject
-** link:#output_523[$PMVXG,523] Time Recovery Configuration
-** link:#output_830[$PMVXG,830] Time Recovery Results
-
-[[control]]
-== Control Port Sentences ==
-
-The Control (CDU) Port is used to initialize, monitor, and control the
-receiver. The structure of the control port sentences is based on the
-_NMEA-0183_ Standard for Interfacing Marine Electronics Navigation Devices
-(version 1.5). For more details, please refer to the _NMEA-0183_
-Specification available from the https://www.nmea.org/[National Marine
-Electronics Association].
-
-Reserved characters are used to indicate the beginning and the end of
-records in the data stream, and to delimit data fields within a
-sentence. Only printable ASCII characters (Hex 20 through 7F) may be
-used in a sentence. link:#table_2[Table 2] lists the reserved characters
-and defines their usage. link:#table_1[Table 1] illustrates the general
-Magnavox proprietary NMEA sentence format.
-
-=== Table 1. Magnavox Proprietary NMEA Sentence Format ===
-
- +$PMVXG,XXX,...................*CK +
-
-[width="100%",cols="<50%,<50%",options="header"]
-|================================
-| Character | Meaning
-| +$+       | Sentence Start Character
-| +P+       | Special ID (P = Proprietary)
-| +MVX+     | Originator ID (MVX = Magnavox)
-| +G+       | Interface ID (G = GPS)
-| +XXX+     | Sentence Type
-| +...+     | Data
-| +*+       | Optional Checksum Field Delimiter
-| +CK+      | Optional Checksum
-|================================
-
-=== Table 2. NMEA Sentence Reserved Characters ===
-
-[width="100%",cols="<34%,<33%,<33%",options="header"]
-|================================
-| Character   | Hex Value  | Usage
-| +$+         | 24         | Start of Sentence Identifier
-| +{cr}{lf}+  | 0D 0A      | End of Sentence Identifier
-| +,+         | 2C         | Sentence Delimiter
-| +*+         | 2A         | Optional Checksum Field Delimiter
-|================================
-
-Following the start character +$+, are five characters which constitute
-the block label of the sentence. For Magnavox proprietary sentences,
-this label is always +PMVXG+. The next field after the block label is
-the sentence type, consisting of three decimal digits.
-
-The data, delimited by commas, follows the sentence type. Note that the
-receiver uses a free-format parsing algorithm, so you need not send the
-exact number of characters shown in the examples. You will need to use
-the commas to determine how many bytes of data need to be retrieved.
-
-The notation +CK+ shown in link:#table_1[Table 1] symbolically indicates
-the optional checksum in the examples. The checksum is computed by
-exclusive-ORing all of the bytes between the +$+ and the +*+ characters.
-The +$+, +*+ and the checksum are not included in the checksum
-computation.
-
-Checksums are optional for Control Port input sentences, but are highly
-recommended to limit the effects of communication errors. Magnavox
-receivers always generate checksums for Control Port output sentences.
-
-ASCII data characters are transmitted in the following format:
-
-[width="100%",cols="<50%,<50%",]
-|===============
-| Data Bits | 8 (msb always 0)
-| Parity    | None
-| Stop Bits | 1
-|===============
-
-NULL fields are fields which do not contain any data. They would appear
-as two commas together in the sentence format, except for the final
-field. Some Magnavox proprietary sentences require that the format
-contain NULL fields. mandatory NULL fields are identified by an \'*' next
-to the respective field.
-
-'''''
-
-[[input]]
-== Control Port Input Sentences ==
-
-These are the subset of the MX4200 control port input sentences sent by
-the NTP driver to the GPS receiver.
-
-'''''
-
-[[input_000]]
-=== $PMVXG,000 ===
-
-.Initialization/Mode Control - Part A
-Initializes the time, position and antenna height of the MX4200.
-
-[width="99%",cols="<20%,<16%,<16%,<16%,<16%,<16%",options="header"]
-|=============================================================================
-| Field | Description          | Units      | Format | Default |  Range
-| 1     | Day                  |            | Int    |         | 1-31
-| 2     | Month                |            | Int    |         | 1-12
-| 3     | Year                 |            | Int    |         | 1991-9999
-| 4     | GMT Time             | HHMMSS     | Int    |         | 000000-235959
-| 5     | WGS-84 Latitude      | DDMM.MMMM  | Float  | 0.0     | 0 - 8959.9999
-| 6     | North/South Indicator|            | Char   | N       | N,S
-| 7     | WGS-84 Longitude     | DDDMM.MMMM | Float  | 0.0     | 0 - 17959.9999
-| 8     | East/West Indicator  |            | Char   | E       | E,W
-| 9     | Altitude (height above Mean Sea Level) in meters (WGS-84)            | Meters     | Float  | 0.0     | +/-99999.0
-| 10    | Not Used             |            |        |         |
-|=============================================================================
-
-
-.Example:
---------------------------------------------------
-$PMVXG,000,,,,,,,,,,*48
-$PMVXG,000,,,,,5128.4651,N,00020.0715,W,58.04,*4F
---------------------------------------------------
-
-'''''
-
-[[input_001]]
-=== $PMVXG,001 ===
-
-.Initialization/Mode Control - Part B
-Specifies various navigation parameters: Altitude aiding, acceleration
-DOP limits, and satellite elevation limits.
-
-[width="99%",cols="<10%,<26%,<16%,<16%,<16%,<16%",options="header"]
-|=============================================================================
-| Field | Description          | Units      | Format | Default | Range
-| *1     | Constrain Altitude   |            | Int    | 1       | 0=3D Only
-1=Auto
-2=2D Only
-| 2     | Not Used             |            |        |         |
-| *3     | Horizontal Acceleration Factor           | m/sec^2    | Float  | 1.0     | 0.5-10.0
-| *4     | Not Used             |            |        |         |
-| *5     | VDOP Limit           |            | Int    | 10      | 1-9999
-| *6     | HDOP Limit           |            | Int    | 10      | 1-9999
-| 7     | Elevation Limit      | Deg        | Int    | 5       | 0-90
-| 8     | Time Output Mode     |            | Char   | U       | U=UTC
- L=Local Time
-| 9     | Local Time Offset    | HHMM       | Int    | 0       | +/- 0-2359
-|=============================================================================
-
-// In the HTML original, field numbers 1, 3, 4, 5, and 6 are
-// preceded with asterisks.  No explanation is given
-
-.Example:
---------------------------------------------------
-$PMVXG,001,3,,0.1,0.1,10,10,5,U,0*06
---------------------------------------------------
-
-'''''
-
-[[input_007]]
-=== $PMVXG,007 ===
-
-.Control Port Output Configuration
-This message enables or disables output of the specified sentence and
-defines the output rate. The user sends this message for each sentence
-that the receiver is to output.
-
-[width="99%",cols="<20%,<16%,<16%,<16%,<16%,<16%",options="header"]
-|===============================================================================
-| Field | Description                    | Units      |Format|Default| Range
-| 1     | Control Port Output Block Label|            |Char  |       |
-| 2     | Clear Current Output List      |            |Int   |       |0=No
-1=Yes
-| 3     | Add/Delete Sentence from List  |            |Int   |       |1=Append
-2=Delete
-| 4     | Not used                       |            |      |       |
-| 5     | Sentence Output Rate           | Sec        | Int  |       |1-999
-| 6     | # digits of Precision for CGA and GLL sentences| |Int|2    |2-4
-| 7     | Not used                       |            |      |       |
-| 8     | Not used                       |            |      |       |
-|===============================================================================
-
-.Example:
---------------------------------------------------
-$PMVXG,007,022,0,1,,1,,,*4F+
---------------------------------------------------
-
-'''''
-
-[[input_023]]
-=== $PMVXG,023 ===
-
-.Time Recovery Configuration
-
-This message is used to enable/disable the time recovery feature of the
-receiver. The time synchronization for the 1PPS output is specified in
-addition to a user time bias and an error tolerance for a valid pulse.
-This record is accepted in units configured for time recovery. If the
-back panel contains a 1PPS outlet, the receiver is a time recovery unit.
-
-// In the HTML original, field number 1 is preceded with an asterisk.
-// No explanation is given
-
-[width="99%",cols="<20%,<16%,<16%,<16%,<16%,<16%",options="header"]
-|===============================================================================
-| Field | Description               | Units  | Format | Default | Range
-| *1     | Time Recovery Mode        |        | Char   | D       |D=Dynamic
-S=Static
-K=Known Position
-N=No Time Recovery
-| 2     | Time Synchronization      |        | Char   | G       |U=UTC
-G=GPS
-| 3     | Time Mark Mode            |        | Char   | A       |A=Always
-V=Valid Pulses Only
-| 4     | Maximum Time Error        | Nsec   | Int    | 100     |50-100
-| 5     | User Time Bias            | Nsec   | Int    | 0       |+/- 99999
-| 6     | ASCII Time Message Control|        | Int    | 0       |0=No output
-1=830 to Control Port
-2=830 to Equipment Port
-| 7     | Known Pos PRN             |        | Int    | 0       |1-32
-0=Track All Sats
-|===============================================================================
-
-.Example:
---------------------------------------------------
-$PMVXG,023,S,U,A,500,0,1,*16
---------------------------------------------------
-
-'''''
-
-[[input_gpq]]
-=== $CDGPQ,YYY ===
-
-.Query From a Remote Device / Request to Output a Sentence
-Enables the controller to request a one-time transmission of a specific
-block label. To output messages at a periodic rate, refer to input
-sentence link:#input_007[$PMVXG,007].
-
-[width="99%",cols="<20%,<16%,<16%,<16%,<16%,<16%",options="header"]
-|===============================================================================
-| Field | Description               | Units  | Format | Default | Range
-| 1:CD  | ID of Remote Device       |        | Char   |         |(See _NMEA-0183_)
-| 2:GP  | GPS                       |        | Char   |         |(See _NMEA-0183_)
-| 3:CD  | Query                     |        | Char   |         |(See _NMEA-0183_)
-| 4:YYY | Label of desired sentence |        | Char   |         |Any Valid NMEA
-or Magnavox Sentence Type
-|===============================================================================
-
-.Example:
---------------------------------------------------
-$CDGPQ,030*5E
---------------------------------------------------
-
-'''''
-
-[[output]]
-== Control Port Output Sentences ==
-
-These are the subset of the MX4200 control port output sentences
-recognized by the NTP driver.
-
-'''''
-
-[[output_000]]
-=== $PMVXG,000 ===
-
-.Receiver Status
-Returns the current status of the receiver including the operating mode,
-number of satellites visible, and the number of satellites being
-tracked.
-
-[width="100%",cols="<20%,<20%,<20%,<20%,<20%",options="header"]
-|===============================================================================
-| Field | Description               |Units | Format | Range
-| 1     | Current Receiver Status   |      | Char   |ACQ=Reacquisition
-ALT=Constellation Selection
-IAC=Initial Acquisition
-IDL=Idle, No Satellites
-NAV=Navigating
-STS=Search The Sky
-TRK=Tracking
-| 2 | Number of Satellites that should be Visible||Int|0-12
-| 3 | Number of Satellites being Tracked         ||Int|0-12
-| 4 | Time since Last Navigation    |HHMM  | Int      |0-2359
-| 5 | Initialization Status         |      | Int |0=Waiting for Initialization
-1=Initialization Complete
-|===============================================================================
-
-.Example:
---------------------------------------------------
-$PMVXG,000,TRK,3,3,0122,1*19
---------------------------------------------------
-
-'''''
-
-[[output_021]]
-=== $PMVXG,021 ===
-
-.Position, Height, Velocity
-This sentence gives the receiver position, height, navigation mode and
-velocity north/east. _This sentence is intended for post analysis
-applications._
-
-[width="100%",cols="<20%,<20%,<20%,<20%,<20%",options="header"]
-|===============================================================================
-| Field | Description           | Units                 | Format | Range
-| 1     | UTC Measurement Time  | Seconds into the week | Float  | 0-604800.00
-| 2     | WGS-84 Latitude       | DDMM.MMMM             | Float  | 0-89.9999
-| 3     | North/South Indicator |                       | Char   | N, S
-| 4     | WGS-84 Longitude      | DDDMM.MMMM            | Float  | 0-179.9999
-| 5     | East/West Indicator   |                       | Char   | E, W
-| 6     | Altitude (MSL)        | Meters                | Float  |
-| 7     | Geoidal Height        | Meters                | Float  |
-| 8     | Velocity East         | M/Sec                 | Float  |
-| 9     | Velocity North        | M/Sec                 | Float  |
-| 10    | Navigation Mode       |  | Int |_Navigating_
-1=Position From a Remote Device
-2=2D
-3=3D
-4=2D differential
-5=3D differential
-_Not Navigating_
-51=Too Few Satellites
-52=DOPs too large
-53=Position STD too large
-54=Velocity STD too large
-55=Too many iterations for velocity
-56=Too many iterations for position
-57=3 Sat Startup failed
-|===============================================================================
-
-
-.Example:
---------------------------------------------------
-$PMVXG,021,142244.00,5128.4744,N,00020.0593,W,00054.4,0047.4,0000.1,-000.2,03*66
---------------------------------------------------
-
-'''''
-
-[[output_022]]
-=== $PMVXG,022 ===
-
-.DOPs
-This sentence reports the DOP (Dilution Of Precision) values actually
-used in the measurement processing corresponding to the satellites
-listed. The satellites are listed in receiver channel order. Fields
-11-16 are output only on 12-channel receivers.
-
-[width="100%",cols="<20%,<20%,<20%,<20%,<20%",options="header"]
-|=============================================================================
-| Field | Description           | Units                 | Format | Range
-| 1     | UTC Measurement Time  | Seconds into the week | Float  |0-604800.00
-| 2     | East DOP (EDOP)       |                       | Float  |
-| 3     | North DOP (NDOP)      |                       | Float  |
-| 4     | Vertical DOP (VDOP)   |                       | Float  |
-| 5     | PRN on Channel #1     |                       | Int    |1-32
-| 6     | PRN on Channel #2     |                       | Int    |1-32
-| 7     | PRN on Channel #3     |                       | Int    |1-32
-| 8     | PRN on Channel #4     |                       | Int    |1-32
-| 9     | PRN on Channel #5     |                       | Int    |1-32
-| 10    | PRN on Channel #6     |                       | Int    |1-32
-| 11    | PRN on Channel #7     |                       | Int    |1-32
-| 12    | PRN on Channel #8     |                       | Int    |1-32
-| 13    | PRN on Channel #9     |                       | Int    |1-32
-| 14    | PRN on Channel #10    |                       | Int    |1-32
-| 15    | PRN on Channel #11    |                       | Int    |1-32
-| 16    | PRN on Channel #12    |                       | Int    |1-32
-|=============================================================================
-
-.Example:
---------------------------------------------------
-$PMVXG,022,142243.00,00.7,00.8,01.9,27,26,10,09,13,23*77
---------------------------------------------------
-
-'''''
-
-[[output_030]]
-=== $PMVXG,030 ===
-
-*Software Configuration*
-
-This sentence contains the navigation processor and baseband firmware
-version numbers.
-
-[width="100%",cols="<20%,<20%,<20%,<20%,<20%",options="header"]
-|=============================================================================
-| Field | Description                      | Units | Format | Range
-| 1     | Nav Processor Version Number     |       | Char   |
-| 2     | Baseband Firmware Version Number |       | Char   |
-|=============================================================================
-
-.Example:
---------------------------------------------------
-$PMVXG,030,DA35,015
---------------------------------------------------
-
-'''''
-
-[[output_101]]
-=== $PMVXG,101 ===
-
-.Control Sentence Accept/Reject
-This sentence is returned (on the Control Port) for every *$PMVXG* and
-*$XXGPQ* sentence that is received.
-
-[width="100%",cols="<20%,<20%,<20%,<20%,<20%",options="header"]
-|=============================================================================
-| Field | Description            |Units| Format | Range
-| 1     | Sentence ID            |     | Char   |
-| 2     | Accept/Reject Status   |     | Int    |0=Sentence Accepted
-1=Bad Checksum
-2=Illegal Value
-3=Unrecognized ID
-4=Wrong # of fields
-5=Required Data Field Missing
-6=Requested Sentence Unavailable
-| 3     | Bad Field Index        |     | Int    |
-| 4     | Requested Sentence ID (If field #1 = GPQ) | | Int |
-|=============================================================================
-
-.Example:
---------------------------------------------------
-$PMVXG,101,GPQ,0,,030*0D
---------------------------------------------------
-
-'''''
-
-[[output_523]]
-=== $PMVXG,523 ===
-
-.Time Recovery Configuration
-This sentence contains the configuration of the time recovery function
-of the receiver.
-
-[width="100%",cols="<20%,<20%,<20%,<20%,<20%",options="header"]
-|================================================================
-| Field | Description            |Units| Format | Range
-| 1     | Time Recovery Mode     |     | Char   |D=Dynamic
-S=Static
-K=Known Position
-N=No Time Recovery
-| 2     | Time Synchronization   |     | Char   |U=UTC Time
-G=GPS Time
-| 3     | Time Mark Mode         |     | Char   |A=Always Output Time Pulse
-V=Only when Valid
-| 4| Maximum Time Error for which a time mark will be considered valid|Nsec|Int|
-| 5     | User Time Bias         |Nsec |Int     |
-| 6     | Time Message Control   |     |Int     |0=No Message
-1=830 to Control Port
-2=830 to Equipment Port
-| 7     | Not Used               |     |        |
-|================================================================
-
-.Example:
---------------------------------------------------
-$PMVXG,523,S,U,A,0500,000000,1,0*23
---------------------------------------------------
-
-'''''
-
-[[output_830]]
-=== $PMVXG,830 ===
-
-.Time Recovery Results
-This sentence is output approximately 1 second preceding the 1PPS
-output. It indicates the exact time of the next pulse, whether or not
-the time mark will be valid (based on operator-specified error
-tolerance), the time to which the pulse is synchronized, the receiver
-operating mode, and the time error of the *last* 1PPS output. The leap
-second flag (Field #11) is not output by older receivers.
-
-[width="100%",cols="<10%,<40%,<20%,<10%,<20%",options="header"]
-|=======================================================================
-| Field | Description            |Units   | Format | Range
-| 1     |Time Mark Valid        |        | Char   |T=Valid
-F=Not Valid
-| 2     |Year                   |        | Int    |1993-
-| 3     |Month                  |        | Int    |1-12
-| 4     |Day                    |Nsec    | Int    |1-31
-| 5     |Time                   |HH:MM:SS| Int    |00:00:00-23:59:59
-| 6     |Time Synchronization   |        | Char   |U=UTC
-G=GPS
-| 7     |Operating Mode         |        |Char    |D=Dynamic
-S=Static
-K=Known Position
-| 8     |Oscillator Offset - estimate of oscillator frequency error|PPB|Int|
-| 9     |Time Mark Error of last pulse|Nsec|Int     |
-| 10    |User Time Bias          |Nsec    |Int      |
-| 11    |Leap second flag - indicates that a leap second will occur. This value is usually zero except during the week prior to a leap second occurrence, when this value will be set to +/-. A value of +1 indicates that GPS time will be 1 second further ahead of UTC time.        |        |Int      |-1,0,1
-|=======================================================================
-
-
-.Example:
---------------------------------------------------
-$PMVXG,830,T,1998,10,12,15:30:46,U,S,000298,00003,000000,01*02
---------------------------------------------------
-
-'''''
-
-include::includes/footer.txt[]


=====================================
docs/pic/9400n.jpg deleted
=====================================
Binary files a/docs/pic/9400n.jpg and /dev/null differ


=====================================
docs/refclock.txt
=====================================
--- a/docs/refclock.txt
+++ b/docs/refclock.txt
@@ -145,10 +145,10 @@ entries than you expected.  Support for some very ancient drivers
 (notably, those rendered obsolete by the WWVB modulation change at
 2012-10-29T15:00:00Z) has been dropped in order to reduce our
 maintenance load. So have some other drivers (notably the Austron
-2200A/2201A) after having been end-of-lifed with no sign of
-aftermarket activity for more than ten years. Several others have been
-removed for relying on obsolete buses or hardware classes that no
-longer exist.
+2200A/2201A and Magnavox MX4200) after having been end-of-lifed with
+no sign of aftermarket activity for more than ten years. Several
+others have been removed for relying on obsolete buses or hardware
+classes that no longer exist.
 
 For security reasons, we will no longer support any refclock that
 requires a closed-source driver to run.  This filtered out the
@@ -165,7 +165,6 @@ the 6021 in the generic parse driver.
 |link:driver_spectracom.html[spectracom]| D | Generic Spectracom Receivers
 |link:driver_truetime.html[truetime]    | D | TrueTime GPS/GOES Receivers
 |link:driver_generic.html[generic]      | T | Generic Reference Driver (Parse)
-|link:driver_magnavox.html[magnavox]    | D | MX4200 and compatible GPS receivers
 |link:driver_arbiter.html[arbiter]      | D | Arbiter 1088A/B GPS Receiver
 |link:driver_modem.html[modem]          | - | NIST/USNO/PTB Modem Time Services
 |link:driver_nmea.html[nmea]            | T | Generic NMEA GPS Receiver


=====================================
include/ntp_refclock.h
=====================================
--- a/include/ntp_refclock.h
+++ b/include/ntp_refclock.h
@@ -233,12 +233,6 @@ extern	struct refclock	refclock_local;
 #define	refclock_local	refclock_none
 #endif
 
-#if defined(CLOCK_MAGNAVOX) && defined(HAVE_PPSAPI)
-extern	struct refclock	refclock_magnavox;
-#else
-#define	refclock_magnavox	refclock_none
-#endif
-
 #ifdef CLOCK_MODEM
 extern	struct refclock	refclock_modem;
 #else


=====================================
ntpd/refclock_conf.c
=====================================
--- a/ntpd/refclock_conf.c
+++ b/ntpd/refclock_conf.c
@@ -43,7 +43,7 @@ struct refclock * const refclock_conf[] = {
 	&refclock_none,		/* 6 was: REFCLK_IRIG_AUDIO */
 	&refclock_none,		/* 7 was: REFCLK_CHU_AUDIO */
 	&refclock_parse,	/* 8 REFCLK_GENERIC */
-	&refclock_magnavox,	/* 9 REFCLK_GPS_MX4200 */
+	&refclock_none,		/* 9 was: REFCLK_GPS_MX4200 */
 	&refclock_none,		/* 10 was: REFCLK_GPS_AS2201 */
 	&refclock_arbiter,	/* 11 REFCLK_GPS_ARBITER */
 	&refclock_none,		/* 12 was: REFCLK_IRIG_TPRO */


=====================================
ntpd/refclock_magnavox.c deleted
=====================================
--- a/ntpd/refclock_magnavox.c
+++ /dev/null
@@ -1,1587 +0,0 @@
-/*
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66.
- *
- * Copyright 2015 by the NTPsec project contributors
- * SPDX-License-Identifier: BSD-4-clause
- *
- * Modified: Marc Brett <marc.brett at westgeo.com>   Sept, 1999.
- *
- * 1. Added support for alternate PPS schemes, with code mostly
- *    copied from the Oncore driver (Thanks, Poul-Henning Kamp).
- *    This code runs on SunOS 4.1.3 with ppsclock-1.6a1 and Solaris 7.
- */
-
-
-#include "config.h"
-#include "ntpd.h"
-#include "ntp_io.h"
-#include "ntp_refclock.h"
-#include "ntp_stdlib.h"
-#include "ntp_calendar.h"
-#include "timespecops.h"
-
-#include <stdio.h>
-#include <ctype.h>
-
-#ifdef HAVE_PPSAPI
-# include "ppsapi_timepps.h"
-#endif /* HAVE_PPSAPI */
-
-/*
- * This driver supports the Magnavox Model MX 4200 GPS Receiver
- * adapted to precision timing applications.  It requires the PPS API.
- *
- * It's likely that other compatible Magnavox receivers such as the
- * MX 4200D, MX 9212, MX 9012R, MX 9112 will be supported by this code.
- */
-
-/*
- * GPS Definitions
- */
-#define	DEVICE		"/dev/gps%d"	/* device name and unit */
-#define	SPEED232	B4800		/* baud */
-
-/*
- * Radio interface parameters
- */
-#define	PRECISION	(-18)		/* precision assumed (about 4 us) */
-#define	REFID		"GPS\0"		/* reference id */
-#define	NAME		"MAGNAVOX"	/* shortname */
-#define	DESCRIPTION	"Magnavox MX4200 and compatible GPS receivers" /* who we are */
-#define	DEFFUDGETIME	0		/* default fudge time (ms) */
-
-#define	SLEEPTIME	32	/* seconds to wait for reconfig to complete */
-
-/*
- * Position Averaging.
- */
-#define INTERVAL	1	/* Interval between position measurements (s) */
-#define AVGING_TIME	24	/* Number of hours to average */
-/* central meridian is +/- 180 degrees, so -9999 is well out of range */
-#define NOT_INITIALIZED	-9999.	/* initial pivot longitude */
-
-/* records transmitted from extern CDU to MX 4200 */
-#define PMVXG_S_INITMODEA	0	/* initialization/mode part A */
-#define PMVXG_S_INITMODEB	1	/* initialization/mode part B*/
-#define PMVXG_S_SATHEALTH	2	/* satellite health control */
-#define PMVXG_S_DIFFNAV		3	/* differential navigation control */
-#define PMVXG_S_PORTCONF	7	/* control port configuration */
-#define PMVXG_S_GETSELFTEST	13	/* self test (request results) */
-#define PMVXG_S_RTCMCONF	16	/* RTCM port configuration */
-#define PMVXG_S_PASSTHRU	17	/* equipment port pass-thru config */
-#define PMVXG_S_RESTART		18	/* restart control */
-#define PMVXG_S_OSCPARAM	19	/* oscillator parameter */
-#define PMVXG_S_DOSELFTEST	20	/* self test (activate a test) */
-#define PMVXG_S_TRECOVCONF	23	/* time recovery configuration */
-#define PMVXG_S_RAWDATASEL	24	/* raw data port data selection */
-#define PMVXG_S_EQUIPCONF	26	/* equipment port configuration */
-#define PMVXG_S_RAWDATACONF	27	/* raw data port configuration */
-
-/* records transmitted from MX 4200 to external CDU */
-#define PMVXG_D_STATUS		0	/* status */
-#define PMVXG_D_POSITION	1	/* position */
-#define PMVXG_D_OPDOPS		3	/* (optimum) DOPs */
-#define PMVXG_D_MODEDATA	4	/* mode data */
-#define PMVXG_D_SATPRED		5	/* satellite predictions */
-#define PMVXG_D_SATHEALTH	6	/* satellite health status */
-#define PMVXG_D_UNRECOG		7	/* unrecognized request response */
-#define PMVXG_D_SIGSTRLOC	8	/* sig strength & location (sats 1-4) */
-#define PMVXG_D_SPEEDHEAD	11	/* speed/heading data */
-#define PMVXG_D_OSELFTEST	12	/* (old) self-test results */
-#define PMVXG_D_SIGSTRLOC2	18	/* sig strength & location (sats 5-8) */
-#define PMVXG_D_OSCPARAM	19	/* oscillator parameter */
-#define PMVXG_D_SELFTEST	20	/* self test results */
-#define PMVXG_D_PHV		21	/* position, height & velocity */
-#define PMVXG_D_DOPS		22	/* DOPs */
-#define PMVXG_D_SOFTCONF	30	/* software configuration */
-#define PMVXG_D_DIFFGPSMODE	503	/* differential gps moding */
-#define PMVXG_D_TRECOVUSEAGE	523	/* time recovery usage */
-#define PMVXG_D_RAWDATAOUT	524	/* raw data port data output */
-#define PMVXG_D_TRECOVRESULT	828	/* time recovery results */
-#define PMVXG_D_TRECOVOUT	830	/* time recovery output message */
-
-/*
- * MX4200 unit control structure.
- */
-struct mx4200unit {
-	unsigned int  pollcnt;			/* poll message counter */
-	bool   polled;			/* Hand in a time sample? */
-	unsigned int  lastserial;		/* last pps serial number */
-	double avg_lat;			/* average latitude */
-	double avg_lon;			/* average longitude */
-	double avg_alt;			/* average height */
-	double central_meridian;	/* central meridian */
-	double N_fixes;			/* Number of position measurements */
-	int    last_leap;		/* leap second warning */
-	bool   moving;			/* mobile platform? */
-	unsigned long sloppyclockflag;	/* driver option flags */
-	bool   known;			/* position known yet? */
-	unsigned long clamp_time;	/* when to stop position averaging */
-	unsigned long log_time;		/* when to print receiver status */
-	pps_handle_t	pps_h;
-	pps_params_t	pps_p;
-	pps_info_t	pps_i;
-};
-
-static char pmvxg[] = "PMVXG";
-static int year_last_modified;
-
-/*
- * Function prototypes
- */
-static	bool	mx4200_start	(int, struct peer *);
-static	void	mx4200_shutdown	(int, struct peer *);
-static	void	mx4200_receive	(struct recvbuf *);
-static	void	mx4200_poll	(int, struct peer *);
-
-static	const char *	mx4200_parse_t	(struct peer *);
-static	const char *	mx4200_parse_p	(struct peer *);
-static	const char *	mx4200_parse_s	(struct peer *);
-int	mx4200_cmpl_fp	(const void *, const void *);
-static	bool	mx4200_config	(struct peer *);
-static	void	mx4200_ref	(struct peer *);
-static	void	mx4200_send	(struct peer *, const char *, ...)
-    __attribute__ ((format (printf, 2, 3)));
-static	uint8_t	mx4200_cksum	(char *, int);
-static	int	mx4200_jday	(int, int, int);
-static	void	mx4200_debug	(struct peer *, const char *, ...)
-    __attribute__ ((format (printf, 2, 3)));
-static	bool	mx4200_pps	(struct peer *);
-
-/*
- * Transfer vector
- */
-struct	refclock refclock_magnavox = {
-	NAME,			/* basename of driver */
-	mx4200_start,		/* start up driver */
-	mx4200_shutdown,	/* shut down driver */
-	mx4200_poll,		/* transmit poll message */
-	NULL,			/* not used (old mx4200_control) */
-	NULL,			/* initialize driver (not used) */
-	NULL			/* timer - not used */
-};
-
-
-
-/*
- * mx4200_start - open the devices and initialize data for processing
- */
-static bool
-mx4200_start(
-	int unit,
-	struct peer *peer
-	)
-{
-	struct mx4200unit *up;
-	struct refclockproc *pp;
-	int fd;
-	char gpsdev[20];
-	struct calendar date;
-
-	/*
-	 * Open serial port
-	 */
-	snprintf(gpsdev, sizeof(gpsdev), DEVICE, unit);
-	fd = refclock_open(peer->cfg.path ? peer->cfg.path : gpsdev,
-			   peer->cfg.baud ? peer->cfg.baud : SPEED232,
-			   LDISC_PPS);
-	if (fd < 0)
-		return false;
-
-	/*
-	 * Allocate unit structure
-	 */
-	up = emalloc_zero(sizeof(*up));
-	pp = peer->procptr;
-	pp->io.clock_recv = mx4200_receive;
-	pp->io.srcclock = peer;
-	pp->io.datalen = 0;
-	pp->io.fd = fd;
-	if (!io_addclock(&pp->io)) {
-		close(fd);
-		pp->io.fd = -1;
-		free(up);
-		return false;
-	}
-	pp->unitptr = up;
-
-	/*
-	 * Initialize miscellaneous variables
-	 */
-	peer->precision = PRECISION;
-	pp->clockname = NAME;
-	pp->clockdesc = DESCRIPTION;
-	memcpy((char *)&pp->refid, REFID, REFIDLEN);
-	peer->sstclktype = CTL_SST_TS_LF;
-        /* find the base year for time, can't be before build date,
-         * unless we actually get some tests... */
-	ntpcal_get_build_date(&date);
-	year_last_modified = date.year;
-
-	/* Ensure the receiver is properly configured */
-	return mx4200_config(peer);
-}
-
-
-/*
- * mx4200_shutdown - shut down the clock
- */
-static void
-mx4200_shutdown(
-	int unit,
-	struct peer *peer
-	)
-{
-	struct mx4200unit *up;
-	struct refclockproc *pp;
-
-	UNUSED_ARG(unit);
-
-	pp = peer->procptr;
-	up = pp->unitptr;
-	if (-1 != pp->io.fd)
-		io_closeclock(&pp->io);
-	if (NULL != up)
-		free(up);
-}
-
-
-/*
- * mx4200_config - Configure the receiver
- */
-static bool
-mx4200_config(
-	struct peer *peer
-	)
-{
-	char tr_mode;
-	int add_mode;
-	struct mx4200unit *up;
-	struct refclockproc *pp;
-	int mode;
-
-	pp = peer->procptr;
-	up = pp->unitptr;
-
-	/*
-	 * Initialize the unit variables
-	 *
-	 * STRANGE BEHAVIOUR WARNING: The driver option flags are not available
-	 * at the time mx4200_start is called.  These are set later,
-	 * and so the code must be prepared to handle changing flags.
-	 */
-	up->sloppyclockflag = pp->sloppyclockflag;
-	if (pp->sloppyclockflag & CLK_FLAG2) {
-		up->moving   = true;	/* Receiver on mobile platform */
-		msyslog(LOG_DEBUG, "REFCLOCK: mx4200_config: mobile platform");
-	} else {
-		up->moving   = false;	/* Static Installation */
-	}
-	up->pollcnt     	= 2;
-	up->polled      	= false;
-	up->known       	= false;
-	up->avg_lat     	= 0.0;
-	up->avg_lon     	= 0.0;
-	up->avg_alt     	= 0.0;
-	up->central_meridian	= NOT_INITIALIZED;
-	up->N_fixes    		= 0.0;
-	up->last_leap   	= 0;	/* LEAP_NOWARNING */
-	up->clamp_time  	= current_time + (AVGING_TIME * 60 * 60);
-	up->log_time    	= current_time + SLEEPTIME;
-
-	if (time_pps_create(pp->io.fd, &up->pps_h) < 0) {
-		perror("time_pps_create");
-		msyslog(LOG_ERR,
-			"REFCLOCK: mx4200_config: time_pps_create failed: %m");
-		return false;
-	}
-	if (time_pps_getcap(up->pps_h, &mode) < 0) {
-		msyslog(LOG_ERR,
-			"REFCLOCK: mx4200_config: time_pps_getcap failed: %m");
-		return false;
-	}
-
-	if (time_pps_getparams(up->pps_h, &up->pps_p) < 0) {
-		msyslog(LOG_ERR,
-			"REFCLOCK: mx4200_config: time_pps_getparams failed: %m");
-		return false;
-	}
-
-	/* nb. only turn things on, if someone else has turned something
-	 *      on before we get here, leave it alone!
-	 */
-
-	up->pps_p.mode = PPS_CAPTUREASSERT | PPS_TSFMT_TSPEC;
-	up->pps_p.mode &= mode;		/* only set what is legal */
-
-	if (time_pps_setparams(up->pps_h, &up->pps_p) < 0) {
-		perror("time_pps_setparams");
-		msyslog(LOG_ERR,
-			"REFCLOCK: mx4200_config: time_pps_setparams failed: %m");
-		exit(1);
-	}
-
-	if (time_pps_kcbind(up->pps_h, PPS_KC_HARDPPS, PPS_CAPTUREASSERT,
-			PPS_TSFMT_TSPEC) < 0) {
-		perror("time_pps_kcbind");
-		msyslog(LOG_ERR,
-			"REFCLOCK: mx4200_config: time_pps_kcbind failed: %m");
-		exit(1);
-	}
-
-
-	/*
-	 * "007" Control Port Configuration
-	 * Zero the output list (do it twice to flush possible junk)
-	 */
-	mx4200_send(peer, "%s,%03d,,%d,,,,,,", pmvxg,
-	    PMVXG_S_PORTCONF,
-	    /* control port output block Label */
-	    1);		/* clear current output control list (1=yes) */
-	/* add/delete sentences from list */
-	/* must be null */
-	/* sentence output rate (sec) */
-	/* precision for position output */
-	/* nmea version for cga & gll output */
-	/* pass-through control */
-	mx4200_send(peer, "%s,%03d,,%d,,,,,,", pmvxg,
-	    PMVXG_S_PORTCONF, 1);
-
-	/*
-	 * Request software configuration so we can syslog the firmware version
-	 */
-	mx4200_send(peer, "%s,%03d", "CDGPQ", PMVXG_D_SOFTCONF);
-
-	/*
-	 * "001" Initialization/Mode Control, Part A
-	 * Where ARE we?
-	 */
-	mx4200_send(peer, "%s,%03d,,,,,,,,,,", pmvxg,
-	    PMVXG_S_INITMODEA);
-	/* day of month */
-	/* month of year */
-	/* year */
-	/* gmt */
-	/* latitude   DDMM.MMMM */
-	/* north/south */
-	/* longitude DDDMM.MMMM */
-	/* east/west */
-	/* height */
-	/* Altitude Reference 1=MSL */
-
-	/*
-	 * "001" Initialization/Mode Control, Part B
-	 * Start off in 2d/3d coast mode, holding altitude to last known
-	 * value if only 3 satellites available.
-	 */
-	mx4200_send(peer, "%s,%03d,%d,,%.1f,%.1f,%d,%d,%d,%c,%d",
-	    pmvxg, PMVXG_S_INITMODEB,
-	    3,		/* 2d/3d coast */
-	    /* reserved */
-	    0.1,	/* hor accel fact as per Steve (m/s**2) */
-	    0.1,	/* ver accel fact as per Steve (m/s**2) */
-	    10,		/* vdop */
-	    10,		/* hdop limit as per Steve */
-	    5,		/* elevation limit as per Steve (deg) */
-	    'U',	/* time output mode (UTC) */
-	    0);		/* local time offset from gmt (HHHMM) */
-
-	/*
-	 * "023" Time Recovery Configuration
-	 * Get UTC time from a stationary receiver.
-	 * (Set field 1 'D' == dynamic if we are on a moving platform).
-	 * (Set field 1 'S' == static  if we are not moving).
-	 * (Set field 1 'K' == known position if we can initialize lat/lon/alt).
-	 */
-
-	if (pp->sloppyclockflag & CLK_FLAG2)
-		up->moving   = true;	/* Receiver on mobile platform */
-	else
-		up->moving   = false;	/* Static Installation */
-
-	up->pollcnt  = 2;
-	if (up->moving) {
-		/* dynamic: solve for pos, alt, time, while moving */
-		tr_mode = 'D';
-	} else {
-		/* static: solve for pos, alt, time, while stationary */
-		tr_mode = 'S';
-	}
-	mx4200_send(peer, "%s,%03d,%c,%c,%c,%d,%d,%d,", pmvxg,
-	    PMVXG_S_TRECOVCONF,
-	    tr_mode,	/* time recovery mode (see above ) */
-	    'U',	/* synchronize to UTC */
-	    'A',	/* always output a time pulse */
-	    500,	/* max time error in ns */
-	    0,		/* user bias in ns */
-	    1);		/* output "830" sentences to control port */
-			/* Multi-satellite mode */
-
-	/*
-	 * Output position information (to calculate fixed installation
-	 * location) only if we are not moving
-	 */
-	if (up->moving) {
-		add_mode = 2;	/* delete from list */
-	} else {
-		add_mode = 1;	/* add to list */
-	}
-
-
-	/*
-	 * "007" Control Port Configuration
-	 * Output "021" position, height, velocity reports
-	 */
-	mx4200_send(peer, "%s,%03d,%03d,%d,%d,,%d,,,", pmvxg,
-	    PMVXG_S_PORTCONF,
-	    PMVXG_D_PHV, /* control port output block Label */
-	    0,		/* clear current output control list (0=no) */
-	    add_mode,	/* add/delete sentences from list (1=add, 2=del) */
-	    		/* must be null */
-	    INTERVAL);	/* sentence output rate (sec) */
-			/* precision for position output */
-			/* nmea version for cga & gll output */
-			/* pass-through control */
-
-	return true;
-}
-
-/*
- * mx4200_ref - Reconfigure unit as a reference station at a known position.
- */
-static void
-mx4200_ref(
-	struct peer *peer
-	)
-{
-	struct mx4200unit *up;
-	struct refclockproc *pp;
-	double minute, lat, lon, alt;
-	char lats[16], lons[16];
-	char nsc, ewc;
-
-	pp = peer->procptr;
-	up = pp->unitptr;
-
-	/* Should never happen! */
-	if (up->moving) return;
-
-	/*
-	 * Set up to output status information in the near future
-	 */
-	up->log_time    = current_time + SLEEPTIME;
-
-	/*
-	 * "007" Control Port Configuration
-	 * Stop outputting "021" position, height, velocity reports
-	 */
-	mx4200_send(peer, "%s,%03d,%03d,%d,%d,,,,,", pmvxg,
-	    PMVXG_S_PORTCONF,
-	    PMVXG_D_PHV, /* control port output block Label */
-	    0,		/* clear current output control list (0=no) */
-	    2);		/* add/delete sentences from list (2=delete) */
-			/* must be null */
-	    		/* sentence output rate (sec) */
-			/* precision for position output */
-			/* nmea version for cga & gll output */
-			/* pass-through control */
-
-	/*
-	 * "001" Initialization/Mode Control, Part B
-	 * Put receiver in fully-constrained 2d nav mode
-	 */
-	mx4200_send(peer, "%s,%03d,%d,,%.1f,%.1f,%d,%d,%d,%c,%d",
-	    pmvxg, PMVXG_S_INITMODEB,
-	    2,		/* 2d nav */
-	    /* reserved */
-	    0.1,	/* hor accel fact as per Steve (m/s**2) */
-	    0.1,	/* ver accel fact as per Steve (m/s**2) */
-	    10,		/* vdop */
-	    10,		/* hdop limit as per Steve */
-	    5,		/* elevation limit as per Steve (deg) */
-	    'U',	/* time output mode (UTC) */
-	    0);		/* local time offset from gmt (HHHMM) */
-
-	/*
-	 * "023" Time Recovery Configuration
-	 * Get UTC time from a stationary receiver.  Solve for time only.
-	 * This should improve the time resolution dramatically.
-	 */
-	mx4200_send(peer, "%s,%03d,%c,%c,%c,%d,%d,%d,", pmvxg,
-	    PMVXG_S_TRECOVCONF,
-	    'K',	/* known position: solve for time only */
-	    'U',	/* synchronize to UTC */
-	    'A',	/* always output a time pulse */
-	    500,	/* max time error in ns */
-	    0,		/* user bias in ns */
-	    1);		/* output "830" sentences to control port */
-	/* Multi-satellite mode */
-
-	/*
-	 * "000" Initialization/Mode Control - Part A
-	 * Fix to our averaged position.
-	 */
-	if (up->central_meridian < NOT_INITIALIZED) {
-		up->avg_lon += up->central_meridian;
-		if (up->avg_lon < -180.0) up->avg_lon += 360.0;
-		if (up->avg_lon >  180.0) up->avg_lon -= 360.0;
-	}
-
-	if (up->avg_lat >= 0.0) {
-		lat = up->avg_lat;
-		nsc = 'N';
-	} else {
-		lat = up->avg_lat * (-1.0);
-		nsc = 'S';
-	}
-	if (up->avg_lon >= 0.0) {
-		lon = up->avg_lon;
-		ewc = 'E';
-	} else {
-		lon = up->avg_lon * (-1.0);
-		ewc = 'W';
-	}
-	alt = up->avg_alt;
-	minute = (lat - (double)(int)lat) * 60.0;
-	snprintf(lats, sizeof(lats), "%02d%02.4f", (int)lat, minute);
-	minute = (lon - (double)(int)lon) * 60.0;
-	snprintf(lons, sizeof(lons), "%03d%02.4f", (int)lon, minute);
-
-	mx4200_send(peer, "%s,%03d,,,,,%s,%c,%s,%c,%.2f,%d", pmvxg,
-	    PMVXG_S_INITMODEA,
-	    /* day of month */
-	    /* month of year */
-	    /* year */
-	    /* gmt */
-	    lats,	/* latitude   DDMM.MMMM */
-	    nsc,	/* north/south */
-	    lons,	/* longitude DDDMM.MMMM */
-	    ewc,	/* east/west */
-	    alt,	/* Altitude */
-	    1);		/* Altitude Reference (0=WGS84 ellipsoid, 1=MSL geoid)*/
-
-	msyslog(LOG_DEBUG,
-	    "REFCLOCK: mx4200: reconfig to fixed location: %s %c, %s %c, %.2f m",
-		lats, nsc, lons, ewc, alt );
-
-}
-
-/*
- * mx4200_poll - mx4200 watchdog routine
- */
-static void
-mx4200_poll(
-	int unit,
-	struct peer *peer
-	)
-{
-	struct mx4200unit *up;
-	struct refclockproc *pp;
-
-	UNUSED_ARG(unit);
-
-	pp = peer->procptr;
-	up = pp->unitptr;
-
-	/*
-	 * You don't need to poll this clock.  It puts out timecodes
-	 * once per second.  If asked for a timestamp, take note.
-	 * The next time a timecode comes in, it will be fed back.
-	 */
-
-	/*
-	 * If we haven't had a response in a while, reset the receiver.
-	 */
-	if (up->pollcnt > 0) {
-		up->pollcnt--;
-	} else {
-		refclock_report(peer, CEVNT_TIMEOUT);
-
-		/*
-		 * Request a "000" status message which should trigger a
-		 * reconfig
-		 */
-		mx4200_send(peer, "%s,%03d",
-		    "CDGPQ",		/* query from CDU to GPS */
-		    PMVXG_D_STATUS);	/* label of desired sentence */
-	}
-
-	/*
-	 * polled every 64 seconds. Ask mx4200_receive to hand in
-	 * a timestamp.
-	 */
-	up->polled = true;
-	pp->polls++;
-
-	/*
-	 * Output receiver status information.
-	 */
-	if ((up->log_time > 0) && (current_time > up->log_time)) {
-		up->log_time = 0;
-		/*
-		 * Output the following messages once, for debugging.
-		 *    "004" Mode Data
-		 *    "523" Time Recovery Parameters
-		 */
-		mx4200_send(peer, "%s,%03d", "CDGPQ", PMVXG_D_MODEDATA);
-		mx4200_send(peer, "%s,%03d", "CDGPQ", PMVXG_D_TRECOVUSEAGE);
-	}
-}
-
-static char char2hex[] = "0123456789ABCDEF";
-
-/*
- * mx4200_receive - receive gps data
- */
-static void
-mx4200_receive(
-	struct recvbuf *rbufp
-	)
-{
-	struct mx4200unit *up;
-	struct refclockproc *pp;
-	struct peer *peer;
-	char *cp;
-	const char *ccp;
-	int sentence_type;
-	uint8_t ck;
-
-	/*
-	 * Initialize pointers and read the timecode and timestamp.
-	 */
-	peer = rbufp->recv_peer;
-	pp = peer->procptr;
-	up = pp->unitptr;
-
-	/*
-	 * If operating mode has been changed, then reinitialize the receiver
-	 * before doing anything else.
-	 */
-	if ((pp->sloppyclockflag & CLK_FLAG2) !=
-	    (up->sloppyclockflag & CLK_FLAG2)) {
-		up->sloppyclockflag = pp->sloppyclockflag;
-		mx4200_debug(peer,
-		    "mx4200_receive: mode switch: reset receiver\n");
-		mx4200_config(peer);
-		return;
-	}
-	up->sloppyclockflag = pp->sloppyclockflag;
-
-	/*
-	 * Read clock output.  Automatically handles CLKLDISC.
-	 */
-	pp->lencode = refclock_gtlin(rbufp, pp->a_lastcode, BMAX, &pp->lastrec);
-
-	/*
-	 * There is a case where <cr><lf> generates 2 timestamps.
-	 */
-	if (pp->lencode == 0)
-		return;
-
-	up->pollcnt = 2;
-	pp->a_lastcode[pp->lencode] = '\0';
-	record_clock_stats(peer, pp->a_lastcode);
-	mx4200_debug(peer, "mx4200_receive: %d %s\n",
-		     pp->lencode, pp->a_lastcode);
-
-	/*
-	 * The structure of the control port sentences is based on the
-	 * NMEA-0183 Standard for interfacing Marine Electronics
-	 * Navigation Devices (Version 1.5)
-	 *
-	 *	$PMVXG,XXX, ....................*CK<cr><lf>
-	 *
-	 *		$	Sentence Start Identifier (reserved char)
-	 *			   (Start-of-Sentence Identifier)
-	 *		P	Special ID (Proprietary)
-	 *		MVX	Originator ID (Magnavox)
-	 *		G	Interface ID (GPS)
-	 *		,	Field Delimiters (reserved char)
-	 *		XXX	Sentence Type
-	 *		......	Data
-	 *		*	Checksum Field Delimiter (reserved char)
-	 *		CK	Checksum
-	 *		<cr><lf> Carriage-Return/Line Feed (reserved chars)
-	 *			   (End-of-Sentence Identifier)
-	 *
-	 * Reject if any important landmarks are missing.
-	 */
-	cp = pp->a_lastcode + pp->lencode - 3;
-	if (cp < pp->a_lastcode || *pp->a_lastcode != '$' || cp[0] != '*' ) {
-		mx4200_debug(peer, "mx4200_receive: bad format\n");
-		refclock_report(peer, CEVNT_BADREPLY);
-		return;
-	}
-
-	/*
-	 * Check and discard the checksum
-	 */
-	ck = mx4200_cksum(&pp->a_lastcode[1], pp->lencode - 4);
-	if (char2hex[ck >> 4] != cp[1] || char2hex[ck & 0xf] != cp[2]) {
-		mx4200_debug(peer, "mx4200_receive: bad checksum\n");
-		refclock_report(peer, CEVNT_BADREPLY);
-		return;
-	}
-	*cp = '\0';
-
-	/*
-	 * Get the sentence type.
-	 */
-	sentence_type = 0;
-	if ((cp = strchr(pp->a_lastcode, ',')) == NULL) {
-		mx4200_debug(peer, "mx4200_receive: no sentence\n");
-		refclock_report(peer, CEVNT_BADREPLY);
-		return;
-	}
-	cp++;
-	sentence_type = strtol(cp, &cp, 10);
-
-	/*
-	 * Process the sentence according to its type.
-	 */
-	switch (sentence_type) {
-
-	/*
-	 * "000" Status message
-	 */
-	case PMVXG_D_STATUS:
-		/*
-		 * XXX
-		 * Since we configure the receiver to not give us status
-		 * messages and since the receiver outputs status messages by
-		 * default after being reset to factory defaults when sent the
-		 * "$PMVXG,018,C\r\n" message, any status message we get
-		 * indicates the receiver needs to be initialized; thus, it is
-		 * not necessary to decode the status message.
-		 */
-		if ((ccp = mx4200_parse_s(peer)) != NULL) {
-			mx4200_debug(peer,
-				     "mx4200_receive: status: %s\n", ccp);
-		}
-		mx4200_debug(peer, "mx4200_receive: reset receiver\n");
-		mx4200_config(peer);
-		break;
-
-	/*
-	 * "021" Position, Height, Velocity message,
-	 *  if we are still averaging our position
-	 */
-	case PMVXG_D_PHV:
-		if (!up->known) {
-			/*
-			 * Parse the message, calculating our averaged position.
-			 */
-			if ((ccp = mx4200_parse_p(peer)) != NULL) {
-				mx4200_debug(peer, "mx4200_receive: pos: %s\n",
-                                             ccp);
-				return;
-			}
-			mx4200_debug(peer,
-			    "mx4200_receive: position avg %f %.9f %.9f %.4f\n",
-			    up->N_fixes, up->avg_lat, up->avg_lon, up->avg_alt);
-			/*
-			 * Reinitialize as a reference station
-			 * if position is well known.
-			 */
-			if (current_time > up->clamp_time) {
-			    up->known = true;
-				mx4200_debug(peer, "mx4200_receive: reconfiguring!\n");
-				mx4200_ref(peer);
-			}
-		}
-		break;
-
-	/*
-	 * Print to the syslog:
-	 * "004" Mode Data
-	 * "030" Software Configuration
-	 * "523" Time Recovery Parameters Currently in Use
-	 */
-	case PMVXG_D_MODEDATA:
-	case PMVXG_D_SOFTCONF:
-	case PMVXG_D_TRECOVUSEAGE:
-
-		if ((ccp = mx4200_parse_s(peer)) != NULL) {
-			mx4200_debug(peer,
-				     "mx4200_receive: multi-record: %s\n", ccp);
-		}
-		break;
-
-	/*
-	 * "830" Time Recovery Results message
-	 */
-	case PMVXG_D_TRECOVOUT:
-
-		/*
-		 * Capture the last PPS signal.
-		 * Precision timestamp is returned in pp->lastrec
-		 */
-		if (mx4200_pps(peer)) {
-			mx4200_debug(peer, "mx4200_receive: pps failure\n");
-			refclock_report(peer, CEVNT_FAULT);
-			return;
-		}
-
-
-		/*
-		 * Parse the time recovery message, and keep the info
-		 * to print the pretty billboards.
-		 */
-		if ((ccp = mx4200_parse_t(peer)) != NULL) {
-			mx4200_debug(peer, "mx4200_receive: time: %s\n", ccp);
-			refclock_report(peer, CEVNT_BADREPLY);
-			return;
-		}
-
-		/*
-		 * Add the new sample to a median filter.
-		 */
-		if (!refclock_process(pp)) {
-			mx4200_debug(peer,"mx4200_receive: offset: %.6f\n",
-			    pp->offset);
-			refclock_report(peer, CEVNT_BADTIME);
-			return;
-		}
-
-		/*
-		 * The clock will blurt a timecode every second but we only
-		 * want one when polled.  If we havn't been polled, bail out.
-		 */
-		if (!up->polled)
-			return;
-
-		/*
-		 * Return offset and dispersion to control module.  We use
-		 * lastrec as both the reference time and receive time in
-		 * order to avoid being cute, like setting the reference time
-		 * later than the receive time, which may cause a paranoid
-		 * protocol module to chuck out the data.
-		 */
-		mx4200_debug(peer, "mx4200_receive: process time: ");
-		mx4200_debug(peer, "%4d-%03d %02d:%02d:%02d at %s, %.6f\n",
-		    pp->year, pp->day, pp->hour, pp->minute, pp->second,
-		    prettydate(pp->lastrec), pp->offset);
-		pp->lastref = pp->lastrec;
-		refclock_receive(peer);
-
-		/*
-		 * We have succeeded in answering the poll.
-		 * Turn off the flag and return
-		 */
-		up->polled = false;
-		break;
-
-	/*
-	 * Ignore all other sentence types
-	 */
-	default:
-		break;
-
-	} /* switch (sentence_type) */
-
-	return;
-}
-
-
-/*
- * Parse a mx4200 time recovery message. Returns a string if error.
- *
- * A typical message looks like this.  Checksum has already been stripped.
- *
- *    $PMVXG,830,T,YYYY,MM,DD,HH:MM:SS,U,S,FFFFFF,PPPPP,BBBBBB,LL
- *
- *	Field	Field Contents
- *	-----	--------------
- *		Block Label: $PMVXG
- *		Sentence Type: 830=Time Recovery Results
- *			This sentence is output approximately 1 second
- *			preceding the 1PPS output.  It indicates the
- *			exact time of the next pulse, whether or not the
- *			time mark will be valid (based on operator-specified
- *			error tolerance), the time to which the pulse is
- *			synchronized, the receiver operating mode,
- *			and the time error of the *last* 1PPS output.
- *	1  char Time Mark Valid: T=Valid, F=Not Valid
- *	2  int  Year: 1993-
- *	3  int  Month of Year: 1-12
- *	4  int  Day of Month: 1-31
- *	5  int  Time of Day: HH:MM:SS
- *	6  char Time Synchronization: U=UTC, G=GPS
- *	7  char Time Recovery Mode: D=Dynamic, S=Static,
- *			K=Known Position, N=No Time Recovery
- *	8  int  Oscillator Offset: The filter's estimate of the oscillator
- *			frequency error, in parts per billion (ppb).
- *	9  int  Time Mark Error: The computed error of the *last* pulse
- *			output, in nanoseconds.
- *	10 int  User Time Bias: Operator specified bias, in nanoseconds
- *	11 int  Leap Second Flag: Indicates that a leap second will
- *			occur.  This value is usually zero, except during
- *			the week prior to the leap second occurrence, when
- *			this value will be set to +1 or -1.  A value of
- *			+1 indicates that GPS time will be 1 second
- *			further ahead of UTC time.
- *
- */
-static const char *
-mx4200_parse_t(
-	struct peer *peer
-	)
-{
-	struct refclockproc *pp;
-	struct mx4200unit *up;
-	char   time_mark_valid, time_sync, op_mode;
-	int    sentence_type, valid;
-	int    year, day_of_year, month, day_of_month;
-	int    hour, minute, second, leapsec_warn;
-	int    oscillator_offset, time_mark_error, time_bias;
-
-	pp = peer->procptr;
-	up = pp->unitptr;
-
-	leapsec_warn = 0;  /* Not all receivers output leap second warnings (!) */
-	if (14 != sscanf(pp->a_lastcode,
-		"$PMVXG,%d,%c,%d,%d,%d,%d:%d:%d,%c,%c,%d,%d,%d,%d",
-		&sentence_type, &time_mark_valid, &year, &month, &day_of_month,
-		&hour, &minute, &second, &time_sync, &op_mode,
-		&oscillator_offset, &time_mark_error, &time_bias, &leapsec_warn))
-		return ("unexpected sentence");
-
-	if (sentence_type != PMVXG_D_TRECOVOUT)
-		return ("wrong rec-type");
-
-	switch (time_mark_valid) {
-		case 'T':
-			valid = 1;
-			break;
-		case 'F':
-			valid = 0;
-			break;
-		default:
-			return ("bad pulse-valid");
-	}
-
-	switch (time_sync) {
-		case 'G':
-			return ("synchronized to GPS; should be UTC");
-		case 'U':
-			break; /* UTC -> ok */
-		default:
-			return ("not synchronized to UTC");
-	}
-
-	/*
-	 * Check for insane time (allow for possible leap seconds)
-	 */
-	if (second > 60 || minute > 59 || hour > 23 ||
-	    second <  0 || minute <  0 || hour <  0) {
-		mx4200_debug(peer,
-		    "mx4200_parse_t: bad time %02d:%02d:%02d",
-		    hour, minute, second);
-		if (leapsec_warn != 0)
-			mx4200_debug(peer, " (leap %+d\n)", leapsec_warn);
-		mx4200_debug(peer, "\n");
-		refclock_report(peer, CEVNT_BADTIME);
-		return ("bad time");
-	}
-	if ( second == 60 ) {
-		msyslog(LOG_DEBUG,
-		    "REFCLOCK: mx4200: leap second! %02d:%02d:%02d",
-		    hour, minute, second);
-	}
-
-	/*
-	 * Check for insane date
-	 * (Certainly can't be any year before this code was last altered!)
-	 */
-	if (day_of_month > 31 || month > 12 ||
-	    day_of_month <  1 || month <  1 || year < year_last_modified) {
-		mx4200_debug(peer,
-		    "mx4200_parse_t: bad date (%4d-%02d-%02d)\n",
-		    year, month, day_of_month);
-		refclock_report(peer, CEVNT_BADDATE);
-		return ("bad date");
-	}
-
-	/*
-	 * Silly Hack for MX4200:
-	 * ASCII message is for *next* 1PPS signal, but we have the
-	 * timestamp for the *last* 1PPS signal.  So we have to subtract
-	 * a second.  Discard if we are on a month boundary to avoid
-	 * possible leap seconds and leap days.
-	 */
-	second--;
-	if (second < 0) {
-		second = 59;
-		minute--;
-		if (minute < 0) {
-			minute = 59;
-			hour--;
-			if (hour < 0) {
-				hour = 23;
-				day_of_month--;
-				if (day_of_month < 1) {
-					return ("sorry, month boundary");
-				}
-			}
-		}
-	}
-
-	/*
-	 * Calculate Julian date
-	 */
-	if (!(day_of_year = mx4200_jday(year, month, day_of_month))) {
-		mx4200_debug(peer,
-		    "mx4200_parse_t: bad julian date %d (%4d-%02d-%02d)\n",
-		    day_of_year, year, month, day_of_month);
-		refclock_report(peer, CEVNT_BADDATE);
-		return("invalid julian date");
-	}
-
-	/*
-	 * Setup leap second indicator
-	 */
-	switch (leapsec_warn) {
-		case 0:
-			pp->leap = LEAP_NOWARNING;
-			break;
-		case 1:
-			pp->leap = LEAP_ADDSECOND;
-			break;
-		case -1:
-			pp->leap = LEAP_DELSECOND;
-			break;
-		default:
-			pp->leap = LEAP_NOTINSYNC;
-	}
-
-	/*
-	 * Any change to the leap second warning status?
-	 */
-	if (leapsec_warn != up->last_leap ) {
-		msyslog(LOG_DEBUG,
-		    "REFCLOCK: mx4200: leap second warning: %d to %d (%d)",
-		    up->last_leap, leapsec_warn, pp->leap);
-	}
-	up->last_leap = leapsec_warn;
-
-	/*
-	 * Copy time data for billboard monitoring.
-	 */
-
-	pp->year   = year;
-	pp->day    = day_of_year;
-	pp->hour   = hour;
-	pp->minute = minute;
-	pp->second = second;
-
-	/*
-	 * Toss if sentence is marked invalid
-	 */
-	if (!valid || pp->leap == LEAP_NOTINSYNC) {
-		mx4200_debug(peer, "mx4200_parse_t: time mark not valid\n");
-		refclock_report(peer, CEVNT_BADTIME);
-		return ("pulse invalid");
-	}
-
-	return (NULL);
-}
-
-/*
- * Calculate the checksum
- */
-static uint8_t
-mx4200_cksum(
-	char *cp,
-	int n
-	)
-{
-	uint8_t ck;
-
-	for (ck = 0; n-- > 0; cp++)
-		ck ^= *cp;
-	return (ck);
-}
-
-/*
- * Tables to compute the day of year.  Viva la leap.
- */
-static int day1tab[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-static int day2tab[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
-
-/*
- * Calculate the Julian Day
- */
-static int
-mx4200_jday(
-	int year,
-	int month,
-	int day_of_month
-	)
-{
-	int day, i;
-	bool leap_year;
-
-	/*
-	 * Is this a leap year ?
-	 */
-	if (year % 4) {
-		leap_year = false;
-	} else {
-		if (year % 100) {
-			leap_year = true;
-		} else {
-			if (year % 400) {
-			    leap_year = false;
-			} else {
-				leap_year = true;
-			}
-		}
-	}
-
-	/*
-	 * Calculate the Julian Date
-	 */
-	day = day_of_month;
-
-	if (leap_year) {
-		/* a leap year */
-		if (day > day2tab[month - 1]) {
-			return (0);
-		}
-		for (i = 0; i < month - 1; i++)
-		    day += day2tab[i];
-	} else {
-		/* not a leap year */
-		if (day > day1tab[month - 1]) {
-			return (0);
-		}
-		for (i = 0; i < month - 1; i++)
-		    day += day1tab[i];
-	}
-	return (day);
-}
-
-/*
- * Parse a mx4200 position/height/velocity sentence.
- *
- * A typical message looks like this.  Checksum has already been stripped.
- *
- * $PMVXG,021,SSSSSS.SS,DDMM.MMMM,N,DDDMM.MMMM,E,HHHHH.H,GGGG.G,EEEE.E,WWWW.W,MM
- *
- *	Field	Field Contents
- *	-----	--------------
- *		Block Label: $PMVXG
- *		Sentence Type: 021=Position, Height Velocity Data
- *			This sentence gives the receiver position, height,
- *			navigation mode, and velocity north/east.
- *			*This sentence is intended for post-analysis
- *			applications.*
- *	1 float UTC measurement time (seconds into week)
- *	2 float WGS-84 Latitude (degrees, minutes)
- *	3  char N=North, S=South
- *	4 float WGS-84 Longitude (degrees, minutes)
- *	5  char E=East, W=West
- *	6 float Altitude (meters above mean sea level)
- *	7 float Geoidal height (meters)
- *	8 float East velocity (m/sec)
- *	9 float West Velocity (m/sec)
- *	10  int Navigation Mode
- *		    Mode if navigating:
- *			1 = Position from remote device
- *			2 = 2-D position
- *			3 = 3-D position
- *			4 = 2-D differential position
- *			5 = 3-D differential position
- *			6 = Static
- *			8 = Position known -- reference station
- *			9 = Position known -- Navigator
- *		    Mode if not navigating:
- *			51 = Too few satellites
- *			52 = DOPs too large
- *			53 = Position STD too large
- *			54 = Velocity STD too large
- *			55 = Too many iterations for velocity
- *			56 = Too many iterations for position
- *			57 = 3 sat startup failed
- *			58 = Command abort
- */
-static const char *
-mx4200_parse_p(
-	struct peer *peer
-	)
-{
-	struct refclockproc *pp;
-	struct mx4200unit *up;
-	int sentence_type, mode;
-	double mtime, lat, lon, alt, geoid, vele, veln;
-	char   north_south, east_west;
-
-	pp = peer->procptr;
-	up = pp->unitptr;
-
-	/* Should never happen! */
-	if (up->moving) return ("mobile platform - no pos!");
-
-	if (11 != sscanf ( pp->a_lastcode,
-		"$PMVXG,%d,%lf,%lf,%c,%lf,%c,%lf,%lf,%lf,%lf,%d",
-		&sentence_type, &mtime, &lat, &north_south, &lon, &east_west,
-		&alt, &geoid, &vele, &veln, &mode))
-		return ("unexpected sentence");
-
-	/* Sentence type */
-	if (sentence_type != PMVXG_D_PHV)
-		return ("wrong rec-type");
-
-	/*
-	 * return if not navigating
-	 */
-	if (mode > 10)
-		return ("not navigating");
-	if (mode != 3 && mode != 5)
-		return ("not navigating in 3D");
-
-	/* Latitude (always +ve) and convert DDMM.MMMM to decimal */
-	if (lat <  0.0) return ("negative latitude");
-	if (lat > 9000.0) lat = 9000.0;
-	lat *= 0.01;
-	lat = ((int)lat) + (((lat - (int)lat)) * 1.6666666666666666);
-
-	/* North/South */
-	switch (north_south) {
-		case 'N':
-			break;
-		case 'S':
-			lat *= -1.0;
-			break;
-		default:
-			return ("invalid north/south indicator");
-	}
-
-	/* Longitude (always +ve) and convert DDDMM.MMMM to decimal */
-	if (lon <   0.0) return ("negative longitude");
-	if (lon > 180.0) lon = 180.0;
-	lon *= 0.01;
-	lon = ((int)lon) + (((lon - (int)lon)) * 1.6666666666666666);
-
-	/* East/West */
-	switch (east_west) {
-		case 'E':
-			break;
-		case 'W':
-			lon *= -1.0;
-			break;
-		default:
-			return ("invalid east/west indicator");
-	}
-
-	/*
-	 * Normalize longitude to near 0 degrees.
-	 * Assume all data are clustered around first reading.
-	 */
-	if (up->central_meridian < (NOT_INITIALIZED - 1.0)) {
-		up->central_meridian = lon;
-		mx4200_debug(peer,
-		    "mx4200_receive: central meridian =  %.9f \n",
-		    up->central_meridian);
-	}
-	lon -= up->central_meridian;
-	if (lon < -180.0) lon += 360.0;
-	if (lon >  180.0) lon -= 360.0;
-
-	/*
-	 * Calculate running averages
-	 */
-
-	up->avg_lon = (up->N_fixes * up->avg_lon) + lon;
-	up->avg_lat = (up->N_fixes * up->avg_lat) + lat;
-	up->avg_alt = (up->N_fixes * up->avg_alt) + alt;
-
-	up->N_fixes += 1.0;
-
-	up->avg_lon /= up->N_fixes;
-	up->avg_lat /= up->N_fixes;
-	up->avg_alt /= up->N_fixes;
-
-	mx4200_debug(peer,
-	    "mx4200_receive: position rdg %.0f: %.9f %.9f %.4f (CM=%.9f)\n",
-	    up->N_fixes, lat, lon, alt, up->central_meridian);
-
-	return (NULL);
-}
-
-/*
- * Parse a mx4200 Status sentence
- * Parse a mx4200 Mode Data sentence
- * Parse a mx4200 Software Configuration sentence
- * Parse a mx4200 Time Recovery Parameters Currently in Use sentence
- * (used only for logging raw strings)
- *
- * A typical message looks like this.  Checksum has already been stripped.
- *
- * $PMVXG,000,XXX,XX,X,HHMM,X
- *
- *	Field	Field Contents
- *	-----	--------------
- *		Block Label: $PMVXG
- *		Sentence Type: 000=Status.
- *			Returns status of the receiver to the controller.
- *	1	Current Receiver Status:
- *		ACQ = Satellite re-acquisition
- *		ALT = Constellation selection
- *		COR = Providing corrections (for reference stations only)
- *		IAC = Initial acquisition
- *		IDL = Idle, no satellites
- *		NAV = Navigation
- *		STS = Search the Sky (no almanac available)
- *		TRK = Tracking
- *	2	Number of satellites that should be visible
- *	3	Number of satellites being tracked
- *	4	Time since last navigation status if not currently navigating
- *		(hours, minutes)
- *	5	Initialization status:
- *		0 = Waiting for initialization parameters
- *		1 = Initialization completed
- *
- * A typical message looks like this.  Checksum has already been stripped.
- *
- * $PMVXG,004,C,R,D,H.HH,V.VV,TT,HHHH,VVVV,T
- *
- *	Field	Field Contents
- *	-----	--------------
- *		Block Label: $PMVXG
- *		Sentence Type: 004=Software Configuration.
- *			Defines the navigation mode and criteria for
- *			acceptable navigation for the receiver.
- *	1	Constrain Altitude Mode:
- *		0 = Auto.  Constrain altitude (2-D solution) and use
- *		    manual altitude input when 3 sats available.  Do
- *		    not constrain altitude (3-D solution) when 4 sats
- *		    available.
- *		1 = Always constrain altitude (2-D solution).
- *		2 = Never constrain altitude (3-D solution).
- *		3 = Coast.  Constrain altitude (2-D solution) and use
- *		    last GPS altitude calculation when 3 sats available.
- *		    Do not constrain altitude (3-D solution) when 4 sats
- *		    available.
- *	2	Altitude Reference: (always 0 for MX4200)
- *		0 = Ellipsoid
- *		1 = Geoid (MSL)
- *	3	Differential Navigation Control:
- *		0 = Disabled
- *		1 = Enabled
- *	4	Horizontal Acceleration Constant (m/sec**2)
- *	5	Vertical Acceleration Constant (m/sec**2) (0 for MX4200)
- *	6	Tracking Elevation Limit (degrees)
- *	7	HDOP Limit
- *	8	VDOP Limit
- *	9	Time Output Mode:
- *		U = UTC
- *		L = Local time
- *	10	Local Time Offset (minutes) (absent on MX4200)
- *
- * A typical message looks like this.  Checksum has already been stripped.
- *
- * $PMVXG,030,NNNN,FFF
- *
- *	Field	Field Contents
- *	-----	--------------
- *		Block Label: $PMVXG
- *		Sentence Type: 030=Software Configuration.
- *			This sentence contains the navigation processor
- *			and baseband firmware version numbers.
- *	1	Nav Processor Version Number
- *	2	Baseband Firmware Version Number
- *
- * A typical message looks like this.  Checksum has already been stripped.
- *
- * $PMVXG,523,M,S,M,EEEE,BBBBBB,C,R
- *
- *	Field	Field Contents
- *	-----	--------------
- *		Block Label: $PMVXG
- *		Sentence Type: 523=Time Recovery Parameters Currently in Use.
- *			This sentence contains the configuration of the
- *			time recovery feature of the receiver.
- *	1	Time Recovery Mode:
- *		D = Dynamic; solve for position and time while moving
- *		S = Static; solve for position and time while stationary
- *		K = Known position input, solve for time only
- *		N = No time recovery
- *	2	Time Synchronization:
- *		U = UTC time
- *		G = GPS time
- *	3	Time Mark Mode:
- *		A = Always output a time pulse
- *		V = Only output time pulse if time is valid (as determined
- *		    by Maximum Time Error)
- *	4	Maximum Time Error - the maximum error (in nanoseconds) for
- *		which a time mark will be considered valid.
- *	5	User Time Bias - external bias in nanoseconds
- *	6	Time Message Control:
- *		0 = Do not output the time recovery message
- *		1 = Output the time recovery message (record 830) to
- *		    Control port
- *		2 = Output the time recovery message (record 830) to
- *		    Equipment port
- *	7	Reserved
- *	8	Position Known PRN (absent on MX 4200)
- *
- */
-static const char *
-mx4200_parse_s(
-	struct peer *peer
-	)
-{
-	struct refclockproc *pp;
-	int sentence_type;
-
-	pp = peer->procptr;
-
-        if (sscanf ( pp->a_lastcode, "$PMVXG,%d", &sentence_type) != 1)
-		return ("unexpected sentence");
-
-	/* Sentence type */
-	switch (sentence_type) {
-
-		case PMVXG_D_STATUS:
-			msyslog(LOG_DEBUG,
-			  "REFCLOCK: mx4200: status: %s", pp->a_lastcode);
-			break;
-		case PMVXG_D_MODEDATA:
-			msyslog(LOG_DEBUG,
-			  "REFCLOCK: mx4200: mode data: %s", pp->a_lastcode);
-			break;
-		case PMVXG_D_SOFTCONF:
-			msyslog(LOG_DEBUG,
-			  "REFCLOCK: mx4200: firmware configuration: %s", pp->a_lastcode);
-			break;
-		case PMVXG_D_TRECOVUSEAGE:
-			msyslog(LOG_DEBUG,
-			  "REFCLOCK: mx4200: time recovery parms: %s", pp->a_lastcode);
-			break;
-		default:
-			return ("wrong rec-type");
-	}
-
-	return (NULL);
-}
-
-/*
- * Process a PPS signal, placing a timestamp in pp->lastrec.
- */
-static bool
-mx4200_pps(
-	struct peer *peer
-	)
-{
-	unsigned int temp_serial;
-	struct refclockproc *pp;
-	struct mx4200unit *up;
-
-	struct timespec timeout;
-
-	pp = peer->procptr;
-	up = pp->unitptr;
-
-	/*
-	 * Grab the timestamp of the PPS signal.
-	 */
-	temp_serial = up->pps_i.assert_sequence;
-	timeout.tv_sec  = 0;
-	timeout.tv_nsec = 0;
-	if (time_pps_fetch(up->pps_h, PPS_TSFMT_TSPEC, &(up->pps_i),
-			&timeout) < 0) {
-		mx4200_debug(peer,
-		  "mx4200_pps: time_pps_fetch: serial=%lu, %m\n",
-		     (unsigned long)up->pps_i.assert_sequence);
-		refclock_report(peer, CEVNT_FAULT);
-		return true;
-	}
-	if (temp_serial == up->pps_i.assert_sequence) {
-		mx4200_debug(peer,
-		   "mx4200_pps: assert_sequence serial not incrementing: %lu\n",
-			(unsigned long)up->pps_i.assert_sequence);
-		refclock_report(peer, CEVNT_FAULT);
-		return true;
-	}
-	/*
-	 * Check pps serial number against last one
-	 */
-	if (up->lastserial + 1 != up->pps_i.assert_sequence &&
-	    up->lastserial != 0) {
-		if (up->pps_i.assert_sequence == up->lastserial) {
-			mx4200_debug(peer, "mx4200_pps: no new pps event\n");
-		} else {
-			mx4200_debug(peer, "mx4200_pps: missed %lu pps events\n",
-			    up->pps_i.assert_sequence - up->lastserial - 1UL);
-		}
-		refclock_report(peer, CEVNT_FAULT);
-	}
-	up->lastserial = up->pps_i.assert_sequence;
-
-	/*
-	 * Return the timestamp in pp->lastrec
-	 */
-	pp->lastrec = tspec_stamp_to_lfp(up->pps_i.assert_timestamp);
-
-	return false;
-}
-
-/*
- * mx4200_debug - print debug messages
- */
-static void
-mx4200_debug(struct peer *peer, const char *fmt, ...)
-{
-	UNUSED_ARG(peer);
-#ifndef DEBUG
-	UNUSED_ARG(fmt);
-#else
-	va_list ap;
-
-	if (debug) {
-		va_start(ap, fmt);
-
-		/*
-		 * Print debug message to stdout
-		 * In the future, we may want to get get more creative...
-		 */
-		vprintf(fmt, ap);
-
-		va_end(ap);
-	}
-#endif
-}
-
-/*
- * Send a character string to the receiver.  Checksum is appended here.
- */
-static void
-mx4200_send(struct peer *peer, const char *fmt, ...)
-{
-	struct refclockproc *pp;
-
-	int n, m;
-	va_list ap;
-	char buf1[1024];
-	char buf[sizeof(buf1)  + 10];
-	uint8_t ck;
-
-	va_start(ap, fmt);
-
-	pp = peer->procptr;
-
-	vsnprintf(buf1, sizeof(buf1) - 1, fmt, ap);
-        buf1[sizeof(buf1) - 1 ] = '\0';
-	ck = mx4200_cksum(buf1, (int)strlen(buf1));
-        /* buf can never overrun */
-	n = snprintf(buf, sizeof(buf) - 1, "$%1024s*%02X\r\n", buf1, ck);
-
-	m = write(pp->io.fd, buf, (unsigned)n);
-	if (m < 0)
-	    msyslog(LOG_ERR, "TRFCLOCK: mx4200_send: write: %s [%s]", buf, strerror(errno));
-	mx4200_debug(peer, "mx4200_send: %d %s\n", m, buf);
-	va_end(ap);
-}
-


=====================================
wafhelpers/refclock.py
=====================================
--- a/wafhelpers/refclock.py
+++ b/wafhelpers/refclock.py
@@ -33,13 +33,6 @@ refclock_map = {
         "file":     "generic"
     },
 
-    "magnavox": {
-        "descr":    "Magnavox MX4200 and related GPS receivers",
-        "define":   "CLOCK_MAGNAVOX",
-        "require":  ["ppsapi"],
-        "file":     "magnavox"
-    },
-
     "arbiter": {
         "descr":    "Arbiter 1088A/B GPS Receiver",
         "define":   "CLOCK_ARBITER",



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/6d2b724af07ad8973603d3b4de9b1f5debde3dff

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/6d2b724af07ad8973603d3b4de9b1f5debde3dff
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170917/40e6648c/attachment.html>


More information about the vc mailing list