mbgtools-lx
4.2.8
|
Functions | |
_MBG_API_ATTR int _MBG_API | mbg_get_hr_time (MBG_DEV_HANDLE dh, PCPS_HR_TIME *p) |
Read the card's current time with high resolution, including status. More... | |
_MBG_API_ATTR int _MBG_API | mbg_get_hr_time_cycles (MBG_DEV_HANDLE dh, PCPS_HR_TIME_CYCLES *p) |
Read the current high resolution time plus the associated PC cycles from a device. More... | |
_MBG_API_ATTR int _MBG_API | mbg_get_hr_time_comp (MBG_DEV_HANDLE dh, PCPS_HR_TIME *p, int32_t *hns_latency) |
Read the current high resolution time, and compensate the call's latency. More... | |
These functions return a high resolution time, including status flags and local time offset according to the time zone configuration on the device.
The API call mbg_chk_dev_has_hr_time checks if these functions are supported by a device.
Due to the extended information returned to the caller these function require interaction with the on-board microcontroller, and thus take longer to execute than the Fast API functions reading high resolution timestamps, but no status.
Note: These API calls provides better accuracy and higher resolution than the the standard functions in Legacy API functions to read the time.
The mbg_get_hr_time function doesn't account for the latency which is introduced when accessing the board.
The mbg_get_hr_time_cycles and mbg_get_hr_time_comp calls provide ways to account for and/or compensate the latency.
int mbg_get_hr_time | ( | MBG_DEV_HANDLE | dh, |
PCPS_HR_TIME * | p | ||
) |
Read the card's current time with high resolution, including status.
Fills up a PCPS_HR_TIME (High Resolution time) structure containing the current UTC time (seconds since 1970), UTC offset, and status.
The API call mbg_chk_dev_has_hr_time checks whether this call is supported by a device.
For details see API functions reading high resolution time, plus status
[in] | dh | Valid MBG_DEV_HANDLE handle to a Meinberg device. |
[out] | p | Pointer to a PCPS_HR_TIME structure to be filled up |
Definition at line 4625 of file mbgdevio.c.
References _mbg_swab_pcps_hr_time, _mbgdevio_cnv_ret_val, _mbgdevio_read_var_chk, _pcps_ddev_has_hr_time, IOCTL_GET_PCPS_HR_TIME, MBGDEVIO_RET_VAL, and PCPS_GIVE_HR_TIME.
Referenced by do_set_system_time_from_pcps_hr_time(), show_hr_timestamp(), show_hr_timestamp_burst(), and show_time_and_status().
int mbg_get_hr_time_comp | ( | MBG_DEV_HANDLE | dh, |
PCPS_HR_TIME * | p, | ||
int32_t * | hns_latency | ||
) |
Read the current high resolution time, and compensate the call's latency.
Read a PCPS_HR_TIME structure plus cycles counter value, and correct the time stamp for the latency of the call as described for mbg_get_hr_time_cycles, then return the compensated time stamp, and optionally the latency.
The API call mbg_chk_dev_has_hr_time checks whether this call is supported by the device.
For details see API functions reading high resolution time, plus status
The cycles counter value corresponds to a value returned by QueryPerformanceCounter() under Windows, and get_cycles() under Linux. On operating systems or targets which don't provide a cycles counter the returned cycles value is always 0.
Applications should first pick up their own cycles counter value and then call this function. The difference of the cycles counter values corresponds to the latency of the call in units of the cycles counter clock frequency, e.g as reported by QueryPerformanceFrequency() under Windows.
[in] | dh | Valid MBG_DEV_HANDLE handle to a Meinberg device. |
[out] | p | Pointer to a PCPS_HR_TIME structure to be filled up |
[out] | hns_latency | Optional pointer to an int32_t value to return the latency in 100ns units, or NULL, if not used. |
Definition at line 6739 of file mbgdevio.c.
References PCPS_HR_TIME_CYCLES::cycles, mbg_comp_hr_latency(), mbg_get_hr_time_cycles(), mbg_get_pc_cycles(), mbg_init_pc_cycles_frequency(), mbg_rc_is_success, pc_cycles_frequency, PCPS_HR_TIME_CYCLES::t, and PCPS_HR_TIME::tstamp.
Referenced by show_hr_timestamp(), and show_hr_timestamp_burst().
int mbg_get_hr_time_cycles | ( | MBG_DEV_HANDLE | dh, |
PCPS_HR_TIME_CYCLES * | p | ||
) |
Read the current high resolution time plus the associated PC cycles from a device.
The returned PCPS_HR_TIME_CYCLES structure contains a PCPS_HR_TIME structure and a PC cycles counter value which can be used to compensate the latency of the call, i.e. the program execution time until the time stamp has actually been read from the board.
The API call mbg_chk_dev_has_hr_time checks whether this call is supported by the device.
For details see API functions reading high resolution time, plus status
The cycles counter value corresponds to a value returned by QueryPerformanceCounter() under Windows, and get_cycles() under Linux. On operating systems or targets which don't provide a cycles counter the returned cycles value is always 0.
Applications should first pick up their own cycles counter value and then call this function. The difference of the cycles counter values corresponds to the latency of the call in units of the cycles counter clock frequency, e.g as reported by QueryPerformanceFrequency() under Windows.
[in] | dh | Valid MBG_DEV_HANDLE handle to a Meinberg device. |
[out] | p | Pointer to a PCPS_HR_TIME_CYCLES structure to be filled up |
Definition at line 6682 of file mbgdevio.c.
References _mbg_swab_pcps_hr_time_cycles, _mbgdevio_cnv_ret_val, _mbgdevio_read_var_chk, _pcps_ddev_has_hr_time, PCPS_HR_TIME_CYCLES::cycles, IOCTL_GET_PCPS_HR_TIME_CYCLES, MBGDEVIO_RET_VAL, and PCPS_GIVE_HR_TIME.
Referenced by get_htc_timestamps(), mbg_get_default_cycles_frequency_from_dev(), mbg_get_hr_time_comp(), and mbg_set_current_process_affinity_to_cpu().