Unix & Linux Asked on December 6, 2021
I have a c program on a Cyclone 5 that does an FFT using the connected FPGA. This program currently takes 256 bytes from stdin
and then process it gives the FFT results on stdout
. I run it like this from the Linux bash on the Cyclone 5.
./fpga_fft < input_s16le_audio.pcm
This only evaluates the first 256 bytes. How do I do this, so that the program is continuously called with the stdin stream until all from the *.pcm file is read?
Ideas:
cat input_s16le_audio.pcm|xargs ./fpga_fft
Somehow xargs needs to be told to process 256 bytes at the time in chronological sequential order (not parallel).
Using GNU Parallel:
cat input_s16le_audio.pcm |
parallel --pipe --recend '' --block 256 ./fpga_fft
If multiple fpga_fft
cannot run in parallel, add -j0
Answered by Ole Tange on December 6, 2021
Something like this:
for i in {0..N}
do
dd if=input_s16le_audio.pcm bs=256 count=1 skip=$i | ./fpga_fft
done
Obviously you have to replace the for loop by something that stops when the whole file has been processed (when the skip value is too big, dd just sends 0 bytes, so you cannot count on a bad rc).
Now, if you have a C program, it should be that hard to change it to make it loop on its input file?
Answered by xenoid on December 6, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP