Commit 19ed9eb8 authored by Adam Wujek's avatar Adam Wujek 💬

userspace/libwr: remove unused functions from ptpd_netif

following functions were removed:
ptpd_netif_calibration_pattern_enable
ptpd_netif_calibration_pattern_disable
ptpd_netif_calibrating_disable
ptpd_netif_calibrating_enable
ptpd_netif_calibrating_poll
ptpd_netif_extsrc_detection
ptpd_netif_adjust_phase
ptpd_netif_adjust_in_progress
ptpd_netif_enable_timing_output
ptpd_netif_enable_phase_tracking
ptpd_netif_get_hw_addr
ptpd_netif_get_ifName
ptpd_netif_get_msec_tics
ptpd_netif_get_port_state
ptpd_netif_locking_disable
ptpd_netif_locking_enable
ptpd_netif_locking_poll
ptpd_netif_read_calibration_data
ptpd_netif_select

--function ptpd_netif_get_dmtd_phase was kept since it is commented as for debugging
--function ptpd_netif_close_socket even not used, should be preserved,
  because ptpd_netif_create_socket is available
parent 380cbdc5
......@@ -504,193 +504,8 @@ int ptpd_netif_recvfrom(wr_socket_t *sock, wr_sockaddr_t *from, void *data,
return ret - sizeof(struct ethhdr);
}
/*
* Turns on locking
*/
int ptpd_netif_locking_enable(int txrx, const char *ifaceName, int priority)
{
netif_dbg("(PTPD_NETIF): start locking\n");
int ret = halexp_lock_cmd(ifaceName, HEXP_LOCK_CMD_START, 0);
return (ret < 0 ? PTPD_NETIF_ERROR : PTPD_NETIF_OK);
}
int ptpd_netif_locking_disable(int txrx, const char *ifaceName, int priority)
{
return PTPD_NETIF_OK;
}
int ptpd_netif_locking_poll(int txrx, const char *ifaceName, int priority)
{
if( halexp_lock_cmd(ifaceName, HEXP_LOCK_CMD_CHECK, 0) == HEXP_LOCK_STATUS_LOCKED)
return PTPD_NETIF_READY;
else
return PTPD_NETIF_NOT_READY;
}
/* We don't need these functions in V3/spec anymore - the transceivers are deterministic! */
int ptpd_netif_calibration_pattern_enable(const char *ifaceName,
unsigned int calibrationPeriod,
unsigned int calibrationPattern,
unsigned int calibrationPatternLen)
{
return PTPD_NETIF_OK;
}
int ptpd_netif_calibrating_disable(int txrx, const char *ifaceName)
{
return PTPD_NETIF_OK;
}
int ptpd_netif_calibrating_enable(int txrx, const char *ifaceName)
{
return PTPD_NETIF_OK;
}
int ptpd_netif_calibrating_poll(int txrx, const char *ifaceName,
uint64_t *delta)
{
uint64_t delta_rx, delta_tx;
ptpd_netif_read_calibration_data(ifaceName, &delta_tx, &delta_rx, NULL, NULL);
if(txrx == PTPD_NETIF_TX)
*delta = delta_tx;
else
*delta = delta_rx;
return PTPD_NETIF_READY;
}
int ptpd_netif_calibration_pattern_disable(const char *ifaceName)
{
return PTPD_NETIF_OK;
}
int ptpd_netif_read_calibration_data(const char *ifaceName, uint64_t *deltaTx,
uint64_t *deltaRx, int32_t *fix_alpha, int32_t *clock_period)
{
hexp_port_state_t state;
//read the port state
halexp_get_port_state(&state, ifaceName);
// check if the data is available
if(state.valid && state.tx_calibrated && state.rx_calibrated)
{
fprintf(stderr, "servo:ifaceName: %s (%d / %d)\n", ifaceName, state.delta_tx ,state.delta_rx);
if(deltaTx)
*deltaTx = state.delta_tx;
if(deltaRx)
*deltaRx = state.delta_rx;
if(fix_alpha)
*fix_alpha = state.fiber_fix_alpha;
if(clock_period)
*clock_period = state.clock_period;
return PTPD_NETIF_OK;
}
return PTPD_NETIF_NOT_FOUND;
}
int ptpd_netif_select( wr_socket_t *wrSock)
{
struct my_socket *s = (struct my_socket *)wrSock;
int ret;
fd_set readfds;
FD_ZERO(&readfds);
FD_SET(s->fd, &readfds);
ret = select(s->fd + 1, &readfds, 0, 0, 0) > 0;
if(ret < 0)
{
if(errno == EAGAIN || errno == EINTR)
return 0;
}
return 1;
}
int ptpd_netif_get_hw_addr(wr_socket_t *sock, mac_addr_t *mac)
{
struct my_socket *s = (struct my_socket *)sock;
memcpy(mac, s->local_mac, 6);
return 0;
}
int ptpd_netif_get_port_state(const char *ifaceName)
{
hexp_port_state_t state;
//read the port state
halexp_get_port_state(&state, ifaceName);
// check if the data is available
if(state.valid)
{
//check if link is UP
if(state.up > 0)
return PTPD_NETIF_OK;
else
{
// if(!strcmp(ifaceName,"wru1") || !strcmp(ifaceName,"wru0"))
// printf("(ptpd_netif) linkdown detected on port: %s\n",ifaceName);
return PTPD_NETIF_ERROR;
}
}
/* printf("(ptpd_netif) linkdown detected on port: %s "
"[no valid port state data)\n",ifaceName);*/
//should not get here
return PTPD_NETIF_ERROR;
}
int ptpd_netif_extsrc_detection()
{
return 0;
}
int ptpd_netif_get_ifName(char *ifname, int number)
{
int i;
int j = 0;
hexp_port_list_t list;
halexp_query_ports(&list);
for( i = 0; i < list.num_ports; i++)
{
if(j == number)
{
strcpy(ifname,list.port_names[i]);
return PTPD_NETIF_OK;
}
else
j++;
}
return PTPD_NETIF_ERROR;
}
uint64_t ptpd_netif_get_msec_tics()
{
// printf("getmsec: %lld\n", get_tics() / 1000ULL);
return get_tics() / 1000ULL;
}
int ptpd_netif_adjust_counters(int64_t adjust_sec, int32_t adjust_nsec)
{
hexp_pps_params_t p;
......@@ -719,42 +534,3 @@ int ptpd_netif_adjust_counters(int64_t adjust_sec, int32_t adjust_nsec)
return PTPD_NETIF_ERROR;
}
int ptpd_netif_adjust_phase(int32_t phase_ps)
{
hexp_pps_params_t p;
p.adjust_phase_shift = phase_ps;
if(!halexp_pps_cmd(HEXP_PPSG_CMD_ADJUST_PHASE, &p))
return PTPD_NETIF_OK;
return PTPD_NETIF_ERROR;
}
int ptpd_netif_adjust_in_progress()
{
hexp_pps_params_t p;
if(halexp_pps_cmd(HEXP_PPSG_CMD_POLL, &p))
return PTPD_NETIF_OK;
else
return PTPD_NETIF_NOT_READY;
}
int ptpd_netif_enable_timing_output(int enable)
{
hexp_pps_params_t p;
p.pps_valid = enable;
if(halexp_pps_cmd(HEXP_PPSG_CMD_SET_VALID, &p))
return PTPD_NETIF_OK;
else
return PTPD_NETIF_NOT_READY;
}
int ptpd_netif_enable_phase_tracking(const char *if_name)
{
int ret = halexp_lock_cmd(if_name, HEXP_LOCK_CMD_ENABLE_TRACKING, 0);
return (ret < 0 ? PTPD_NETIF_ERROR : PTPD_NETIF_OK);
}
......@@ -119,106 +119,6 @@ int ptpd_netif_close_socket(wr_socket_t *sock);
int ptpd_netif_poll(wr_socket_t*);
int ptpd_netif_get_hw_addr(wr_socket_t *sock, mac_addr_t *mac);
/*
* Function start HW locking of freq on WR Slave
* return:
* PTPD_NETIF_ERROR - locking not started
* PTPD_NETIF_OK - locking started
*/
int ptpd_netif_locking_enable(int txrx, const char *ifaceName, int priority);
/*
*
* return:
*
* PTPD_NETIF_OK - locking started
*/
int ptpd_netif_locking_disable(int txrx, const char *ifaceName, int priority);
int ptpd_netif_locking_poll(int txrx, const char *ifaceName, int priority);
/*
* Function turns on calibration (measurement of delay)
* Tx or Rx depending on the txrx param
* return:
* PTPD_NETIF_NOT_READY - if there is calibratin going on on another port
* PTPD_NETIF_OK - calibration started
*/
int ptpd_netif_calibrating_enable(int txrx, const char *ifaceName);
/*
* Function turns off calibration (measurement of delay)
* Tx or Rx depending on the txrx param
* return:
* PTPD_NETIF_ERROR - if there is calibratin going on on another port
* PTPD_NETIF_OK - calibration started
*/
int ptpd_netif_calibrating_disable(int txrx, const char *ifaceName);
/*
* Function checks if Rx/Tx (depending on the param) calibration is finished
* if finished, returns measured delay in delta
* return:
*
* PTPD_NETIF_OK - locking started
*/
int ptpd_netif_calibrating_poll(int txrx, const char *ifaceName, uint64_t *delta);
/*
* Function turns on calibration pattern.
* return:
* PTPD_NETIF_NOT_READY - if WRSW is busy with calibration on other switch or error occured
* PTPD_NETIF_OK - calibration started
*/
int ptpd_netif_calibration_pattern_enable(const char *ifaceName, unsigned int calibrationPeriod, unsigned int calibrationPattern, unsigned int calibrationPatternLen);
/*
* Function turns off calibration pattern
* return:
* PTPD_NETIF_ERROR - turning off not successful
* PTPD_NETIF_OK - turning off successful
*/
int ptpd_netif_calibration_pattern_disable(const char *ifaceName);
/*
* Function reads calibration data if it's available, used at the beginning of PTPWRd to check if
* HW knows already the interface's deltax, and therefore no need for calibration
* return:
* PTPD_NETIF_NOT_FOUND - if deltas are not known
* PTPD_NETIF_OK - if deltas are known, in such case, deltaTx and deltaRx have valid data
*/
int ptpd_netif_read_calibration_data(const char *ifaceName, uint64_t *deltaTx,
uint64_t *deltaRx, int32_t *fix_alpha, int32_t *clock_period);
int ptpd_netif_select(wr_socket_t*);
int ptpd_netif_get_hw_addr(wr_socket_t *sock, mac_addr_t *mac);
/*
* Function reads state of the given port (interface in our case), if the port is up, everything is OK, otherwise ERROR
* return:
* PTPD_NETIF_ERROR - if the port is down
* PTPD_NETIF_OK - if the port is up
*/
int ptpd_netif_get_port_state(const char *ifaceName);
/*
* Function looks for a port (interface) for the port number 'number'
* it will return in the argument ifname the port name
* return:
* PTPD_NETIF_ERROR - port not found
* PTPD_NETIF_OK - if the port found
*/
int ptpd_netif_get_ifName(char *ifname, int number);
/* Returns the millisecond "tics" counter value */
uint64_t ptpd_netif_get_msec_tics();
/*
* Function detects external source lock,
......@@ -228,15 +128,10 @@ uint64_t ptpd_netif_get_msec_tics();
* HEXP_LOCK_STATUS_BUSY 1
* HEXP_EXTSRC_STATUS_NOSRC 2
*/
int ptpd_netif_extsrc_detection();
/* Timebase adjustment functions - the servo should not call the HAL directly */
int ptpd_netif_adjust_counters(int64_t adjust_sec, int32_t adjust_nsec);
int ptpd_netif_adjust_phase(int32_t phase_ps);
int ptpd_netif_adjust_in_progress();
int ptpd_netif_get_dmtd_phase(wr_socket_t *sock, int32_t *phase);
void ptpd_netif_linearize_rx_timestamp(wr_timestamp_t *ts, int32_t dmtd_phase, int cntr_ahead, int transition_point, int clock_period);
int ptpd_netif_enable_timing_output(int enable);
int ptpd_netif_enable_phase_tracking(const char *if_name);
#endif
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