Commit b16d3628 authored by Tristan Gingold's avatar Tristan Gingold

wrpc-calibration.c: directly read calibration values

parent f201fe81
......@@ -13,6 +13,9 @@
#include "../proto-ext-whiterabbit/wr-constants.h"
#include "board.h"
#include "sfp.h"
#include "dev/endpoint.h"
int32_t wrpc_get_clock_period(void)
{
return REF_CLOCK_PERIOD_PS;
......@@ -24,21 +27,17 @@ int wrpc_read_calibration_data(struct pp_instance *ppi,
TimeInterval *scaledSfpDeltaTx,
TimeInterval *scaledSfpDeltaRx)
{
struct wrc_port_state state;
wrpc_get_port_state(&state);
*scaledDelayCoefficient = (RelativeDifference) state.calib.alpha;
*scaledDelayCoefficient = (RelativeDifference)sfp_info.sfp_params.alpha;
*scaledBitSlide = picos_to_interval((int64_t)state.calib.bitslide_ps);
*scaledBitSlide = picos_to_interval(ep_get_bitslide(&wrc_endpoint_dev));
/* check if tx is calibrated,
* if so read data */
*scaledSfpDeltaTx = picos_to_interval(state.calib.delta_tx_ps);
*scaledSfpDeltaTx = picos_to_interval(sfp_info.sfp_params.dTx);
/* check if rx is calibrated,
* if so read data */
*scaledSfpDeltaRx = picos_to_interval(state.calib.delta_rx_ps);
*scaledSfpDeltaRx = picos_to_interval(sfp_info.sfp_params.dRx);
return WRH_HW_CALIB_OK;
}
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