mbgtools-lx  4.2.8
mbgclock.h File Reference
#include <pcpsdrvr.h>

Go to the source code of this file.

Macros

#define _ext   extern
 

Typedefs

typedef int(* MBGCLOCK_DEFAULT_GET_FAST_HR_TIMESTAMP_FNC) (PCPS_TIME_STAMP *p_ts)
 
typedef int(* MBGCLOCK_DEFAULT_GET_FAST_HR_TIMESTAMP_CYCLES_FNC) (PCPS_TIME_STAMP_CYCLES *p_ts_cyc)
 
typedef int(* MBGCLOCK_DEFAULT_CLR_UCAP_BUFF_FNC) (void)
 
typedef int(* MBGCLOCK_DEFAULT_GET_UCAP_ENTRIES_FNC) (PCPS_UCAP_ENTRIES *p)
 
typedef int(* MBGCLOCK_DEFAULT_GET_UCAP_EVENT_FNC) (PCPS_HR_TIME *p)
 

Functions

int mbgclock_default_get_fast_hr_timestamp (PCPS_TIME_STAMP *p_ts)
 Read a high resolution PCPS_TIME_STAMP structure via memory mapped access. More...
 
int mbgclock_default_get_fast_hr_timestamp_cycles (PCPS_TIME_STAMP_CYCLES *p_ts_cyc)
 Read a high resolution PCPS_TIME_STAMP_CYCLES structure via memory mapped access. More...
 
int mbgclock_default_clr_ucap_buff (void)
 Clear the on-board user capture FIFO buffer. More...
 
int mbgclock_default_get_ucap_entries (PCPS_UCAP_ENTRIES *p)
 Read user capture FIFO information. More...
 
int mbgclock_default_get_ucap_event (PCPS_HR_TIME *p)
 Retrieve single time capture event. More...
 

Macro Definition Documentation

◆ _ext

#define _ext   extern

Definition at line 113 of file mbgclock.h.

Typedef Documentation

◆ MBGCLOCK_DEFAULT_CLR_UCAP_BUFF_FNC

typedef int(* MBGCLOCK_DEFAULT_CLR_UCAP_BUFF_FNC) (void)

Definition at line 131 of file mbgclock.h.

◆ MBGCLOCK_DEFAULT_GET_FAST_HR_TIMESTAMP_CYCLES_FNC

typedef int(* MBGCLOCK_DEFAULT_GET_FAST_HR_TIMESTAMP_CYCLES_FNC) (PCPS_TIME_STAMP_CYCLES *p_ts_cyc)

Definition at line 129 of file mbgclock.h.

◆ MBGCLOCK_DEFAULT_GET_FAST_HR_TIMESTAMP_FNC

typedef int(* MBGCLOCK_DEFAULT_GET_FAST_HR_TIMESTAMP_FNC) (PCPS_TIME_STAMP *p_ts)

Definition at line 128 of file mbgclock.h.

◆ MBGCLOCK_DEFAULT_GET_UCAP_ENTRIES_FNC

typedef int(* MBGCLOCK_DEFAULT_GET_UCAP_ENTRIES_FNC) (PCPS_UCAP_ENTRIES *p)

Definition at line 132 of file mbgclock.h.

◆ MBGCLOCK_DEFAULT_GET_UCAP_EVENT_FNC

typedef int(* MBGCLOCK_DEFAULT_GET_UCAP_EVENT_FNC) (PCPS_HR_TIME *p)

Definition at line 133 of file mbgclock.h.

Function Documentation

◆ mbgclock_default_clr_ucap_buff()

int mbgclock_default_clr_ucap_buff ( void  )

Clear the on-board user capture FIFO buffer.

Clear the user capture FIFO buffer on the first device registered by the driver which supports this call.

Returns
MBG_SUCCESS on success, or MBG_ERR_NOT_SUPP_BY_DEV if no device supports this call, or MBG_ERR_IRQ_UNSAFE called on a device where such calls are unsafe if IRQs are enabled.
See also
mbgclock_default_get_ucap_entries()
mbgclock_default_get_ucap_event()

This function can be called from other kernel drivers to clear the user capture FIFO buffer on the first device registered by the driver which supports this call.

Returns
MBG_SUCCESS on success, or MBG_ERR_NOT_SUPP_BY_DEV if no device supports this call, or MBG_ERR_IRQ_UNSAFE if called on a device where such calls are unsafe if IRQs are enabled.
See also
mbgclock_default_get_ucap_entries
mbgclock_default_get_ucap_event

Definition at line 2781 of file mbgclock_main.c.

References _mbgddmsg_fnc_entry, _mbgddmsg_fnc_exit, _mbgddmsg_fnc_exit_err_dec, _pcps_sem_dec, _pcps_sem_inc_safe, _pcps_write_byte, EXPORT_SYMBOL(), MBG_ERR_IRQ_UNSAFE, MBG_ERR_NOT_SUPP_BY_DEV, and PCPS_CLR_UCAP_BUFF.

◆ mbgclock_default_get_fast_hr_timestamp()

int mbgclock_default_get_fast_hr_timestamp ( PCPS_TIME_STAMP p_ts)

Read a high resolution PCPS_TIME_STAMP structure via memory mapped access.

Read a high resolution PCPS_TIME_STAMP structure via memory mapped access. This function can be called from other kernel drivers and reads the timestamp from the first device registered by the driver which supports this call.

Parameters
*p_tsPointer to a PCPS_TIME_STAMP structure to be filled up
Returns
MBG_SUCCESS on success, or MBG_ERR_NOT_SUPP_BY_DEV if no device supports this call.
See also
mbgclock_default_get_fast_hr_timestamp_cycles()

This function can be called from other kernel drivers to read a timestamp of the current time from the first device registered by the driver which supports this call.

Parameters
*p_tsPointer to a PCPS_TIME_STAMP structure to be filled up
Returns
MBG_SUCCESS on success, or MBG_ERR_NOT_SUPP_BY_DEV if no device supports this call
See also
mbgclock_default_get_fast_hr_timestamp_cycles

Definition at line 2708 of file mbgclock_main.c.

References _mbg_swab_pcps_time_stamp, _mbgddmsg_fnc_entry, _mbgddmsg_fnc_exit, do_get_fast_hr_timestamp_safe(), EXPORT_SYMBOL(), MBG_ERR_NOT_SUPP_BY_DEV, and MBG_SUCCESS.

◆ mbgclock_default_get_fast_hr_timestamp_cycles()

int mbgclock_default_get_fast_hr_timestamp_cycles ( PCPS_TIME_STAMP_CYCLES p_ts_cyc)

Read a high resolution PCPS_TIME_STAMP_CYCLES structure via memory mapped access.

Read a high resolution PCPS_TIME_STAMP_CYCLES structure via memory mapped access. This function can be called from other kernel drivers and reads the timestamp from the first device registered by the driver which supports this call, plus an associated cycles counter which can be used to determine the latency.

Parameters
*p_ts_cycPointer to a PCPS_TIME_STAMP_CYCLES structure to be filled up
Returns
MBG_SUCCESS on success, or MBG_ERR_NOT_SUPP_BY_DEV if no device supports this call.
See also
mbgclock_default_get_fast_hr_timestamp()

This function can be called from other kernel drivers to read a timestamp of the current time from the first device registered by the driver which supports this call. The returned structure also contains an associated cycles counter value which can be used to determine the latency.

Parameters
*p_ts_cycPointer to a PCPS_TIME_STAMP_CYCLES structure to be filled up
Returns
MBG_SUCCESS on success, or:: MBG_ERR_NOT_SUPP_BY_DEV if no device supports this call
See also
mbgclock_default_get_fast_hr_timestamp

Definition at line 2745 of file mbgclock_main.c.

References _mbg_swab_pcps_time_stamp_cycles, _mbgddmsg_fnc_entry, _mbgddmsg_fnc_exit, do_get_fast_hr_timestamp_cycles_safe(), EXPORT_SYMBOL(), MBG_ERR_NOT_SUPP_BY_DEV, and MBG_SUCCESS.

◆ mbgclock_default_get_ucap_entries()

int mbgclock_default_get_ucap_entries ( PCPS_UCAP_ENTRIES p)

Read user capture FIFO information.

Read a PCPS_UCAP_ENTRIES structure to retrieve the number of saved user capture events and the maximum capture buffer sizefrom the first device registered by the driver which supports this call.

Returns
MBG_SUCCESS on success, or MBG_ERR_NOT_SUPP_BY_DEV if no device supports this call, or MBG_ERR_IRQ_UNSAFE called on a device where such calls are unsafe if IRQs are enabled.
See also
mbgclock_default_clr_ucap_buff()
mbgclock_default_get_ucap_event()

Read a PCPS_UCAP_ENTRIES structure to retrieve the number of saved user capture events and the maximum capture buffer size from the first device registered by the driver which supports this call.

Returns
MBG_SUCCESS on success, or MBG_ERR_NOT_SUPP_BY_DEV if no device supports this call, or MBG_ERR_IRQ_UNSAFE if called on a device where such calls are unsafe if IRQs are enabled.
See also
mbgclock_default_clr_ucap_buff
mbgclock_default_get_ucap_event

Definition at line 2823 of file mbgclock_main.c.

References _mbg_swab_pcps_ucap_entries, _mbgddmsg_4, _mbgddmsg_fnc_entry, _mbgddmsg_fnc_exit_err_dec, _pcps_read_var, _pcps_sem_dec, _pcps_sem_inc_safe, EXPORT_SYMBOL(), PCPS_UCAP_ENTRIES::max, MBG_ERR_IRQ_UNSAFE, MBG_ERR_NOT_SUPP_BY_DEV, MBG_LOG_FMT_LEAVING, MBG_LOG_INFO, PCPS_GIVE_UCAP_ENTRIES, and PCPS_UCAP_ENTRIES::used.

◆ mbgclock_default_get_ucap_event()

int mbgclock_default_get_ucap_event ( PCPS_HR_TIME p)

Retrieve single time capture event.

Retrieve a single time capture event from the on-board FIFO buffer of the first device registered by the driver which supports this call. The captured event time is returned in a PCPS_HR_TIME structure. The oldest entry of the FIFO is retrieved and then removed from the FIFO. If no capture event is available in the FIFO buffer then both the seconds and the fractions of the returned timestamp are 0.

Returns
MBG_SUCCESS on success, or MBG_ERR_NOT_SUPP_BY_DEV if no device supports this call, or MBG_ERR_IRQ_UNSAFE called on a device where such calls are unsafe if IRQs are enabled.
See also
mbgclock_default_clr_ucap_buff()
mbgclock_default_get_ucap_entries()

Retrieve a single time capture event from the on-board FIFO buffer of the first device registered by the driver which supports this call. The captured event time is returned in a PCPS_HR_TIME structure. The oldest entry of the FIFO is retrieved and then removed from the FIFO. If no capture event is available in the FIFO buffer then both the seconds and the fractions of the returned timestamp are 0.

Returns
MBG_SUCCESS on success, or MBG_ERR_NOT_SUPP_BY_DEV if no device supports this call, or MBG_ERR_IRQ_UNSAFE called on a device where such calls are unsafe if IRQs are enabled.
See also
mbgclock_default_clr_ucap_buff
mbgclock_default_get_ucap_entries

Definition at line 2871 of file mbgclock_main.c.

References _mbg_swab_pcps_hr_time, _mbgddmsg_4, _mbgddmsg_fnc_entry, _mbgddmsg_fnc_exit_err_dec, _pcps_read_var, _pcps_sem_dec, _pcps_sem_inc_safe, EXPORT_SYMBOL(), PCPS_TIME_STAMP::frac, MBG_ERR_IRQ_UNSAFE, MBG_ERR_NOT_SUPP_BY_DEV, MBG_LOG_FMT_LEAVING, MBG_LOG_INFO, PCPS_GIVE_UCAP_EVENT, PCPS_TIME_STAMP::sec, and PCPS_HR_TIME::tstamp.