Home | History | Annotate | Line # | Download | only in scsipi
ssvar.h revision 1.3.2.2
      1  1.3.2.2  thorpej /*	$NetBSD: ssvar.h,v 1.3.2.2 1997/08/27 23:33:38 thorpej Exp $	*/
      2  1.3.2.2  thorpej 
      3  1.3.2.2  thorpej /*
      4  1.3.2.2  thorpej  * Copyright (c) 1995 Kenneth Stailey.  All rights reserved.
      5  1.3.2.2  thorpej  *   modified for configurable scanner support by Joachim Koenig
      6  1.3.2.2  thorpej  *
      7  1.3.2.2  thorpej  * Redistribution and use in source and binary forms, with or without
      8  1.3.2.2  thorpej  * modification, are permitted provided that the following conditions
      9  1.3.2.2  thorpej  * are met:
     10  1.3.2.2  thorpej  * 1. Redistributions of source code must retain the above copyright
     11  1.3.2.2  thorpej  *    notice, this list of conditions and the following disclaimer.
     12  1.3.2.2  thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.3.2.2  thorpej  *    notice, this list of conditions and the following disclaimer in the
     14  1.3.2.2  thorpej  *    documentation and/or other materials provided with the distribution.
     15  1.3.2.2  thorpej  * 3. All advertising materials mentioning features or use of this software
     16  1.3.2.2  thorpej  *    must display the following acknowledgement:
     17  1.3.2.2  thorpej  *	This product includes software developed by Kenneth Stailey.
     18  1.3.2.2  thorpej  * 4. The name of the author may not be used to endorse or promote products
     19  1.3.2.2  thorpej  *    derived from this software without specific prior written permission.
     20  1.3.2.2  thorpej  *
     21  1.3.2.2  thorpej  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     22  1.3.2.2  thorpej  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     23  1.3.2.2  thorpej  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     24  1.3.2.2  thorpej  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     25  1.3.2.2  thorpej  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     26  1.3.2.2  thorpej  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     27  1.3.2.2  thorpej  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     28  1.3.2.2  thorpej  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     29  1.3.2.2  thorpej  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     30  1.3.2.2  thorpej  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     31  1.3.2.2  thorpej  */
     32  1.3.2.2  thorpej 
     33  1.3.2.2  thorpej /*
     34  1.3.2.2  thorpej  * SCSI scanner interface description
     35  1.3.2.2  thorpej  */
     36  1.3.2.2  thorpej 
     37  1.3.2.2  thorpej /*
     38  1.3.2.2  thorpej  * Special handlers for impractically different scanner types.
     39  1.3.2.2  thorpej  * Register NULL for a function if you want to try the real SCSI code
     40  1.3.2.2  thorpej  * (with quirks table)
     41  1.3.2.2  thorpej  */
     42  1.3.2.2  thorpej struct ss_softc;
     43  1.3.2.2  thorpej struct scan_io;
     44  1.3.2.2  thorpej 
     45  1.3.2.2  thorpej struct ss_special {
     46  1.3.2.2  thorpej 	int	(*set_params) __P((struct ss_softc *, struct scan_io *));
     47  1.3.2.2  thorpej 	int	(*trigger_scanner) __P((struct ss_softc *));
     48  1.3.2.2  thorpej 	int	(*get_params) __P((struct ss_softc *));
     49  1.3.2.2  thorpej 	/* some scanners only send line-multiples */
     50  1.3.2.2  thorpej 	void	(*minphys) __P((struct ss_softc *, struct buf *));
     51  1.3.2.2  thorpej 	int	(*read) __P((struct ss_softc *, struct buf *));
     52  1.3.2.2  thorpej 	int	(*rewind_scanner) __P((struct ss_softc *));
     53  1.3.2.2  thorpej 	int	(*load_adf) __P((struct ss_softc *));
     54  1.3.2.2  thorpej 	int	(*unload_adf) __P((struct ss_softc *));
     55  1.3.2.2  thorpej };
     56  1.3.2.2  thorpej 
     57  1.3.2.2  thorpej /*
     58  1.3.2.2  thorpej  * ss_softc has to be declared here, because the device dependant
     59  1.3.2.2  thorpej  * modules include it
     60  1.3.2.2  thorpej  */
     61  1.3.2.2  thorpej struct ss_softc {
     62  1.3.2.2  thorpej 	struct device sc_dev;
     63  1.3.2.2  thorpej 
     64  1.3.2.2  thorpej 	int flags;
     65  1.3.2.2  thorpej #define SSF_TRIGGERED	0x01	/* read operation has been primed */
     66  1.3.2.2  thorpej #define	SSF_LOADED	0x02	/* parameters loaded */
     67  1.3.2.2  thorpej 	struct scsipi_link *sc_link;	/* contains our targ, lun, etc. */
     68  1.3.2.2  thorpej 	struct scan_io sio;
     69  1.3.2.2  thorpej 	struct buf buf_queue;		/* the queue of pending IO operations */
     70  1.3.2.2  thorpej 	u_int quirks;			/* scanner is only mildly twisted */
     71  1.3.2.2  thorpej #define SS_Q_GET_BUFFER_SIZE	0x0001	/* poll for available data in ssread() */
     72  1.3.2.2  thorpej /* truncate to byte boundry is assumed by default unless one of these is set */
     73  1.3.2.2  thorpej #define SS_Q_PAD_TO_BYTE	0x0002	/* pad monochrome data to byte boundary */
     74  1.3.2.2  thorpej #define SS_Q_PAD_TO_WORD	0x0004	/* pad monochrome data to word boundary */
     75  1.3.2.2  thorpej #define SS_Q_THRESHOLD_FOLLOWS_BRIGHTNESS 0x0008
     76  1.3.2.2  thorpej 	struct ss_special *special;	/* special handlers for spec. devices */
     77  1.3.2.2  thorpej };
     78  1.3.2.2  thorpej 
     79  1.3.2.2  thorpej /*
     80  1.3.2.2  thorpej  * define the special attach routines if configured
     81  1.3.2.2  thorpej  */
     82  1.3.2.2  thorpej void mustek_attach __P((struct ss_softc *, struct scsipibus_attach_args *));
     83  1.3.2.2  thorpej void scanjet_attach __P((struct ss_softc *, struct scsipibus_attach_args *));
     84