Import 2.3.18pre1
[davej-history.git] / include / pcmcia / bus_ops.h
blob56f0dd92f85bae64fdaddf4a18bc91333a607da9
1 /*
2 * bus_ops.h 1.6 1999/08/28 04:12:33
4 * The contents of this file are subject to the Mozilla Public License
5 * Version 1.1 (the "License"); you may not use this file except in
6 * compliance with the License. You may obtain a copy of the License
7 * at http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS"
10 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11 * the License for the specific language governing rights and
12 * limitations under the License.
14 * The initial developer of the original code is David A. Hinds
15 * <dhinds@hyper.stanford.edu>. Portions created by David A. Hinds
16 * are Copyright (C) 1999 David A. Hinds. All Rights Reserved.
18 * Alternatively, the contents of this file may be used under the
19 * terms of the GNU Public License version 2 (the "GPL"), in which
20 * case the provisions of the GPL are applicable instead of the
21 * above. If you wish to allow the use of your version of this file
22 * only under the terms of the GPL and not to allow others to use
23 * your version of this file under the MPL, indicate your decision by
24 * deleting the provisions above and replace them with the notice and
25 * other provisions required by the GPL. If you do not delete the
26 * provisions above, a recipient may use your version of this file
27 * under either the MPL or the GPL.
30 #ifndef _LINUX_BUS_OPS_H
31 #define _LINUX_BUS_OPS_H
33 typedef struct bus_operations {
34 void *priv;
35 u32 (*b_in)(void *bus, u32 port, s32 sz);
36 void (*b_ins)(void *bus, u32 port, void *buf,
37 u32 count, s32 sz);
38 void (*b_out)(void *bus, u32 val, u32 port, s32 sz);
39 void (*b_outs)(void *bus, u32 port, void *buf,
40 u32 count, s32 sz);
41 void *(*b_ioremap)(void *bus, u_long ofs, u_long sz);
42 void (*b_iounmap)(void *bus, void *addr);
43 u32 (*b_read)(void *bus, void *addr, s32 sz);
44 void (*b_write)(void *bus, u32 val, void *addr, s32 sz);
45 void (*b_copy_from)(void *bus, void *d, void *s, u32 count);
46 void (*b_copy_to)(void *bus, void *d, void *s, u32 count);
47 int (*b_request_irq)(void *bus, u_int irq,
48 void (*handler)(int, void *,
49 struct pt_regs *),
50 u_long flags, const char *device,
51 void *dev_id);
52 void (*b_free_irq)(void *bus, u_int irq, void *dev_id);
53 } bus_operations;
55 #ifdef CONFIG_VIRTUAL_BUS
57 #define bus_inb(b,p) (b)->b_in((b),(p),0)
58 #define bus_inw(b,p) (b)->b_in((b),(p),1)
59 #define bus_inl(b,p) (b)->b_in((b),(p),2)
60 #define bus_inw_ns(b,p) (b)->b_in((b),(p),-1)
61 #define bus_inl_ns(b,p) (b)->b_in((b),(p),-2)
63 #define bus_insb(b,p,a,c) (b)->b_ins((b),(p),(a),(c),0)
64 #define bus_insw(b,p,a,c) (b)->b_ins((b),(p),(a),(c),1)
65 #define bus_insl(b,p,a,c) (b)->b_ins((b),(p),(a),(c),2)
66 #define bus_insw_ns(b,p,a,c) (b)->b_ins((b),(p),(a),(c),-1)
67 #define bus_insl_ns(b,p,a,c) (b)->b_ins((b),(p),(a),(c),-2)
69 #define bus_outb(b,v,p) (b)->b_out((b),(v),(p),0)
70 #define bus_outw(b,v,p) (b)->b_out((b),(v),(p),1)
71 #define bus_outl(b,v,p) (b)->b_out((b),(v),(p),2)
72 #define bus_outw_ns(b,v,p) (b)->b_out((b),(v),(p),-1)
73 #define bus_outl_ns(b,v,p) (b)->b_out((b),(v),(p),-2)
75 #define bus_outsb(b,p,a,c) (b)->b_outs((b),(p),(a),(c),0)
76 #define bus_outsw(b,p,a,c) (b)->b_outs((b),(p),(a),(c),1)
77 #define bus_outsl(b,p,a,c) (b)->b_outs((b),(p),(a),(c),2)
78 #define bus_outsw_ns(b,p,a,c) (b)->b_outs((b),(p),(a),(c),-1)
79 #define bus_outsl_ns(b,p,a,c) (b)->b_outs((b),(p),(a),(c),-2)
81 #define bus_readb(b,a) (b)->b_read((b),(a),0)
82 #define bus_readw(b,a) (b)->b_read((b),(a),1)
83 #define bus_readl(b,a) (b)->b_read((b),(a),2)
84 #define bus_readw_ns(b,a) (b)->b_read((b),(a),-1)
85 #define bus_readl_ns(b,a) (b)->b_read((b),(a),-2)
87 #define bus_writeb(b,v,a) (b)->b_write((b),(v),(a),0)
88 #define bus_writew(b,v,a) (b)->b_write((b),(v),(a),1)
89 #define bus_writel(b,v,a) (b)->b_write((b),(v),(a),2)
90 #define bus_writew_ns(b,v,a) (b)->b_write((b),(v),(a),-1)
91 #define bus_writel_ns(b,v,a) (b)->b_write((b),(v),(a),-2)
93 #define bus_ioremap(b,s,n) (b)->b_ioremap((b),(s),(n))
94 #define bus_iounmap(b,a) (b)->b_iounmap((b),(a))
95 #define bus_memcpy_fromio(b,d,s,n) (b)->b_copy_from((b),(d),(s),(n))
96 #define bus_memcpy_toio(b,d,s,n) (b)->b_copy_to((b),(d),(s),(n))
98 #define bus_request_irq(b,i,h,f,n,d) \
99 (b)->b_request_irq((b),(i),(h),(f),(n),(d))
100 #define bus_free_irq(b,i,d) (b)->b_free_irq((b),(i),(d))
102 #else
104 #define bus_inb(b,p) inb(p)
105 #define bus_inw(b,p) inw(p)
106 #define bus_inl(b,p) inl(p)
107 #define bus_inw_ns(b,p) inw_ns(p)
108 #define bus_inl_ns(b,p) inl_ns(p)
110 #define bus_insb(b,p,a,c) insb(p,a,c)
111 #define bus_insw(b,p,a,c) insw(p,a,c)
112 #define bus_insl(b,p,a,c) insl(p,a,c)
113 #define bus_insw_ns(b,p,a,c) insw_ns(p,a,c)
114 #define bus_insl_ns(b,p,a,c) insl_ns(p,a,c)
116 #define bus_outb(b,v,p) outb(b,v,p)
117 #define bus_outw(b,v,p) outw(b,v,p)
118 #define bus_outl(b,v,p) outl(b,v,p)
119 #define bus_outw_ns(b,v,p) outw_ns(b,v,p)
120 #define bus_outl_ns(b,v,p) outl_ns(b,v,p)
122 #define bus_outsb(b,p,a,c) outsb(p,a,c)
123 #define bus_outsw(b,p,a,c) outsw(p,a,c)
124 #define bus_outsl(b,p,a,c) outsl(p,a,c)
125 #define bus_outsw_ns(b,p,a,c) outsw_ns(p,a,c)
126 #define bus_outsl_ns(b,p,a,c) outsl_ns(p,a,c)
128 #define bus_readb(b,a) readb(a)
129 #define bus_readw(b,a) readw(a)
130 #define bus_readl(b,a) readl(a)
131 #define bus_readw_ns(b,a) readw_ns(a)
132 #define bus_readl_ns(b,a) readl_ns(a)
134 #define bus_writeb(b,v,a) writeb(v,a)
135 #define bus_writew(b,v,a) writew(v,a)
136 #define bus_writel(b,v,a) writel(v,a)
137 #define bus_writew_ns(b,v,a) writew_ns(v,a)
138 #define bus_writel_ns(b,v,a) writel_ns(v,a)
140 #define bus_ioremap(b,s,n) ioremap(s,n)
141 #define bus_iounmap(b,a) iounmap(a)
142 #define bus_memcpy_fromio(b,d,s,n) memcpy_fromio(d,s,n)
143 #define bus_memcpy_toio(b,d,s,n) memcpy_toio(d,s,n)
145 #define bus_request_irq(b,i,h,f,n,d) request_irq((i),(h),(f),(n),(d))
146 #define bus_free_irq(b,i,d) free_irq((i),(d))
148 #endif /* CONFIG_VIRTUAL_BUS */
150 #endif /* _LINUX_BUS_OPS_H */