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#define DEBUG_DECLARE_ONLY
22
23#include "low.h"
24
25namespace genesys {
26
27StaticInit<std::vector<Genesys_Gpo>> s_gpo;
28
29void genesys_init_gpo_tables()
30{
31    s_gpo.init();
32
33    Genesys_Gpo gpo;
34    gpo.id = GpioId::UMAX;
35    gpo.regs = {
36        { 0x66, 0x11 },
37        { 0x67, 0x00 },
38        { 0x68, 0x51 },
39        { 0x69, 0x20 },
40    };
41    s_gpo->push_back(gpo);
42
43
44    gpo = Genesys_Gpo();
45    gpo.id = GpioId::ST12;
46    gpo.regs = {
47        { 0x66, 0x11 },
48        { 0x67, 0x00 },
49        { 0x68, 0x51 },
50        { 0x69, 0x20 },
51    };
52    s_gpo->push_back(gpo);
53
54
55    gpo = Genesys_Gpo();
56    gpo.id = GpioId::ST24;
57    gpo.regs = {
58        { 0x66, 0x00 },
59        { 0x67, 0x00 },
60        { 0x68, 0x51 },
61        { 0x69, 0x20 },
62    };
63    s_gpo->push_back(gpo);
64
65
66    gpo = Genesys_Gpo();
67    gpo.id = GpioId::MD_5345; // bits 11-12 are for bipolar V-ref input voltage
68    gpo.regs = {
69        { 0x66, 0x30 },
70        { 0x67, 0x18 },
71        { 0x68, 0xa0 },
72        { 0x69, 0x18 },
73    };
74    s_gpo->push_back(gpo);
75
76
77    gpo = Genesys_Gpo();
78    gpo.id = GpioId::HP2400;
79    gpo.regs = {
80        { 0x66, 0x30 },
81        { 0x67, 0x00 },
82        { 0x68, 0x31 },
83        { 0x69, 0x00 },
84    };
85    s_gpo->push_back(gpo);
86
87
88    gpo = Genesys_Gpo();
89    gpo.id = GpioId::HP2300;
90    gpo.regs = {
91        { 0x66, 0x00 },
92        { 0x67, 0x00 },
93        { 0x68, 0x00 },
94        { 0x69, 0x00 },
95    };
96    s_gpo->push_back(gpo);
97
98
99    gpo = Genesys_Gpo();
100    gpo.id = GpioId::CANON_LIDE_35;
101    gpo.regs = {
102        { 0x6c, 0x02 },
103        { 0x6d, 0x80 },
104        { 0x6e, 0xef },
105        { 0x6f, 0x80 },
106    };
107    s_gpo->push_back(gpo);
108
109
110    gpo = Genesys_Gpo();
111    gpo.id = GpioId::CANON_LIDE_90;
112    gpo.regs = {
113        { 0x6b, 0x03 },
114        { 0x6c, 0x74 },
115        { 0x6d, 0x80 },
116        { 0x6e, 0x7f },
117        { 0x6f, 0xe0 },
118    };
119    s_gpo->push_back(gpo);
120
121
122    gpo = Genesys_Gpo();
123    gpo.id = GpioId::XP200;
124    gpo.regs = {
125        { 0x66, 0x30 },
126        { 0x67, 0x00 },
127        { 0x68, 0xb0 },
128        { 0x69, 0x00 },
129    };
130    s_gpo->push_back(gpo);
131
132
133    gpo = Genesys_Gpo();
134    gpo.id = GpioId::HP3670;
135    gpo.regs = {
136        { 0x66, 0x00 },
137        { 0x67, 0x00 },
138        { 0x68, 0x00 },
139        { 0x69, 0x00 },
140    };
141    s_gpo->push_back(gpo);
142
143
144    gpo = Genesys_Gpo();
145    gpo.id = GpioId::XP300;
146    gpo.regs = {
147        { 0x6c, 0x09 },
148        { 0x6d, 0xc6 },
149        { 0x6e, 0xbb },
150        { 0x6f, 0x00 },
151    };
152    s_gpo->push_back(gpo);
153
154
155    gpo = Genesys_Gpo();
156    gpo.id = GpioId::DP665;
157    gpo.regs = {
158        { 0x6c, 0x18 },
159        { 0x6d, 0x00 },
160        { 0x6e, 0xbb },
161        { 0x6f, 0x00 },
162    };
163    s_gpo->push_back(gpo);
164
165
166    gpo = Genesys_Gpo();
167    gpo.id = GpioId::DP685;
168    gpo.regs = {
169        { 0x6c, 0x3f },
170        { 0x6d, 0x46 },
171        { 0x6e, 0xfb },
172        { 0x6f, 0x00 },
173    };
174    s_gpo->push_back(gpo);
175
176
177    gpo = Genesys_Gpo();
178    gpo.id = GpioId::CANON_LIDE_200;
179    gpo.regs = {
180        { 0x6b, 0x02 },
181        { 0x6c, 0xf9 }, // 0xfb when idle , 0xf9/0xe9 (1200) when scanning
182        { 0x6d, 0x20 },
183        { 0x6e, 0xff },
184        { 0x6f, 0x00 },
185        { 0xa6, 0x04 },
186        { 0xa7, 0x04 },
187        { 0xa8, 0x00 },
188        { 0xa9, 0x00 },
189    };
190    s_gpo->push_back(gpo);
191
192
193    gpo = Genesys_Gpo();
194    gpo.id = GpioId::CANON_LIDE_700F;
195    gpo.regs = {
196        { 0x6b, 0x06 },
197        { 0x6c, 0xdb },
198        { 0x6d, 0xff },
199        { 0x6e, 0xff },
200        { 0x6f, 0x80 },
201        { 0xa6, 0x15 },
202        { 0xa7, 0x07 },
203        { 0xa8, 0x20 },
204        { 0xa9, 0x10 },
205    };
206    s_gpo->push_back(gpo);
207
208
209    gpo = Genesys_Gpo();
210    gpo.id = GpioId::KVSS080;
211    gpo.regs = {
212        { 0x6c, 0xf5 },
213        { 0x6d, 0x20 },
214        { 0x6e, 0x7e },
215        { 0x6f, 0xa1 },
216        { 0xa6, 0x06 },
217        { 0xa7, 0x0f },
218        { 0xa8, 0x00 },
219        { 0xa9, 0x08 },
220    };
221    s_gpo->push_back(gpo);
222
223
224    gpo = Genesys_Gpo();
225    gpo.id = GpioId::G4050;
226    gpo.regs = {
227        { 0x6c, 0x20 },
228        { 0x6d, 0x00 },
229        { 0x6e, 0xfc },
230        { 0x6f, 0x00 },
231        { 0xa6, 0x08 },
232        { 0xa7, 0x1e },
233        { 0xa8, 0x3e },
234        { 0xa9, 0x06 },
235    };
236    s_gpo->push_back(gpo);
237
238
239    gpo = Genesys_Gpo();
240    gpo.id = GpioId::G4010;
241    gpo.regs = {
242        { 0x6c, 0x20 },
243        { 0x6d, 0x00 },
244        { 0x6e, 0xfc },
245        { 0x6f, 0x00 },
246        { 0xa6, 0x08 },
247        { 0xa7, 0x1e },
248        { 0xa8, 0x3e },
249        { 0xa9, 0x06 },
250    };
251    s_gpo->push_back(gpo);
252
253
254    gpo = Genesys_Gpo();
255    gpo.id = GpioId::HP_N6310;
256    gpo.regs = {
257        { 0x6c, 0xa3 },
258        { 0x6d, 0x00 },
259        { 0x6e, 0x7f },
260        { 0x6f, 0x00 },
261    };
262    s_gpo->push_back(gpo);
263
264
265    gpo = Genesys_Gpo();
266    gpo.id = GpioId::CANON_LIDE_110;
267    gpo.regs = {
268        { 0x6c, 0xfb },
269        { 0x6d, 0x20 },
270        { 0x6e, 0xff },
271        { 0x6f, 0x00 },
272    };
273    s_gpo->push_back(gpo);
274
275
276    gpo = Genesys_Gpo();
277    gpo.id = GpioId::CANON_LIDE_120;
278    gpo.regs = {
279        { 0x6c, 0xfb },
280        { 0x6d, 0x20 },
281        { 0x6e, 0xff },
282        { 0x6f, 0x00 },
283    };
284    s_gpo->push_back(gpo);
285
286
287    gpo = Genesys_Gpo();
288    gpo.id = GpioId::CANON_LIDE_210;
289    gpo.regs = {
290        { 0x6c, 0xfb },
291        { 0x6d, 0x20 },
292        { 0x6e, 0xff },
293        { 0x6f, 0x00 },
294    };
295    s_gpo->push_back(gpo);
296
297
298    gpo = Genesys_Gpo();
299    gpo.id = GpioId::PLUSTEK_OPTICPRO_3600;
300    gpo.regs = {
301        { 0x6c, 0x02 },
302        { 0x6d, 0x00 },
303        { 0x6e, 0x1e },
304        { 0x6f, 0x80 },
305    };
306    s_gpo->push_back(gpo);
307
308
309    gpo = Genesys_Gpo();
310    gpo.id = GpioId::PLUSTEK_OPTICFILM_7200;
311    gpo.regs = {
312        { 0x6b, 0x33 },
313        { 0x6c, 0x00 },
314        { 0x6d, 0x80 },
315        { 0x6e, 0x0c },
316        { 0x6f, 0x80 },
317        { 0x7e, 0x00 }
318    };
319    s_gpo->push_back(gpo);
320
321
322    gpo = Genesys_Gpo();
323    gpo.id = GpioId::PLUSTEK_OPTICFILM_7200I;
324    gpo.regs = {
325        { 0x6c, 0x4c },
326        { 0x6d, 0x80 },
327        { 0x6e, 0x4c },
328        { 0x6f, 0x80 },
329        { 0xa6, 0x00 },
330        { 0xa7, 0x07 },
331        { 0xa8, 0x20 },
332        { 0xa9, 0x01 },
333    };
334    s_gpo->push_back(gpo);
335
336    gpo = Genesys_Gpo();
337    gpo.id = GpioId::PLUSTEK_OPTICFILM_7300;
338    gpo.regs = {
339        { 0x6c, 0x4c },
340        { 0x6d, 0x00 },
341        { 0x6e, 0x4c },
342        { 0x6f, 0x80 },
343        { 0xa6, 0x00 },
344        { 0xa7, 0x07 },
345        { 0xa8, 0x20 },
346        { 0xa9, 0x01 },
347    };
348    s_gpo->push_back(gpo);
349
350
351    gpo = Genesys_Gpo();
352    gpo.id = GpioId::PLUSTEK_OPTICFILM_7400;
353    gpo.regs = {
354        { 0x6b, 0x30 }, { 0x6c, 0x4c }, { 0x6d, 0x80 }, { 0x6e, 0x4c }, { 0x6f, 0x80 },
355        { 0xa6, 0x00 }, { 0xa7, 0x07 }, { 0xa8, 0x20 }, { 0xa9, 0x01 },
356    };
357    s_gpo->push_back(gpo);
358
359
360    gpo = Genesys_Gpo();
361    gpo.id = GpioId::PLUSTEK_OPTICFILM_7500I;
362    gpo.regs = {
363        { 0x6c, 0x4c },
364        { 0x6d, 0x00 },
365        { 0x6e, 0x4c },
366        { 0x6f, 0x80 },
367        { 0xa6, 0x00 },
368        { 0xa7, 0x07 },
369        { 0xa8, 0x20 },
370        { 0xa9, 0x01 },
371    };
372    s_gpo->push_back(gpo);
373
374
375    gpo = Genesys_Gpo();
376    gpo.id = GpioId::PLUSTEK_OPTICFILM_8200I;
377    gpo.regs = {
378        { 0x6b, 0x30 }, { 0x6c, 0x4c }, { 0x6d, 0x80 }, { 0x6e, 0x4c }, { 0x6f, 0x80 },
379        { 0xa6, 0x00 }, { 0xa7, 0x07 }, { 0xa8, 0x20 }, { 0xa9, 0x01 },
380    };
381    s_gpo->push_back(gpo);
382
383
384    gpo = Genesys_Gpo();
385    gpo.id = GpioId::CANON_4400F;
386    gpo.regs = {
387        { 0x6c, 0x01 },
388        { 0x6d, 0x7f },
389        { 0x6e, 0xff },
390        { 0x6f, 0x00 },
391        { 0xa6, 0x00 },
392        { 0xa7, 0xff },
393        { 0xa8, 0x07 },
394        { 0xa9, 0x00 },
395    };
396    s_gpo->push_back(gpo);
397
398
399    gpo = Genesys_Gpo();
400    gpo.id = GpioId::CANON_5600F;
401    gpo.regs = {
402        { 0x6b, 0x87 },
403        { 0x6c, 0xf0 },
404        { 0x6d, 0x5f },
405        { 0x6e, 0x7f },
406        { 0x6f, 0xa0 },
407        { 0xa6, 0x07 },
408        { 0xa7, 0x1c },
409        { 0xa8, 0x00 },
410        { 0xa9, 0x04 },
411    };
412    s_gpo->push_back(gpo);
413
414
415    gpo = Genesys_Gpo();
416    gpo.id = GpioId::CANON_8400F;
417    gpo.regs = {
418        { 0x6c, 0x9a },
419        { 0x6d, 0xdf },
420        { 0x6e, 0xfe },
421        { 0x6f, 0x60 },
422        { 0xa6, 0x00 },
423        { 0xa7, 0x03 },
424        { 0xa8, 0x00 },
425        { 0xa9, 0x02 },
426    };
427    s_gpo->push_back(gpo);
428
429
430    gpo = Genesys_Gpo();
431    gpo.id = GpioId::CANON_8600F;
432    gpo.regs = {
433        { 0x6c, 0x20 },
434        { 0x6d, 0x7c },
435        { 0x6e, 0xff },
436        { 0x6f, 0x00 },
437        { 0xa6, 0x00 },
438        { 0xa7, 0xff },
439        { 0xa8, 0x00 },
440        { 0xa9, 0x00 },
441    };
442    s_gpo->push_back(gpo);
443
444
445    gpo = Genesys_Gpo();
446    gpo.id = GpioId::IMG101;
447    gpo.regs = {
448        { 0x6b, 0x72 }, { 0x6c, 0x1f }, { 0x6d, 0xa4 }, { 0x6e, 0x13 }, { 0x6f, 0xa7 },
449        { 0xa6, 0x11 }, { 0xa7, 0xff }, { 0xa8, 0x19 }, { 0xa9, 0x05 },
450    };
451    s_gpo->push_back(gpo);
452
453
454    gpo = Genesys_Gpo();
455    gpo.id = GpioId::PLUSTEK_OPTICBOOK_3800;
456    gpo.regs = {
457        { 0x6b, 0x30 }, { 0x6c, 0x01 }, { 0x6d, 0x80 }, { 0x6e, 0x2d }, { 0x6f, 0x80 },
458        { 0xa6, 0x0c }, { 0xa7, 0x8f }, { 0xa8, 0x08 }, { 0xa9, 0x04 },
459    };
460    s_gpo->push_back(gpo);
461
462
463    gpo = Genesys_Gpo();
464    gpo.id = GpioId::CANON_LIDE_80;
465    gpo.regs = {
466        { 0x6c, 0x28 },
467        { 0x6d, 0x90 },
468        { 0x6e, 0x75 },
469        { 0x6f, 0x80 },
470    };
471    s_gpo->push_back(gpo);
472}
473
474} // namespace genesys
475