Skip to content
Snippets Groups Projects
Commit 76a225d3 authored by Grzegorz Daniluk's avatar Grzegorz Daniluk
Browse files

fix t24p, we used default value and not the one returned from calib procedure

parent 3bc91804
Branches
Tags
No related merge requests found
...@@ -225,13 +225,17 @@ int8_t eeprom_match_sfp(uint8_t i2cif, uint8_t i2c_addr, struct s_sfpinfo * sfp) ...@@ -225,13 +225,17 @@ int8_t eeprom_match_sfp(uint8_t i2cif, uint8_t i2c_addr, struct s_sfpinfo * sfp)
int8_t eeprom_phtrans(uint8_t i2cif, uint8_t i2c_addr, uint32_t * val, int8_t eeprom_phtrans(uint8_t i2cif, uint8_t i2c_addr, uint32_t * val,
uint8_t write) uint8_t write)
{ {
int8_t ret;
if (write) { if (write) {
*val |= (1 << 31); *val |= (1 << 31);
if (eeprom_write(i2cif, i2c_addr, EE_BASE_CAL, (uint8_t *) val, if (eeprom_write(i2cif, i2c_addr, EE_BASE_CAL, (uint8_t *) val,
sizeof(*val)) != sizeof(*val)) sizeof(*val)) != sizeof(*val))
return EE_RET_I2CERR; ret = EE_RET_I2CERR;
else else
return 1; ret = 1;
*val &= 0x7fffffff; //return ph_trans value without validity bit
return ret;
} else { } else {
if (eeprom_read(i2cif, i2c_addr, EE_BASE_CAL, (uint8_t *) val, if (eeprom_read(i2cif, i2c_addr, EE_BASE_CAL, (uint8_t *) val,
sizeof(*val)) != sizeof(*val)) sizeof(*val)) != sizeof(*val))
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "softpll_ng.h" #include "softpll_ng.h"
#include "wrc_ptp.h" #include "wrc_ptp.h"
#include "eeprom.h" #include "eeprom.h"
#include "ptpd_netif.h"
/* New calibrator for the transition phase value. A major pain in the ass for /* New calibrator for the transition phase value. A major pain in the ass for
the folks who frequently rebuild their gatewares. The idea is described the folks who frequently rebuild their gatewares. The idea is described
...@@ -235,8 +236,14 @@ static int calib_t24p_master(uint32_t *value) ...@@ -235,8 +236,14 @@ static int calib_t24p_master(uint32_t *value)
int calib_t24p(int mode, uint32_t *value) int calib_t24p(int mode, uint32_t *value)
{ {
int ret;
if (mode == WRC_MODE_SLAVE) if (mode == WRC_MODE_SLAVE)
return calib_t24p_slave(value); ret = calib_t24p_slave(value);
else else
return calib_t24p_master(value); ret = calib_t24p_master(value);
//update phtrans value in socket struct
ptpd_netif_set_phase_transition(*value);
return ret;
} }
...@@ -242,5 +242,6 @@ void ptpd_netif_linearize_rx_timestamp(wr_timestamp_t * ts, int32_t dmtd_phase, ...@@ -242,5 +242,6 @@ void ptpd_netif_linearize_rx_timestamp(wr_timestamp_t * ts, int32_t dmtd_phase,
int clock_period); int clock_period);
int ptpd_netif_enable_timing_output(int enable); int ptpd_netif_enable_timing_output(int enable);
int ptpd_netif_enable_phase_tracking(const char *if_name); int ptpd_netif_enable_phase_tracking(const char *if_name);
void ptpd_netif_set_phase_transition(uint32_t phase);
#endif #endif
...@@ -56,10 +56,13 @@ int ptpd_netif_get_hw_addr(wr_socket_t * sock, mac_addr_t * mac) ...@@ -56,10 +56,13 @@ int ptpd_netif_get_hw_addr(wr_socket_t * sock, mac_addr_t * mac)
return 0; return 0;
} }
void ptpd_netif_set_phase_transition(wr_socket_t * sock, int phase) void ptpd_netif_set_phase_transition(uint32_t phase)
{ {
struct my_socket *s = (struct my_socket *)sock; int i;
s->phase_transition = phase;
for (i=0; i< NET_MAX_SOCKETS; ++i) {
socks[i].phase_transition = phase;
}
} }
wr_socket_t *ptpd_netif_create_socket(int sock_type, int flags, wr_socket_t *ptpd_netif_create_socket(int sock_type, int flags,
......
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