Commit cead1712 authored by Aurelio Colosimo's avatar Aurelio Colosimo Committed by Alessandro Rubini

tests/measure_t24p.c: support for ppsi implemented

Signed-off-by: Aurelio Colosimo's avatarAurelio Colosimo <aurelio@aureliocolosimo.it>
parent a911afaa
......@@ -24,8 +24,14 @@
#undef PACKED
#include <ptpd_netif.h>
#ifdef CONFIG_PTP_NOPOSIX /* FIXME */
#ifdef CONFIG_PPSI
#include <ppsi/ppsi.h>
#define UNPACK_HEADER msg_unpack_header
#define UNPACK_FOLLOWUP msg_unpack_follow_up
#else
#include "ptpd.h"
#define UNPACK_HEADER msgUnpackHeader
#define UNPACK_FOLLOWUP msgUnpackFollowUp
#endif
#if 0 /* not used, currently */
......@@ -55,7 +61,6 @@ static void purge_socket(wr_socket_t * sock)
static int meas_phase_range(wr_socket_t * sock, int phase_min, int phase_max,
int phase_step, struct meas_entry *results)
{
#ifdef CONFIG_PTP_NOPOSIX /* FIXME */
char buf[128];
wr_timestamp_t ts_rx, ts_sync = {0,};
wr_sockaddr_t from;
......@@ -75,12 +80,12 @@ static int meas_phase_range(wr_socket_t * sock, int phase_min, int phase_max,
int n = ptpd_netif_recvfrom(sock, &from, buf, 128, &ts_rx);
if (n > 0) {
msgUnpackHeader(buf, &mhdr);
UNPACK_HEADER(buf, &mhdr);
if (mhdr.messageType == 0)
ts_sync = ts_rx;
else if (mhdr.messageType == 8 && ts_sync.correct) {
MsgFollowUp fup;
msgUnpackFollowUp(buf, &fup);
UNPACK_FOLLOWUP(buf, &fup);
mprintf("Shift: %d/%dps [step %dps] \r",
setpoint, phase_max, phase_step);
......@@ -106,7 +111,6 @@ static int meas_phase_range(wr_socket_t * sock, int phase_min, int phase_max,
}
mprintf("\n");
return i;
#endif
}
static int find_transition(struct meas_entry *results, int n, int positive)
......
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