1 /* sane - Scanner Access Now Easy.
2 
3    Copyright (C) 2000 Adrian Perez Jorge
4 
5    This file is part of the SANE package.
6 
7    This program is free software; you can redistribute it and/or
8    modify it under the terms of the GNU General Public License as
9    published by the Free Software Foundation; either version 2 of the
10    License, or (at your option) any later version.
11 
12    This program is distributed in the hope that it will be useful, but
13    WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    General Public License for more details.
16 
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <https://www.gnu.org/licenses/>.
19 
20    As a special exception, the authors of SANE give permission for
21    additional uses of the libraries contained in this release of SANE.
22 
23    The exception is that, if you link a SANE library with other files
24    to produce an executable, this does not by itself cause the
25    resulting executable to be covered by the GNU General Public
26    License.  Your use of that executable is in no way restricted on
27    account of linking the SANE library code into it.
28 
29    This exception does not, however, invalidate any other reasons why
30    the executable file might be covered by the GNU General Public
31    License.
32 
33    If you submit changes to SANE to the maintainers to be included in
34    a subsequent release, you agree by submitting the changes that
35    those changes may be distributed with this exception intact.
36 
37    If you write modifications of your own for SANE, it is your choice
38    whether to permit this exception to apply to your modifications.
39    If you do not wish that, delete this exception notice.
40 
41    This file implements a backend for the HP4200C flatbed scanner
42 */
43 
44 
45 #define INPUT_SIGNAL_POLARITY_NEGATIVE 0
46 #define INPUT_SIGNAL_POLARITY_POSITIVE 1
47 #define CDS_OFF 0
48 #define CDS_ON (1 << 1)
49 #define SENSOR_EVENODD (1 << 2)
50 #define SENSOR_STANDARD 0
51 #define SENSOR_RESOLUTION_300 0
52 #define SENSOR_RESOLUTION_600 (1 << 3)
53 #define LINE_SKIPPING_COLOR_PHASE_DELAY(n) (((n) & 0x0f) << 4)
54 
55 #define PHI1_POLARITY_POSITIVE 0
56 #define PHI1_POLARITY_NEGATIVE 1
57 #define PHI2_POLARITY_POSITIVE 0
58 #define PHI2_POLARITY_NEGATIVE (1 << 1)
59 #define RS_POLARITY_POSITIVE 0
60 #define RS_POLARITY_NEGATIVE (1 << 2)
61 #define CP1_POLARITY_POSITIVE 0
62 #define CP1_POLARITY_NEGATIVE (1 << 3)
63 #define CP2_POLARITY_POSITIVE 0
64 #define CP2_POLARITY_NEGATIVE (1 << 4)
65 #define TR1_POLARITY_POSITIVE 0
66 #define TR1_POLARITY_NEGATIVE (1 << 5)
67 #define TR2_POLARITY_POSITIVE 0
68 #define TR2_POLARITY_NEGATIVE (1 << 6)
69 
70 #define PHI1_OFF 0
71 #define PHI1_ACTIVE 1
72 #define PHI2_OFF 0
73 #define PHI2_ACTIVE (1 << 1)
74 #define RS_OFF 0
75 #define RS_ACTIVE (1 << 2)
76 #define CP1_OFF 0
77 #define CP1_ACTIVE (1 << 3)
78 #define CP2_OFF 0
79 #define CP2_ACTIVE (1 << 4)
80 #define TR1_OFF 0
81 #define TR1_ACTIVE (1 << 5)
82 #define TR2_OFF 0
83 #define TR2_ACTIVE (1 << 6)
84 #define NUMBER_OF_TR_PULSES(n) (((n) - 1) << 7)
85 
86 #define TR_PULSE_DURATION(n) ((n) & 0x0f)
87 #define TR_PHI1_GUARDBAND_DURATION(n) (((n) & 0x0f) << 4)
88 
89 #define CIS_TR1_TIMING_OFF 0
90 #define CIS_TR1_TIMING_MODE1 1
91 #define CIS_TR1_TIMING_MODE2 2
92 #define FAKE_OPTICAL_BLACK_PIXELS_OFF 0
93 #define FAKE_OPTICAL_BLACK_PIXELS_ON (1 << 2)
94 
95 #define PIXEL_RATE_3_CHANNELS 0
96 #define LINE_RATE_3_CHANNELS 1
97 #define MODEA_1_CHANNEL 4
98 #define MODEB_1_CHANNEL 5
99 #define GRAY_CHANNEL_RED 0
100 #define GRAY_CHANNEL_GREEN (1 << 3)
101 #define GRAY_CHANNEL_BLU (2 << 3)
102 
103 #define TR_RED(n) ((n) << 5)
104 #define TR_GREEN(n) ((n) << 6)
105 #define TR_BLUE(n) ((n) << 7)
106 
107 #define TR_RED_DROP(n) (n)
108 #define TR_GREEN_DROP(n) ((n) << 2)
109 #define TR_BLUE_DROP(n) ((n) << 4)
110 
111 #define ILLUMINATION_MODE(n) (n)
112 
113 #define HIBYTE(w) ((SANE_Byte)(((w) >> 8) & 0xff))
114 #define LOBYTE(w) ((SANE_Byte)((w) & 0xff))
115 
116 #define EPP_MODE 0
117 #define NIBBLE_MODE 1
118 
119 #define PPORT_DRIVE_CURRENT(n) ((n) << 1)
120 
121 #define RAM_SIZE_64 0
122 #define RAM_SIZE_128 1
123 #define RAM_SIZE_256 2
124 
125 #define SRAM_DRIVER_CURRENT(n) ((n) << 2)
126 #define SRAM_BANDWIDTH_4 0
127 #define SRAM_BANDWIDTH_8 (1 << 4)
128 #define SCANNING_FULL_DUPLEX 0
129 #define SCANNING_HALF_DUPLEX (1 << 5)
130 
131 #define FULL_STEPPING 0
132 #define MICRO_STEPPING 1
133 #define CURRENT_SENSING_PHASES(n) (((n) - 1) << 1)
134 #define PHASE_A_POLARITY_POSITIVE 0
135 #define PHASE_A_POLARITY_NEGATIVE (1 << 2)
136 #define PHASE_B_POLARITY_POSITIVE 0
137 #define PHASE_B_POLARITY_NEGATIVE (1 << 3)
138 #define STEPPER_MOTOR_TRISTATE 0
139 #define STEPPER_MOTOR_OUTPUT (1 << 4)
140 
141 #define ACCELERATION_PROFILE_STOPPED(n) (n)
142 #define ACCELERATION_PROFILE_25P(n) ((n) << 2)
143 #define ACCELERATION_PROFILE_50P(n) ((n) << 4)
144 
145 #define NON_REVERSING_EXTRA_LINES(n) (n)
146 #define FIRST_LINE_TO_PROCESS(n) ((n) << 3)
147 
148 #define KICKSTART_STEPS(n) (n)
149 #define HOLD_CURRENT_TIMEOUT(n) ((n) << 3)
150 
151 #define PAPER_SENSOR_1_POLARITY_LOW  0
152 #define PAPER_SENSOR_1_POLARITY_HIGH 1
153 #define PAPER_SENSOR_1_TRIGGER_LEVEL 0
154 #define PAPER_SENSOR_1_TRIGGER_EDGE  (1 << 1)
155 #define PAPER_SENSOR_1_NO_STOP_SCAN  0
156 #define PAPER_SENSOR_1_STOP_SCAN     (1 << 2)
157 #define PAPER_SENSOR_2_POLARITY_LOW  0
158 #define PAPER_SENSOR_2_POLARITY_HIGH (1 << 3)
159 #define PAPER_SENSOR_2_TRIGGER_LEVEL 0
160 #define PAPER_SENSOR_2_TRIGGER_EDGE  (1 << 4)
161 #define PAPER_SENSOR_2_NO_STOP_SCAN  0
162 #define PAPER_SENSOR_2_STOP_SCAN     (1 << 5)
163 
164 #define	MISCIO_1_TYPE_INPUT          0
165 #define	MISCIO_1_TYPE_OUTPUT         1
166 #define	MISCIO_1_POLARITY_LOW        0
167 #define	MISCIO_1_POLARITY_HIGH       (1 << 1)
168 #define	MISCIO_1_TRIGGER_LEVEL       0
169 #define	MISCIO_1_TRIGGER_EDGE        (1 << 2)
170 #define	MISCIO_1_OUTPUT_STATE_LOW    0
171 #define	MISCIO_1_OUTPUT_STATE_HIGH   (1 << 3)
172 #define	MISCIO_2_TYPE_INPUT          0
173 #define	MISCIO_2_TYPE_OUTPUT         (1 << 4)
174 #define	MISCIO_2_POLARITY_LOW        0
175 #define	MISCIO_2_POLARITY_HIGH       (1 << 5)
176 #define	MISCIO_2_TRIGGER_LEVEL       0
177 #define	MISCIO_2_TRIGGER_EDGE        (1 << 6)
178 #define	MISCIO_2_OUTPUT_STATE_LOW    0
179 #define	MISCIO_2_OUTPUT_STATE_HIGH   (1 << 7)
180 
181 #define PIXEL_PACKING(n) ((n) << 3)
182 #define DATAMODE(n) ((n) << 5)
183