summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Burnicki <martin.burnicki@meinberg.de>2014-07-10 12:00:00 +0200
committerMartin Burnicki <martin.burnicki@meinberg.de>2014-07-10 12:00:00 +0200
commitf6c51fd5c56b3e0247792573ea3335f7e00675a9 (patch)
treea77d390e39bfc584db4a217d9392ed2862c9f8cd
parent00bbb622f7a0f4e9c4ca97abbec75544b0f23ecf (diff)
downloadmbgsdk-win-f6c51fd5c56b3e0247792573ea3335f7e00675a9.tar.gz
mbgsdk-win-f6c51fd5c56b3e0247792573ea3335f7e00675a9.zip
Support new mbgsvcio function mbg_get_time_adjustment_err_info()
The function reads some error status information from the Meinberg time adjustment service. Requires mbgsvcio.dll v3.6.9.14 (from 2014-07-10) or newer.
-rw-r--r--c/mbglib/include/mbgsvcio.h138
-rw-r--r--c/mbglib/lib/bc/mbgsvcio.libbin2560 -> 2560 bytes
-rw-r--r--c/mbglib/lib/msc/mbgsvcio.libbin7148 -> 7736 bytes
3 files changed, 70 insertions, 68 deletions
diff --git a/c/mbglib/include/mbgsvcio.h b/c/mbglib/include/mbgsvcio.h
index 95e94a5..f97b9b5 100644
--- a/c/mbglib/include/mbgsvcio.h
+++ b/c/mbglib/include/mbgsvcio.h
@@ -1,7 +1,7 @@
/**************************************************************************
*
- * $Id: mbgsvcio.h 1.16.1.2 2010/01/08 15:04:38Z martin TRASH $
+ * $Id: mbgsvcio.h 1.17 2014/07/10 15:03:14Z martin TEST $
*
* Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
*
@@ -10,8 +10,9 @@
*
* -----------------------------------------------------------------------
* $Log: mbgsvcio.h $
- * Revision 1.16.1.2 2010/01/08 15:04:38Z martin
- * Revision 1.16.1.1 2010/01/07 16:24:56Z martin
+ * Revision 1.17 2014/07/10 15:03:14Z martin
+ * Moved some definitions here.
+ * Updated function prototypes.
* Revision 1.16 2009/08/14 09:28:13Z daniel
* New version code 306, compatibility version code still 200.
* Revision 1.15 2009/06/09 08:57:47Z daniel
@@ -55,8 +56,8 @@
/* Other headers to be included */
#include <mbg_tgt.h>
-#include <mbgdevio.h> // for mutex support only
-#include <timecnv.h> // for REF_TIME only
+#include <words.h>
+#include <pcpsdefs.h>
@@ -78,11 +79,67 @@
#define MBGSVCIO_COMPAT_VERSION 0x0200
-
#ifdef __cplusplus
extern "C" {
#endif
+/**
+ * @brief A union used to access a FILETIME as 64 bit number
+ *
+ * @note using this union may be tricky. Even though no problems
+ * have been observed, yet, the MS docs clearly say there may be
+ * alignment problems under 64 bit Windows.
+ * If the FILETIME members are not 32 bit aligned then accessing
+ * the dwl member will yield wrong values.
+ */
+typedef union
+{
+ FILETIME ft; ///< FILETIME structure as provided by the Windows API
+ uint64_t dwl; ///< used to access as single 64 bit number
+
+} FT_DWL;
+
+
+
+/**
+ * @brief A timestamp in Windows format, plus %UTC offset and clock status
+ */
+typedef struct
+{
+ FT_DWL ftdwl; ///< time stamp, based on %UTC
+ int32_t utc_offs; ///< %UTC offset in [sec]
+ PCPS_TIME_STATUS_X status; ///< extended status, see ::PCPS_TIME_STATUS_X
+
+} REF_TIME;
+
+
+
+/**
+ * @brief Error information retrieved from the time adjustment service
+ */
+typedef struct
+{
+ uint32_t code; ///< error/status code, see ::ERR_INFO_CODES
+ REF_TIME time; ///< clock's time and status when ::code was updated
+
+} ERR_INFO;
+
+
+/**
+ * @brief Codes used with ::ERR_INFO::code
+ */
+enum ERR_INFO_CODES
+{
+ MBG_SVC_NO_ERROR, ///< No current error condition
+ MBG_SVC_ERR_OPEN_CLOCK_DEV, ///< Failed to open clock device
+ MBG_SVC_ERR_OPEN_SERIAL_PORT, ///< Failed to open serial port
+ MBG_SVC_ERR_SAME_REF_TIME, ///< Clock device always returns same time (hardware failure)
+ MBG_SVC_ERR_REF_TIME_STEP, ///< Time on the clock device has jumped, service stopped disciplining system time
+ N_MBG_SVC_ERR_CODE ///< the number of known codes
+};
+
+
+
/* ----- function prototypes begin ----- */
/* This section was generated automatically */
@@ -122,6 +179,13 @@ extern "C" {
_MBG_API_ATTR int _MBG_API mbg_time_adjustment_active( void ) ;
/**
+ Read the ::ERROR_INFO structure from the Meinberg time adjustment service "mbgadjtm.exe"
+
+ @return 0 on success, < 0 on error
+*/
+ _MBG_API_ATTR int _MBG_API mbg_get_time_adjustment_err_info( ERR_INFO *p ) ;
+
+ /**
Check if the time of the reference clock is accessible.
@return 1: The reference clock is accessible and delivers a valid time.<br>
@@ -154,68 +218,6 @@ extern "C" {
*/
_MBG_API_ATTR int _MBG_API mbg_get_ref_time_status( void ) ;
- /**
- Save the latest date and time from a serial time string
- plus the associated PC cycles count, so other processes
- or functions can use the current cycles count together
- with this data pair to interpolate the time between two
- time strings.
-
- This function is (and should only be) called by the time
- adjustment service.
-
- @return MBG_SUCCESS always
-*/
- _MBG_API_ATTR int _MBG_API mbg_set_serial_xhrt_data( const REF_TIME_CYCLES *p ) ;
-
- /**
- Set the "invalid time" flag (PCPS_INVT) in the status of the
- saved serial date and time. This is normally done by time
- adjustment service if the serial string times out, e.g. because
- the serial device has been disconnected.
-
- @return MBG_SUCCESS always
-*/
- _MBG_API_ATTR int _MBG_API mbg_set_serial_xhrt_data_invalid( void ) ;
-
- /**
- Retrieve the latest date and time from a serial time string
- plus the associated PC cycles count, so this data pair can
- be used to interpolate the time between two serial strings
- using the current cycles count.
-
- @return MBG_SUCCESS always
-*/
- _MBG_API_ATTR int _MBG_API mbg_get_serial_xhrt_data( uint64_t *tstamp, MBG_XHRT_VARS *vars ) ;
-
- /**
- Retrieve a time stamp in PCPS_HR_TIME format which is extrapolated
- using the system's current cycles counter value and a time stamp
- plus associated cycles counter value from a serial time string,
- saved by the time adjustment service.
-
- @param *p_hrt Pointer to a ::PCPS_HR_TIME structure to be filled up.
-
- @return MBG_SUCCESS
-
- @see mbg_get_serial_xhrt_time_as_filetime()
- */
- _MBG_API_ATTR int _MBG_API mbg_get_serial_xhrt_time_as_pcps_hr_time( PCPS_HR_TIME *p_hrt ) ;
-
- /**
- Retrieve a time stamp in FILETIME format which is extrapolated
- using the system's current cycles counter value and a time stamp
- plus associated cycles counter value from a serial time string,
- saved by the time adjustment service.
-
- @param *p_ft Pointer to a ::FILETIME structure to be filled up.
-
- @return MBG_SUCCESS
-
- @see mbg_get_serial_xhrt_time_as_pcps_hr_time()
- */
- _MBG_API_ATTR int _MBG_API mbg_get_serial_xhrt_time_as_filetime( FILETIME *p_ft ) ;
-
/* ----- function prototypes end ----- */
diff --git a/c/mbglib/lib/bc/mbgsvcio.lib b/c/mbglib/lib/bc/mbgsvcio.lib
index 86b966f..33ac0fa 100644
--- a/c/mbglib/lib/bc/mbgsvcio.lib
+++ b/c/mbglib/lib/bc/mbgsvcio.lib
Binary files differ
diff --git a/c/mbglib/lib/msc/mbgsvcio.lib b/c/mbglib/lib/msc/mbgsvcio.lib
index c4987be..e49df2b 100644
--- a/c/mbglib/lib/msc/mbgsvcio.lib
+++ b/c/mbglib/lib/msc/mbgsvcio.lib
Binary files differ