rocket_int.h 42 KB

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