43 #define ROCKET_PARANOIA_CHECK
44 #define ROCKET_DISABLE_SIMUSAGE
46 #undef ROCKET_SOFT_FLOW
47 #undef ROCKET_DEBUG_OPEN
48 #undef ROCKET_DEBUG_INTR
49 #undef ROCKET_DEBUG_WRITE
50 #undef ROCKET_DEBUG_FLOW
51 #undef ROCKET_DEBUG_THROTTLE
52 #undef ROCKET_DEBUG_WAIT_UNTIL_SENT
53 #undef ROCKET_DEBUG_RECEIVE
54 #undef ROCKET_DEBUG_HANGUP
56 #undef ROCKET_DEBUG_IO
58 #define POLL_PERIOD HZ/100
62 #include <linux/module.h>
63 #include <linux/errno.h>
65 #include <linux/kernel.h>
66 #include <linux/signal.h>
67 #include <linux/slab.h>
69 #include <linux/sched.h>
72 #include <linux/tty.h>
75 #include <linux/serial.h>
76 #include <linux/string.h>
77 #include <linux/fcntl.h>
78 #include <linux/ptrace.h>
83 #include <linux/wait.h>
84 #include <linux/pci.h>
87 #include <asm/unaligned.h>
88 #include <linux/bitops.h>
97 #define ROCKET_VERSION "2.09"
98 #define ROCKET_DATE "12-June-2003"
102 static void rp_do_poll(
unsigned long dummy);
116 static unsigned long board1;
117 static unsigned long board2;
118 static unsigned long board3;
119 static unsigned long board4;
121 static bool support_low_speed;
122 static unsigned long modem1;
123 static unsigned long modem2;
124 static unsigned long modem3;
125 static unsigned long modem4;
126 static unsigned long pc104_1[8];
127 static unsigned long pc104_2[8];
128 static unsigned long pc104_3[8];
129 static unsigned long pc104_4[8];
130 static unsigned long *pc104[4] = { pc104_1, pc104_2, pc104_3, pc104_4 };
133 static unsigned long rcktpt_io_addr[
NUM_BOARDS];
137 static int max_board;
161 0x00, 0x09, 0xf6, 0x82,
162 0x02, 0x09, 0x86, 0xfb,
163 0x04, 0x09, 0x00, 0x0a,
164 0x06, 0x09, 0x01, 0x0a,
165 0x08, 0x09, 0x8a, 0x13,
166 0x0a, 0x09, 0xc5, 0x11,
167 0x0c, 0x09, 0x86, 0x85,
168 0x0e, 0x09, 0x20, 0x0a,
169 0x10, 0x09, 0x21, 0x0a,
170 0x12, 0x09, 0x41, 0xff,
171 0x14, 0x09, 0x82, 0x00,
172 0x16, 0x09, 0x82, 0x7b,
173 0x18, 0x09, 0x8a, 0x7d,
174 0x1a, 0x09, 0x88, 0x81,
175 0x1c, 0x09, 0x86, 0x7a,
176 0x1e, 0x09, 0x84, 0x81,
177 0x20, 0x09, 0x82, 0x7c,
178 0x22, 0x09, 0x0a, 0x0a
182 0x00, 0x09, 0xf6, 0x82,
183 0x08, 0x09, 0x8a, 0x13,
184 0x0a, 0x09, 0xc5, 0x11,
185 0x0c, 0x09, 0x86, 0x85,
186 0x12, 0x09, 0x41, 0xff,
187 0x14, 0x09, 0x82, 0x00,
188 0x16, 0x09, 0x82, 0x7b,
189 0x18, 0x09, 0x8a, 0x7d,
190 0x1a, 0x09, 0x88, 0x81,
191 0x1c, 0x09, 0x86, 0x7a,
192 0x1e, 0x09, 0x84, 0x81,
193 0x20, 0x09, 0x82, 0x7c,
194 0x22, 0x09, 0x0a, 0x0a
198 {-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0},
199 {0, 0, 0, 0}, {-1, -1, -1, -1}, {0, 0, 0, 0}},
200 {-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0},
201 {0, 0, 0, 0}, {-1, -1, -1, -1}, {0, 0, 0, 0}},
202 {-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0},
203 {0, 0, 0, 0}, {-1, -1, -1, -1}, {0, 0, 0, 0}},
204 {-1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, {0, 0, 0, 0},
205 {0, 0, 0, 0}, {-1, -1, -1, -1}, {0, 0, 0, 0}}
208 static Byte_t sBitMapClrTbl[8] = {
209 0xfe, 0xfd, 0xfb, 0xf7, 0xef, 0xdf, 0xbf, 0x7f
212 static Byte_t sBitMapSetTbl[8] = {
213 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80
216 static int sClockPrescale = 0x14;
224 static unsigned long nextLineNumber;
227 static int __init init_ISA(
int i);
228 static void rp_wait_until_sent(
struct tty_struct *tty,
int timeout);
229 static void rp_flush_buffer(
struct tty_struct *tty);
230 static void rmSpeakerReset(
CONTROLLER_T * CtlP,
unsigned long model);
231 static unsigned char GetLineNumber(
int ctrl,
int aiop,
int ch);
232 static unsigned char SetLineNumber(
int ctrl,
int aiop,
int ch);
237 static void sFlushRxFIFO(
CHANNEL_T * ChP);
238 static void sFlushTxFIFO(
CHANNEL_T * ChP);
244 static int sPCIInitController(
CONTROLLER_T * CtlP,
int CtlNum,
245 ByteIO_t * AiopIOList,
int AiopIOListSize,
247 int PeriodicOnly,
int altChanRingIndicator,
250 ByteIO_t * AiopIOList,
int AiopIOListSize,
251 int IRQNum,
Byte_t Frequency,
int PeriodicOnly);
268 MODULE_PARM_DESC(support_low_speed,
"1 means support 50 baud, 0 means support 460400 baud");
278 MODULE_PARM_DESC(pc104_1,
"set interface types for ISA(PC104) board #1 (e.g. pc104_1=232,232,485,485,...");
280 MODULE_PARM_DESC(pc104_2,
"set interface types for ISA(PC104) board #2 (e.g. pc104_2=232,232,485,485,...");
282 MODULE_PARM_DESC(pc104_3,
"set interface types for ISA(PC104) board #3 (e.g. pc104_3=232,232,485,485,...");
284 MODULE_PARM_DESC(pc104_4,
"set interface types for ISA(PC104) board #4 (e.g. pc104_4=232,232,485,485,...");
286 static int rp_init(
void);
287 static void rp_cleanup_module(
void);
298 static inline int rocket_paranoia_check(
struct r_port *
info,
301 #ifdef ROCKET_PARANOIA_CHECK
306 "struct in %s\n", routine);
318 static void rp_do_receive(
struct r_port *info,
322 unsigned int CharNStat;
323 int ToRecv, wRecv, space;
327 #ifdef ROCKET_DEBUG_INTR
340 #ifdef ROCKET_DEBUG_RECEIVE
354 #ifdef ROCKET_DEBUG_RECEIVE
362 #ifdef ROCKET_DEBUG_RECEIVE
372 if (CharNStat & STMBREAKH)
382 tty_insert_flip_char(tty, CharNStat & 0xff, flag);
391 #ifdef ROCKET_DEBUG_RECEIVE
403 if (space < ToRecv) {
404 #ifdef ROCKET_DEBUG_RECEIVE
405 printk(
KERN_INFO "rp_do_receive:insufficient space ToRecv=%d space=%d\n", ToRecv, space);
427 static void rp_do_transmit(
struct r_port *info)
434 #ifdef ROCKET_DEBUG_INTR
456 if (c <= 0 || info->xmit_fifo_room <= 0)
465 #ifdef ROCKET_DEBUG_INTR
475 #ifdef ROCKETPORT_HAVE_POLL_WAIT
480 spin_unlock_irqrestore(&info->
slock, flags);
483 #ifdef ROCKET_DEBUG_INTR
494 static void rp_handle_port(
struct r_port *info)
498 unsigned int IntMask, ChanStatus;
505 "info->flags & NOT_INIT\n");
517 #ifdef ROCKET_DEBUG_INTR
522 rp_do_receive(info, tty, cp, ChanStatus);
525 #if (defined(ROCKET_DEBUG_OPEN) || defined(ROCKET_DEBUG_INTR) || defined(ROCKET_DEBUG_HANGUP))
527 (ChanStatus &
CD_ACT) ?
"on" :
"off");
530 #ifdef ROCKET_DEBUG_HANGUP
538 #ifdef ROCKET_DEBUG_INTR
552 static void rp_do_poll(
unsigned long dummy)
556 unsigned int xmitmask,
i;
557 unsigned int CtlMask;
558 unsigned char AiopMask;
562 for (ctrl = 0; ctrl < max_board; ctrl++) {
563 if (rcktpt_io_addr[ctrl] <= 0)
578 for (aiop = 0; CtlMask; aiop++) {
585 for (ch = 0; AiopMask; AiopMask >>= 1, ch++) {
590 line = GetLineNumber(ctrl, aiop, ch);
591 rp_handle_port(rp_table[line]);
607 if (xmitmask & (1 << i)) {
608 aiop = (i & 0x18) >> 3;
610 line = GetLineNumber(ctrl, aiop, ch);
611 rp_do_transmit(rp_table[line]);
637 line = SetLineNumber(board, aiop, chan);
656 info->
port.ops = &rocket_port_ops;
659 switch (pc104[board][line]) {
673 if (sInitChan(ctlp, &info->
channel, aiop, chan) == 0) {
688 switch (rocketMode) {
708 pci_dev ? &pci_dev->
dev :
NULL);
759 divisor = ((rp_baud_base[info->
board] + (baud >> 1)) /
baud) - 1;
760 if ((divisor >= 8192 || divisor < 0) && old_termios) {
764 divisor = (rp_baud_base[info->
board] /
baud) - 1;
766 if (divisor >= 8192 || divisor < 0) {
768 divisor = (rp_baud_base[info->
board] /
baud) - 1;
792 spin_unlock_irqrestore(&info->
slock, flags);
798 #ifdef ROCKET_SOFT_FLOW
851 switch (rocketMode) {
875 static void dtr_rts(
struct tty_port *port,
int on)
899 info = rp_table[tty->
index];
922 info->
xmit_buf = (
unsigned char *) page;
927 if (port->
count++ == 0) {
930 #ifdef ROCKET_DEBUG_OPEN
935 #ifdef ROCKET_DEBUG_OPEN
980 configure_r_port(tty, info,
NULL);
981 if (tty->termios.c_cflag &
CBAUD) {
991 #ifdef ROCKET_DEBUG_OPEN
992 printk(
KERN_INFO "rp_open returning after block_til_ready with %d\n", retval);
1009 if (rocket_paranoia_check(info,
"rp_close"))
1012 #ifdef ROCKET_DEBUG_OPEN
1029 rp_wait_until_sent(tty, timeout);
1043 rp_flush_buffer(tty);
1063 spin_lock_irq(&port->
lock);
1066 spin_unlock_irq(&port->
lock);
1074 #ifdef ROCKET_DEBUG_OPEN
1082 static void rp_set_termios(
struct tty_struct *tty,
1089 if (rocket_paranoia_check(info,
"rp_set_termios"))
1092 cflag = tty->termios.c_cflag;
1097 if (((cflag & CSIZE) ==
CS5) || ((cflag & CSIZE) ==
CS6))
1098 tty->termios.c_cflag =
1099 ((cflag & ~CSIZE) | (old_termios->
c_cflag & CSIZE));
1101 tty->termios.c_cflag &= ~
CMSPAR;
1103 configure_r_port(tty, info, old_termios);
1115 if (!tty->
hw_stopped || !(tty->termios.c_cflag & CRTSCTS))
1120 if ((old_termios->
c_cflag & CRTSCTS) && !(tty->termios.c_cflag & CRTSCTS)) {
1126 static int rp_break(
struct tty_struct *tty,
int break_state)
1129 unsigned long flags;
1131 if (rocket_paranoia_check(info,
"rp_break"))
1135 if (break_state == -1)
1139 spin_unlock_irqrestore(&info->
slock, flags);
1156 RingInd = !(sInB(CtlP->
UPCIRingInd) & sBitMapSetTbl[ChanNum]);
1160 RingInd = !(sInB(CtlP->
AiopIO[3]) & sBitMapSetTbl[ChanNum]);
1172 static int rp_tiocmget(
struct tty_struct *tty)
1192 static int rp_tiocmset(
struct tty_struct *tty,
1193 unsigned int set,
unsigned int clear)
1199 if (
set & TIOCM_DTR)
1203 if (clear & TIOCM_DTR)
1220 tmp.close_delay = info->
port.close_delay;
1221 tmp.closing_wait = info->
port.closing_wait;
1222 tmp.port = rcktpt_io_addr[(info->
line >> 5) & 3];
1246 configure_r_port(tty, info,
NULL);
1252 info->
port.close_delay = new_serial.close_delay;
1253 info->
port.closing_wait = new_serial.closing_wait;
1265 configure_r_port(tty, info,
NULL);
1283 tmp.tty_major = rocket_driver->
major;
1285 for (board = 0; board < 4; board++) {
1286 tmp.rocketModel[board].model = rocketModel[board].
model;
1288 tmp.rocketModel[board].numPorts = rocketModel[board].
numPorts;
1289 tmp.rocketModel[board].loadrm2 = rocketModel[board].
loadrm2;
1297 static int reset_rm2(
struct r_port *info,
void __user *
arg)
1314 sModemReset(info->
ctlp, info->
chan, reset);
1316 sPCIModemReset(info->
ctlp, info->
chan, reset);
1323 if (
copy_to_user(retvers, &driver_version,
sizeof (*retvers)))
1330 unsigned int cmd,
unsigned long arg)
1336 if (cmd !=
RCKP_GET_PORTS && rocket_paranoia_check(info,
"rp_ioctl"))
1345 ret = get_config(info, argp);
1348 ret = set_config(tty, info, argp);
1351 ret = get_ports(info, argp);
1354 ret = reset_rm2(info, argp);
1357 ret = get_version(info, argp);
1365 static void rp_send_xchar(
struct tty_struct *tty,
char ch)
1370 if (rocket_paranoia_check(info,
"rp_send_xchar"))
1375 sWriteTxPrioByte(cp, ch);
1380 static void rp_throttle(
struct tty_struct *tty)
1384 #ifdef ROCKET_DEBUG_THROTTLE
1386 tty->
ldisc.chars_in_buffer(tty));
1389 if (rocket_paranoia_check(info,
"rp_throttle"))
1398 static void rp_unthrottle(
struct tty_struct *tty)
1401 #ifdef ROCKET_DEBUG_THROTTLE
1403 tty->
ldisc.chars_in_buffer(tty));
1406 if (rocket_paranoia_check(info,
"rp_throttle"))
1427 #ifdef ROCKET_DEBUG_FLOW
1432 if (rocket_paranoia_check(info,
"rp_stop"))
1443 #ifdef ROCKET_DEBUG_FLOW
1448 if (rocket_paranoia_check(info,
"rp_stop"))
1459 static void rp_wait_until_sent(
struct tty_struct *tty,
int timeout)
1463 unsigned long orig_jiffies;
1464 int check_time, exit_time;
1467 if (rocket_paranoia_check(info,
"rp_wait_until_sent"))
1473 #ifdef ROCKET_DEBUG_WAIT_UNTIL_SENT
1474 printk(
KERN_INFO "In RP_wait_until_sent(%d) (jiff=%lu)...\n", timeout,
1483 check_time = (
HZ / info->
cps) / 5;
1485 check_time =
HZ * txcnt / info->
cps;
1488 exit_time = orig_jiffies + timeout -
jiffies;
1491 if (exit_time < check_time)
1492 check_time = exit_time;
1494 if (check_time == 0)
1496 #ifdef ROCKET_DEBUG_WAIT_UNTIL_SENT
1498 jiffies, check_time);
1505 #ifdef ROCKET_DEBUG_WAIT_UNTIL_SENT
1513 static void rp_hangup(
struct tty_struct *tty)
1517 unsigned long flags;
1519 if (rocket_paranoia_check(info,
"rp_hangup"))
1522 #if (defined(ROCKET_DEBUG_OPEN) || defined(ROCKET_DEBUG_HANGUP))
1525 rp_flush_buffer(tty);
1528 spin_unlock_irqrestore(&info->
port.lock, flags);
1531 if (info->
port.count)
1534 spin_unlock_irqrestore(&info->
port.lock, flags);
1557 static int rp_put_char(
struct tty_struct *tty,
unsigned char ch)
1561 unsigned long flags;
1563 if (rocket_paranoia_check(info,
"rp_put_char"))
1572 #ifdef ROCKET_DEBUG_WRITE
1591 spin_unlock_irqrestore(&info->
slock, flags);
1604 const unsigned char *
buf,
int count)
1608 const unsigned char *
b;
1610 unsigned long flags;
1612 if (count <= 0 || rocket_paranoia_check(info,
"rp_write"))
1618 #ifdef ROCKET_DEBUG_WRITE
1647 spin_unlock_irqrestore(&info->
slock, flags);
1671 spin_unlock_irqrestore(&info->
slock, flags);
1684 #ifdef ROCKETPORT_HAVE_POLL_WAIT
1697 static int rp_write_room(
struct tty_struct *tty)
1702 if (rocket_paranoia_check(info,
"rp_write_room"))
1708 #ifdef ROCKET_DEBUG_WRITE
1718 static int rp_chars_in_buffer(
struct tty_struct *tty)
1722 if (rocket_paranoia_check(info,
"rp_chars_in_buffer"))
1725 #ifdef ROCKET_DEBUG_WRITE
1736 static void rp_flush_buffer(
struct tty_struct *tty)
1740 unsigned long flags;
1742 if (rocket_paranoia_check(info,
"rp_flush_buffer"))
1747 spin_unlock_irqrestore(&info->
slock, flags);
1749 #ifdef ROCKETPORT_HAVE_POLL_WAIT
1771 static __init int register_PCI(
int i,
struct pci_dev *
dev)
1773 int num_aiops, aiop, max_num_aiops,
num_chan, chan;
1778 int altChanRingIndicator = 0;
1779 int ports_per_aiop = 8;
1798 strcpy(rocketModel[i].modelString,
"RocketPort 4 port w/quad cable");
1804 strcpy(rocketModel[i].modelString,
"RocketPort 8 port w/octa cable");
1810 strcpy(rocketModel[i].modelString,
"RocketPort UPCI 8 port w/octa cable");
1816 strcpy(rocketModel[i].modelString,
"RocketPort 8 port w/external I/F");
1822 strcpy(rocketModel[i].modelString,
"RocketPort UPCI 8 port w/external I/F");
1828 strcpy(rocketModel[i].modelString,
"RocketPort 8 port w/RJ11 connectors");
1835 strcpy(rocketModel[i].modelString,
"RocketPort 4 port w/RJ45 connectors");
1841 strcpy(rocketModel[i].modelString,
"RocketPort 8 port w/ custom DB78");
1847 strcpy(rocketModel[i].modelString,
"RocketPort 16 port w/ custom DB78");
1853 strcpy(rocketModel[i].modelString,
"RocketPort 16 port w/external I/F");
1859 strcpy(rocketModel[i].modelString,
"RocketPort UPCI 16 port w/external I/F");
1865 strcpy(rocketModel[i].modelString,
"RocketPort Compact PCI 16 port w/external I/F");
1871 strcpy(rocketModel[i].modelString,
"RocketPort 32 port w/external I/F");
1877 strcpy(rocketModel[i].modelString,
"RocketPort UPCI 32 port w/external I/F");
1883 altChanRingIndicator++;
1886 strcpy(rocketModel[i].modelString,
"RocketPort Plus 4 port");
1892 altChanRingIndicator++;
1895 strcpy(rocketModel[i].modelString,
"RocketPort Plus 8 port");
1901 altChanRingIndicator++;
1904 strcpy(rocketModel[i].modelString,
"RocketPort Plus 2 port RS232");
1910 altChanRingIndicator++;
1913 strcpy(rocketModel[i].modelString,
"RocketPort Plus 2 port RS422");
1931 strcpy(rocketModel[i].modelString,
"RocketModem 6 port");
1945 strcpy(rocketModel[i].modelString,
"RocketModem 4 port");
1982 strcpy(rocketModel[i].modelString,
"RocketModem III 8 port");
1992 strcpy(rocketModel[i].modelString,
"RocketModem III 4 port");
2004 sClockPrescale = 0x12;
2005 rp_baud_base[
i] = 921600;
2011 if (support_low_speed) {
2013 sClockPrescale = 0x19;
2014 rp_baud_base[
i] = 230400;
2017 sClockPrescale = 0x14;
2018 rp_baud_base[
i] = 460800;
2022 for (aiop = 0; aiop < max_num_aiops; aiop++)
2023 aiopio[aiop] = rcktpt_io_addr[i] + (aiop * 0x40);
2025 num_aiops = sPCIInitController(ctlp, i, aiopio, max_num_aiops, ConfigIO, 0,
FREQ_DIS, 0, altChanRingIndicator, UPCIRingInd);
2026 for (aiop = 0; aiop < max_num_aiops; aiop++)
2029 dev_info(&dev->
dev,
"comtrol PCI controller #%d found at "
2030 "address %04lx, %d AIOP(s) (%s), creating ttyR%d - %ld\n",
2031 i, rcktpt_io_addr[i], num_aiops, rocketModel[i].
modelString,
2035 if (num_aiops <= 0) {
2036 rcktpt_io_addr[
i] = 0;
2042 for (aiop = 0; aiop < num_aiops; aiop++) {
2044 num_chan = ports_per_aiop;
2045 for (chan = 0; chan <
num_chan; chan++)
2046 init_r_port(i, aiop, chan, dev);
2053 num_chan = ports_per_aiop;
2054 for (chan = 0; chan <
num_chan; chan++)
2055 sPCIModemReset(ctlp, chan, 1);
2057 for (chan = 0; chan <
num_chan; chan++)
2058 sPCIModemReset(ctlp, chan, 0);
2060 rmSpeakerReset(ctlp, rocketModel[i].model);
2071 static int __init init_PCI(
int boards_found)
2073 struct pci_dev *dev =
NULL;
2078 if (register_PCI(count + boards_found, dev))
2091 static int __init init_ISA(
int i)
2093 int num_aiops, num_chan = 0, total_num_chan = 0;
2100 if (rcktpt_io_addr[i] == 0)
2104 if (!
request_region(rcktpt_io_addr[i], 64,
"Comtrol RocketPort")) {
2106 "ISA RocketPort at address 0x%lx, board not "
2107 "installed...\n", rcktpt_io_addr[i]);
2108 rcktpt_io_addr[
i] = 0;
2116 switch (rcktpt_type[i]) {
2118 type_string =
"(PC104)";
2121 type_string =
"(RocketModem)";
2124 type_string =
"(RocketModem II)";
2135 if (support_low_speed) {
2136 sClockPrescale = 0x19;
2137 rp_baud_base[
i] = 230400;
2139 sClockPrescale = 0x14;
2140 rp_baud_base[
i] = 460800;
2144 aiopio[aiop] = rcktpt_io_addr[i] + (aiop * 0x400);
2146 num_aiops = sInitController(ctlp, i,
controller + (i * 0x400), aiopio, MAX_AIOPS_PER_BOARD, 0,
FREQ_DIS, 0);
2154 if (num_aiops <= 0) {
2156 rcktpt_io_addr[
i] = 0;
2162 for (aiop = 0; aiop < num_aiops; aiop++) {
2167 for (chan = 0; chan <
num_chan; chan++)
2168 init_r_port(i, aiop, chan,
NULL);
2174 for (chan = 0; chan <
num_chan; chan++)
2175 sModemReset(ctlp, chan, 1);
2177 for (chan = 0; chan <
num_chan; chan++)
2178 sModemReset(ctlp, chan, 0);
2180 strcpy(rocketModel[i].modelString,
"RocketModem ISA");
2182 strcpy(rocketModel[i].modelString,
"RocketPort ISA");
2184 rocketModel[
i].
numPorts = total_num_chan;
2187 printk(
KERN_INFO "RocketPort ISA card #%d found at 0x%lx - %d AIOPs %s\n",
2188 i, rcktpt_io_addr[i], num_aiops, type_string);
2191 rocketModel[i].modelString,
2192 rocketModel[i].startingPortNumber,
2193 rocketModel[i].startingPortNumber +
2194 rocketModel[i].numPorts - 1);
2203 .put_char = rp_put_char,
2204 .write_room = rp_write_room,
2205 .chars_in_buffer = rp_chars_in_buffer,
2206 .flush_buffer = rp_flush_buffer,
2208 .throttle = rp_throttle,
2209 .unthrottle = rp_unthrottle,
2210 .set_termios = rp_set_termios,
2213 .hangup = rp_hangup,
2214 .break_ctl = rp_break,
2215 .send_xchar = rp_send_xchar,
2216 .wait_until_sent = rp_wait_until_sent,
2217 .tiocmget = rp_tiocmget,
2218 .tiocmset = rp_tiocmset,
2229 static int __init rp_init(
void)
2231 int ret = -
ENOMEM, pci_boards_found, isa_boards_found,
i;
2254 "configured ISA RocketPort controller 0x%lx. "
2261 rcktpt_io_addr[0] = board1;
2262 rcktpt_io_addr[1] = board2;
2263 rcktpt_io_addr[2] = board3;
2264 rcktpt_io_addr[3] = board4;
2281 rocket_driver->
name =
"ttyR";
2282 rocket_driver->
driver_name =
"Comtrol RocketPort";
2292 #ifdef ROCKET_SOFT_FLOW
2300 goto err_controller;
2303 #ifdef ROCKET_DEBUG_OPEN
2311 isa_boards_found = 0;
2312 pci_boards_found = 0;
2320 if (isa_boards_found < NUM_BOARDS)
2321 pci_boards_found = init_PCI(isa_boards_found);
2324 max_board = pci_boards_found + isa_boards_found;
2326 if (max_board == 0) {
2327 printk(
KERN_ERR "No rocketport ports found; unloading driver\n");
2345 static void rp_cleanup_module(
void)
2355 "rocketport driver\n", -retval);
2366 if (rcktpt_io_addr[i] <= 0 || is_PCI[i])
2445 ByteIO_t * AiopIOList,
int AiopIOListSize,
2446 int IRQNum,
Byte_t Frequency,
int PeriodicOnly)
2465 if (sIRQMap[IRQNum] == 0) {
2469 CtlP->
MReg2 = sIRQMap[IRQNum];
2470 CtlP->
MReg3 = Frequency;
2481 for (i = done = 0; i < AiopIOListSize; i++) {
2486 sOutB(MudbacIO, (
Byte_t) (io >> 6));
2490 CtlP->
AiopID[
i] = sReadAiopID(io);
2577 static int sPCIInitController(
CONTROLLER_T * CtlP,
int CtlNum,
2578 ByteIO_t * AiopIOList,
int AiopIOListSize,
2580 int PeriodicOnly,
int altChanRingIndicator,
2607 for (i = 0; i < AiopIOListSize; i++) {
2612 CtlP->
AiopID[
i] = sReadAiopID(io);
2639 static int sReadAiopID(
ByteIO_t io)
2665 static int sReadAiopNumChan(
WordIO_t io)
2668 static Byte_t R[4] = { 0x00, 0x00, 0x34, 0x12 };
2717 AiopIO = CtlP->
AiopIO[AiopNum];
2725 ChIOOff = AiopIO + ChP->
ChanNum * 2;
2734 R[1] = RData[i + 1] + 0x10 * ChanNum;
2735 R[2] = RData[i + 2];
2736 R[3] = RData[i + 3];
2742 ChR[
i] = RRegData[
i];
2743 ChR[i + 1] = RRegData[i + 1] + 0x10 * ChanNum;
2744 ChR[i + 2] = RRegData[i + 2];
2745 ChR[i + 3] = RRegData[i + 3];
2749 ChOff = (
Word_t) ChanNum *0x1000;
2751 if (sClockPrescale == 0x14)
2844 static void sStopRxProcessor(
CHANNEL_T * ChP)
2869 static void sFlushRxFIFO(
CHANNEL_T * ChP)
2879 if (ChP->
R[0x32] == 0x08) {
2882 for (i = 0; i < 2000 / 200; i++)
2888 sOutB(ChP->
Cmd, Ch);
2911 static void sFlushTxFIFO(
CHANNEL_T * ChP)
2925 sStopRxProcessor(ChP);
2926 for (i = 0; i < 4000 / 200; i++)
2930 sOutB(ChP->
Cmd, Ch);
2963 WordPtr = (
Word_t *) (&DWBuf[0]);
2967 out32(IndexAddr, DWBuf);
2971 DWBuf[2] = PRI_PEND + 1;
2973 out32(IndexAddr, DWBuf);
3082 static void sModemReset(
CONTROLLER_T * CtlP,
int chan,
int on)
3087 addr = CtlP->
AiopIO[0] + 0x400;
3090 if ((val & 2) == 0) {
3092 sOutB(CtlP->
MReg2IO, (val & 0xfc) | (1 & 0x03));
3093 sOutB(CtlP->
MBaseIO, (
unsigned char) (addr >> 6));
3099 sOutB(addr + chan, 0);
3107 static void sPCIModemReset(
CONTROLLER_T * CtlP,
int chan,
int on)
3111 addr = CtlP->
AiopIO[0] + 0x40;
3114 sOutB(addr + chan, 0);
3118 static void rmSpeakerReset(
CONTROLLER_T * CtlP,
unsigned long model)
3124 addr = CtlP->
AiopIO[0] + 0x4F;
3131 addr = CtlP->
AiopIO[0] + 0x88;
3137 static unsigned char GetLineNumber(
int ctrl,
int aiop,
int ch)
3139 return lineNumbers[(ctrl << 5) | (aiop << 3) | ch];
3147 static unsigned char SetLineNumber(
int ctrl,
int aiop,
int ch)
3149 lineNumbers[(ctrl << 5) | (aiop << 3) | ch] = nextLineNumber++;
3150 return (nextLineNumber - 1);