Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/rp/rp.c
Show First 20 Lines • Show All 590 Lines • ▼ Show 20 Lines | if(!(ChanStatus & STATMODE)) { | ||||
sEnRxStatusMode(cp); | sEnRxStatusMode(cp); | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
if we previously entered status mode then read down the | if we previously entered status mode then read down the | ||||
FIFO one word at a time, pulling apart the character and | FIFO one word at a time, pulling apart the character and | ||||
the status. Update error counters depending on status. | the status. Update error counters depending on status. | ||||
*/ | */ | ||||
tty_lock(tp); | ttydisc_lock(tp); | ||||
if(ChanStatus & STATMODE) { | if(ChanStatus & STATMODE) { | ||||
while(ToRecv) { | while(ToRecv) { | ||||
CharNStat = rp_readch2(cp,sGetTxRxDataIO(cp)); | CharNStat = rp_readch2(cp,sGetTxRxDataIO(cp)); | ||||
ch = CharNStat & 0xff; | ch = CharNStat & 0xff; | ||||
if((CharNStat & STMBREAK) || (CharNStat & STMFRAMEH)) | if((CharNStat & STMBREAK) || (CharNStat & STMFRAMEH)) | ||||
err |= TRE_FRAMING; | err |= TRE_FRAMING; | ||||
else if (CharNStat & STMPARITYH) | else if (CharNStat & STMPARITYH) | ||||
Show All 17 Lines | */ | ||||
ToRecv = sGetRxCnt(cp); | ToRecv = sGetRxCnt(cp); | ||||
while (ToRecv) { | while (ToRecv) { | ||||
ch = rp_readch1(cp,sGetTxRxDataIO(cp)); | ch = rp_readch1(cp,sGetTxRxDataIO(cp)); | ||||
ttydisc_rint(tp, ch & 0xff, err); | ttydisc_rint(tp, ch & 0xff, err); | ||||
ToRecv--; | ToRecv--; | ||||
} | } | ||||
} | } | ||||
ttydisc_rint_done(tp); | ttydisc_rint_done(tp); | ||||
tty_unlock(tp); | ttydisc_unlock(tp); | ||||
} | } | ||||
static void rp_handle_port(struct rp_port *rp) | static void rp_handle_port(struct rp_port *rp) | ||||
{ | { | ||||
CHANNEL_t *cp; | CHANNEL_t *cp; | ||||
struct tty *tp; | struct tty *tp; | ||||
unsigned int IntMask, ChanStatus; | unsigned int IntMask, ChanStatus; | ||||
Show All 27 Lines | static void rp_do_poll(void *arg) | ||||
CONTROLLER_t *ctl; | CONTROLLER_t *ctl; | ||||
struct rp_port *rp; | struct rp_port *rp; | ||||
struct tty *tp; | struct tty *tp; | ||||
int count; | int count; | ||||
unsigned char CtlMask, AiopMask; | unsigned char CtlMask, AiopMask; | ||||
rp = arg; | rp = arg; | ||||
tp = rp->rp_tty; | tp = rp->rp_tty; | ||||
tty_assert_locked(tp); | ttydisc_assert_locked(tp); | ||||
ctl = rp->rp_ctlp; | ctl = rp->rp_ctlp; | ||||
CtlMask = ctl->ctlmask(ctl); | CtlMask = ctl->ctlmask(ctl); | ||||
if (CtlMask & (1 << rp->rp_aiop)) { | if (CtlMask & (1 << rp->rp_aiop)) { | ||||
AiopMask = sGetAiopIntStatus(ctl, rp->rp_aiop); | AiopMask = sGetAiopIntStatus(ctl, rp->rp_aiop); | ||||
if (AiopMask & (1 << rp->rp_chan)) { | if (AiopMask & (1 << rp->rp_chan)) { | ||||
rp_handle_port(rp); | rp_handle_port(rp); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | if (rp == NULL) { | ||||
goto nogo; | goto nogo; | ||||
} | } | ||||
port = 0; | port = 0; | ||||
for(aiop=0; aiop < num_aiops; aiop++) { | for(aiop=0; aiop < num_aiops; aiop++) { | ||||
num_chan = sGetAiopNumChan(ctlp, aiop); | num_chan = sGetAiopNumChan(ctlp, aiop); | ||||
for(chan=0; chan < num_chan; chan++, port++, rp++) { | for(chan=0; chan < num_chan; chan++, port++, rp++) { | ||||
rp->rp_tty = tp = tty_alloc(&rp_tty_class, rp); | rp->rp_tty = tp = tty_alloc(&rp_tty_class, rp); | ||||
callout_init_mtx(&rp->rp_timer, tty_getlock(tp), 0); | callout_init_mtx(&rp->rp_timer, ttydisc_getlock(tp), 0); | ||||
rp->rp_port = port; | rp->rp_port = port; | ||||
rp->rp_ctlp = ctlp; | rp->rp_ctlp = ctlp; | ||||
rp->rp_unit = unit; | rp->rp_unit = unit; | ||||
rp->rp_chan = chan; | rp->rp_chan = chan; | ||||
rp->rp_aiop = aiop; | rp->rp_aiop = aiop; | ||||
rp->rp_intmask = RXF_TRIG | TXFIFO_MT | SRC_INT | | rp->rp_intmask = RXF_TRIG | TXFIFO_MT | SRC_INT | | ||||
DELTA_CD | DELTA_CTS | DELTA_DSR; | DELTA_CD | DELTA_CTS | DELTA_DSR; | ||||
▲ Show 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | |||||
/* sSetDTR(&rp->rp_channel); | /* sSetDTR(&rp->rp_channel); | ||||
sSetRTS(&rp->rp_channel); | sSetRTS(&rp->rp_channel); | ||||
*/ | */ | ||||
IntMask = sGetChanIntID(&rp->rp_channel); | IntMask = sGetChanIntID(&rp->rp_channel); | ||||
IntMask = IntMask & rp->rp_intmask; | IntMask = IntMask & rp->rp_intmask; | ||||
ChanStatus = sGetChanStatus(&rp->rp_channel); | ChanStatus = sGetChanStatus(&rp->rp_channel); | ||||
ttydisc_lock(tp); | |||||
callout_reset(&rp->rp_timer, POLL_INTERVAL, rp_do_poll, rp); | callout_reset(&rp->rp_timer, POLL_INTERVAL, rp_do_poll, rp); | ||||
ttydisc_unlock(tp); | |||||
device_busy(rp->rp_ctlp->dev); | device_busy(rp->rp_ctlp->dev); | ||||
return(0); | return(0); | ||||
} | } | ||||
static void | static void | ||||
rpclose(struct tty *tp) | rpclose(struct tty *tp) | ||||
{ | { | ||||
struct rp_port *rp; | struct rp_port *rp; | ||||
rp = tty_softc(tp); | rp = tty_softc(tp); | ||||
ttydisc_assert_locked(tp); | |||||
callout_stop(&rp->rp_timer); | callout_stop(&rp->rp_timer); | ||||
rphardclose(tp); | rphardclose(tp); | ||||
device_unbusy(rp->rp_ctlp->dev); | device_unbusy(rp->rp_ctlp->dev); | ||||
} | } | ||||
static void | static void | ||||
rphardclose(struct tty *tp) | rphardclose(struct tty *tp) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 243 Lines • Show Last 20 Lines |