rocket_int.h 43 KB

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