2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
5 Desc: CachePreDMA() - Do what is necessary for DMA.
11 #include <aros/debug.h>
12 #include <exec/types.h>
13 #include <aros/libcall.h>
15 #include "exec_intern.h"
17 /*****************************************************************************
20 #include <proto/exec.h>
21 #include <proto/kernel.h>
23 AROS_LH3(APTR
, CachePreDMA
,
26 AROS_LHA(APTR
, address
, A0
),
27 AROS_LHA(ULONG
*, length
, A1
),
28 AROS_LHA(ULONG
, flags
, D0
),
31 struct ExecBase
*, SysBase
, 127, Exec
)
34 Do everything necessary to make CPU caches aware that a DMA
35 will happen. Virtual memory systems will make it possible
36 that your memory is not at one block and not at the address
37 you thought. This function gives you all the information
38 you need to split the DMA request up and to convert virtual
39 to physical addresses.
42 address - Virtual address of memory affected by the DMA
43 *length - Number of bytes affected
44 flags - DMA_Continue - This is a call to continue a
45 request that was broken up.
46 DMA_ReadFromRAM - Indicate that the DMA goes from
47 RAM to the device. Set this bit
51 The physical address in memory.
52 *length contains the number of contiguous bytes in physical
56 DMA must follow a call to CachePreDMA() and must be followed
57 by a call to CachePostDMA().
68 ******************************************************************************/
72 void *addr
= KrnVirtualToPhysical(address
);
74 /* At PreDMA stage only data caches need to be flushed */
75 //if (flags & DMA_ReadFromRAM)
77 CacheClearE(address
, *length
, CACRF_ClearD
);