^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Driver for Microtek Scanmaker X6 USB scanner and possibly others.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * (C) Copyright 2000 John Fremlin <vii@penguinpowered.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * (C) Copyright 2000 Oliver Neukum <Oliver.Neukum@lrz.uni-muenchen.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * See microtek.c for history
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) typedef void (*mts_scsi_cmnd_callback)(struct scsi_cmnd *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) struct mts_transfer_context
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) struct mts_desc *instance;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) mts_scsi_cmnd_callback final_callback;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) struct scsi_cmnd *srb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) void *data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) unsigned data_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) int data_pipe;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) struct scatterlist *curr_sg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) u8 *scsi_status; /* status returned from ep_response after command completion */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) struct mts_desc {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) struct mts_desc *next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct mts_desc *prev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) struct usb_device *usb_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) struct usb_interface *usb_intf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) /* Endpoint addresses */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) u8 ep_out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) u8 ep_response;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) u8 ep_image;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) struct Scsi_Host *host;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) struct urb *urb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) struct mts_transfer_context context;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #define MTS_EP_OUT 0x1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #define MTS_EP_RESPONSE 0x2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) #define MTS_EP_IMAGE 0x3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #define MTS_EP_TOTAL 0x3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #define MTS_SCSI_ERR_MASK ~0x3fu
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)