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