* Copyright (c) 1988 University of Utah.
* Copyright (c) 1990 The Regents of the University of California.
* This code is derived from software contributed to Berkeley by
* the Systems Programming Group of the University of Utah Computer
* %sccs.include.redist.c%
* @(#)dcm.c 7.1 (Berkeley) %G%
#include "machine/cons.h"
#include "../hpdev/device.h"
#include "../hpdev/dcmreg.h"
struct dcmdevice
*CONSOLE
= NULL
;
extern struct hp_hw sc_table
[];
register struct hp_hw
*hw
;
register struct dcmdevice
*dcm
;
for (hw
= sc_table
; hw
< &sc_table
[MAX_CTLR
]; hw
++)
if (hw
->hw_type
== COMMDCM
&& !badaddr((caddr_t
)hw
->hw_addr
))
if (hw
->hw_type
!= COMMDCM
) {
CONSOLE
= (struct dcmdevice
*)hw
->hw_addr
;
register struct dcmdevice
*dcm
= CONSOLE
;
register int port
= CONSPORT
;
while (dcm
->dcm_thead
[port
].ptr
!= dcm
->dcm_ttail
[port
].ptr
)
dcm
->dcm_data
[port
].dcm_baud
= BR_9600
;
dcm
->dcm_data
[port
].dcm_conf
= LC_8BITS
| LC_1STOP
;
dcm
->dcm_cmdtab
[port
].dcm_data
|= CT_CON
;
dcm
->dcm_cr
|= (1 << port
);
register struct dcmdevice
*dcm
= CONSOLE
;
register struct dcmrfifo
*fifo
;
register struct dcmpreg
*pp
;
pp
= dcm_preg(dcm
, port
);
head
= pp
->r_head
& RX_MASK
;
if (head
== (pp
->r_tail
& RX_MASK
))
fifo
= &dcm
->dcm_rfifos
[3-port
][head
>>1];
pp
->r_head
= (head
+ 2) & RX_MASK
;
register struct dcmdevice
*dcm
= CONSOLE
;
register struct dcmpreg
*pp
;
pp
= dcm_preg(dcm
, port
);
tail
= pp
->t_tail
& TX_MASK
;
while (tail
!= (pp
->t_head
& TX_MASK
) && --timo
)
dcm
->dcm_tfifos
[3-port
][tail
].data_char
= c
;
pp
->t_tail
= tail
= (tail
+ 1) & TX_MASK
;
dcm
->dcm_cmdtab
[port
].dcm_data
|= CT_TX
;
dcm
->dcm_cr
|= (1 << port
);
while (tail
!= (pp
->t_head
& TX_MASK
) && --timo
)