Commit 7c8101a9 authored by Tomasz Wlostowski's avatar Tomasz Wlostowski

cleanup, removed obsolete/unused functions from libposix, removed remaining…

cleanup, removed obsolete/unused functions from libposix, removed remaining references to UTC timescale
parent 9a93572f
......@@ -8,6 +8,7 @@
* This header file includes all default values used during initialization
* and enumeration defined in the spec
*/
#undef PACKED
#include "ptpd_netif.h"
/**
......
......@@ -407,8 +407,8 @@ void msgPackFollowUp(void *buf,PtpPortDS *ptpPortDS)
*(Integer8*)(buf+33) = ptpPortDS->logSyncInterval;
/*Follow_up message*/
*(UInteger16*)(buf+34) = flip16(0xFFFF & (ptpPortDS->synch_tx_ts.utc >> 32));
put_be32(buf+36,0xFFFFFFFF & ptpPortDS->synch_tx_ts.utc);
*(UInteger16*)(buf+34) = flip16(0xFFFF & (ptpPortDS->synch_tx_ts.sec >> 32));
put_be32(buf+36,0xFFFFFFFF & ptpPortDS->synch_tx_ts.sec);
put_be32(buf+40, ptpPortDS->synch_tx_ts.nsec);
/*
......@@ -419,8 +419,8 @@ void msgPackFollowUp(void *buf,PtpPortDS *ptpPortDS)
PTPD_TRACE(TRACE_MSG, NULL,"------------ msgPackFollowUp-------\n");
PTPD_TRACE(TRACE_MSG, NULL," syncSequenceId ............... %u\n", ptpPortDS->sentSyncSequenceId-1);
PTPD_TRACE(TRACE_MSG, NULL," logMinDelayReqInterval ....... %u\n", ptpPortDS->logSyncInterval);
PTPD_TRACE(TRACE_MSG, NULL," syncTransTimestamp.secs.hi.... %d\n", (int)(0xFFFF & (ptpPortDS->synch_tx_ts.utc >> 32)));
PTPD_TRACE(TRACE_MSG, NULL," syncTransTimestamp.secs.lo.... %d\n", (int)(0xFFFFFFFF & ptpPortDS->synch_tx_ts.utc));
PTPD_TRACE(TRACE_MSG, NULL," syncTransTimestamp.secs.hi.... %d\n", (int)(0xFFFF & (ptpPortDS->synch_tx_ts.sec >> 32)));
PTPD_TRACE(TRACE_MSG, NULL," syncTransTimestamp.secs.lo.... %d\n", (int)(0xFFFFFFFF & ptpPortDS->synch_tx_ts.sec));
PTPD_TRACE(TRACE_MSG, NULL," syncTransTimestamp.nsecs...... %d\n", ptpPortDS->synch_tx_ts.nsec);
PTPD_TRACE(TRACE_MSG, NULL,"^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n");
......@@ -508,8 +508,8 @@ void msgPackDelayResp(void *buf,MsgHeader *header,PtpPortDS *ptpPortDS)
*(Integer8*)(buf+33) = ptpPortDS->logMinDelayReqInterval; //Table 24
/*Pdelay_resp message*/
*(UInteger16*)(buf+34) = flip16(0xFFFF & (ptpPortDS->current_rx_ts.utc >> 32));
put_be32(buf+36, 0xFFFFFFFF & ptpPortDS->current_rx_ts.utc);
*(UInteger16*)(buf+34) = flip16(0xFFFF & (ptpPortDS->current_rx_ts.sec >> 32));
put_be32(buf+36, 0xFFFFFFFF & ptpPortDS->current_rx_ts.sec);
put_be32(buf+40, ptpPortDS->current_rx_ts.nsec);
memcpy((buf+44),header->sourcePortIdentity.clockIdentity,CLOCK_IDENTITY_LENGTH);
......@@ -522,8 +522,8 @@ void msgPackDelayResp(void *buf,MsgHeader *header,PtpPortDS *ptpPortDS)
PTPD_TRACE(TRACE_MSG, NULL," correctionfield.lsb........... %d\n", header->correctionfield.lsb);
PTPD_TRACE(TRACE_MSG, NULL," sequenceId ................... %u\n", header->sequenceId);
PTPD_TRACE(TRACE_MSG, NULL," logMinDelayReqInterval ....... %u\n", ptpPortDS->logMinDelayReqInterval);
PTPD_TRACE(TRACE_MSG, NULL," delayReceiptTimestamp.secs.hi. %d\n", (int)(0xFFFF & (ptpPortDS->current_rx_ts.utc >> 32)));
PTPD_TRACE(TRACE_MSG, NULL," delayReceiptTimestamp.secs.lo. %d\n", (int)(0xFFFFFFFF & ptpPortDS->current_rx_ts.utc));
PTPD_TRACE(TRACE_MSG, NULL," delayReceiptTimestamp.secs.hi. %d\n", (int)(0xFFFF & (ptpPortDS->current_rx_ts.sec >> 32)));
PTPD_TRACE(TRACE_MSG, NULL," delayReceiptTimestamp.secs.lo. %d\n", (int)(0xFFFFFFFF & ptpPortDS->current_rx_ts.sec));
PTPD_TRACE(TRACE_MSG, NULL," delayReceiptTimestamp.nsecs... %d\n", ptpPortDS->current_rx_ts.nsec);
PTPD_TRACE(TRACE_MSG, NULL," requestingSourceUuid.......... %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n",
header->sourcePortIdentity.clockIdentity[0],
......@@ -554,8 +554,8 @@ void msgPackPDelayResp(void *buf,MsgHeader *header,Timestamp *requestReceiptTime
*(UInteger8*)(buf+32) = 0x05; //Table 23
*(Integer8*)(buf+33) = 0x7F; //Table 24
*(UInteger16*)(buf+34) = flip16(0xFFFF & (ptpPortDS->current_rx_ts.utc >> 32 ));
put_be32(buf+36,0xFFFFFFFF & ptpPortDS->current_rx_ts.utc);
*(UInteger16*)(buf+34) = flip16(0xFFFF & (ptpPortDS->current_rx_ts.sec >> 32 ));
put_be32(buf+36,0xFFFFFFFF & ptpPortDS->current_rx_ts.sec);
put_be32(buf+40, ptpPortDS->current_rx_ts.nsec);
memcpy((buf+44),header->sourcePortIdentity.clockIdentity,CLOCK_IDENTITY_LENGTH);
......@@ -644,8 +644,8 @@ void msgPackPDelayRespFollowUp(void *buf,MsgHeader *header,Timestamp *responseOr
*(Integer32*)(buf+8) = flip32(header->correctionfield.msb);
*(Integer32*)(buf+12) = flip32(header->correctionfield.lsb);
*(UInteger16*)(buf+34) = flip16(0xFFFF & (ptpPortDS->pDelayResp_tx_ts.utc >> 32));
put_be32(buf+36, 0xFFFFFFFF & ptpPortDS->pDelayResp_tx_ts.utc);
*(UInteger16*)(buf+34) = flip16(0xFFFF & (ptpPortDS->pDelayResp_tx_ts.sec >> 32));
put_be32(buf+36, 0xFFFFFFFF & ptpPortDS->pDelayResp_tx_ts.sec);
put_be32(buf+40, ptpPortDS->pDelayResp_tx_ts.nsec);
memcpy((buf+44),header->sourcePortIdentity.clockIdentity,CLOCK_IDENTITY_LENGTH);
......
......@@ -40,13 +40,12 @@ void wr_servo_enable_tracking(int enable)
static void dump_timestamp(char *what, wr_timestamp_t ts)
{
//fprintf(stderr, "%s = %d:%d:%d\n", what, (int32_t)ts.utc, ts.nsec, ts.phase);
fprintf(stderr, "%s = %d:%d:%d\n", what, (int32_t)ts.utc, ts.nsec, ts.phase);
fprintf(stderr, "%s = %d:%d:%d\n", what, (int32_t)ts.sec, ts.nsec, ts.phase);
}
static int64_t ts_to_picos(wr_timestamp_t ts)
{
return (int64_t) ts.utc * (int64_t)1000000000000LL
return (int64_t) ts.sec * (int64_t)1000000000000LL
+ (int64_t) ts.nsec * (int64_t)1000LL
+ (int64_t) ts.phase;
}
......@@ -60,7 +59,7 @@ static wr_timestamp_t picos_to_ts(int64_t picos)
picos = (picos-nsec)/1000000000LL;
wr_timestamp_t ts;
ts.utc = (int64_t) picos;
ts.sec = (int64_t) picos;
ts.nsec = (int32_t) nsec;
ts.phase = (int32_t) phase;
......@@ -71,7 +70,7 @@ static wr_timestamp_t ts_add(wr_timestamp_t a, wr_timestamp_t b)
{
wr_timestamp_t c;
c.utc = 0;
c.sec = 0;
c.nsec = 0;
c.phase =a.phase + b.phase;
......@@ -87,10 +86,10 @@ static wr_timestamp_t ts_add(wr_timestamp_t a, wr_timestamp_t b)
while(c.nsec >= 1000000000L)
{
c.nsec -= 1000000000L;
c.utc++;
c.sec++;
}
c.utc += (a.utc + b.utc);
c.sec += (a.sec + b.sec);
return c;
}
......@@ -99,7 +98,7 @@ static wr_timestamp_t ts_sub(wr_timestamp_t a, wr_timestamp_t b)
{
wr_timestamp_t c;
c.utc = 0;
c.sec = 0;
c.nsec = 0;
c.phase = a.phase - b.phase;
......@@ -114,10 +113,10 @@ static wr_timestamp_t ts_sub(wr_timestamp_t a, wr_timestamp_t b)
while(c.nsec < 0)
{
c.nsec += 1000000000L;
c.utc--;
c.sec--;
}
c.utc += a.utc - b.utc;
c.sec += a.sec - b.sec;
return c;
}
......@@ -143,16 +142,16 @@ static wr_timestamp_t ts_hardwarize(wr_timestamp_t ts, int clock_period_ps)
if(ts.nsec < 0) {
ts.nsec += 1000000000LL;
ts.utc--;
ts.sec--;
}
if(ts.utc == -1 && ts.nsec > 0)
if(ts.sec == -1 && ts.nsec > 0)
{
ts.utc++;
ts.sec++;
ts.nsec -= 1000000000LL;
}
if(ts.nsec < 0 && ts.nsec >= (-q_threshold) && ts.utc == 0)
if(ts.nsec < 0 && ts.nsec >= (-q_threshold) && ts.sec == 0)
{
ts.nsec += q_threshold;
ts.phase -= q_threshold * 1000;
......@@ -223,7 +222,7 @@ int wr_servo_init(PtpPortDS *clock)
wr_timestamp_t timeint_to_wr(TimeInternal t)
{
wr_timestamp_t ts;
ts.utc = t.seconds;
ts.sec = t.seconds;
ts.nsec = t.nanoseconds;
ts.phase = t.phase;
return ts;
......@@ -354,10 +353,10 @@ int wr_servo_update(PtpPortDS *clock)
case WR_SYNC_TAI:
ptpd_netif_enable_timing_output(0);
if(ts_offset_hw.utc != 0)
if(ts_offset_hw.sec != 0)
{
strcpy(cur_servo_state.slave_servo_state, "SYNC_UTC");
ptpd_netif_adjust_counters(ts_offset_hw.utc, 0);
strcpy(cur_servo_state.slave_servo_state, "SYNC_SEC");
ptpd_netif_adjust_counters(ts_offset_hw.sec, 0);
ptpd_netif_adjust_phase(0);
s->next_state = WR_SYNC_NSEC;
......@@ -397,7 +396,7 @@ int wr_servo_update(PtpPortDS *clock)
{
int64_t remaining_offset = abs(ts_to_picos(ts_offset_hw));
if(ts_offset_hw.utc !=0 || ts_offset_hw.nsec != 0)
if(ts_offset_hw.sec !=0 || ts_offset_hw.nsec != 0)
s->state = WR_SYNC_TAI;
else if(remaining_offset < WR_SERVO_OFFSET_STABILITY_THRESHOLD)
{
......@@ -416,7 +415,7 @@ int wr_servo_update(PtpPortDS *clock)
cur_servo_state.cur_setpoint = s->cur_setpoint;
cur_servo_state.cur_skew = s->delta_ms - s->delta_ms_prev;
if(ts_offset_hw.utc !=0 || ts_offset_hw.nsec != 0)
if(ts_offset_hw.sec !=0 || ts_offset_hw.nsec != 0)
s->state = WR_SYNC_TAI;
if(tracking_enabled)
......
......@@ -754,7 +754,7 @@ void handle(RunTimeOpts *rtOpts, PtpPortDS *ptpPortDS)
* WR: to comply with old PTP daemon work flow
* this should go to netRecvMsg
*/
time.seconds = ptpPortDS->current_rx_ts.utc;
time.seconds = ptpPortDS->current_rx_ts.sec;
time.nanoseconds = ptpPortDS->current_rx_ts.nsec;
// !!!!!!!!!!!!!!!!!
......@@ -985,7 +985,7 @@ void handleSync(MsgHeader *header, Octet *msgIbuf, ssize_t length, TimeInternal
/*
* WR: HW timestamps
*/
ptpPortDS->sync_receive_time.seconds = ptpPortDS->current_rx_ts.utc;
ptpPortDS->sync_receive_time.seconds = ptpPortDS->current_rx_ts.sec;
ptpPortDS->sync_receive_time.nanoseconds = ptpPortDS->current_rx_ts.nsec;
ptpPortDS->sync_receive_time.phase = ptpPortDS->current_rx_ts.phase;
ptpPortDS->sync_receive_time.correct = ptpPortDS->current_rx_ts.correct;
......@@ -1729,7 +1729,7 @@ void issueFollowup(RunTimeOpts *rtOpts,PtpPortDS *ptpPortDS)
else
{
PTPD_TRACE(TRACE_PROTO, ptpPortDS,"issue ..... FOLLOW_UP: succedded [sending time of sync tx: sec = %lld nanosec = %lld]\n",\
(unsigned long long)ptpPortDS->synch_tx_ts.utc,\
(unsigned long long)ptpPortDS->synch_tx_ts.sec,\
(unsigned long long)ptpPortDS->synch_tx_ts.nsec);
}
......@@ -1847,7 +1847,7 @@ void issuePDelayRespFollowUp(TimeInternal *time,MsgHeader *header,RunTimeOpts *r
else
{
PTPD_TRACE(TRACE_PROTO, ptpPortDS,"issue ..... PDELAY_RESP_FOLLOW_UP, succedded [sending time of pDelayResp tx]: \n\t\t sec = %lld \n\t\t nanosec = %lld\n",\
(unsigned long long)ptpPortDS->pDelayResp_tx_ts.utc,\
(unsigned long long)ptpPortDS->pDelayResp_tx_ts.sec,\
(unsigned long long)ptpPortDS->pDelayResp_tx_ts.nsec);
}
}
......
......@@ -254,7 +254,7 @@ char *format_wr_timestamp(wr_timestamp_t ts)
{
static char ts_buf[64];
snprintf(ts_buf,64, "sec: %lld nsec: %ld ", (long long)ts.utc,
snprintf(ts_buf,64, "sec: %lld nsec: %ld ", (long long)ts.sec,
(long) ts.nsec);
return ts_buf;
......
......@@ -37,44 +37,6 @@ uint64_t ptpd_netif_get_msec_tics(void)
return timer_get_tics();
}
int halexp_pps_cmd(int cmd, hexp_pps_params_t *params)
{
switch(cmd)
{
case HEXP_PPSG_CMD_GET:
/*not know what to do here*/
break;
case HEXP_PPSG_CMD_ADJUST_PHASE:
spll_set_phase_shift(SPLL_ALL_CHANNELS, params->adjust_phase_shift);
//*(dpll + WRD(DMPLL_REG_PSCR_IN0)) = DMPLL_PSCR_IN0_PS_VAL_W(params->adjust_phase_shift);
/*something new here*/
break;
case HEXP_PPSG_CMD_ADJUST_UTC:
pps_gen_adjust_utc((uint32_t)params->adjust_utc);
//*(ppsg + WRD(PPSG_REG_ADJ_UTCLO)) = (params->adjust_utc & 0xffffffffLL);
//*(ppsg + WRD(PPSG_REG_ADJ_UTCHI)) = (params->adjust_utc >> 32);
//*(ppsg + WRD(PPSG_REG_ADJ_NSEC)) = 0x00;
//*(ppsg + WRD(PPSG_REG_CR)) = PPSG_CR_CNT_EN | PPSG_CR_PWIDTH_W(PPS_WIDTH) | PPSG_CR_CNT_ADJ;
break;
case HEXP_PPSG_CMD_ADJUST_NSEC:
pps_gen_adjust_nsec(params->adjust_nsec);
//*(ppsg + WRD(PPSG_REG_ADJ_UTCLO)) = 0x0;
//*(ppsg + WRD(PPSG_REG_ADJ_UTCHI)) = 0x0;
//*(ppsg + WRD(PPSG_REG_ADJ_NSEC)) = params->adjust_nsec;
//*(ppsg + WRD(PPSG_REG_CR)) = PPSG_CR_CNT_EN | PPSG_CR_PWIDTH_W(PPS_WIDTH) | PPSG_CR_CNT_ADJ;
break;
case HEXP_PPSG_CMD_POLL:
//return ( *(dpll + WRD(DMPLL_REG_PSCR_IN0)) & DMPLL_PSCR_IN0_BUSY ) ||
// ( (*(ppsg + WRD(PPSG_REG_CR)) & PPSG_CR_CNT_ADJ)==PPSG_CR_CNT_ADJ );
return pps_gen_busy() || spll_shifter_busy(0);
/*add here pll busy to return*/
break;
}
return 0;
}
int ptpd_netif_init()
{
memset(wr_sockets, 0, sizeof(wr_sockets));
......@@ -407,7 +369,7 @@ int ptpd_netif_recvfrom(wr_socket_t *sock, wr_sockaddr_t *from, void *data,
rx_timestamp->raw_ahead = hwts.ahead;
spll_read_ptracker(0, &rx_timestamp->raw_phase, NULL);
rx_timestamp->utc = hwts.utc;
rx_timestamp->sec = hwts.sec;
rx_timestamp->nsec = hwts.nsec;
rx_timestamp->phase = 0;
rx_timestamp->correct = hwts.valid;
......@@ -461,7 +423,7 @@ int ptpd_netif_sendto(wr_socket_t *sock, wr_sockaddr_t *to, void *data,
rval = minic_tx_frame(hdr, (uint8_t*)data, data_length + ETH_HEADER_SIZE, &ts);
tx_ts->utc = ts.utc;
tx_ts->sec = ts.sec;
tx_ts->nsec = ts.nsec;
tx_ts->phase = 0; //ts.phase;
tx_ts->correct = ts.valid;
......@@ -516,16 +478,6 @@ int update_rx_queues(void)
memcpy(pkg, &size, sizeof(uint8_t));
memcpy(pkg+ETH_HEADER_SIZE+recvd+sizeof(uint8_t), &hwts, sizeof(struct hw_timestamp));
size += sizeof(uint8_t); /*size of data + 1 byte for size itself*/
//TRACE_WRAP("storing: ");
//for(i=0; i<size; i++)
// TRACE_WRAP("%x ", pkg[i]);
//TRACE_WRAP("\n");
//memcpy(&tstest, pkg+ETH_HEADER_SIZE+recvd+sizeof(uint8_t), sizeof(struct hw_timestamp));
//TRACE_WRAP("aabc up: ");
//for(i=0;i<size-1;i++)
// TRACE_WRAP("%d ", pkg[i+1]);
//TRACE_WRAP("\n%s: %x: %x: %x size=%d, recvd=%d, ETH_HEADER_SIZE=%d\n", "aabc", tstest.utc, tstest.nsec, tstest.phase, size-1, recvd, ETH_HEADER_SIZE);
while(size)
{
......@@ -542,36 +494,6 @@ int update_rx_queues(void)
return sizeof(uint8_t)+ETH_HEADER_SIZE+recvd+sizeof(struct hw_timestamp);
}
#if 0
void protocol_nonblock(RunTimeOpts *rtOpts, PtpPortDS *ptpPortDS)
{
PTPD_TRACE(TRACE_WRPC, ptpPortDS, "nonblock\n");
singlePortLoop(rtOpts, ptpPortDS, 0);
if(ptpPortDS->ptpClockDS->globalStateDecisionEvent)
{
PTPD_TRACE(TRACE_WRPC, ptpPortDS,"update secondary slaves\n");
/* Do after State Decision Even in all the ports */
if(globalSecondSlavesUpdate(ptpPortDS) == FALSE)
PTPD_TRACE(TRACE_WRPC, ptpPortDS,"no secondary slaves\n");
ptpPortDS->ptpClockDS->globalStateDecisionEvent = FALSE;
}
/* Handle Best Master Clock Algorithm globally */
if(globalBestForeignMastersUpdate(ptpPortDS))
{
PTPD_TRACE(TRACE_WRPC, ptpPortDS,"Initiate global State Decision Event\n");
ptpPortDS->ptpClockDS->globalStateDecisionEvent = TRUE;
}
else
ptpPortDS->ptpClockDS->globalStateDecisionEvent = FALSE;
checkClockClassValidity(ptpPortDS->ptpClockDS);
}
#endif
int ptpd_netif_read_calibration_data(const char *ifaceName, uint64_t *deltaTx,
uint64_t *deltaRx, int32_t *fix_alpha, int32_t *clock_period)
{
......@@ -620,28 +542,22 @@ int ptpd_netif_enable_timing_output(int enable)
int ptpd_netif_adjust_in_progress()
{
return halexp_pps_cmd(HEXP_PPSG_CMD_POLL, NULL);
return pps_gen_busy() || spll_shifter_busy(0);
}
int ptpd_netif_adjust_counters(int64_t adjust_utc, int32_t adjust_nsec)
int ptpd_netif_adjust_counters(int64_t adjust_sec, int32_t adjust_nsec)
{
hexp_pps_params_t params;
params.adjust_utc = adjust_utc;
params.adjust_nsec = adjust_nsec;
if(adjust_utc != 0) halexp_pps_cmd(HEXP_PPSG_CMD_ADJUST_UTC, &params);
if(adjust_nsec != 0) halexp_pps_cmd(HEXP_PPSG_CMD_ADJUST_NSEC, &params);
return 0;
if(adjust_sec)
pps_gen_adjust(PPSG_ADJUST_SEC, adjust_sec);
if(adjust_nsec)
pps_gen_adjust(PPSG_ADJUST_NSEC, adjust_nsec);
return 0;
}
int ptpd_netif_adjust_phase(int32_t phase_ps)
{
hexp_pps_params_t params;
params.adjust_phase_shift = phase_ps;
return halexp_pps_cmd(HEXP_PPSG_CMD_ADJUST_PHASE, &params);
spll_set_phase_shift(SPLL_ALL_CHANNELS, phase_ps);
}
/*not implemented yet*/
......@@ -658,7 +574,7 @@ int ptpd_netif_get_dmtd_phase(wr_socket_t *sock, int32_t *phase)
char* format_wr_timestamp(wr_timestamp_t ts)
{
static char buf[10];
static char buf[1];
buf[0]='\0';
return buf;
}
......
This diff is collapsed.
......@@ -421,7 +421,7 @@ static void poll_tx_timestamp(wr_socket_t *sock, wr_timestamp_t *tx_timestamp)
tx_timestamp->correct = 1;
tx_timestamp->phase = 0;
tx_timestamp->nsec = sts->hwtimeraw.tv_nsec;
tx_timestamp->utc = (uint64_t) sts->hwtimeraw.tv_sec & 0x7fffffff;
tx_timestamp->sec = (uint64_t) sts->hwtimeraw.tv_sec & 0x7fffffff;
}
}
}
......@@ -485,7 +485,7 @@ int ptpd_netif_recvfrom(wr_socket_t *sock, wr_sockaddr_t *from, void *data,
{
int cntr_ahead = sts->hwtimeraw.tv_sec & 0x80000000 ? 1: 0;
rx_timestamp->nsec = sts->hwtimeraw.tv_nsec;
rx_timestamp->utc =
rx_timestamp->sec =
(uint64_t) sts->hwtimeraw.tv_sec & 0x7fffffff;
rx_timestamp->raw_nsec = sts->hwtimeraw.tv_nsec;
......@@ -689,24 +689,24 @@ uint64_t ptpd_netif_get_msec_tics()
}
int ptpd_netif_adjust_counters(int64_t adjust_utc, int32_t adjust_nsec)
int ptpd_netif_adjust_counters(int64_t adjust_sec, int32_t adjust_nsec)
{
hexp_pps_params_t p;
int cmd;
if(!adjust_nsec && !adjust_utc)
if(!adjust_nsec && !adjust_sec)
return PTPD_NETIF_OK;
if(adjust_utc && adjust_nsec)
if(adjust_sec && adjust_nsec)
{
fprintf(stderr, " FATAL : trying to adjust both the UTC and the NS counters simultaneously. \n");
fprintf(stderr, " FATAL : trying to adjust both the SEC and the NS counters simultaneously. \n");
exit(-1);
}
if(adjust_utc)
if(adjust_sec)
{
cmd = HEXP_PPSG_CMD_ADJUST_SEC;
p.adjust_sec = adjust_utc;
p.adjust_sec = adjust_sec;
} else {
cmd = HEXP_PPSG_CMD_ADJUST_NSEC;
p.adjust_nsec = adjust_nsec;
......
......@@ -66,8 +66,8 @@ typedef struct {
PACKED struct _wr_timestamp {
// UTC time value (seconds)
int64_t utc;
// Seconds
int64_t sec;
// Nanoseconds
int32_t nsec;
......@@ -75,9 +75,10 @@ PACKED struct _wr_timestamp {
// Phase (in picoseconds), linearized for receive timestamps, zero for send timestamps
int32_t phase; // phase(picoseconds)
int32_t raw_phase;
int32_t raw_nsec;
int32_t raw_ahead;
/* Raw time (non-linearized) for debugging purposes */
int32_t raw_phase;
int32_t raw_nsec;
int32_t raw_ahead;
// correctness flag: when 0, the timestamp MAY be incorrect (e.g. generated during timebase adjustment)
int correct;
......@@ -230,7 +231,7 @@ uint64_t ptpd_netif_get_msec_tics();
int ptpd_netif_extsrc_detection();
/* Timebase adjustment functions - the servo should not call the HAL directly */
int ptpd_netif_adjust_counters(int64_t adjust_utc, int32_t adjust_nsec);
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);
......
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