grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / usb / pciusbhc / ohci / pci.h
blob7bfcfe6335f85430bcca8645829dcf1179083b01
1 /*
2 Copyright © 2002-2009, Chris Hodges. All rights reserved.
3 Copyright © 2009-2012, The AROS Development Team. All rights reserved.
4 $Id$
5 */
7 #ifndef PCI_H
8 #define PCI_H
10 #include <aros/io.h>
12 #undef SYNC
13 #ifdef __powerpc__
14 #define SYNC asm volatile("eieio");
15 #else
16 #define SYNC
17 #endif
19 #define READMEM16_LE(rb) AROS_WORD2LE(*((volatile UWORD *) (rb)))
20 #define READMEM32_LE(rb) AROS_LONG2LE(*((volatile ULONG *) (rb)))
21 #define WRITEMEM32_LE(adr, value) \
22 *((volatile ULONG *) (adr)) = AROS_LONG2LE(value)
23 #define CONSTWRITEMEM32_LE(adr, value) \
24 *((volatile ULONG *) (adr)) = AROS_LONG2LE(value)
26 #define CONSTWRITEREG16_LE(rb, offset, value) \
27 *((volatile UWORD *) (((UBYTE *) (rb)) + ((ULONG) (offset)))) = \
28 AROS_WORD2LE(value)
29 #define CONSTWRITEREG32_LE(rb, offset, value) \
30 *((volatile ULONG *) (((UBYTE *) (rb)) + ((ULONG) (offset)))) = \
31 AROS_LONG2LE(value)
32 #define WRITEREG16_LE(rb, offset, value) \
33 *((volatile UWORD *) (((UBYTE *) (rb)) + ((ULONG) (offset)))) = \
34 AROS_WORD2LE(value)
35 #define WRITEREG32_LE(rb, offset, value) \
36 *((volatile ULONG *) (((UBYTE *) (rb)) + ((ULONG) (offset)))) = \
37 AROS_LONG2LE(value)
38 #define WRITEREG64_LE(rb, offset, value) \
39 *((volatile UQUAD *) (((UBYTE *) (rb)) + ((ULONG) (offset)))) = \
40 AROS_QUAD2LE(value)
42 #define READREG16_LE(rb, offset) \
43 AROS_WORD2LE(*((volatile UWORD *) (((UBYTE *) (rb)) + ((ULONG) (offset)))))
44 #define READREG32_LE(rb, offset) \
45 AROS_LONG2LE(*((volatile ULONG *) (((UBYTE *) (rb)) + ((ULONG) (offset)))))
46 #define READREG64_LE(rb, offset) \
47 AROS_QUAD2LE(*((volatile UQUAD *) (((UBYTE *) (rb)) + ((ULONG) (offset)))))
49 #define READIO16_LE(rb, offset) \
50 AROS_WORD2LE(WORDIN((((UBYTE *) (rb)) + ((ULONG) (offset)))))
51 #define WRITEIO16_LE(rb, offset, value) \
52 WORDOUT((((UBYTE *) (rb)) + ((ULONG) (offset))), AROS_WORD2LE(value))
53 #define WRITEIO32_LE(rb, offset, value) \
54 LONGOUT((((UBYTE *) (rb)) + ((ULONG) (offset))), AROS_WORD2LE(value))
56 #endif // PCI_H