Style(9) cleanup to src/sys/vfs, stage 20/21: umapfs.
[dragonfly.git] / sys / dev / serial / rp / rpreg.h
1 /* 
2  * Copyright (c) Comtrol Corporation <support@comtrol.com>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted prodived that the follwoing conditions
7  * are met.
8  * 1. Redistributions of source code must retain the above copyright 
9  *    notive, this list of conditions and the following disclainer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials prodided with the distribution.
13  * 3. All advertising materials mentioning features or use of this software
14  *    must display the following acknowledgement:
15  *       This product includes software developed by Comtrol Corporation.
16  * 4. The name of Comtrol Corporation may not be used to endorse or 
17  *    promote products derived from this software without specific 
18  *    prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY COMTROL CORPORATION ``AS IS'' AND ANY
21  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED.  IN NO EVENT SHALL COMTROL CORPORATION BE LIABLE FOR
24  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26  * OR SERVICES; LOSS OF USE, DATA, LIFE OR PROFITS; OR BUSINESS INTERRUPTION)
27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30  * SUCH DAMAGE.
31  *
32  * $FreeBSD: src/sys/dev/rp/rpreg.h,v 1.4.2.1 2002/06/18 03:11:46 obrien Exp $
33  * $DragonFly: src/sys/dev/serial/rp/rpreg.h,v 1.2 2003/06/17 04:28:29 dillon Exp $
34  */
35
36 /*
37  * Begin OS-specific defines -  rpreg.h - for RocketPort FreeBSD
38  */
39
40 typedef unsigned char Byte_t;
41 typedef unsigned int ByteIO_t;
42
43 typedef unsigned int Word_t;
44 typedef unsigned int WordIO_t;
45
46 typedef unsigned long DWord_t;
47 typedef unsigned int DWordIO_t;
48
49 #define rp_readio(size, ctlp, rid, offset) \
50         (bus_space_read_##size(rman_get_bustag(ctlp->io[rid]), rman_get_bushandle(ctlp->io[rid]), offset))
51 #define rp_readmultiio(size, ctlp, rid, offset, addr, count) \
52         (bus_space_read_multi_##size(rman_get_bustag(ctlp->io[rid]), rman_get_bushandle(ctlp->io[rid]), offset, addr, count))
53 #define rp_writeio(size, ctlp, rid, offset, data) \
54         (bus_space_write_##size(rman_get_bustag(ctlp->io[rid]), rman_get_bushandle(ctlp->io[rid]), offset, data))
55 #define rp_writemultiio(size, ctlp, rid, offset, addr, count) \
56         (bus_space_write_multi_##size(rman_get_bustag(ctlp->io[rid]), rman_get_bushandle(ctlp->io[rid]), offset, addr, count))
57
58 #define rp_readio1(ctlp, rid, offset)                           rp_readio(1, ctlp, rid, offset)
59 #define rp_readio2(ctlp, rid, offset)                           rp_readio(2, ctlp, rid, offset)
60 #define rp_readio4(ctlp, rid, offset)                           rp_readio(4, ctlp, rid, offset)
61 #define rp_writeio1(ctlp, rid, offset, data)                    rp_writeio(1, ctlp, rid, offset, data)
62 #define rp_writeio2(ctlp, rid, offset, data)                    rp_writeio(2, ctlp, rid, offset, data)
63 #define rp_writeio4(ctlp, rid, offset, data)                    rp_writeio(4, ctlp, rid, offset, data)
64 #define rp_readmultiio1(ctlp, rid, offset, addr, count)         rp_readmultiio(1, ctlp, rid, offset, addr, count) 
65 #define rp_readmultiio2(ctlp, rid, offset, addr, count)         rp_readmultiio(2, ctlp, rid, offset, addr, count) 
66 #define rp_readmultiio4(ctlp, rid, offset, addr, count)         rp_readmultiio(4, ctlp, rid, offset, addr, count) 
67 #define rp_writemultiio1(ctlp, rid, offset, addr, count)        rp_writemultiio(1, ctlp, rid, offset, addr, count) 
68 #define rp_writemultiio2(ctlp, rid, offset, addr, count)        rp_writemultiio(2, ctlp, rid, offset, addr, count) 
69 #define rp_writemultiio4(ctlp, rid, offset, addr, count)        rp_writemultiio(4, ctlp, rid, offset, addr, count) 
70
71 #define rp_readaiop1(ctlp, aiop, offset) \
72         (rp_readio1((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset)))
73 #define rp_readaiop2(ctlp, aiop, offset) \
74         (rp_readio2((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset)))
75 #define rp_readaiop4(ctlp, aiop, offset) \
76         (rp_readio4((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset)))
77 #define rp_readmultiaiop1(ctlp, aiop, offset, addr, count) \
78         (rp_readmultiio1((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset), addr, count))
79 #define rp_readmultiaiop2(ctlp, aiop, offset, addr, count) \
80         (rp_readmultiio2((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset), addr, count))
81 #define rp_readmultiaiop4(ctlp, aiop, offset, addr, count) \
82         (rp_readmultiio4((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset), addr, count))
83 #define rp_writeaiop1(ctlp, aiop, offset, data) \
84         (rp_writeio1((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset), data))
85 #define rp_writeaiop2(ctlp, aiop, offset, data) \
86         (rp_writeio2((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset), data))
87 #define rp_writeaiop4(ctlp, aiop, offset, data) \
88         (rp_writeio4((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset), data))
89 #define rp_writemultiaiop1(ctlp, aiop, offset, addr, count) \
90         (rp_writemultiio1((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset), addr, count))
91 #define rp_writemultiaiop2(ctlp, aiop, offset, addr, count) \
92         (rp_writemultiio2((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset), addr, count))
93 #define rp_writemultiaiop4(ctlp, aiop, offset, addr, count) \
94         (rp_writemultiio4((ctlp), (ctlp)->aiop2rid(aiop, offset), (ctlp)->aiop2off(aiop, offset), addr, count))
95
96 #define rp_readch1(chp, offset) \
97         (rp_readaiop1((chp)->CtlP, (chp)->AiopNum, offset))
98 #define rp_readch2(chp, offset) \
99         (rp_readaiop2((chp)->CtlP, (chp)->AiopNum, offset))
100 #define rp_readch4(chp, offset) \
101         (rp_readaiop4((chp)->CtlP, (chp)->AiopNum, offset))
102 #define rp_readmultich1(chp, offset, addr, count) \
103         (rp_readmultiaiop1((chp)->CtlP, (chp)->AiopNum, offset, addr, count))
104 #define rp_readmultich2(chp, offset, addr, count) \
105         (rp_readmultiaiop2((chp)->CtlP, (chp)->AiopNum, offset, addr, count))
106 #define rp_readmultich4(chp, offset, addr, count) \
107         (rp_readmultiaiop4((chp)->CtlP, (chp)->AiopNum, offset, addr, count))
108 #define rp_writech1(chp, offset, data) \
109         (rp_writeaiop1((chp)->CtlP, (chp)->AiopNum, offset, data))
110 #define rp_writech2(chp, offset, data) \
111         (rp_writeaiop2((chp)->CtlP, (chp)->AiopNum, offset, data))
112 #define rp_writech4(chp, offset, data) \
113         (rp_writeaiop4((chp)->CtlP, (chp)->AiopNum, offset, data))
114 #define rp_writemultich1(chp, offset, addr, count) \
115         (rp_writemultiaiop1((chp)->CtlP, (chp)->AiopNum, offset, addr, count))
116 #define rp_writemultich2(chp, offset, addr, count) \
117         (rp_writemultiaiop2((chp)->CtlP, (chp)->AiopNum, offset, addr, count))
118 #define rp_writemultich4(chp, offset, addr, count) \
119         (rp_writemultiaiop4((chp)->CtlP, (chp)->AiopNum, offset, addr, count))
120
121 /*
122  * End of OS-specific defines
123  */
124
125 #define ROCKET_H
126
127 #define CTL_SIZE 4
128 #define AIOP_CTL_SIZE 4
129 #define CHAN_AIOP_SIZE 8
130 #define MAX_PORTS_PER_AIOP 8
131 #define MAX_AIOPS_PER_BOARD 4
132 #define MAX_PORTS_PER_BOARD 32
133
134 /* Controller ID numbers */
135 #define CTLID_NULL  -1              /* no controller exists */
136 #define CTLID_0001  0x0001          /* controller release 1 */
137
138 /* AIOP ID numbers, identifies AIOP type implementing channel */
139 #define AIOPID_NULL -1              /* no AIOP or channel exists */
140 #define AIOPID_0001 0x0001          /* AIOP release 1 */
141
142 #define NULLDEV -1                  /* identifies non-existant device */
143 #define NULLCTL -1                  /* identifies non-existant controller */
144 #define NULLCTLPTR (CONTROLLER_T *)0 /* identifies non-existant controller */
145 #define NULLAIOP -1                 /* identifies non-existant AIOP */
146 #define NULLCHAN -1                 /* identifies non-existant channel */
147
148 /************************************************************************
149  Global Register Offsets - Direct Access - Fixed values
150 ************************************************************************/
151
152 #define _CMD_REG   0x38   /* Command Register            8    Write */
153 #define _INT_CHAN  0x39   /* Interrupt Channel Register  8    Read */
154 #define _INT_MASK  0x3A   /* Interrupt Mask Register     8    Read / Write */
155 #define _UNUSED    0x3B   /* Unused                      8 */
156 #define _INDX_ADDR 0x3C   /* Index Register Address      16   Write */
157 #define _INDX_DATA 0x3E   /* Index Register Data         8/16 Read / Write */
158
159 /************************************************************************
160  Channel Register Offsets for 1st channel in AIOP - Direct Access
161 ************************************************************************/
162 #define _TD0       0x00  /* Transmit Data               16   Write */
163 #define _RD0       0x00  /* Receive Data                16   Read */
164 #define _CHN_STAT0 0x20  /* Channel Status              8/16 Read / Write */
165 #define _FIFO_CNT0 0x10  /* Transmit/Receive FIFO Count 16   Read */
166 #define _INT_ID0   0x30  /* Interrupt Identification    8    Read */
167
168 /************************************************************************
169  Tx Control Register Offsets - Indexed - External - Fixed
170 ************************************************************************/
171 #define _TX_ENBLS  0x980    /* Tx Processor Enables Register 8 Read / Write */
172 #define _TXCMP1    0x988    /* Transmit Compare Value #1     8 Read / Write */
173 #define _TXCMP2    0x989    /* Transmit Compare Value #2     8 Read / Write */
174 #define _TXREP1B1  0x98A    /* Tx Replace Value #1 - Byte 1  8 Read / Write */
175 #define _TXREP1B2  0x98B    /* Tx Replace Value #1 - Byte 2  8 Read / Write */
176 #define _TXREP2    0x98C    /* Transmit Replace Value #2     8 Read / Write */
177
178 /************************************************************************
179  Receive FIFO
180 ************************************************************************/
181 #define RXFIFO_DATA     0x5f
182 #define RXFIFO_OUT      0x5c
183 #define RXFIFO_EN       0x08
184 #define RXFIFO_DIS      0xa7
185
186 /************************************************************************
187 Memory Controller Register Offsets - Indexed - External - Fixed
188 ************************************************************************/
189 #define _RX_FIFO    0x000    /* Rx FIFO */
190 #define _TX_FIFO    0x800    /* Tx FIFO */
191 #define _RXF_OUTP   0x990    /* Rx FIFO OUT pointer        16 Read / Write */
192 #define _RXF_INP    0x992    /* Rx FIFO IN pointer         16 Read / Write */
193 #define _TXF_OUTP   0x994    /* Tx FIFO OUT pointer        8  Read / Write */
194 #define _TXF_INP    0x995    /* Tx FIFO IN pointer         8  Read / Write */
195 #define _TXP_CNT    0x996    /* Tx Priority Count          8  Read / Write */
196 #define _TXP_PNTR   0x997    /* Tx Priority Pointer        8  Read / Write */
197
198 #define PRI_PEND    0x80     /* Priority data pending (bit7, Tx pri cnt) */
199 #define TXFIFO_SIZE 255      /* size of Tx FIFO */
200 #define RXFIFO_SIZE 1023     /* size of Rx FIFO */
201
202 /************************************************************************
203 Tx Priority Buffer - Indexed - External - Fixed
204 ************************************************************************/
205 #define _TXP_BUF    0x9C0    /* Tx Priority Buffer  32  Bytes   Read / Write */
206 #define TXP_SIZE    0x20     /* 32 bytes */
207
208 /************************************************************************
209 Channel Register Offsets - Indexed - Internal - Fixed
210 ************************************************************************/
211
212 #define _TX_CTRL    0xFF0    /* Transmit Control               16  Write */
213 #define _RX_CTRL    0xFF2    /* Receive Control                 8  Write */
214 #define _BAUD       0xFF4    /* Baud Rate                      16  Write */
215 #define _CLK_PRE    0xFF6    /* Clock Prescaler                 8  Write */
216
217 #define CLOCK_PRESC 0x19          /* mod 9 (divide by 10) prescale */
218
219 #define BRD50             4607
220 #define BRD75             3071
221 #define BRD110            2094
222 #define BRD134            1712
223 #define BRD150            1535
224 #define BRD200            1151
225 #define BRD300            767
226 #define BRD600            383
227 #define BRD1200           191
228 #define BRD1800           127
229 #define BRD2000           114
230 #define BRD2400           95
231 #define BRD3600           64
232 #define BRD4800           47
233 #define BRD7200           31
234 #define BRD9600           23
235 #define BRD14400          15
236 #define BRD19200          11
237 #define BRD38400          5
238 #define BRD57600          3
239 #define BRD76800          2
240 #define BRD115200         1
241 #define BRD230400         0
242
243 #define STMBREAK   0x08        /* BREAK */
244 #define STMFRAME   0x04        /* framing error */
245 #define STMRCVROVR 0x02        /* receiver over run error */
246 #define STMPARITY  0x01        /* parity error */
247 #define STMERROR   (STMBREAK | STMFRAME | STMPARITY)
248 #define STMBREAKH   0x800      /* BREAK */
249 #define STMFRAMEH   0x400      /* framing error */
250 #define STMRCVROVRH 0x200      /* receiver over run error */
251 #define STMPARITYH  0x100      /* parity error */
252 #define STMERRORH   (STMBREAKH | STMFRAMEH | STMPARITYH)
253
254 #define CTS_ACT   0x20        /* CTS input asserted */
255 #define DSR_ACT   0x10        /* DSR input asserted */
256 #define CD_ACT    0x08        /* CD input asserted */
257 #define TXFIFOMT  0x04        /* Tx FIFO is empty */
258 #define TXSHRMT   0x02        /* Tx shift register is empty */
259 #define RDA       0x01        /* Rx data available */
260 #define DRAINED (TXFIFOMT | TXSHRMT)  /* indicates Tx is drained */
261
262 #define STATMODE  0x8000      /* status mode enable bit */
263 #define RXFOVERFL 0x2000      /* receive FIFO overflow */
264 #define RX2MATCH  0x1000      /* receive compare byte 2 match */
265 #define RX1MATCH  0x0800      /* receive compare byte 1 match */
266 #define RXBREAK   0x0400      /* received BREAK */
267 #define RXFRAME   0x0200      /* received framing error */
268 #define RXPARITY  0x0100      /* received parity error */
269 #define STATERROR (RXBREAK | RXFRAME | RXPARITY)
270
271 #define CTSFC_EN  0x80        /* CTS flow control enable bit */
272 #define RTSTOG_EN 0x40        /* RTS toggle enable bit */
273 #define TXINT_EN  0x10        /* transmit interrupt enable */
274 #define STOP2     0x08        /* enable 2 stop bits (0 = 1 stop) */
275 #define PARITY_EN 0x04        /* enable parity (0 = no parity) */
276 #define EVEN_PAR  0x02        /* even parity (0 = odd parity) */
277 #define DATA8BIT  0x01        /* 8 bit data (0 = 7 bit data) */
278
279 #define SETBREAK  0x10        /* send break condition (must clear) */
280 #define LOCALLOOP 0x08        /* local loopback set for test */
281 #define SET_DTR   0x04        /* assert DTR */
282 #define SET_RTS   0x02        /* assert RTS */
283 #define TX_ENABLE 0x01        /* enable transmitter */
284
285 #define RTSFC_EN  0x40        /* RTS flow control enable */
286 #define RXPROC_EN 0x20        /* receive processor enable */
287 #define TRIG_NO   0x00        /* Rx FIFO trigger level 0 (no trigger) */
288 #define TRIG_1    0x08        /* trigger level 1 char */
289 #define TRIG_1_2  0x10        /* trigger level 1/2 */
290 #define TRIG_7_8  0x18        /* trigger level 7/8 */
291 #define TRIG_MASK 0x18        /* trigger level mask */
292 #define SRCINT_EN 0x04        /* special Rx condition interrupt enable */
293 #define RXINT_EN  0x02        /* Rx interrupt enable */
294 #define MCINT_EN  0x01        /* modem change interrupt enable */
295
296 #define RXF_TRIG  0x20        /* Rx FIFO trigger level interrupt */
297 #define TXFIFO_MT 0x10        /* Tx FIFO empty interrupt */
298 #define SRC_INT   0x08        /* special receive condition interrupt */
299 #define DELTA_CD  0x04        /* CD change interrupt */
300 #define DELTA_CTS 0x02        /* CTS change interrupt */
301 #define DELTA_DSR 0x01        /* DSR change interrupt */
302
303 #define REP1W2_EN 0x10        /* replace byte 1 with 2 bytes enable */
304 #define IGN2_EN   0x08        /* ignore byte 2 enable */
305 #define IGN1_EN   0x04        /* ignore byte 1 enable */
306 #define COMP2_EN  0x02        /* compare byte 2 enable */
307 #define COMP1_EN  0x01        /* compare byte 1 enable */
308
309 #define RESET_ALL 0x80        /* reset AIOP (all channels) */
310 #define TXOVERIDE 0x40        /* Transmit software off override */
311 #define RESETUART 0x20        /* reset channel's UART */
312 #define RESTXFCNT 0x10        /* reset channel's Tx FIFO count register */
313 #define RESRXFCNT 0x08        /* reset channel's Rx FIFO count register */
314
315 #define INTSTAT0  0x01        /* AIOP 0 interrupt status */
316 #define INTSTAT1  0x02        /* AIOP 1 interrupt status */
317 #define INTSTAT2  0x04        /* AIOP 2 interrupt status */
318 #define INTSTAT3  0x08        /* AIOP 3 interrupt status */
319
320 #define INTR_EN   0x08        /* allow interrupts to host */
321 #define INT_STROB 0x04        /* strobe and clear interrupt line (EOI) */
322
323 #define CHAN3_EN  0x08        /* enable AIOP 3 */
324 #define CHAN2_EN  0x04        /* enable AIOP 2 */
325 #define CHAN1_EN  0x02        /* enable AIOP 1 */
326 #define CHAN0_EN  0x01        /* enable AIOP 0 */
327 #define FREQ_DIS  0x00
328 #define FREQ_274HZ 0x60
329 #define FREQ_137HZ 0x50
330 #define FREQ_69HZ  0x40
331 #define FREQ_34HZ  0x30
332 #define FREQ_17HZ  0x20
333 #define FREQ_9HZ   0x10
334 #define PERIODIC_ONLY 0x80    /* only PERIODIC interrupt */
335
336 #define CHANINT_EN 0x0100           /* flags to enable/disable channel ints */
337
338 #define RDATASIZE 72
339 #define RREGDATASIZE 52
340
341 #ifndef TRUE
342 #define TRUE 1
343 #endif
344
345 #ifndef FALSE
346 #define FALSE 0
347 #endif
348
349 struct CONTROLLER_str;
350 struct CHANNEL_str;
351
352 /* The types of bus-specific methods */
353 typedef int rp_aiop2rid_t(int, int);
354 typedef int rp_aiop2off_t(int, int);
355 typedef unsigned char rp_ctlmask_t(struct CONTROLLER_str *);
356
357 /* Controller level information structure */
358 struct CONTROLLER_str
359 {
360         int             CtlID;
361         int             NumAiop;
362         int             AiopID[AIOP_CTL_SIZE];
363         int             AiopNumChan[AIOP_CTL_SIZE];
364
365         /* Device and resource management */
366         device_t                dev;            /* device */
367         int                     io_num;         /* Number of IO resources */
368         int                     *io_rid;        /* IO resource IDs */
369         struct resource         **io;           /* IO resources */
370
371         struct rp_port          *rp;            /* port */
372         struct tty              *tty;           /* tty */
373
374         /* Device nodes */
375         dev_t                   *dev_nodes;
376
377         /* Bus-specific properties */
378         void                    *bus_ctlp;
379
380         /* Bus-specific methods */
381         rp_aiop2rid_t           *aiop2rid;      /* (aiop, offset) -> rid */
382         rp_aiop2off_t           *aiop2off;      /* (aiop, offset) -> off */
383         rp_ctlmask_t            *ctlmask;       /* Int status */
384 };
385 typedef struct CONTROLLER_str CONTROLLER_T;
386 typedef CONTROLLER_T CONTROLLER_t;
387
388 /* Channel level information structure */
389 struct CHANNEL_str
390 {
391         CONTROLLER_t    *CtlP;
392         int             AiopNum;
393         int             ChanID;
394         int             ChanNum;
395
396         Word_t          TxFIFO;
397         Word_t          TxFIFOPtrs;
398         Word_t          RxFIFO;
399         Word_t          RxFIFOPtrs;
400         Word_t          TxPrioCnt;
401         Word_t          TxPrioPtr;
402         Word_t          TxPrioBuf;
403
404         Byte_t          R[RREGDATASIZE];
405
406         Byte_t          BaudDiv[4];
407         Byte_t          TxControl[4];
408         Byte_t          RxControl[4];
409         Byte_t          TxEnables[4];
410         Byte_t          TxCompare[4];
411         Byte_t          TxReplace1[4];
412         Byte_t          TxReplace2[4];
413 };
414
415 typedef struct CHANNEL_str CHANNEL_T;
416 typedef CHANNEL_T CHANNEL_t;
417 typedef CHANNEL_T * CHANPTR_T;
418
419 #define CHNOFF_TXRXDATA(chp)    ((chp)->ChanNum * 2 + _TD0)
420 #define CHNOFF_CHANSTAT(chp)    ((chp)->ChanNum * 2 + _CHN_STAT0)
421 #define CHNOFF_TXRXCOUNT(chp)   ((chp)->ChanNum * 2 + _FIFO_CNT0)
422 #define CHNOFF_INTID(chp)       ((chp)->ChanNum     + _INT_ID0)
423
424 /***************************************************************************
425 Function: sClrBreak
426 Purpose:  Stop sending a transmit BREAK signal
427 Call:     sClrBreak(ChP)
428           CHANNEL_T *ChP; Ptr to channel structure
429 */
430 #define sClrBreak(ChP) \
431 { \
432    (ChP)->TxControl[3] &= ~SETBREAK; \
433    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \
434 }
435
436 /***************************************************************************
437 Function: sClrDTR
438 Purpose:  Clr the DTR output
439 Call:     sClrDTR(ChP)
440           CHANNEL_T *ChP; Ptr to channel structure
441 */
442 #define sClrDTR(ChP) \
443 { \
444    (ChP)->TxControl[3] &= ~SET_DTR; \
445    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \
446 }
447
448 /***************************************************************************
449 Function: sClrRTS
450 Purpose:  Clr the RTS output
451 Call:     sClrRTS(ChP)
452           CHANNEL_T *ChP; Ptr to channel structure
453 */
454 #define sClrRTS(ChP) \
455 { \
456    (ChP)->TxControl[3] &= ~SET_RTS; \
457    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \
458 }
459
460 /***************************************************************************
461 Function: sClrTxXOFF
462 Purpose:  Clear any existing transmit software flow control off condition
463 Call:     sClrTxXOFF(ChP)
464           CHANNEL_T *ChP; Ptr to channel structure
465 */
466 #define sClrTxXOFF(ChP) \
467 { \
468    rp_writech1(ChP,_CMD_REG,TXOVERIDE | (Byte_t)(ChP)->ChanNum); \
469    rp_writech1(ChP,_CMD_REG,(Byte_t)(ChP)->ChanNum); \
470 }
471
472 /***************************************************************************
473 Function: sDisCTSFlowCtl
474 Purpose:  Disable output flow control using CTS
475 Call:     sDisCTSFlowCtl(ChP)
476           CHANNEL_T *ChP; Ptr to channel structure
477 */
478 #define sDisCTSFlowCtl(ChP) \
479 { \
480    (ChP)->TxControl[2] &= ~CTSFC_EN; \
481    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \
482 }
483
484 /***************************************************************************
485 Function: DisParity
486 Purpose:  Disable parity
487 Call:     sDisParity(ChP)
488           CHANNEL_T *ChP; Ptr to channel structure
489 Comments: Function sSetParity() can be used in place of functions sEnParity(),
490           sDisParity(), sSetOddParity(), and sSetEvenParity().
491 */
492 #define sDisParity(ChP) \
493 { \
494    (ChP)->TxControl[2] &= ~PARITY_EN; \
495    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \
496 }
497
498 /***************************************************************************
499 Function: sDisRxFIFO
500 Purpose:  Disable Rx FIFO
501 Call:     sDisRxFIFO(ChP)
502           CHANNEL_T *ChP; Ptr to channel structure
503 */
504 #define sDisRxFIFO(ChP) \
505 { \
506    (ChP)->R[0x32] = 0x0a; \
507    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->R[0x30]); \
508 }
509
510 /***************************************************************************
511 Function: sDisRxStatusMode
512 Purpose:  Disable the Rx status mode
513 Call:     sDisRxStatusMode(ChP)
514           CHANNEL_T *ChP; Ptr to channel structure
515 Comments: This takes the channel out of the receive status mode.  All
516           subsequent reads of receive data using sReadRxWord() will return
517           two data bytes.
518 */
519 #define sDisRxStatusMode(ChP) rp_writech2(ChP,CHNOFF_CHANSTAT(ChP),0)
520
521 /***************************************************************************
522 Function: sDisTransmit
523 Purpose:  Disable transmit
524 Call:     sDisTransmit(ChP)
525           CHANNEL_T *ChP; Ptr to channel structure
526           This disables movement of Tx data from the Tx FIFO into the 1 byte
527           Tx buffer.  Therefore there could be up to a 2 byte latency
528           between the time sDisTransmit() is called and the transmit buffer
529           and transmit shift register going completely empty.
530 */
531 #define sDisTransmit(ChP) \
532 { \
533    (ChP)->TxControl[3] &= ~TX_ENABLE; \
534    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \
535 }
536
537 /***************************************************************************
538 Function: sDisTxSoftFlowCtl
539 Purpose:  Disable Tx Software Flow Control
540 Call:     sDisTxSoftFlowCtl(ChP)
541           CHANNEL_T *ChP; Ptr to channel structure
542 */
543 #define sDisTxSoftFlowCtl(ChP) \
544 { \
545    (ChP)->R[0x06] = 0x8a; \
546    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->R[0x04]); \
547 }
548
549 /***************************************************************************
550 Function: sEnCTSFlowCtl
551 Purpose:  Enable output flow control using CTS
552 Call:     sEnCTSFlowCtl(ChP)
553           CHANNEL_T *ChP; Ptr to channel structure
554 */
555 #define sEnCTSFlowCtl(ChP) \
556 { \
557    (ChP)->TxControl[2] |= CTSFC_EN; \
558    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \
559 }
560
561 /***************************************************************************
562 Function: EnParity
563 Purpose:  Enable parity
564 Call:     sEnParity(ChP)
565           CHANNEL_T *ChP; Ptr to channel structure
566 Comments: Function sSetParity() can be used in place of functions sEnParity(),
567           sDisParity(), sSetOddParity(), and sSetEvenParity().
568
569 Warnings: Before enabling parity odd or even parity should be chosen using
570           functions sSetOddParity() or sSetEvenParity().
571 */
572 #define sEnParity(ChP) \
573 { \
574    (ChP)->TxControl[2] |= PARITY_EN; \
575    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \
576 }
577
578 /***************************************************************************
579 Function: sEnRTSFlowCtl
580 Return: void
581 */
582 #define sEnRTSFlowCtl(ChP) \
583 { \
584         (ChP)->TxControl[2] &= ~RTSTOG_EN; \
585         (ChP)->TxControl[3] &= ~SET_RTS; \
586    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \
587         (ChP)->RxControl[2] |= RTSFC_EN; \
588    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->RxControl[0]); \
589 }
590
591 /***************************************************************************
592 Function: sDisRTSFlowCtl
593 Return: void
594 */
595 #define sDisRTSFlowCtl(ChP) \
596 { \
597         (ChP)->RxControl[2] &= ~RTSFC_EN; \
598    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->RxControl[0]); \
599 }
600
601 /***************************************************************************
602 Function: sEnRxFIFO
603 Purpose:  Enable Rx FIFO
604 Call:     sEnRxFIFO(ChP)
605           CHANNEL_T *ChP; Ptr to channel structure
606 */
607 #define sEnRxFIFO(ChP) \
608 { \
609    (ChP)->R[0x32] = 0x08; \
610    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->R[0x30]); \
611 }
612
613 /***************************************************************************
614 Function: sEnRxProcessor
615 Purpose:  Enable the receive processor
616 Call:     sEnRxProcessor(ChP)
617           CHANNEL_T *ChP; Ptr to channel structure
618 Comments: This function is used to start the receive processor.  When
619           the channel is in the reset state the receive processor is not
620           running.  This is done to prevent the receive processor from
621           executing invalid microcode instructions prior to the
622           downloading of the microcode.
623
624 Warnings: This function must be called after valid microcode has been
625           downloaded to the AIOP, and it must not be called before the
626           microcode has been downloaded.
627 */
628 #define sEnRxProcessor(ChP) \
629 { \
630    (ChP)->RxControl[2] |= RXPROC_EN; \
631    rp_writech2(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->RxControl[0]); \
632 }
633
634 /***************************************************************************
635 Function: sEnRxStatusMode
636 Purpose:  Enable the Rx status mode
637 Call:     sEnRxStatusMode(ChP)
638           CHANNEL_T *ChP; Ptr to channel structure
639 Comments: This places the channel in the receive status mode.  All subsequent
640           reads of receive data using sReadRxWord() will return a data byte
641           in the low word and a status byte in the high word.
642
643 */
644 #define sEnRxStatusMode(ChP) rp_writech2(ChP,CHNOFF_CHANSTAT(ChP),STATMODE)
645
646 /***************************************************************************
647 Function: sEnTransmit
648 Purpose:  Enable transmit
649 Call:     sEnTransmit(ChP)
650           CHANNEL_T *ChP; Ptr to channel structure
651 */
652 #define sEnTransmit(ChP) \
653 { \
654    (ChP)->TxControl[3] |= TX_ENABLE; \
655    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \
656 }
657
658 /***************************************************************************
659 Function: sGetAiopIntStatus
660 Purpose:  Get the AIOP interrupt status
661 Call:     sGetAiopIntStatus(CtlP,AiopNum)
662           CONTROLLER_T *CtlP; Ptr to controller structure
663           int AiopNum; AIOP number
664 Return:   Byte_t: The AIOP interrupt status.  Bits 0 through 7
665                          represent channels 0 through 7 respectively.  If a
666                          bit is set that channel is interrupting.
667 */
668 #define sGetAiopIntStatus(CtlP,AIOPNUM) rp_readaiop1(CtlP,AIOPNUM,_INT_CHAN)
669
670 /***************************************************************************
671 Function: sGetAiopNumChan
672 Purpose:  Get the number of channels supported by an AIOP
673 Call:     sGetAiopNumChan(CtlP,AiopNum)
674           CONTROLLER_T *CtlP; Ptr to controller structure
675           int AiopNum; AIOP number
676 Return:   int: The number of channels supported by the AIOP
677 */
678 #define sGetAiopNumChan(CtlP,AIOPNUM) CtlP->AiopNumChan[AIOPNUM]
679
680 /***************************************************************************
681 Function: sGetChanIntID
682 Purpose:  Get a channel's interrupt identification byte
683 Call:     sGetChanIntID(ChP)
684           CHANNEL_T *ChP; Ptr to channel structure
685 Return:   Byte_t: The channel interrupt ID.  Can be any
686              combination of the following flags:
687                 RXF_TRIG:     Rx FIFO trigger level interrupt
688                 TXFIFO_MT:    Tx FIFO empty interrupt
689                 SRC_INT:      Special receive condition interrupt
690                 DELTA_CD:     CD change interrupt
691                 DELTA_CTS:    CTS change interrupt
692                 DELTA_DSR:    DSR change interrupt
693 */
694 #define sGetChanIntID(ChP) (rp_readch1(ChP,(ChP)->ChanNum+_INT_ID0) & (RXF_TRIG | TXFIFO_MT | SRC_INT | DELTA_CD | DELTA_CTS | DELTA_DSR))
695
696 /***************************************************************************
697 Function: sGetChanNum
698 Purpose:  Get the number of a channel within an AIOP
699 Call:     sGetChanNum(ChP)
700           CHANNEL_T *ChP; Ptr to channel structure
701 Return:   int: Channel number within AIOP, or NULLCHAN if channel does
702                not exist.
703 */
704 #define sGetChanNum(ChP) (ChP)->ChanNum
705
706 /***************************************************************************
707 Function: sGetChanStatus
708 Purpose:  Get the channel status
709 Call:     sGetChanStatus(ChP)
710           CHANNEL_T *ChP; Ptr to channel structure
711 Return:   Word_t: The channel status.  Can be any combination of
712              the following flags:
713                 LOW BYTE 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                 HIGH BYTE FLAGS
722                 STATMODE:     status mode enable bit
723                 RXFOVERFL:    receive FIFO overflow
724                 RX2MATCH:     receive compare byte 2 match
725                 RX1MATCH:     receive compare byte 1 match
726                 RXBREAK:      received BREAK
727                 RXFRAME:      received framing error
728                 RXPARITY:     received parity error
729 Warnings: This function will clear the high byte flags in the Channel
730           Status Register.
731 */
732 #define sGetChanStatus(ChP) rp_readch2(ChP,CHNOFF_CHANSTAT(ChP))
733
734 /***************************************************************************
735 Function: sGetChanStatusLo
736 Purpose:  Get the low byte only of the channel status
737 Call:     sGetChanStatusLo(ChP)
738           CHANNEL_T *ChP; Ptr to channel structure
739 Return:   Byte_t: The channel status low byte.  Can be any combination
740              of the following flags:
741                 CTS_ACT:      CTS input asserted
742                 DSR_ACT:      DSR input asserted
743                 CD_ACT:       CD input asserted
744                 TXFIFOMT:     Tx FIFO is empty
745                 TXSHRMT:      Tx shift register is empty
746                 RDA:          Rx data available
747 */
748 #define sGetChanStatusLo(ChP) rp_readch1(ChP,CHNOFF_CHANSTAT(ChP))
749
750 /***************************************************************************
751 Function: sGetRxCnt
752 Purpose:  Get the number of data bytes in the Rx FIFO
753 Call:     sGetRxCnt(ChP)
754           CHANNEL_T *ChP; Ptr to channel structure
755 Return:   int: The number of data bytes in the Rx FIFO.
756 Comments: Byte read of count register is required to obtain Rx count.
757
758 */
759 #define sGetRxCnt(ChP) rp_readch2(ChP,CHNOFF_TXRXCOUNT(ChP))
760
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 */
770 #define sGetTxCnt(ChP) rp_readch1(ChP,CHNOFF_TXRXCOUNT(ChP))
771
772 /*****************************************************************************
773 Function: sGetTxRxDataIO
774 Purpose:  Get the offset of a channel's TxRx Data register
775 Call:     sGetTxRxDataIO(ChP)
776           CHANNEL_T *ChP; Ptr to channel structure
777 Return:   WordIO_t: offset of a channel's TxRx Data register
778 */
779 #define sGetTxRxDataIO(ChP) CHNOFF_TXRXDATA(ChP)
780
781 /***************************************************************************
782 Function: sInitChanDefaults
783 Purpose:  Initialize a channel structure to its default state.
784 Call:     sInitChanDefaults(ChP)
785           CHANNEL_T *ChP; Ptr to the channel structure
786 Comments: This function must be called once for every channel structure
787           that exists before any other SSCI calls can be made.
788
789 */
790 #define sInitChanDefaults(ChP) \
791 { \
792    (ChP)->CtlP = NULLCTLPTR; \
793    (ChP)->AiopNum = NULLAIOP; \
794    (ChP)->ChanID = AIOPID_NULL; \
795    (ChP)->ChanNum = NULLCHAN; \
796 }
797
798 /***************************************************************************
799 Function: sResetAiopByNum
800 Purpose:  Reset the AIOP by number
801 Call:     sResetAiopByNum(CTLP,AIOPNUM)
802         CONTROLLER_T CTLP; Ptr to controller structure
803         AIOPNUM; AIOP index
804 */
805 #define sResetAiopByNum(CTLP,AIOPNUM) \
806 { \
807    rp_writeaiop1(CTLP,AIOPNUM,_CMD_REG,RESET_ALL); \
808    rp_writeaiop1(CTLP,AIOPNUM,_CMD_REG,0x0); \
809 }
810
811 /***************************************************************************
812 Function: sSendBreak
813 Purpose:  Send a transmit BREAK signal
814 Call:     sSendBreak(ChP)
815           CHANNEL_T *ChP; Ptr to channel structure
816 */
817 #define sSendBreak(ChP) \
818 { \
819    (ChP)->TxControl[3] |= SETBREAK; \
820    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \
821 }
822
823 /***************************************************************************
824 Function: sSetBaud
825 Purpose:  Set baud rate
826 Call:     sSetBaud(ChP,Divisor)
827           CHANNEL_T *ChP; Ptr to channel structure
828           Word_t Divisor; 16 bit baud rate divisor for channel
829 */
830 #define sSetBaud(ChP,DIVISOR) \
831 { \
832    (ChP)->BaudDiv[2] = (Byte_t)(DIVISOR); \
833    (ChP)->BaudDiv[3] = (Byte_t)((DIVISOR) >> 8); \
834    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->BaudDiv[0]); \
835 }
836
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 { \
845    (ChP)->TxControl[2] &= ~DATA8BIT; \
846    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \
847 }
848
849 /***************************************************************************
850 Function: sSetData8
851 Purpose:  Set data bits to 8
852 Call:     sSetData8(ChP)
853           CHANNEL_T *ChP; Ptr to channel structure
854 */
855 #define sSetData8(ChP) \
856 { \
857    (ChP)->TxControl[2] |= DATA8BIT; \
858    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \
859 }
860
861 /***************************************************************************
862 Function: sSetDTR
863 Purpose:  Set the DTR output
864 Call:     sSetDTR(ChP)
865           CHANNEL_T *ChP; Ptr to channel structure
866 */
867 #define sSetDTR(ChP) \
868 { \
869    (ChP)->TxControl[3] |= SET_DTR; \
870    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \
871 }
872
873 /***************************************************************************
874 Function: sSetEvenParity
875 Purpose:  Set even parity
876 Call:     sSetEvenParity(ChP)
877           CHANNEL_T *ChP; Ptr to channel structure
878 Comments: Function sSetParity() can be used in place of functions sEnParity(),
879           sDisParity(), sSetOddParity(), and sSetEvenParity().
880
881 Warnings: This function has no effect unless parity is enabled with function
882           sEnParity().
883 */
884 #define sSetEvenParity(ChP) \
885 { \
886    (ChP)->TxControl[2] |= EVEN_PAR; \
887    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \
888 }
889
890 /***************************************************************************
891 Function: sSetOddParity
892 Purpose:  Set odd parity
893 Call:     sSetOddParity(ChP)
894           CHANNEL_T *ChP; Ptr to channel structure
895 Comments: Function sSetParity() can be used in place of functions sEnParity(),
896           sDisParity(), sSetOddParity(), and sSetEvenParity().
897
898 Warnings: This function has no effect unless parity is enabled with function
899           sEnParity().
900 */
901 #define sSetOddParity(ChP) \
902 { \
903    (ChP)->TxControl[2] &= ~EVEN_PAR; \
904    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \
905 }
906
907 /***************************************************************************
908 Function: sSetRTS
909 Purpose:  Set the RTS output
910 Call:     sSetRTS(ChP)
911           CHANNEL_T *ChP; Ptr to channel structure
912 */
913 #define sSetRTS(ChP) \
914 { \
915    (ChP)->TxControl[3] |= SET_RTS; \
916    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \
917 }
918
919 /***************************************************************************
920 Function: sSetRxTrigger
921 Purpose:  Set the Rx FIFO trigger level
922 Call:     sSetRxProcessor(ChP,Level)
923           CHANNEL_T *ChP; Ptr to channel structure
924           Byte_t Level; Number of characters in Rx FIFO at which the
925              interrupt will be generated.  Can be any of the following flags:
926
927              TRIG_NO:   no trigger
928              TRIG_1:    1 character in FIFO
929              TRIG_1_2:  FIFO 1/2 full
930              TRIG_7_8:  FIFO 7/8 full
931 Comments: An interrupt will be generated when the trigger level is reached
932           only if function sEnInterrupt() has been called with flag
933           RXINT_EN set.  The RXF_TRIG flag in the Interrupt Idenfification
934           register will be set whenever the trigger level is reached
935           regardless of the setting of RXINT_EN.
936
937 */
938 #define sSetRxTrigger(ChP,LEVEL) \
939 { \
940    (ChP)->RxControl[2] &= ~TRIG_MASK; \
941    (ChP)->RxControl[2] |= LEVEL; \
942    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->RxControl[0]); \
943 }
944
945 /***************************************************************************
946 Function: sSetStop1
947 Purpose:  Set stop bits to 1
948 Call:     sSetStop1(ChP)
949           CHANNEL_T *ChP; Ptr to channel structure
950 */
951 #define sSetStop1(ChP) \
952 { \
953    (ChP)->TxControl[2] &= ~STOP2; \
954    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \
955 }
956
957 /***************************************************************************
958 Function: sSetStop2
959 Purpose:  Set stop bits to 2
960 Call:     sSetStop2(ChP)
961           CHANNEL_T *ChP; Ptr to channel structure
962 */
963 #define sSetStop2(ChP) \
964 { \
965    (ChP)->TxControl[2] |= STOP2; \
966    rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->TxControl[0]); \
967 }
968
969 /***************************************************************************
970 Function: sStartRxProcessor
971 Purpose:  Start a channel's receive processor
972 Call:     sStartRxProcessor(ChP)
973           CHANNEL_T *ChP; Ptr to channel structure
974 Comments: This function is used to start a Rx processor after it was
975           stopped with sStopRxProcessor() or sStopSWInFlowCtl().  It
976           will restart both the Rx processor and software input flow control.
977
978 */
979 #define sStartRxProcessor(ChP) rp_writech4(ChP,_INDX_ADDR,*(DWord_t *)&(ChP)->R[0])
980
981 /***************************************************************************
982 Function: sWriteTxByte
983 Purpose:  Write a transmit data byte to a channel.
984           CHANNEL_T *ChP; Ptr to channel structure
985           ByteIO_t io: Channel transmit register I/O address.  This can
986                            be obtained with sGetTxRxDataIO().
987           Byte_t Data; The transmit data byte.
988 Warnings: This function writes the data byte without checking to see if
989           sMaxTxSize is exceeded in the Tx FIFO.
990 */
991 #define sWriteTxByte(ChP,IO,DATA) rp_writech1(ChP,IO,DATA)
992
993 int sReadAiopID(CONTROLLER_T *CtlP, int aiop);
994 int sReadAiopNumChan(CONTROLLER_T *CtlP, int aiop);
995 int sInitChan(  CONTROLLER_T *CtlP,
996                 CHANNEL_T *ChP,
997                 int AiopNum,
998                 int ChanNum);
999 Byte_t sGetRxErrStatus(CHANNEL_T *ChP);
1000 void sStopRxProcessor(CHANNEL_T *ChP);
1001 void sStopSWInFlowCtl(CHANNEL_T *ChP);
1002 void sFlushRxFIFO(CHANNEL_T *ChP);
1003 void sFlushTxFIFO(CHANNEL_T *ChP);
1004 int sWriteTxPrioByte(CHANNEL_T *ChP, Byte_t Data);
1005 void sEnInterrupts(CHANNEL_T *ChP,Word_t Flags);
1006 void sDisInterrupts(CHANNEL_T *ChP,Word_t Flags);
1007 int rp_attachcommon(CONTROLLER_T *ctlp, int num_aiops, int num_ports);
1008 void rp_releaseresource(CONTROLLER_t *ctlp);
1009
1010 #ifndef ROCKET_C
1011 extern Byte_t R[RDATASIZE];
1012 extern CONTROLLER_T sController[CTL_SIZE];
1013 extern Byte_t sIRQMap[16];
1014 #endif
1015 extern Byte_t rp_sBitMapClrTbl[8];
1016 extern Byte_t rp_sBitMapSetTbl[8];