Rockbox mail archiveSubject: Aligning the buffer for DMA
Aligning the buffer for DMA
From: Boris Gjenero <boris.gjenero_at_gmail.com>
Date: Mon, 02 Mar 2009 14:30:13 -0500
While working on the PP502x ATA DMA patch (
http://www.rockbox.org/tracker/task/9708 ) I noticed that data in the
buffer is not always properly aligned for DMA. The buffering.c code
word-aligns the first frame, but the DMA code needs alignment of sector
boundaries. For example, if the size of the ID3v2 tag in an MP3 file
isn't divisible by 4, the whole file must be read via PIO.
Another issue is cache line alignment of the start and end of reads. If
they're not aligned, the start and end must be read via PIO to prevent
cache line interference. This would double the number of ATA commands
It's easy to change buffer alignment. FS#9708 already has a separate
patch which word-aligns the buffer for DMA. But is it okay to do this?
Will it cause errors or slowdowns due to unaligned reads? I
understand that even if it is a good idea it probably belongs in
separate platform-independent patch.
Received on 2009-03-02