Go to the documentation of this file.
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
21 #include <asm/byteorder.h>
40 static inline void sOutB(
unsigned short port,
unsigned char value)
42 #ifdef ROCKET_DEBUG_IO
48 static inline void sOutW(
unsigned short port,
unsigned short value)
50 #ifdef ROCKET_DEBUG_IO
56 static inline void out32(
unsigned short port,
Byte_t *
p)
59 #ifdef ROCKET_DEBUG_IO
65 static inline unsigned char sInB(
unsigned short port)
70 static inline unsigned short sInW(
unsigned short port)
76 #define sOutStrW(port, addr, count) if (count) outsw(port, addr, count)
77 #define sInStrW(port, addr, count) if (count) insw(port, addr, count)
80 #define AIOP_CTL_SIZE 4
81 #define CHAN_AIOP_SIZE 8
82 #define MAX_PORTS_PER_AIOP 8
83 #define MAX_AIOPS_PER_BOARD 4
84 #define MAX_PORTS_PER_BOARD 32
93 #define CTLID_0001 0x0001
96 #define AIOPID_NULL -1
97 #define AIOPID_0001 0x0001
103 #define _CMD_REG 0x38
104 #define _INT_CHAN 0x39
105 #define _INT_MASK 0x3A
107 #define _INDX_ADDR 0x3C
108 #define _INDX_DATA 0x3E
115 #define _CHN_STAT0 0x20
116 #define _FIFO_CNT0 0x10
117 #define _INT_ID0 0x30
122 #define _TX_ENBLS 0x980
123 #define _TXCMP1 0x988
124 #define _TXCMP2 0x989
125 #define _TXREP1B1 0x98A
126 #define _TXREP1B2 0x98B
127 #define _TXREP2 0x98C
132 #define _RX_FIFO 0x000
133 #define _TX_FIFO 0x800
134 #define _RXF_OUTP 0x990
135 #define _RXF_INP 0x992
136 #define _TXF_OUTP 0x994
137 #define _TXF_INP 0x995
138 #define _TXP_CNT 0x996
139 #define _TXP_PNTR 0x997
141 #define PRI_PEND 0x80
142 #define TXFIFO_SIZE 255
143 #define RXFIFO_SIZE 1023
148 #define _TXP_BUF 0x9C0
149 #define TXP_SIZE 0x20
155 #define _TX_CTRL 0xFF0
156 #define _RX_CTRL 0xFF2
158 #define _CLK_PRE 0xFF6
160 #define STMBREAK 0x08
161 #define STMFRAME 0x04
162 #define STMRCVROVR 0x02
163 #define STMPARITY 0x01
164 #define STMERROR (STMBREAK | STMFRAME | STMPARITY)
165 #define STMBREAKH 0x800
166 #define STMFRAMEH 0x400
167 #define STMRCVROVRH 0x200
168 #define STMPARITYH 0x100
169 #define STMERRORH (STMBREAKH | STMFRAMEH | STMPARITYH)
174 #define TXFIFOMT 0x04
177 #define DRAINED (TXFIFOMT | TXSHRMT)
179 #define STATMODE 0x8000
180 #define RXFOVERFL 0x2000
181 #define RX2MATCH 0x1000
182 #define RX1MATCH 0x0800
183 #define RXBREAK 0x0400
184 #define RXFRAME 0x0200
185 #define RXPARITY 0x0100
186 #define STATERROR (RXBREAK | RXFRAME | RXPARITY)
188 #define CTSFC_EN 0x80
189 #define RTSTOG_EN 0x40
190 #define TXINT_EN 0x10
192 #define PARITY_EN 0x04
193 #define EVEN_PAR 0x02
194 #define DATA8BIT 0x01
196 #define SETBREAK 0x10
197 #define LOCALLOOP 0x08
200 #define TX_ENABLE 0x01
202 #define RTSFC_EN 0x40
203 #define RXPROC_EN 0x20
206 #define TRIG_1_2 0x10
207 #define TRIG_7_8 0x18
208 #define TRIG_MASK 0x18
209 #define SRCINT_EN 0x04
210 #define RXINT_EN 0x02
211 #define MCINT_EN 0x01
213 #define RXF_TRIG 0x20
214 #define TXFIFO_MT 0x10
216 #define DELTA_CD 0x04
217 #define DELTA_CTS 0x02
218 #define DELTA_DSR 0x01
220 #define REP1W2_EN 0x10
223 #define COMP2_EN 0x02
224 #define COMP1_EN 0x01
226 #define RESET_ALL 0x80
227 #define TXOVERIDE 0x40
228 #define RESETUART 0x20
229 #define RESTXFCNT 0x10
230 #define RESRXFCNT 0x08
232 #define INTSTAT0 0x01
233 #define INTSTAT1 0x02
234 #define INTSTAT2 0x04
235 #define INTSTAT3 0x08
238 #define INT_STROB 0x04
244 #define _CFG_INT_PCI 0x40
245 #define _PCI_INT_FUNC 0x3A
247 #define PCI_STROB 0x2000
248 #define INTR_EN_PCI 0x0010
253 #define _PCI_9030_INT_CTRL 0x4c
254 #define _PCI_9030_GPIO_CTRL 0x54
255 #define PCI_INT_CTRL_AIOP 0x0001
256 #define PCI_GPIO_CTRL_8PORT 0x4000
257 #define _PCI_9030_RING_IND 0xc0
259 #define CHAN3_EN 0x08
260 #define CHAN2_EN 0x04
261 #define CHAN1_EN 0x02
262 #define CHAN0_EN 0x01
263 #define FREQ_DIS 0x00
264 #define FREQ_274HZ 0x60
265 #define FREQ_137HZ 0x50
266 #define FREQ_69HZ 0x40
267 #define FREQ_34HZ 0x30
268 #define FREQ_17HZ 0x20
269 #define FREQ_9HZ 0x10
270 #define PERIODIC_ONLY 0x80
272 #define CHANINT_EN 0x0100
275 #define RREGDATASIZE 52
280 #define AIOP_INTR_BIT_0 0x0001
281 #define AIOP_INTR_BIT_1 0x0002
282 #define AIOP_INTR_BIT_2 0x0004
283 #define AIOP_INTR_BIT_3 0x0008
285 #define AIOP_INTR_BITS ( \
291 #define UPCI_AIOP_INTR_BIT_0 0x0004
292 #define UPCI_AIOP_INTR_BIT_1 0x0020
293 #define UPCI_AIOP_INTR_BIT_2 0x0100
294 #define UPCI_AIOP_INTR_BIT_3 0x0800
296 #define UPCI_AIOP_INTR_BITS ( \
297 UPCI_AIOP_INTR_BIT_0 \
298 | UPCI_AIOP_INTR_BIT_1 \
299 | UPCI_AIOP_INTR_BIT_2 \
300 | UPCI_AIOP_INTR_BIT_3)
370 #define InterfaceModeRS232 0x00
371 #define InterfaceModeRS422 0x08
372 #define InterfaceModeRS485 0x10
373 #define InterfaceModeRS232T 0x18
381 #define sClrBreak(ChP) \
383 (ChP)->TxControl[3] &= ~SETBREAK; \
384 out32((ChP)->IndexAddr,(ChP)->TxControl); \
393 #define sClrDTR(ChP) \
395 (ChP)->TxControl[3] &= ~SET_DTR; \
396 out32((ChP)->IndexAddr,(ChP)->TxControl); \
405 #define sClrRTS(ChP) \
407 if ((ChP)->rtsToggle) break; \
408 (ChP)->TxControl[3] &= ~SET_RTS; \
409 out32((ChP)->IndexAddr,(ChP)->TxControl); \
418 #define sClrTxXOFF(ChP) \
420 sOutB((ChP)->Cmd,TXOVERIDE | (Byte_t)(ChP)->ChanNum); \
421 sOutB((ChP)->Cmd,(Byte_t)(ChP)->ChanNum); \
431 #define sCtlNumToCtlPtr(CTLNUM) &sController[CTLNUM]
439 #define sControllerEOI(CTLP) sOutB((CTLP)->MReg2IO,(CTLP)->MReg2 | INT_STROB)
449 #define sPCIControllerEOI(CTLP) \
451 if ((CTLP)->isUPCI) { \
452 Word_t w = sInW((CTLP)->PCIIO); \
453 sOutW((CTLP)->PCIIO, (w ^ PCI_INT_CTRL_AIOP)); \
454 sOutW((CTLP)->PCIIO, w); \
457 sOutW((CTLP)->PCIIO, PCI_STROB); \
468 #define sDisAiop(CTLP,AIOPNUM) \
470 (CTLP)->MReg3 &= sBitMapClrTbl[AIOPNUM]; \
471 sOutB((CTLP)->MReg3IO,(CTLP)->MReg3); \
480 #define sDisCTSFlowCtl(ChP) \
482 (ChP)->TxControl[2] &= ~CTSFC_EN; \
483 out32((ChP)->IndexAddr,(ChP)->TxControl); \
492 #define sDisIXANY(ChP) \
494 (ChP)->R[0x0e] = 0x86; \
495 out32((ChP)->IndexAddr,&(ChP)->R[0x0c]); \
506 #define sDisParity(ChP) \
508 (ChP)->TxControl[2] &= ~PARITY_EN; \
509 out32((ChP)->IndexAddr,(ChP)->TxControl); \
518 #define sDisRTSToggle(ChP) \
520 (ChP)->TxControl[2] &= ~RTSTOG_EN; \
521 out32((ChP)->IndexAddr,(ChP)->TxControl); \
522 (ChP)->rtsToggle = 0; \
531 #define sDisRxFIFO(ChP) \
533 (ChP)->R[0x32] = 0x0a; \
534 out32((ChP)->IndexAddr,&(ChP)->R[0x30]); \
546 #define sDisRxStatusMode(ChP) sOutW((ChP)->ChanStat,0)
558 #define sDisTransmit(ChP) \
560 (ChP)->TxControl[3] &= ~TX_ENABLE; \
561 out32((ChP)->IndexAddr,(ChP)->TxControl); \
570 #define sDisTxSoftFlowCtl(ChP) \
572 (ChP)->R[0x06] = 0x8a; \
573 out32((ChP)->IndexAddr,&(ChP)->R[0x04]); \
583 #define sEnAiop(CTLP,AIOPNUM) \
585 (CTLP)->MReg3 |= sBitMapSetTbl[AIOPNUM]; \
586 sOutB((CTLP)->MReg3IO,(CTLP)->MReg3); \
595 #define sEnCTSFlowCtl(ChP) \
597 (ChP)->TxControl[2] |= CTSFC_EN; \
598 out32((ChP)->IndexAddr,(ChP)->TxControl); \
607 #define sEnIXANY(ChP) \
609 (ChP)->R[0x0e] = 0x21; \
610 out32((ChP)->IndexAddr,&(ChP)->R[0x0c]); \
624 #define sEnParity(ChP) \
626 (ChP)->TxControl[2] |= PARITY_EN; \
627 out32((ChP)->IndexAddr,(ChP)->TxControl); \
638 #define sEnRTSToggle(ChP) \
640 (ChP)->RxControl[2] &= ~RTSFC_EN; \
641 out32((ChP)->IndexAddr,(ChP)->RxControl); \
642 (ChP)->TxControl[2] |= RTSTOG_EN; \
643 (ChP)->TxControl[3] &= ~SET_RTS; \
644 out32((ChP)->IndexAddr,(ChP)->TxControl); \
645 (ChP)->rtsToggle = 1; \
654 #define sEnRxFIFO(ChP) \
656 (ChP)->R[0x32] = 0x08; \
657 out32((ChP)->IndexAddr,&(ChP)->R[0x30]); \
675 #define sEnRxProcessor(ChP) \
677 (ChP)->RxControl[2] |= RXPROC_EN; \
678 out32((ChP)->IndexAddr,(ChP)->RxControl); \
691 #define sEnRxStatusMode(ChP) sOutW((ChP)->ChanStat,STATMODE)
699 #define sEnTransmit(ChP) \
701 (ChP)->TxControl[3] |= TX_ENABLE; \
702 out32((ChP)->IndexAddr,(ChP)->TxControl); \
711 #define sEnTxSoftFlowCtl(ChP) \
713 (ChP)->R[0x06] = 0xc5; \
714 out32((ChP)->IndexAddr,&(ChP)->R[0x04]); \
727 #define sGetAiopIntStatus(CTLP,AIOPNUM) sInB((CTLP)->AiopIntChanIO[AIOPNUM])
737 #define sGetAiopNumChan(CTLP,AIOPNUM) (CTLP)->AiopNumChan[AIOPNUM]
753 #define sGetChanIntID(ChP) (sInB((ChP)->IntID) & (RXF_TRIG | TXFIFO_MT | SRC_INT | DELTA_CD | DELTA_CTS | DELTA_DSR))
763 #define sGetChanNum(ChP) (ChP)->ChanNum
791 #define sGetChanStatus(ChP) sInW((ChP)->ChanStat)
807 #define sGetChanStatusLo(ChP) sInB((ByteIO_t)(ChP)->ChanStat)
814 #define sGetChanRI(ChP) ((ChP)->CtlP->AltChanRingIndicator ? \
815 (sInB((ByteIO_t)((ChP)->ChanStat+8)) & DSR_ACT) : \
816 (((ChP)->CtlP->boardType == ROCKET_TYPE_PC104) ? \
817 (!(sInB((ChP)->CtlP->AiopIO[3]) & sBitMapSetTbl[(ChP)->ChanNum])) : \
832 #define sGetControllerIntStatus(CTLP) (sInB((CTLP)->MReg1IO) & 0x0f)
845 #define sPCIGetControllerIntStatus(CTLP) \
847 (sInW((CTLP)->PCIIO2) & UPCI_AIOP_INTR_BITS) : \
848 ((sInW((CTLP)->PCIIO) >> 8) & AIOP_INTR_BITS))
860 #define sGetRxCnt(ChP) sInW((ChP)->TxRxCount)
871 #define sGetTxCnt(ChP) sInB((ByteIO_t)(ChP)->TxRxCount)
880 #define sGetTxRxDataIO(ChP) (ChP)->TxRxData
891 #define sInitChanDefaults(ChP) \
893 (ChP)->CtlP = NULLCTLPTR; \
894 (ChP)->AiopNum = NULLAIOP; \
895 (ChP)->ChanID = AIOPID_NULL; \
896 (ChP)->ChanNum = NULLCHAN; \
906 #define sResetAiopByNum(CTLP,AIOPNUM) \
908 sOutB((CTLP)->AiopIO[(AIOPNUM)]+_CMD_REG,RESET_ALL); \
909 sOutB((CTLP)->AiopIO[(AIOPNUM)]+_CMD_REG,0x0); \
918 #define sSendBreak(ChP) \
920 (ChP)->TxControl[3] |= SETBREAK; \
921 out32((ChP)->IndexAddr,(ChP)->TxControl); \
931 #define sSetBaud(ChP,DIVISOR) \
933 (ChP)->BaudDiv[2] = (Byte_t)(DIVISOR); \
934 (ChP)->BaudDiv[3] = (Byte_t)((DIVISOR) >> 8); \
935 out32((ChP)->IndexAddr,(ChP)->BaudDiv); \
944 #define sSetData7(ChP) \
946 (ChP)->TxControl[2] &= ~DATA8BIT; \
947 out32((ChP)->IndexAddr,(ChP)->TxControl); \
956 #define sSetData8(ChP) \
958 (ChP)->TxControl[2] |= DATA8BIT; \
959 out32((ChP)->IndexAddr,(ChP)->TxControl); \
968 #define sSetDTR(ChP) \
970 (ChP)->TxControl[3] |= SET_DTR; \
971 out32((ChP)->IndexAddr,(ChP)->TxControl); \
985 #define sSetEvenParity(ChP) \
987 (ChP)->TxControl[2] |= EVEN_PAR; \
988 out32((ChP)->IndexAddr,(ChP)->TxControl); \
1002 #define sSetOddParity(ChP) \
1004 (ChP)->TxControl[2] &= ~EVEN_PAR; \
1005 out32((ChP)->IndexAddr,(ChP)->TxControl); \
1014 #define sSetRTS(ChP) \
1016 if ((ChP)->rtsToggle) break; \
1017 (ChP)->TxControl[3] |= SET_RTS; \
1018 out32((ChP)->IndexAddr,(ChP)->TxControl); \
1040 #define sSetRxTrigger(ChP,LEVEL) \
1042 (ChP)->RxControl[2] &= ~TRIG_MASK; \
1043 (ChP)->RxControl[2] |= LEVEL; \
1044 out32((ChP)->IndexAddr,(ChP)->RxControl); \
1053 #define sSetStop1(ChP) \
1055 (ChP)->TxControl[2] &= ~STOP2; \
1056 out32((ChP)->IndexAddr,(ChP)->TxControl); \
1065 #define sSetStop2(ChP) \
1067 (ChP)->TxControl[2] |= STOP2; \
1068 out32((ChP)->IndexAddr,(ChP)->TxControl); \
1078 #define sSetTxXOFFChar(ChP,CH) \
1080 (ChP)->R[0x07] = (CH); \
1081 out32((ChP)->IndexAddr,&(ChP)->R[0x04]); \
1091 #define sSetTxXONChar(ChP,CH) \
1093 (ChP)->R[0x0b] = (CH); \
1094 out32((ChP)->IndexAddr,&(ChP)->R[0x08]); \
1107 #define sStartRxProcessor(ChP) out32((ChP)->IndexAddr,&(ChP)->R[0])
1118 #define sWriteTxByte(IO,DATA) sOutB(IO,DATA)
1152 #define RPORT_MAGIC 0x525001
1154 #define NUM_BOARDS 8
1155 #define MAX_RP_PORTS (32*NUM_BOARDS)
1160 #define XMIT_BUF_SIZE 4096
1163 #define WAKEUP_CHARS 256
1168 #define TTY_ROCKET_MAJOR 46
1169 #define CUA_ROCKET_MAJOR 47
1171 #ifdef PCI_VENDOR_ID_RP
1172 #undef PCI_VENDOR_ID_RP
1173 #undef PCI_DEVICE_ID_RP8OCTA
1174 #undef PCI_DEVICE_ID_RP8INTF
1175 #undef PCI_DEVICE_ID_RP16INTF
1176 #undef PCI_DEVICE_ID_RP32INTF
1177 #undef PCI_DEVICE_ID_URP8OCTA
1178 #undef PCI_DEVICE_ID_URP8INTF
1179 #undef PCI_DEVICE_ID_URP16INTF
1180 #undef PCI_DEVICE_ID_CRP16INTF
1181 #undef PCI_DEVICE_ID_URP32INTF
1185 #define PCI_VENDOR_ID_RP 0x11fe
1188 #define PCI_DEVICE_ID_RP32INTF 0x0001
1189 #define PCI_DEVICE_ID_RP8INTF 0x0002
1190 #define PCI_DEVICE_ID_RP16INTF 0x0003
1191 #define PCI_DEVICE_ID_RP4QUAD 0x0004
1192 #define PCI_DEVICE_ID_RP8OCTA 0x0005
1193 #define PCI_DEVICE_ID_RP8J 0x0006
1194 #define PCI_DEVICE_ID_RP4J 0x0007
1195 #define PCI_DEVICE_ID_RP8SNI 0x0008
1196 #define PCI_DEVICE_ID_RP16SNI 0x0009
1197 #define PCI_DEVICE_ID_RPP4 0x000A
1198 #define PCI_DEVICE_ID_RPP8 0x000B
1199 #define PCI_DEVICE_ID_RP6M 0x000C
1200 #define PCI_DEVICE_ID_RP4M 0x000D
1201 #define PCI_DEVICE_ID_RP2_232 0x000E
1202 #define PCI_DEVICE_ID_RP2_422 0x000F
1205 #define PCI_DEVICE_ID_URP32INTF 0x0801
1206 #define PCI_DEVICE_ID_URP8INTF 0x0802
1207 #define PCI_DEVICE_ID_URP16INTF 0x0803
1208 #define PCI_DEVICE_ID_URP8OCTA 0x0805
1209 #define PCI_DEVICE_ID_UPCI_RM3_8PORT 0x080C
1210 #define PCI_DEVICE_ID_UPCI_RM3_4PORT 0x080D
1213 #define PCI_DEVICE_ID_CRP16INTF 0x0903