1 /*****************************************************************************/
2
3 /*
4 * stallion.h -- stallion multiport serial driver.
5 *
6 * Copyright (C) 1994-1996 Greg Ungerer (gerg@stallion.oz.au).
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 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * 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 #ifndef _STALLION_H
25 #define _STALLION_H
26 /*****************************************************************************/
27
28 /*
29 * Define important driver constants here.
30 */
31 #define STL_MAXBRDS 4
32 #define STL_MAXPANELS 4
33 #define STL_PORTSPERPANEL 16
34 #define STL_MAXPORTS 64
35 #define STL_MAXDEVS (STL_MAXBRDS * STL_MAXPORTS)
36
37
38 /*
39 * Define a set of structures to hold all the board/panel/port info
40 * for our ports. These will be dynamically allocated as required.
41 */
42
43 /*
44 * Define a ring queue structure for each port. This will hold the
45 * TX data waiting to be output. Characters are fed into this buffer
46 * from the line discipline (or even direct from user space!) and
47 * then fed into the UARTs during interrupts. Will use a classic ring
48 * queue here for this. The good thing about this type of ring queue
49 * is that the head and tail pointers can be updated without interrupt
50 * protection - since "write" code only needs to change the head, and
51 * interrupt code only needs to change the tail.
52 */
53 typedef struct {
54 char *buf;
55 char *head;
56 char *tail;
57 } stlrq_t;
58
59 /*
60 * Port, panel and board structures to hold status info about each.
61 * The board structure contains pointers to structures for each panel
62 * connected to it, and in turn each panel structure contains pointers
63 * for each port structure for each port on that panel. Note that
64 * the port structure also contains the board and panel number that it
65 * is associated with, this makes it (fairly) easy to get back to the
66 * board/panel info for a port.
67 */
68 typedef struct {
69 unsigned long magic;
70 int portnr;
71 int panelnr;
72 int brdnr;
73 int ioaddr;
74 int uartaddr;
75 int pagenr;
76 int istate;
77 int flags;
78 int baud_base;
79 int custom_divisor;
80 int close_delay;
81 int closing_wait;
82 int refcount;
83 int openwaitcnt;
84 int brklen;
85 long session;
86 long pgrp;
87 unsigned int sigs;
88 unsigned int rxignoremsk;
89 unsigned int rxmarkmsk;
90 unsigned long clk;
91 unsigned long hwid;
92 struct tty_struct *tty;
93 struct wait_queue *open_wait;
94 struct wait_queue *close_wait;
95 struct termios normaltermios;
96 struct termios callouttermios;
97 struct tq_struct tqueue;
98 comstats_t stats;
99 stlrq_t tx;
100 } stlport_t;
101
102 typedef struct {
103 unsigned long magic;
104 int panelnr;
105 int brdnr;
106 int pagenr;
107 int nrports;
108 int iobase;
109 unsigned int hwid;
110 unsigned int ackmask;
111 stlport_t *ports[STL_PORTSPERPANEL];
112 } stlpanel_t;
113
114 typedef struct {
115 unsigned long magic;
116 int brdnr;
117 int brdtype;
118 int state;
119 int nrpanels;
120 int nrports;
121 int irq;
122 int irqtype;
123 unsigned int ioaddr1;
124 unsigned int ioaddr2;
125 unsigned int iostatus;
126 unsigned int ioctrl;
127 unsigned int ioctrlval;
128 unsigned int hwid;
129 unsigned long clk;
130 stlpanel_t *panels[STL_MAXPANELS];
131 } stlbrd_t;
132
133
134 /*
135 * Define MAGIC numbers used for above structures.
136 */
137 #define STL_PORTMAGIC 0x5a7182c9
138 #define STL_PANELMAGIC 0x7ef621a1
139 #define STL_BOARDMAGIC 0xa2267f52
140
141 /*****************************************************************************/
142 #endif