blob: f3a75791b8111abb7654ebbda2017d3ccf4da09a [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * rocket_int.h --- internal header file for rocket.c
3 *
4 * Written by Theodore Ts'o, Copyright 1997.
5 * Copyright 1997 Comtrol Corporation.
6 *
7 */
8
9/*
10 * Definition of the types in rcktpt_type
11 */
12#define ROCKET_TYPE_NORMAL 0
13#define ROCKET_TYPE_MODEM 1
14#define ROCKET_TYPE_MODEMII 2
15#define ROCKET_TYPE_MODEMIII 3
16#define ROCKET_TYPE_PC104 4
17
Matthias Kaehlcke69f545e2007-05-08 00:32:00 -070018#include <linux/mutex.h>
19
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#include <asm/io.h>
21#include <asm/byteorder.h>
22
23typedef unsigned char Byte_t;
24typedef unsigned int ByteIO_t;
25
26typedef unsigned int Word_t;
27typedef unsigned int WordIO_t;
28
29typedef unsigned long DWord_t;
30typedef unsigned int DWordIO_t;
31
32/*
33 * Note! Normally the Linux I/O macros already take care of
34 * byte-swapping the I/O instructions. However, all accesses using
35 * sOutDW aren't really 32-bit accesses, but should be handled in byte
36 * order. Hence the use of the cpu_to_le32() macro to byte-swap
37 * things to no-op the byte swapping done by the big-endian outl()
38 * instruction.
39 */
40
41#ifdef ROCKET_DEBUG_IO
42static inline void sOutB(unsigned short port, unsigned char value)
43{
44#ifdef ROCKET_DEBUG_IO
Jiri Slaby68562b72008-02-07 00:16:33 -080045 printk(KERN_DEBUG "sOutB(%x, %x)...\n", port, value);
Linus Torvalds1da177e2005-04-16 15:20:36 -070046#endif
47 outb_p(value, port);
48}
49
50static inline void sOutW(unsigned short port, unsigned short value)
51{
52#ifdef ROCKET_DEBUG_IO
Jiri Slaby68562b72008-02-07 00:16:33 -080053 printk(KERN_DEBUG "sOutW(%x, %x)...\n", port, value);
Linus Torvalds1da177e2005-04-16 15:20:36 -070054#endif
55 outw_p(value, port);
56}
57
58static inline void sOutDW(unsigned short port, unsigned long value)
59{
60#ifdef ROCKET_DEBUG_IO
Jiri Slaby68562b72008-02-07 00:16:33 -080061 printk(KERN_DEBUG "sOutDW(%x, %lx)...\n", port, value);
Linus Torvalds1da177e2005-04-16 15:20:36 -070062#endif
63 outl_p(cpu_to_le32(value), port);
64}
65
66static inline unsigned char sInB(unsigned short port)
67{
68 return inb_p(port);
69}
70
71static inline unsigned short sInW(unsigned short port)
72{
73 return inw_p(port);
74}
75
76#else /* !ROCKET_DEBUG_IO */
77#define sOutB(a, b) outb_p(b, a)
78#define sOutW(a, b) outw_p(b, a)
79#define sOutDW(port, value) outl_p(cpu_to_le32(value), port)
80#define sInB(a) (inb_p(a))
81#define sInW(a) (inw_p(a))
82#endif /* ROCKET_DEBUG_IO */
83
84/* This is used to move arrays of bytes so byte swapping isn't appropriate. */
85#define sOutStrW(port, addr, count) if (count) outsw(port, addr, count)
86#define sInStrW(port, addr, count) if (count) insw(port, addr, count)
87
88#define CTL_SIZE 8
89#define AIOP_CTL_SIZE 4
90#define CHAN_AIOP_SIZE 8
91#define MAX_PORTS_PER_AIOP 8
92#define MAX_AIOPS_PER_BOARD 4
93#define MAX_PORTS_PER_BOARD 32
94
95/* Bus type ID */
96#define isISA 0
97#define isPCI 1
98#define isMC 2
99
100/* Controller ID numbers */
101#define CTLID_NULL -1 /* no controller exists */
102#define CTLID_0001 0x0001 /* controller release 1 */
103
104/* AIOP ID numbers, identifies AIOP type implementing channel */
105#define AIOPID_NULL -1 /* no AIOP or channel exists */
106#define AIOPID_0001 0x0001 /* AIOP release 1 */
107
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108/************************************************************************
109 Global Register Offsets - Direct Access - Fixed values
110************************************************************************/
111
112#define _CMD_REG 0x38 /* Command Register 8 Write */
113#define _INT_CHAN 0x39 /* Interrupt Channel Register 8 Read */
114#define _INT_MASK 0x3A /* Interrupt Mask Register 8 Read / Write */
115#define _UNUSED 0x3B /* Unused 8 */
116#define _INDX_ADDR 0x3C /* Index Register Address 16 Write */
117#define _INDX_DATA 0x3E /* Index Register Data 8/16 Read / Write */
118
119/************************************************************************
120 Channel Register Offsets for 1st channel in AIOP - Direct Access
121************************************************************************/
122#define _TD0 0x00 /* Transmit Data 16 Write */
123#define _RD0 0x00 /* Receive Data 16 Read */
124#define _CHN_STAT0 0x20 /* Channel Status 8/16 Read / Write */
125#define _FIFO_CNT0 0x10 /* Transmit/Receive FIFO Count 16 Read */
126#define _INT_ID0 0x30 /* Interrupt Identification 8 Read */
127
128/************************************************************************
129 Tx Control Register Offsets - Indexed - External - Fixed
130************************************************************************/
131#define _TX_ENBLS 0x980 /* Tx Processor Enables Register 8 Read / Write */
132#define _TXCMP1 0x988 /* Transmit Compare Value #1 8 Read / Write */
133#define _TXCMP2 0x989 /* Transmit Compare Value #2 8 Read / Write */
134#define _TXREP1B1 0x98A /* Tx Replace Value #1 - Byte 1 8 Read / Write */
135#define _TXREP1B2 0x98B /* Tx Replace Value #1 - Byte 2 8 Read / Write */
136#define _TXREP2 0x98C /* Transmit Replace Value #2 8 Read / Write */
137
138/************************************************************************
139Memory Controller Register Offsets - Indexed - External - Fixed
140************************************************************************/
141#define _RX_FIFO 0x000 /* Rx FIFO */
142#define _TX_FIFO 0x800 /* Tx FIFO */
143#define _RXF_OUTP 0x990 /* Rx FIFO OUT pointer 16 Read / Write */
144#define _RXF_INP 0x992 /* Rx FIFO IN pointer 16 Read / Write */
145#define _TXF_OUTP 0x994 /* Tx FIFO OUT pointer 8 Read / Write */
146#define _TXF_INP 0x995 /* Tx FIFO IN pointer 8 Read / Write */
147#define _TXP_CNT 0x996 /* Tx Priority Count 8 Read / Write */
148#define _TXP_PNTR 0x997 /* Tx Priority Pointer 8 Read / Write */
149
150#define PRI_PEND 0x80 /* Priority data pending (bit7, Tx pri cnt) */
151#define TXFIFO_SIZE 255 /* size of Tx FIFO */
152#define RXFIFO_SIZE 1023 /* size of Rx FIFO */
153
154/************************************************************************
155Tx Priority Buffer - Indexed - External - Fixed
156************************************************************************/
157#define _TXP_BUF 0x9C0 /* Tx Priority Buffer 32 Bytes Read / Write */
158#define TXP_SIZE 0x20 /* 32 bytes */
159
160/************************************************************************
161Channel Register Offsets - Indexed - Internal - Fixed
162************************************************************************/
163
164#define _TX_CTRL 0xFF0 /* Transmit Control 16 Write */
165#define _RX_CTRL 0xFF2 /* Receive Control 8 Write */
166#define _BAUD 0xFF4 /* Baud Rate 16 Write */
167#define _CLK_PRE 0xFF6 /* Clock Prescaler 8 Write */
168
169#define STMBREAK 0x08 /* BREAK */
170#define STMFRAME 0x04 /* framing error */
171#define STMRCVROVR 0x02 /* receiver over run error */
172#define STMPARITY 0x01 /* parity error */
173#define STMERROR (STMBREAK | STMFRAME | STMPARITY)
174#define STMBREAKH 0x800 /* BREAK */
175#define STMFRAMEH 0x400 /* framing error */
176#define STMRCVROVRH 0x200 /* receiver over run error */
177#define STMPARITYH 0x100 /* parity error */
178#define STMERRORH (STMBREAKH | STMFRAMEH | STMPARITYH)
179
180#define CTS_ACT 0x20 /* CTS input asserted */
181#define DSR_ACT 0x10 /* DSR input asserted */
182#define CD_ACT 0x08 /* CD input asserted */
183#define TXFIFOMT 0x04 /* Tx FIFO is empty */
184#define TXSHRMT 0x02 /* Tx shift register is empty */
185#define RDA 0x01 /* Rx data available */
186#define DRAINED (TXFIFOMT | TXSHRMT) /* indicates Tx is drained */
187
188#define STATMODE 0x8000 /* status mode enable bit */
189#define RXFOVERFL 0x2000 /* receive FIFO overflow */
190#define RX2MATCH 0x1000 /* receive compare byte 2 match */
191#define RX1MATCH 0x0800 /* receive compare byte 1 match */
192#define RXBREAK 0x0400 /* received BREAK */
193#define RXFRAME 0x0200 /* received framing error */
194#define RXPARITY 0x0100 /* received parity error */
195#define STATERROR (RXBREAK | RXFRAME | RXPARITY)
196
197#define CTSFC_EN 0x80 /* CTS flow control enable bit */
198#define RTSTOG_EN 0x40 /* RTS toggle enable bit */
199#define TXINT_EN 0x10 /* transmit interrupt enable */
200#define STOP2 0x08 /* enable 2 stop bits (0 = 1 stop) */
201#define PARITY_EN 0x04 /* enable parity (0 = no parity) */
202#define EVEN_PAR 0x02 /* even parity (0 = odd parity) */
203#define DATA8BIT 0x01 /* 8 bit data (0 = 7 bit data) */
204
205#define SETBREAK 0x10 /* send break condition (must clear) */
206#define LOCALLOOP 0x08 /* local loopback set for test */
207#define SET_DTR 0x04 /* assert DTR */
208#define SET_RTS 0x02 /* assert RTS */
209#define TX_ENABLE 0x01 /* enable transmitter */
210
211#define RTSFC_EN 0x40 /* RTS flow control enable */
212#define RXPROC_EN 0x20 /* receive processor enable */
213#define TRIG_NO 0x00 /* Rx FIFO trigger level 0 (no trigger) */
214#define TRIG_1 0x08 /* trigger level 1 char */
215#define TRIG_1_2 0x10 /* trigger level 1/2 */
216#define TRIG_7_8 0x18 /* trigger level 7/8 */
217#define TRIG_MASK 0x18 /* trigger level mask */
218#define SRCINT_EN 0x04 /* special Rx condition interrupt enable */
219#define RXINT_EN 0x02 /* Rx interrupt enable */
220#define MCINT_EN 0x01 /* modem change interrupt enable */
221
222#define RXF_TRIG 0x20 /* Rx FIFO trigger level interrupt */
223#define TXFIFO_MT 0x10 /* Tx FIFO empty interrupt */
224#define SRC_INT 0x08 /* special receive condition interrupt */
225#define DELTA_CD 0x04 /* CD change interrupt */
226#define DELTA_CTS 0x02 /* CTS change interrupt */
227#define DELTA_DSR 0x01 /* DSR change interrupt */
228
229#define REP1W2_EN 0x10 /* replace byte 1 with 2 bytes enable */
230#define IGN2_EN 0x08 /* ignore byte 2 enable */
231#define IGN1_EN 0x04 /* ignore byte 1 enable */
232#define COMP2_EN 0x02 /* compare byte 2 enable */
233#define COMP1_EN 0x01 /* compare byte 1 enable */
234
235#define RESET_ALL 0x80 /* reset AIOP (all channels) */
236#define TXOVERIDE 0x40 /* Transmit software off override */
237#define RESETUART 0x20 /* reset channel's UART */
238#define RESTXFCNT 0x10 /* reset channel's Tx FIFO count register */
239#define RESRXFCNT 0x08 /* reset channel's Rx FIFO count register */
240
241#define INTSTAT0 0x01 /* AIOP 0 interrupt status */
242#define INTSTAT1 0x02 /* AIOP 1 interrupt status */
243#define INTSTAT2 0x04 /* AIOP 2 interrupt status */
244#define INTSTAT3 0x08 /* AIOP 3 interrupt status */
245
246#define INTR_EN 0x08 /* allow interrupts to host */
247#define INT_STROB 0x04 /* strobe and clear interrupt line (EOI) */
248
249/**************************************************************************
250 MUDBAC remapped for PCI
251**************************************************************************/
252
253#define _CFG_INT_PCI 0x40
254#define _PCI_INT_FUNC 0x3A
255
256#define PCI_STROB 0x2000 /* bit 13 of int aiop register */
257#define INTR_EN_PCI 0x0010 /* allow interrupts to host */
258
259/*
260 * Definitions for Universal PCI board registers
261 */
262#define _PCI_9030_INT_CTRL 0x4c /* Offsets from BAR1 */
263#define _PCI_9030_GPIO_CTRL 0x54
264#define PCI_INT_CTRL_AIOP 0x0001
265#define PCI_GPIO_CTRL_8PORT 0x4000
266#define _PCI_9030_RING_IND 0xc0 /* Offsets from BAR1 */
267
268#define CHAN3_EN 0x08 /* enable AIOP 3 */
269#define CHAN2_EN 0x04 /* enable AIOP 2 */
270#define CHAN1_EN 0x02 /* enable AIOP 1 */
271#define CHAN0_EN 0x01 /* enable AIOP 0 */
272#define FREQ_DIS 0x00
273#define FREQ_274HZ 0x60
274#define FREQ_137HZ 0x50
275#define FREQ_69HZ 0x40
276#define FREQ_34HZ 0x30
277#define FREQ_17HZ 0x20
278#define FREQ_9HZ 0x10
279#define PERIODIC_ONLY 0x80 /* only PERIODIC interrupt */
280
281#define CHANINT_EN 0x0100 /* flags to enable/disable channel ints */
282
283#define RDATASIZE 72
284#define RREGDATASIZE 52
285
286/*
287 * AIOP interrupt bits for ISA/PCI boards and UPCI boards.
288 */
289#define AIOP_INTR_BIT_0 0x0001
290#define AIOP_INTR_BIT_1 0x0002
291#define AIOP_INTR_BIT_2 0x0004
292#define AIOP_INTR_BIT_3 0x0008
293
294#define AIOP_INTR_BITS ( \
295 AIOP_INTR_BIT_0 \
296 | AIOP_INTR_BIT_1 \
297 | AIOP_INTR_BIT_2 \
298 | AIOP_INTR_BIT_3)
299
300#define UPCI_AIOP_INTR_BIT_0 0x0004
301#define UPCI_AIOP_INTR_BIT_1 0x0020
302#define UPCI_AIOP_INTR_BIT_2 0x0100
303#define UPCI_AIOP_INTR_BIT_3 0x0800
304
305#define UPCI_AIOP_INTR_BITS ( \
306 UPCI_AIOP_INTR_BIT_0 \
307 | UPCI_AIOP_INTR_BIT_1 \
308 | UPCI_AIOP_INTR_BIT_2 \
309 | UPCI_AIOP_INTR_BIT_3)
310
311/* Controller level information structure */
312typedef struct {
313 int CtlID;
314 int CtlNum;
315 int BusType;
316 int boardType;
317 int isUPCI;
318 WordIO_t PCIIO;
319 WordIO_t PCIIO2;
320 ByteIO_t MBaseIO;
321 ByteIO_t MReg1IO;
322 ByteIO_t MReg2IO;
323 ByteIO_t MReg3IO;
324 Byte_t MReg2;
325 Byte_t MReg3;
326 int NumAiop;
327 int AltChanRingIndicator;
328 ByteIO_t UPCIRingInd;
329 WordIO_t AiopIO[AIOP_CTL_SIZE];
330 ByteIO_t AiopIntChanIO[AIOP_CTL_SIZE];
331 int AiopID[AIOP_CTL_SIZE];
332 int AiopNumChan[AIOP_CTL_SIZE];
333 Word_t *AiopIntrBits;
334} CONTROLLER_T;
335
336typedef CONTROLLER_T CONTROLLER_t;
337
338/* Channel level information structure */
339typedef struct {
340 CONTROLLER_T *CtlP;
341 int AiopNum;
342 int ChanID;
343 int ChanNum;
344 int rtsToggle;
345
346 ByteIO_t Cmd;
347 ByteIO_t IntChan;
348 ByteIO_t IntMask;
349 DWordIO_t IndexAddr;
350 WordIO_t IndexData;
351
352 WordIO_t TxRxData;
353 WordIO_t ChanStat;
354 WordIO_t TxRxCount;
355 ByteIO_t IntID;
356
357 Word_t TxFIFO;
358 Word_t TxFIFOPtrs;
359 Word_t RxFIFO;
360 Word_t RxFIFOPtrs;
361 Word_t TxPrioCnt;
362 Word_t TxPrioPtr;
363 Word_t TxPrioBuf;
364
365 Byte_t R[RREGDATASIZE];
366
367 Byte_t BaudDiv[4];
368 Byte_t TxControl[4];
369 Byte_t RxControl[4];
370 Byte_t TxEnables[4];
371 Byte_t TxCompare[4];
372 Byte_t TxReplace1[4];
373 Byte_t TxReplace2[4];
374} CHANNEL_T;
375
376typedef CHANNEL_T CHANNEL_t;
377typedef CHANNEL_T *CHANPTR_T;
378
379#define InterfaceModeRS232 0x00
380#define InterfaceModeRS422 0x08
381#define InterfaceModeRS485 0x10
382#define InterfaceModeRS232T 0x18
383
384/***************************************************************************
385Function: sClrBreak
386Purpose: Stop sending a transmit BREAK signal
387Call: sClrBreak(ChP)
388 CHANNEL_T *ChP; Ptr to channel structure
389*/
390#define sClrBreak(ChP) \
391do { \
392 (ChP)->TxControl[3] &= ~SETBREAK; \
393 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \
394} while (0)
395
396/***************************************************************************
397Function: sClrDTR
398Purpose: Clr the DTR output
399Call: sClrDTR(ChP)
400 CHANNEL_T *ChP; Ptr to channel structure
401*/
402#define sClrDTR(ChP) \
403do { \
404 (ChP)->TxControl[3] &= ~SET_DTR; \
405 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \
406} while (0)
407
408/***************************************************************************
409Function: sClrRTS
410Purpose: Clr the RTS output
411Call: sClrRTS(ChP)
412 CHANNEL_T *ChP; Ptr to channel structure
413*/
414#define sClrRTS(ChP) \
415do { \
416 if ((ChP)->rtsToggle) break; \
417 (ChP)->TxControl[3] &= ~SET_RTS; \
418 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \
419} while (0)
420
421/***************************************************************************
422Function: sClrTxXOFF
423Purpose: Clear any existing transmit software flow control off condition
424Call: sClrTxXOFF(ChP)
425 CHANNEL_T *ChP; Ptr to channel structure
426*/
427#define sClrTxXOFF(ChP) \
428do { \
429 sOutB((ChP)->Cmd,TXOVERIDE | (Byte_t)(ChP)->ChanNum); \
430 sOutB((ChP)->Cmd,(Byte_t)(ChP)->ChanNum); \
431} while (0)
432
433/***************************************************************************
434Function: sCtlNumToCtlPtr
435Purpose: Convert a controller number to controller structure pointer
436Call: sCtlNumToCtlPtr(CtlNum)
437 int CtlNum; Controller number
438Return: CONTROLLER_T *: Ptr to controller structure
439*/
440#define sCtlNumToCtlPtr(CTLNUM) &sController[CTLNUM]
441
442/***************************************************************************
443Function: sControllerEOI
444Purpose: Strobe the MUDBAC's End Of Interrupt bit.
445Call: sControllerEOI(CtlP)
446 CONTROLLER_T *CtlP; Ptr to controller structure
447*/
448#define sControllerEOI(CTLP) sOutB((CTLP)->MReg2IO,(CTLP)->MReg2 | INT_STROB)
449
450/***************************************************************************
451Function: sPCIControllerEOI
452Purpose: Strobe the PCI End Of Interrupt bit.
453 For the UPCI boards, toggle the AIOP interrupt enable bit
454 (this was taken from the Windows driver).
455Call: sPCIControllerEOI(CtlP)
456 CONTROLLER_T *CtlP; Ptr to controller structure
457*/
458#define sPCIControllerEOI(CTLP) \
459do { \
460 if ((CTLP)->isUPCI) { \
461 Word_t w = sInW((CTLP)->PCIIO); \
462 sOutW((CTLP)->PCIIO, (w ^ PCI_INT_CTRL_AIOP)); \
463 sOutW((CTLP)->PCIIO, w); \
464 } \
465 else { \
466 sOutW((CTLP)->PCIIO, PCI_STROB); \
467 } \
468} while (0)
469
470/***************************************************************************
471Function: sDisAiop
472Purpose: Disable I/O access to an AIOP
473Call: sDisAiop(CltP)
474 CONTROLLER_T *CtlP; Ptr to controller structure
475 int AiopNum; Number of AIOP on controller
476*/
477#define sDisAiop(CTLP,AIOPNUM) \
478do { \
479 (CTLP)->MReg3 &= sBitMapClrTbl[AIOPNUM]; \
480 sOutB((CTLP)->MReg3IO,(CTLP)->MReg3); \
481} while (0)
482
483/***************************************************************************
484Function: sDisCTSFlowCtl
485Purpose: Disable output flow control using CTS
486Call: sDisCTSFlowCtl(ChP)
487 CHANNEL_T *ChP; Ptr to channel structure
488*/
489#define sDisCTSFlowCtl(ChP) \
490do { \
491 (ChP)->TxControl[2] &= ~CTSFC_EN; \
492 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \
493} while (0)
494
495/***************************************************************************
496Function: sDisIXANY
497Purpose: Disable IXANY Software Flow Control
498Call: sDisIXANY(ChP)
499 CHANNEL_T *ChP; Ptr to channel structure
500*/
501#define sDisIXANY(ChP) \
502do { \
503 (ChP)->R[0x0e] = 0x86; \
504 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x0c]); \
505} while (0)
506
507/***************************************************************************
508Function: DisParity
509Purpose: Disable parity
510Call: sDisParity(ChP)
511 CHANNEL_T *ChP; Ptr to channel structure
512Comments: Function sSetParity() can be used in place of functions sEnParity(),
513 sDisParity(), sSetOddParity(), and sSetEvenParity().
514*/
515#define sDisParity(ChP) \
516do { \
517 (ChP)->TxControl[2] &= ~PARITY_EN; \
518 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \
519} while (0)
520
521/***************************************************************************
522Function: sDisRTSToggle
523Purpose: Disable RTS toggle
524Call: sDisRTSToggle(ChP)
525 CHANNEL_T *ChP; Ptr to channel structure
526*/
527#define sDisRTSToggle(ChP) \
528do { \
529 (ChP)->TxControl[2] &= ~RTSTOG_EN; \
530 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \
531 (ChP)->rtsToggle = 0; \
532} while (0)
533
534/***************************************************************************
535Function: sDisRxFIFO
536Purpose: Disable Rx FIFO
537Call: sDisRxFIFO(ChP)
538 CHANNEL_T *ChP; Ptr to channel structure
539*/
540#define sDisRxFIFO(ChP) \
541do { \
542 (ChP)->R[0x32] = 0x0a; \
543 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x30]); \
544} while (0)
545
546/***************************************************************************
547Function: sDisRxStatusMode
548Purpose: Disable the Rx status mode
549Call: sDisRxStatusMode(ChP)
550 CHANNEL_T *ChP; Ptr to channel structure
551Comments: This takes the channel out of the receive status mode. All
552 subsequent reads of receive data using sReadRxWord() will return
553 two data bytes.
554*/
555#define sDisRxStatusMode(ChP) sOutW((ChP)->ChanStat,0)
556
557/***************************************************************************
558Function: sDisTransmit
559Purpose: Disable transmit
560Call: sDisTransmit(ChP)
561 CHANNEL_T *ChP; Ptr to channel structure
562 This disables movement of Tx data from the Tx FIFO into the 1 byte
563 Tx buffer. Therefore there could be up to a 2 byte latency
564 between the time sDisTransmit() is called and the transmit buffer
565 and transmit shift register going completely empty.
566*/
567#define sDisTransmit(ChP) \
568do { \
569 (ChP)->TxControl[3] &= ~TX_ENABLE; \
570 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \
571} while (0)
572
573/***************************************************************************
574Function: sDisTxSoftFlowCtl
575Purpose: Disable Tx Software Flow Control
576Call: sDisTxSoftFlowCtl(ChP)
577 CHANNEL_T *ChP; Ptr to channel structure
578*/
579#define sDisTxSoftFlowCtl(ChP) \
580do { \
581 (ChP)->R[0x06] = 0x8a; \
582 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x04]); \
583} while (0)
584
585/***************************************************************************
586Function: sEnAiop
587Purpose: Enable I/O access to an AIOP
588Call: sEnAiop(CltP)
589 CONTROLLER_T *CtlP; Ptr to controller structure
590 int AiopNum; Number of AIOP on controller
591*/
592#define sEnAiop(CTLP,AIOPNUM) \
593do { \
594 (CTLP)->MReg3 |= sBitMapSetTbl[AIOPNUM]; \
595 sOutB((CTLP)->MReg3IO,(CTLP)->MReg3); \
596} while (0)
597
598/***************************************************************************
599Function: sEnCTSFlowCtl
600Purpose: Enable output flow control using CTS
601Call: sEnCTSFlowCtl(ChP)
602 CHANNEL_T *ChP; Ptr to channel structure
603*/
604#define sEnCTSFlowCtl(ChP) \
605do { \
606 (ChP)->TxControl[2] |= CTSFC_EN; \
607 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \
608} while (0)
609
610/***************************************************************************
611Function: sEnIXANY
612Purpose: Enable IXANY Software Flow Control
613Call: sEnIXANY(ChP)
614 CHANNEL_T *ChP; Ptr to channel structure
615*/
616#define sEnIXANY(ChP) \
617do { \
618 (ChP)->R[0x0e] = 0x21; \
619 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x0c]); \
620} while (0)
621
622/***************************************************************************
623Function: EnParity
624Purpose: Enable parity
625Call: sEnParity(ChP)
626 CHANNEL_T *ChP; Ptr to channel structure
627Comments: Function sSetParity() can be used in place of functions sEnParity(),
628 sDisParity(), sSetOddParity(), and sSetEvenParity().
629
630Warnings: Before enabling parity odd or even parity should be chosen using
631 functions sSetOddParity() or sSetEvenParity().
632*/
633#define sEnParity(ChP) \
634do { \
635 (ChP)->TxControl[2] |= PARITY_EN; \
636 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \
637} while (0)
638
639/***************************************************************************
640Function: sEnRTSToggle
641Purpose: Enable RTS toggle
642Call: sEnRTSToggle(ChP)
643 CHANNEL_T *ChP; Ptr to channel structure
644Comments: This function will disable RTS flow control and clear the RTS
645 line to allow operation of RTS toggle.
646*/
647#define sEnRTSToggle(ChP) \
648do { \
649 (ChP)->RxControl[2] &= ~RTSFC_EN; \
650 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->RxControl[0]); \
651 (ChP)->TxControl[2] |= RTSTOG_EN; \
652 (ChP)->TxControl[3] &= ~SET_RTS; \
653 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \
654 (ChP)->rtsToggle = 1; \
655} while (0)
656
657/***************************************************************************
658Function: sEnRxFIFO
659Purpose: Enable Rx FIFO
660Call: sEnRxFIFO(ChP)
661 CHANNEL_T *ChP; Ptr to channel structure
662*/
663#define sEnRxFIFO(ChP) \
664do { \
665 (ChP)->R[0x32] = 0x08; \
666 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x30]); \
667} while (0)
668
669/***************************************************************************
670Function: sEnRxProcessor
671Purpose: Enable the receive processor
672Call: sEnRxProcessor(ChP)
673 CHANNEL_T *ChP; Ptr to channel structure
674Comments: This function is used to start the receive processor. When
675 the channel is in the reset state the receive processor is not
676 running. This is done to prevent the receive processor from
677 executing invalid microcode instructions prior to the
678 downloading of the microcode.
679
680Warnings: This function must be called after valid microcode has been
681 downloaded to the AIOP, and it must not be called before the
682 microcode has been downloaded.
683*/
684#define sEnRxProcessor(ChP) \
685do { \
686 (ChP)->RxControl[2] |= RXPROC_EN; \
687 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->RxControl[0]); \
688} while (0)
689
690/***************************************************************************
691Function: sEnRxStatusMode
692Purpose: Enable the Rx status mode
693Call: sEnRxStatusMode(ChP)
694 CHANNEL_T *ChP; Ptr to channel structure
695Comments: This places the channel in the receive status mode. All subsequent
696 reads of receive data using sReadRxWord() will return a data byte
697 in the low word and a status byte in the high word.
698
699*/
700#define sEnRxStatusMode(ChP) sOutW((ChP)->ChanStat,STATMODE)
701
702/***************************************************************************
703Function: sEnTransmit
704Purpose: Enable transmit
705Call: sEnTransmit(ChP)
706 CHANNEL_T *ChP; Ptr to channel structure
707*/
708#define sEnTransmit(ChP) \
709do { \
710 (ChP)->TxControl[3] |= TX_ENABLE; \
711 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \
712} while (0)
713
714/***************************************************************************
715Function: sEnTxSoftFlowCtl
716Purpose: Enable Tx Software Flow Control
717Call: sEnTxSoftFlowCtl(ChP)
718 CHANNEL_T *ChP; Ptr to channel structure
719*/
720#define sEnTxSoftFlowCtl(ChP) \
721do { \
722 (ChP)->R[0x06] = 0xc5; \
723 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x04]); \
724} while (0)
725
726/***************************************************************************
727Function: sGetAiopIntStatus
728Purpose: Get the AIOP interrupt status
729Call: sGetAiopIntStatus(CtlP,AiopNum)
730 CONTROLLER_T *CtlP; Ptr to controller structure
731 int AiopNum; AIOP number
732Return: Byte_t: The AIOP interrupt status. Bits 0 through 7
733 represent channels 0 through 7 respectively. If a
734 bit is set that channel is interrupting.
735*/
736#define sGetAiopIntStatus(CTLP,AIOPNUM) sInB((CTLP)->AiopIntChanIO[AIOPNUM])
737
738/***************************************************************************
739Function: sGetAiopNumChan
740Purpose: Get the number of channels supported by an AIOP
741Call: sGetAiopNumChan(CtlP,AiopNum)
742 CONTROLLER_T *CtlP; Ptr to controller structure
743 int AiopNum; AIOP number
744Return: int: The number of channels supported by the AIOP
745*/
746#define sGetAiopNumChan(CTLP,AIOPNUM) (CTLP)->AiopNumChan[AIOPNUM]
747
748/***************************************************************************
749Function: sGetChanIntID
750Purpose: Get a channel's interrupt identification byte
751Call: sGetChanIntID(ChP)
752 CHANNEL_T *ChP; Ptr to channel structure
753Return: Byte_t: The channel interrupt ID. Can be any
754 combination of the following flags:
755 RXF_TRIG: Rx FIFO trigger level interrupt
756 TXFIFO_MT: Tx FIFO empty interrupt
757 SRC_INT: Special receive condition interrupt
758 DELTA_CD: CD change interrupt
759 DELTA_CTS: CTS change interrupt
760 DELTA_DSR: DSR change interrupt
761*/
762#define sGetChanIntID(ChP) (sInB((ChP)->IntID) & (RXF_TRIG | TXFIFO_MT | SRC_INT | DELTA_CD | DELTA_CTS | DELTA_DSR))
763
764/***************************************************************************
765Function: sGetChanNum
766Purpose: Get the number of a channel within an AIOP
767Call: sGetChanNum(ChP)
768 CHANNEL_T *ChP; Ptr to channel structure
769Return: int: Channel number within AIOP, or NULLCHAN if channel does
770 not exist.
771*/
772#define sGetChanNum(ChP) (ChP)->ChanNum
773
774/***************************************************************************
775Function: sGetChanStatus
776Purpose: Get the channel status
777Call: sGetChanStatus(ChP)
778 CHANNEL_T *ChP; Ptr to channel structure
779Return: Word_t: The channel status. Can be any combination of
780 the following flags:
781 LOW BYTE FLAGS
782 CTS_ACT: CTS input asserted
783 DSR_ACT: DSR input asserted
784 CD_ACT: CD input asserted
785 TXFIFOMT: Tx FIFO is empty
786 TXSHRMT: Tx shift register is empty
787 RDA: Rx data available
788
789 HIGH BYTE FLAGS
790 STATMODE: status mode enable bit
791 RXFOVERFL: receive FIFO overflow
792 RX2MATCH: receive compare byte 2 match
793 RX1MATCH: receive compare byte 1 match
794 RXBREAK: received BREAK
795 RXFRAME: received framing error
796 RXPARITY: received parity error
797Warnings: This function will clear the high byte flags in the Channel
798 Status Register.
799*/
800#define sGetChanStatus(ChP) sInW((ChP)->ChanStat)
801
802/***************************************************************************
803Function: sGetChanStatusLo
804Purpose: Get the low byte only of the channel status
805Call: sGetChanStatusLo(ChP)
806 CHANNEL_T *ChP; Ptr to channel structure
807Return: Byte_t: The channel status low byte. Can be any combination
808 of the following flags:
809 CTS_ACT: CTS input asserted
810 DSR_ACT: DSR input asserted
811 CD_ACT: CD input asserted
812 TXFIFOMT: Tx FIFO is empty
813 TXSHRMT: Tx shift register is empty
814 RDA: Rx data available
815*/
816#define sGetChanStatusLo(ChP) sInB((ByteIO_t)(ChP)->ChanStat)
817
818/**********************************************************************
819 * Get RI status of channel
820 * Defined as a function in rocket.c -aes
821 */
822#if 0
823#define sGetChanRI(ChP) ((ChP)->CtlP->AltChanRingIndicator ? \
824 (sInB((ByteIO_t)((ChP)->ChanStat+8)) & DSR_ACT) : \
825 (((ChP)->CtlP->boardType == ROCKET_TYPE_PC104) ? \
826 (!(sInB((ChP)->CtlP->AiopIO[3]) & sBitMapSetTbl[(ChP)->ChanNum])) : \
827 0))
828#endif
829
830/***************************************************************************
831Function: sGetControllerIntStatus
832Purpose: Get the controller interrupt status
833Call: sGetControllerIntStatus(CtlP)
834 CONTROLLER_T *CtlP; Ptr to controller structure
835Return: Byte_t: The controller interrupt status in the lower 4
836 bits. Bits 0 through 3 represent AIOP's 0
837 through 3 respectively. If a bit is set that
838 AIOP is interrupting. Bits 4 through 7 will
839 always be cleared.
840*/
841#define sGetControllerIntStatus(CTLP) (sInB((CTLP)->MReg1IO) & 0x0f)
842
843/***************************************************************************
844Function: sPCIGetControllerIntStatus
845Purpose: Get the controller interrupt status
846Call: sPCIGetControllerIntStatus(CtlP)
847 CONTROLLER_T *CtlP; Ptr to controller structure
848Return: unsigned char: The controller interrupt status in the lower 4
849 bits and bit 4. Bits 0 through 3 represent AIOP's 0
850 through 3 respectively. Bit 4 is set if the int
851 was generated from periodic. If a bit is set the
852 AIOP is interrupting.
853*/
854#define sPCIGetControllerIntStatus(CTLP) \
855 ((CTLP)->isUPCI ? \
856 (sInW((CTLP)->PCIIO2) & UPCI_AIOP_INTR_BITS) : \
857 ((sInW((CTLP)->PCIIO) >> 8) & AIOP_INTR_BITS))
858
859/***************************************************************************
860
861Function: sGetRxCnt
862Purpose: Get the number of data bytes in the Rx FIFO
863Call: sGetRxCnt(ChP)
864 CHANNEL_T *ChP; Ptr to channel structure
865Return: int: The number of data bytes in the Rx FIFO.
866Comments: Byte read of count register is required to obtain Rx count.
867
868*/
869#define sGetRxCnt(ChP) sInW((ChP)->TxRxCount)
870
871/***************************************************************************
872Function: sGetTxCnt
873Purpose: Get the number of data bytes in the Tx FIFO
874Call: sGetTxCnt(ChP)
875 CHANNEL_T *ChP; Ptr to channel structure
876Return: Byte_t: The number of data bytes in the Tx FIFO.
877Comments: Byte read of count register is required to obtain Tx count.
878
879*/
880#define sGetTxCnt(ChP) sInB((ByteIO_t)(ChP)->TxRxCount)
881
882/*****************************************************************************
883Function: sGetTxRxDataIO
884Purpose: Get the I/O address of a channel's TxRx Data register
885Call: sGetTxRxDataIO(ChP)
886 CHANNEL_T *ChP; Ptr to channel structure
887Return: WordIO_t: I/O address of a channel's TxRx Data register
888*/
889#define sGetTxRxDataIO(ChP) (ChP)->TxRxData
890
891/***************************************************************************
892Function: sInitChanDefaults
893Purpose: Initialize a channel structure to it's default state.
894Call: sInitChanDefaults(ChP)
895 CHANNEL_T *ChP; Ptr to the channel structure
896Comments: This function must be called once for every channel structure
897 that exists before any other SSCI calls can be made.
898
899*/
900#define sInitChanDefaults(ChP) \
901do { \
902 (ChP)->CtlP = NULLCTLPTR; \
903 (ChP)->AiopNum = NULLAIOP; \
904 (ChP)->ChanID = AIOPID_NULL; \
905 (ChP)->ChanNum = NULLCHAN; \
906} while (0)
907
908/***************************************************************************
909Function: sResetAiopByNum
910Purpose: Reset the AIOP by number
911Call: sResetAiopByNum(CTLP,AIOPNUM)
912 CONTROLLER_T CTLP; Ptr to controller structure
913 AIOPNUM; AIOP index
914*/
915#define sResetAiopByNum(CTLP,AIOPNUM) \
916do { \
917 sOutB((CTLP)->AiopIO[(AIOPNUM)]+_CMD_REG,RESET_ALL); \
918 sOutB((CTLP)->AiopIO[(AIOPNUM)]+_CMD_REG,0x0); \
919} while (0)
920
921/***************************************************************************
922Function: sSendBreak
923Purpose: Send a transmit BREAK signal
924Call: sSendBreak(ChP)
925 CHANNEL_T *ChP; Ptr to channel structure
926*/
927#define sSendBreak(ChP) \
928do { \
929 (ChP)->TxControl[3] |= SETBREAK; \
930 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \
931} while (0)
932
933/***************************************************************************
934Function: sSetBaud
935Purpose: Set baud rate
936Call: sSetBaud(ChP,Divisor)
937 CHANNEL_T *ChP; Ptr to channel structure
938 Word_t Divisor; 16 bit baud rate divisor for channel
939*/
940#define sSetBaud(ChP,DIVISOR) \
941do { \
942 (ChP)->BaudDiv[2] = (Byte_t)(DIVISOR); \
943 (ChP)->BaudDiv[3] = (Byte_t)((DIVISOR) >> 8); \
944 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->BaudDiv[0]); \
945} while (0)
946
947/***************************************************************************
948Function: sSetData7
949Purpose: Set data bits to 7
950Call: sSetData7(ChP)
951 CHANNEL_T *ChP; Ptr to channel structure
952*/
953#define sSetData7(ChP) \
954do { \
955 (ChP)->TxControl[2] &= ~DATA8BIT; \
956 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \
957} while (0)
958
959/***************************************************************************
960Function: sSetData8
961Purpose: Set data bits to 8
962Call: sSetData8(ChP)
963 CHANNEL_T *ChP; Ptr to channel structure
964*/
965#define sSetData8(ChP) \
966do { \
967 (ChP)->TxControl[2] |= DATA8BIT; \
968 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \
969} while (0)
970
971/***************************************************************************
972Function: sSetDTR
973Purpose: Set the DTR output
974Call: sSetDTR(ChP)
975 CHANNEL_T *ChP; Ptr to channel structure
976*/
977#define sSetDTR(ChP) \
978do { \
979 (ChP)->TxControl[3] |= SET_DTR; \
980 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \
981} while (0)
982
983/***************************************************************************
984Function: sSetEvenParity
985Purpose: Set even parity
986Call: sSetEvenParity(ChP)
987 CHANNEL_T *ChP; Ptr to channel structure
988Comments: Function sSetParity() can be used in place of functions sEnParity(),
989 sDisParity(), sSetOddParity(), and sSetEvenParity().
990
991Warnings: This function has no effect unless parity is enabled with function
992 sEnParity().
993*/
994#define sSetEvenParity(ChP) \
995do { \
996 (ChP)->TxControl[2] |= EVEN_PAR; \
997 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \
998} while (0)
999
1000/***************************************************************************
1001Function: sSetOddParity
1002Purpose: Set odd parity
1003Call: sSetOddParity(ChP)
1004 CHANNEL_T *ChP; Ptr to channel structure
1005Comments: Function sSetParity() can be used in place of functions sEnParity(),
1006 sDisParity(), sSetOddParity(), and sSetEvenParity().
1007
1008Warnings: This function has no effect unless parity is enabled with function
1009 sEnParity().
1010*/
1011#define sSetOddParity(ChP) \
1012do { \
1013 (ChP)->TxControl[2] &= ~EVEN_PAR; \
1014 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \
1015} while (0)
1016
1017/***************************************************************************
1018Function: sSetRTS
1019Purpose: Set the RTS output
1020Call: sSetRTS(ChP)
1021 CHANNEL_T *ChP; Ptr to channel structure
1022*/
1023#define sSetRTS(ChP) \
1024do { \
1025 if ((ChP)->rtsToggle) break; \
1026 (ChP)->TxControl[3] |= SET_RTS; \
1027 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \
1028} while (0)
1029
1030/***************************************************************************
1031Function: sSetRxTrigger
1032Purpose: Set the Rx FIFO trigger level
1033Call: sSetRxProcessor(ChP,Level)
1034 CHANNEL_T *ChP; Ptr to channel structure
1035 Byte_t Level; Number of characters in Rx FIFO at which the
1036 interrupt will be generated. Can be any of the following flags:
1037
1038 TRIG_NO: no trigger
1039 TRIG_1: 1 character in FIFO
1040 TRIG_1_2: FIFO 1/2 full
1041 TRIG_7_8: FIFO 7/8 full
1042Comments: An interrupt will be generated when the trigger level is reached
1043 only if function sEnInterrupt() has been called with flag
1044 RXINT_EN set. The RXF_TRIG flag in the Interrupt Idenfification
1045 register will be set whenever the trigger level is reached
1046 regardless of the setting of RXINT_EN.
1047
1048*/
1049#define sSetRxTrigger(ChP,LEVEL) \
1050do { \
1051 (ChP)->RxControl[2] &= ~TRIG_MASK; \
1052 (ChP)->RxControl[2] |= LEVEL; \
1053 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->RxControl[0]); \
1054} while (0)
1055
1056/***************************************************************************
1057Function: sSetStop1
1058Purpose: Set stop bits to 1
1059Call: sSetStop1(ChP)
1060 CHANNEL_T *ChP; Ptr to channel structure
1061*/
1062#define sSetStop1(ChP) \
1063do { \
1064 (ChP)->TxControl[2] &= ~STOP2; \
1065 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \
1066} while (0)
1067
1068/***************************************************************************
1069Function: sSetStop2
1070Purpose: Set stop bits to 2
1071Call: sSetStop2(ChP)
1072 CHANNEL_T *ChP; Ptr to channel structure
1073*/
1074#define sSetStop2(ChP) \
1075do { \
1076 (ChP)->TxControl[2] |= STOP2; \
1077 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->TxControl[0]); \
1078} while (0)
1079
1080/***************************************************************************
1081Function: sSetTxXOFFChar
1082Purpose: Set the Tx XOFF flow control character
1083Call: sSetTxXOFFChar(ChP,Ch)
1084 CHANNEL_T *ChP; Ptr to channel structure
1085 Byte_t Ch; The value to set the Tx XOFF character to
1086*/
1087#define sSetTxXOFFChar(ChP,CH) \
1088do { \
1089 (ChP)->R[0x07] = (CH); \
1090 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x04]); \
1091} while (0)
1092
1093/***************************************************************************
1094Function: sSetTxXONChar
1095Purpose: Set the Tx XON flow control character
1096Call: sSetTxXONChar(ChP,Ch)
1097 CHANNEL_T *ChP; Ptr to channel structure
1098 Byte_t Ch; The value to set the Tx XON character to
1099*/
1100#define sSetTxXONChar(ChP,CH) \
1101do { \
1102 (ChP)->R[0x0b] = (CH); \
1103 sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0x08]); \
1104} while (0)
1105
1106/***************************************************************************
1107Function: sStartRxProcessor
1108Purpose: Start a channel's receive processor
1109Call: sStartRxProcessor(ChP)
1110 CHANNEL_T *ChP; Ptr to channel structure
1111Comments: This function is used to start a Rx processor after it was
1112 stopped with sStopRxProcessor() or sStopSWInFlowCtl(). It
1113 will restart both the Rx processor and software input flow control.
1114
1115*/
1116#define sStartRxProcessor(ChP) sOutDW((ChP)->IndexAddr,*(DWord_t *)&(ChP)->R[0])
1117
1118/***************************************************************************
1119Function: sWriteTxByte
1120Purpose: Write a transmit data byte to a channel.
1121 ByteIO_t io: Channel transmit register I/O address. This can
1122 be obtained with sGetTxRxDataIO().
1123 Byte_t Data; The transmit data byte.
1124Warnings: This function writes the data byte without checking to see if
1125 sMaxTxSize is exceeded in the Tx FIFO.
1126*/
1127#define sWriteTxByte(IO,DATA) sOutB(IO,DATA)
1128
Linus Torvalds1da177e2005-04-16 15:20:36 -07001129/*
1130 * Begin Linux specific definitions for the Rocketport driver
1131 *
1132 * This code is Copyright Theodore Ts'o, 1995-1997
1133 */
1134
1135struct r_port {
1136 int magic;
1137 int line;
1138 int flags;
1139 int count;
1140 int blocked_open;
1141 struct tty_struct *tty;
1142 unsigned int board:3;
1143 unsigned int aiop:2;
1144 unsigned int chan:3;
1145 CONTROLLER_t *ctlp;
1146 CHANNEL_t channel;
1147 int closing_wait;
1148 int close_delay;
1149 int intmask;
1150 int xmit_fifo_room; /* room in xmit fifo */
1151 unsigned char *xmit_buf;
1152 int xmit_head;
1153 int xmit_tail;
1154 int xmit_cnt;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001155 int cd_status;
1156 int ignore_status_mask;
1157 int read_status_mask;
1158 int cps;
1159
Linus Torvalds1da177e2005-04-16 15:20:36 -07001160 wait_queue_head_t open_wait;
Jiri Slaby8cf5a8c2007-10-18 03:06:25 -07001161 struct completion close_wait;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001162 spinlock_t slock;
Matthias Kaehlcke69f545e2007-05-08 00:32:00 -07001163 struct mutex write_mtx;
Linus Torvalds1da177e2005-04-16 15:20:36 -07001164};
1165
1166#define RPORT_MAGIC 0x525001
1167
1168#define NUM_BOARDS 8
1169#define MAX_RP_PORTS (32*NUM_BOARDS)
1170
1171/*
1172 * The size of the xmit buffer is 1 page, or 4096 bytes
1173 */
1174#define XMIT_BUF_SIZE 4096
1175
1176/* number of characters left in xmit buffer before we ask for more */
1177#define WAKEUP_CHARS 256
1178
1179/* Internal flags used only by the rocketport driver */
1180#define ROCKET_INITIALIZED 0x80000000 /* Port is active */
1181#define ROCKET_CLOSING 0x40000000 /* Serial port is closing */
1182#define ROCKET_NORMAL_ACTIVE 0x20000000 /* Normal port is active */
1183
Linus Torvalds1da177e2005-04-16 15:20:36 -07001184/*
1185 * Assigned major numbers for the Comtrol Rocketport
1186 */
1187#define TTY_ROCKET_MAJOR 46
1188#define CUA_ROCKET_MAJOR 47
1189
1190#ifdef PCI_VENDOR_ID_RP
1191#undef PCI_VENDOR_ID_RP
1192#undef PCI_DEVICE_ID_RP8OCTA
1193#undef PCI_DEVICE_ID_RP8INTF
1194#undef PCI_DEVICE_ID_RP16INTF
1195#undef PCI_DEVICE_ID_RP32INTF
1196#undef PCI_DEVICE_ID_URP8OCTA
1197#undef PCI_DEVICE_ID_URP8INTF
1198#undef PCI_DEVICE_ID_URP16INTF
1199#undef PCI_DEVICE_ID_CRP16INTF
1200#undef PCI_DEVICE_ID_URP32INTF
1201#endif
1202
1203/* Comtrol PCI Vendor ID */
1204#define PCI_VENDOR_ID_RP 0x11fe
1205
1206/* Comtrol Device ID's */
1207#define PCI_DEVICE_ID_RP32INTF 0x0001 /* Rocketport 32 port w/external I/F */
1208#define PCI_DEVICE_ID_RP8INTF 0x0002 /* Rocketport 8 port w/external I/F */
1209#define PCI_DEVICE_ID_RP16INTF 0x0003 /* Rocketport 16 port w/external I/F */
1210#define PCI_DEVICE_ID_RP4QUAD 0x0004 /* Rocketport 4 port w/quad cable */
1211#define PCI_DEVICE_ID_RP8OCTA 0x0005 /* Rocketport 8 port w/octa cable */
1212#define PCI_DEVICE_ID_RP8J 0x0006 /* Rocketport 8 port w/RJ11 connectors */
1213#define PCI_DEVICE_ID_RP4J 0x0007 /* Rocketport 4 port w/RJ11 connectors */
1214#define PCI_DEVICE_ID_RP8SNI 0x0008 /* Rocketport 8 port w/ DB78 SNI (Siemens) connector */
1215#define PCI_DEVICE_ID_RP16SNI 0x0009 /* Rocketport 16 port w/ DB78 SNI (Siemens) connector */
1216#define PCI_DEVICE_ID_RPP4 0x000A /* Rocketport Plus 4 port */
1217#define PCI_DEVICE_ID_RPP8 0x000B /* Rocketport Plus 8 port */
1218#define PCI_DEVICE_ID_RP6M 0x000C /* RocketModem 6 port */
1219#define PCI_DEVICE_ID_RP4M 0x000D /* RocketModem 4 port */
1220#define PCI_DEVICE_ID_RP2_232 0x000E /* Rocketport Plus 2 port RS232 */
1221#define PCI_DEVICE_ID_RP2_422 0x000F /* Rocketport Plus 2 port RS422 */
1222
1223/* Universal PCI boards */
1224#define PCI_DEVICE_ID_URP32INTF 0x0801 /* Rocketport UPCI 32 port w/external I/F */
1225#define PCI_DEVICE_ID_URP8INTF 0x0802 /* Rocketport UPCI 8 port w/external I/F */
1226#define PCI_DEVICE_ID_URP16INTF 0x0803 /* Rocketport UPCI 16 port w/external I/F */
1227#define PCI_DEVICE_ID_URP8OCTA 0x0805 /* Rocketport UPCI 8 port w/octa cable */
1228#define PCI_DEVICE_ID_UPCI_RM3_8PORT 0x080C /* Rocketmodem III 8 port */
1229#define PCI_DEVICE_ID_UPCI_RM3_4PORT 0x080D /* Rocketmodem III 4 port */
1230
1231/* Compact PCI device */
1232#define PCI_DEVICE_ID_CRP16INTF 0x0903 /* Rocketport Compact PCI 16 port w/external I/F */
1233