1 /* sane - Scanner Access Now Easy.
2 
3    Copyright (C) 2019 Povilas Kanapickas <povilas@radix.lt>
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 
21 #ifndef BACKEND_GENESYS_GL124_REGISTERS_H
22 #define BACKEND_GENESYS_GL124_REGISTERS_H
23 
24 #include <cstdint>
25 
26 namespace genesys {
27 namespace gl124 {
28 
29 using RegAddr = std::uint16_t;
30 using RegMask = std::uint8_t;
31 using RegShift = unsigned;
32 
33 static constexpr RegAddr REG_0x01 = 0x01;
34 static constexpr RegMask REG_0x01_CISSET = 0x80;
35 static constexpr RegMask REG_0x01_DOGENB = 0x40;
36 static constexpr RegMask REG_0x01_DVDSET = 0x20;
37 static constexpr RegMask REG_0x01_STAGGER = 0x10;
38 static constexpr RegMask REG_0x01_COMPENB = 0x08;
39 static constexpr RegMask REG_0x01_TRUEGRAY = 0x04;
40 static constexpr RegMask REG_0x01_SHDAREA = 0x02;
41 static constexpr RegMask REG_0x01_SCAN = 0x01;
42 
43 static constexpr RegAddr REG_0x02 = 0x02;
44 static constexpr RegMask REG_0x02_NOTHOME = 0x80;
45 static constexpr RegMask REG_0x02_ACDCDIS = 0x40;
46 static constexpr RegMask REG_0x02_AGOHOME = 0x20;
47 static constexpr RegMask REG_0x02_MTRPWR = 0x10;
48 static constexpr RegMask REG_0x02_FASTFED = 0x08;
49 static constexpr RegMask REG_0x02_MTRREV = 0x04;
50 static constexpr RegMask REG_0x02_HOMENEG = 0x02;
51 static constexpr RegMask REG_0x02_LONGCURV = 0x01;
52 
53 static constexpr RegAddr REG_0x03 = 0x03;
54 static constexpr RegMask REG_0x03_LAMPDOG = 0x80;
55 static constexpr RegMask REG_0x03_AVEENB = 0x40;
56 static constexpr RegMask REG_0x03_XPASEL = 0x20;
57 static constexpr RegMask REG_0x03_LAMPPWR = 0x10;
58 static constexpr RegMask REG_0x03_LAMPTIM = 0x0f;
59 
60 static constexpr RegAddr REG_0x04 = 0x04;
61 static constexpr RegMask REG_0x04_LINEART = 0x80;
62 static constexpr RegMask REG_0x04_BITSET = 0x40;
63 static constexpr RegMask REG_0x04_FILTER = 0x30;
64 static constexpr RegMask REG_0x04_AFEMOD = 0x07;
65 
66 static constexpr RegAddr REG_0x05 = 0x05;
67 static constexpr RegMask REG_0x05_DPIHW = 0xc0;
68 static constexpr RegMask REG_0x05_DPIHW_600 = 0x00;
69 static constexpr RegMask REG_0x05_DPIHW_1200 = 0x40;
70 static constexpr RegMask REG_0x05_DPIHW_2400 = 0x80;
71 static constexpr RegMask REG_0x05_DPIHW_4800 = 0xc0;
72 static constexpr RegMask REG_0x05_MTLLAMP = 0x30;
73 static constexpr RegMask REG_0x05_GMMENB = 0x08;
74 static constexpr RegMask REG_0x05_ENB20M = 0x04;
75 static constexpr RegMask REG_0x05_MTLBASE = 0x03;
76 
77 static constexpr RegAddr REG_0x06 = 0x06;
78 static constexpr RegMask REG_0x06_SCANMOD = 0xe0;
79 static constexpr RegMask REG_0x06S_SCANMOD = 5;
80 static constexpr RegMask REG_0x06_PWRBIT = 0x10;
81 static constexpr RegMask REG_0x06_GAIN4 = 0x08;
82 static constexpr RegMask REG_0x06_OPTEST = 0x07;
83 
84 static constexpr RegMask REG_0x07_LAMPSIM = 0x80;
85 
86 static constexpr RegMask REG_0x08_DRAM2X = 0x80;
87 static constexpr RegMask REG_0x08_MPENB = 0x20;
88 static constexpr RegMask REG_0x08_CIS_LINE = 0x10;
89 static constexpr RegMask REG_0x08_IR2_ENB = 0x08;
90 static constexpr RegMask REG_0x08_IR1_ENB = 0x04;
91 static constexpr RegMask REG_0x08_ENB24M = 0x01;
92 
93 static constexpr RegMask REG_0x09_MCNTSET = 0xc0;
94 static constexpr RegMask REG_0x09_EVEN1ST = 0x20;
95 static constexpr RegMask REG_0x09_BLINE1ST = 0x10;
96 static constexpr RegMask REG_0x09_BACKSCAN = 0x08;
97 static constexpr RegMask REG_0x09_OUTINV = 0x04;
98 static constexpr RegMask REG_0x09_SHORTTG = 0x02;
99 
100 static constexpr RegShift REG_0x09S_MCNTSET = 6;
101 static constexpr RegShift REG_0x09S_CLKSET = 4;
102 
103 static constexpr RegAddr REG_0x0A = 0x0a;
104 static constexpr RegMask REG_0x0A_SIFSEL = 0xc0;
105 static constexpr RegShift REG_0x0AS_SIFSEL = 6;
106 static constexpr RegMask REG_0x0A_SHEETFED = 0x20;
107 static constexpr RegMask REG_0x0A_LPWMEN = 0x10;
108 
109 static constexpr RegAddr REG_0x0B = 0x0b;
110 static constexpr RegMask REG_0x0B_DRAMSEL = 0x07;
111 static constexpr RegMask REG_0x0B_16M = 0x01;
112 static constexpr RegMask REG_0x0B_64M = 0x02;
113 static constexpr RegMask REG_0x0B_128M = 0x03;
114 static constexpr RegMask REG_0x0B_256M = 0x04;
115 static constexpr RegMask REG_0x0B_512M = 0x05;
116 static constexpr RegMask REG_0x0B_1G = 0x06;
117 static constexpr RegMask REG_0x0B_ENBDRAM = 0x08;
118 static constexpr RegMask REG_0x0B_RFHDIS = 0x10;
119 static constexpr RegMask REG_0x0B_CLKSET = 0xe0;
120 static constexpr RegMask REG_0x0B_24MHZ = 0x00;
121 static constexpr RegMask REG_0x0B_30MHZ = 0x20;
122 static constexpr RegMask REG_0x0B_40MHZ = 0x40;
123 static constexpr RegMask REG_0x0B_48MHZ = 0x60;
124 static constexpr RegMask REG_0x0B_60MHZ = 0x80;
125 
126 static constexpr RegAddr REG_0x0D = 0x0d;
127 static constexpr RegMask REG_0x0D_MTRP_RDY = 0x80;
128 static constexpr RegMask REG_0x0D_FULLSTP = 0x10;
129 static constexpr RegMask REG_0x0D_CLRMCNT = 0x04;
130 static constexpr RegMask REG_0x0D_CLRDOCJM = 0x02;
131 static constexpr RegMask REG_0x0D_CLRLNCNT = 0x01;
132 
133 static constexpr RegAddr REG_0x0F = 0x0f;
134 
135 static constexpr RegMask REG_0x16_CTRLHI = 0x80;
136 static constexpr RegMask REG_0x16_TOSHIBA = 0x40;
137 static constexpr RegMask REG_0x16_TGINV = 0x20;
138 static constexpr RegMask REG_0x16_CK1INV = 0x10;
139 static constexpr RegMask REG_0x16_CK2INV = 0x08;
140 static constexpr RegMask REG_0x16_CTRLINV = 0x04;
141 static constexpr RegMask REG_0x16_CKDIS = 0x02;
142 static constexpr RegMask REG_0x16_CTRLDIS = 0x01;
143 
144 static constexpr RegMask REG_0x17_TGMODE = 0xc0;
145 static constexpr RegMask REG_0x17_SNRSYN = 0x0f;
146 
147 static constexpr RegAddr REG_0x18 = 0x18;
148 static constexpr RegMask REG_0x18_CNSET = 0x80;
149 static constexpr RegMask REG_0x18_DCKSEL = 0x60;
150 static constexpr RegMask REG_0x18_CKTOGGLE = 0x10;
151 static constexpr RegMask REG_0x18_CKDELAY = 0x0c;
152 static constexpr RegMask REG_0x18_CKSEL = 0x03;
153 
154 static constexpr RegMask REG_0x1A_SW2SET = 0x80;
155 static constexpr RegMask REG_0x1A_SW1SET = 0x40;
156 static constexpr RegMask REG_0x1A_MANUAL3 = 0x02;
157 static constexpr RegMask REG_0x1A_MANUAL1 = 0x01;
158 static constexpr RegMask REG_0x1A_CK4INV = 0x08;
159 static constexpr RegMask REG_0x1A_CK3INV = 0x04;
160 static constexpr RegMask REG_0x1A_LINECLP = 0x02;
161 
162 static constexpr RegMask REG_0x1C_TBTIME = 0x07;
163 
164 static constexpr RegAddr REG_0x1D = 0x1d;
165 static constexpr RegMask REG_0x1D_CK4LOW = 0x80;
166 static constexpr RegMask REG_0x1D_CK3LOW = 0x40;
167 static constexpr RegMask REG_0x1D_CK1LOW = 0x20;
168 static constexpr RegMask REG_0x1D_LINESEL = 0x1f;
169 static constexpr RegShift REG_0x1DS_LINESEL = 0;
170 
171 static constexpr RegAddr REG_0x1E = 0x1e;
172 static constexpr RegMask REG_0x1E_WDTIME = 0xf0;
173 static constexpr RegShift REG_0x1ES_WDTIME = 4;
174 
175 static constexpr RegAddr REG_0x30 = 0x30;
176 static constexpr RegAddr REG_0x31 = 0x31;
177 static constexpr RegAddr REG_0x32 = 0x32;
178 static constexpr RegMask REG_0x32_GPIO16 = 0x80;
179 static constexpr RegMask REG_0x32_GPIO15 = 0x40;
180 static constexpr RegMask REG_0x32_GPIO14 = 0x20;
181 static constexpr RegMask REG_0x32_GPIO13 = 0x10;
182 static constexpr RegMask REG_0x32_GPIO12 = 0x08;
183 static constexpr RegMask REG_0x32_GPIO11 = 0x04;
184 static constexpr RegMask REG_0x32_GPIO10 = 0x02;
185 static constexpr RegMask REG_0x32_GPIO9 = 0x01;
186 static constexpr RegAddr REG_0x33 = 0x33;
187 static constexpr RegAddr REG_0x34 = 0x34;
188 static constexpr RegAddr REG_0x35 = 0x35;
189 static constexpr RegAddr REG_0x36 = 0x36;
190 static constexpr RegAddr REG_0x37 = 0x37;
191 static constexpr RegAddr REG_0x38 = 0x38;
192 static constexpr RegAddr REG_0x39 = 0x39;
193 
194 static constexpr RegAddr REG_0x60 = 0x60;
195 static constexpr RegMask REG_0x60_LED4TG = 0x80;
196 static constexpr RegMask REG_0x60_YENB = 0x40;
197 static constexpr RegMask REG_0x60_YBIT = 0x20;
198 static constexpr RegMask REG_0x60_ACYNCNRLC = 0x10;
199 static constexpr RegMask REG_0x60_ENOFFSET = 0x08;
200 static constexpr RegMask REG_0x60_LEDADD = 0x04;
201 static constexpr RegMask REG_0x60_CK4ADC = 0x02;
202 static constexpr RegMask REG_0x60_AUTOCONF = 0x01;
203 
204 static constexpr RegAddr REG_0x80 = 0x80;
205 static constexpr RegAddr REG_0x81 = 0x81;
206 
207 static constexpr RegAddr REG_0xA0 = 0xa0;
208 static constexpr RegMask REG_0xA0_FSTPSEL = 0x38;
209 static constexpr RegShift REG_0xA0S_FSTPSEL = 3;
210 static constexpr RegMask REG_0xA0_STEPSEL = 0x07;
211 static constexpr RegShift REG_0xA0S_STEPSEL = 0;
212 
213 static constexpr RegAddr REG_0xA1 = 0xa1;
214 static constexpr RegAddr REG_0xA2 = 0xa2;
215 static constexpr RegAddr REG_0xA3 = 0xa3;
216 static constexpr RegAddr REG_0xA4 = 0xa4;
217 static constexpr RegAddr REG_0xA5 = 0xa5;
218 static constexpr RegAddr REG_0xA6 = 0xa6;
219 static constexpr RegAddr REG_0xA7 = 0xa7;
220 static constexpr RegAddr REG_0xA8 = 0xa8;
221 static constexpr RegAddr REG_0xA9 = 0xa9;
222 static constexpr RegAddr REG_0xAA = 0xaa;
223 static constexpr RegAddr REG_0xAB = 0xab;
224 static constexpr RegAddr REG_0xAC = 0xac;
225 static constexpr RegAddr REG_0xAD = 0xad;
226 static constexpr RegAddr REG_0xAE = 0xae;
227 static constexpr RegAddr REG_0xAF = 0xaf;
228 static constexpr RegAddr REG_0xB0 = 0xb0;
229 static constexpr RegAddr REG_0xB1 = 0xb1;
230 
231 static constexpr RegAddr REG_0xB2 = 0xb2;
232 static constexpr RegMask REG_0xB2_Z1MOD = 0x1f;
233 static constexpr RegAddr REG_0xB3 = 0xb3;
234 static constexpr RegMask REG_0xB3_Z1MOD = 0xff;
235 static constexpr RegAddr REG_0xB4 = 0xb4;
236 static constexpr RegMask REG_0xB4_Z1MOD = 0xff;
237 
238 static constexpr RegAddr REG_0xB5 = 0xb5;
239 static constexpr RegMask REG_0xB5_Z2MOD = 0x1f;
240 static constexpr RegAddr REG_0xB6 = 0xb6;
241 static constexpr RegMask REG_0xB6_Z2MOD = 0xff;
242 static constexpr RegAddr REG_0xB7 = 0xb7;
243 static constexpr RegMask REG_0xB7_Z2MOD = 0xff;
244 
245 static constexpr RegAddr REG_0x100 = 0x100;
246 static constexpr RegMask REG_0x100_DOCSNR = 0x80;
247 static constexpr RegMask REG_0x100_ADFSNR = 0x40;
248 static constexpr RegMask REG_0x100_COVERSNR = 0x20;
249 static constexpr RegMask REG_0x100_CHKVER = 0x10;
250 static constexpr RegMask REG_0x100_DOCJAM = 0x08;
251 static constexpr RegMask REG_0x100_HISPDFLG = 0x04;
252 static constexpr RegMask REG_0x100_MOTMFLG = 0x02;
253 static constexpr RegMask REG_0x100_DATAENB = 0x01;
254 
255 static constexpr RegAddr REG_0x114 = 0x114;
256 static constexpr RegAddr REG_0x115 = 0x115;
257 
258 static constexpr RegAddr REG_LINCNT = 0x25;
259 static constexpr RegAddr REG_MAXWD = 0x28;
260 static constexpr RegAddr REG_DPISET = 0x2c;
261 static constexpr RegAddr REG_FEEDL = 0x3d;
262 static constexpr RegAddr REG_CK1MAP = 0x74;
263 static constexpr RegAddr REG_CK3MAP = 0x77;
264 static constexpr RegAddr REG_CK4MAP = 0x7a;
265 static constexpr RegAddr REG_LPERIOD = 0x7d;
266 static constexpr RegAddr REG_DUMMY = 0x80;
267 static constexpr RegAddr REG_STRPIXEL = 0x82;
268 static constexpr RegAddr REG_ENDPIXEL = 0x85;
269 static constexpr RegAddr REG_EXPDMY = 0x88;
270 static constexpr RegAddr REG_EXPR = 0x8a;
271 static constexpr RegAddr REG_EXPG = 0x8d;
272 static constexpr RegAddr REG_EXPB = 0x90;
273 static constexpr RegAddr REG_SEGCNT = 0x93;
274 static constexpr RegAddr REG_TG0CNT = 0x96;
275 static constexpr RegAddr REG_SCANFED = 0xa2;
276 static constexpr RegAddr REG_STEPNO = 0xa4;
277 static constexpr RegAddr REG_FWDSTEP = 0xa6;
278 static constexpr RegAddr REG_BWDSTEP = 0xa8;
279 static constexpr RegAddr REG_FASTNO = 0xaa;
280 static constexpr RegAddr REG_FSHDEC = 0xac;
281 static constexpr RegAddr REG_FMOVNO = 0xae;
282 static constexpr RegAddr REG_FMOVDEC = 0xb0;
283 static constexpr RegAddr REG_Z1MOD = 0xb2;
284 static constexpr RegAddr REG_Z2MOD = 0xb5;
285 
286 static constexpr RegAddr REG_TRUER = 0x110;
287 static constexpr RegAddr REG_TRUEG = 0x111;
288 static constexpr RegAddr REG_TRUEB = 0x112;
289 
290 } // namespace gl124
291 } // namespace genesys
292 
293 #endif // BACKEND_GENESYS_GL843_REGISTERS_H
294