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