Commit ff30407f authored by Cesar Prados's avatar Cesar Prados Committed by Alessandro Rubini

pdelay/pp-inst: add definition for PDelay Synch mechanism,

functions for set/get the mechanism.
Signed-off-by: Cesar Prados's avatarC.Prados <c.prados@gsi.de>
parent 73e73cae
......@@ -26,6 +26,7 @@
extern int32_t cal_phase_transition;
int ptp_mode = WRC_MODE_UNKNOWN;
int ptp_sync_mech = WRC_E2E;
static int ptp_enabled = 0;
static struct wr_operations wrpc_wr_operations = {
......@@ -94,6 +95,7 @@ static struct pp_globals ppg_static = {
.parentDS = &parentDS,
.timePropertiesDS = &timePropertiesDS,
.global_ext_data = &servo_state,
.delay_mech = WRC_E2E,
};
int wrc_ptp_init()
......@@ -188,6 +190,22 @@ int wrc_ptp_get_mode()
return ptp_mode;
}
void wrc_ptp_set_sync_mech(int mech)
{
struct pp_instance *ppi = &ppi_static;
struct pp_globals *ppg = ppi->glbs;
wrc_ptp_stop();
ppg->delay_mech = mech;
ptp_sync_mech = mech;
}
int wrc_ptp_get_sync_mech()
{
return ptp_sync_mech;
}
int wrc_ptp_start()
{
struct pp_instance *ppi = &ppi_static;
......
......@@ -18,11 +18,19 @@
#define WRC_MODE_GM 1
#define WRC_MODE_MASTER 2
#define WRC_MODE_SLAVE 3
#define WRC_MODE_PCLOCK 4
#define WRC_E2E 0
#define WRC_P2P 1
extern int ptp_mode;
extern int ptp_sync_mech;
int wrc_ptp_init(void);
int wrc_ptp_set_mode(int mode);
int wrc_ptp_get_mode(void);
void wrc_ptp_set_sync_mech(int mech);
int wrc_ptp_get_sync_mech(void);
int wrc_ptp_start(void);
int wrc_ptp_stop(void);
int wrc_ptp_update(void);
......
......@@ -115,6 +115,7 @@ struct pp_instance_cfg {
char port_name[16];
char iface_name[16];
int ext; /* 0: none, 1: whiterabbit */ /* FIXME extension enumeration */
int delay_mech; /* E2E: 0, P2P: 1 */
};
/*
......@@ -211,6 +212,9 @@ struct pp_globals {
DSParent *parentDS; /* page 68 */
DSTimeProperties *timePropertiesDS; /* page 70 */
/* Sync Mechanism */
int delay_mech; /* E2E : 0 , P2P : 1 */
/* Index of the pp_instance receiving the "Ebest" clock */
int ebest_idx;
int ebest_updated; /* set to 1 when ebest_idx changes */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment