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