Fixed compatibility of output.
[AROS.git] / compiler / include / asm / io.h
blobc096db5b878e5a5ea98c82a26c04fbfad3d1c609
1 #ifndef ASM_IO_H
2 #define ASM_IO_H
4 /*
5 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
6 $Id$
8 I/O operations, generic header.
9 */
11 #include <aros/macros.h>
13 /* Include the actual CPU-dependent definitions */
14 #if defined __i386__
15 # include <asm/i386/io.h>
16 #elif defined __x86_64__
17 /* I/O operations are the same on i386 and x86-64 */
18 # include <asm/i386/io.h>
19 #elif defined __powerpc__
20 # include <asm/ppc/io.h>
21 #else
23 /* Default version for memory-mapped I/O with strong ordering */
25 #define inb(address) (*((volatile unsigned char *)(address)))
26 #define inw(address) (*((volatile unsigned short *)(address)))
27 #define inl(address) (*((volatile unsigned int *)(address)))
29 #define outb(value, address) *((volatile unsigned char *)(address)) = (value)
30 #define outw(value, address) *((volatile unsigned short *)(address)) = (value)
31 #define outl(value, address) *((volatile unsigned int *)(address)) = (value)
33 #endif
35 #ifndef port_t
36 #define port_t void *
37 #endif
39 #ifndef HAVE_MMIO_IO
41 #define mmio_inb(address) (*((volatile unsigned char *)(address)))
42 #define mmio_inw(address) (*((volatile unsigned short *)(address)))
43 #define mmio_inl(address) (*((volatile unsigned int *)(address)))
45 #define mmio_outb(value, address) *((volatile unsigned char *)(address)) = (value)
46 #define mmio_outw(value, address) *((volatile unsigned short *)(address)) = (value)
47 #define mmio_outl(value, address) *((volatile unsigned int *)(address)) = (value)
49 #endif
51 #ifndef HAVE_LE_IO
53 #define inw_le(address) AROS_LE2WORD(inw(address))
54 #define inl_le(address) AROS_LE2LONG(inl(address))
56 #define outw_le(value, address) outw(AROS_WORD2LE(value), address)
57 #define outl_le(value, address) outl(AROS_LONG2LE(value), address)
59 #endif
61 #ifndef HAVE_LE_MMIO_IO
63 #define mmio_inw_le(address) AROS_LE2WORD(mmio_inw(address))
64 #define mmio_inl_le(address) AROS_LE2LONG(mmio_inl(address))
66 #define mmio_outw_le(value, address) mmio_outw(AROS_WORD2LE(value), address)
67 #define mmio_outl_le(value, address) mmio_outl(AROS_LONG2LE(value), address)
69 #endif
71 #endif