memory allocation for DMA (how to make bdbuf use non-cacheable region for SD card read and write reuqest)

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Sep 4 08:30:39 UTC 2015


You may have a look at the "rtemsbsd/sys/dev/dw_mmc/dw_mmc.c" file of 
rtems-libbsd for an example.

On 04/09/15 02:49, Chan Kim wrote:
> Hi, Sebastian, thanks
>
>> It makes no sense to put the buffers in non-cacheable memory. The buffers
>> are already cache line aligned, so you can safely use cache flush/invalidate
>> operations or use a bounce buffer.
> I forgot to finish my reply yesterday. Yes, I was confused. It was the flushing operation I put in not the page table setup that had the good effect.  But I'm still confused about the cache operation. I put "flush" for when a SD command processing(block read or write) has been completed. This somehow seems to make the DMAed data from SD card to 'come to cache' - maybe declaring the cache invalid  or empty' for SD card read. But I don't understand how data from disk cache(bdbuf) goes to real memory for DMA (to SD card) because I fulsh the cache only 'after' the command completion. (just by lucky flush out?, or should I put another cache flush before DMA write to SD card controller? )
>
> Now it takes 2~3 seconds to write 512KB file and 3~4 seconds to copy a file in SD card to another file in the SD card. I have to find the reason for occasional stop during file write or copy.
>
> Chan
>
>
>
> 보낸 사람 : "Sebastian Huber" <sebastian.huber at embedded-brains.de>
> 보낸 날짜 : 2015-09-02 22:56:15 ( +09:00 )
> 받는 사람 : 김찬 <ckim at etri.re.kr>, users at rtems.org <users at rtems.org>
> 참조 :
> 제목 : Re: memory allocation for DMA (how to make bdbuf use non-cacheable region for SD card read and write reuqest)
>
>
>
> On 02/09/15 15:33, Chan Kim wrote:
>> My question is : how come the buffer used for SD card read or write request from the bdbuf is allocated in cacheable memory? I guess there should be setting that tells bdbuf to use some area that the bsp assigned for DMA(non-cacheable). Or , maybe I should map the buffer address to non-cacheable adderss and copyit myself?(should be slow). What is the correct method?
> It makes no sense to put the buffers in non-cacheable memory. The
> buffers are already cache line aligned, so you can safely use cache
> flush/invalidate operations or use a bounce buffer.
>

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.




More information about the users mailing list