Commit 4a60739f authored by Adam Wujek's avatar Adam Wujek 💬

wrpc: update function wrpc_read_calibration_data to get rid of hexp_port_state

make wrpc to use the same structures as HAL even though wrpc doesn't use real
HAL. The idea is it remove hexp_port_state completely.

Additionally indentation was fixed.
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 12cf9874
...@@ -12,45 +12,45 @@ ...@@ -12,45 +12,45 @@
#include "wrpc.h" #include "wrpc.h"
#include "../proto-ext-whiterabbit/wr-constants.h" #include "../proto-ext-whiterabbit/wr-constants.h"
extern int32_t sfp_alpha;
int wrpc_read_calibration_data(struct pp_instance *ppi, int wrpc_read_calibration_data(struct pp_instance *ppi,
uint32_t *deltaTx, uint32_t *deltaRx, int32_t *fix_alpha, uint32_t *deltaTx, uint32_t *deltaRx, int32_t *fix_alpha,
int32_t *clock_period) int32_t *clock_period)
{ {
hexp_port_state_t state; struct hal_port_state state;
halexp_get_port_state(&state, ppi->iface_name); wrpc_get_port_state(&state, ppi->iface_name);
// check if the data is available /* check if the data is available */
if(state.valid) if (fix_alpha)
{ /* take local alpha instead of HAL */
*fix_alpha = sfp_alpha;
if(fix_alpha)
*fix_alpha = state.fiber_fix_alpha; if (clock_period)
*clock_period = state.clock_period;
if(clock_period)
*clock_period = state.clock_period; /* check if tx is calibrated,
* if so read data */
//check if tx is calibrated, if (state.calib.tx_calibrated) {
// if so read data if (deltaTx)
if(state.tx_calibrated) *deltaTx = state.calib.delta_tx_phy
{ + state.calib.sfp.delta_tx_ps
if(deltaTx) *deltaTx = state.delta_tx; + state.calib.delta_tx_board;
} } else
else return WR_HW_CALIB_NOT_FOUND;
return WR_HW_CALIB_NOT_FOUND;
/* check if rx is calibrated,
//check if rx is calibrated, * if so read data */
// if so read data if (state.calib.rx_calibrated) {
if(state.rx_calibrated) if (deltaRx)
{ *deltaRx = state.calib.delta_rx_phy
if(deltaRx) *deltaRx = state.delta_rx; + state.calib.sfp.delta_rx_ps
} + state.calib.delta_rx_board;
else } else
return WR_HW_CALIB_NOT_FOUND; return WR_HW_CALIB_NOT_FOUND;
}
return WR_HW_CALIB_OK;
return WR_HW_CALIB_OK;
} }
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <ppsi/ppsi.h> #include <ppsi/ppsi.h>
#include <hw/memlayout.h> #include <hw/memlayout.h>
#include <libwr/hal_shmem.h>
/* This part is exactly wrpc-sw::wrc_ptp.h */ /* This part is exactly wrpc-sw::wrc_ptp.h */
#define WRC_MODE_UNKNOWN 0 #define WRC_MODE_UNKNOWN 0
...@@ -60,5 +61,6 @@ int wrpc_calibration_pattern_enable(struct pp_instance *ppi, ...@@ -60,5 +61,6 @@ int wrpc_calibration_pattern_enable(struct pp_instance *ppi,
unsigned int calibrationPattern, unsigned int calibrationPattern,
unsigned int calibrationPatternLen); unsigned int calibrationPatternLen);
int wrpc_calibration_pattern_disable(struct pp_instance *ppi); int wrpc_calibration_pattern_disable(struct pp_instance *ppi);
int wrpc_get_port_state(struct hal_port_state *port, const char *port_name);
#endif /* __WRPC_H */ #endif /* __WRPC_H */
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