Commit 3fbdc4ef authored by Tomasz Wlostowski's avatar Tomasz Wlostowski

wip

parent cd0ea761
......@@ -38,9 +38,12 @@ static int ft_read_calibration_eeprom(struct fmc_device *fmc, void *buf,
/* Look for sdb entry point */
for (i = 0x40; i < fmc->eeprom_len - 0x40; i += 0x40) {
fs.entrypoint = i;
printk("trying %x\n", i);
ret = sdbfs_dev_create(&fs, 0);
if (ret == 0)
break;
if (ret == 0) {
printk("found sdb @ %x\n", i);
break;
}
}
if (ret)
......
......@@ -108,6 +108,7 @@ struct ft_wr_timestamp {
uint32_t frac;
int seq_id;
int channel;
struct ft_hw_timestamp raw;
};
struct ft_sw_fifo {
......@@ -123,6 +124,7 @@ struct ft_channel_state {
int32_t user_offset;
struct ft_wr_timestamp prev_ts;
struct ft_hw_timestamp prev_hwts;
struct ft_sw_fifo fifo;
};
......
......@@ -97,7 +97,7 @@ int ft_read_sw_fifo(struct fmctdc_dev *ft, int channel,
v[FT_ATTR_TDC_SECONDS] = ts.seconds;
v[FT_ATTR_TDC_COARSE] = ts.coarse;
v[FT_ATTR_TDC_FRAC] = ts.frac;
v[FT_ATTR_TDC_SEQ] = ts.seq_id;
v[FT_ATTR_TDC_SEQ] = ts.raw.metadata;
v[FT_ATTR_TDC_OFFSET] = ft->calib.zero_offset[channel - 1];
v[FT_ATTR_TDC_USER_OFFSET] = st->user_offset;
......@@ -130,6 +130,8 @@ static inline void process_timestamp(struct fmctdc_dev *ft,
struct ft_wr_timestamp ts;
int channel, edge, frac;
printk("raw: %x %x %x %x\n", hwts->metadata, hwts->utc, hwts->coarse, hwts->bins);
channel = (hwts->metadata & 0x7) + 1;
edge = hwts->metadata & (1 << 4) ? 1 : 0;
......@@ -187,13 +189,15 @@ static inline void process_timestamp(struct fmctdc_dev *ft,
ts.seq_id++;
st->cur_seq_id++;
}
ts.raw = st->prev_hwts;
/* Put the timestamp in the FIFO */
enqueue_timestamp(ft, channel, &ts);
}
} else
} else {
st->prev_ts = ts;
st->prev_hwts = *hwts;
}
st->expected_edge = 1 - st->expected_edge;
}
}
......
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