rp.c (130057) | rp.c (130077) |
---|---|
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 --- 18 unchanged lines hidden (view full) --- 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 */ 33 34#include <sys/cdefs.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 --- 18 unchanged lines hidden (view full) --- 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 */ 33 34#include <sys/cdefs.h> |
35__FBSDID("$FreeBSD: head/sys/dev/rp/rp.c 130057 2004-06-04 08:02:37Z phk $"); | 35__FBSDID("$FreeBSD: head/sys/dev/rp/rp.c 130077 2004-06-04 16:02:56Z phk $"); |
36 37/* 38 * rp.c - for RocketPort FreeBSD 39 */ 40 41#include "opt_compat.h" 42 43#include <sys/param.h> --- 611 unchanged lines hidden (view full) --- 655 656 if((CharNStat & STMBREAK) || (CharNStat & STMFRAMEH)) 657 ch |= TTY_FE; 658 else if (CharNStat & STMPARITYH) 659 ch |= TTY_PE; 660 else if (CharNStat & STMRCVROVRH) 661 rp->rp_overflows++; 662 | 36 37/* 38 * rp.c - for RocketPort FreeBSD 39 */ 40 41#include "opt_compat.h" 42 43#include <sys/param.h> --- 611 unchanged lines hidden (view full) --- 655 656 if((CharNStat & STMBREAK) || (CharNStat & STMFRAMEH)) 657 ch |= TTY_FE; 658 else if (CharNStat & STMPARITYH) 659 ch |= TTY_PE; 660 else if (CharNStat & STMRCVROVRH) 661 rp->rp_overflows++; 662 |
663 (*linesw[tp->t_line].l_rint)(ch, tp); | 663 ttyld_rint(tp, ch); |
664 ToRecv--; 665 } 666/* 667 After emtying FIFO in status mode, turn off status mode 668*/ 669 670 if(sGetRxCnt(cp) == 0) { 671 sDisRxStatusMode(cp); --- 25 unchanged lines hidden (view full) --- 697 ttwakeup(tp); 698 } else { 699 while (ToRecv) { 700 if(tp->t_state & TS_TBLOCK) { 701 break; 702 } 703 ch = (u_char) rp_readch1(cp,sGetTxRxDataIO(cp)); 704 spl = spltty(); | 664 ToRecv--; 665 } 666/* 667 After emtying FIFO in status mode, turn off status mode 668*/ 669 670 if(sGetRxCnt(cp) == 0) { 671 sDisRxStatusMode(cp); --- 25 unchanged lines hidden (view full) --- 697 ttwakeup(tp); 698 } else { 699 while (ToRecv) { 700 if(tp->t_state & TS_TBLOCK) { 701 break; 702 } 703 ch = (u_char) rp_readch1(cp,sGetTxRxDataIO(cp)); 704 spl = spltty(); |
705 (*linesw[tp->t_line].l_rint)(ch, tp); | 705 ttyld_rint(tp, ch); |
706 splx(spl); 707 ToRecv--; 708 } 709 } 710 } 711} 712 713static void rp_handle_port(struct rp_port *rp) --- 12 unchanged lines hidden (view full) --- 726 ChanStatus = sGetChanStatus(cp); 727 if(IntMask & RXF_TRIG) 728 if(!(tp->t_state & TS_TBLOCK) && (tp->t_state & TS_CARR_ON) && (tp->t_state & TS_ISOPEN)) { 729 rp_do_receive(rp, tp, cp, ChanStatus); 730 } 731 if(IntMask & DELTA_CD) { 732 if(ChanStatus & CD_ACT) { 733 if(!(tp->t_state & TS_CARR_ON) ) { | 706 splx(spl); 707 ToRecv--; 708 } 709 } 710 } 711} 712 713static void rp_handle_port(struct rp_port *rp) --- 12 unchanged lines hidden (view full) --- 726 ChanStatus = sGetChanStatus(cp); 727 if(IntMask & RXF_TRIG) 728 if(!(tp->t_state & TS_TBLOCK) && (tp->t_state & TS_CARR_ON) && (tp->t_state & TS_ISOPEN)) { 729 rp_do_receive(rp, tp, cp, ChanStatus); 730 } 731 if(IntMask & DELTA_CD) { 732 if(ChanStatus & CD_ACT) { 733 if(!(tp->t_state & TS_CARR_ON) ) { |
734 (void)(*linesw[tp->t_line].l_modem)(tp, 1); | 734 (void)ttyld_modem(tp, 1); |
735 } 736 } else { 737 if((tp->t_state & TS_CARR_ON)) { | 735 } 736 } else { 737 if((tp->t_state & TS_CARR_ON)) { |
738 (void)(*linesw[tp->t_line].l_modem)(tp, 0); 739 if((*linesw[tp->t_line].l_modem)(tp, 0) == 0) { | 738 (void)ttyld_modem(tp, 0); 739 if(ttyld_modem(tp, 0) == 0) { |
740 rphardclose(rp); 741 } 742 } 743 } 744 } 745/* oldcts = rp->rp_cts; 746 rp->rp_cts = ((ChanStatus & CTS_ACT) != 0); 747 if(oldcts != rp->rp_cts) { --- 31 unchanged lines hidden (view full) --- 779 line++, rp++) { 780 tp = rp->rp_tty; 781 if((tp->t_state & TS_BUSY) && (tp->t_state & TS_ISOPEN)) { 782 count = sGetTxCnt(&rp->rp_channel); 783 if(count == 0) 784 tp->t_state &= ~(TS_BUSY); 785 if(!(tp->t_state & TS_TTSTOP) && 786 (count <= rp->rp_restart)) { | 740 rphardclose(rp); 741 } 742 } 743 } 744 } 745/* oldcts = rp->rp_cts; 746 rp->rp_cts = ((ChanStatus & CTS_ACT) != 0); 747 if(oldcts != rp->rp_cts) { --- 31 unchanged lines hidden (view full) --- 779 line++, rp++) { 780 tp = rp->rp_tty; 781 if((tp->t_state & TS_BUSY) && (tp->t_state & TS_ISOPEN)) { 782 count = sGetTxCnt(&rp->rp_channel); 783 if(count == 0) 784 tp->t_state &= ~(TS_BUSY); 785 if(!(tp->t_state & TS_TTSTOP) && 786 (count <= rp->rp_restart)) { |
787 (*linesw[tp->t_line].l_start)(tp); | 787 ttyld_start(tp); |
788 } 789 } 790 } 791 } 792 if(rp_num_ports_open) 793 timeout(rp_do_poll, (void *)NULL, POLL_INTERVAL); 794} 795 --- 267 unchanged lines hidden (view full) --- 1063 1064 rp_num_ports_open++; 1065 1066 IntMask = sGetChanIntID(&rp->rp_channel); 1067 IntMask = IntMask & rp->rp_intmask; 1068 ChanStatus = sGetChanStatus(&rp->rp_channel); 1069 if((IntMask & DELTA_CD) || IS_CALLOUT(dev)) { 1070 if((ChanStatus & CD_ACT) || IS_CALLOUT(dev)) { | 788 } 789 } 790 } 791 } 792 if(rp_num_ports_open) 793 timeout(rp_do_poll, (void *)NULL, POLL_INTERVAL); 794} 795 --- 267 unchanged lines hidden (view full) --- 1063 1064 rp_num_ports_open++; 1065 1066 IntMask = sGetChanIntID(&rp->rp_channel); 1067 IntMask = IntMask & rp->rp_intmask; 1068 ChanStatus = sGetChanStatus(&rp->rp_channel); 1069 if((IntMask & DELTA_CD) || IS_CALLOUT(dev)) { 1070 if((ChanStatus & CD_ACT) || IS_CALLOUT(dev)) { |
1071 (void)(*linesw[tp->t_line].l_modem)(tp, 1); | 1071 (void)ttyld_modem(tp, 1); |
1072 } 1073 } 1074 1075 if(rp_num_ports_open == 1) 1076 timeout(rp_do_poll, (void *)NULL, POLL_INTERVAL); 1077 1078 } 1079 1080 if(!(flag&O_NONBLOCK) && !(tp->t_cflag&CLOCAL) && 1081 !(tp->t_state & TS_CARR_ON) && !(IS_CALLOUT(dev))) { 1082 ++rp->wopeners; 1083 error = tsleep(TSA_CARR_ON(tp), TTIPRI | PCATCH, 1084 "rpdcd", 0); 1085 --rp->wopeners; 1086 if(error != 0) 1087 goto out; 1088 goto open_top; 1089 } | 1072 } 1073 } 1074 1075 if(rp_num_ports_open == 1) 1076 timeout(rp_do_poll, (void *)NULL, POLL_INTERVAL); 1077 1078 } 1079 1080 if(!(flag&O_NONBLOCK) && !(tp->t_cflag&CLOCAL) && 1081 !(tp->t_state & TS_CARR_ON) && !(IS_CALLOUT(dev))) { 1082 ++rp->wopeners; 1083 error = tsleep(TSA_CARR_ON(tp), TTIPRI | PCATCH, 1084 "rpdcd", 0); 1085 --rp->wopeners; 1086 if(error != 0) 1087 goto out; 1088 goto open_top; 1089 } |
1090 error = (*linesw[tp->t_line].l_open)(dev, tp); | 1090 error = ttyld_open(tp, dev); |
1091 1092 rp_disc_optim(tp, &tp->t_termios); 1093 if(tp->t_state & TS_ISOPEN && IS_CALLOUT(dev)) 1094 rp->active_out = TRUE; 1095 1096/* if(rp_num_ports_open == 1) 1097 timeout(rp_do_poll, (void *)NULL, POLL_INTERVAL); 1098*/ --- 26 unchanged lines hidden (view full) --- 1125 1126 if(IS_CONTROL(dev)) 1127 return(0); 1128 rp = rp_addr(unit) + port; 1129 cp = &rp->rp_channel; 1130 tp = rp->rp_tty; 1131 1132 oldspl = spltty(); | 1091 1092 rp_disc_optim(tp, &tp->t_termios); 1093 if(tp->t_state & TS_ISOPEN && IS_CALLOUT(dev)) 1094 rp->active_out = TRUE; 1095 1096/* if(rp_num_ports_open == 1) 1097 timeout(rp_do_poll, (void *)NULL, POLL_INTERVAL); 1098*/ --- 26 unchanged lines hidden (view full) --- 1125 1126 if(IS_CONTROL(dev)) 1127 return(0); 1128 rp = rp_addr(unit) + port; 1129 cp = &rp->rp_channel; 1130 tp = rp->rp_tty; 1131 1132 oldspl = spltty(); |
1133 (*linesw[tp->t_line].l_close)(tp, flag); | 1133 ttyld_close(tp, flag); |
1134 rp_disc_optim(tp, &tp->t_termios); 1135 rphardclose(rp); 1136 1137 tp->t_state &= ~TS_BUSY; 1138 ttyclose(tp); 1139 1140 splx(oldspl); 1141 --- 60 unchanged lines hidden (view full) --- 1202 tp = rp->rp_tty; 1203 while(rp->rp_disable_writes) { 1204 rp->rp_waiting = 1; 1205 error = ttysleep(tp, (caddr_t)rp, TTOPRI|PCATCH, "rp_write", 0); 1206 if (error) 1207 return(error); 1208 } 1209 | 1134 rp_disc_optim(tp, &tp->t_termios); 1135 rphardclose(rp); 1136 1137 tp->t_state &= ~TS_BUSY; 1138 ttyclose(tp); 1139 1140 splx(oldspl); 1141 --- 60 unchanged lines hidden (view full) --- 1202 tp = rp->rp_tty; 1203 while(rp->rp_disable_writes) { 1204 rp->rp_waiting = 1; 1205 error = ttysleep(tp, (caddr_t)rp, TTOPRI|PCATCH, "rp_write", 0); 1206 if (error) 1207 return(error); 1208 } 1209 |
1210 error = (*linesw[tp->t_line].l_write)(tp, uio, flag); | 1210 error = ttyld_write(tp, uio, flag); |
1211 return error; 1212} 1213 1214static void 1215rpdtrwakeup(void *chan) 1216{ 1217 struct rp_port *rp; 1218 --- 456 unchanged lines hidden --- | 1211 return error; 1212} 1213 1214static void 1215rpdtrwakeup(void *chan) 1216{ 1217 struct rp_port *rp; 1218 --- 456 unchanged lines hidden --- |