brorson / ADC-001_basic_code

Basic programs for development and test of the ADC-001 cape
GNU General Public License v3.0
3 stars 3 forks source link

Milestones 1 and 2 #4

Closed RobertPHeller closed 4 years ago

RobertPHeller commented 4 years ago

This is both Milestones 1 and 2 -- I built Milestone 2 as a test of the basic code.

The program mainstream1.cc takes samples for the number of seconds on the command line to the file on the command line:

sudo ./mainstream1 seconds filename

if filename is a dash (-), then the output is to stdout.

each line of the output file is printed with the format %10.5g.

I modified pru0.c and spidriver_host.c to pass a rx buffer offset and modified spidriver_host.c to split apart the original spi_writeread_continuous into separate sections -- a start function, a wait function, and a transfer function. I also changed the transfer code to use memcpy() instead of a for loop with pru_read_word() calls -- this should speed up the transfer from pru dataram to ARM memory. This allows implementing two buffers in PRU dataram. I am overlaping copying from PRU dataram to ARM memory with fatching another buffer's worth from the ADC -- the PRU is SPI'ing to one buffer while the ARM is copying the other buffer to the ring buffer.