Thanks Glenn, Dave and Rurik!
To conclude this thread, there is a C-based example of reading the mmap
/dev/roach/mem file here:
https://github.com/shanlyrajan/roach2_linux/blob/master/test_mmap_RW.c
which can be found from that link that Glenn sent:
https://casper.berkeley.edu/wiki/FPGA_Device_Driver_Memo
I had already gotten my teeth in before getting that email, so I wrote
some Python code that is more than fast enough for our needs and simple
to use. I've created a github gist in case it comes in handy for anyone
else:
https://gist.github.com/telegraphic/37de73d5227017582c17
What this example code does is parse the core_info.tab file and creates
a set of 'cores' specific to that core_info.tab file. Each core has a
read method that uses mmap to access the data, taking care of read
offsets and such (I haven't implemented write). There's also some
example usage with a quick 'n dirty UDP packetizer specific for our needs.
Cheers
Danny
PS: I suggest adding katcp / corr / spead / numpy / zmq etc to the
default filesystem if licenses allow? Our filesystems are mounted as
read-only so I couldn't easily install packages that require
compilation, hence my shoddy UDP approach as opposed to using something
more robust.
G Jones wrote:
Hi Danny,
Have you seen this page on the wiki?
https://casper.berkeley.edu/wiki/FPGA_Device_Driver_Memo
The example code in the links provided there worked well as a good
starting point.
Glenn
On Mon, Feb 16, 2015 at 10:04 PM, Danny Price <[email protected]
<mailto:[email protected]>> wrote:
Hi all
I'd like to read data from the FPGA on the ROACH2 powerpc, then
pack it into UDP and send it out over Ethernet. Is there a
straightforward and reasonably efficient way to read
registers/bram from the FPGA on the ROACH2 powerpc? Better yet,
has anyone implemented something already that they're happy to
share? We need a ~0.5MB transfer, triggered when a register is
incremented (once per second), so speed shouldn't be a major issue.
I know on the ROACH1 the BRAMs were available in /proc, and that
the new tcpborphserver3 on the ROACH2 memory maps through the
'device nodes' in /dev/roach, but I'm not clear on how to read
desired registers on the PPC though this...
Thanks
Danny