BF537 /dev/sport1 and /dev/sport0 write/read data using DMA

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