RA Flexible Software Package Documentation  Release v6.1.0

 
GPTP Interface

Detailed Description

Interface for gPTP timing.

Summary

The gPTP API provides a generic interface for gPTP timer operation.

Data Structures

struct  gptp_timer_value_t
 
struct  gptp_timer_cfg_t
 
struct  gptp_callback_args_t
 
struct  gptp_cfg_t
 
struct  gptp_api_t
 
struct  gptp_instance_t
 

Typedefs

typedef void gptp_ctrl_t
 

Data Structure Documentation

◆ gptp_timer_value_t

struct gptp_timer_value_t

Timer value.

Data Fields
uint16_t time_sec_upper Second(Upper 16 bit).
uint32_t time_sec_lower Second(Lower 32 bit).
uint32_t time_nsec Nanosecond.

◆ gptp_timer_cfg_t

struct gptp_timer_cfg_t

Configuration of gPTP timer.

Data Fields
uint8_t clock_period Timer increment value.

◆ gptp_callback_args_t

struct gptp_callback_args_t

GPTP callback arguments definitions.

Data Fields
void * p_context Placeholder for user data. Set in gptp_api_t::open function in gptp_cfg_t.

◆ gptp_cfg_t

struct gptp_cfg_t

Configuration parameters.

Data Fields

void(* p_callback )(gptp_callback_args_t *p_args)
 Pointer to callback function.
 
void * p_context
 Placeholder for user data. Passed to the user callback in gptp_callback_args_t.
 
void const * p_extend
 Placeholder for user extension.
 

◆ gptp_api_t

struct gptp_api_t

Functions implemented at the HAL layer will follow this API.

Data Fields

fsp_err_t(* open )(gptp_ctrl_t *const p_ctrl, gptp_cfg_t const *const p_cfg)
 
fsp_err_t(* close )(gptp_ctrl_t *const p_ctrl)
 
fsp_err_t(* timerCfg )(gptp_ctrl_t *const p_ctrl, uint8_t timer, gptp_timer_cfg_t const *const p_timer_cfg)
 
fsp_err_t(* start )(gptp_ctrl_t *const p_ctrl, uint8_t timer)
 
fsp_err_t(* stop )(gptp_ctrl_t *const p_ctrl, uint8_t timer)
 
fsp_err_t(* timerValueGet )(gptp_ctrl_t *const p_ctrl, uint8_t timer, gptp_timer_value_t *const p_timer_value)
 
fsp_err_t(* timerOffsetSet )(gptp_ctrl_t *const p_ctrl, uint8_t timer, int64_t offset)
 
fsp_err_t(* timerRateSet )(gptp_ctrl_t *const p_ctrl, uint8_t timer, uint32_t rate)
 
fsp_err_t(* callbackSet )(gptp_ctrl_t *const p_ctrl, void(*p_callback)(gptp_callback_args_t *), void *const p_context, gptp_callback_args_t *const p_callback_memory)
 

Field Documentation

◆ open

fsp_err_t(* gptp_api_t::open) (gptp_ctrl_t *const p_ctrl, gptp_cfg_t const *const p_cfg)

Open driver.

Parameters
[in]p_ctrlPointer to control structure.
[in]p_cfgPointer to pin configuration structure.

◆ close

fsp_err_t(* gptp_api_t::close) (gptp_ctrl_t *const p_ctrl)

Close driver.

Parameters
[in]p_ctrlPointer to control structure.

◆ timerCfg

fsp_err_t(* gptp_api_t::timerCfg) (gptp_ctrl_t *const p_ctrl, uint8_t timer, gptp_timer_cfg_t const *const p_timer_cfg)

Configure gptp timer parameters.

Parameters
[in]p_ctrlPointer to control structure.
[in]timerTimer index.
[in]p_timer_cfgConfiguration of the timer.

◆ start

fsp_err_t(* gptp_api_t::start) (gptp_ctrl_t *const p_ctrl, uint8_t timer)

Start gptp timer.

Parameters
[in]p_ctrlPointer to control structure.
[in]timerTimer index.

◆ stop

fsp_err_t(* gptp_api_t::stop) (gptp_ctrl_t *const p_ctrl, uint8_t timer)

Stop gptp timer.

Parameters
[in]p_ctrlPointer to control structure.
[in]timerTimer index.

◆ timerValueGet

fsp_err_t(* gptp_api_t::timerValueGet) (gptp_ctrl_t *const p_ctrl, uint8_t timer, gptp_timer_value_t *const p_timer_value)

Get the current time value to gptp timer.

Parameters
[in]p_ctrlPointer to control structure.
[in]timerTimer index.
[out]p_timer_valuePointer to timer value structure.

◆ timerOffsetSet

fsp_err_t(* gptp_api_t::timerOffsetSet) (gptp_ctrl_t *const p_ctrl, uint8_t timer, int64_t offset)

Set time offset correction to gptp timer.

Parameters
[in]p_ctrlPointer to control structure.
[in]timerTimer index.
[in]offsetTime offset value.

◆ timerRateSet

fsp_err_t(* gptp_api_t::timerRateSet) (gptp_ctrl_t *const p_ctrl, uint8_t timer, uint32_t rate)

Set clock rate correction to gptp timer.

Parameters
[in]p_ctrlPointer to control structure.
[in]timerTimer index.
[in]rateClock rate value.

◆ callbackSet

fsp_err_t(* gptp_api_t::callbackSet) (gptp_ctrl_t *const p_ctrl, void(*p_callback)(gptp_callback_args_t *), void *const p_context, gptp_callback_args_t *const p_callback_memory)

Specify callback function and optional context pointer and working memory pointer.

Parameters
[in]p_ctrlPointer to control structure.
[in]p_callbackCallback function.
[in]p_contextPointer to send to callback function.
[in]p_callback_memoryPointer to volatile memory where callback structure can be allocated. Callback arguments allocated here are only valid during the callback.

◆ gptp_instance_t

struct gptp_instance_t

This structure encompasses everything that is needed to use an instance of this interface.

Data Fields
gptp_ctrl_t * p_ctrl Pointer to the control structure for this instance.
gptp_cfg_t const * p_cfg Pointer to the configuration structure for this instance.
gptp_api_t const * p_api Pointer to the API structure for this instance.

Typedef Documentation

◆ gptp_ctrl_t

typedef void gptp_ctrl_t

Control block. Allocate an instance specific control block to pass into the API calls.