~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/asm-arm/io.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  *  linux/include/asm-arm/io.h
  3  *
  4  *  Copyright (C) 1996-2000 Russell King
  5  *
  6  * This program is free software; you can redistribute it and/or modify
  7  * it under the terms of the GNU General Public License version 2 as
  8  * published by the Free Software Foundation.
  9  *
 10  * Modifications:
 11  *  16-Sep-1996 RMK     Inlined the inx/outx functions & optimised for both
 12  *                      constant addresses and variable addresses.
 13  *  04-Dec-1997 RMK     Moved a lot of this stuff to the new architecture
 14  *                      specific IO header files.
 15  *  27-Mar-1999 PJB     Second parameter of memcpy_toio is const..
 16  *  04-Apr-1999 PJB     Added check_signature.
 17  *  12-Dec-1999 RMK     More cleanups
 18  *  18-Jun-2000 RMK     Removed virt_to_* and friends definitions
 19  */
 20 #ifndef __ASM_ARM_IO_H
 21 #define __ASM_ARM_IO_H
 22 
 23 #include <linux/types.h>
 24 #include <asm/arch/hardware.h>
 25 #include <asm/arch/io.h>
 26 
 27 #define outb_p(val,port)                outb((val),(port))
 28 #define outw_p(val,port)                outw((val),(port))
 29 #define outl_p(val,port)                outl((val),(port))
 30 #define inb_p(port)                     inb((port))
 31 #define inw_p(port)                     inw((port))
 32 #define inl_p(port)                     inl((port))
 33 
 34 extern void outsb(unsigned int port, const void *from, int len);
 35 extern void outsw(unsigned int port, const void *from, int len);
 36 extern void outsl(unsigned int port, const void *from, int len);
 37 extern void insb(unsigned int port, void *from, int len);
 38 extern void insw(unsigned int port, void *from, int len);
 39 extern void insl(unsigned int port, void *from, int len);
 40 
 41 #define outsb_p(port,from,len)          outsb(port,from,len)
 42 #define outsw_p(port,from,len)          outsw(port,from,len)
 43 #define outsl_p(port,from,len)          outsl(port,from,len)
 44 #define insb_p(port,to,len)             insb(port,to,len)
 45 #define insw_p(port,to,len)             insw(port,to,len)
 46 #define insl_p(port,to,len)             insl(port,to,len)
 47 
 48 #ifdef __KERNEL__
 49 
 50 #include <asm/memory.h>
 51 
 52 /* the following macro is depreciated */
 53 #define ioaddr(port)                    __ioaddr((port))
 54 
 55 /*
 56  * ioremap and friends
 57  */
 58 extern void * __ioremap(unsigned long offset, size_t size, unsigned long flags);
 59 extern void __iounmap(void *addr);
 60 
 61 #define ioremap(off,sz)                 __arch_ioremap((off),(sz),0)
 62 #define ioremap_nocache(off,sz)         __arch_ioremap((off),(sz),1)
 63 #define iounmap(_addr)                  __iounmap(_addr)
 64 
 65 /*
 66  * DMA-consistent mapping functions.  These allocate/free a region of
 67  * uncached, unwrite-buffered mapped memory space for use with DMA
 68  * devices.  This is the "generic" version.  The PCI specific version
 69  * is in pci.h
 70  */
 71 extern void *consistent_alloc(int gfp, size_t size, dma_addr_t *handle);
 72 extern void consistent_free(void *vaddr);
 73 extern void consistent_sync(void *vaddr, size_t size, int rw);
 74 
 75 extern void __readwrite_bug(const char *fn);
 76 
 77 /*
 78  * String version of IO memory access ops:
 79  */
 80 extern void _memcpy_fromio(void *, unsigned long, size_t);
 81 extern void _memcpy_toio(unsigned long, const void *, size_t);
 82 extern void _memset_io(unsigned long, int, size_t);
 83 
 84 #define __raw_writeb(val,addr)          __arch_putb(val,addr)
 85 #define __raw_writew(val,addr)          __arch_putw(val,addr)
 86 #define __raw_writel(val,addr)          __arch_putl(val,addr)
 87 
 88 #define __raw_readb(addr)               __arch_getb(addr)
 89 #define __raw_readw(addr)               __arch_getw(addr)
 90 #define __raw_readl(addr)               __arch_getl(addr)
 91 
 92 /*
 93  * If this architecture has PCI memory IO, then define the read/write
 94  * macros.
 95  */
 96 #ifdef __mem_pci
 97 
 98 #define readb(addr)                     __arch_getb(__mem_pci(addr))
 99 #define readw(addr)                     __arch_getw(__mem_pci(addr))
100 #define readl(addr)                     __arch_getl(__mem_pci(addr))
101 #define writeb(val,addr)                __arch_putb(val,__mem_pci(addr))
102 #define writew(val,addr)                __arch_putw(val,__mem_pci(addr))
103 #define writel(val,addr)                __arch_putl(val,__mem_pci(addr))
104 
105 #define memset_io(a,b,c)                _memset_io(__mem_pci(a),(b),(c))
106 #define memcpy_fromio(a,b,c)            _memcpy_fromio((a),__mem_pci(b),(c))
107 #define memcpy_toio(a,b,c)              _memcpy_toio(__mem_pci(a),(b),(c))
108 
109 #define eth_io_copy_and_sum(a,b,c,d) \
110                                 eth_copy_and_sum((a),__mem_pci(b),(c),(d))
111 
112 static inline int
113 check_signature(unsigned long io_addr, const unsigned char *signature,
114                 int length)
115 {
116         int retval = 0;
117         do {
118                 if (readb(io_addr) != *signature)
119                         goto out;
120                 io_addr++;
121                 signature++;
122                 length--;
123         } while (length);
124         retval = 1;
125 out:
126         return retval;
127 }
128 
129 #else   /* __mem_pci */
130 
131 #define readb(addr)                     (__readwrite_bug("readb"),0)
132 #define readw(addr)                     (__readwrite_bug("readw"),0)
133 #define readl(addr)                     (__readwrite_bug("readl"),0)
134 #define writeb(v,addr)                  __readwrite_bug("writeb")
135 #define writew(v,addr)                  __readwrite_bug("writew")
136 #define writel(v,addr)                  __readwrite_bug("writel")
137 
138 #define eth_io_copy_and_sum(a,b,c,d)    __readwrite_bug("eth_io_copy_and_sum")
139 
140 #define check_signature(io,sig,len)     (0)
141 
142 #endif  /* __mem_pci */
143 
144 /*
145  * If this architecture has ISA IO, then define the isa_read/isa_write
146  * macros.
147  */
148 #ifdef __mem_isa
149 
150 #define isa_readb(addr)                 __arch_getb(__mem_isa(addr))
151 #define isa_readw(addr)                 __arch_getw(__mem_isa(addr))
152 #define isa_readl(addr)                 __arch_getl(__mem_isa(addr))
153 #define isa_writeb(val,addr)            __arch_putb(val,__mem_isa(addr))
154 #define isa_writew(val,addr)            __arch_putw(val,__mem_isa(addr))
155 #define isa_writel(val,addr)            __arch_putl(val,__mem_isa(addr))
156 #define isa_memset_io(a,b,c)            _memset_io(__mem_isa(a),(b),(c))
157 #define isa_memcpy_fromio(a,b,c)        _memcpy_fromio((a),__mem_isa(b),(c))
158 #define isa_memcpy_toio(a,b,c)          _memcpy_toio(__mem_isa((a)),(b),(c))
159 
160 #define isa_eth_io_copy_and_sum(a,b,c,d) \
161                                 eth_copy_and_sum((a),__mem_isa(b),(c),(d))
162 
163 static inline int
164 isa_check_signature(unsigned long io_addr, const unsigned char *signature,
165                     int length)
166 {
167         int retval = 0;
168         do {
169                 if (isa_readb(io_addr) != *signature)
170                         goto out;
171                 io_addr++;
172                 signature++;
173                 length--;
174         } while (length);
175         retval = 1;
176 out:
177         return retval;
178 }
179 
180 #else   /* __mem_isa */
181 
182 #define isa_readb(addr)                 (__readwrite_bug("isa_readb"),0)
183 #define isa_readw(addr)                 (__readwrite_bug("isa_readw"),0)
184 #define isa_readl(addr)                 (__readwrite_bug("isa_readl"),0)
185 #define isa_writeb(val,addr)            __readwrite_bug("isa_writeb")
186 #define isa_writew(val,addr)            __readwrite_bug("isa_writew")
187 #define isa_writel(val,addr)            __readwrite_bug("isa_writel")
188 #define isa_memset_io(a,b,c)            __readwrite_bug("isa_memset_io")
189 #define isa_memcpy_fromio(a,b,c)        __readwrite_bug("isa_memcpy_fromio")
190 #define isa_memcpy_toio(a,b,c)          __readwrite_bug("isa_memcpy_toio")
191 
192 #define isa_eth_io_copy_and_sum(a,b,c,d) \
193                                 __readwrite_bug("isa_eth_io_copy_and_sum")
194 
195 #define isa_check_signature(io,sig,len) (0)
196 
197 #endif  /* __mem_isa */
198 #endif  /* __KERNEL__ */
199 #endif  /* __ASM_ARM_IO_H */
200 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.