2 #include <aros/libcall.h>
3 #include <aros/asmcall.h>
5 #include <proto/exec.h>
6 #include <proto/kernel.h>
10 /*****************************************************************************
14 AROS_LH1(APTR
, BusToPhys
,
17 AROS_LHA(APTR
, busAddress
, A0
),
20 APTR
, KernelBase
, 1, Kernel
)
23 This function translates Bus address (address that device sees) to
24 Physical address (address seen by CPU).
27 busAddress - Bus address as seen by device
30 Physical address seen by CPU
32 *****************************************************************************/
36 return((APTR
)((ULONG
)busAddress
+_BUS_BASE
));
44 /*****************************************************************************
48 AROS_LH1(APTR
, PhysToBus
,
51 AROS_LHA(APTR
, physAddress
, A0
),
54 APTR
, KernelBase
, 2, Kernel
)
57 This function translates Physical address address (address seen by CPU)
58 to Bus address (address seen by device).
61 physAddress - Physical address as seen by CPU
64 Bus address seen by device
66 *****************************************************************************/
70 return((APTR
)((ULONG
)physAddress
+_BUS_BASE
));
76 /*****************************************************************************
80 These functions are the only allowable things used to communicate with IO
81 address space. Please note that theirs implementation is platform specific.
83 Also note, that allthough it might be possible to talk to hardware without
84 them, it doesn't have to be possible any time. It may happen, that
85 self-made IO access will end with program killed.
87 There is no description available for this functions, but there is no need
88 for any. Function names and parameters are self-explaining.
90 *****************************************************************************/
93 AROS_LHA(UWORD
, port
, D0
),
94 AROS_LHA(UBYTE
, val
, D1
),
95 APTR
, KernelBase
, 3, Kernel
)
103 : "r"(val
), "r"(port
+ _IO_BASE
));
109 AROS_LHA(UWORD
, port
, D0
),
110 AROS_LHA(UWORD
, val
, D1
),
111 APTR
, KernelBase
, 4, Kernel
)
116 "sthbrx %0,0,%1 \n\t"
119 : "r"(val
), "r"(port
+ _IO_BASE
));
125 AROS_LHA(UWORD
, port
, D0
),
126 AROS_LHA(ULONG
, val
, D1
),
127 APTR
, KernelBase
, 5, Kernel
)
132 "stwbrx %0,0,%1 \n\t"
135 : "r"(val
), "r"(port
+ _IO_BASE
));
141 AROS_LHA(UWORD
, port
, D0
),
142 APTR
, KernelBase
, 6, Kernel
)
148 asm volatile ("lbzx %0,0,%1\n\tisync\n\tnop"
150 :"r"(port
+ _IO_BASE
));
158 AROS_LHA(UWORD
, port
, D0
),
159 APTR
, KernelBase
, 7, Kernel
)
165 asm volatile ("lhbrx %0,0,%1\n\tisync\n\tnop"
167 :"r"(port
+ _IO_BASE
));
175 AROS_LHA(UWORD
, port
, D0
),
176 APTR
, KernelBase
, 8, Kernel
)
182 asm volatile ("lwbrx %0,0,%1\n\tisync\n\tnop"
184 :"r"(port
+ _IO_BASE
));