summaryrefslogtreecommitdiffstats
path: root/sys/dev/ppbus/ppb_base.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/ppbus/ppb_base.c')
-rw-r--r--sys/dev/ppbus/ppb_base.c63
1 files changed, 25 insertions, 38 deletions
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 <sys/param.h>
@@ -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)
OpenPOWER on IntegriCloud