projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sun merge
[unix-history]
/
usr
/
src
/
sys
/
vax
/
uba
/
lp.c
diff --git
a/usr/src/sys/vax/uba/lp.c
b/usr/src/sys/vax/uba/lp.c
index
752fa5b
..
cb7e2f5
100644
(file)
--- a/
usr/src/sys/vax/uba/lp.c
+++ b/
usr/src/sys/vax/uba/lp.c
@@
-1,4
+1,4
@@
-/* lp.c 4.
15 81/03/14
*/
+/* lp.c 4.
31 82/12/17
*/
#include "lp.h"
#if NLP > 0
#include "lp.h"
#if NLP > 0
@@
-7,11
+7,8
@@
*
* This driver has been modified to work on printers where
* leaving IENABLE set would cause continuous interrupts.
*
* This driver has been modified to work on printers where
* leaving IENABLE set would cause continuous interrupts.
- *
- * TODO:
- * Test driver
- * Test driver on multiple printers
*/
*/
+#include "../machine/pte.h"
#include "../h/param.h"
#include "../h/dir.h"
#include "../h/param.h"
#include "../h/dir.h"
@@
-19,10
+16,8
@@
#include "../h/buf.h"
#include "../h/systm.h"
#include "../h/map.h"
#include "../h/buf.h"
#include "../h/systm.h"
#include "../h/map.h"
-#include "../h/pte.h"
-#include "../h/ubavar.h"
-#include "../h/ioctl.h"
-#include "../h/tty.h"
+
+#include "../vaxuba/ubavar.h"
#define LPPRI (PZERO+8)
#define IENABLE 0100
#define LPPRI (PZERO+8)
#define IENABLE 0100
@@
-31,7
+26,11
@@
#define LPLWAT 650
#define LPHWAT 800
#define LPLWAT 650
#define LPHWAT 800
+#ifndef CAD
#define MAXCOL 132
#define MAXCOL 132
+#else
+#define MAXCOL 512
+#endif
#define CAP 1
#define LPUNIT(dev) (minor(dev) >> 3)
#define CAP 1
#define LPUNIT(dev) (minor(dev) >> 3)
@@
-82,10
+81,20
@@
lpprobe(reg)
{
register int br, cvec; /* value-result */
register struct lpdevice *lpaddr = (struct lpdevice *)reg;
{
register int br, cvec; /* value-result */
register struct lpdevice *lpaddr = (struct lpdevice *)reg;
-
+#ifdef lint
+ br = 0; cvec = br; br = cvec;
+ lpintr(0);
+#endif
+
+#ifdef INGVAX
+ br = 0x14;
+ cvec = 0200;
+#else
lpaddr->lpsr = IENABLE;
DELAY(5);
lpaddr->lpsr = 0;
lpaddr->lpsr = IENABLE;
DELAY(5);
lpaddr->lpsr = 0;
+#endif
+ return (sizeof (struct lpdevice));
}
/*ARGSUSED*/
}
/*ARGSUSED*/
@@
-100,25
+109,22
@@
lpopen(dev, flag)
if ((unit = LPUNIT(dev)) >= NLP ||
(sc = &lp_softc[unit])->sc_state&OPEN ||
if ((unit = LPUNIT(dev)) >= NLP ||
(sc = &lp_softc[unit])->sc_state&OPEN ||
- (ui = lpinfo[unit]) == 0 || ui->ui_alive == 0) {
- u.u_error = ENXIO;
- return;
- }
+ (ui = lpinfo[unit]) == 0 || ui->ui_alive == 0)
+ return (ENXIO);
lpaddr = (struct lpdevice *)ui->ui_addr;
lpaddr = (struct lpdevice *)ui->ui_addr;
- if (lpaddr->lpsr&ERROR) {
- u.u_error = EIO;
- return;
- }
+ if (lpaddr->lpsr&ERROR)
+ return (EIO);
sc->sc_state |= OPEN;
sc->sc_state |= OPEN;
- sc->sc_inbuf = geteblk();
+ sc->sc_inbuf = geteblk(
512
);
sc->sc_flags = minor(dev) & 07;
(void) spl4();
if ((sc->sc_state&TOUT) == 0) {
sc->sc_state |= TOUT;
sc->sc_flags = minor(dev) & 07;
(void) spl4();
if ((sc->sc_state&TOUT) == 0) {
sc->sc_state |= TOUT;
- timeout(lptout, dev, 10*hz);
+ timeout(lptout,
(caddr_t)
dev, 10*hz);
}
(void) spl0();
lpcanon(dev, '\f');
}
(void) spl0();
lpcanon(dev, '\f');
+ return (0);
}
/*ARGSUSED*/
}
/*ARGSUSED*/
@@
-133,20
+139,25
@@
lpclose(dev, flag)
sc->sc_state &= ~OPEN;
}
sc->sc_state &= ~OPEN;
}
-lpwrite(dev)
+lpwrite(dev
, uio
)
dev_t dev;
dev_t dev;
+ struct uio *uio;
{
{
- register
int
n;
+ register
unsigned
n;
register char *cp;
register struct lp_softc *sc = &lp_softc[LPUNIT(dev)];
register char *cp;
register struct lp_softc *sc = &lp_softc[LPUNIT(dev)];
+ int error;
- while (n = min(
BSIZE, u.u_count
)) {
+ while (n = min(
512, uio->uio_resid
)) {
cp = sc->sc_inbuf->b_un.b_addr;
cp = sc->sc_inbuf->b_un.b_addr;
- iomove(cp, n, B_WRITE);
+ error = uiomove(cp, n, UIO_WRITE, uio);
+ if (error)
+ return (error);
do
lpcanon(dev, *cp++);
while (--n);
}
do
lpcanon(dev, *cp++);
while (--n);
}
+ return (0);
}
lpcanon(dev, c)
}
lpcanon(dev, c)
@@
-301,7
+312,7
@@
lptout(dev)
lpaddr = (struct lpdevice *) ui->ui_addr;
if ((sc->sc_state&MOD) != 0) {
sc->sc_state &= ~MOD; /* something happened */
lpaddr = (struct lpdevice *) ui->ui_addr;
if ((sc->sc_state&MOD) != 0) {
sc->sc_state &= ~MOD; /* something happened */
- timeout(lptout,
dev, 2*hz);
/* so don't sweat */
+ timeout(lptout,
(caddr_t)dev, 2*hz);
/* so don't sweat */
return;
}
if ((sc->sc_state&OPEN) == 0) {
return;
}
if ((sc->sc_state&OPEN) == 0) {
@@
-311,7
+322,7
@@
lptout(dev)
}
if (sc->sc_outq.c_cc && (lpaddr->lpsr&DONE) && (lpaddr->lpsr&ERROR)==0)
lpintr(LPUNIT(dev)); /* ready to go */
}
if (sc->sc_outq.c_cc && (lpaddr->lpsr&DONE) && (lpaddr->lpsr&ERROR)==0)
lpintr(LPUNIT(dev)); /* ready to go */
- timeout(lptout, dev, 10*hz);
+ timeout(lptout,
(caddr_t)
dev, 10*hz);
}
lpreset(uban)
}
lpreset(uban)