summaryrefslogtreecommitdiff
path: root/mbglib/common/gpsdefs.h
diff options
context:
space:
mode:
Diffstat (limited to 'mbglib/common/gpsdefs.h')
-rwxr-xr-xmbglib/common/gpsdefs.h429
1 files changed, 285 insertions, 144 deletions
diff --git a/mbglib/common/gpsdefs.h b/mbglib/common/gpsdefs.h
index d7156fd..80a4e1d 100755
--- a/mbglib/common/gpsdefs.h
+++ b/mbglib/common/gpsdefs.h
@@ -1,19 +1,33 @@
/**************************************************************************
*
- * $Id: gpsdefs.h 1.91 2011/01/31 11:23:56 martin REL_M $
+ * $Id: gpsdefs.h 1.91.1.8 2011/02/23 15:11:23 martin TRASH $
*
* Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
*
* Description:
* General definitions to be used with Meinberg clocks.
* These definitions have initially be used with GPS devices only.
- * However, more and more Meinberg non-GPS devices also use some of
+ * However, more and more Meinberg non-GPS devices also use some of
* these definitions.
*
* -----------------------------------------------------------------------
* $Log: gpsdefs.h $
- * Revision 1.91 2011/01/31 11:23:56 martin
+ * Revision 1.91.1.8 2011/02/23 15:11:23 martin
+ * New PTP_STATE flags bit PTP_FLAG_MSK_IS_UNICAST.
+ * Revision 1.91.1.7 2011/02/23 15:05:54 martin
+ * Made unused PTP_STATE fields num_clients and num_masters reserved.
+ * Revision 1.91.1.6 2011/02/23 14:47:22 martin
+ * Removed trailing whitespace and hard tabs.
+ * Revision 1.91.1.5 2011/02/23 13:17:06 daniel
+ * Revision 1.91.1.4 2011/02/17 14:39:13Z daniel
+ * Account for different PTP roles.
+ * Revision 1.91.1.3 2011/02/15 14:24:53 martin
+ * Revision 1.91.1.2 2011/02/15 11:30:56 martin
+ * New feature GPS_FEAT_PTP_UNICAST.
+ * Revision 1.91.1.1 2011/02/15 10:54:28 daniel
+ * Started to support configuration for PTP unicast.
+ * Revision 1.91 2011/01/31 11:23:56Z martin
* Added model type name definitions for GPS180PEX and TCR180PEX.
* Introduced synthesizer mode for programmable outputs.
* Added IRIG-RX code TXC-101 DTR-6.
@@ -53,10 +67,10 @@
* Revision 1.81 2009/11/09 09:08:24 martin
* New TM_GPS status bit TM_INVT.
* Added definitions to support VLAN.
- * Changed DEFAULT_PTP_DELAY_MECH_MASK to include also
+ * Changed DEFAULT_PTP_DELAY_MECH_MASK to include also
* PTP_DELAY_MECH_MSK_P2P.
* There is now only one type of TCXO supported which matches the former
- * TCXO HQ, so the default name for TCXO HQ has been changed to TCXO.
+ * TCXO HQ, so the default name for TCXO HQ has been changed to TCXO.
* TCXO LQ and MQ names are still supported for backward compatibility.
* Revision 1.80 2009/09/28 14:55:53 martin
* Support IRIG formats G002/G142 and G006/G146.
@@ -73,7 +87,7 @@
* Added macro _nano_time_negative().
* Revision 1.77 2009/06/08 19:22:32Z daniel
* Added feature GPS_HAS_PTP.
- * Added preliminary structures and definitions for PTP
+ * Added preliminary structures and definitions for PTP
* configuration and state.
* Added IP4_ADDR type.
* Added Bitmask IP4_MSK_DHCP.
@@ -86,7 +100,7 @@
* Revision 1.75 2009/03/19 14:06:39Z martin
* Modified string initializer for unknown oscillator type.
* Revision 1.74 2009/03/18 13:45:53 daniel
- * Added missing commas in
+ * Added missing commas in
* MBG_DEBUG_STATUS_STRS initializer.
* Adjusted some comments for doxygen parser.
* Revision 1.73 2009/03/10 16:55:33Z martin
@@ -162,7 +176,7 @@
* Revision 1.52 2006/12/12 15:47:18 martin
* Added MBG_DEBUG_STATUS type and associated definitions.
* Added definition GPS_HAS_REF_OFFS.
- * Moved PCPS_REF_OFFS and associated definitions from pcpsdefs.h here
+ * Moved PCPS_REF_OFFS and associated definitions from pcpsdefs.h here
* and renamed them to MBG_REF_OFFS, etc.
* Revision 1.51 2006/10/23 15:31:27 martin
* Added definitions for GPS170.
@@ -234,7 +248,7 @@
* Added definitions OSC_DAC_RANGE, OSC_DAC_BIAS.
* Revision 1.27 2004/03/08 14:06:45Z martin
* New model code and name for GPS169PCI.
- * Existing feature GPS_FEAT_IRIG has been
+ * Existing feature GPS_FEAT_IRIG has been
* renamed to GPS_FEAT_IRIG_TX.
* Added feature GPS_FEAT_IRIG_RX.
* Added IPv4 LAN interface feature flags.
@@ -319,7 +333,7 @@
#include <config.h>
#endif
-// CLOCK_MEINBERG is defined in NTP's config.h if configured
+// CLOCK_MEINBERG is defined in NTP's config.h if configured
// to support Meinberg clocks.
#if !defined( CLOCK_MEINBERG )
// avoid having to use these headers in non-Meinberg projects
@@ -382,8 +396,8 @@ typedef uint16_t IOD; /* Issue-Of-Data code */
/**
* @brief The type of a GPS command code
*
- * These command codes can be passed via
- * @ref gps_cmds_serial "serial port" (see @file gpsserio.h), or
+ * These command codes can be passed via
+ * @ref gps_cmds_serial "serial port" (see @file gpsserio.h), or
* @ref gps_cmds_bus "system bus" (see @file pcpsdefs.h).
*/
typedef uint16_t GPS_CMD;
@@ -561,9 +575,9 @@ enum
GPS_MODEL_GPS180PEX,
GPS_MODEL_TCR180PEX,
N_GPS_MODEL
- /* If new model codes are added then care must be taken
- * to update the associated string initializers below
- * accordingly, and to check whether the classification macros
+ /* If new model codes are added then care must be taken
+ * to update the associated string initializers below
+ * accordingly, and to check whether the classification macros
* also cover the new model names. */
};
@@ -657,7 +671,7 @@ enum
/*
* The macros below can be used to classify a receiver,
- * e.g. depending on the time source and/or depending on
+ * e.g. depending on the time source and/or depending on
* whether it's a plug-in card or an external device.
*/
@@ -828,6 +842,7 @@ enum
GPS_FEAT_NAV_ENGINE_SETTINGS, /**< supports navigation engine configuration */
GPS_FEAT_RAW_IRIG_DATA, /**< supports reading raw IRIG input data */
GPS_FEAT_RAW_IRIG_TIME, /**< supports reading decoded IRIG time */
+ GPS_FEAT_PTP_UNICAST, /**< has PTP Unicast support */
N_GPS_FEATURE /**< the number of valid features */
};
@@ -852,7 +867,8 @@ enum
"PTP/IEEE1588", \
"Nav. Engine Settings", \
"Raw IRIG Data", \
- "Raw IRIG Time" \
+ "Raw IRIG Time", \
+ "PTP/IEEE1588 Unicast" \
}
@@ -879,6 +895,7 @@ enum
#define GPS_HAS_NAV_ENGINE_SETTINGS ( 1UL << GPS_FEAT_NAV_ENGINE_SETTINGS )
#define GPS_HAS_RAW_IRIG_DATA ( 1UL << GPS_FEAT_RAW_IRIG_DATA )
#define GPS_HAS_RAW_IRIG_TIME ( 1UL << GPS_FEAT_RAW_IRIG_TIME )
+#define GPS_HAS_PTP_UNICAST ( 1UL << GPS_FEAT_PTP_UNICAST )
#define GPS_HAS_REF_OFFS GPS_HAS_IRIG_RX
@@ -953,7 +970,7 @@ typedef struct
-/**
+/**
Date and time referred to the linear time scale defined by GPS.
GPS time is defined by the number of weeks since midnight from
January 5, 1980 to January 6, 1980 plus the number of seconds of
@@ -1035,7 +1052,7 @@ enum
// Type of an extended TM status which is mainly used by the firmware.
typedef uint32_t TM_STATUS_EXT; // extended status, mainly used by the firmware
-// The lower 16 bits of the TM_STATUS_X type correspond to those defined above,
+// The lower 16 bits of the TM_STATUS_X type correspond to those defined above,
// and the upper bits are defined below:
enum
{
@@ -1072,7 +1089,7 @@ enum
#define TM_MSK_TIME_VALID ( TM_UTC | TM_SCALE_GPS | TM_SCALE_TAI )
/**
- This structure is used to transmit information on date and time
+ This structure is used to transmit information on date and time
*/
typedef struct
{
@@ -1143,31 +1160,31 @@ typedef struct
/**
@defgroup group_synth Synthesizer parameters
- Synthesizer frequency is expressed as a
- four digit decimal number (freq) to be multiplied by 0.1 Hz and an
- base 10 exponent (range). If the effective frequency is less than
- 10 kHz its phase is synchronized corresponding to the variable phase.
- Phase may be in a range from -360 deg to +360 deg with a resolution
- of 0.1 deg, so the resulting numbers to be stored are in a range of
- -3600 to +3600.
+ Synthesizer frequency is expressed as a
+ four digit decimal number (freq) to be multiplied by 0.1 Hz and an
+ base 10 exponent (range). If the effective frequency is less than
+ 10 kHz its phase is synchronized corresponding to the variable phase.
+ Phase may be in a range from -360 deg to +360 deg with a resolution
+ of 0.1 deg, so the resulting numbers to be stored are in a range of
+ -3600 to +3600.
Example:<br>
- Assume the value of freq is 2345 (decimal) and the value of phase is 900.
- If range == 0 the effective frequency is 234.5 Hz with a phase of +90 deg.
- If range == 1 the synthesizer will generate a 2345 Hz output frequency
- and so on.
+ Assume the value of freq is 2345 (decimal) and the value of phase is 900.
+ If range == 0 the effective frequency is 234.5 Hz with a phase of +90 deg.
+ If range == 1 the synthesizer will generate a 2345 Hz output frequency
+ and so on.
Limitations:<br>
- If freq == 0 the synthesizer is disabled. If range == 0 the least
- significant digit of freq is limited to 0, 3, 5 or 6. The resulting
- frequency is shown in the examples below:
- - freq == 1230 --> 123.0 Hz
- - freq == 1233 --> 123 1/3 Hz (real 1/3 Hz, NOT 123.3 Hz)
- - freq == 1235 --> 123.5 Hz
- - freq == 1236 --> 123 2/3 Hz (real 2/3 Hz, NOT 123.6 Hz)
-
- If range == MAX_RANGE the value of freq must not exceed 1000, so the
- output frequency is limited to 10 MHz.
+ If freq == 0 the synthesizer is disabled. If range == 0 the least
+ significant digit of freq is limited to 0, 3, 5 or 6. The resulting
+ frequency is shown in the examples below:
+ - freq == 1230 --> 123.0 Hz
+ - freq == 1233 --> 123 1/3 Hz (real 1/3 Hz, NOT 123.3 Hz)
+ - freq == 1235 --> 123.5 Hz
+ - freq == 1236 --> 123 2/3 Hz (real 2/3 Hz, NOT 123.6 Hz)
+
+ If range == MAX_RANGE the value of freq must not exceed 1000, so the
+ output frequency is limited to 10 MHz.
@{
*/
@@ -1188,20 +1205,20 @@ typedef struct
#define MAX_SYNTH_FREQ_VAL 10000000UL /**< 10 MHz */
/* == MAX_SYNTH_FREQ * 10^(MAX_SYNTH_RANGE-1) */
-/**
- The synthesizer phase will only be synchronized if the frequency
+/**
+ The synthesizer phase will only be synchronized if the frequency
is below this limit: */
#define SYNTH_PHASE_SYNC_LIMIT 10000UL /**< 10 kHz */
-/**
- the position of the decimal point if the frequency is
- printed as 4 digit value */
+/**
+ the position of the decimal point if the frequency is
+ printed as 4 digit value */
#define _synth_dp_pos_from_range( _r ) \
( ( ( N_SYNTH_RANGE - (_r) ) % ( N_SYNTH_FREQ_DIGIT - 1 ) ) + 1 )
-/**
- An initializer for commonly displayed synthesizer frequency units
- (N_SYNTH_RANGE strings) */
+/**
+ An initializer for commonly displayed synthesizer frequency units
+ (N_SYNTH_RANGE strings) */
#define DEFAULT_FREQ_RANGES \
{ \
"Hz", \
@@ -1229,7 +1246,7 @@ typedef struct
}
-/**
+/**
The definitions below can be used to query the
current synthesizer state.
*/
@@ -1259,14 +1276,14 @@ typedef struct
@defgroup group_tzdl Time zone/daylight saving parameters
Example: <br>
- For automatic daylight saving enable/disable in Central Europe,
+ For automatic daylight saving enable/disable in Central Europe,
the variables are to be set as shown below: <br>
- - offs = 3600L one hour from UTC
- - offs_dl = 3600L one additional hour if daylight saving enabled
- - tm_on = first Sunday from March 25, 02:00:00h ( year |= DL_AUTO_FLAG )
- - tm_off = first Sunday from October 25, 03:00:00h ( year |= DL_AUTO_FLAG )
- - name[0] == "CET " name if daylight saving not enabled
- - name[1] == "CEST " name if daylight saving is enabled
+ - offs = 3600L one hour from UTC
+ - offs_dl = 3600L one additional hour if daylight saving enabled
+ - tm_on = first Sunday from March 25, 02:00:00h ( year |= DL_AUTO_FLAG )
+ - tm_off = first Sunday from October 25, 03:00:00h ( year |= DL_AUTO_FLAG )
+ - name[0] == "CET " name if daylight saving not enabled
+ - name[1] == "CEST " name if daylight saving is enabled
@{
*/
@@ -1292,8 +1309,8 @@ typedef struct
/**
- If the year in tzdl.tm_on and tzdl.tm_off is or'ed with that constant,
- the receiver automatically generates daylight saving year by year.
+ If the year in tzdl.tm_on and tzdl.tm_off is or'ed with that constant,
+ the receiver automatically generates daylight saving year by year.
*/
#define DL_AUTO_FLAG 0x8000
@@ -1306,8 +1323,8 @@ typedef struct
#define DEFAULt_TZDL_OFFS_DL 3600L /**< usually DST is +1 hour */
-/**
- The symbol below can be used to initialize both the tm_on
+/**
+ The symbol below can be used to initialize both the tm_on
and tm_off fields for time zones which do not switch to DST:
*/
#define DEFAULT_TZDL_TM_ON_OFF_NO_DST \
@@ -1330,7 +1347,7 @@ typedef struct
}
-/**
+/**
The symbols below specify beginning and end of DST for
Central Europe, as constituted by the European Parliament:
*/
@@ -1347,8 +1364,8 @@ typedef struct
#define TZ_INFO_CET_CEST_EN "CET/CEST (Central Europe)"
#define TZ_INFO_CET_CEST_DE "MEZ/MESZ (Mitteleuropa)"
-#define DEFAULT_TZDL_NAMES_CET_CEST_EN { "CET ", "CEST " }
-#define DEFAULT_TZDL_NAMES_CET_CEST_DE { "MEZ ", "MESZ " }
+#define DEFAULT_TZDL_NAMES_CET_CEST_EN { "CET ", "CEST " }
+#define DEFAULT_TZDL_NAMES_CET_CEST_DE { "MEZ ", "MESZ " }
#define DEFAULT_TZDL_OFFS_CET 3600L
@@ -1386,8 +1403,8 @@ typedef struct
#define TZ_INFO_EET_EEST_EN "EET/EEST (East Europe)"
#define TZ_INFO_EET_EEST_DE "OEZ/OEST (Osteuropa)"
-#define DEFAULT_TZDL_NAMES_EET_EEST_EN { "EET ", "EEST " }
-#define DEFAULT_TZDL_NAMES_EET_EEST_DE { "OEZ ", "OESZ " }
+#define DEFAULT_TZDL_NAMES_EET_EEST_EN { "EET ", "EEST " }
+#define DEFAULT_TZDL_NAMES_EET_EEST_DE { "OEZ ", "OESZ " }
#define DEFAULT_TZDL_OFFS_EET 7200L
@@ -1412,7 +1429,7 @@ typedef struct
/** @} */ // endgroup
/**
- * The structure below reflects the status of the antenna,
+ * The structure below reflects the status of the antenna,
* the times of last disconnect/reconnect, and the board's
* clock offset after the disconnection interval.
*/
@@ -1433,8 +1450,8 @@ typedef struct
}
-/**
- The status field may be set to one of the values below:
+/**
+ The status field may be set to one of the values below:
*/
enum
{
@@ -1452,8 +1469,8 @@ enum
#define EF_FREQ_ALL 0x07 /**< all fixed freq. outputs on */
#define EF_SYNTH 0x01 /**< synth. on */
-/**
- The structure holds some flags which let
+/**
+ The structure holds some flags which let
the corresponding outputs be disabled after power-up until
the receiver has synchronized (flag == 0x00, the default) or force
the outputs to be enabled immediately after power-up. The fixed
@@ -1707,7 +1724,7 @@ typedef struct
/*
* The definitions below can be used to mark specific fields of a
- * PORT_SETTINGS structure, e.g. when editing build a mask indicating
+ * PORT_SETTINGS structure, e.g. when editing build a mask indicating
* which of the fields have changed or which are not valid.
*/
enum
@@ -1987,7 +2004,7 @@ enum
The following definitions are used to configure an optional
on-board IRIG input or output. Which frame types are supported
- by a device depends on the device type, and may eventually
+ by a device depends on the device type, and may eventually
depend on the device's firmware version.
All IRIG frames transport the day-of-year number plus the time-of-day,
@@ -2021,7 +2038,7 @@ enum
- \b AFNOR: 100 bps, 1 kHz carrier, SBS, complete date
- <b> AFNOR DC:</b> 100 bps, DCLS, SBS, complete date
- \b IEEE1344: 100 bps, 1 kHz carrier, time-of-year, SBS, IEEE1344 extensions (B120)
- - <b> IEEE1344 DC:</b> 100 bps, DCLS, time-of-year, SBS, IEEE1344 extensions (B000)
+ - <b> IEEE1344 DC:</b> 100 bps, DCLS, time-of-year, SBS, IEEE1344 extensions (B000)
- \b C37.118: like IEEE1344, but UTC offset with reversed sign
- \b C37.118 DC: like IEEE1344 DC, but UTC offset with reversed sign
@@ -2693,14 +2710,14 @@ typedef uint32_t MBG_IRIG_CTRL_BITS;
/**
The buffer below can be used to get the raw data bits
- from the IRIG decoder. A maximum number of RAW_IRIG_SIZE
- bytes can be filled. If less bytes are used then the rest
+ from the IRIG decoder. A maximum number of RAW_IRIG_SIZE
+ bytes can be filled. If less bytes are used then the rest
of the bytes are filled with zeros.
The first IRIG bit received from the transmitter is saved
in the MSB (bit 7) of data_bytes[0], etc.
*/
-typedef struct
+typedef struct
{
uint8_t data_bytes[RAW_IRIG_SIZE];
} MBG_RAW_IRIG_DATA;
@@ -2717,14 +2734,14 @@ typedef struct
-/**
- @defgroup group_scale Time Scale Configuration
+/**
+ @defgroup group_scale Time Scale Configuration
- The structures and defines can be used to configure the GPS receiver's
- basic time scale. By default this is UTC which can optionally
- be converted to some local time. However, some applications
- prefer TAI or pure GPS time. This can be configured using the
- structures below if the GPS_HAS_TIME_SCALE flag is set in
+ The structures and defines can be used to configure the GPS receiver's
+ basic time scale. By default this is UTC which can optionally
+ be converted to some local time. However, some applications
+ prefer TAI or pure GPS time. This can be configured using the
+ structures below if the GPS_HAS_TIME_SCALE flag is set in
RECEIVER_INFO::features.
@{
*/
@@ -2754,7 +2771,7 @@ enum
-/**
+/**
The fixed time offset between the GPS and TAI time scales, in seconds
*/
#define GPS_TAI_OFFSET 19 /**< [s], TAI = GPS + GPS_TAI_OFFSET */
@@ -3056,9 +3073,9 @@ typedef struct
/**
The structure below holds the current settings
- for a programmable pulse output, plus additional
- informaton on the output's capabilities.
- This can be read by setup programs to allow setup
+ for a programmable pulse output, plus additional
+ informaton on the output's capabilities.
+ This can be read by setup programs to allow setup
of supported features only.
*/
typedef struct
@@ -3108,8 +3125,8 @@ typedef struct
}
-/*
- * The codes below are used with devices which support multiple
+/*
+ * The codes below are used with devices which support multiple
* ref time sources at the same time. The priorities of the
* supported ref time sources is configurable.
*/
@@ -3122,7 +3139,7 @@ enum
{
MULTI_REF_NONE = -1, // nothing, undefined
MULTI_REF_GPS = 0, // standard GPS
- MULTI_REF_10MHZ, // 10 MHz input frequency
+ MULTI_REF_10MHZ, // 10 MHz input frequency
MULTI_REF_PPS, // 1 PPS input signal
MULTI_REF_10MHZ_PPS, // combined 10 MHz plus PPS
MULTI_REF_IRIG, // IRIG input
@@ -3154,7 +3171,7 @@ enum
/*
- * Bit masks used to indicate supported reference sources
+ * Bit masks used to indicate supported reference sources
*/
#define HAS_MULTI_REF_GPS ( 1UL << MULTI_REF_GPS )
#define HAS_MULTI_REF_10MHZ ( 1UL << MULTI_REF_10MHZ )
@@ -3169,16 +3186,16 @@ enum
/*
- * There are 2 different ways to configure multi ref support
- * provided by some devices.
+ * There are 2 different ways to configure multi ref support
+ * provided by some devices.
*
* Newer devices which have the GPS_FEAT_XMULTI_REF flag set
* in RECEIVER_INFO::features support the newer XMULTI_REF_...
* structures which provide a more flexible interface.
*
- * Older devices which have the GPS_FEAT_MULTI_REF flag set
- * support these MULTI_REF_... structures below where
- * the number of supported input sources and priorities
+ * Older devices which have the GPS_FEAT_MULTI_REF flag set
+ * support these MULTI_REF_... structures below where
+ * the number of supported input sources and priorities
* is limited to N_MULTI_REF_PRIO.
*/
@@ -3221,11 +3238,11 @@ typedef uint16_t MULTI_REF_STATUS; /* flag bits as defined below */
/*
- * The bits and associated bit masks below are used with the
- * MULTI_REF_STATUS type. Each bit is set if the associated
+ * The bits and associated bit masks below are used with the
+ * MULTI_REF_STATUS type. Each bit is set if the associated
* condition is true and is reset if the condition is not true:
*/
-enum
+enum
{
WRN_MODULE_MODE, /* selected input mode was invalid, set to default */
WRN_COLD_BOOT, /* GPS is in cold boot mode */
@@ -3253,16 +3270,16 @@ enum
/*
* If the RECEIVER_INFO::features flag GPS_FEAT_XMULTI_REF is set
- * then the following XMULTI_REF_... data structures must be used
+ * then the following XMULTI_REF_... data structures must be used
* instead of the older MULTI_REF_... structures above.
*
* Those devices support a number of priority levels addressed by
- * the priority index, starting at 0 for highest priority. A single
- * reference time source from the set of supported sources can be
+ * the priority index, starting at 0 for highest priority. A single
+ * reference time source from the set of supported sources can be
* assigned to each priority level.
- *
- * The structures below are used to configure the individual
- * time source for each priority level, and retrieve the status
+ *
+ * The structures below are used to configure the individual
+ * time source for each priority level, and retrieve the status
* of the time source at each priority level.
*/
@@ -3298,7 +3315,7 @@ typedef struct
/*
* The structure below contains the XMULTI_REF configuration
- * for a single priority level, plus information on supported
+ * for a single priority level, plus information on supported
* ref time sources, and the number of supported priority levels.
*/
typedef struct
@@ -3339,7 +3356,7 @@ typedef struct
/*
- * The structure below is used to retrieve the the status information
+ * The structure below is used to retrieve the the status information
* of the time source at a specific priority level.
*/
typedef struct
@@ -3351,9 +3368,9 @@ typedef struct
/*
- * Bits used with XMULTI_REF_STATUS.
+ * Bits used with XMULTI_REF_STATUS.
*/
-enum
+enum
{
XMRS_BIT_NOT_SUPP, /* ref type cfg'd for this level is not supported */
XMRS_BIT_NO_CONN, /* input signal is disconnected */
@@ -3381,8 +3398,8 @@ enum
/*
- * An initializer for a XMULTI_REF_STATUS variable
- * with status invalid / not used
+ * An initializer for a XMULTI_REF_STATUS variable
+ * with status invalid / not used
*/
#define XMULTI_REF_STATUS_INVALID \
{ \
@@ -3397,7 +3414,7 @@ enum
/*------------------------------------------------------------------------*/
/*
- * The types below are not used with all devices:
+ * The types below are not used with all devices:
*/
typedef uint16_t ROM_CSUM; /* The ROM checksum */
@@ -3405,18 +3422,18 @@ typedef uint16_t RCV_TIMEOUT; /* [min] (only if HAS_RCV_TIMEOUT) */
typedef uint16_t IGNORE_LOCK; /* (only if GPS_HAS_IGNORE_LOCK) */
/*
- * Originally IGNORE_LOG above has been a boolean value (equal or
+ * Originally IGNORE_LOG above has been a boolean value (equal or
* not equal 0) which was evaluated the same way for all ports.
*
- * Due to special firmware requirements it has been changed to a
- * bit maskable property in order to be able to specify the behaviour
+ * Due to special firmware requirements it has been changed to a
+ * bit maskable property in order to be able to specify the behaviour
* for individual ports.
*
- * In order to keep compatibility with older versions the LSB is used
- * to specify ignore_lock for all ports. The next higher bits are used
- * to specify ignore_lock for an individual port, where the bit position
+ * In order to keep compatibility with older versions the LSB is used
+ * to specify ignore_lock for all ports. The next higher bits are used
+ * to specify ignore_lock for an individual port, where the bit position
* depends on the port number, e.g. 0x02 for COM0, 0x04 for COM1, etc.
- * The macros below can be used to simplify the code:
+ * The macros below can be used to simplify the code:
*/
/* return a bit mask depending on the port number */
@@ -3437,7 +3454,7 @@ typedef uint16_t IGNORE_LOCK; /* (only if GPS_HAS_IGNORE_LOCK) */
/*------------------------------------------------------------------------*/
/*
- * The structures below are used with the SCU multiplexer board
+ * The structures below are used with the SCU multiplexer board
* in a redundant system:
*/
@@ -3446,13 +3463,13 @@ typedef struct
uint32_t hw_id; // hardware identification
uint32_t fw_id; // firmware identification
uint16_t flags; // reserved currently 0
- uint8_t clk0_info; // reference clock 0 type
- uint8_t clk1_info; // reference clock 1 type
+ uint8_t clk0_info; // reference clock 0 type
+ uint8_t clk1_info; // reference clock 1 type
uint16_t epld_status; // epld status word, see defintions below
uint16_t epld_control; // epld control word, see defintions below
} SCU_STAT_INFO;
-typedef struct
+typedef struct
{
uint16_t epld_control_mask; // control mask, determines which bit is to be changed
uint16_t epld_control_value; // control value, determines value of bits to be changed
@@ -3483,7 +3500,7 @@ typedef struct
* Definitions for clk0_info and clk1_info, can be used to determine
* the reference clock type connected to SCU input channel 0 and 1:
*/
-enum
+enum
{
SCU_CLK_INFO_GPS, // ref. clock is GPS receiver
SCU_CLK_INFO_DCF_PZF, // ref. clock is DCF77 PZF receiver
@@ -3626,7 +3643,7 @@ enum
#define MAX_USED_SATS 32
/*
- The structure below allos to transfer
+ The structure below allos to transfer
SV information from a certain GNSS type.
*/
typedef struct
@@ -3635,7 +3652,7 @@ typedef struct
uint8_t reserved;
uint16_t good_svs;
uint16_t svs_in_view;
- uint8_t svs[MAX_USED_SATS];
+ uint8_t svs[MAX_USED_SATS];
} GNSS_SAT_INFO;
#define _mbg_swab_gnss_sat_info( _p ) \
@@ -3665,7 +3682,7 @@ typedef struct
}
/**
- * The type below is used to configure the length of the
+ * The type below is used to configure the length of the
* antenna cable in [m]:
*/
typedef uint16_t ANT_CABLE_LEN;
@@ -3795,7 +3812,7 @@ typedef struct
/* codes used with LAN_IF_INFO::type: */
-enum
+enum
{
LAN_IF_TYPE_XPORT,
LAN_IF_TYPE_PTP,
@@ -3854,6 +3871,16 @@ enum
}
+#define PTP_NW_PROT_STRS_SHORT \
+{ \
+ "RES", \
+ "IP4", \
+ "IP6", \
+ "ETH", \
+ "DN", \
+ "CN", \
+ "PN" \
+}
enum
{
@@ -4000,6 +4027,25 @@ enum
+enum
+{
+ PTP_ROLE_MULTICAST_SLAVE,
+ PTP_ROLE_UNICAST_SLAVE,
+ PTP_ROLE_MULTICAST_MASTER,
+ PTP_ROLE_UNICAST_MASTER,
+ N_PTP_ROLES
+};
+
+
+#define PTP_ROLE_STRS \
+{ \
+ "Multicast Slave", \
+ "Unicast Slave", \
+ "Multicast Master", \
+ "Unicast Master" \
+}
+
+
/* PTP configuration stuff */
@@ -4008,6 +4054,8 @@ typedef struct
uint8_t b[8];
} PTP_CLOCK_IDENTITY;
+#define _mbg_swab_ptp_clock_identity( _p ) _nop_macro_fnc() // nothing to swap
+
typedef struct
@@ -4027,8 +4075,8 @@ typedef struct
uint8_t clock_class;
uint8_t clock_accuracy; // enum
- uint32_t num_clients;
- uint32_t num_masters;
+ uint32_t reserved_1;
+ uint32_t reserved_2;
uint8_t domain_number;
uint8_t time_source; // enum
@@ -4038,7 +4086,7 @@ typedef struct
int16_t utc_offset;
DAC_VAL osc_dac_cal;
- uint32_t reserved;
+ uint32_t reserved_3;
} PTP_STATE;
#define _mbg_swab_ptp_state( _p ) \
@@ -4049,6 +4097,7 @@ typedef struct
_mbg_swab_nano_time( &(_p)->path_delay ); \
_mbg_swab_nano_time( &(_p)->mean_path_delay ); \
_mbg_swab_nano_time( &(_p)->delay_asymmetry ); \
+ _mbg_swab_ptp_clock_identity( &(_p)->gm_identity ); \
_mbg_swab16( &(_p)->clock_offset_scaled_log_variance ); \
_mbg_swab32( &(_p)->num_clients ); \
_mbg_swab32( &(_p)->num_masters ); \
@@ -4064,6 +4113,7 @@ enum
PTP_FLAG_BIT_TIMESCALE_IS_PTP,
PTP_FLAG_BIT_LS_ANN,
PTP_FLAG_BIT_LS_ANN_NEG,
+ PTP_FLAG_BIT_IS_UNICAST,
N_PTP_FLAG_BIT
};
@@ -4072,6 +4122,7 @@ enum
#define PTP_FLAG_MSK_TIMESCALE_IS_PTP ( 1UL << PTP_FLAG_BIT_TIMESCALE_IS_PTP )
#define PTP_FLAG_MSK_LS_ANN ( 1UL << PTP_FLAG_BIT_LS_ANN )
#define PTP_FLAG_MSK_LS_ANN_NEG ( 1UL << PTP_FLAG_BIT_LS_ANN_NEG )
+#define PTP_FLAG_MSK_IS_UNICAST ( 1UL << PTP_FLAG_BIT_IS_UNICAST )
#define PTP_SYNC_INTERVAL_MIN -6
@@ -4080,6 +4131,15 @@ enum
#define PTP_DELAY_REQ_INTERVAL_MIN -6
#define PTP_DELAY_REQ_INTERVAL_MAX 6
+#define PTP_DEFAULT_UNICAST_SYNC_INTERVAL_MIN -4
+#define PTP_DEFAULT_UNICAST_SYNC_INTERVAL_MAX 4
+
+#define PTP_DEFAULT_UNICAST_DELAY_REQ_INTERVAL_MIN -4
+#define PTP_DEFAULT_UNICAST_DELAY_REQ_INTERVAL_MAX 4
+
+#define PTP_DEFAULT_UNICAST_ANNOUNCE_INTERVAL_MIN -4
+#define PTP_DEFAULT_UNICAST_ANNOUNCE_INTERVAL_MAX 4
+
typedef struct
{
@@ -4088,7 +4148,7 @@ typedef struct
uint8_t domain_number; // 0:3
uint8_t delay_mechanism; // 0 (E2E) or 1 (P2P), unless disabled
- uint8_t reserved_0;
+ uint8_t ptp_role; // MC_SLAVE/UC_SLAVE/MC_Master/UC_MASTER as defined in enum above
uint8_t priority_1;
uint8_t priority_2;
@@ -4104,8 +4164,8 @@ typedef struct
int16_t announce_interval; // log 2
int16_t delay_request_interval; // log 2
- uint32_t upper_bound; // [ns] sync state set to false if above this limit
- uint32_t lower_bound; // [ns] sync state set to true if below this limit
+ uint32_t upper_bound; // [ns] sync state set to false if above this limit
+ uint32_t lower_bound; // [ns] sync state set to true if below this limit
uint32_t reserved_3; // currently always 0
uint32_t flags; // (see below)
@@ -4170,11 +4230,92 @@ enum
{
PTP_CFG_BIT_TIME_SCALE_IS_PTP, // time scale is PTP/TAI, else arbitrary
PTP_CFG_BIT_V1_HW_COMPAT,
- N_PTP_CFG_BIT
+ PTP_CFG_BIT_CAN_BE_UNICAST_SLAVE,
+ PTP_CFG_BIT_CAN_BE_MULTICAST_MASTER,
+ PTP_CFG_BIT_CAN_BE_UNICAST_MASTER
};
-#define PTP_CFG_MSK_TIME_SCALE_IS_PTP ( 1UL << PTP_CFG_BIT_TIME_SCALE_IS_PTP )
-#define PTP_CFG_MSK_V1_HW_COMPAT ( 1UL << PTP_CFG_BIT_V1_HW_COMPAT )
+#define PTP_CFG_MSK_TIME_SCALE_IS_PTP ( 1UL << PTP_CFG_BIT_TIME_SCALE_IS_PTP )
+#define PTP_CFG_MSK_V1_HW_COMPAT ( 1UL << PTP_CFG_BIT_V1_HW_COMPAT )
+#define PTP_CFG_MSK_CAN_BE_UNICAST_SLAVE ( 1UL << PTP_CFG_BIT_CAN_BE_UNICAST_SLAVE )
+#define PTP_CFG_MSK_CAN_BE_MULTICAST_MASTER ( 1UL << PTP_CFG_BIT_CAN_BE_MULTICAST_MASTER )
+#define PTP_CFG_MSK_CAN_BE_UNICAST_MASTER ( 1UL << PTP_CFG_BIT_CAN_BE_UNICAST_MASTER )
+
+
+#define PTP_CFG_MSK_SUPPORT_PTP_ROLES ( PTP_CFG_MSK_CAN_BE_UNICAST_SLAVE | \
+ PTP_CFG_MSK_CAN_BE_MULTICAST_MASTER | \
+ PTP_CFG_MSK_CAN_BE_UNICAST_MASTER )
+
+#define PTP_CFG_MSK_SUPPORT_PTP_UNICAST ( PTP_CFG_MSK_CAN_BE_UNICAST_SLAVE | \
+ PTP_CFG_MSK_CAN_BE_UNICAST_MASTER )
+
+
+// Set Multicast as default
+#define _get_supp_ptp_roles( _r ) ((((_r) & ~3UL) >> PTP_CFG_BIT_V1_HW_COMPAT ) | 1UL)
+
+// The MBG_HOSTNAME type can hold a host's fully qualified domain name (FQDN),
+// or the ASCII string of a numeric IP address.
+// In theory each single component (host name, domain name, top level domain name)
+// of a FQDN can have up to 63 characters, but the overall length is limited to
+// 255 characters. We specify one more character for the trailing 0.
+typedef char MBG_HOSTNAME[256];
+
+typedef struct
+{
+ MBG_HOSTNAME gm_host; /**< grandmaster's hostname or IP address */
+ PTP_CLOCK_IDENTITY gm_clock_id; /**< use clock ID of master port, or FF:FF:FF:FF:FF:FF:FF:FF as wildcard */
+ uint16_t gm_port_id; /**< use target port ID of master port (e.g. '1') or 0xFFFF as wildcard */
+ int16_t sync_interval; /**< log 2 */
+ int16_t announce_interval; /**< log 2 */
+ int16_t delay_request_interval; /**< log 2 */
+ uint16_t message_duration; /**< time period until master stops sending the messages */
+ uint16_t reserved;
+ uint32_t flags;
+
+} PTP_UNICAST_CFG_SETTINGS;
+
+#define _mbg_swab_ptp_unicast_cfg_settings( _p ) \
+{ \
+ _mbg_swab_ptp_clock_identity( &(_p)->gm_clock_id ); \
+ _mbg_swab16( &(_p)->gm_port_id ); \
+ _mbg_swab16( &(_p)->sync_interval ); \
+ _mbg_swab16( &(_p)->announce_interval ); \
+ _mbg_swab16( &(_p)->delay_request_interval ); \
+ _mbg_swab16( &(_p)->message_duration ); \
+ _mbg_swab16( &(_p)->reserved ); \
+ _mbg_swab32( &(_p)->flags ); \
+}
+
+
+
+typedef struct
+{
+ PTP_UNICAST_CFG_SETTINGS settings;
+
+ int16_t sync_interval_min; // log 2
+ int16_t sync_interval_max; // log 2
+ int16_t announce_interval_min; // log 2
+ int16_t announce_interval_max; // log 2
+ int16_t delay_request_interval_min; // log 2
+ int16_t delay_request_interval_max; // log 2
+
+ uint32_t supported_flags;
+ uint32_t reserved;
+
+} PTP_UNICAST_CFG_INFO;
+
+#define _mbg_swab_ptp_unicast_cfg_info( _p ) \
+{ \
+ _mbg_swab_ptp_unicast_cfg_settings( &(_p)->settings ); \
+ _mbg_swab16( &(_p)->sync_interval_min ); \
+ _mbg_swab16( &(_p)->sync_interval_max ); \
+ _mbg_swab16( &(_p)->announce_interval_min ); \
+ _mbg_swab16( &(_p)->announce_interval_max ); \
+ _mbg_swab16( &(_p)->delay_request_interval_min ); \
+ _mbg_swab16( &(_p)->delay_request_interval_max ); \
+ _mbg_swab32( &(_p)->supported_flags ); \
+ _mbg_swab32( &(_p)->reserved ); \
+}
@@ -4344,7 +4485,7 @@ enum
GPS_PLATFORM_AIRBORNE_4G,
N_GPS_PLATFORMS
};
-
+
#define GPS_PLATFORM_STRS \
{ \
@@ -4365,11 +4506,11 @@ enum
{
TIME_MODE_DISABLED,
TIME_MODE_SURVEY_IN,
- TIME_MODE_FIXED
+ TIME_MODE_FIXED
};
-
+
typedef struct
{
uint32_t time_mode;
@@ -4384,12 +4525,12 @@ typedef struct
} NAV_TIME_MODE_SETTINGS;
-/**
- Navigation Engine settings to set configuration
+/**
+ Navigation Engine settings to set configuration
parameters of a dynamic platform model.
*/
typedef struct
-{
+{
uint8_t dynamic_platform;
uint8_t fix_mode;
int8_t min_elevation;