2 * include/asm-microblaze/io.h -- Misc I/O operations
4 * Copyright (C) 2003 John Williams <jwilliams@itee.uq.edu.au>
5 * Copyright (C) 2001,02 NEC Corporation
6 * Copyright (C) 2001,02 Miles Bader <miles@gnu.org>
8 * This file is subject to the terms and conditions of the GNU General
9 * Public License. See the file COPYING in the main directory of this
10 * archive for more details.
12 * Written by Miles Bader <miles@gnu.org>
13 * Microblaze port by John Williams
16 #ifndef __MICROBLAZE_IO_H__
17 #define __MICROBLAZE_IO_H__
19 #define IO_SPACE_LIMIT 0xFFFFFFFF
22 ({ unsigned char __v = (*(volatile unsigned char *) (addr)); __v; })
24 ({ unsigned short __v = (*(volatile unsigned short *) (addr)); __v; })
26 ({ unsigned long __v = (*(volatile unsigned long *) (addr)); __v; })
28 #define writeb(b, addr) \
29 (void)((*(volatile unsigned char *) (addr)) = (b))
30 #define writew(b, addr) \
31 (void)((*(volatile unsigned short *) (addr)) = (b))
32 #define writel(b, addr) \
33 (void)((*(volatile unsigned int *) (addr)) = (b))
35 #define memset_io(a,b,c) memset((void *)(a),(b),(c))
36 #define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
37 #define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
39 #define inb(addr) readb (addr)
40 #define inw(addr) readw (addr)
41 #define inl(addr) readl (addr)
42 #define outb(x, addr) ((void) writeb (x, addr))
43 #define outw(x, addr) ((void) writew (x, addr))
44 #define outl(x, addr) ((void) writel (x, addr))
46 /* Some #definitions to keep strange Xilinx code happy */
47 #define in_8(addr) readb (addr)
48 #define in_be16(addr) readw (addr)
49 #define in_be32(addr) readl (addr)
51 #define out_8(addr,x ) outb (x,addr)
52 #define out_be16(addr,x ) outw (x,addr)
53 #define out_be32(addr,x ) outl (x,addr)
56 #define inb_p(port) inb((port))
57 #define outb_p(val, port) outb((val), (port))
58 #define inw_p(port) inw((port))
59 #define outw_p(val, port) outw((val), (port))
60 #define inl_p(port) inl((port))
61 #define outl_p(val, port) outl((val), (port))
63 /* Some defines to keep the MTD flash drivers happy */
65 #define __raw_readb readb
66 #define __raw_readw readw
67 #define __raw_readl readl
68 #define __raw_writeb writeb
69 #define __raw_writew writew
70 #define __raw_writel writel
72 static inline void io_insb (unsigned long port, void *dst, unsigned long count)
74 unsigned char *p = dst;
78 static inline void io_insw (unsigned long port, void *dst, unsigned long count)
80 unsigned short *p = dst;
84 static inline void io_insl (unsigned long port, void *dst, unsigned long count)
86 unsigned long *p = dst;
92 io_outsb (unsigned long port, const void *src, unsigned long count)
94 const unsigned char *p = src;
99 io_outsw (unsigned long port, const void *src, unsigned long count)
101 const unsigned short *p = src;
106 io_outsl (unsigned long port, const void *src, unsigned long count)
108 const unsigned long *p = src;
113 #define outsb(a,b,l) io_outsb(a,b,l)
114 #define outsw(a,b,l) io_outsw(a,b,l)
115 #define outsl(a,b,l) io_outsl(a,b,l)
117 #define insb(a,b,l) io_insb(a,b,l)
118 #define insw(a,b,l) io_insw(a,b,l)
119 #define insl(a,b,l) io_insl(a,b,l)
122 #define iounmap(addr) ((void)0)
123 #define ioremap(physaddr, size) (physaddr)
124 #define ioremap_nocache(physaddr, size) (physaddr)
125 #define ioremap_writethrough(physaddr, size) (physaddr)
126 #define ioremap_fullcache(physaddr, size) (physaddr)
128 #endif /* __MICROBLAZE_IO_H__ */