v2.4.9.9 -> v2.4.9.10
[opensuse:kernel.git] / drivers / isdn / eicon / uxio.h
1
2 /*
3  *
4  * Copyright (C) Eicon Technology Corporation, 2000.
5  *
6  * Eicon File Revision :    1.6  
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY 
15  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
16  * See the GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  *
22  */
23
24
25 /*
26  * Interface to Unix specific code for performing card I/O
27  */
28
29 #if !defined(UXIO_H)
30 #define UXIO_H
31
32 #include "sys.h"
33 #include "adapter.h"
34
35
36 struct pt_regs;
37
38 /* user callback, returns zero if interrupt was from this card */
39 typedef void            isr_fn_t(void *);
40 struct ux_diva_card_s
41 {
42         word    in_use;
43         int             io_base;
44         int             reset_base;
45         int             card_type;
46         byte            *mapped;
47         int             bus_num;
48         int             func_num;
49         int             slot;
50         int             irq;
51         byte            *pDRAM;
52         byte            *pDEVICES;
53         byte            *pCONFIG;
54         byte            *pSHARED;
55         byte            *pCONTROL;
56         word            features;
57         void            *user_isr_arg;
58         isr_fn_t        *user_isr;
59 };
60
61 /*
62  * Get a card handle to enable card to be accessed
63  */
64
65 int             UxCardHandleGet(        ux_diva_card_t  **card,
66                                                         dia_card_t              *cfg);
67
68 /*
69  * Free a card handle as no longer needed
70  */
71
72 void    UxCardHandleFree(ux_diva_card_t *card);
73
74 /*
75  * Lock and unlock access to a card
76  */
77
78 long            UxCardLock(ux_diva_card_t *card);
79 void    UxCardUnlock(ux_diva_card_t *card, long ipl);
80
81 /*
82  * Set the mapping address for PCI cards
83  */
84
85 int             UxCardAddrMappingSet(ux_diva_card_t     *card,
86                                                         int                             id,
87                                                         void                    *address,
88                                                         int                             size);
89
90 /*
91  * Attach card to memory to enable it to be accessed
92  * Returns the mapped address
93  */
94
95 void    *UxCardMemAttach(ux_diva_card_t *card, int id);
96
97 /*
98  * map card out of memory after completion of access
99  */
100
101 void    UxCardMemDetach(ux_diva_card_t *card, void *address);
102
103 /*
104  * input functions for memory-mapped cards
105  */
106
107 byte    UxCardMemIn(ux_diva_card_t *card, void *address);
108
109 word    UxCardMemInW(ux_diva_card_t *card, void *address);
110
111 dword   UxCardMemInD(ux_diva_card_t *card, void *address);
112
113 void    UxCardMemInBuffer(      ux_diva_card_t *card,
114                                                         void                    *address,
115                                                         void                    *buffer,
116                                                         int                             length);
117
118 /*
119  * output functions for memory-mapped cards
120  */
121
122 void UxCardMemOut(ux_diva_card_t *card, void *address, byte data);
123
124 void UxCardMemOutW(ux_diva_card_t *card, void *address, word data);
125
126 void UxCardMemOutD(ux_diva_card_t *card, void *address, dword data);
127
128 void UxCardMemOutBuffer(        ux_diva_card_t  *card,
129                                                         void                    *address,
130                                                         void                    *buffer,
131                                                         int                             length);
132
133 /*
134  * input functions for I/O-mapped cards
135  */
136
137 byte    UxCardIoIn(ux_diva_card_t *card, void *, void *address);
138
139 word    UxCardIoInW(ux_diva_card_t *card, void *, void *address);
140
141 dword   UxCardIoInD(ux_diva_card_t *card, void *, void *address);
142
143 void    UxCardIoInBuffer(       ux_diva_card_t *card,
144                                                         void *, void                    *address,
145                                                         void                    *buffer,
146                                                         int                             length);
147
148 /*
149  * output functions for I/O-mapped cards
150  */
151
152 void UxCardIoOut(ux_diva_card_t *card, void *, void *address, byte data);
153
154 void UxCardIoOutW(ux_diva_card_t *card, void *, void *address, word data);
155
156 void UxCardIoOutD(ux_diva_card_t *card, void *, void *address, dword data);
157
158 void UxCardIoOutBuffer( ux_diva_card_t  *card,
159                                                         void *, void                    *address,
160                                                         void                    *buffer,
161                                                         int                             length);
162
163 /*
164  * Get specified PCI config
165  */
166
167 void    UxPciConfigRead(ux_diva_card_t  *card, 
168                                                 int                             size,
169                                                 int                             offset,
170                                                 void                    *value);
171
172 /*
173  * Set specified PCI config
174  */
175
176 void    UxPciConfigWrite(ux_diva_card_t *card, 
177                                                 int                             size,
178                                                 int                             offset,
179                                                 void                    *value);
180
181 /* allocate memory, returning NULL if none available */
182
183 void    *UxAlloc(unsigned int size);
184
185 void    UxFree(void *);
186
187 /*
188  * Pause for specified number of milli-seconds 
189  */
190
191 void    UxPause(long ms);
192
193 /*
194  * Install an ISR for the specified card
195  */
196
197 int             UxIsrInstall(ux_diva_card_t *card, isr_fn_t *isr_fn, void *isr_arg);
198
199 /*
200  * Remove an ISR for the specified card
201  */
202 void    UxIsrRemove(ux_diva_card_t *card, void *);
203
204 /*
205  * DEBUG function to turn logging ON or OFF
206  */
207
208 void    UxCardLog(int turn_on);
209
210 long    UxInterlockedIncrement(ux_diva_card_t *card, long *dst);
211 long    UxInterlockedDecrement(ux_diva_card_t *card, long *dst);
212
213 #endif /* of UXIO_H */