mbgtools-lx  4.2.8
chk_time_info.h File Reference
#include <mbgdevio.h>

Go to the source code of this file.

Data Structures

struct  CYCLES_FILTER_DATA
 A structure to keep filter data for cycles values. More...
 
struct  MBG_CHK_TIME_INFO
 A structure to store the results of the mbg_chk_time_info routine. More...
 

Macros

#define _ext   extern
 
#define MAX_CYCLES_FILTER_ENTRIES   32
 

Functions

int mbg_chk_time_info (MBG_DEV_HANDLE dh, MBG_CHK_TIME_INFO *p, CYCLES_FILTER_DATA *p_filter, int fast_ts_only)
 Read and evaluate a system timestamp / reference timestamp pair. More...
 
int snprint_chk_time_info (char *s, size_t max_len, const MBG_CHK_TIME_INFO *p, const PCPS_DEV *p_dev, int frac_digits, int print_raw)
 Print info from a MBG_CHK_TIME_INFO structure into a string buffer. More...
 

Macro Definition Documentation

◆ _ext

#define _ext   extern

Definition at line 40 of file chk_time_info.h.

◆ MAX_CYCLES_FILTER_ENTRIES

#define MAX_CYCLES_FILTER_ENTRIES   32

Definition at line 57 of file chk_time_info.h.

Referenced by do_filter().

Function Documentation

◆ mbg_chk_time_info()

int mbg_chk_time_info ( MBG_DEV_HANDLE  dh,
MBG_CHK_TIME_INFO p,
CYCLES_FILTER_DATA p_filter,
int  fast_ts_only 
)

Read and evaluate a system timestamp / reference timestamp pair.

The device timestamp is considered as reference timestamp.

Usually the fast_ts_only flag should be 0, in which case a PCPS_HR_TIME is read from the device in conjunction with the system timestamp.

If the fast_ts_only flag is not 0 then only a PCPS_TIME_STAMP instead of a PCPS_HR_TIME is read in conjunction with the system timestamp. In this case the call executes faster, but this is only supported if the device supports memory mapped timestamps (see chk_fast_tstamp_supp). Also, the returned data doesn't include the device status information in this case.

Once the device system timestamp / reference timestamp pair has been read successfully, the associated cycles values are evaluated to simplify further processing by the calling application.

Parameters
[in]dhValid MBG_DEV_HANDLE handle to a Meinberg device.
[out]pPointer to a POUT_SETTINGS_IDX structure to be written.
[in,out]p_filterOptional address of a CYCLES_FILTER_DATA instance associated with the device that is referenced by dh. If this parameter is not NULL then
[in]fast_ts_onlyA flag indicating that only a PCPS_TIME_STAMP instead of a PCPS_HR_TIME is to be read in conjunction with the system timestamp, usually 0.
Returns
MBG_SUCCESS on success, else one of the MBG_ERROR_CODES
See also
snprint_chk_time_info
mbg_get_time_info_hrt
mbg_get_time_info_tstamp

Definition at line 115 of file chk_time_info.c.

References MBG_SYS_TIME_CYCLES::cyc_after, MBG_SYS_TIME_CYCLES::cyc_before, cyc_freq, PCPS_HR_TIME_CYCLES::cycles, MBG_CHK_TIME_INFO::d_ref, MBG_CHK_TIME_INFO::d_ref_comp, MBG_CHK_TIME_INFO::d_sys, do_filter(), MBG_CHK_TIME_INFO::exec_cyc, MBG_CHK_TIME_INFO::exec_cyc_limit, MBG_CHK_TIME_INFO::exec_sec, MBG_CHK_TIME_INFO::exec_sec_limit, PCPS_TIME_STAMP::frac, MBG_CHK_TIME_INFO::hrti, MBG_CHK_TIME_INFO::ltcy_cyc, MBG_CHK_TIME_INFO::ltcy_sec, mbg_delta_pc_cycles(), MBG_FRAC32_UNITS_PER_SEC, mbg_get_time_info_hrt(), mbg_get_time_info_tstamp(), mbg_rc_is_error, MBG_SUCCESS, NANO_TIME_64::nano_secs, NSEC_PER_SEC, MBG_TIME_INFO_HRT::ref_hr_time_cycles, MBG_TIME_INFO_TSTAMP::ref_tstamp_cycles, PCPS_TIME_STAMP::sec, NANO_TIME_64::secs, setup_hr_time_cycles_from_timestamp_cycles(), MBG_SYS_TIME_CYCLES::sys_time, MBG_TIME_INFO_HRT::sys_time_cycles, MBG_TIME_INFO_TSTAMP::sys_time_cycles, PCPS_HR_TIME_CYCLES::t, and PCPS_HR_TIME::tstamp.

Referenced by do_mbgsvctasks().

◆ snprint_chk_time_info()

int snprint_chk_time_info ( char *  s,
size_t  max_len,
const MBG_CHK_TIME_INFO p,
const PCPS_DEV p_dev,
int  frac_digits,
int  print_raw 
)

Print info from a MBG_CHK_TIME_INFO structure into a string buffer.

Parameters
[out]sThe string buffer to be filled.
[in]max_lenSize of the output buffer for 0-terminated string.
[in]pPointer to a MBG_CHK_TIME_INFO to be evaluated.
[in]p_dev
[in]frac_digits
[in]print_raw
Returns
Length of the string in the buffer
See also
mbg_chk_time_info

Definition at line 206 of file chk_time_info.c.

References _int_from_size_t, _pcps_type_name, cyc_freq, MBG_CHK_TIME_INFO::d_ref, MBG_CHK_TIME_INFO::d_ref_comp, MBG_CHK_TIME_INFO::d_sys, MBG_CHK_TIME_INFO::exec_cyc, MBG_CHK_TIME_INFO::exec_cyc_limit, MBG_CHK_TIME_INFO::exec_sec, MBG_CHK_TIME_INFO::exec_sec_limit, MBG_CHK_TIME_INFO::hrti, MBG_CHK_TIME_INFO::ltcy_cyc, MBG_CHK_TIME_INFO::ltcy_sec, mbg_snprint_hr_tstamp(), MBG_TIME_INFO_HRT::ref_hr_time_cycles, snprintf_safe(), PCPS_HR_TIME_CYCLES::t, and PCPS_HR_TIME::tstamp.

Referenced by do_mbgsvctasks().