2 Copyright © 1995-2014, The AROS Development Team. All rights reserved.
6 #include <aros/libcall.h>
7 #include <aros/asmcall.h>
9 #include <proto/exec.h>
10 #include <proto/kernel.h>
14 /*****************************************************************************
18 AROS_LH1(APTR
, BusToPhys
,
21 AROS_LHA(APTR
, busAddress
, A0
),
24 APTR
, KernelBase
, 1, Kernel
)
27 This function translates Bus address (address that device sees) to
28 Physical address (address seen by CPU).
31 busAddress - Bus address as seen by device
34 Physical address seen by CPU
36 *****************************************************************************/
40 return((APTR
)((ULONG
)busAddress
+_BUS_BASE
));
48 /*****************************************************************************
52 AROS_LH1(APTR
, PhysToBus
,
55 AROS_LHA(APTR
, physAddress
, A0
),
58 APTR
, KernelBase
, 2, Kernel
)
61 This function translates Physical address address (address seen by CPU)
62 to Bus address (address seen by device).
65 physAddress - Physical address as seen by CPU
68 Bus address seen by device
70 *****************************************************************************/
74 return((APTR
)((ULONG
)physAddress
+_BUS_BASE
));
80 /*****************************************************************************
84 These functions are the only allowable things used to communicate with IO
85 address space. Please note that theirs implementation is platform specific.
87 Also note, that allthough it might be possible to talk to hardware without
88 them, it doesn't have to be possible any time. It may happen, that
89 self-made IO access will end with program killed.
91 There is no description available for this functions, but there is no need
92 for any. Function names and parameters are self-explaining.
94 *****************************************************************************/
97 AROS_LHA(UWORD
, port
, D0
),
98 AROS_LHA(UBYTE
, val
, D1
),
99 APTR
, KernelBase
, 3, Kernel
)
107 : "r"(val
), "r"(port
+ _IO_BASE
));
113 AROS_LHA(UWORD
, port
, D0
),
114 AROS_LHA(UWORD
, val
, D1
),
115 APTR
, KernelBase
, 4, Kernel
)
120 "sthbrx %0,0,%1 \n\t"
123 : "r"(val
), "r"(port
+ _IO_BASE
));
129 AROS_LHA(UWORD
, port
, D0
),
130 AROS_LHA(ULONG
, val
, D1
),
131 APTR
, KernelBase
, 5, Kernel
)
136 "stwbrx %0,0,%1 \n\t"
139 : "r"(val
), "r"(port
+ _IO_BASE
));
145 AROS_LHA(UWORD
, port
, D0
),
146 APTR
, KernelBase
, 6, Kernel
)
152 asm volatile ("lbzx %0,0,%1\n\tisync\n\tnop"
154 :"r"(port
+ _IO_BASE
));
162 AROS_LHA(UWORD
, port
, D0
),
163 APTR
, KernelBase
, 7, Kernel
)
169 asm volatile ("lhbrx %0,0,%1\n\tisync\n\tnop"
171 :"r"(port
+ _IO_BASE
));
179 AROS_LHA(UWORD
, port
, D0
),
180 APTR
, KernelBase
, 8, Kernel
)
186 asm volatile ("lwbrx %0,0,%1\n\tisync\n\tnop"
188 :"r"(port
+ _IO_BASE
));