Commit a0d2fba5 authored by Dimitris Lampridis's avatar Dimitris Lampridis Committed by Dimitris Lampridis

sw: rework WRTD attributes

parent fed05a7e
...@@ -29,14 +29,12 @@ ...@@ -29,14 +29,12 @@
class WrtdAlarm extends WrtdRepCap; class WrtdAlarm extends WrtdRepCap;
protected WrtdTstamp setup_time;
protected wrtd_event ev; protected wrtd_event ev;
protected int repeat_count; protected int repeat_count;
protected uint32_t period_ns; protected uint32_t period_ns;
function new ( string name = "" ); function new ( string name = "" );
super.new ( name ); super.new ( name );
this.setup_time = new();
this.ev.ts = new(); this.ev.ts = new();
this.ev.id = new(); this.ev.id = new();
clear(); clear();
...@@ -44,7 +42,6 @@ class WrtdAlarm extends WrtdRepCap; ...@@ -44,7 +42,6 @@ class WrtdAlarm extends WrtdRepCap;
function void clear ( ); function void clear ( );
super.clear(); super.clear();
this.setup_time.zero();
this.ev.ts.zero(); this.ev.ts.zero();
this.ev.id.clear(); this.ev.id.clear();
this.ev.seq = 0; this.ev.seq = 0;
...@@ -55,26 +52,24 @@ class WrtdAlarm extends WrtdRepCap; ...@@ -55,26 +52,24 @@ class WrtdAlarm extends WrtdRepCap;
function wrtd_data data_pack ( ); function wrtd_data data_pack ( );
wrtd_data ret = new[`WRTD_ALRM_WORD_SIZE]; wrtd_data ret = new[`WRTD_ALRM_WORD_SIZE];
ret[0:2] = this.setup_time.data_pack(); ret[0:2] = this.ev.ts.data_pack();
ret[3:5] = this.ev.ts.data_pack(); ret[3:6] = this.ev.id.data_pack();
ret[6:9] = this.ev.id.data_pack(); ret[7] = this.ev.seq;
ret[10] = this.ev.seq; ret[8] = this.ev.flags;
ret[11] = this.ev.flags; ret[9] = this.enabled;
ret[12] = this.enabled; ret[10] = this.repeat_count;
ret[13] = this.repeat_count; ret[11] = this.period_ns;
ret[14] = this.period_ns;
return ret; return ret;
endfunction // data_pack endfunction // data_pack
function void data_unpack ( wrtd_data data ); function void data_unpack ( wrtd_data data );
this.setup_time.data_unpack ( data[0:2] ); this.ev.ts.data_unpack ( data[0:2] );
this.ev.ts.data_unpack ( data[3:5] ); this.ev.id.data_unpack ( data[3:6] );
this.ev.id.data_unpack ( data[6:9] ); this.ev.seq = data[7];
this.ev.seq = data[10]; this.ev.flags = data[8];
this.ev.flags = data[11]; this.enabled = data[9];
this.enabled = data[12]; this.repeat_count = data[10];
this.repeat_count = data[13]; this.period_ns = data[11];
this.period_ns = data[14];
endfunction // data_unpack endfunction // data_unpack
endclass //WrtdAlarm endclass //WrtdAlarm
......
...@@ -37,8 +37,8 @@ ...@@ -37,8 +37,8 @@
`define WRTD_IO_MSG_WORD_SIZE 2 `define WRTD_IO_MSG_WORD_SIZE 2
`define WRTD_CFG_MSG_WORD_SIZE 5 `define WRTD_CFG_MSG_WORD_SIZE 5
`define WRTD_ROOT_WORD_SIZE 12 `define WRTD_ROOT_WORD_SIZE 12
`define WRTD_RULE_WORD_SIZE 40 `define WRTD_RULE_WORD_SIZE 43
`define WRTD_ALRM_WORD_SIZE 15 `define WRTD_ALRM_WORD_SIZE 12
`define WRTD_DEST_CPU_LOCAL 'hfe `define WRTD_DEST_CPU_LOCAL 'hfe
`define WRTD_DEST_CH_NET 'hff `define WRTD_DEST_CH_NET 'hff
...@@ -83,6 +83,7 @@ typedef enum uint32_t { ...@@ -83,6 +83,7 @@ typedef enum uint32_t {
typedef enum uint32_t { typedef enum uint32_t {
WRTD_LOG_DISCARD_NO_SYNC = 1, WRTD_LOG_DISCARD_NO_SYNC = 1,
WRTD_LOG_DISCARD_HOLDOFF,
WRTD_LOG_DISCARD_TIMEOUT, WRTD_LOG_DISCARD_TIMEOUT,
WRTD_LOG_DISCARD_OVERFLOW WRTD_LOG_DISCARD_OVERFLOW
} wrtd_log_dsc_reason; } wrtd_log_dsc_reason;
......
...@@ -37,18 +37,21 @@ class WrtdRule extends WrtdRepCap; ...@@ -37,18 +37,21 @@ class WrtdRule extends WrtdRepCap;
protected uint32_t delay_ns; protected uint32_t delay_ns;
protected uint32_t hold_off_ns; protected uint32_t hold_off_ns;
protected uint32_t resync_period_ns; protected uint32_t resync_period_ns;
protected uint32_t resync_delay_ns; protected uint32_t resync_factor;
int hash_chain; int hash_chain;
protected uint32_t rx_events; protected uint32_t rx_events;
protected WrtdTstamp rx_last; protected WrtdTstamp rx_last;
protected uint32_t tx_events; protected uint32_t tx_events;
protected WrtdTstamp tx_last; protected WrtdTstamp tx_last;
protected uint32_t lat_min_ns;
protected uint32_t lat_max_ns; protected uint32_t lat_max_ns;
protected uint32_t lat_lo_ns; protected uint32_t lat_lo_ns;
protected uint32_t lat_hi_ns; protected uint32_t lat_hi_ns;
protected uint32_t lat_nbr; protected uint32_t lat_nbr;
protected uint32_t miss_holdoff; protected uint32_t miss_holdoff;
protected uint32_t miss_late; protected uint32_t miss_late;
protected uint32_t miss_nosync;
protected uint32_t miss_overflow;
protected WrtdTstamp miss_last; protected WrtdTstamp miss_last;
protected WrtdTstamp hold_off; protected WrtdTstamp hold_off;
protected uint32_t seq; protected uint32_t seq;
...@@ -79,7 +82,7 @@ class WrtdRule extends WrtdRepCap; ...@@ -79,7 +82,7 @@ class WrtdRule extends WrtdRepCap;
this.delay_ns = 0; this.delay_ns = 0;
this.hold_off_ns = 0; this.hold_off_ns = 0;
this.resync_period_ns = 0; this.resync_period_ns = 0;
this.resync_delay_ns = 0; this.resync_factor = 0;
this.hash_chain = -1; this.hash_chain = -1;
endfunction // clear endfunction // clear
...@@ -96,21 +99,24 @@ class WrtdRule extends WrtdRepCap; ...@@ -96,21 +99,24 @@ class WrtdRule extends WrtdRepCap;
ret[14] = this.delay_ns; ret[14] = this.delay_ns;
ret[15] = this.hold_off_ns; ret[15] = this.hold_off_ns;
ret[16] = this.resync_period_ns; ret[16] = this.resync_period_ns;
ret[17] = this.resync_delay_ns; ret[17] = this.resync_factor;
ret[18] = this.hash_chain; ret[18] = this.hash_chain;
ret[19] = this.rx_events; ret[19] = this.rx_events;
ret[20:22] = this.rx_last.data_pack(); ret[20:22] = this.rx_last.data_pack();
ret[23] = this.tx_events; ret[23] = this.tx_events;
ret[24:26] = this.tx_last.data_pack(); ret[24:26] = this.tx_last.data_pack();
ret[27] = this.lat_max_ns; ret[27] = this.lat_min_ns;
ret[28] = this.lat_lo_ns; ret[28] = this.lat_max_ns;
ret[29] = this.lat_hi_ns; ret[29] = this.lat_lo_ns;
ret[30] = this.lat_nbr; ret[30] = this.lat_hi_ns;
ret[31] = this.miss_holdoff; ret[31] = this.lat_nbr;
ret[32] = this.miss_late; ret[32] = this.miss_holdoff;
ret[33:35] = this.miss_last.data_pack(); ret[33] = this.miss_late;
ret[36:38] = this.hold_off.data_pack(); ret[34] = this.miss_nosync;
ret[39] = this.seq; ret[35] = this.miss_overflow;
ret[36:38] = this.miss_last.data_pack();
ret[39:41] = this.hold_off.data_pack();
ret[42] = this.seq;
return ret; return ret;
endfunction // data_pack endfunction // data_pack
...@@ -126,21 +132,24 @@ class WrtdRule extends WrtdRepCap; ...@@ -126,21 +132,24 @@ class WrtdRule extends WrtdRepCap;
this.delay_ns = data[14]; this.delay_ns = data[14];
this.hold_off_ns = data[15]; this.hold_off_ns = data[15];
this.resync_period_ns = data[16]; this.resync_period_ns = data[16];
this.resync_delay_ns = data[17]; this.resync_factor = data[17];
this.hash_chain = data[18]; this.hash_chain = data[18];
this.rx_events = data[19]; this.rx_events = data[19];
this.rx_last.data_unpack ( data[20:22] ); this.rx_last.data_unpack ( data[20:22] );
this.tx_events = data[23]; this.tx_events = data[23];
this.tx_last.data_unpack ( data[24:26] ); this.tx_last.data_unpack ( data[24:26] );
this.lat_max_ns = data[27]; this.lat_min_ns = data[27];
this.lat_lo_ns = data[28]; this.lat_max_ns = data[28];
this.lat_hi_ns = data[29]; this.lat_lo_ns = data[29];
this.lat_nbr = data[30]; this.lat_hi_ns = data[30];
this.miss_holdoff = data[31]; this.lat_nbr = data[31];
this.miss_late = data[32]; this.miss_holdoff = data[32];
this.miss_last.data_unpack ( data[33:35] ); this.miss_late = data[33];
this.hold_off.data_unpack ( data[36:38] ); this.miss_nosync = data[34];
this.seq = data[39]; this.miss_overflow = data[35];
this.miss_last.data_unpack ( data[36:38] );
this.hold_off.data_unpack ( data[39:41] );
this.seq = data[42];
endfunction // data_unpack endfunction // data_unpack
function string get_src ( ); function string get_src ( );
......
...@@ -94,7 +94,8 @@ static void adcin_input(struct wrtd_adcin_dev *adcin) ...@@ -94,7 +94,8 @@ static void adcin_input(struct wrtd_adcin_dev *adcin)
ev.flags = 0; ev.flags = 0;
wrtd_log(WRTD_LOG_MSG_EV_GENERATED, wrtd_log(WRTD_LOG_MSG_EV_GENERATED,
WRTD_LOG_GENERATED_DEVICE + (i * 8), &ev, NULL); WRTD_LOG_GENERATED_DEVICE + (i * 8),
NULL, &ev, NULL);
/* Pass to wrtd. */ /* Pass to wrtd. */
wrtd_route_in(&ev); wrtd_route_in(&ev);
......
...@@ -93,7 +93,7 @@ static void adcout_drop_trigger(struct wrtd_adcout_dev *dev, ...@@ -93,7 +93,7 @@ static void adcout_drop_trigger(struct wrtd_adcout_dev *dev,
/* Disarm the ADC output */ /* Disarm the ADC output */
adcout_writel(dev, 0, ALT_TRIGIN_CTRL); adcout_writel(dev, 0, ALT_TRIGIN_CTRL);
wrtd_log(WRTD_LOG_MSG_EV_DISCARDED, reason, ev, now); wrtd_log(WRTD_LOG_MSG_EV_DISCARDED, reason, NULL, ev, now);
} }
...@@ -127,7 +127,9 @@ static void adcout_output (struct wrtd_adcout_dev *dev) ...@@ -127,7 +127,9 @@ static void adcout_output (struct wrtd_adcout_dev *dev)
} }
} else { } else {
/* Has been triggered. */ /* Has been triggered. */
wrtd_log(WRTD_LOG_MSG_EV_CONSUMED, WRTD_LOG_CONSUMED_DONE, ev, NULL); wrtd_log(WRTD_LOG_MSG_EV_CONSUMED,
WRTD_LOG_CONSUMED_DONE,
NULL, ev, NULL);
adcout_out_queue_pop(q); adcout_out_queue_pop(q);
dev->idle = 1; dev->idle = 1;
...@@ -153,7 +155,8 @@ static void adcout_output (struct wrtd_adcout_dev *dev) ...@@ -153,7 +155,8 @@ static void adcout_output (struct wrtd_adcout_dev *dev)
adcout_writel(dev, ts->ns / 8, ALT_TRIGIN_CYCLES); adcout_writel(dev, ts->ns / 8, ALT_TRIGIN_CYCLES);
adcout_writel(dev, ALT_TRIGIN_CTRL_ENABLE, ALT_TRIGIN_CTRL); adcout_writel(dev, ALT_TRIGIN_CTRL_ENABLE, ALT_TRIGIN_CTRL);
wrtd_log(WRTD_LOG_MSG_EV_CONSUMED, WRTD_LOG_CONSUMED_START, ev, NULL); wrtd_log(WRTD_LOG_MSG_EV_CONSUMED, WRTD_LOG_CONSUMED_START,
NULL, ev, NULL);
ts_add2_ns (ts, 8000); ts_add2_ns (ts, 8000);
...@@ -166,21 +169,19 @@ static void adcout_output (struct wrtd_adcout_dev *dev) ...@@ -166,21 +169,19 @@ static void adcout_output (struct wrtd_adcout_dev *dev)
dev->idle = 0; dev->idle = 0;
} }
static void adcout_local_output(struct wrtd_adcout_dev *dev, static int adcout_local_output(struct wrtd_adcout_dev *dev,
struct wrtd_event *ev, unsigned ch) struct wrtd_event *ev, unsigned ch)
{ {
struct wrtd_event *pq_ev; struct wrtd_event *pq_ev;
pq_ev = adcout_out_queue_push(&dev->queue); pq_ev = adcout_out_queue_push(&dev->queue);
if (!pq_ev) { if (!pq_ev) {
/* overflow. return -EOVERFLOW;
FIXME: stats ? */
wrtd_log(WRTD_LOG_MSG_EV_DISCARDED, WRTD_LOG_DISCARD_OVERFLOW,
ev, NULL);
return;
} }
*pq_ev = *ev; *pq_ev = *ev;
return 0;
} }
static void adcout_init(struct wrtd_adcout_dev *dev) static void adcout_init(struct wrtd_adcout_dev *dev)
......
...@@ -92,10 +92,9 @@ static inline int wr_sync_timeout(void) ...@@ -92,10 +92,9 @@ static inline int wr_sync_timeout(void)
#endif #endif
} }
static void wrtd_local_output(struct wrtd_event *ev, unsigned ch) static int wrtd_local_output(struct wrtd_event *ev, unsigned ch)
{ {
adcout_local_output(&adcout0, ev, ch); return adcout_local_output(&adcout0, ev, ch);
return;
} }
static int wrtd_user_init(void) static int wrtd_user_init(void)
......
...@@ -29,8 +29,8 @@ static int wr_link_up(void); ...@@ -29,8 +29,8 @@ static int wr_link_up(void);
static int wr_time_locked(void); static int wr_time_locked(void);
static int wr_time_ready(void); static int wr_time_ready(void);
static void wr_enable_lock(int enable); static void wr_enable_lock(int enable);
static int wrtd_local_output(struct wrtd_event *ev, unsigned ch);
static int wr_sync_timeout(void); static int wr_sync_timeout(void);
static void wrtd_local_output(struct wrtd_event *ev, unsigned ch);
static int wrtd_user_init(void); static int wrtd_user_init(void);
static void wrtd_io(void); static void wrtd_io(void);
...@@ -136,14 +136,13 @@ struct loopback_queue { ...@@ -136,14 +136,13 @@ struct loopback_queue {
SMEM struct loopback_queue lqueues[NBR_CPUS]; SMEM struct loopback_queue lqueues[NBR_CPUS];
static void wrtd_remote_output(struct wrtd_event *ev, static int wrtd_remote_output(struct wrtd_event *ev,
unsigned dest_cpu, unsigned ch) unsigned dest_cpu, unsigned ch)
{ {
volatile struct loopback_queue *q = &lqueues[dest_cpu]; volatile struct loopback_queue *q = &lqueues[dest_cpu];
if (q->count >= LOOPBACK_QUEUE_SIZE) { if (q->count >= LOOPBACK_QUEUE_SIZE) {
/* FIXME: log. */ return -EOVERFLOW;
return;
} }
/* Get lock. */ /* Get lock. */
...@@ -158,8 +157,10 @@ static void wrtd_remote_output(struct wrtd_event *ev, ...@@ -158,8 +157,10 @@ static void wrtd_remote_output(struct wrtd_event *ev,
q->buf[q->write_idx].ev = *ev; q->buf[q->write_idx].ev = *ev;
q->buf[q->write_idx].ch = ch; q->buf[q->write_idx].ch = ch;
q->write_idx = (q->write_idx + 1) & (LOOPBACK_QUEUE_SIZE - 1); q->write_idx = (q->write_idx + 1) & (LOOPBACK_QUEUE_SIZE - 1);
smem_atomic_add(&q->count, 1); smem_atomic_add(&q->count, 1);
q->lock = 0; q->lock = 0;
return 0;
} }
static void wrtd_recv_loopback(void) static void wrtd_recv_loopback(void)
...@@ -234,12 +235,35 @@ static void ts_now(struct wrtd_tstamp *now) ...@@ -234,12 +235,35 @@ static void ts_now(struct wrtd_tstamp *now)
} }
static void wrtd_log(uint32_t type, uint32_t reason, static void wrtd_log(uint32_t type, uint32_t reason,
struct wrtd_rule *rule,
const struct wrtd_event *ev, const struct wrtd_event *ev,
const struct wrtd_tstamp *ts) const struct wrtd_tstamp *ts)
{ {
struct wrtd_log_entry *log; struct wrtd_log_entry *log;
struct trtl_fw_msg msg; struct trtl_fw_msg msg;
int ret; struct wrtd_tstamp now;
int ret;
/* First, handle statistics */
if ((type == WRTD_LOG_MSG_EV_DISCARDED) && (rule != NULL)) {
rule->stat.miss_last = ev->ts;
switch (reason) {
case WRTD_LOG_DISCARD_NO_SYNC:
rule->stat.miss_nosync++;
break;
case WRTD_LOG_DISCARD_HOLDOFF:
rule->stat.miss_holdoff++;
break;
case WRTD_LOG_DISCARD_TIMEOUT:
rule->stat.miss_late++;
break;
case WRTD_LOG_DISCARD_OVERFLOW:
rule->stat.miss_overflow++;
break;
default:
break;
}
}
if (!(root.log_flags & (1 << type))) { if (!(root.log_flags & (1 << type))) {
root.log_nbr_discarded++; root.log_nbr_discarded++;
...@@ -252,7 +276,12 @@ static void wrtd_log(uint32_t type, uint32_t reason, ...@@ -252,7 +276,12 @@ static void wrtd_log(uint32_t type, uint32_t reason,
return; return;
} }
mq_map_out_message(TRTL_HMQ, WRTD_HMQ, &msg); if ( ts == NULL )
ts_now(&now);
else
now = *ts;
mq_map_out_message(TRTL_HMQ, WRTD_HMQ, &msg);
msg.header->flags = 0; msg.header->flags = 0;
msg.header->msg_id = WRTD_ACTION_LOG; msg.header->msg_id = WRTD_ACTION_LOG;
...@@ -265,11 +294,10 @@ static void wrtd_log(uint32_t type, uint32_t reason, ...@@ -265,11 +294,10 @@ static void wrtd_log(uint32_t type, uint32_t reason,
log->event = *ev; log->event = *ev;
else else
memset(&log->event, 0, sizeof(struct wrtd_event)); memset(&log->event, 0, sizeof(struct wrtd_event));
if (ts != NULL)
log->ts = *ts; log->ts = now;
else
memset(&log->ts, 0, sizeof(struct wrtd_tstamp)); mq_send(TRTL_HMQ, WRTD_HMQ);
mq_send(TRTL_HMQ, WRTD_HMQ);
root.log_nbr_sent++; root.log_nbr_sent++;
} }
...@@ -290,16 +318,14 @@ static void wrtd_init_tx(void) ...@@ -290,16 +318,14 @@ static void wrtd_init_tx(void)
rmq_bind_out(WRTD_RMQ, TRTL_EP_ETH, &addr); rmq_bind_out(WRTD_RMQ, TRTL_EP_ETH, &addr);
} }
static void wrtd_send_network(struct wrtd_event *ev) static int wrtd_send_network(struct wrtd_event *ev)
{ {
int ret; int ret;
struct trtl_fw_msg fw_msg; struct trtl_fw_msg fw_msg;
ret = mq_claim(TRTL_RMQ, WRTD_RMQ); ret = mq_claim(TRTL_RMQ, WRTD_RMQ);
if (ret < 0) { if (ret < 0) {
/* FIXME: log ? */ return -EOVERFLOW;
pr_error("RMQ full\n\r");
return;
} }
mq_map_out_message(TRTL_RMQ, WRTD_RMQ, &fw_msg); mq_map_out_message(TRTL_RMQ, WRTD_RMQ, &fw_msg);
...@@ -325,9 +351,11 @@ static void wrtd_send_network(struct wrtd_event *ev) ...@@ -325,9 +351,11 @@ static void wrtd_send_network(struct wrtd_event *ev)
msg->zero[1] = 0; msg->zero[1] = 0;
msg->pad[0] = 0; msg->pad[0] = 0;
mq_send(TRTL_RMQ, WRTD_RMQ); mq_send(TRTL_RMQ, WRTD_RMQ);
wrtd_log(WRTD_LOG_MSG_EV_NETWORK, WRTD_LOG_NETWORK_TX, NULL, ev, NULL);
wrtd_log(WRTD_LOG_MSG_EV_NETWORK, WRTD_LOG_NETWORK_TX, ev, NULL); return 0;
} }
#endif #endif
...@@ -346,9 +374,9 @@ static void wrtd_route(struct wrtd_rule *rule, const struct wrtd_event *ev) ...@@ -346,9 +374,9 @@ static void wrtd_route(struct wrtd_rule *rule, const struct wrtd_event *ev)
one. */ one. */
if (rule->conf.hold_off_ns) { if (rule->conf.hold_off_ns) {
if (ts_cmp(&ev->ts, &rule->stat.hold_off) < 0) { if (ts_cmp(&ev->ts, &rule->stat.hold_off) < 0) {
rule->stat.miss_holdoff++; wrtd_log(WRTD_LOG_MSG_EV_DISCARDED,
rule->stat.miss_last = ev->ts; WRTD_LOG_DISCARD_HOLDOFF,
wrtd_log(WRTD_LOG_MSG_EV_DISCARDED, 0, ev, NULL); rule, ev, NULL);
return; return;
} }
...@@ -396,8 +424,11 @@ static void wrtd_route(struct wrtd_rule *rule, const struct wrtd_event *ev) ...@@ -396,8 +424,11 @@ static void wrtd_route(struct wrtd_rule *rule, const struct wrtd_event *ev)
if (r != 0) if (r != 0)
ts_add2_ns(&tev.ts, rule->conf.resync_period_ns - r); ts_add2_ns(&tev.ts, rule->conf.resync_period_ns - r);
tev.ts.frac = 0; tev.ts.frac = 0;
if (rule->conf.resync_factor)
ts_add2_ns(&tev.ts,
rule->conf.resync_period_ns *
rule->conf.resync_factor);
} }
ts_add2_ns(&tev.ts, rule->conf.resync_delay_ns);
/* Check with current time. */ /* Check with current time. */
if (!rule->conf.send_late) { if (!rule->conf.send_late) {
...@@ -405,9 +436,9 @@ static void wrtd_route(struct wrtd_rule *rule, const struct wrtd_event *ev) ...@@ -405,9 +436,9 @@ static void wrtd_route(struct wrtd_rule *rule, const struct wrtd_event *ev)
|| (tev.ts.seconds == now.seconds || (tev.ts.seconds == now.seconds
&& tev.ts.ns < now.ns)) { && tev.ts.ns < now.ns)) {
/* Too late... */ /* Too late... */
rule->stat.miss_late++; wrtd_log(WRTD_LOG_MSG_EV_DISCARDED,
rule->stat.miss_last = ev->ts; WRTD_LOG_DISCARD_TIMEOUT,
wrtd_log(WRTD_LOG_MSG_EV_DISCARDED, 0, ev, &now); rule, ev, &now);
return; return;
} }
} }
...@@ -423,29 +454,45 @@ static void wrtd_route(struct wrtd_rule *rule, const struct wrtd_event *ev) ...@@ -423,29 +454,45 @@ static void wrtd_route(struct wrtd_rule *rule, const struct wrtd_event *ev)
memcpy(tev.id, rule->conf.dest_id, WRTD_ID_LEN); memcpy(tev.id, rule->conf.dest_id, WRTD_ID_LEN);
tev.seq = rule->stat.seq++; tev.seq = rule->stat.seq++;
/* Send. */ uint32_t res = 0;
rule->stat.tx_events++;
rule->stat.tx_last = ev->ts; /* Check timing. */
if (!wr_is_timing_ok()) {
wrtd_log(WRTD_LOG_MSG_EV_DISCARDED,
WRTD_LOG_DISCARD_NO_SYNC,
rule, ev, &now);
return;
}
/* Send. */
if (rule->conf.dest_ch == WRTD_DEST_CH_NET) { if (rule->conf.dest_ch == WRTD_DEST_CH_NET) {
#if WRTD_NET_TX > 0 #if WRTD_NET_TX > 0
wrtd_send_network(&tev); res = wrtd_send_network(&tev);
#else #else
wrtd_remote_output res = wrtd_remote_output
(&tev, rule->conf.dest_cpu, WRTD_DEST_CH_NET); (&tev, rule->conf.dest_cpu, WRTD_DEST_CH_NET);
#endif #endif
} }
else { else {
if (rule->conf.dest_cpu != WRTD_DEST_CPU_LOCAL) { if (rule->conf.dest_cpu != WRTD_DEST_CPU_LOCAL) {
#if NBR_CPUS > 1 #if NBR_CPUS > 1
wrtd_remote_output res = wrtd_remote_output
(&tev, rule->conf.dest_cpu, rule->conf.dest_ch); (&tev, rule->conf.dest_cpu, rule->conf.dest_ch);
#endif #endif
} else { } else {
/* Local delivery. */ /* Local delivery. */
wrtd_local_output(&tev, rule->conf.dest_ch); res = wrtd_local_output(&tev, rule->conf.dest_ch);
} }
} }
if (res == -EOVERFLOW) {
wrtd_log(WRTD_LOG_MSG_EV_DISCARDED,
WRTD_LOG_DISCARD_OVERFLOW,
rule, ev, &now);
}
else if (res == 0) {
rule->stat.tx_events++;
rule->stat.tx_last = ev->ts;
}
} }
#if WRTD_LOCAL_RX > 0 || WRTD_NET_RX > 0 || NBR_ALARMS > 0 #if WRTD_LOCAL_RX > 0 || WRTD_NET_RX > 0 || NBR_ALARMS > 0
...@@ -507,11 +554,10 @@ static void wrtd_recv_network(void) ...@@ -507,11 +554,10 @@ static void wrtd_recv_network(void)
mq_discard(TRTL_RMQ, WRTD_RMQ); mq_discard(TRTL_RMQ, WRTD_RMQ);
wrtd_log(WRTD_LOG_MSG_EV_NETWORK, WRTD_LOG_NETWORK_RX, &ev, NULL); wrtd_log(WRTD_LOG_MSG_EV_NETWORK, WRTD_LOG_NETWORK_RX, NULL, &ev, NULL);
wrtd_route_in(&ev); wrtd_route_in(&ev);
/* FIXME: counter ? */
} }
#endif #endif
...@@ -530,11 +576,11 @@ static void wrtd_alarms(void) ...@@ -530,11 +576,11 @@ static void wrtd_alarms(void)
if (!al->enabled) if (!al->enabled)
continue; continue;
if (ts_cmp(&al->setup_time, &now) > 0) if (ts_cmp(&al->event.ts, &now) > 0)
continue; continue;
wrtd_log(WRTD_LOG_MSG_EV_GENERATED, WRTD_LOG_GENERATED_ALARM, wrtd_log(WRTD_LOG_MSG_EV_GENERATED, WRTD_LOG_GENERATED_ALARM,
&al->event, &now); NULL, &al->event, &now);
/* Trigger. */ /* Trigger. */
wrtd_route_in(&al->event); wrtd_route_in(&al->event);
...@@ -553,7 +599,6 @@ static void wrtd_alarms(void) ...@@ -553,7 +599,6 @@ static void wrtd_alarms(void)
continue; continue;
} }
ts_add2_ns(&al->event.ts, al->period_ns); ts_add2_ns(&al->event.ts, al->period_ns);
ts_add2_ns(&al->setup_time, al->period_ns);
} }
} }
#endif #endif
......
...@@ -184,7 +184,7 @@ static void drop_trigger(struct wrtd_fd_channel *out, ...@@ -184,7 +184,7 @@ static void drop_trigger(struct wrtd_fd_channel *out,
/* Disarm the FD output */ /* Disarm the FD output */
fd_ch_writel(out, FD_DCR_MODE, FD_REG_DCR); fd_ch_writel(out, FD_DCR_MODE, FD_REG_DCR);
wrtd_log(WRTD_LOG_MSG_EV_DISCARDED, reason, ev, NULL); wrtd_log(WRTD_LOG_MSG_EV_DISCARDED, reason, NULL, ev, NULL);
} }
...@@ -217,7 +217,8 @@ static void fd_output (struct wrtd_fd_dev *fd, unsigned channel) ...@@ -217,7 +217,8 @@ static void fd_output (struct wrtd_fd_dev *fd, unsigned channel)
} else { } else {
/* Has been triggered. */ /* Has been triggered. */
wrtd_log(WRTD_LOG_MSG_EV_CONSUMED, wrtd_log(WRTD_LOG_MSG_EV_CONSUMED,
WRTD_LOG_CONSUMED_DONE, ev, NULL); WRTD_LOG_CONSUMED_DONE,
NULL, ev, NULL);
pulse_queue_pop(q); pulse_queue_pop(q);
out->idle = 1; out->idle = 1;
...@@ -256,7 +257,8 @@ static void fd_output (struct wrtd_fd_dev *fd, unsigned channel) ...@@ -256,7 +257,8 @@ static void fd_output (struct wrtd_fd_dev *fd, unsigned channel)
fd_ch_writel(out, FD_DCR_MODE | FD_DCR_PG_ARM | FD_DCR_ENABLE, fd_ch_writel(out, FD_DCR_MODE | FD_DCR_PG_ARM | FD_DCR_ENABLE,
FD_REG_DCR); FD_REG_DCR);
wrtd_log(WRTD_LOG_MSG_EV_CONSUMED, WRTD_LOG_CONSUMED_START, ev, NULL); wrtd_log(WRTD_LOG_MSG_EV_CONSUMED, WRTD_LOG_CONSUMED_START,
NULL, ev, NULL);
ts_add2_ns (ts, 8000); ts_add2_ns (ts, 8000);
...@@ -269,22 +271,20 @@ static void fd_output (struct wrtd_fd_dev *fd, unsigned channel) ...@@ -269,22 +271,20 @@ static void fd_output (struct wrtd_fd_dev *fd, unsigned channel)
out->idle = 0; out->idle = 0;
} }
static void fd_local_output(struct wrtd_fd_dev *fd, static int fd_local_output(struct wrtd_fd_dev *fd,
struct wrtd_event *ev, unsigned ch) struct wrtd_event *ev, unsigned ch)
{ {
struct wrtd_fd_channel *out = &fd->channels[ch]; struct wrtd_fd_channel *out = &fd->channels[ch];
struct wrtd_event *pq_ev; struct wrtd_event *pq_ev;
pq_ev = pulse_queue_push(&out->queue); pq_ev = pulse_queue_push(&out->queue);
if (!pq_ev) { if (!pq_ev) {
/* overflow. return -EOVERFLOW;
FIXME: stats ? */
wrtd_log(WRTD_LOG_MSG_EV_DISCARDED, WRTD_LOG_DISCARD_OVERFLOW,
ev, NULL);
return;
} }
*pq_ev = *ev; *pq_ev = *ev;
return 0;
} }
static void fd_outputs(struct wrtd_fd_dev *fd) static void fd_outputs(struct wrtd_fd_dev *fd)
......
...@@ -64,9 +64,9 @@ static inline int wr_sync_timeout(void) ...@@ -64,9 +64,9 @@ static inline int wr_sync_timeout(void)
#endif #endif
} }
static void wrtd_local_output(struct wrtd_event *ev, unsigned ch) static int wrtd_local_output(struct wrtd_event *ev, unsigned ch)
{ {
fd_local_output(&fd0, ev, ch); return fd_local_output(&fd0, ev, ch);
} }
/** /**
......
...@@ -65,10 +65,10 @@ static inline int wr_sync_timeout(void) ...@@ -65,10 +65,10 @@ static inline int wr_sync_timeout(void)
#endif #endif
} }
static void wrtd_local_output(struct wrtd_event *ev, unsigned ch) static int wrtd_local_output(struct wrtd_event *ev, unsigned ch)
{ {
/* No output. */ /* No output. */
return; return 0;
} }
static int wrtd_user_init(void) static int wrtd_user_init(void)
......
...@@ -274,7 +274,8 @@ static void tdc_input(struct wrtd_tdc_dev *tdc) ...@@ -274,7 +274,8 @@ static void tdc_input(struct wrtd_tdc_dev *tdc)
ev.flags = 0; ev.flags = 0;
wrtd_log(WRTD_LOG_MSG_EV_GENERATED, wrtd_log(WRTD_LOG_MSG_EV_GENERATED,
WRTD_LOG_GENERATED_DEVICE + (channel * 8), &ev, NULL); WRTD_LOG_GENERATED_DEVICE + (channel * 8),
NULL, &ev, NULL);
/* Pass to wrtd. */ /* Pass to wrtd. */
wrtd_route_in(&ev); wrtd_route_in(&ev);
......
...@@ -85,7 +85,7 @@ struct wrtd_rule_config { ...@@ -85,7 +85,7 @@ struct wrtd_rule_config {
uint32_t hold_off_ns; uint32_t hold_off_ns;
uint32_t resync_period_ns; uint32_t resync_period_ns;
uint32_t resync_delay_ns; uint32_t resync_factor;
/* Next rule id for the same hash; -1 for last. */ /* Next rule id for the same hash; -1 for last. */
int32_t hash_chain; int32_t hash_chain;
...@@ -99,6 +99,7 @@ struct wrtd_rule_stats { ...@@ -99,6 +99,7 @@ struct wrtd_rule_stats {
struct wrtd_tstamp tx_last; struct wrtd_tstamp tx_last;
/* Latency. */ /* Latency. */
uint32_t lat_min_ns;
uint32_t lat_max_ns; uint32_t lat_max_ns;
uint32_t lat_lo_ns; uint32_t lat_lo_ns;
uint32_t lat_hi_ns; uint32_t lat_hi_ns;
...@@ -106,6 +107,8 @@ struct wrtd_rule_stats { ...@@ -106,6 +107,8 @@ struct wrtd_rule_stats {
uint32_t miss_holdoff; uint32_t miss_holdoff;
uint32_t miss_late; uint32_t miss_late;
uint32_t miss_nosync;
uint32_t miss_overflow;
struct wrtd_tstamp miss_last; struct wrtd_tstamp miss_last;
/* Events that occur before this time are discarded. */ /* Events that occur before this time are discarded. */
...@@ -121,9 +124,6 @@ struct wrtd_rule { ...@@ -121,9 +124,6 @@ struct wrtd_rule {
}; };
struct wrtd_alarm { struct wrtd_alarm {
/* Time when to generate the event. */
struct wrtd_tstamp setup_time;
/* Next time and id. */ /* Next time and id. */
struct wrtd_event event; struct wrtd_event event;
...@@ -256,6 +256,8 @@ enum wrtd_log_reason_type { ...@@ -256,6 +256,8 @@ enum wrtd_log_reason_type {
/* For DISCARDED: */ /* For DISCARDED: */
/* Not synchronized. */ /* Not synchronized. */
WRTD_LOG_DISCARD_NO_SYNC = 1, WRTD_LOG_DISCARD_NO_SYNC = 1,
/* Hold-off violation. */
WRTD_LOG_DISCARD_HOLDOFF,
/* Timeout: event after time. */ /* Timeout: event after time. */
WRTD_LOG_DISCARD_TIMEOUT, WRTD_LOG_DISCARD_TIMEOUT,
/* No space in a queue. */ /* No space in a queue. */
......
This diff is collapsed.
...@@ -7,6 +7,16 @@ ...@@ -7,6 +7,16 @@
#define WRTD_RETURN_IF_ERROR(status) if(status != WRTD_SUCCESS) return status #define WRTD_RETURN_IF_ERROR(status) if(status != WRTD_SUCCESS) return status
/* Add nanoseconds to an existing wrtd timestamp */
static inline void wrtd_ts_add_ns(struct wrtd_tstamp *ts, uint32_t ns)
{
ts->ns += ns;
while (ts->ns >= 1000000000) {
ts->ns -= 1000000000;
ts->seconds++;
}
}
/* Alarm when in user space. */ /* Alarm when in user space. */
struct wrtd_lib_alarm { struct wrtd_lib_alarm {
/* CPU on which the alarm is. */ /* CPU on which the alarm is. */
...@@ -136,7 +146,7 @@ enum wrtd_status wrtd_fill_rules(struct wrtd_dev *wrtd); ...@@ -136,7 +146,7 @@ enum wrtd_status wrtd_fill_rules(struct wrtd_dev *wrtd);
/* Count number of rules. */ /* Count number of rules. */
enum wrtd_status wrtd_attr_get_rule_count(struct wrtd_dev *wrtd, enum wrtd_status wrtd_attr_get_rule_count(struct wrtd_dev *wrtd,
unsigned *value); int32_t *value);
/* Reconfigure route tables and write-back rules. */ /* Reconfigure route tables and write-back rules. */
enum wrtd_status wrtd_reconfigure(struct wrtd_dev *wrtd); enum wrtd_status wrtd_reconfigure(struct wrtd_dev *wrtd);
......
...@@ -45,10 +45,12 @@ static enum wrtd_status wrtd_reconfigure_alloc_map(struct wrtd_dev *wrtd, ...@@ -45,10 +45,12 @@ static enum wrtd_status wrtd_reconfigure_alloc_map(struct wrtd_dev *wrtd,
unsigned n; unsigned n;
unsigned i; unsigned i;
unsigned ch_in_idx, ch_out_idx; unsigned ch_in_idx, ch_out_idx;
int32_t nrules;
/* 1. Count number of rules. */ /* 1. Count number of rules. */
status = wrtd_attr_get_rule_count(wrtd, &map->nbr_rules); status = wrtd_attr_get_rule_count(wrtd, &nrules);
WRTD_RETURN_IF_ERROR(status); WRTD_RETURN_IF_ERROR(status);
map->nbr_rules = nrules;
/* Count number of devices. */ /* Count number of devices. */
n = 0; n = 0;
......
...@@ -77,12 +77,12 @@ enum wrtd_status { ...@@ -77,12 +77,12 @@ enum wrtd_status {
*/ */
enum wrtd_attr { enum wrtd_attr {
__WRTD_ATTR_BASE = 950000, __WRTD_ATTR_BASE = 950000,
WRTD_MAJOR_VERSION, // RO, int32 WRTD_MAJOR_VERSION, // RO, int32
WRTD_MINOR_VERSION, // RO, int32 WRTD_MINOR_VERSION, // RO, int32
WRTD_ATTR_EVENT_LOG_ENTRY_COUNT, // RO, int32 WRTD_ATTR_EVENT_LOG_EMPTY, // RO, bool
WRTD_ATTR_EVENT_LOG_ENABLED, //RW, bool WRTD_ATTR_EVENT_LOG_ENABLED, //RW, bool
// TODO: add log levels/masks here // TODO: WRTD_ATTR_IS_TIME_MASTER, // RO, bool
WRTD_ATTR_IS_TIME_MASTER, // RO, bool
WRTD_ATTR_IS_TIME_SYNCHRONIZED, // RO, bool WRTD_ATTR_IS_TIME_SYNCHRONIZED, // RO, bool
// Number of alarms (global attribute). // Number of alarms (global attribute).
...@@ -91,7 +91,7 @@ enum wrtd_attr { ...@@ -91,7 +91,7 @@ enum wrtd_attr {
// Enable/disable an alarm. // Enable/disable an alarm.
WRTD_ATTR_ALARM_ENABLED, //RW, bool WRTD_ATTR_ALARM_ENABLED, //RW, bool
// Specifies at what time to trigger the alarm // Specifies at what time to trigger the alarm
WRTD_ATTR_ALARM_SETUP_TIME, //RW, tstamp WRTD_ATTR_ALARM_TIME, //RW, tstamp
// Specifies the alarm period. 0 means no repetitions. // Specifies the alarm period. 0 means no repetitions.
WRTD_ATTR_ALARM_PERIOD, //RW, tstamp WRTD_ATTR_ALARM_PERIOD, //RW, tstamp
// Specifies the number of times the alarm will occur at the period specified by // Specifies the number of times the alarm will occur at the period specified by
...@@ -122,24 +122,21 @@ enum wrtd_attr { ...@@ -122,24 +122,21 @@ enum wrtd_attr {
WRTD_ATTR_RULE_RESYNC_PERIOD, //RW, tstamp WRTD_ATTR_RULE_RESYNC_PERIOD, //RW, tstamp
WRTD_ATTR_RULE_RESYNC_FACTOR, //RW, int32 WRTD_ATTR_RULE_RESYNC_FACTOR, //RW, int32
// TODO: add __ boundaries between groups to make it easier /* Statistics */
// to do input validation
WRTD_ATTR_STAT_RULE_RX_EVENTS, //RO, int32 WRTD_ATTR_STAT_RULE_RX_EVENTS, //RO, int32
WRTD_ATTR_STAT_RULE_RX_LAST, //RO, tstamp WRTD_ATTR_STAT_RULE_RX_LAST, //RO, tstamp
WRTD_ATTR_STAT_RULE_TX_EVENTS, //RO, int32 WRTD_ATTR_STAT_RULE_TX_EVENTS, //RO, int32
WRTD_ATTR_STAT_RULE_TX_LAST, //RO, tstamp WRTD_ATTR_STAT_RULE_TX_LAST, //RO, tstamp
WRTD_ATTR_STAT_RULE_MISSED_EVENTS_LATE, //RO, int32 WRTD_ATTR_STAT_RULE_MISSED_LATE, //RO, int32
WRTD_ATTR_STAT_RULE_MISSED_EVENTS_HOLDOFF, //RO, int32 WRTD_ATTR_STAT_RULE_MISSED_HOLDOFF, //RO, int32
WRTD_ATTR_STAT_RULE_MISSED_EVENTS_OVERFLOW, //RO, int32 WRTD_ATTR_STAT_RULE_MISSED_NOSYNC, //RO, int32
WRTD_ATTR_STAT_RULE_MISSED_OVERFLOW, //RO, int32
WRTD_ATTR_STAT_RULE_MISSED_LAST, //RO, tstamp WRTD_ATTR_STAT_RULE_MISSED_LAST, //RO, tstamp
WRTD_ATTR_STAT_RULE_RX_LATENCY_MIN, //RO, tstamp
WRTD_ATTR_STAT_RULE_RX_LATENCY_MAX, //RO, tstamp
WRTD_ATTR_STAT_RULE_RX_LATENCY_AVG, //RO, tstamp
WRTD_ATTR_STAT_RULE_RX_PERIOD_AVG, //RO, tstamp
/* Latency and period (excluding events discarded due to holdoff). */
WRTD_ATTR_STAT_RULE_RX_LATENCY_MIN, //RO, tstamp (maybe ns only valid)
WRTD_ATTR_STAT_RULE_RX_LATENCY_MAX, //RO, tstamp (maybe ns only valid)
WRTD_ATTR_STAT_RULE_RX_LATENCY_AVG, //RO, tstamp (maybe ns only valid)
WRTD_ATTR_STAT_RULE_RX_PERIOD_MIN, //RO, tstamp (maybe ns only valid)
WRTD_ATTR_STAT_RULE_RX_PERIOD_MAX, //RO, tstamp (maybe ns only valid)
WRTD_ATTR_STAT_RULE_RX_PERIOD_AVG, //RO, tstamp (maybe ns only valid)
__WRTD_ATTR_MAX_NUMBER, __WRTD_ATTR_MAX_NUMBER,
}; };
...@@ -156,7 +153,6 @@ enum wrtd_attr { ...@@ -156,7 +153,6 @@ enum wrtd_attr {
* Set of functions to manage the basic device and library configuration. * Set of functions to manage the basic device and library configuration.
* @{ * @{
*/ */
// Ideally, also be able to list possible names
extern enum wrtd_status wrtd_init(const char *resource_name, extern enum wrtd_status wrtd_init(const char *resource_name,
bool reset, bool reset,
const char *options_str, const char *options_str,
...@@ -173,18 +169,6 @@ extern enum wrtd_status wrtd_error_message(struct wrtd_dev *dev, ...@@ -173,18 +169,6 @@ extern enum wrtd_status wrtd_error_message(struct wrtd_dev *dev,
/* Attributes. */ /* Attributes. */
extern enum wrtd_status wrtd_get_attr_int32(struct wrtd_dev *dev,
const char *rep_cap_id,
enum wrtd_attr id,
int32_t *value);
extern enum wrtd_status wrtd_set_attr_int32(struct wrtd_dev *dev,
const char *rep_cap_id,
enum wrtd_attr id,
int32_t value);
extern enum wrtd_status wrtd_set_attr_int64(struct wrtd_dev *dev,
const char *rep_cap_id,
enum wrtd_attr id,
int64_t value);
extern enum wrtd_status wrtd_get_attr_bool(struct wrtd_dev *dev, extern enum wrtd_status wrtd_get_attr_bool(struct wrtd_dev *dev,
const char *rep_cap_id, const char *rep_cap_id,
enum wrtd_attr id, enum wrtd_attr id,
...@@ -193,6 +177,14 @@ extern enum wrtd_status wrtd_set_attr_bool(struct wrtd_dev *dev, ...@@ -193,6 +177,14 @@ extern enum wrtd_status wrtd_set_attr_bool(struct wrtd_dev *dev,
const char *rep_cap_id, const char *rep_cap_id,
enum wrtd_attr id, enum wrtd_attr id,
bool value); bool value);
extern enum wrtd_status wrtd_get_attr_int32(struct wrtd_dev *dev,
const char *rep_cap_id,
enum wrtd_attr id,
int32_t *value);
extern enum wrtd_status wrtd_set_attr_int32(struct wrtd_dev *dev,
const char *rep_cap_id,
enum wrtd_attr id,
int32_t value);
extern enum wrtd_status wrtd_get_attr_tstamp(struct wrtd_dev *dev, extern enum wrtd_status wrtd_get_attr_tstamp(struct wrtd_dev *dev,
const char *rep_cap_id, const char *rep_cap_id,
enum wrtd_attr id, enum wrtd_attr id,
...@@ -205,10 +197,6 @@ extern enum wrtd_status wrtd_set_attr_string(struct wrtd_dev *dev, ...@@ -205,10 +197,6 @@ extern enum wrtd_status wrtd_set_attr_string(struct wrtd_dev *dev,
const char *rep_cap_id, const char *rep_cap_id,
enum wrtd_attr id, enum wrtd_attr id,
const char *value); const char *value);
extern enum wrtd_status wrtd_get_attr_int64(struct wrtd_dev *dev,
const char *rep_cap_id,
enum wrtd_attr id,
int64_t *value);
extern enum wrtd_status wrtd_get_attr_string(struct wrtd_dev *dev, extern enum wrtd_status wrtd_get_attr_string(struct wrtd_dev *dev,
const char *rep_cap_id, const char *rep_cap_id,
enum wrtd_attr id, enum wrtd_attr id,
...@@ -289,34 +277,6 @@ extern enum wrtd_status wrtd_get_rule_id(struct wrtd_dev *dev, ...@@ -289,34 +277,6 @@ extern enum wrtd_status wrtd_get_rule_id(struct wrtd_dev *dev,
extern enum wrtd_status wrtd_reset_rule_stats(struct wrtd_dev *dev, extern enum wrtd_status wrtd_reset_rule_stats(struct wrtd_dev *dev,
const char *rep_cap_id); const char *rep_cap_id);
/**@}*/
// ===========================================================================
// BEGIN DEPRECATED
// ===========================================================================
/**
* Status description for an input channel
*/
struct wrtd_input_state {
struct wrtd_tstamp tdc_timebase_offset; /**< TDC time base offset */
};
/**
* Status description for an output channel
*/
struct wrtd_output_state {
struct wrtd_tstamp pulse_width; /**< Pulse width */
};
/**@}*/
/**@}*/
// ===========================================================================
// END DEPRECATED
// ===========================================================================
#ifdef __cplusplus #ifdef __cplusplus
}; };
......
...@@ -98,9 +98,6 @@ static void disp_alarm(const struct wrtd_alarm *alarm) ...@@ -98,9 +98,6 @@ static void disp_alarm(const struct wrtd_alarm *alarm)
" enabled: %d\n", alarm->enabled); " enabled: %d\n", alarm->enabled);
printf(" next time: "); printf(" next time: ");
print_ts(&alarm->event.ts); print_ts(&alarm->event.ts);
printf("\n"
" setup time: ");
print_ts(&alarm->setup_time);
printf("\n" printf("\n"
" repeat count: %d\n", alarm->repeat_count); " repeat count: %d\n", alarm->repeat_count);
printf(" period: "); printf(" period: ");
...@@ -142,8 +139,8 @@ static void disp_rule_conf(const struct wrtd_rule *rule, unsigned nbr_rules) ...@@ -142,8 +139,8 @@ static void disp_rule_conf(const struct wrtd_rule *rule, unsigned nbr_rules)
" resync_period_ns: "); " resync_period_ns: ");
print_ns(cfg->resync_period_ns); print_ns(cfg->resync_period_ns);
printf("\n" printf("\n"
" resync_delay_ns: "); " resync_factor: ");
print_ns(cfg->resync_delay_ns); print_ns(cfg->resync_factor);
printf("\n"); printf("\n");
} }
...@@ -493,7 +490,7 @@ static enum wrtd_status wrtd_cmd_set_alarm(struct wrtd_dev *wrtd, ...@@ -493,7 +490,7 @@ static enum wrtd_status wrtd_cmd_set_alarm(struct wrtd_dev *wrtd,
ts_sub_ps(&ts, setup); ts_sub_ps(&ts, setup);
status = wrtd_set_attr_tstamp(wrtd, id, status = wrtd_set_attr_tstamp(wrtd, id,
WRTD_ATTR_ALARM_SETUP_TIME, &ts); WRTD_ATTR_ALARM_TIME, &ts);
WRTD_RETURN_IF_ERROR(status); WRTD_RETURN_IF_ERROR(status);
/* Set repeat count. */ /* Set repeat count. */
......
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