1 
2 /*
3  *  sx.h
4  *
5  *  Copyright (C) 1998/1999 R.E.Wolff@BitWizard.nl
6  *
7  *  SX serial driver.
8  *  -- Supports SI, XIO and SX host cards.
9  *  -- Supports TAs, MTAs and SXDCs.
10  *
11  *  Version 1.3 -- March, 1999.
12  *
13  */
14 
15 #define SX_NBOARDS        4
16 #define SX_PORTSPERBOARD 32
17 #define SX_NPORTS        (SX_NBOARDS * SX_PORTSPERBOARD)
18 
19 #ifdef __KERNEL__
20 
21 #define SX_MAGIC 0x12345678
22 
23 struct sx_port {
24   struct gs_port          gs;
25   /*
26   struct tq_struct        tqueue;
27   struct tq_struct        tqueue_hangup;
28   */
29   struct wait_queue       *shutdown_wait;
30   int                     ch_base;
31   int                     c_dcd;
32   struct sx_board         *board;
33   int                     line;
34   long                    locks;
35 };
36 
37 struct sx_board {
38   int magic;
39   unsigned long base;
40   unsigned long base2;
41   unsigned long hw_base;
42   int eisa_base;
43   int port_base; /* Number of the first port */
44   struct sx_port *ports;
45   int nports;
46   int flags;
47   int irq;
48   int poll;
49   int ta_type;
50   struct timer_list       timer;
51   int                     locks;
52 };
53 
54 struct vpd_prom {
55   unsigned short id;
56   char hwrev;
57   char hwass;
58   int uniqid;
59   char myear;
60   char mweek;
61   char hw_feature[5];
62   char oem_id;
63   char identifier[16];
64 };
65 
66 #ifndef MOD_RS232DB25MALE
67 #define MOD_RS232DB25MALE 0x0a
68 #endif
69 
70 #define SI_ISA_BOARD         0x00000001
71 #define SX_ISA_BOARD         0x00000002
72 #define SX_PCI_BOARD         0x00000004
73 #define SX_CFPCI_BOARD       0x00000008
74 #define SX_CFISA_BOARD       0x00000010
75 #define SI_EISA_BOARD        0x00000020
76 #define SI1_ISA_BOARD        0x00000040
77 
78 #define SX_BOARD_PRESENT     0x00001000
79 #define SX_BOARD_INITIALIZED 0x00002000
80 #define SX_IRQ_ALLOCATED     0x00004000
81 
82 #define SX_BOARD_TYPE        0x000000ff
83 
84 #define IS_SX_BOARD(board) (board->flags & (SX_PCI_BOARD | SX_CFPCI_BOARD | \
85                                             SX_ISA_BOARD | SX_CFISA_BOARD))
86 
87 #define IS_SI_BOARD(board) (board->flags & SI_ISA_BOARD)
88 #define IS_SI1_BOARD(board) (board->flags & SI1_ISA_BOARD)
89 
90 #define IS_EISA_BOARD(board) (board->flags & SI_EISA_BOARD)
91 
92 #define IS_CF_BOARD(board) (board->flags & (SX_CFISA_BOARD | SX_CFPCI_BOARD))
93 
94 #define SERIAL_TYPE_NORMAL 1
95 
96 /* The SI processor clock is required to calculate the cc_int_count register
97    value for the SI cards. */
98 #define SI_PROCESSOR_CLOCK 25000000
99 
100 
101 /* port flags */
102 /* Make sure these don't clash with gs flags or async flags */
103 #define SX_RX_THROTTLE        0x0000001
104 
105 
106 
107 #define SX_PORT_TRANSMIT_LOCK  0
108 #define SX_BOARD_INTR_LOCK     0
109 
110 
111 
112 /* Debug flags. Add these together to get more debug info. */
113 
114 #define SX_DEBUG_OPEN          0x00000001
115 #define SX_DEBUG_SETTING       0x00000002
116 #define SX_DEBUG_FLOW          0x00000004
117 #define SX_DEBUG_MODEMSIGNALS  0x00000008
118 #define SX_DEBUG_TERMIOS       0x00000010
119 #define SX_DEBUG_TRANSMIT      0x00000020
120 #define SX_DEBUG_RECEIVE       0x00000040
121 #define SX_DEBUG_INTERRUPTS    0x00000080
122 #define SX_DEBUG_PROBE         0x00000100
123 #define SX_DEBUG_INIT          0x00000200
124 #define SX_DEBUG_CLEANUP       0x00000400
125 #define SX_DEBUG_CLOSE         0x00000800
126 #define SX_DEBUG_FIRMWARE      0x00001000
127 #define SX_DEBUG_MEMTEST       0x00002000
128 
129 #define SX_DEBUG_ALL           0xffffffff
130 
131 
132 #define O_OTHER(tty)    \
133       ((O_OLCUC(tty))  ||\
134       (O_ONLCR(tty))   ||\
135       (O_OCRNL(tty))   ||\
136       (O_ONOCR(tty))   ||\
137       (O_ONLRET(tty))  ||\
138       (O_OFILL(tty))   ||\
139       (O_OFDEL(tty))   ||\
140       (O_NLDLY(tty))   ||\
141       (O_CRDLY(tty))   ||\
142       (O_TABDLY(tty))  ||\
143       (O_BSDLY(tty))   ||\
144       (O_VTDLY(tty))   ||\
145       (O_FFDLY(tty)))
146 
147 /* Same for input. */
148 #define I_OTHER(tty)    \
149       ((I_INLCR(tty))  ||\
150       (I_IGNCR(tty))   ||\
151       (I_ICRNL(tty))   ||\
152       (I_IUCLC(tty))   ||\
153       (L_ISIG(tty)))
154 
155 #define MOD_TA   (        TA>>4)
156 #define MOD_MTA  (MTA_CD1400>>4)
157 #define MOD_SXDC (      SXDC>>4)
158 
159 
160 /* We copy the download code over to the card in chunks of ... bytes */
161 #define SX_CHUNK_SIZE 128
162 
163 #endif /* __KERNEL__ */
164 
165 
166 
167 /* Specialix document 6210046-11 page 3 */
168 #define SPX(X) (('S'<<24) | ('P' << 16) | (X))
169 
170 /* Specialix-Linux specific IOCTLS. */
171 #define SPXL(X) (SPX(('L' << 8) | (X)))
172 
173 
174 #define SXIO_SET_BOARD      SPXL(0x01)
175 #define SXIO_GET_TYPE       SPXL(0x02)
176 #define SXIO_DOWNLOAD       SPXL(0x03)
177 #define SXIO_INIT           SPXL(0x04)
178 #define SXIO_SETDEBUG       SPXL(0x05)
179 #define SXIO_GETDEBUG       SPXL(0x06)
180 #define SXIO_DO_RAMTEST     SPXL(0x07)
181 #define SXIO_SETGSDEBUG     SPXL(0x08)
182 #define SXIO_GETGSDEBUG     SPXL(0x09)
183 #define SXIO_GETNPORTS      SPXL(0x0a)
184 
185 
186 #ifndef SXCTL_MISC_MINOR
187 /* Allow others to gather this into "major.h" or something like that */
188 #define SXCTL_MISC_MINOR    167
189 #endif
190 
191 #ifndef SX_NORMAL_MAJOR
192 /* This allows overriding on the compiler commandline, or in a "major.h"
193    include or something like that */
194 #define SX_NORMAL_MAJOR  32
195 #define SX_CALLOUT_MAJOR 33
196 #endif
197 
198 
199 #define SX_TYPE_SX          0x01
200 #define SX_TYPE_SI          0x02
201 #define SX_TYPE_CF          0x03
202 
203 
204 #define WINDOW_LEN(board) (IS_CF_BOARD(board)?0x20000:SX_WINDOW_LEN)
205 /*                         Need a #define for ^^^^^^^ !!! */
206 
207