- Removed unused HandleEvent method.
[AROS.git] / arch / m68k-all / exec / cachepredma.c
blob06a853a617b3e3592ef16c381d99a23a5620195b
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: CachePreDMA() - Do what is necessary for DMA.
6 Lang: english
7 */
9 #define DEBUG 0
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 /*****************************************************************************
19 NAME */
20 #include <proto/exec.h>
22 AROS_LH3(APTR, CachePreDMA,
24 /* SYNOPSIS */
25 AROS_LHA(APTR, address, A0),
26 AROS_LHA(ULONG *, length, A1),
27 AROS_LHA(ULONG, flags, D0),
29 /* LOCATION */
30 struct ExecBase *, SysBase, 127, Exec)
32 /* FUNCTION
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.
40 INPUTS
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
47 in both calls.
49 RESULT
50 The physical address in memory.
51 *length contains the number of contiguous bytes in physical
52 memory.
54 NOTES
55 DMA must follow a call to CachePreDMA() and must be followed
56 by a call to CachePostDMA().
58 EXAMPLE
60 BUGS
62 SEE ALSO
63 CachePostDMA()
65 INTERNALS
66 This function should be replaced by a function in $(KERNEL).
68 ******************************************************************************/
70 AROS_LIBFUNC_INIT
71 void (*func)(void);
73 /* When called the first time, this patches up the
74 * Exec syscall table to directly point to the right routine.
76 Disable();
77 if (SysBase->AttnFlags & AFF_68040) {
78 /* 68040 support */
79 func = AROS_SLIB_ENTRY(CachePreDMA_40, Exec, 127);
80 } else {
81 /* Everybody else (68000, 68010) */
82 func = AROS_SLIB_ENTRY(CachePreDMA_00, Exec, 127);
85 SetFunction((struct Library *)SysBase, -LIB_VECTSIZE * 127, func);
86 Enable();
88 /* Call 'myself', which is now pointing to the correct routine */
89 return CachePreDMA(address, length, flags);
91 AROS_LIBFUNC_EXIT
92 } /* CachePreDMA() */