From 2fdb23234a18b64b994328bb4be606a420e3b56d Mon Sep 17 00:00:00 2001 From: msmith Date: Mon, 3 Aug 1998 19:14:33 +0000 Subject: Major ppbus updates from the author. - ppbus now supports PLIP via the if_plip driver - ieee1284 infrastructure added, including parallel-port PnP - port microsequencer added, for scripting the sort of port I/O that is common with parallel devices without endless calls up and down through the driver structure. - improved bus ownership behaviour among the ppbus-using drivers. - improved I/O chipset feature detection The vpo driver is now implemented using the microsequencer, leading to some performance improvements as well as providing an extensive example of its use. Reviewed by: msmith Submitted by: Nicolas Souchu --- sys/dev/ppbus/ppb_base.c | 63 +++++++++++++++++++----------------------------- 1 file changed, 25 insertions(+), 38 deletions(-) (limited to 'sys/dev/ppbus/ppb_base.c') diff --git a/sys/dev/ppbus/ppb_base.c b/sys/dev/ppbus/ppb_base.c index 8c956be..6bea760 100644 --- a/sys/dev/ppbus/ppb_base.c +++ b/sys/dev/ppbus/ppb_base.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 1997 Nicolas Souchu + * Copyright (c) 1997, 1998 Nicolas Souchu * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ppb_base.c,v 1.2 1997/08/28 10:15:12 msmith Exp $ + * $Id: ppb_base.c,v 1.3 1997/09/01 00:51:45 bde Exp $ * */ #include @@ -98,78 +98,65 @@ ppb_poll_device(struct ppb_device *dev, int max, } /* - * ppb_reset_epp_timeout() + * ppb_set_mode() * - * Reset the EPP timeout bit in the status register. + * Set the operating mode of the chipset */ int -ppb_reset_epp_timeout(struct ppb_device *dev) +ppb_set_mode(struct ppb_device *dev, int mode) { struct ppb_data *ppb = dev->ppb; + int old_mode = ppb_get_mode(dev); - if (ppb->ppb_owner != dev) - return (EACCES); + if ((*ppb->ppb_link->adapter->setmode)(dev->id_unit, mode)) + return (-1); - (*ppb->ppb_link->adapter->reset_epp_timeout)(dev->id_unit); + /* XXX yet device mode = ppbus mode = chipset mode */ + dev->mode = ppb->mode = mode; - return (0); + return (old_mode); } /* - * ppb_ecp_sync() + * ppb_reset_epp_timeout() * - * Wait for the ECP FIFO to be empty. + * Reset the EPP timeout bit in the status register */ int -ppb_ecp_sync(struct ppb_device *dev) +ppb_reset_epp_timeout(struct ppb_device *dev) { struct ppb_data *ppb = dev->ppb; if (ppb->ppb_owner != dev) return (EACCES); - (*ppb->ppb_link->adapter->ecp_sync)(dev->id_unit); + (*ppb->ppb_link->adapter->reset_epp_timeout)(dev->id_unit); return (0); } /* - * ppb_get_mode() + * ppb_ecp_sync() * - * Read the mode (SPP, EPP...) of the chipset. + * Wait for the ECP FIFO to be empty */ int -ppb_get_mode(struct ppb_device *dev) +ppb_ecp_sync(struct ppb_device *dev) { - return (dev->ppb->ppb_link->mode); -} + struct ppb_data *ppb = dev->ppb; -/* - * ppb_get_epp_protocol() - * - * Read the EPP protocol (1.9 or 1.7). - */ -int -ppb_get_epp_protocol(struct ppb_device *dev) -{ - return (dev->ppb->ppb_link->epp_protocol); -} + if (ppb->ppb_owner != dev) + return (EACCES); -/* - * ppb_get_irq() - * - * Return the irq, 0 if none. - */ -int -ppb_get_irq(struct ppb_device *dev) -{ - return (dev->ppb->ppb_link->id_irq); + (*ppb->ppb_link->adapter->ecp_sync)(dev->id_unit); + + return (0); } /* * ppb_get_status() * - * Read the status register and update the status info. + * Read the status register and update the status info */ int ppb_get_status(struct ppb_device *dev, struct ppb_status *status) -- cgit v1.1