Merge remote-tracking branch 'asoc/fix/max98095' into asoc-linus
[cascardo/linux.git] / drivers / staging / dgap / dgap_driver.h
1 /*
2  * Copyright 2003 Digi International (www.digi.com)
3  *      Scott H Kilau <Scott_Kilau at digi dot com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2, or (at your option)
8  * any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
12  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13  * PURPOSE.  See the GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  *
19  *      NOTE: THIS IS A SHARED HEADER. DO NOT CHANGE CODING STYLE!!!
20  *
21  *************************************************************************
22  *
23  * Driver includes
24  *
25  *************************************************************************/
26
27 #ifndef __DGAP_DRIVER_H
28 #define __DGAP_DRIVER_H
29
30 #include <linux/version.h>      /* To get the current Linux version */
31 #include <linux/types.h>        /* To pick up the varions Linux types */
32 #include <linux/tty.h>          /* To pick up the various tty structs/defines */
33 #include <linux/interrupt.h>    /* For irqreturn_t type */
34
35 #include "dgap_types.h"         /* Additional types needed by the Digi header files */
36 #include "digi.h"               /* Digi specific ioctl header */
37 #include "dgap_kcompat.h"       /* Kernel 2.4/2.6 compat includes */
38 #include "dgap_sysfs.h"         /* Support for SYSFS */
39
40 /*************************************************************************
41  *
42  * Driver defines
43  *
44  *************************************************************************/
45
46 /*
47  * Driver identification, error and debugging statments
48  *
49  * In theory, you can change all occurances of "digi" in the next
50  * three lines, and the driver printk's will all automagically change.
51  *
52  * APR((fmt, args, ...));       Always prints message
53  * DPR((fmt, args, ...));       Only prints if DGAP_TRACER is defined at
54  *                                compile time and dgap_debug!=0
55  */
56 #define PROCSTR         "dgap"                  /* /proc entries         */
57 #define DEVSTR          "/dev/dg/dgap"          /* /dev entries          */
58 #define DRVSTR          "dgap"                  /* Driver name string 
59                                                  * displayed by APR      */
60 #define APR(args)       do { PRINTF_TO_KMEM(args); printk(DRVSTR": "); printk args; \
61                            } while (0)
62 #define RAPR(args)      do { PRINTF_TO_KMEM(args); printk args; } while (0)
63
64 #define TRC_TO_CONSOLE 1
65
66 /*
67  * Debugging levels can be set using debug insmod variable
68  * They can also be compiled out completely.
69  */
70
71 #define DBG_INIT                (dgap_debug & 0x01)
72 #define DBG_BASIC               (dgap_debug & 0x02)
73 #define DBG_CORE                (dgap_debug & 0x04)
74
75 #define DBG_OPEN                (dgap_debug & 0x08)
76 #define DBG_CLOSE               (dgap_debug & 0x10)
77 #define DBG_READ                (dgap_debug & 0x20)
78 #define DBG_WRITE               (dgap_debug & 0x40)
79
80 #define DBG_IOCTL               (dgap_debug & 0x80)
81
82 #define DBG_PROC                (dgap_debug & 0x100)
83 #define DBG_PARAM               (dgap_debug & 0x200)
84 #define DBG_PSCAN               (dgap_debug & 0x400)
85 #define DBG_EVENT               (dgap_debug & 0x800)
86
87 #define DBG_DRAIN               (dgap_debug & 0x1000)
88 #define DBG_CARR                (dgap_debug & 0x2000)
89
90 #define DBG_MGMT                (dgap_debug & 0x4000)
91
92
93 #if defined(DGAP_TRACER)
94
95 # if defined(TRC_TO_KMEM)
96 /* Choose one: */
97 #  define TRC_ON_OVERFLOW_WRAP_AROUND
98 #  undef  TRC_ON_OVERFLOW_SHIFT_BUFFER
99 # endif //TRC_TO_KMEM
100
101 # define TRC_MAXMSG             1024
102 # define TRC_OVERFLOW           "(OVERFLOW)"
103 # define TRC_DTRC               "/usr/bin/dtrc"
104
105 #if defined TRC_TO_CONSOLE
106 #define PRINTF_TO_CONSOLE(args) { printk(DRVSTR": "); printk args; }
107 #else //!defined TRACE_TO_CONSOLE
108 #define PRINTF_TO_CONSOLE(args)
109 #endif
110
111 #if defined TRC_TO_KMEM
112 #define PRINTF_TO_KMEM(args) dgap_tracef args 
113 #else //!defined TRC_TO_KMEM
114 #define PRINTF_TO_KMEM(args)
115 #endif
116
117 #define TRC(args)       { PRINTF_TO_KMEM(args); PRINTF_TO_CONSOLE(args) }
118
119 # define DPR_INIT(ARGS)         if (DBG_INIT) TRC(ARGS)
120 # define DPR_BASIC(ARGS)        if (DBG_BASIC) TRC(ARGS)
121 # define DPR_CORE(ARGS)         if (DBG_CORE) TRC(ARGS)
122 # define DPR_OPEN(ARGS)         if (DBG_OPEN)  TRC(ARGS)
123 # define DPR_CLOSE(ARGS)        if (DBG_CLOSE)  TRC(ARGS)
124 # define DPR_READ(ARGS)         if (DBG_READ)  TRC(ARGS)
125 # define DPR_WRITE(ARGS)        if (DBG_WRITE) TRC(ARGS)
126 # define DPR_IOCTL(ARGS)        if (DBG_IOCTL) TRC(ARGS)
127 # define DPR_PROC(ARGS)         if (DBG_PROC)  TRC(ARGS)
128 # define DPR_PARAM(ARGS)        if (DBG_PARAM)  TRC(ARGS)
129 # define DPR_PSCAN(ARGS)        if (DBG_PSCAN)  TRC(ARGS)
130 # define DPR_EVENT(ARGS)        if (DBG_EVENT)  TRC(ARGS)
131 # define DPR_DRAIN(ARGS)        if (DBG_DRAIN)  TRC(ARGS)
132 # define DPR_CARR(ARGS)         if (DBG_CARR)  TRC(ARGS)
133 # define DPR_MGMT(ARGS)         if (DBG_MGMT)  TRC(ARGS)
134
135 # define DPR(ARGS)              if (dgap_debug) TRC(ARGS)
136 # define P(X)                   dgap_tracef(#X "=%p\n", X)
137 # define X(X)                   dgap_tracef(#X "=%x\n", X)
138
139 #else//!defined DGAP_TRACER
140
141 #define PRINTF_TO_KMEM(args)
142 # define TRC(ARGS)
143 # define DPR_INIT(ARGS)
144 # define DPR_BASIC(ARGS)
145 # define DPR_CORE(ARGS)
146 # define DPR_OPEN(ARGS)
147 # define DPR_CLOSE(ARGS)
148 # define DPR_READ(ARGS)
149 # define DPR_WRITE(ARGS)
150 # define DPR_IOCTL(ARGS)
151 # define DPR_PROC(ARGS)
152 # define DPR_PARAM(ARGS)
153 # define DPR_PSCAN(ARGS)
154 # define DPR_EVENT(ARGS)
155 # define DPR_DRAIN(ARGS)
156 # define DPR_CARR(ARGS)
157 # define DPR_MGMT(ARGS)
158
159 # define DPR(args)
160
161 #endif//DGAP_TRACER
162
163 /* Number of boards we support at once. */
164 #define MAXBOARDS       32
165 #define MAXPORTS        224
166 #define MAXTTYNAMELEN   200
167
168 /* Our 3 magic numbers for our board, channel and unit structs */
169 #define DGAP_BOARD_MAGIC        0x5c6df104
170 #define DGAP_CHANNEL_MAGIC      0x6c6df104
171 #define DGAP_UNIT_MAGIC         0x7c6df104
172
173 /* Serial port types */
174 #define DGAP_SERIAL             0
175 #define DGAP_PRINT              1
176
177 #define SERIAL_TYPE_NORMAL      1
178
179 /* 4 extra for alignment play space */
180 #define WRITEBUFLEN             ((4096) + 4)
181 #define MYFLIPLEN               N_TTY_BUF_SIZE
182
183 #define SBREAK_TIME 0x25
184 #define U2BSIZE 0x400
185
186 #define dgap_jiffies_from_ms(a) (((a) * HZ) / 1000)
187
188 /*
189  * Our major for the mgmt devices.
190  *
191  * We can use 22, because Digi was allocated 22 and 23 for the epca driver.
192  * 22 has now become obsolete now that the "cu" devices have 
193  * been removed from 2.6.
194  * Also, this *IS* the epca driver, just PCI only now.
195  */
196 #ifndef DIGI_DGAP_MAJOR
197 # define DIGI_DGAP_MAJOR         22
198 #endif
199
200 /*
201  * The parameters we use to define the periods of the moving averages.
202  */
203 #define         MA_PERIOD       (HZ / 10)
204 #define         SMA_DUR         (1 * HZ)
205 #define         EMA_DUR         (1 * HZ)
206 #define         SMA_NPERIODS    (SMA_DUR / MA_PERIOD)
207 #define         EMA_NPERIODS    (EMA_DUR / MA_PERIOD)
208
209 /*
210  * Define a local default termios struct. All ports will be created
211  * with this termios initially.  This is the same structure that is defined
212  * as the default in tty_io.c with the same settings overriden as in serial.c
213  *
214  * In short, this should match the internal serial ports' defaults.
215  */
216 #define DEFAULT_IFLAGS  (ICRNL | IXON)
217 #define DEFAULT_OFLAGS  (OPOST | ONLCR)
218 #define DEFAULT_CFLAGS  (B9600 | CS8 | CREAD | HUPCL | CLOCAL)
219 #define DEFAULT_LFLAGS  (ISIG | ICANON | ECHO | ECHOE | ECHOK | \
220                         ECHOCTL | ECHOKE | IEXTEN)
221
222 #ifndef _POSIX_VDISABLE
223 #define   _POSIX_VDISABLE '\0'
224 #endif
225
226 #define SNIFF_MAX       65536           /* Sniff buffer size (2^n) */
227 #define SNIFF_MASK      (SNIFF_MAX - 1) /* Sniff wrap mask */
228
229 #define VPDSIZE (512)
230
231 /*
232  * Lock function/defines.
233  * Makes spotting lock/unlock locations easier.
234  */
235 # define DGAP_SPINLOCK_INIT(x)          spin_lock_init(&(x))
236 # define DGAP_LOCK(x,y)                 spin_lock_irqsave(&(x), y)
237 # define DGAP_UNLOCK(x,y)               spin_unlock_irqrestore(&(x), y)
238 # define DGAP_TRYLOCK(x,y)              spin_trylock(&(x))
239
240 /*
241  * All the possible states the driver can be while being loaded.
242  */
243 enum {
244         DRIVER_INITIALIZED = 0,
245         DRIVER_NEED_CONFIG_LOAD,
246         DRIVER_REQUESTED_CONFIG,
247         DRIVER_READY
248 };
249
250 /*
251  * All the possible states the board can be while booting up.
252  */
253 enum {
254         BOARD_FAILED = 0,
255         CONFIG_NOT_FOUND,
256         BOARD_FOUND,
257         NEED_RESET,
258         FINISHED_RESET,
259         NEED_CONFIG,
260         FINISHED_CONFIG,
261         NEED_DEVICE_CREATION,
262         REQUESTED_DEVICE_CREATION,
263         FINISHED_DEVICE_CREATION,
264         NEED_BIOS_LOAD,
265         REQUESTED_BIOS,
266         WAIT_BIOS_LOAD,
267         FINISHED_BIOS_LOAD,
268         NEED_FEP_LOAD,
269         REQUESTED_FEP,
270         WAIT_FEP_LOAD,
271         FINISHED_FEP_LOAD,
272         NEED_PROC_CREATION,
273         FINISHED_PROC_CREATION,
274         BOARD_READY
275 };
276
277 /*
278  * All the possible states that a requested concentrator image can be in.
279  */
280 enum {
281         NO_PENDING_CONCENTRATOR_REQUESTS = 0,
282         NEED_CONCENTRATOR,
283         REQUESTED_CONCENTRATOR
284 };
285
286 extern char *dgap_state_text[];
287 extern char *dgap_driver_state_text[];
288
289
290 /* 
291  * Modem line constants are defined as macros because DSR and
292  * DCD are swapable using the ditty altpin option.
293  */
294 #define D_CD(ch)        ch->ch_cd       /* Carrier detect       */
295 #define D_DSR(ch)       ch->ch_dsr      /* Data set ready       */
296 #define D_RTS(ch)       DM_RTS          /* Request to send      */
297 #define D_CTS(ch)       DM_CTS          /* Clear to send        */
298 #define D_RI(ch)        DM_RI           /* Ring indicator       */
299 #define D_DTR(ch)       DM_DTR          /* Data terminal ready  */
300
301
302 /*************************************************************************
303  *
304  * Structures and closely related defines.
305  *
306  *************************************************************************/
307
308
309 /*
310  * A structure to hold a statistics counter.  We also
311  * compute moving averages for this counter.
312  */
313 struct macounter
314 {
315         u32             cnt;    /* Total count */
316         ulong           accum;  /* Acuumulator per period */
317         ulong           sma;    /* Simple moving average */
318         ulong           ema;    /* Exponential moving average */
319 };
320
321
322 /************************************************************************ 
323  * Device flag definitions for bd_flags.
324  ************************************************************************/
325 #define BD_FEP5PLUS     0x0001          /* Supports FEP5 Plus commands */
326 #define BD_HAS_VPD      0x0002          /* Board has VPD info available */
327
328
329 /*
330  *      Per-board information
331  */
332 struct board_t
333 {
334         int             magic;          /* Board Magic number.  */
335         int             boardnum;       /* Board number: 0-3 */
336         int             firstminor;     /* First minor, e.g. 0, 30, 60 */
337
338         int             type;           /* Type of board */
339         char            *name;          /* Product Name */
340         struct pci_dev  *pdev;          /* Pointer to the pci_dev struct */ 
341         u16             vendor;         /* PCI vendor ID */
342         u16             device;         /* PCI device ID */
343         u16             subvendor;      /* PCI subsystem vendor ID */
344         u16             subdevice;      /* PCI subsystem device ID */
345         uchar           rev;            /* PCI revision ID */
346         uint            pci_bus;        /* PCI bus value */
347         uint            pci_slot;       /* PCI slot value */
348         u16             maxports;       /* MAX ports this board can handle */
349         uchar           vpd[VPDSIZE];   /* VPD of board, if found */
350         u32             bd_flags;       /* Board flags */
351
352         spinlock_t      bd_lock;        /* Used to protect board */
353
354         u32             state;          /* State of card. */
355         wait_queue_head_t state_wait;   /* Place to sleep on for state change */
356
357         struct          tasklet_struct helper_tasklet; /* Poll helper tasklet */
358
359         u32             wait_for_bios;
360         u32             wait_for_fep;
361
362         struct cnode *  bd_config;      /* Config of board */
363
364         u16             nasync;         /* Number of ports on card */
365
366         u32             use_interrupts; /* Should we be interrupt driven? */
367         ulong           irq;            /* Interrupt request number */
368         ulong           intr_count;     /* Count of interrupts */
369         u32             intr_used;      /* Non-zero if using interrupts */
370         u32             intr_running;   /* Non-zero if FEP knows its doing interrupts */
371
372         ulong           port;           /* Start of base io port of the card */
373         ulong           port_end;       /* End of base io port of the card */
374         ulong           membase;        /* Start of base memory of the card */
375         ulong           membase_end;    /* End of base memory of the card */
376
377         uchar           *re_map_port;   /* Remapped io port of the card */
378         uchar           *re_map_membase;/* Remapped memory of the card */
379
380         uchar           runwait;        /* # Processes waiting for FEP  */
381         uchar           inhibit_poller; /* Tells  the poller to leave us alone */
382
383         struct channel_t *channels[MAXPORTS]; /* array of pointers to our channels. */
384
385         struct tty_driver       *SerialDriver;
386         char            SerialName[200];
387         struct tty_driver       *PrintDriver;
388         char            PrintName[200];
389
390         u32             dgap_Major_Serial_Registered;
391         u32             dgap_Major_TransparentPrint_Registered;
392
393         u32             dgap_Serial_Major;
394         u32             dgap_TransparentPrint_Major;
395
396 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
397         u32             TtyRefCnt;
398 #endif
399
400         struct bs_t     *bd_bs;                 /* Base structure pointer       */
401
402         char    *flipbuf;               /* Our flip buffer, alloced if board is found */
403         char    *flipflagbuf;           /* Our flip flag buffer, alloced if board is found */
404
405         u16             dpatype;        /* The board "type", as defined by DPA */
406         u16             dpastatus;      /* The board "status", as defined by DPA */
407         wait_queue_head_t kme_wait;     /* Needed for DPA support */
408
409         u32             conc_dl_status; /* Status of any pending conc download */
410         /*
411          *      Mgmt data.
412          */
413         char            *msgbuf_head;
414         char            *msgbuf;
415 };
416
417
418
419 /************************************************************************ 
420  * Unit flag definitions for un_flags.
421  ************************************************************************/
422 #define UN_ISOPEN       0x0001          /* Device is open               */
423 #define UN_CLOSING      0x0002          /* Line is being closed         */
424 #define UN_IMM          0x0004          /* Service immediately          */
425 #define UN_BUSY         0x0008          /* Some work this channel       */
426 #define UN_BREAKI       0x0010          /* Input break received         */
427 #define UN_PWAIT        0x0020          /* Printer waiting for terminal */
428 #define UN_TIME         0x0040          /* Waiting on time              */
429 #define UN_EMPTY        0x0080          /* Waiting output queue empty   */
430 #define UN_LOW          0x0100          /* Waiting output low water mark*/
431 #define UN_EXCL_OPEN    0x0200          /* Open for exclusive use       */
432 #define UN_WOPEN        0x0400          /* Device waiting for open      */
433 #define UN_WIOCTL       0x0800          /* Device waiting for open      */
434 #define UN_HANGUP       0x8000          /* Carrier lost                 */
435
436 struct device;
437
438 /************************************************************************
439  * Structure for terminal or printer unit. 
440  ************************************************************************/
441 struct un_t {
442         int     magic;          /* Unit Magic Number.                   */
443         struct  channel_t *un_ch;
444         u32     un_time;
445         u32     un_type;
446         u32     un_open_count;  /* Counter of opens to port             */
447         struct tty_struct *un_tty;/* Pointer to unit tty structure      */
448         u32     un_flags;       /* Unit flags                           */
449         wait_queue_head_t un_flags_wait; /* Place to sleep to wait on unit */
450         u32     un_dev;         /* Minor device number                  */
451         tcflag_t un_oflag;      /* oflags being done on board           */
452         tcflag_t un_lflag;      /* lflags being done on board           */
453         struct device *un_sysfs;
454 };
455
456
457 /************************************************************************ 
458  * Device flag definitions for ch_flags.
459  ************************************************************************/
460 #define CH_PRON         0x0001          /* Printer on string                */
461 #define CH_OUT          0x0002          /* Dial-out device open             */
462 #define CH_STOP         0x0004          /* Output is stopped                */
463 #define CH_STOPI        0x0008          /* Input is stopped                 */
464 #define CH_CD           0x0010          /* Carrier is present               */
465 #define CH_FCAR         0x0020          /* Carrier forced on                */
466
467 #define CH_RXBLOCK      0x0080          /* Enable rx blocked flag           */
468 #define CH_WLOW         0x0100          /* Term waiting low event           */
469 #define CH_WEMPTY       0x0200          /* Term waiting empty event         */
470 #define CH_RENABLE      0x0400          /* Buffer just emptied          */
471 #define CH_RACTIVE      0x0800          /* Process active in xxread()   */
472 #define CH_RWAIT        0x1000          /* Process waiting in xxread()  */
473 #define CH_BAUD0        0x2000          /* Used for checking B0 transitions */
474 #define CH_HANGUP       0x8000          /* Hangup received                  */
475
476 /*
477  * Definitions for ch_sniff_flags
478  */
479 #define SNIFF_OPEN      0x1
480 #define SNIFF_WAIT_DATA 0x2
481 #define SNIFF_WAIT_SPACE 0x4
482
483
484 /************************************************************************ 
485  * Channel information structure.
486  ************************************************************************/
487 struct channel_t {
488         int magic;                      /* Channel Magic Number         */
489         struct bs_t     *ch_bs;         /* Base structure pointer       */
490         struct cm_t     *ch_cm;         /* Command queue pointer        */
491         struct board_t *ch_bd;          /* Board structure pointer      */
492         unsigned char *ch_vaddr;        /* FEP memory origin            */
493         unsigned char *ch_taddr;        /* Write buffer origin          */
494         unsigned char *ch_raddr;        /* Read buffer origin           */
495         struct digi_t  ch_digi;         /* Transparent Print structure  */
496         struct un_t ch_tun;             /* Terminal unit info           */
497         struct un_t ch_pun;             /* Printer unit info            */
498
499         spinlock_t      ch_lock;        /* provide for serialization */
500         wait_queue_head_t ch_flags_wait;
501
502         u32     pscan_state;
503         uchar   pscan_savechar;
504
505         u32 ch_portnum;                 /* Port number, 0 offset.       */
506         u32 ch_open_count;              /* open count                   */
507         u32     ch_flags;               /* Channel flags                */
508
509
510         u32     ch_close_delay;         /* How long we should drop RTS/DTR for */
511
512         u32     ch_cpstime;             /* Time for CPS calculations    */
513
514         tcflag_t ch_c_iflag;            /* channel iflags               */
515         tcflag_t ch_c_cflag;            /* channel cflags               */
516         tcflag_t ch_c_oflag;            /* channel oflags               */
517         tcflag_t ch_c_lflag;            /* channel lflags               */
518
519         u16  ch_fepiflag;            /* FEP tty iflags               */
520         u16  ch_fepcflag;               /* FEP tty cflags               */
521         u16  ch_fepoflag;               /* FEP tty oflags               */
522         u16  ch_wopen;                  /* Waiting for open process cnt */
523         u16  ch_tstart;                 /* Transmit buffer start        */
524         u16  ch_tsize;                  /* Transmit buffer size         */
525         u16  ch_rstart;                 /* Receive buffer start         */
526         u16  ch_rsize;                  /* Receive buffer size          */
527         u16  ch_rdelay;                 /* Receive delay time           */
528
529         u16     ch_tlw;                 /* Our currently set low water mark */
530
531         u16  ch_cook;                   /* Output character mask        */
532
533         uchar   ch_card;                /* Card channel is on           */
534         uchar   ch_stopc;               /* Stop character               */
535         uchar   ch_startc;              /* Start character              */
536
537         uchar   ch_mostat;              /* FEP output modem status      */
538         uchar   ch_mistat;              /* FEP input modem status       */
539         uchar   ch_mforce;              /* Modem values to be forced    */
540         uchar   ch_mval;                /* Force values                 */
541         uchar   ch_fepstopc;            /* FEP stop character           */
542         uchar   ch_fepstartc;           /* FEP start character          */
543
544         uchar   ch_astopc;              /* Auxiliary Stop character     */
545         uchar   ch_astartc;             /* Auxiliary Start character    */
546         uchar   ch_fepastopc;           /* Auxiliary FEP stop char      */
547         uchar   ch_fepastartc;          /* Auxiliary FEP start char     */
548
549         uchar   ch_hflow;               /* FEP hardware handshake       */
550         uchar   ch_dsr;                 /* stores real dsr value        */
551         uchar   ch_cd;                  /* stores real cd value         */
552         uchar   ch_tx_win;              /* channel tx buffer window     */
553         uchar   ch_rx_win;              /* channel rx buffer window     */
554         uint    ch_custom_speed;        /* Custom baud, if set          */
555         uint    ch_baud_info;           /* Current baud info for /proc output   */
556         ulong   ch_rxcount;             /* total of data received so far        */
557         ulong   ch_txcount;             /* total of data transmitted so far     */
558         ulong   ch_err_parity;          /* Count of parity errors on channel    */
559         ulong   ch_err_frame;           /* Count of framing errors on channel   */
560         ulong   ch_err_break;           /* Count of breaks on channel   */
561         ulong   ch_err_overrun;         /* Count of overruns on channel */
562
563         uint ch_sniff_in;
564         uint ch_sniff_out;
565         char *ch_sniff_buf;             /* Sniff buffer for proc */
566         ulong ch_sniff_flags;           /* Channel flags                */
567         wait_queue_head_t ch_sniff_wait;
568 };
569
570
571 /*************************************************************************
572  *
573  * Prototypes for non-static functions used in more than one module
574  *
575  *************************************************************************/
576
577 extern int              dgap_ms_sleep(ulong ms);
578 extern void             *dgap_driver_kzmalloc(size_t size, int priority);
579 extern char             *dgap_ioctl_name(int cmd);
580 extern void             dgap_do_bios_load(struct board_t *brd, uchar __user *ubios, int len);
581 extern void             dgap_do_fep_load(struct board_t *brd, uchar __user *ufep, int len);
582 extern void             dgap_do_conc_load(struct board_t *brd, uchar *uaddr, int len);
583 extern void             dgap_do_config_load(uchar __user *uaddr, int len);
584 extern int              dgap_after_config_loaded(void);
585 extern int              dgap_finalize_board_init(struct board_t *brd);
586
587 /*
588  * Our Global Variables.
589  */
590 extern int              dgap_driver_state;      /* The state of the driver      */
591 extern int              dgap_debug;             /* Debug variable               */
592 extern int              dgap_rawreadok;         /* Set if user wants rawreads   */
593 extern int              dgap_poll_tick;         /* Poll interval - 20 ms        */
594 extern spinlock_t       dgap_global_lock;       /* Driver global spinlock       */
595 extern uint             dgap_NumBoards;         /* Total number of boards       */
596 extern struct board_t   *dgap_Board[MAXBOARDS]; /* Array of board structs       */
597 extern ulong            dgap_poll_counter;      /* Times the poller has run     */
598 extern char             *dgap_config_buf;       /* The config file buffer       */
599 extern spinlock_t       dgap_dl_lock;           /* Downloader spinlock          */
600 extern wait_queue_head_t dgap_dl_wait;          /* Wait queue for downloader    */
601 extern int              dgap_dl_action;         /* Action flag for downloader   */
602 extern int              dgap_registerttyswithsysfs; /* Should we register the   */
603                                                     /* ttys with sysfs or not   */
604
605 /*
606  * Global functions declared in dgap_fep5.c, but must be hidden from
607  * user space programs.
608  */
609 extern void     dgap_poll_tasklet(unsigned long data); 
610 extern void     dgap_cmdb(struct channel_t *ch, uchar cmd, uchar byte1, uchar byte2, uint ncmds);
611 extern void     dgap_cmdw(struct channel_t *ch, uchar cmd, u16 word, uint ncmds);
612 extern void     dgap_wmove(struct channel_t *ch, char *buf, uint cnt);
613 extern int      dgap_param(struct tty_struct *tty);
614 extern void     dgap_parity_scan(struct channel_t *ch, unsigned char *cbuf, unsigned char *fbuf, int *len);
615 extern uint     dgap_get_custom_baud(struct channel_t *ch);
616 extern void     dgap_firmware_reset_port(struct channel_t *ch);
617
618 #endif