BPicture: Fix archive constructor.
[haiku.git] / src / add-ons / kernel / bus_managers / pci / arch / m68k / pci_io.h
blob927fad7a014fce80d1e093e82c811453693b9996
1 /*
2 * Copyright 2006, Ingo Weinhold <bonefish@cs.tu-berlin.de>.
3 * All rights reserved. Distributed under the terms of the MIT License.
4 */
6 #ifndef PCI_BUS_MANAGER_M68K_IO_H
7 #define PCI_BUS_MANAGER_M68K_IO_H
9 #include <SupportDefs.h>
11 #define IOBARRIER() asm volatile("nop") /* nop flushes the instruction pipeline */
12 /*XXX: sync cache/pmmu?*/
14 static inline void
15 m68k_out8(vuint8 *address, uint8 value)
17 *address = value;
18 IOBARRIER();
22 static inline void
23 m68k_out16(vuint16 *address, uint16 value)
25 *address = value;
26 IOBARRIER();
29 #if _XXX_HAS_REVERSE_IO
30 static inline void
31 m68k_out16_reverse(vuint16 *address, uint16 value)
33 asm volatile("sthbrx %1, 0, %0" : : "r"(address), "r"(value));
34 IOBARRIER();
36 #endif
39 static inline void
40 m68k_out32(vuint32 *address, uint32 value)
42 *address = value;
43 IOBARRIER();
47 #if _XXX_HAS_REVERSE_IO
48 static inline void
49 m68k_out32_reverse(vuint32 *address, uint32 value)
51 asm volatile("stwbrx %1, 0, %0" : : "r"(address), "r"(value));
52 IOBARRIER();
54 #endif
56 static inline uint8
57 m68k_in8(const vuint8 *address)
59 uint8 value = *address;
60 IOBARRIER();
61 return value;
65 static inline uint16
66 m68k_in16(const vuint16 *address)
68 uint16 value = *address;
69 IOBARRIER();
70 return value;
74 #if _XXX_HAS_REVERSE_IO
75 static inline uint16
76 m68k_in16_reverse(const vuint16 *address)
78 uint16 value;
79 asm volatile("lhbrx %0, 0, %1" : "=r"(value) : "r"(address));
80 IOBARRIER();
81 return value;
83 #endif
86 static inline uint32
87 m68k_in32(const vuint32 *address)
89 uint32 value = *address;
90 IOBARRIER();
91 return value;
95 #if _XXX_HAS_REVERSE_IO
96 static inline uint32
97 m68k_in32_reverse(const vuint32 *address)
99 uint32 value;
100 asm volatile("lwbrx %0, 0, %1" : "=r"(value) : "r"(address));
101 IOBARRIER();
102 return value;
104 #endif
106 #endif // PCI_BUS_MANAGER_M68K_IO_H