1 /* sane - Scanner Access Now Easy.
2    Copyright (C) 2007 Ilia Sotnikov <hostcc@gmail.com>
3    This file is part of the SANE package.
4 
5    This program is free software; you can redistribute it and/or
6    modify it under the terms of the GNU General Public License as
7    published by the Free Software Foundation; either version 2 of the
8    License, or (at your option) any later version.
9 
10    This program is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 
18    As a special exception, the authors of SANE give permission for
19    additional uses of the libraries contained in this release of SANE.
20 
21    The exception is that, if you link a SANE library with other files
22    to produce an executable, this does not by itself cause the
23    resulting executable to be covered by the GNU General Public
24    License.  Your use of that executable is in no way restricted on
25    account of linking the SANE library code into it.
26 
27    This exception does not, however, invalidate any other reasons why
28    the executable file might be covered by the GNU General Public
29    License.
30 
31    If you submit changes to SANE to the maintainers to be included in
32    a subsequent release, you agree by submitting the changes that
33    those changes may be distributed with this exception intact.
34 
35    If you write modifications of your own for SANE, it is your choice
36    whether to permit this exception to apply to your modifications.
37    If you do not wish that, delete this exception notice.
38 
39    This file is part of a SANE backend for
40    HP ScanJet 4500C/4570C/5500C/5550C/5590/7650 Scanners
41 */
42 
43 #ifndef HP5590_LOW_H
44 #define HP5590_LOW_H
45 
46 #include "../include/sane/sane.h"
47 
48 enum proto_flags {
49   PF_NONE               = 0,
50   PF_NO_USB_IN_USB_ACK  = 1 << 0        /* Getting acknowledge after USB-in-USB command
51                                          * will be skipped */
52 };
53 
54 /* Flags for hp5590_cmd() */
55 #define CMD_IN                  1 << 0  /* Indicates IN direction, otherwise - OUT */
56 #define CMD_VERIFY              1 << 1  /* Requests last command verification */
57 
58 /* Core flags for hp5590_cmd() - they indicate so called CORE commands */
59 #define CORE_NONE                    0  /* No CORE operation */
60 #define CORE_DATA               1 << 0  /* Operate on CORE data */
61 #define CORE_BULK_IN            1 << 1  /* CORE bulk operation - prepare for bulk IN
62                                          * transfer (not used yet)
63                                          */
64 #define CORE_BULK_OUT           1 << 2  /* CORE bulk operation - prepare for bulk OUT
65                                          * transfer
66                                          */
67 static SANE_Status hp5590_cmd (SANE_Int dn,
68                         enum proto_flags proto_flags,
69                         unsigned int flags,
70                         unsigned int cmd, unsigned char *data,
71                         unsigned int size, unsigned int core_flags);
72 static SANE_Status hp5590_bulk_read (SANE_Int dn,
73                               enum proto_flags proto_flags,
74                               unsigned char *bytes,
75                               unsigned int size, void *state);
76 static SANE_Status hp5590_bulk_write (SANE_Int dn,
77                                enum proto_flags proto_flags,
78                                int cmd,
79                                unsigned char *bytes,
80                                unsigned int size);
81 static SANE_Status hp5590_get_status (SANE_Int dn,
82                                       enum proto_flags proto_flags);
83 static SANE_Status hp5590_low_init_bulk_read_state (void **state);
84 static SANE_Status hp5590_low_free_bulk_read_state (void **state);
85 #endif /* HP5590_LOW_H */
86 /* vim: sw=2 ts=8
87  */
88