Commit e1ed6c8d authored by Tomasz Wlostowski's avatar Tomasz Wlostowski

software: updated python demo to work with the newest rawrabbit driver

parent aade9e8b
......@@ -51,7 +51,7 @@ PUBLIC API
*/
fdelay_device_t *fdelay_create_rawrabbit(uint32_t base_addr);
fdelay_device_t *fdelay_create_rawrabbit(int fd, uint32_t base_addr);
fdelay_device_t *fdelay_create_minibone(char *iface, char *mac_addr, uint32_t base_addr);
fdelay_time_t fdelay_from_picos(const uint64_t ps);
......
......@@ -4,6 +4,7 @@
#include <stdint.h>
#include <rawrabbit.h>
int rr_bind(int a_fd);
int rr_init(int bus, int devfn);
int rr_writel(uint32_t data, uint32_t addr);
uint32_t rr_readl(uint32_t addr);
......
......@@ -1170,11 +1170,11 @@ int fdelay_configure_output(fdelay_device_t *dev, int channel, int enable, int64
delay_ps -= hw->calib.zero_offset[channel-1];
start = fdelay_from_picos(delay_ps);
end = fdelay_from_picos(delay_ps + width_ps);
end = fdelay_from_picos(delay_ps + width_ps - 4000);
delta = fdelay_from_picos(delta_ps);
// printf("Start: %lld: %d:%d\n", start.utc, start.coarse, start.frac);
printf("Start: %lld: %d:%d rep %d\n", start.utc, start.coarse, start.frac, rep_count);
chan_writel(hw->frr_cur[channel-1], FD_REG_FRR);
......@@ -1192,7 +1192,7 @@ int fdelay_configure_output(fdelay_device_t *dev, int channel, int enable, int64
chan_writel(delta.frac, FD_REG_F_DELTA);
// chan_writel(0, FD_REG_RCR);
chan_writel(FD_RCR_REP_CNT_W(rep_count) | (rep_count < 0 ? FD_RCR_CONT : 0), FD_REG_RCR);
chan_writel(FD_RCR_REP_CNT_W(rep_count-1) | (rep_count < 0 ? FD_RCR_CONT : 0), FD_REG_RCR);
dcr = 0;
......
......@@ -68,11 +68,16 @@ def on_chk_wr():
if __name__ == "__main__":
import os
import os,sys
if(os.getuid() != 0):
print("Sorry, I must be run as root...");
sys.exit(-1)
fd = os.open("/dev/rawrabbit", os.O_SYNC)
if(fd < 0):
print("Can't open the rawrabbit device. Is the rawrabbit driver installed?")
os.exit(-1)
sys.exit(-1)
card = FineDelay(fd)
......
......@@ -53,7 +53,7 @@ class FineDelay:
self.fdelay.fdelay_configure_trigger(self.handle, c_int(enable), c_int(termination))
def conf_output(self, channel, enable, delay, width):
self.fdelay.fdelay_configure_output(self.handle, c_int(channel), c_int(enable), c_ulonglong(delay), c_ulonglong(width))
self.fdelay.fdelay_configure_output(self.handle, c_int(channel), c_int(enable), c_ulonglong(delay), c_ulonglong(width), c_ulonglong(200000), c_int(1))
def conf_readout(self, enable):
self.fdelay.fdelay_configure_readout(self.handle, enable)
......
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