Plug some spl-holes in the lp-driver. Also be more strict in protecting
the register access to the psg-chip. The combination of those bugs caused the printer to print garbage sometimes.
This commit is contained in:
parent
d3ef248436
commit
f9ace39811
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: locore.s,v 1.26 1996/11/09 22:24:49 leo Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.27 1996/11/17 13:47:09 leo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -603,7 +603,7 @@ mfp_lpt:
|
|||
moveml d0-d1/a0-a1,sp@- | Save scratch registers
|
||||
movw sp@(16),sp@- | push previous SR value
|
||||
clrw sp@- | padded to longword
|
||||
jbsr _lptintr | handle interrupt
|
||||
jbsr _lpthwintr | handle interrupt
|
||||
addql #4,sp | pop SR
|
||||
moveml sp@+,d0-d1/a0-a1
|
||||
addql #1,_cnt+V_INTR | chalk up another interrupt
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lpt.c,v 1.6 1996/10/13 04:11:05 christos Exp $ */
|
||||
/* $NetBSD: lpt.c,v 1.7 1996/11/17 13:47:21 leo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Leo Weppelman
|
||||
|
@ -113,8 +113,10 @@ dev_type_ioctl(lptioctl);
|
|||
|
||||
static void lptwakeup __P((void *arg));
|
||||
static int pushbytes __P((struct lpt_softc *));
|
||||
|
||||
static void lptpseudointr __P((void));
|
||||
int lptintr __P((void));
|
||||
int lpthwintr __P((int));
|
||||
|
||||
|
||||
/*
|
||||
* Autoconfig stuff
|
||||
|
@ -230,11 +232,8 @@ lptwakeup(arg)
|
|||
void *arg;
|
||||
{
|
||||
struct lpt_softc *sc = arg;
|
||||
int s;
|
||||
|
||||
s = spltty();
|
||||
lptintr();
|
||||
splx(s);
|
||||
lptpseudointr();
|
||||
|
||||
timeout(lptwakeup, sc, STEP);
|
||||
}
|
||||
|
@ -312,16 +311,12 @@ pushbytes(sc)
|
|||
sc->sc_spinmax--;
|
||||
}
|
||||
} else {
|
||||
int s;
|
||||
|
||||
while (sc->sc_count > 0) {
|
||||
/* if the printer is ready for a char, give it one */
|
||||
if ((sc->sc_state & LPT_OBUSY) == 0) {
|
||||
lprintf("%s: write %d\n", sc->sc_dev.dv_xname,
|
||||
sc->sc_count);
|
||||
s = spltty();
|
||||
(void) lptintr();
|
||||
splx(s);
|
||||
(void) lptpseudointr();
|
||||
}
|
||||
if ((error = tsleep((caddr_t)sc, LPTPRI | PCATCH,
|
||||
"lptwrite2", 0)) != 0)
|
||||
|
@ -396,6 +391,26 @@ lptintr()
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
lptpseudointr()
|
||||
{
|
||||
int s;
|
||||
|
||||
s = spltty();
|
||||
lptintr();
|
||||
splx(s);
|
||||
}
|
||||
|
||||
int
|
||||
lpthwintr(sr)
|
||||
int sr;
|
||||
{
|
||||
if (!BASEPRI(sr))
|
||||
add_sicallback((si_farg)lptpseudointr, NULL, 0);
|
||||
else lptpseudointr();
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
lptioctl(dev, cmd, data, flag, p)
|
||||
dev_t dev;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ym2149reg.h,v 1.1 1996/03/27 10:08:34 leo Exp $ */
|
||||
/* $NetBSD: ym2149reg.h,v 1.2 1996/11/17 13:47:21 leo Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Leo Weppelman.
|
||||
|
@ -114,31 +114,53 @@ extern u_char ym2149_ioa; /* Soft-copy of port-A */
|
|||
splx(s); \
|
||||
}
|
||||
|
||||
#define ym2149_write_ioport2(port, value) { \
|
||||
YM2149->sd_selr = port; \
|
||||
YM2149->sd_wdat = value; \
|
||||
}
|
||||
|
||||
#define ym2149_fd_select(select) { \
|
||||
int s = splhigh(); \
|
||||
\
|
||||
ym2149_ioa = (ym2149_ioa & ~PA_FDSEL) | (select & PA_FDSEL); \
|
||||
ym2149_write_ioport(YM_IOA, ym2149_ioa); \
|
||||
splx(s); \
|
||||
}
|
||||
|
||||
#define ym2149_rts(set) { \
|
||||
int s = splhigh(); \
|
||||
\
|
||||
ym2149_ioa = set ? ym2149_ioa | PA_SRTS : ym2149_ioa & ~PA_SRTS;\
|
||||
ym2149_write_ioport(YM_IOA, ym2149_ioa); \
|
||||
splx(s); \
|
||||
}
|
||||
|
||||
#define ym2149_dtr(set) { \
|
||||
int s = splhigh(); \
|
||||
\
|
||||
ym2149_ioa = set ? ym2149_ioa | PA_SDTR : ym2149_ioa & ~PA_SDTR;\
|
||||
ym2149_write_ioport(YM_IOA, ym2149_ioa); \
|
||||
splx(s); \
|
||||
}
|
||||
|
||||
#define ym2149_strobe(set) { \
|
||||
int s = splhigh(); \
|
||||
\
|
||||
ym2149_ioa = set ? ym2149_ioa | PA_PSTROBE : ym2149_ioa & ~PA_PSTROBE;\
|
||||
ym2149_write_ioport(YM_IOA, ym2149_ioa); \
|
||||
splx(s); \
|
||||
}
|
||||
|
||||
#define ym2149_ser2_select() { \
|
||||
int s = splhigh(); \
|
||||
\
|
||||
ym2149_ioa |= PA_SER2; \
|
||||
ym2149_write_ioport(YM_IOA, ym2149_ioa); \
|
||||
splx(s); \
|
||||
}
|
||||
|
||||
#undef ym2149_write_ioport2
|
||||
|
||||
#ifdef _KERNEL
|
||||
/*
|
||||
* Prototypes
|
||||
|
|
Loading…
Reference in New Issue