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 extern void AROS_SLIB_ENTRY(CachePreDMA_00
,Exec
,127)(void);
16 extern void AROS_SLIB_ENTRY(CachePreDMA_40
,Exec
,127)(void);
17 /*****************************************************************************
20 #include <proto/exec.h>
22 AROS_LH3(APTR
, CachePreDMA
,
25 AROS_LHA(APTR
, address
, A0
),
26 AROS_LHA(ULONG
*, length
, A1
),
27 AROS_LHA(ULONG
, flags
, D0
),
30 struct ExecBase
*, SysBase
, 127, Exec
)
33 Do everything necessary to make CPU caches aware that a DMA
34 will happen. Virtual memory systems will make it possible
35 that your memory is not at one block and not at the address
36 you thought. This function gives you all the information
37 you need to split the DMA request up and to convert virtual
38 to physical addresses.
41 address - Virtual address of memory affected by the DMA
42 *length - Number of bytes affected
43 flags - DMA_Continue - This is a call to continue a
44 request that was broken up.
45 DMA_ReadFromRAM - Indicate that the DMA goes from
46 RAM to the device. Set this bit
50 The physical address in memory.
51 *length contains the number of contiguous bytes in physical
55 DMA must follow a call to CachePreDMA() and must be followed
56 by a call to CachePostDMA().
66 This function should be replaced by a function in $(KERNEL).
68 ******************************************************************************/
73 /* When called the first time, this patches up the
74 * Exec syscall table to directly point to the right routine.
77 if (SysBase
->AttnFlags
& AFF_68040
) {
79 func
= AROS_SLIB_ENTRY(CachePreDMA_40
, Exec
, 127);
81 /* Everybody else (68000, 68010) */
82 func
= AROS_SLIB_ENTRY(CachePreDMA_00
, Exec
, 127);
85 SetFunction((struct Library
*)SysBase
, -LIB_VECTSIZE
* 127, func
);
88 /* Call 'myself', which is now pointing to the correct routine */
89 return CachePreDMA(address
, length
, flags
);