Commit fe03a624 authored by Adam Wujek's avatar Adam Wujek 💬

userspace/libwr: add new fields to hal_port_state

Function hal_port_get_exported_state, fills structure hal_port_state with data
that are not available in SHM. It just assigns defines.
These defines are private to HAL, and assignment should be done in HAL.

Similar problem is for wrpc. There is a wrapper function that pretends to be
HAL. All HAL info should be filled in that function.

Fields added:
--uint32_t clock_period;
--uint32_t t2_phase_transition;
--uint32_t t4_phase_transition;

Additionally updated wrs_dump_shmem.c to dump new fields and the version number
of HAL SHM.
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 0a7acbd8
......@@ -87,12 +87,24 @@ struct hal_port_state {
/* locking FSM state */
int lock_state;
/*reference lock period in picoseconds*/
uint32_t clock_period;
/* approximate DMTD phase value (on slave port) at which RX timestamp
* (T2) counter transistion occurs (picoseconds) */
uint32_t t2_phase_transition;
/* approximate phase value (on master port) at which RX timestamp (T4)
* counter transistion occurs (picoseconds) */
uint32_t t4_phase_transition;
/* Endpoint's base address */
uint32_t ep_base;
};
/* This is the overall structure stored in shared memory */
#define HAL_SHMEM_VERSION 3 /* Version 3 because sfp delta is signed */
#define HAL_SHMEM_VERSION 4 /* Version 4 because of new fields in struct
* hal_port_state */
struct hal_shmem_header {
int nports;
struct hal_port_state *ports;
......
......@@ -26,7 +26,6 @@
#include <libwr/shmem.h>
#include <libwr/hal_shmem.h>
#include <libwr/hal_client.h>
#include <libwr/switch_hw.h>
#include <net/ethernet.h>
#ifdef NETIF_VERBOSE
......@@ -271,8 +270,8 @@ struct wr_socket *ptpd_netif_create_socket(int sock_type, int flags,
s->fd = fd;
// store the linearization parameters
s->clock_period = REF_CLOCK_PERIOD_PS;
s->phase_transition = DEFAULT_T2_PHASE_TRANS;
s->clock_period = port->clock_period;
s->phase_transition = port->t2_phase_transition;
s->dmtd_phase_valid = 0;
s->dmtd_phase = port->phase_val;
......
ppsi @ 4a60739f
Subproject commit fa1332004d01384a667fad3057f1307baf58af3b
Subproject commit 4a60739fc06a3d68718e1bdeece92bd7b279253d
......@@ -216,6 +216,9 @@ struct dump_info hal_port_info [] = {
DUMP_FIELD(int, tx_cal_pending),
DUMP_FIELD(int, rx_cal_pending),
DUMP_FIELD(int, lock_state),
DUMP_FIELD(uint32_t, clock_period),
DUMP_FIELD(uint32_t, t2_phase_transition),
DUMP_FIELD(uint32_t, t4_phase_transition),
DUMP_FIELD(uint32_t, ep_base),
};
......
......@@ -138,6 +138,10 @@ static int hal_port_init(int index)
p->calib.delta_rx_board = 0; /* never set */
sscanf(p->name + 2, "%d", &p->hw_index);
p->t2_phase_transition = DEFAULT_T2_PHASE_TRANS;
p->t4_phase_transition = DEFAULT_T4_PHASE_TRANS;
p->clock_period = REF_CLOCK_PERIOD_PS;
hal_port_enable(p->hw_index, 1);
{
......
......@@ -39,7 +39,6 @@
#include <linux/if.h>
#include <libwr/wrs-msg.h>
#include <libwr/switch_hw.h>
#include <libwr/shmem.h>
#include <libwr/hal_shmem.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