5dba61f4ba46fe0e85bcb7680bc98dbff316cad1
* When running dz's using only SAE (silo alarm) on input
* it is necessary to call dzrint() at clock interrupt time.
* This is unsafe unless spl5()s in tty code are changed to
* spl6()s to block clock interrupts. Note that the dh driver
* currently in use works the same way as the dz, even though
* we could try to more intelligently manage its silo.
* Thus don't take this out if you have no dz's unless you
* change clock.c and dhtimer().
#define DZADDR (UBA0_DEV + 0160100)
#define MSE 040 /* Master Scan Enable */
#define RIE 0100 /* Receiver Interrupt Enable */
#define SAE 010000 /* Silo Alarm Enable */
#define TIE 040000 /* Transmit Interrupt Enable */
#define DZ_IEN (MSE+RIE+TIE+SAE)
#define SSPEED 7 /* std speed = 300 baud */
(struct device
*)(DZADDR
), NULL
, NULL
, (int)&dz_tty
[0], dzxint
,
(struct device
*)(DZADDR
), NULL
, NULL
, (int)&dz_tty
[1], dzxint
,
(struct device
*)(DZADDR
), NULL
, NULL
, (int)&dz_tty
[2], dzxint
,
(struct device
*)(DZADDR
), NULL
, NULL
, (int)&dz_tty
[3], dzxint
,
(struct device
*)(DZADDR
), NULL
, NULL
, (int)&dz_tty
[4], dzxint
,
(struct device
*)(DZADDR
), NULL
, NULL
, (int)&dz_tty
[5], dzxint
,
(struct device
*)(DZADDR
), NULL
, NULL
, (int)&dz_tty
[6], dzxint
,
(struct device
*)(DZADDR
), NULL
, NULL
, (int)&dz_tty
[7], dzxint
,
(struct device
*)(DZADDR
+010), NULL
, NULL
, (int)&dz_tty
[8], dzxint
,
(struct device
*)(DZADDR
+010), NULL
, NULL
, (int)&dz_tty
[9], dzxint
,
(struct device
*)(DZADDR
+010), NULL
, NULL
, (int)&dz_tty
[10], dzxint
,
(struct device
*)(DZADDR
+010), NULL
, NULL
, (int)&dz_tty
[11], dzxint
,
(struct device
*)(DZADDR
+010), NULL
, NULL
, (int)&dz_tty
[12], dzxint
,
(struct device
*)(DZADDR
+010), NULL
, NULL
, (int)&dz_tty
[13], dzxint
,
(struct device
*)(DZADDR
+010), NULL
, NULL
, (int)&dz_tty
[14], dzxint
,
(struct device
*)(DZADDR
+010), NULL
, NULL
, (int)&dz_tty
[15], dzxint
,
(struct device
*)(DZADDR
+020), NULL
, NULL
, (int)&dz_tty
[16], dzxint
,
(struct device
*)(DZADDR
+020), NULL
, NULL
, (int)&dz_tty
[17], dzxint
,
(struct device
*)(DZADDR
+020), NULL
, NULL
, (int)&dz_tty
[18], dzxint
,
(struct device
*)(DZADDR
+020), NULL
, NULL
, (int)&dz_tty
[19], dzxint
,
(struct device
*)(DZADDR
+020), NULL
, NULL
, (int)&dz_tty
[20], dzxint
,
(struct device
*)(DZADDR
+020), NULL
, NULL
, (int)&dz_tty
[21], dzxint
,
(struct device
*)(DZADDR
+020), NULL
, NULL
, (int)&dz_tty
[22], dzxint
,
(struct device
*)(DZADDR
+020), NULL
, NULL
, (int)&dz_tty
[23], dzxint
,
0, 020 , 021 , 022 , 023 , 024 , 0, 025,
026 , 027 , 030 , 032 , 034 , 036 , 0 , 0,
timeout(dzscan
, (caddr_t
)0, 60);
tp
->t_addr
= (caddr_t
)&dzpdma
[dev
];
if ((tp
->t_state
& ISOPEN
) == 0) {
tp
->t_ospeed
= tp
->t_ispeed
= SSPEED
;
tp
->t_flags
= ODDP
|EVENP
|ECHO
;
/*tp->t_state |= HUPCLS;*/
} else if (tp
->t_state
&XCLUDE
&& u
.u_uid
!= 0) {
while ((tp
->t_state
& CARR_ON
) == 0) {
sleep((caddr_t
)&tp
->t_rawq
, TTIPRI
);
(*linesw
[tp
->t_line
].l_open
)(d
, tp
);
(*linesw
[tp
->t_line
].l_close
)(tp
);
if (tp
->t_state
& HUPCLS
)
(*linesw
[tp
->t_line
].l_read
)(tp
);
(*linesw
[tp
->t_line
].l_write
)(tp
);
register struct device
*dzaddr
;
register struct tty
*tp0
;
s
= spl6(); /* see comment in clock.c */
/* as long as we are here, service them all */
for (dev
= 0; dev
< NDZ
; dev
+= 8) {
if ((dzact
& (1<<(dev
>>3))) == 0)
dzaddr
= dzpdma
[dev
].p_addr
;
while ((c
= dzaddr
->dzrbuf
) < 0) { /* char present */
if (tp
>= &dz_tty
[dz_cnt
])
if ((tp
->t_state
& ISOPEN
) == 0) {
wakeup((caddr_t
)&tp
->t_rawq
);
/* framing error = break */
c
= 0; /* null for getty */
if (((tp
->t_flags
& (EVENP
|ODDP
)) == EVENP
)
|| ((tp
->t_flags
& (EVENP
|ODDP
)) == ODDP
))
if (tp
->t_line
== NETLDISC
) {
(*linesw
[tp
->t_line
].l_rint
)(c
, tp
);
dzioctl(dev
, cmd
, addr
, flag
)
tp
= &dz_tty
[minor(dev
)];
cmd
= (*linesw
[tp
->t_line
].l_ioctl
)(tp
, cmd
, addr
);
if (ttioccomm(cmd
, tp
, addr
, dev
)) {
if (cmd
==TIOCSETP
|| cmd
==TIOCSETN
)
((struct device
*)(tp
->t_addr
))->dzbrk
|= 1 << (dev
&07);
((struct device
*)(tp
->t_addr
))->dzbrk
&= ~(1 << (dev
&07));
register struct device
*dzaddr
;
dzaddr
= dzpdma
[dev
].p_addr
;
dzmodem(dev
, OFF
); /* hang up line */
lpr
= (dz_speeds
[tp
->t_ispeed
]<<8) | (dev
& 07);
if ((tp
->t_flags
& EVENP
) == 0)
lpr
|= TWOSB
; /* 110 baud: 2 stop bits */
register struct pdma
*dp
;
s
= spl6(); /* block the clock */
ndflush(&tp
->t_outq
, dp
->p_end
-tp
->t_outq
.c_cf
);
(*linesw
[tp
->t_line
].l_start
)(tp
);
if (tp
->t_outq
.c_cc
== 0 || (tp
->t_state
&BUSY
)==0)
dp
->p_addr
->dztcr
&= ~(1 << ((tp
-dz_tty
) % 8));
register struct pdma
*dp
;
register struct device
*dzaddr
;
if (tp
->t_state
& (TIMEOUT
|BUSY
|TTSTOP
))
if (tp
->t_outq
.c_cc
<= TTLOWAT
&& tp
->t_state
&ASLEEP
) {
mcstart(tp
->t_chan
, (caddr_t
)&tp
->t_outq
);
wakeup((caddr_t
)&tp
->t_outq
);
if (tp
->t_outq
.c_cc
== 0)
cc
= ndqb(&tp
->t_outq
, 0);
cc
= ndqb(&tp
->t_outq
, 0200);
timeout(ttrstrt
, (caddr_t
)tp
, (cc
&0177) + 6);
dp
->p_end
= dp
->p_mem
= tp
->t_outq
.c_cf
;
dzaddr
->dztcr
|= 1 << ((tp
-dz_tty
) % 8);
* Assume call is made at spl6.
register struct pdma
*dp
;
if (tp
->t_state
& BUSY
) {
if ((tp
->t_state
&TTSTOP
)==0) {
register struct device
*dzaddr
;
dzaddr
= dzpdma
[dev
].p_addr
;
register struct device
*dzaddr
;
for (i
= 0; i
< dz_cnt
; i
++) {
dzaddr
= dzpdma
[i
].p_addr
;
if (dzaddr
->dzmsr
& bit
) {
if ((tp
->t_state
& CARR_ON
) == 0) {
wakeup((caddr_t
)&tp
->t_rawq
);
if ((tp
->t_state
& CARR_ON
)) {
if (tp->t_state&ISOPEN &&
(tp->t_local&LNOHANG) == 0) {
gsignal(tp
->t_pgrp
, SIGHUP
);
timeout(dzscan
, (caddr_t
)0, 2*HZ
);