Hi to All!
I have several questions about using BF537 SPORT driver in DMA mode.
Hardware: I have a custom board based on BF537-STAMP, and need transmit data from sport1 to sport0.
Port are connected between themselves.
Software: Linux from latest adi-linux source, and latest buildroot distribution. Using adi-toolchain. Using standard driver from adi-linux drivers/char/bfin_sport.c. I was made patch for linux kernel to get two sport devices /dev/sport0 and /dev/sport1 (patch in attachment). It was work fine.
I have two simple application. Оne for write and another for read data to/from sports. Setting up DMA mode. Source in attachments.
If I write 128-bytes of data in /dev/sport1 I see all transmitted data only in the second reading. In the first reading I see that all data is zeros.
If I don't write any data in /dev/sport1 and read data from /dev/sport0 the reading was successfully finished and I see some garbage in data. How I can setup SPORTS for DMA handshaking? May be I miss something settings?
It is possible to sleep in read() syscall for waiting while data will be writting in /dev/sport0 from external port?
If need additional information - it will be provided from me. Help me please. Thank you.
P.S. I was rewrite example in one application: sportrw.c
Moved to Blackfin Linux section.
Hi, to all!
I discover the bfin_sport_raw driver in adi-linux/drivers/char/bfin_sport.c and found that if we using multiple instance of /dev/sport# device value of pointers static unsigned char *sport_rx_buf and static unsigned char *sport_tx_buf will be incorrect, because they are shared between several device. I will provide here my patch for fixing this issue. Thank you.
Thanks for your bug reporting and patch, we will test and merge it accordinlgy.
Thank you for your attention!
Can you tell me, please how I can setup (if it is possible) /dev/sportX in blocking mode? For example, if no data was delivered in the SPORT from external source the read() syscall will be waiting. Thank you.
I think we have supported to read /dev/sportX in blocking mode if you setup dma mode, in "sport_read" function, you can find "wait_for_completion_interruptible" which will wait for the completion event in dma irq handler. Thanks a lot.