2 * include/asm-v850/io.h -- Misc I/O operations
4 * Copyright (C) 2001,02,03,04 NEC Electronics Corporation
5 * Copyright (C) 2001,02,03,04 Miles Bader <miles@gnu.org>
7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of this
9 * archive for more details.
11 * Written by Miles Bader <miles@gnu.org>
17 #define IO_SPACE_LIMIT 0xFFFFFFFF
20 ({ unsigned char __v = (*(volatile unsigned char *) (addr)); __v; })
22 ({ unsigned short __v = (*(volatile unsigned short *) (addr)); __v; })
24 ({ unsigned long __v = (*(volatile unsigned long *) (addr)); __v; })
26 #define readb_relaxed(a) readb(a)
27 #define readw_relaxed(a) readw(a)
28 #define readl_relaxed(a) readl(a)
30 #define writeb(b, addr) \
31 (void)((*(volatile unsigned char *) (addr)) = (b))
32 #define writew(b, addr) \
33 (void)((*(volatile unsigned short *) (addr)) = (b))
34 #define writel(b, addr) \
35 (void)((*(volatile unsigned int *) (addr)) = (b))
37 #define __raw_readb readb
38 #define __raw_readw readw
39 #define __raw_readl readl
40 #define __raw_writeb writeb
41 #define __raw_writew writew
42 #define __raw_writel writel
44 #define inb(addr) readb (addr)
45 #define inw(addr) readw (addr)
46 #define inl(addr) readl (addr)
47 #define outb(x, addr) ((void) writeb (x, addr))
48 #define outw(x, addr) ((void) writew (x, addr))
49 #define outl(x, addr) ((void) writel (x, addr))
51 #define inb_p(port) inb((port))
52 #define outb_p(val, port) outb((val), (port))
53 #define inw_p(port) inw((port))
54 #define outw_p(val, port) outw((val), (port))
55 #define inl_p(port) inl((port))
56 #define outl_p(val, port) outl((val), (port))
58 static inline void insb (unsigned long port
, void *dst
, unsigned long count
)
60 unsigned char *p
= dst
;
64 static inline void insw (unsigned long port
, void *dst
, unsigned long count
)
66 unsigned short *p
= dst
;
70 static inline void insl (unsigned long port
, void *dst
, unsigned long count
)
72 unsigned long *p
= dst
;
78 outsb (unsigned long port
, const void *src
, unsigned long count
)
80 const unsigned char *p
= src
;
85 outsw (unsigned long port
, const void *src
, unsigned long count
)
87 const unsigned short *p
= src
;
92 outsl (unsigned long port
, const void *src
, unsigned long count
)
94 const unsigned long *p
= src
;
99 #define iounmap(addr) ((void)0)
100 #define ioremap(physaddr, size) (physaddr)
101 #define ioremap_nocache(physaddr, size) (physaddr)
102 #define ioremap_writethrough(physaddr, size) (physaddr)
103 #define ioremap_fullcache(physaddr, size) (physaddr)
107 #define page_to_phys(page) ((page - mem_map) << PAGE_SHIFT)
109 /* This is really stupid; don't define it. */
110 #define page_to_bus(page) page_to_phys (page)
113 /* Conversion between virtual and physical mappings. */
114 #define mm_ptov(addr) ((void *)__phys_to_virt (addr))
115 #define mm_vtop(addr) ((unsigned long)__virt_to_phys (addr))
116 #define phys_to_virt(addr) ((void *)__phys_to_virt (addr))
117 #define virt_to_phys(addr) ((unsigned long)__virt_to_phys (addr))
119 #define memcpy_fromio(dst, src, len) memcpy (dst, (void *)src, len)
120 #define memcpy_toio(dst, src, len) memcpy ((void *)dst, src, len)
123 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
126 #define xlate_dev_mem_ptr(p) __va(p)
129 * Convert a virtual cached pointer to an uncached pointer
131 #define xlate_dev_kmem_ptr(p) p
133 #endif /* __V850_IO_H__ */