Rename nlpt to lpt.

Remove from ppi.c the old depreciated module stuff.
Print info when if_plip can't use interrupts.
This commit is contained in:
nsouch 1999-02-14 12:00:00 +00:00
parent 5cb54dc62f
commit a4409dd879
11 changed files with 126 additions and 165 deletions

View File

@ -11,7 +11,7 @@
# device lines is present in the ./LINT configuration file. If you are # device lines is present in the ./LINT configuration file. If you are
# in doubt as to the purpose or necessity of a line, check first in LINT. # in doubt as to the purpose or necessity of a line, check first in LINT.
# #
# $Id: GENERIC,v 1.147 1999/02/10 02:18:31 des Exp $ # $Id: GENERIC,v 1.148 1999/02/11 06:07:27 jkoshy Exp $
machine "i386" machine "i386"
cpu "I386_CPU" cpu "I386_CPU"
@ -146,7 +146,7 @@ device sio2 at isa? disable port "IO_COM3" tty irq 5
device sio3 at isa? disable port "IO_COM4" tty irq 9 device sio3 at isa? disable port "IO_COM4" tty irq 9
# Parallel port # Parallel port
device ppc0 at isa? port? net irq 7 device ppc0 at isa? port? tty irq 7
controller ppbus0 controller ppbus0
device nlpt0 at ppbus? device nlpt0 at ppbus?
device plip0 at ppbus? device plip0 at ppbus?

View File

@ -2,7 +2,7 @@
# LINT -- config file for checking all the sources, tries to pull in # LINT -- config file for checking all the sources, tries to pull in
# as much of the source tree as it can. # as much of the source tree as it can.
# #
# $Id: LINT,v 1.553 1999/02/12 12:15:02 brian Exp $ # $Id: LINT,v 1.554 1999/02/13 17:54:32 nsouch Exp $
# #
# NB: You probably don't want to try running a kernel built from this # NB: You probably don't want to try running a kernel built from this
# file. Instead, you should start from GENERIC, and add options from # file. Instead, you should start from GENERIC, and add options from
@ -1831,9 +1831,9 @@ pseudo-device "i4bisppp" 4
# vpo Iomega Zip Drive # vpo Iomega Zip Drive
# Requires SCSI disk support ('scbus' and 'da'), best # Requires SCSI disk support ('scbus' and 'da'), best
# performance is achieved with ports in EPP 1.9 mode. # performance is achieved with ports in EPP 1.9 mode.
# nlpt Parallel Printer # lpt Parallel Printer
# plip Parallel network interface # plip Parallel network interface
# ppi General-purpose I/O ("Geek Port") # ppi General-purpose I/O ("Geek Port") + IEEE1284 I/O
# pps Pulse per second Timing Interface # pps Pulse per second Timing Interface
# lpbb Philips official parallel port I2C bit-banging interface # lpbb Philips official parallel port I2C bit-banging interface
# #
@ -1846,19 +1846,19 @@ options "PERIPH_1284" # Makes your computer act as a IEEE1284
# compliant peripheral # compliant peripheral
options "DONTPROBE_1284"# Avoid boot detection of PnP parallel devices options "DONTPROBE_1284"# Avoid boot detection of PnP parallel devices
options "VP0_DEBUG" # ZIP/ZIP+ debug options "VP0_DEBUG" # ZIP/ZIP+ debug
options "NLPT_DEBUG" # Printer driver debug options "LPT_DEBUG" # Printer driver debug
options "PPC_DEBUG" # Parallel chipset level debug options "PPC_DEBUG" # Parallel chipset level debug
options "PLIP_DEBUG" # Parallel network IP interface debug options "PLIP_DEBUG" # Parallel network IP interface debug
controller ppbus0 controller ppbus0
controller vpo0 at ppbus? controller vpo0 at ppbus?
device nlpt0 at ppbus? device lpt0 at ppbus?
device plip0 at ppbus? device plip0 at ppbus?
device ppi0 at ppbus? device ppi0 at ppbus?
device pps0 at ppbus? device pps0 at ppbus?
device lpbb0 at ppbus? device lpbb0 at ppbus?
controller ppc0 at isa? disable port ? tty irq 7 controller ppc0 at isa? port? tty irq 7
# Kernel BOOTP support # Kernel BOOTP support

View File

@ -124,7 +124,10 @@ dev/pdq/pdq.c optional fea device-driver
dev/pdq/pdq_ifsubr.c optional fea device-driver dev/pdq/pdq_ifsubr.c optional fea device-driver
dev/pdq/pdq.c optional fpa device-driver dev/pdq/pdq.c optional fpa device-driver
dev/pdq/pdq_ifsubr.c optional fpa device-driver dev/pdq/pdq_ifsubr.c optional fpa device-driver
dev/ppbus/nlpt.c optional nlpt dev/ppbus/immio.c optional vpo
dev/ppbus/if_plip.c optional plip
dev/ppbus/lpbb.c optional lpbb
dev/ppbus/lpt.c optional lpt
dev/ppbus/ppb_base.c optional ppbus dev/ppbus/ppb_base.c optional ppbus
dev/ppbus/ppb_1284.c optional ppbus dev/ppbus/ppb_1284.c optional ppbus
dev/ppbus/ppb_msq.c optional ppbus dev/ppbus/ppb_msq.c optional ppbus
@ -133,9 +136,6 @@ dev/ppbus/ppi.c optional ppi
dev/ppbus/pps.c optional pps dev/ppbus/pps.c optional pps
dev/ppbus/vpo.c optional vpo dev/ppbus/vpo.c optional vpo
dev/ppbus/vpoio.c optional vpo dev/ppbus/vpoio.c optional vpo
dev/ppbus/immio.c optional vpo
dev/ppbus/if_plip.c optional plip
dev/ppbus/lpbb.c optional lpbb
smbus_if.o optional smbus \ smbus_if.o optional smbus \
dependency "smbus_if.c smbus_if.h" \ dependency "smbus_if.c smbus_if.h" \
compile-with "${NORMAL_C}" \ compile-with "${NORMAL_C}" \

View File

@ -1,4 +1,4 @@
# $Id: options,v 1.125 1999/01/25 19:34:27 nsouch Exp $ # $Id: options,v 1.126 1999/02/09 01:02:37 mjacob Exp $
# #
# On the handling of kernel options # On the handling of kernel options
# #
@ -243,11 +243,11 @@ DPT_RESET_HBA opt_dpt.h
# Misc debug flags. Most of these should probably be replaced with # Misc debug flags. Most of these should probably be replaced with
# 'DEBUG', and then let people recompile just the interesting modules # 'DEBUG', and then let people recompile just the interesting modules
# with 'make CC="cc -DDEBUG'. # with 'make CC="cc -DDEBUG"'.
CLUSTERDEBUG opt_debug_cluster.h CLUSTERDEBUG opt_debug_cluster.h
DEBUG_1284 opt_ppb_1284.h DEBUG_1284 opt_ppb_1284.h
VP0_DEBUG opt_vpo.h VP0_DEBUG opt_vpo.h
NLPT_DEBUG opt_nlpt.h LPT_DEBUG opt_lpt.h
PLIP_DEBUG opt_plip.h PLIP_DEBUG opt_plip.h
LOCKF_DEBUG opt_debug_lockf.h LOCKF_DEBUG opt_debug_lockf.h
LOUTB opt_debug_outb.h LOUTB opt_debug_outb.h

View File

@ -24,7 +24,7 @@
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* From Id: lpt.c,v 1.55.2.1 1996/11/12 09:08:38 phk Exp * From Id: lpt.c,v 1.55.2.1 1996/11/12 09:08:38 phk Exp
* $Id: if_plip.c,v 1.9 1999/01/30 15:35:39 nsouch Exp $ * $Id: if_plip.c,v 1.10 1999/02/08 14:12:38 des Exp $
*/ */
/* /*
@ -99,7 +99,7 @@
#endif #endif
#include <dev/ppbus/ppbconf.h> #include <dev/ppbus/ppbconf.h>
#include <dev/ppbus/nlpt.h> #include <dev/ppbus/lpt.h>
#include "opt_plip.h" #include "opt_plip.h"
@ -194,8 +194,10 @@ lpprobe(struct ppb_data *ppb)
struct lpt_softc *lp; struct lpt_softc *lp;
/* if we haven't interrupts, the probe fails */ /* if we haven't interrupts, the probe fails */
if (!ppb->ppb_link->id_irq) if (!ppb->ppb_link->id_irq) {
printf("plip: not an interrupt driven port, failed.\n");
return (0); return (0);
}
lp = (struct lpt_softc *) malloc(sizeof(struct lpt_softc), lp = (struct lpt_softc *) malloc(sizeof(struct lpt_softc),
M_TEMP, M_NOWAIT); M_TEMP, M_NOWAIT);

View File

@ -47,7 +47,8 @@
* *
* from: unknown origin, 386BSD 0.1 * from: unknown origin, 386BSD 0.1
* From Id: lpt.c,v 1.55.2.1 1996/11/12 09:08:38 phk Exp * From Id: lpt.c,v 1.55.2.1 1996/11/12 09:08:38 phk Exp
* $Id: nlpt.c,v 1.13 1999/01/27 20:09:19 dillon Exp $ * From Id: nlpt.c,v 1.14 1999/02/08 13:55:43 des Exp
* $Id$
*/ */
/* /*
@ -82,19 +83,19 @@
#include <dev/ppbus/ppbconf.h> #include <dev/ppbus/ppbconf.h>
#include <dev/ppbus/ppb_1284.h> #include <dev/ppbus/ppb_1284.h>
#include <dev/ppbus/nlpt.h> #include <dev/ppbus/lpt.h>
#include "opt_nlpt.h" #include "opt_lpt.h"
#ifndef NLPT_DEBUG #ifndef LPT_DEBUG
#define nlprintf(args) #define lprintf(args)
#else #else
#define nlprintf(args) \ #define lprintf(args) \
do { \ do { \
if (nlptflag) \ if (lptflag) \
printf args; \ printf args; \
} while (0) } while (0)
static int volatile nlptflag = 1; static int volatile lptflag = 1;
#endif #endif
#define LPINITRDY 4 /* wait up to 4 seconds for a ready */ #define LPINITRDY 4 /* wait up to 4 seconds for a ready */
@ -111,29 +112,29 @@ static int nlpt = 0;
#define MAXLPT 8 /* XXX not much better! */ #define MAXLPT 8 /* XXX not much better! */
static struct lpt_data *lptdata[MAXLPT]; static struct lpt_data *lptdata[MAXLPT];
#define LPT_NAME "nlpt" /* our official name */ #define LPT_NAME "lpt" /* our official name */
static timeout_t nlptout; static timeout_t lptout;
static int nlpt_port_test(struct lpt_data *sc, u_char data, u_char mask); static int lpt_port_test(struct lpt_data *sc, u_char data, u_char mask);
static int nlpt_detect(struct lpt_data *sc); static int lpt_detect(struct lpt_data *sc);
/* /*
* Make ourselves visible as a ppbus driver * Make ourselves visible as a ppbus driver
*/ */
static struct ppb_device *nlptprobe(struct ppb_data *ppb); static struct ppb_device *lptprobe(struct ppb_data *ppb);
static int nlptattach(struct ppb_device *dev); static int lptattach(struct ppb_device *dev);
static void nlptintr(int unit); static void lptintr(int unit);
static void nlpt_drvinit(void *unused); static void lpt_drvinit(void *unused);
static void nlpt_intr(int unit); /* without spls */ static void lpt_intr(int unit); /* without spls */
#ifdef KERNEL #ifdef KERNEL
static struct ppb_driver nlptdriver = { static struct ppb_driver lptdriver = {
nlptprobe, nlptattach, LPT_NAME lptprobe, lptattach, LPT_NAME
}; };
DATA_SET(ppbdriver_set, nlptdriver); DATA_SET(ppbdriver_set, lptdriver);
#endif /* KERNEL */ #endif /* KERNEL */
@ -164,16 +165,16 @@ DATA_SET(ppbdriver_set, nlptdriver);
#define MAX_SPIN 20 /* Max delay for device ready in usecs */ #define MAX_SPIN 20 /* Max delay for device ready in usecs */
static d_open_t nlptopen; static d_open_t lptopen;
static d_close_t nlptclose; static d_close_t lptclose;
static d_write_t nlptwrite; static d_write_t lptwrite;
static d_read_t nlptread; static d_read_t lptread;
static d_ioctl_t nlptioctl; static d_ioctl_t lptioctl;
#define CDEV_MAJOR 16 #define CDEV_MAJOR 16
static struct cdevsw nlpt_cdevsw = static struct cdevsw lpt_cdevsw =
{ nlptopen, nlptclose, nlptread, nlptwrite, /*16*/ { lptopen, lptclose, lptread, lptwrite, /*16*/
nlptioctl, nullstop, nullreset, nodevtotty, /* lpt */ lptioctl, nullstop, nullreset, nodevtotty, /* lpt */
seltrue, nommap, nostrat, LPT_NAME, NULL, -1 }; seltrue, nommap, nostrat, LPT_NAME, NULL, -1 };
static int static int
@ -201,10 +202,10 @@ lpt_release_ppbus(struct lpt_data *sc)
} }
/* /*
* Internal routine to nlptprobe to do port tests of one byte value * Internal routine to lptprobe to do port tests of one byte value
*/ */
static int static int
nlpt_port_test(struct lpt_data *sc, u_char data, u_char mask) lpt_port_test(struct lpt_data *sc, u_char data, u_char mask)
{ {
int temp, timeout; int temp, timeout;
@ -216,7 +217,7 @@ nlpt_port_test(struct lpt_data *sc, u_char data, u_char mask)
temp = ppb_rdtr(&sc->lpt_dev) & mask; temp = ppb_rdtr(&sc->lpt_dev) & mask;
} }
while (temp != data && --timeout); while (temp != data && --timeout);
nlprintf(("out=%x\tin=%x\ttout=%d\n", data, temp, timeout)); lprintf(("out=%x\tin=%x\ttout=%d\n", data, temp, timeout));
return (temp == data); return (temp == data);
} }
@ -268,7 +269,7 @@ nlpt_port_test(struct lpt_data *sc, u_char data, u_char mask)
* Quick exit on fail added. * Quick exit on fail added.
*/ */
static int static int
nlpt_detect(struct lpt_data *sc) lpt_detect(struct lpt_data *sc)
{ {
static u_char testbyte[18] = { static u_char testbyte[18] = {
0x55, /* alternating zeros */ 0x55, /* alternating zeros */
@ -289,7 +290,7 @@ nlpt_detect(struct lpt_data *sc)
} }
for (i = 0; i < 18 && status; i++) for (i = 0; i < 18 && status; i++)
if (!nlpt_port_test(sc, testbyte[i], 0xff)) { if (!lpt_port_test(sc, testbyte[i], 0xff)) {
status = 0; status = 0;
goto end_probe; goto end_probe;
} }
@ -305,10 +306,10 @@ nlpt_detect(struct lpt_data *sc)
} }
/* /*
* nlptprobe() * lptprobe()
*/ */
static struct ppb_device * static struct ppb_device *
nlptprobe(struct ppb_data *ppb) lptprobe(struct ppb_data *ppb)
{ {
struct lpt_data *sc; struct lpt_data *sc;
@ -331,14 +332,14 @@ nlptprobe(struct ppb_data *ppb)
* ppbus dependent initialisation. * ppbus dependent initialisation.
*/ */
sc->lpt_dev.id_unit = sc->lpt_unit; sc->lpt_dev.id_unit = sc->lpt_unit;
sc->lpt_dev.name = nlptdriver.name; sc->lpt_dev.name = lptdriver.name;
sc->lpt_dev.ppb = ppb; sc->lpt_dev.ppb = ppb;
sc->lpt_dev.intr = nlptintr; sc->lpt_dev.intr = lptintr;
/* /*
* Now, try to detect the printer. * Now, try to detect the printer.
*/ */
if (!nlpt_detect(sc)) { if (!lpt_detect(sc)) {
free(sc, M_TEMP); free(sc, M_TEMP);
return (0); return (0);
} }
@ -350,7 +351,7 @@ nlptprobe(struct ppb_data *ppb)
} }
static int static int
nlptattach(struct ppb_device *dev) lptattach(struct ppb_device *dev)
{ {
struct lpt_data *sc = lptdata[dev->id_unit]; struct lpt_data *sc = lptdata[dev->id_unit];
int error; int error;
@ -371,23 +372,23 @@ nlptattach(struct ppb_device *dev)
ppb_wctr(&sc->lpt_dev, LPC_NINIT); ppb_wctr(&sc->lpt_dev, LPC_NINIT);
/* check if we can use interrupt, should be done by ppc stuff */ /* check if we can use interrupt, should be done by ppc stuff */
nlprintf(("oldirq %x\n", sc->sc_irq)); lprintf(("oldirq %x\n", sc->sc_irq));
if (ppb_get_irq(&sc->lpt_dev)) { if (ppb_get_irq(&sc->lpt_dev)) {
sc->sc_irq = LP_HAS_IRQ | LP_USE_IRQ | LP_ENABLE_IRQ; sc->sc_irq = LP_HAS_IRQ | LP_USE_IRQ | LP_ENABLE_IRQ;
printf(LPT_NAME "%d: Interrupt-driven port\n", dev->id_unit); printf(LPT_NAME "%d: Interrupt-driven port\n", dev->id_unit);
} else { } else {
sc->sc_irq = 0; sc->sc_irq = 0;
nlprintf((LPT_NAME "%d: Polled port\n", dev->id_unit)); lprintf((LPT_NAME "%d: Polled port\n", dev->id_unit));
} }
nlprintf(("irq %x\n", sc->sc_irq)); lprintf(("irq %x\n", sc->sc_irq));
lpt_release_ppbus(sc); lpt_release_ppbus(sc);
#ifdef DEVFS #ifdef DEVFS
sc->devfs_token = devfs_add_devswf(&nlpt_cdevsw, sc->devfs_token = devfs_add_devswf(&lpt_cdevsw,
dev->id_unit, DV_CHR, dev->id_unit, DV_CHR,
UID_ROOT, GID_WHEEL, 0600, LPT_NAME "%d", dev->id_unit); UID_ROOT, GID_WHEEL, 0600, LPT_NAME "%d", dev->id_unit);
sc->devfs_token_ctl = devfs_add_devswf(&nlpt_cdevsw, sc->devfs_token_ctl = devfs_add_devswf(&lpt_cdevsw,
dev->id_unit | LP_BYPASS, DV_CHR, dev->id_unit | LP_BYPASS, DV_CHR,
UID_ROOT, GID_WHEEL, 0600, LPT_NAME "%d.ctl", dev->id_unit); UID_ROOT, GID_WHEEL, 0600, LPT_NAME "%d.ctl", dev->id_unit);
#endif #endif
@ -396,17 +397,17 @@ nlptattach(struct ppb_device *dev)
} }
static void static void
nlptout(void *arg) lptout(void *arg)
{ {
struct lpt_data *sc = arg; struct lpt_data *sc = arg;
int pl; int pl;
nlprintf(("T %x ", ppb_rstr(&sc->lpt_dev))); lprintf(("T %x ", ppb_rstr(&sc->lpt_dev)));
if (sc->sc_state & OPEN) { if (sc->sc_state & OPEN) {
sc->sc_backoff++; sc->sc_backoff++;
if (sc->sc_backoff > hz/LPTOUTMAX) if (sc->sc_backoff > hz/LPTOUTMAX)
sc->sc_backoff = sc->sc_backoff > hz/LPTOUTMAX; sc->sc_backoff = sc->sc_backoff > hz/LPTOUTMAX;
timeout(nlptout, (caddr_t)sc, sc->sc_backoff); timeout(lptout, (caddr_t)sc, sc->sc_backoff);
} else } else
sc->sc_state &= ~TOUT; sc->sc_state &= ~TOUT;
@ -418,7 +419,7 @@ nlptout(void *arg)
*/ */
if (sc->sc_xfercnt) { if (sc->sc_xfercnt) {
pl = spltty(); pl = spltty();
nlpt_intr(sc->lpt_unit); lpt_intr(sc->lpt_unit);
splx(pl); splx(pl);
} else { } else {
sc->sc_state &= ~OBUSY; sc->sc_state &= ~OBUSY;
@ -427,13 +428,13 @@ nlptout(void *arg)
} }
/* /*
* nlptopen -- reset the printer, then wait until it's selected and not busy. * lptopen -- reset the printer, then wait until it's selected and not busy.
* If LP_BYPASS flag is selected, then we do not try to select the * If LP_BYPASS flag is selected, then we do not try to select the
* printer -- this is just used for passing ioctls. * printer -- this is just used for passing ioctls.
*/ */
static int static int
nlptopen(dev_t dev, int flags, int fmt, struct proc *p) lptopen(dev_t dev, int flags, int fmt, struct proc *p)
{ {
struct lpt_data *sc; struct lpt_data *sc;
@ -447,7 +448,7 @@ nlptopen(dev_t dev, int flags, int fmt, struct proc *p)
sc = lptdata[unit]; sc = lptdata[unit];
if (sc->sc_state) { if (sc->sc_state) {
nlprintf((LPT_NAME ": still open %x\n", sc->sc_state)); lprintf((LPT_NAME ": still open %x\n", sc->sc_state));
return(EBUSY); return(EBUSY);
} else } else
sc->sc_state |= LPTINIT; sc->sc_state |= LPTINIT;
@ -465,7 +466,7 @@ nlptopen(dev_t dev, int flags, int fmt, struct proc *p)
return (err); return (err);
s = spltty(); s = spltty();
nlprintf((LPT_NAME " flags 0x%x\n", sc->sc_flags)); lprintf((LPT_NAME " flags 0x%x\n", sc->sc_flags));
/* set IRQ status according to ENABLE_IRQ flag */ /* set IRQ status according to ENABLE_IRQ flag */
if (sc->sc_irq & LP_ENABLE_IRQ) if (sc->sc_irq & LP_ENABLE_IRQ)
@ -491,7 +492,7 @@ nlptopen(dev_t dev, int flags, int fmt, struct proc *p)
if (trys++ >= LPINITRDY*4) { if (trys++ >= LPINITRDY*4) {
splx(s); splx(s);
sc->sc_state = 0; sc->sc_state = 0;
nlprintf(("status %x\n", ppb_rstr(&sc->lpt_dev))); lprintf(("status %x\n", ppb_rstr(&sc->lpt_dev)));
lpt_release_ppbus(sc); lpt_release_ppbus(sc);
return (EBUSY); return (EBUSY);
@ -532,25 +533,25 @@ nlptopen(dev_t dev, int flags, int fmt, struct proc *p)
lpt_release_ppbus(sc); lpt_release_ppbus(sc);
/* only use timeout if using interrupt */ /* only use timeout if using interrupt */
nlprintf(("irq %x\n", sc->sc_irq)); lprintf(("irq %x\n", sc->sc_irq));
if (sc->sc_irq & LP_USE_IRQ) { if (sc->sc_irq & LP_USE_IRQ) {
sc->sc_state |= TOUT; sc->sc_state |= TOUT;
timeout(nlptout, (caddr_t)sc, timeout(lptout, (caddr_t)sc,
(sc->sc_backoff = hz/LPTOUTINITIAL)); (sc->sc_backoff = hz/LPTOUTINITIAL));
} }
nlprintf(("opened.\n")); lprintf(("opened.\n"));
return(0); return(0);
} }
/* /*
* nlptclose -- close the device, free the local line buffer. * lptclose -- close the device, free the local line buffer.
* *
* Check for interrupted write call added. * Check for interrupted write call added.
*/ */
static int static int
nlptclose(dev_t dev, int flags, int fmt, struct proc *p) lptclose(dev_t dev, int flags, int fmt, struct proc *p)
{ {
struct lpt_data *sc = lptdata[LPTUNIT(minor(dev))]; struct lpt_data *sc = lptdata[LPTUNIT(minor(dev))];
int err; int err;
@ -583,12 +584,12 @@ nlptclose(dev_t dev, int flags, int fmt, struct proc *p)
sc->sc_state = 0; sc->sc_state = 0;
sc->sc_xfercnt = 0; sc->sc_xfercnt = 0;
nlprintf(("closed.\n")); lprintf(("closed.\n"));
return(0); return(0);
} }
/* /*
* nlpt_pushbytes() * lpt_pushbytes()
* Workhorse for actually spinning and writing bytes to printer * Workhorse for actually spinning and writing bytes to printer
* Derived from lpa.c * Derived from lpa.c
* Originally by ? * Originally by ?
@ -596,12 +597,12 @@ nlptclose(dev_t dev, int flags, int fmt, struct proc *p)
* This code is only used when we are polling the port * This code is only used when we are polling the port
*/ */
static int static int
nlpt_pushbytes(struct lpt_data *sc) lpt_pushbytes(struct lpt_data *sc)
{ {
int spin, err, tic; int spin, err, tic;
char ch; char ch;
nlprintf(("p")); lprintf(("p"));
/* loop for every character .. */ /* loop for every character .. */
while (sc->sc_xfercnt > 0) { while (sc->sc_xfercnt > 0) {
/* printer data */ /* printer data */
@ -648,11 +649,11 @@ nlpt_pushbytes(struct lpt_data *sc)
} }
/* /*
* nlptread --retrieve printer status in IEEE1284 NIBBLE mode * lptread --retrieve printer status in IEEE1284 NIBBLE mode
*/ */
static int static int
nlptread(dev_t dev, struct uio *uio, int ioflag) lptread(dev_t dev, struct uio *uio, int ioflag)
{ {
struct lpt_data *sc = lptdata[LPTUNIT(minor(dev))]; struct lpt_data *sc = lptdata[LPTUNIT(minor(dev))];
int error = 0, len; int error = 0, len;
@ -682,14 +683,14 @@ nlptread(dev_t dev, struct uio *uio, int ioflag)
} }
/* /*
* nlptwrite --copy a line from user space to a local buffer, then call * lptwrite --copy a line from user space to a local buffer, then call
* putc to get the chars moved to the output queue. * putc to get the chars moved to the output queue.
* *
* Flagging of interrupted write added. * Flagging of interrupted write added.
*/ */
static int static int
nlptwrite(dev_t dev, struct uio *uio, int ioflag) lptwrite(dev_t dev, struct uio *uio, int ioflag)
{ {
register unsigned n; register unsigned n;
int pl, err; int pl, err;
@ -732,16 +733,16 @@ nlptwrite(dev_t dev, struct uio *uio, int ioflag)
return(err); return(err);
} }
} else while ((sc->sc_xfercnt > 0)&&(sc->sc_irq & LP_USE_IRQ)) { } else while ((sc->sc_xfercnt > 0)&&(sc->sc_irq & LP_USE_IRQ)) {
nlprintf(("i")); lprintf(("i"));
/* if the printer is ready for a char, */ /* if the printer is ready for a char, */
/* give it one */ /* give it one */
if ((sc->sc_state & OBUSY) == 0){ if ((sc->sc_state & OBUSY) == 0){
nlprintf(("\nC %d. ", sc->sc_xfercnt)); lprintf(("\nC %d. ", sc->sc_xfercnt));
pl = spltty(); pl = spltty();
nlpt_intr(sc->lpt_unit); lpt_intr(sc->lpt_unit);
(void) splx(pl); (void) splx(pl);
} }
nlprintf(("W ")); lprintf(("W "));
if (sc->sc_state & OBUSY) if (sc->sc_state & OBUSY)
if ((err = tsleep((caddr_t)sc, if ((err = tsleep((caddr_t)sc,
LPPRI|PCATCH, LPT_NAME "write", 0))) { LPPRI|PCATCH, LPT_NAME "write", 0))) {
@ -752,9 +753,9 @@ nlptwrite(dev_t dev, struct uio *uio, int ioflag)
/* check to see if we must do a polled write */ /* check to see if we must do a polled write */
if(!(sc->sc_irq & LP_USE_IRQ) && (sc->sc_xfercnt)) { if(!(sc->sc_irq & LP_USE_IRQ) && (sc->sc_xfercnt)) {
nlprintf(("p")); lprintf(("p"));
err = nlpt_pushbytes(sc); err = lpt_pushbytes(sc);
if (err) if (err)
return(err); return(err);
@ -768,14 +769,14 @@ nlptwrite(dev_t dev, struct uio *uio, int ioflag)
} }
/* /*
* nlpt_intr -- handle printer interrupts which occur when the printer is * lpt_intr -- handle printer interrupts which occur when the printer is
* ready to accept another char. * ready to accept another char.
* *
* do checking for interrupted write call. * do checking for interrupted write call.
*/ */
static void static void
nlpt_intr(int unit) lpt_intr(int unit)
{ {
struct lpt_data *sc = lptdata[unit]; struct lpt_data *sc = lptdata[unit];
int sts; int sts;
@ -788,7 +789,7 @@ nlpt_intr(int unit)
/* /*
* Is printer online and ready for output? * Is printer online and ready for output?
* *
* Avoid falling back to nlptout() too quickly. First spin-loop * Avoid falling back to lptout() too quickly. First spin-loop
* to see if the printer will become ready ``really soon now''. * to see if the printer will become ready ``really soon now''.
*/ */
for (i = 0; i < 100 && for (i = 0; i < 100 &&
@ -800,7 +801,7 @@ nlpt_intr(int unit)
if (sc->sc_xfercnt) { if (sc->sc_xfercnt) {
/* send char */ /* send char */
/*nlprintf(("%x ", *sc->sc_cp)); */ /*lprintf(("%x ", *sc->sc_cp)); */
ppb_wdtr(&sc->lpt_dev, *sc->sc_cp++) ; ppb_wdtr(&sc->lpt_dev, *sc->sc_cp++) ;
ppb_wctr(&sc->lpt_dev, sc->sc_control|LPC_STB); ppb_wctr(&sc->lpt_dev, sc->sc_control|LPC_STB);
/* DELAY(X) */ /* DELAY(X) */
@ -818,31 +819,31 @@ nlpt_intr(int unit)
if(!(sc->sc_state & INTERRUPTED)) if(!(sc->sc_state & INTERRUPTED))
wakeup((caddr_t)sc); wakeup((caddr_t)sc);
nlprintf(("w ")); lprintf(("w "));
return; return;
} else { /* check for error */ } else { /* check for error */
if(((sts & (LPS_NERR | LPS_OUT) ) != LPS_NERR) && if(((sts & (LPS_NERR | LPS_OUT) ) != LPS_NERR) &&
(sc->sc_state & OPEN)) (sc->sc_state & OPEN))
sc->sc_state |= EERROR; sc->sc_state |= EERROR;
/* nlptout() will jump in and try to restart. */ /* lptout() will jump in and try to restart. */
} }
nlprintf(("sts %x ", sts)); lprintf(("sts %x ", sts));
} }
static void static void
nlptintr(int unit) lptintr(int unit)
{ {
/* call the interrupt at required spl level */ /* call the interrupt at required spl level */
int s = spltty(); int s = spltty();
nlpt_intr(unit); lpt_intr(unit);
splx(s); splx(s);
return; return;
} }
static int static int
nlptioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p) lptioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
{ {
int error = 0; int error = 0;
struct lpt_data *sc; struct lpt_data *sc;
@ -903,18 +904,18 @@ nlptioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
return(error); return(error);
} }
static nlpt_devsw_installed = 0; static lpt_devsw_installed = 0;
static void static void
nlpt_drvinit(void *unused) lpt_drvinit(void *unused)
{ {
dev_t dev; dev_t dev;
if( ! nlpt_devsw_installed ) { if( ! lpt_devsw_installed ) {
dev = makedev(CDEV_MAJOR, 0); dev = makedev(CDEV_MAJOR, 0);
cdevsw_add(&dev,&nlpt_cdevsw, NULL); cdevsw_add(&dev,&lpt_cdevsw, NULL);
nlpt_devsw_installed = 1; lpt_devsw_installed = 1;
} }
} }
SYSINIT(nlptdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,nlpt_drvinit,NULL) SYSINIT(lptdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,lpt_drvinit,NULL)

View File

@ -26,8 +26,9 @@
* Distantly from : * Distantly from :
* @(#)lptreg.h 1.1 (Berkeley) 12/19/90 * @(#)lptreg.h 1.1 (Berkeley) 12/19/90
* Id: lptreg.h,v 1.6 1997/02/22 09:36:52 peter Exp * Id: lptreg.h,v 1.6 1997/02/22 09:36:52 peter Exp
* From Id: nlpt.h,v 1.3 1999/01/10 12:04:54 nsouch Exp
* *
* $Id: nlpt.h,v 1.2 1997/08/16 14:05:32 msmith Exp $ * $Id$
*/ */
#ifndef __NLPT_H #ifndef __NLPT_H
#define __NLPT_H #define __NLPT_H

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: ppi.c,v 1.10 1999/01/27 21:49:53 dillon Exp $ * $Id: ppi.c,v 1.11 1999/01/30 15:35:39 nsouch Exp $
* *
*/ */
#include "ppi.h" #include "ppi.h"
@ -530,49 +530,6 @@ ppiioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
return (error); return (error);
} }
#ifdef PPI_MODULE
MOD_DEV(ppi, LM_DT_CHAR, CDEV_MAJOR, &ppi_cdevsw);
static int
ppi_load(struct lkm_table *lkmtp, int cmd)
{
struct ppb_data *ppb;
struct ppb_device *dev;
int i;
for (ppb = ppb_next_bus(NULL); ppb; ppb = ppb_next_bus(ppb)) {
dev = ppiprobe(ppb);
ppiattach(dev);
ppb_attach_device(dev);
}
return (0);
}
static int
ppi_unload(struct lkm_table *lkmtp, int cmd)
{
int i;
for (i = nppi-1; i > 0; i--) {
ppb_remove_device(&ppidata[i]->ppi_dev);
free(ppidata[i], M_TEMP);
}
return (0);
}
int
ppi_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, ppi_load, ppi_unload, lkm_nullcmd);
}
#endif /* PPI_MODULE */
static ppi_devsw_installed = 0; static ppi_devsw_installed = 0;
static void ppi_drvinit(void *unused) static void ppi_drvinit(void *unused)

View File

@ -11,7 +11,7 @@
# device lines is present in the ./LINT configuration file. If you are # device lines is present in the ./LINT configuration file. If you are
# in doubt as to the purpose or necessity of a line, check first in LINT. # in doubt as to the purpose or necessity of a line, check first in LINT.
# #
# $Id: GENERIC,v 1.147 1999/02/10 02:18:31 des Exp $ # $Id: GENERIC,v 1.148 1999/02/11 06:07:27 jkoshy Exp $
machine "i386" machine "i386"
cpu "I386_CPU" cpu "I386_CPU"
@ -146,7 +146,7 @@ device sio2 at isa? disable port "IO_COM3" tty irq 5
device sio3 at isa? disable port "IO_COM4" tty irq 9 device sio3 at isa? disable port "IO_COM4" tty irq 9
# Parallel port # Parallel port
device ppc0 at isa? port? net irq 7 device ppc0 at isa? port? tty irq 7
controller ppbus0 controller ppbus0
device nlpt0 at ppbus? device nlpt0 at ppbus?
device plip0 at ppbus? device plip0 at ppbus?

View File

@ -2,7 +2,7 @@
# LINT -- config file for checking all the sources, tries to pull in # LINT -- config file for checking all the sources, tries to pull in
# as much of the source tree as it can. # as much of the source tree as it can.
# #
# $Id: LINT,v 1.553 1999/02/12 12:15:02 brian Exp $ # $Id: LINT,v 1.554 1999/02/13 17:54:32 nsouch Exp $
# #
# NB: You probably don't want to try running a kernel built from this # NB: You probably don't want to try running a kernel built from this
# file. Instead, you should start from GENERIC, and add options from # file. Instead, you should start from GENERIC, and add options from
@ -1831,9 +1831,9 @@ pseudo-device "i4bisppp" 4
# vpo Iomega Zip Drive # vpo Iomega Zip Drive
# Requires SCSI disk support ('scbus' and 'da'), best # Requires SCSI disk support ('scbus' and 'da'), best
# performance is achieved with ports in EPP 1.9 mode. # performance is achieved with ports in EPP 1.9 mode.
# nlpt Parallel Printer # lpt Parallel Printer
# plip Parallel network interface # plip Parallel network interface
# ppi General-purpose I/O ("Geek Port") # ppi General-purpose I/O ("Geek Port") + IEEE1284 I/O
# pps Pulse per second Timing Interface # pps Pulse per second Timing Interface
# lpbb Philips official parallel port I2C bit-banging interface # lpbb Philips official parallel port I2C bit-banging interface
# #
@ -1846,19 +1846,19 @@ options "PERIPH_1284" # Makes your computer act as a IEEE1284
# compliant peripheral # compliant peripheral
options "DONTPROBE_1284"# Avoid boot detection of PnP parallel devices options "DONTPROBE_1284"# Avoid boot detection of PnP parallel devices
options "VP0_DEBUG" # ZIP/ZIP+ debug options "VP0_DEBUG" # ZIP/ZIP+ debug
options "NLPT_DEBUG" # Printer driver debug options "LPT_DEBUG" # Printer driver debug
options "PPC_DEBUG" # Parallel chipset level debug options "PPC_DEBUG" # Parallel chipset level debug
options "PLIP_DEBUG" # Parallel network IP interface debug options "PLIP_DEBUG" # Parallel network IP interface debug
controller ppbus0 controller ppbus0
controller vpo0 at ppbus? controller vpo0 at ppbus?
device nlpt0 at ppbus? device lpt0 at ppbus?
device plip0 at ppbus? device plip0 at ppbus?
device ppi0 at ppbus? device ppi0 at ppbus?
device pps0 at ppbus? device pps0 at ppbus?
device lpbb0 at ppbus? device lpbb0 at ppbus?
controller ppc0 at isa? disable port ? tty irq 7 controller ppc0 at isa? port? tty irq 7
# Kernel BOOTP support # Kernel BOOTP support

View File

@ -2,7 +2,7 @@
# LINT -- config file for checking all the sources, tries to pull in # LINT -- config file for checking all the sources, tries to pull in
# as much of the source tree as it can. # as much of the source tree as it can.
# #
# $Id: LINT,v 1.553 1999/02/12 12:15:02 brian Exp $ # $Id: LINT,v 1.554 1999/02/13 17:54:32 nsouch Exp $
# #
# NB: You probably don't want to try running a kernel built from this # NB: You probably don't want to try running a kernel built from this
# file. Instead, you should start from GENERIC, and add options from # file. Instead, you should start from GENERIC, and add options from
@ -1831,9 +1831,9 @@ pseudo-device "i4bisppp" 4
# vpo Iomega Zip Drive # vpo Iomega Zip Drive
# Requires SCSI disk support ('scbus' and 'da'), best # Requires SCSI disk support ('scbus' and 'da'), best
# performance is achieved with ports in EPP 1.9 mode. # performance is achieved with ports in EPP 1.9 mode.
# nlpt Parallel Printer # lpt Parallel Printer
# plip Parallel network interface # plip Parallel network interface
# ppi General-purpose I/O ("Geek Port") # ppi General-purpose I/O ("Geek Port") + IEEE1284 I/O
# pps Pulse per second Timing Interface # pps Pulse per second Timing Interface
# lpbb Philips official parallel port I2C bit-banging interface # lpbb Philips official parallel port I2C bit-banging interface
# #
@ -1846,19 +1846,19 @@ options "PERIPH_1284" # Makes your computer act as a IEEE1284
# compliant peripheral # compliant peripheral
options "DONTPROBE_1284"# Avoid boot detection of PnP parallel devices options "DONTPROBE_1284"# Avoid boot detection of PnP parallel devices
options "VP0_DEBUG" # ZIP/ZIP+ debug options "VP0_DEBUG" # ZIP/ZIP+ debug
options "NLPT_DEBUG" # Printer driver debug options "LPT_DEBUG" # Printer driver debug
options "PPC_DEBUG" # Parallel chipset level debug options "PPC_DEBUG" # Parallel chipset level debug
options "PLIP_DEBUG" # Parallel network IP interface debug options "PLIP_DEBUG" # Parallel network IP interface debug
controller ppbus0 controller ppbus0
controller vpo0 at ppbus? controller vpo0 at ppbus?
device nlpt0 at ppbus? device lpt0 at ppbus?
device plip0 at ppbus? device plip0 at ppbus?
device ppi0 at ppbus? device ppi0 at ppbus?
device pps0 at ppbus? device pps0 at ppbus?
device lpbb0 at ppbus? device lpbb0 at ppbus?
controller ppc0 at isa? disable port ? tty irq 7 controller ppc0 at isa? port? tty irq 7
# Kernel BOOTP support # Kernel BOOTP support