summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Burnicki <martin.burnicki@meinberg.de>2019-04-15 12:00:00 +0200
committerMartin Burnicki <martin.burnicki@meinberg.de>2019-04-15 12:00:00 +0200
commit36a698982fadd97ddda9d239a00ae848aaef3609 (patch)
tree9dc9ff0625c51adcb0619316deff2af77289b6e4
parent9e5ae74979605aee0d48ba0951ecc37d10b2a175 (diff)
downloadmbgtools-win-36a698982fadd97ddda9d239a00ae848aaef3609.tar.gz
mbgtools-win-36a698982fadd97ddda9d239a00ae848aaef3609.zip
Update files according to mbgtools-lx-4.2.64.2.6
'mbgstatus' now also prints memory mapped timestamp and raw GPS time in verbose mode. 'mbgstatus' message text now says, "Last leap second probably" instead of "eventually". 'mbgshowsignal' supports force-reading the status port even if the device doesn't provide a modulation signal. Requires dkwin-3.08 or newer.
-rw-r--r--mbglib/common/mbg_serclock_cfg.h57
-rw-r--r--mbglib/common/mbgerror.c10
-rw-r--r--mbglib/common/mbgerror.h28
-rw-r--r--mbglib/common/mbgioctl.c11
-rw-r--r--mbglib/common/mbgioctl.h16
-rw-r--r--mbglib/common/mbgpccyc.h100
-rw-r--r--mbglib/common/pcpsiobf.h14
-rw-r--r--mbglib/common/toolutil.h21
-rw-r--r--mbglib/common/usbdefs.h18
-rw-r--r--mbgshowsignal/mbgshowsignal.c41
-rw-r--r--mbgstatus/mbgstatus.c32
-rw-r--r--mbgversion.h10
12 files changed, 220 insertions, 138 deletions
diff --git a/mbglib/common/mbg_serclock_cfg.h b/mbglib/common/mbg_serclock_cfg.h
index 8d2dad0..5ff0c63 100644
--- a/mbglib/common/mbg_serclock_cfg.h
+++ b/mbglib/common/mbg_serclock_cfg.h
@@ -1,7 +1,7 @@
/**************************************************************************
*
- * $Id: mbg_serclock_cfg.h 1.3 2018/11/29 14:31:47Z martin REL_M $
+ * $Id: mbg_serclock_cfg.h 1.4 2019/04/05 07:29:33Z martin.burnicki REL_M $
*
* Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
*
@@ -10,7 +10,10 @@
*
* -----------------------------------------------------------------------
* $Log: mbg_serclock_cfg.h $
- * Revision 1.3 2018/11/29 14:31:47Z martin
+ * Revision 1.4 2019/04/05 07:29:33Z martin.burnicki
+ * Added some comments.
+ * Removed some obsolete code.
+ * Revision 1.3 2018/11/29 14:31:47 martin
* New preprocessor symbol MBG_SUPP_LANCLOCK to
* conditionally include lanclock stuff.
* Revision 1.2 2018/08/08 09:44:01Z martin
@@ -95,32 +98,42 @@ typedef struct
} MBG_SERCLOCK_CFG;
-// Bit masks used with MBG_SERCLOCK_CFG::flags:
+/**
+ * @brief Bit masks used with MBG_SERCLOCK_CFG::flags
+ */
enum
{
- SERCLOCK_FORCE_UTC, // string contains always UTC time
- SERCLOCK_READ_NORMAL, // don't use special timeout settings
- SERCLOCK_STRING_PER_MINUTE, // account for serial string once per minute
- N_SERCLOCK_FLAGS
+ /// This bit can be set if the applied time string
+ /// always contains UTC time, even though this is not
+ /// indicated by the statues character in the string.
+ /// Can be configured in the monitor program.
+ SERCLOCK_FORCE_UTC,
+
+ /// If this bit is set then the serial port is not
+ /// specifically configured to receive a time string,
+ /// and characters are read from the receive buffer
+ /// one after the other, which reduces the resulting
+ /// accuracy.
+ /// This option was introduced a long time ago
+ /// (eventually under Windows NT) to work around reception
+ /// problems in the default mode of operation.
+ /// Must be set manually in the registry.
+ SERCLOCK_READ_NORMAL,
+
+ /// If the connected clock can sent the time string only
+ /// once per minute then this flag can be set to avoid
+ /// receive timeouts which would normally happen.
+ /// Must be set manually in the registry.
+ SERCLOCK_STRING_PER_MINUTE,
+
+ N_SERCLOCK_FLAGS //< The number of known bits.
};
-#define MSK_SERCLOCK_FORCE_UTC ( 1UL << SERCLOCK_FORCE_UTC )
-#define MSK_SERCLOCK_READ_NORMAL ( 1UL << SERCLOCK_READ_NORMAL )
-#define MSK_SERCLOCK_STRING_PER_MINUTE ( 1UL << SERCLOCK_STRING_PER_MINUTE )
+#define MSK_SERCLOCK_FORCE_UTC ( 1UL << SERCLOCK_FORCE_UTC ) //< see ::SERCLOCK_FORCE_UTC
+#define MSK_SERCLOCK_READ_NORMAL ( 1UL << SERCLOCK_READ_NORMAL ) //< see ::SERCLOCK_READ_NORMAL
+#define MSK_SERCLOCK_STRING_PER_MINUTE ( 1UL << SERCLOCK_STRING_PER_MINUTE ) //< see ::SERCLOCK_STRING_PER_MINUTE
-#if 0 // TODO
-
-typedef struct
-{
- IP4_ADDR ip4_addr;
- PASSWORD password;
- uint32_t flags;
-
-} ;
-
-#endif
-
/* ----- function prototypes begin ----- */
diff --git a/mbglib/common/mbgerror.c b/mbglib/common/mbgerror.c
index c0f1a3f..34673c8 100644
--- a/mbglib/common/mbgerror.c
+++ b/mbglib/common/mbgerror.c
@@ -1,7 +1,7 @@
/**************************************************************************
*
- * $Id: mbgerror.c 1.6 2018/11/22 14:47:15Z martin REL_M $
+ * $Id: mbgerror.c 1.7 2019/04/03 12:53:55Z martin REL_M $
*
* Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
*
@@ -10,7 +10,9 @@
*
* -----------------------------------------------------------------------
* $Log: mbgerror.c $
- * Revision 1.6 2018/11/22 14:47:15Z martin
+ * Revision 1.7 2019/04/03 12:53:55Z martin
+ * Use new code MBG_ERR_BAD_ADDR.
+ * Revision 1.6 2018/11/22 14:47:15 martin
* Support QNX target.
* New function mbg_win32_ntstatus_to_mbg().
* Added and renamed static code conversion tables.
@@ -183,7 +185,7 @@ static ERRNO_CNV_ENTRY posix_errno_table[] =
{ EAGAIN, MBG_ERR_AGAIN }, // 11, Try again, resource temporarily unavailable (later calls may complete normally, maybe same as EWOULDBLOCK).
{ ENOMEM, MBG_ERR_NO_MEM }, // 12, Out of memory (can't allocate memory).
{ EACCES, MBG_ERR_ACCESS }, // 13, Permission denied (e.g. when trying to access a device without sufficient permissions).
- { EFAULT, MBG_ERR_INV_PARM }, // 14, Bad address (e.g. invalid address in a function argument).
+ { EFAULT, MBG_ERR_BAD_ADDRESS }, // 14, Bad address (e.g. invalid address in a function argument).
// { ENOTBLK, }, // 15, Block device required (eventually no POSIX error, but supported in Linux and *BSD).
{ EBUSY, MBG_ERR_BUSY }, // 16, Device or resource busy.
{ EEXIST, MBG_ERR_EXIST }, // 17, File exists.
@@ -516,7 +518,7 @@ static ERRNO_CNV_ENTRY win32_wsa_err_table[] =
{ WSAEINTR, MBG_ERR_INTR }, // 10004L A blocking operation was interrupted by a call to WSACancelBlockingCall.
// { WSAEBADF // 10009L The file handle supplied is not valid.
// { WSAEACCES // 10013L An attempt was made to access a socket in a way forbidden by its access permissions.
- { WSAEFAULT, MBG_ERR_INV_PARM }, // 10014L The system detected an invalid pointer address in attempting to use a pointer argument in a call.
+ { WSAEFAULT, MBG_ERR_BAD_ADDRESS }, // 10014L The system detected an invalid pointer address in attempting to use a pointer argument in a call.
{ WSAEINVAL, MBG_ERR_INV_PARM }, // 10022L An invalid argument was supplied.
// { WSAEMFILE // 10024L Too many open sockets.
{ WSAEWOULDBLOCK, MBG_ERR_AGAIN }, // 10035L A non-blocking socket operation could not be completed immediately.
diff --git a/mbglib/common/mbgerror.h b/mbglib/common/mbgerror.h
index 2aa07c4..817995a 100644
--- a/mbglib/common/mbgerror.h
+++ b/mbglib/common/mbgerror.h
@@ -1,7 +1,7 @@
/**************************************************************************
*
- * $Id: mbgerror.h 1.19 2019/02/08 10:42:56Z martin REL_M $
+ * $Id: mbgerror.h 1.21 2019/03/13 16:17:10Z martin REL_M $
*
* Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
*
@@ -11,7 +11,11 @@
*
* -----------------------------------------------------------------------
* $Log: mbgerror.h $
- * Revision 1.19 2019/02/08 10:42:56Z martin
+ * Revision 1.21 2019/03/13 16:17:10Z martin
+ * New code MBG_ERR_BAD_ADDRESS (for EFAULT).
+ * Revision 1.20 2019/03/13 09:44:30 martin
+ * Moved predefined program exit codes here.
+ * Revision 1.19 2019/02/08 10:42:56 martin
* Distinguish more detailed if an NTSTATUS replacement
* is required for a particular build environment.
* Revision 1.18 2018/11/22 11:25:56 martin
@@ -381,7 +385,7 @@ extern "C" {
#define MBG_ERR_OUTDATED -117
#define MBG_ERR_STR_SUBSTR -118 ///< Invalid substring in string
-
+#define MBG_ERR_BAD_ADDRESS -119 ///< Bad Address (like POSIX EFAULT)
// NOTE: New codes have to be appended to this list, and the sequence of codes must not
// be changed. Whenever new codes have been defined, appropriate entries have to be added
@@ -531,7 +535,8 @@ extern "C" {
{ MBG_ERR_CONN_RESET, "Connection reset by peer" }, \
{ MBG_ERR_NO_SPACE, "Insufficient disk space" }, \
{ MBG_ERR_PAM, "PAM authentication was not successful" }, \
- { MBG_ERR_TIMER, "Timer expired" } \
+ { MBG_ERR_TIMER, "Timer expired" }, \
+ { MBG_ERR_BAD_ADDRESS, "Bad Address" }
#endif
@@ -618,6 +623,21 @@ bool mbg_rc_is_success_or_err_perm( int rc )
+/**
+ * @brief Predefined exit codes returned by some tools.
+ */
+enum MBG_EXIT_CODES
+{
+ MBG_EXIT_CODE_SUCCESS, ///< Requested action completed successfully.
+ MBG_EXIT_CODE_USAGE, ///< Unable to handle requested action, usage printed.
+ MBG_EXIT_CODE_NOT_SUPP, ///< Requested action not supported on the running OS.
+ MBG_EXIT_CODE_FAIL, ///< Action failed for specified device.
+ MBG_EXIT_CODE_INV_TIME, ///< Device has no valid time to set the system time with.
+ N_MBG_EXIT_CODES
+};
+
+
+
/* ----- function prototypes begin ----- */
/* This section was generated automatically */
diff --git a/mbglib/common/mbgioctl.c b/mbglib/common/mbgioctl.c
index 4a38f03..e81d7fc 100644
--- a/mbglib/common/mbgioctl.c
+++ b/mbglib/common/mbgioctl.c
@@ -1,7 +1,7 @@
/**************************************************************************
*
- * $Id: mbgioctl.c 1.5 2018/11/22 14:57:43Z martin REL_M $
+ * $Id: mbgioctl.c 1.6 2019/04/03 12:59:43Z martin REL_M $
*
* Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
*
@@ -10,7 +10,9 @@
*
* -----------------------------------------------------------------------
* $Log: mbgioctl.c $
- * Revision 1.5 2018/11/22 14:57:43Z martin
+ * Revision 1.6 2019/04/03 12:59:43Z martin
+ * Fixed preprocessor conditionals using unknown symbols.
+ * Revision 1.5 2018/11/22 14:57:43 martin
* Check new preprocessor symbol MBG_TGT_USE_IOCTL to exclude
* code from build on targets that don't use IOCTL calls.
* Revision 1.4 2018/11/05 13:33:26 martin
@@ -42,7 +44,7 @@
#include <mbgerror.h>
-#if defined( MBG_TGT_WINDOWS ) && !defined( MBG_TGT_KERNEL )
+#if defined( MBG_TGT_WIN32 ) && !defined( MBG_TGT_KERNEL )
/*HDR*/
int mbgioctl_rc_to_mbg_errno( int sys_errno )
@@ -71,7 +73,6 @@ int mbgioctl_rc_to_mbg_errno( int sys_errno )
#if defined( MBG_TGT_LINUX ) // Linux-specific codes
case IOCTL_RC_ERR_COPY_TO_USER: return MBG_ERR_COPY_TO_USER; // FIXME
// case IOCTL_RC_ERR_COPY_FROM_USER: return MBG_ERR_COPY_FROM_USER;
-
#endif // defined( MBG_TGT_LINUX )
}
@@ -84,7 +85,7 @@ int mbgioctl_rc_to_mbg_errno( int sys_errno )
} // mbgioctl_rc_to_mbg_errno
-#endif // defined( MBG_TGT_WINDOWS ) && !defined( MBG_TGT_KERNEL )
+#endif // defined( MBG_TGT_WIN32 ) && !defined( MBG_TGT_KERNEL )
diff --git a/mbglib/common/mbgioctl.h b/mbglib/common/mbgioctl.h
index 41253d3..1fcd7d6 100644
--- a/mbglib/common/mbgioctl.h
+++ b/mbglib/common/mbgioctl.h
@@ -1,7 +1,7 @@
/**************************************************************************
*
- * $Id: mbgioctl.h 1.33 2019/02/08 16:06:52Z martin REL_M $
+ * $Id: mbgioctl.h 1.34 2019/04/03 12:28:11Z martin REL_M $
*
* Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
*
@@ -10,7 +10,9 @@
*
* -----------------------------------------------------------------------
* $Log: mbgioctl.h $
- * Revision 1.33 2019/02/08 16:06:52Z martin
+ * Revision 1.34 2019/04/03 12:28:11Z martin
+ * Removed obsolete definition PCPS_SPIN_BUFFER.
+ * Revision 1.33 2019/02/08 16:06:52 martin
* Moved the Windows GUID stuff elsewhere.
* Revision 1.32 2018/11/22 15:01:44 martin
* Refactored structure IOCTL_GENERIC_REQ using fixed size integer
@@ -479,16 +481,6 @@ typedef struct
typedef union
{
- PCPS_STATUS_PORT pcps_status_port;
- PCPS_TIME_STAMP pcps_time_stamp;
- PCPS_TIME_STAMP_CYCLES pcps_time_stamp_cycles;
-
-} PCPS_SPIN_BUFFER;
-
-
-
-typedef union
-{
IOCTL_DEV_FEAT_REQ dev_feat_req;
PCPS_MAPPED_MEM mapped_mem;
diff --git a/mbglib/common/mbgpccyc.h b/mbglib/common/mbgpccyc.h
index 14add0a..842fe32 100644
--- a/mbglib/common/mbgpccyc.h
+++ b/mbglib/common/mbgpccyc.h
@@ -1,7 +1,7 @@
/**************************************************************************
*
- * $Id: mbgpccyc.h 1.7 2017/05/10 15:21:41Z martin REL_M $
+ * $Id: mbgpccyc.h 1.8 2019/03/18 08:58:39Z martin REL_M $
*
* Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
*
@@ -10,7 +10,9 @@
*
* -----------------------------------------------------------------------
* $Log: mbgpccyc.h $
- * Revision 1.7 2017/05/10 15:21:41Z martin
+ * Revision 1.8 2019/03/18 08:58:39Z martin
+ * Cleanup and comments.
+ * Revision 1.7 2017/05/10 15:21:41 martin
* Tiny cleanup.
* Revision 1.6 2016/08/09 16:01:10 martin
* Syntax fix.
@@ -42,7 +44,7 @@
#if defined( MBG_TGT_NETBSD )
#if defined( MBG_TGT_KERNEL )
#include <machine/cpu.h>
- #include <machine/cpu_counter.h> /* for cycle counter abstraction */
+ #include <machine/cpu_counter.h> // for cycle counter abstraction
#endif
#endif
@@ -50,7 +52,7 @@
#if defined( MBG_TGT_KERNEL )
#if defined( MBG_ARCH_X86 )
#include <sys/time.h>
- #include <machine/clock.h> /* for symbol 'tsc_freq' */
+ #include <machine/clock.h> // for symbol 'tsc_freq'
#endif
#endif
#endif
@@ -82,7 +84,15 @@ extern "C" {
* The cycle counter value is usually derived from the PC CPU's TSC or some other
* timer hardware on the mainboard.
*/
-#if defined( MBG_TGT_WIN32 ) || defined( MBG_TGT_POSIX )
+#if defined( MBG_TGT_WIN32 )
+
+ // On Windows, QPC() is commonly used to retrieve a cycles count
+ // as LARGE_INTEGER union which has a LONGLONG QuadPart field,
+ // which in fact is a signed 64 bit integer.
+ typedef int64_t MBG_PC_CYCLES;
+ typedef uint64_t MBG_PC_CYCLES_FREQUENCY;
+
+#elif defined( MBG_TGT_POSIX )
typedef int64_t MBG_PC_CYCLES;
typedef uint64_t MBG_PC_CYCLES_FREQUENCY;
@@ -97,6 +107,7 @@ extern "C" {
// MBG_PC_CYCLES and MBG_PC_CYCLES_FREQUENCY are always read in native
// machine endianess, so no endianess conversion is required.
+
#define _mbg_swab_mbg_pc_cycles( _p ) \
_nop_macro_fnc()
@@ -166,59 +177,62 @@ extern "C" {
static __mbg_inline
void mbg_get_pc_cycles( MBG_PC_CYCLES *p )
{
-#if !defined( OMIT_PC_CYCLES_SUPPORT )
+ #if !defined( OMIT_PC_CYCLES_SUPPORT )
- #if defined( MBG_TGT_WIN32 )
+ #if defined( MBG_TGT_WIN32 )
- #if defined( MBG_TGT_KERNEL ) // kernel space
- *p = (MBG_PC_CYCLES) KeQueryPerformanceCounter( NULL ).QuadPart;
- #else // user space
- QueryPerformanceCounter( (LARGE_INTEGER *) p );
- #endif
+ #if defined( MBG_TGT_KERNEL ) // kernel space
+ *p = (MBG_PC_CYCLES) KeQueryPerformanceCounter( NULL ).QuadPart;
+ #else // user space
+ // Please note QPC() *may* fail if p points to a variable
+ // that is *not* at least 4-byte-aligned.
+ QueryPerformanceCounter( (LARGE_INTEGER *) p );
+ #endif
- #define MBG_PC_CYCLES_SUPPORTED 1
+ #define MBG_PC_CYCLES_SUPPORTED 1
- #elif defined( MBG_TGT_LINUX ) && defined( MBG_ARCH_X86 )
+ #elif defined( MBG_TGT_LINUX ) && defined( MBG_ARCH_X86 )
- *p = mbg_rdtscll();
- #define MBG_PC_CYCLES_SUPPORTED 1
+ *p = mbg_rdtscll();
+ #define MBG_PC_CYCLES_SUPPORTED 1
- #elif defined( MBG_TGT_LINUX ) && defined( MBG_ARCH_IA64 ) && defined( MBG_TGT_KERNEL )
+ #elif defined( MBG_TGT_LINUX ) && defined( MBG_ARCH_IA64 ) && defined( MBG_TGT_KERNEL )
- unsigned long result = ia64_getreg( _IA64_REG_AR_ITC );
- ia64_barrier();
+ unsigned long result = ia64_getreg( _IA64_REG_AR_ITC );
+ ia64_barrier();
- #ifdef CONFIG_ITANIUM
- while (unlikely((__s32) result == -1)) {
- result = ia64_getreg(_IA64_REG_AR_ITC);
- ia64_barrier();
- }
- #endif
+ #ifdef CONFIG_ITANIUM
+ while (unlikely((__s32) result == -1))
+ {
+ result = ia64_getreg(_IA64_REG_AR_ITC);
+ ia64_barrier();
+ }
+ #endif
- *p = result;
+ *p = result;
- #define MBG_PC_CYCLES_SUPPORTED 1
+ #define MBG_PC_CYCLES_SUPPORTED 1
- #elif defined( MBG_TGT_LINUX ) && defined( MBG_TGT_KERNEL )
+ #elif defined( MBG_TGT_LINUX ) && defined( MBG_TGT_KERNEL )
- *p = get_cycles();
- #define MBG_PC_CYCLES_SUPPORTED 1
+ *p = get_cycles();
+ #define MBG_PC_CYCLES_SUPPORTED 1
- #elif defined( MBG_TGT_FREEBSD ) && defined( MBG_ARCH_X86 )
+ #elif defined( MBG_TGT_FREEBSD ) && defined( MBG_ARCH_X86 )
- *p = mbg_rdtscll();
+ *p = mbg_rdtscll();
- #define MBG_PC_CYCLES_SUPPORTED 1
+ #define MBG_PC_CYCLES_SUPPORTED 1
- #elif defined( MBG_TGT_NETBSD ) && defined( MBG_TGT_KERNEL )
+ #elif defined( MBG_TGT_NETBSD ) && defined( MBG_TGT_KERNEL )
- *p = cpu_counter(); //##++ or cpu_counter_serializing()
+ *p = cpu_counter(); // TODO or cpu_counter_serializing()?
- #define MBG_PC_CYCLES_SUPPORTED 1
+ #define MBG_PC_CYCLES_SUPPORTED 1
- #endif
+ #endif
-#endif
+ #endif
#if !defined( MBG_PC_CYCLES_SUPPORTED )
@@ -252,7 +266,8 @@ void mbg_get_pc_cycles_frequency( MBG_PC_CYCLES_FREQUENCY *p )
#elif defined( MBG_TGT_LINUX ) && defined( MBG_ARCH_IA64 )
- // we probably can use
+ // TODO we probably can use:
+ //
// ia64_sal_freq_base(unsigned long which, unsigned long *ticks_per_second,
// unsigned long *drift_info)
// However, this is not tested.
@@ -280,14 +295,7 @@ void mbg_get_pc_cycles_frequency( MBG_PC_CYCLES_FREQUENCY *p )
static __mbg_inline
MBG_PC_CYCLES mbg_delta_pc_cycles( const MBG_PC_CYCLES *p1, const MBG_PC_CYCLES *p2 )
{
-#if 0 && !MBG_PC_CYCLES_SUPPORTED
- // Cycle counts not supported on this target platform.
- // Under SPARC this may even result in bus errors
- // due to alignment of the underlying data structures.
- return 0;
-#else
return *p1 - *p2;
-#endif
} // mbg_delta_pc_cycles
diff --git a/mbglib/common/pcpsiobf.h b/mbglib/common/pcpsiobf.h
index e0af290..ab45c27 100644
--- a/mbglib/common/pcpsiobf.h
+++ b/mbglib/common/pcpsiobf.h
@@ -1,7 +1,7 @@
/**************************************************************************
*
- * $Id: pcpsiobf.h 1.2 2018/01/18 14:52:52Z martin REL_M $
+ * $Id: pcpsiobf.h 1.3 2019/04/03 12:33:22Z martin REL_M $
*
* Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
*
@@ -12,7 +12,9 @@
*
* -----------------------------------------------------------------------
* $Log: pcpsiobf.h $
- * Revision 1.2 2018/01/18 14:52:52Z martin
+ * Revision 1.3 2019/04/03 12:33:22Z martin
+ * Excluded some PCPS_IO_BUFFER fields that are currently not required.
+ * Revision 1.2 2018/01/18 14:52:52 martin
* Fix for C++ builds.
* Revision 1.1 2018/01/15 10:31:26Z martin
* Initial revision with structures moved from mbgioctl.h here.
@@ -75,7 +77,7 @@ typedef struct
*/
typedef union
{
- PCPS_STATUS_PORT pcps_status_port;
+ PCPS_STATUS_PORT pcps_status_port_usb; // only used with USB devices
PCPS_ID_STR fw_id;
PCPS_SN_STR sernum;
PCPS_TIME pcps_time;
@@ -130,10 +132,10 @@ typedef union
PCPS_TIME_CYCLES pcps_time_cycles;
PCPS_HR_TIME_CYCLES pcps_hr_time_cycles;
MBG_DBG_PORT mbg_dbg_port;
- MBG_DBG_DATA mbg_dbg_data;
- MBG_PC_CYCLES_FREQUENCY mbg_pc_cycles_frequency;
+ // MBG_DBG_DATA mbg_dbg_data; // currently not required
+ // MBG_PC_CYCLES_FREQUENCY mbg_pc_cycles_frequency; // currently not required
MBG_TIME_INFO_HRT mbg_time_info_hrt;
- MBG_TIME_INFO_TSTAMP mbg_time_info_tstamp;
+ // MBG_TIME_INFO_TSTAMP mbg_time_info_tstamp; // currently not required
CORR_INFO corr_info;
TR_DISTANCE tr_distance;
MBG_DEBUG_STATUS debug_status;
diff --git a/mbglib/common/toolutil.h b/mbglib/common/toolutil.h
index 8d75797..cb44f6d 100644
--- a/mbglib/common/toolutil.h
+++ b/mbglib/common/toolutil.h
@@ -1,7 +1,7 @@
/**************************************************************************
*
- * $Id: toolutil.h 1.7 2018/12/14 13:14:52Z martin REL_M $
+ * $Id: toolutil.h 1.8 2019/03/13 09:44:57Z martin REL_M $
*
* Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
*
@@ -10,7 +10,9 @@
*
* -----------------------------------------------------------------------
* $Log: toolutil.h $
- * Revision 1.7 2018/12/14 13:14:52Z martin
+ * Revision 1.8 2019/03/13 09:44:57Z martin
+ * Moved predefined program exit codes to mbgerror.h.
+ * Revision 1.7 2018/12/14 13:14:52 martin
* Updated function prototypes.
* Revision 1.6 2018/11/15 12:21:10 martin
* Updated function prototypes.
@@ -143,21 +145,6 @@ typedef int MBG_DEV_HANDLER_FNC( MBG_DEV_HANDLE, const PCPS_DEV *);
-/**
- * @brief Exit codes returned by the command line tools
- */
-enum MBG_EXIT_CODES
-{
- MBG_EXIT_CODE_SUCCESS, ///< Device handled successfully for requested action
- MBG_EXIT_CODE_USAGE, ///< Device not handled successfully, usage printed
- MBG_EXIT_CODE_NOT_SUPP, ///< Not supported on the running OS
- MBG_EXIT_CODE_FAIL, ///< Action failed for device
- MBG_EXIT_CODE_INV_TIME, ///< Device has no valid time to set the system time with
- N_MBG_EXIT_CODES
-};
-
-
-
/* ----- function prototypes begin ----- */
/* This section was generated automatically */
diff --git a/mbglib/common/usbdefs.h b/mbglib/common/usbdefs.h
index 1159868..ce88cf8 100644
--- a/mbglib/common/usbdefs.h
+++ b/mbglib/common/usbdefs.h
@@ -1,7 +1,7 @@
/**************************************************************************
*
- * $Id: usbdefs.h 1.40 2019/01/14 08:37:45Z martin REL_M $
+ * $Id: usbdefs.h 1.41 2019/03/08 10:51:15Z martin REL_M $
*
* Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
*
@@ -10,7 +10,10 @@
*
* -----------------------------------------------------------------------
* $Log: usbdefs.h $
- * Revision 1.40 2019/01/14 08:37:45Z martin
+ * Revision 1.41 2019/03/08 10:51:15Z martin
+ * Added support for GNM181.
+ * Renamed class MBG_USB_CLASS_GRC to MBG_USB_CLASS_GNS.
+ * Revision 1.40 2019/01/14 08:37:45 martin
* GRC181 and GRC165 were preliminary names, so changed the
* associated definitions to GNS181 and GNS165 which are the
* final device names.
@@ -170,7 +173,7 @@ enum MBG_USB_CLASS_CODES
MBG_USB_CLASS_HPS, ///< High Performance Synchronization Card (PTP/NTP)
MBG_USB_CLASS_VSG, ///< Video Sync Generator
MBG_USB_CLASS_GTS, ///< Greenwich Time Signal
- MBG_USB_CLASS_GRC, ///< GNSS receivers (GPS, GLONASS, ... )
+ MBG_USB_CLASS_GNS, ///< GNSS receivers (GPS, GLONASS, ... )
MBG_USB_CLASS_N2X, ///< NTP/PTP receiver
MBG_USB_CLASS_PLACEHOLDER, // TODO formerly this was MBG_USB_CLASS_USYNC, used with USYNCPWR.
@@ -278,9 +281,10 @@ enum MBG_USB_CLASS_CODES
#define USB_DEV_GTS180 ( ( MBG_USB_CLASS_GTS << 8 ) | 0x01 )
-#define USB_DEV_GRC180 ( ( MBG_USB_CLASS_GRC << 8 ) | 0x01 )
-#define USB_DEV_GNS181 ( ( MBG_USB_CLASS_GRC << 8 ) | 0x02 )
-#define USB_DEV_GNS165 ( ( MBG_USB_CLASS_GRC << 8 ) | 0x03 )
+#define USB_DEV_GRC180 ( ( MBG_USB_CLASS_GNS << 8 ) | 0x01 )
+#define USB_DEV_GNS181 ( ( MBG_USB_CLASS_GNS << 8 ) | 0x02 )
+#define USB_DEV_GNS165 ( ( MBG_USB_CLASS_GNS << 8 ) | 0x03 )
+#define USB_DEV_GNM181 ( ( MBG_USB_CLASS_GNS << 8 ) | 0x04 )
#define USB_DEV_N2X180 ( ( MBG_USB_CLASS_N2X << 8 ) | 0x01 )
@@ -381,6 +385,7 @@ enum MBG_USB_CLASS_CODES
#define USB_DEV_NAME_GRC180 "GRC180"
#define USB_DEV_NAME_GNS181 "GNS181"
#define USB_DEV_NAME_GNS165 "GNS165"
+#define USB_DEV_NAME_GNM181 "GNM181"
#define USB_DEV_NAME_N2X180 "N2X180"
@@ -453,6 +458,7 @@ enum MBG_USB_CLASS_CODES
{ USB_DEV_BPE_STM, USB_DEV_NAME_BPE_STM }, \
{ USB_DEV_VSI180, USB_DEV_NAME_VSI180 }, \
{ USB_DEV_CPC200, USB_DEV_NAME_CPC200 }, \
+ { USB_DEV_GNM181, USB_DEV_NAME_GNM181 }, \
{ 0, /* end of table */ NULL } \
}
diff --git a/mbgshowsignal/mbgshowsignal.c b/mbgshowsignal/mbgshowsignal.c
index 5896dd2..eb02e9c 100644
--- a/mbgshowsignal/mbgshowsignal.c
+++ b/mbgshowsignal/mbgshowsignal.c
@@ -1,7 +1,7 @@
/**************************************************************************
*
- * $Id: mbgshowsignal.c 1.10 2018/11/15 12:12:36Z martin REL_M $
+ * $Id: mbgshowsignal.c 1.11 2019/03/19 16:43:51Z martin REL_M $
*
* Description:
* Main file for mbgshowsignal program which demonstrates how to
@@ -10,7 +10,9 @@
*
* -----------------------------------------------------------------------
* $Log: mbgshowsignal.c $
- * Revision 1.10 2018/11/15 12:12:36Z martin
+ * Revision 1.11 2019/03/19 16:43:51Z martin
+ * Support force reading status port even if device provides no modulation signal.
+ * Revision 1.10 2018/11/15 12:12:36 martin
* Individual MBG_MICRO_VERSION codes are now obsolete.
* Revision 1.9 2017/07/05 18:31:14 martin
* New way to maintain version information.
@@ -59,6 +61,8 @@
static const char *pname = "mbgshowsignal";
+static int force_read;
+
static /*HDR*/
@@ -118,20 +122,36 @@ int show_modulation( MBG_DEV_HANDLE dh )
static /*HDR*/
int do_mbgshowsignal( MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev )
{
+ int do_force_read = 0;
int rc = mbg_chk_dev_has_mod( dh );
if ( mbg_rc_is_error( rc ) )
{
- mbg_cond_err_msg_info( rc, "mbg_dev_has_mod",
- "support monitoring signal modulation" );
- return rc;
+ if ( ( rc != MBG_ERR_NOT_SUPP_BY_DEV ) || !force_read )
+ {
+ mbg_cond_err_msg_info( rc, "mbg_dev_has_mod",
+ "support monitoring signal modulation" );
+ return rc;
+ }
+ else
+ do_force_read = 1;
}
- printf( "\nMonitoring signal modulation:\n" );
+
+ printf( "\nMonitoring signal modulation" );
+
+ if ( do_force_read )
+ printf( " (forced)" );
+
+ printf( ":\n" );
for (;;)
- if ( mbg_rc_is_error( rc = show_modulation( dh ) ) )
+ {
+ rc = show_modulation( dh );
+
+ if ( mbg_rc_is_error( rc ) )
break;
+ }
return rc;
@@ -149,6 +169,7 @@ void usage( void )
"a slowly modulated input signal, e.g. the longwave signal from DCF77.\n"
);
mbg_print_help_options();
+ mbg_print_opt_info( "-F", "force reading status port even if signal not supported" );
mbg_print_device_options();
puts( "" );
@@ -164,10 +185,14 @@ int main( int argc, char *argv[] )
mbg_print_program_info( pname, MBG_FIRST_COPYRIGHT_YEAR, MBG_LAST_COPYRIGHT_YEAR );
// check command line parameters
- while ( ( c = getopt( argc, argv, "h?" ) ) != -1 )
+ while ( ( c = getopt( argc, argv, "Fh?" ) ) != -1 )
{
switch ( c )
{
+ case 'F':
+ force_read = 1;
+ break;
+
case 'h':
case '?':
default:
diff --git a/mbgstatus/mbgstatus.c b/mbgstatus/mbgstatus.c
index fdf1e07..6663a70 100644
--- a/mbgstatus/mbgstatus.c
+++ b/mbgstatus/mbgstatus.c
@@ -1,7 +1,7 @@
/**************************************************************************
*
- * $Id: mbgstatus.c 1.18 2019/02/08 11:08:47Z martin REL_M $
+ * $Id: mbgstatus.c 1.20 2019/04/02 15:15:45Z martin REL_M $
*
* Description:
* Main file for mbgstatus program which demonstrates how to
@@ -10,7 +10,12 @@
*
* -----------------------------------------------------------------------
* $Log: mbgstatus.c $
- * Revision 1.18 2019/02/08 11:08:47Z martin
+ * Revision 1.20 2019/04/02 15:15:45Z martin
+ * Also print raw GPS time in verbose mode.
+ * Removed obsolete debug code.
+ * Revision 1.19 2019/03/11 16:10:24 martin
+ * Als print memory mapped timestamp in verbose mode.
+ * Revision 1.18 2019/02/08 11:08:47 martin
* Also print EPLD name in verbose mode.
* Revision 1.17 2018/11/15 12:12:37 martin
* Individual MBG_MICRO_VERSION codes are now obsolete.
@@ -324,6 +329,22 @@ void show_time_and_status( MBG_DEV_HANDLE dh, const PCPS_DEV *pdev, const char *
printf( "%s", tail );
}
+ if ( ( verbose > 1 ) && _pcps_has_fast_hr_timestamp( pdev ) )
+ {
+ PCPS_TIME_STAMP ts;
+ char ws[80];
+
+ rc = mbg_get_fast_hr_timestamp( dh, &ts );
+
+ if ( mbg_cond_err_msg( rc, "mbg_get_fast_hr_timestamp" ) )
+ return;
+
+ mbg_snprint_hr_tstamp( ws, sizeof( ws ), &ts, 0, 0 );
+
+ printf( "Fast MM time: %s", ws );
+ printf( "%s", tail );
+ }
+
if ( ( verbose > 1 ) && _pcps_is_gps( pdev ) )
{
TTM ttm = { 0 };
@@ -341,6 +362,10 @@ void show_time_and_status( MBG_DEV_HANDLE dh, const PCPS_DEV *pdev, const char *
printf( "TTM time: %s", ws );
printf( ", TTM st: 0x%04X", ttm.tm.status );
printf( "%s", tail );
+
+ printf( "Raw GPS time: wn %u|%06lu.%07lu s", (unsigned) ttm.t.wn,
+ (ulong) ttm.t.sec, (ulong) ttm.t.tick );
+ printf( "%s", tail );
}
signal = t.signal - PCPS_SIG_BIAS;
@@ -601,7 +626,6 @@ void show_utc_info( MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev )
goto out;
}
-
t_ls_long = (long) utc.WNlsf * SECS_PER_WEEK
+ (long) utc.DNt * SECS_PER_DAY
+ GPS_SEC_BIAS - 1;
@@ -619,8 +643,6 @@ void show_utc_info( MBG_DEV_HANDLE dh, const PCPS_DEV *p_dev )
{
printf( "UTC correction parameters:\n" );
- //##++++++++++ utc.delta_tls = utc.delta_tlsf - 1;
-
printf( " CSUM: %04X, valid: %04X\n", utc.csum, utc.valid );
printf( " t0t: %u|%u.%07u, A0: %g A1: %g\n",
utc.t0t.wn, utc.t0t.sec, utc.t0t.tick,
diff --git a/mbgversion.h b/mbgversion.h
index 22fbec1..8f11d8e 100644
--- a/mbgversion.h
+++ b/mbgversion.h
@@ -1,7 +1,7 @@
/**************************************************************************
*
- * $Id: mbgversion.h 1.12 2019/02/08 10:18:07Z martin REL_M $
+ * $Id: mbgversion.h 1.14 2019/03/18 08:54:36Z martin REL_M $
*
* Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
*
@@ -10,7 +10,11 @@
*
* -----------------------------------------------------------------------
* $Log: mbgversion.h $
- * Revision 1.12 2019/02/08 10:18:07Z martin
+ * Revision 1.14 2019/03/18 08:54:36Z martin
+ * New version code 4.2.6.
+ * Revision 1.13 2019/03/11 16:05:00 martin
+ * New version code 4.2.4.
+ * Revision 1.12 2019/02/08 10:18:07 martin
* New version code 4.2.2.
* Changed current copyright year to 2019.
* Revision 1.11 2018/12/13 15:39:00 martin
@@ -51,7 +55,7 @@
#define MBG_MAJOR_VERSION_CODE 4
#define MBG_MINOR_VERSION_CODE 2
-#define MBG_MICRO_VERSION_CODE 2
+#define MBG_MICRO_VERSION_CODE 6
#if defined( MBG_TGT_WIN32 )
#define MBG_BUILD_VERSION_CODE 1