1141cc406Sopenharmony_ci/*  sane - Scanner Access Now Easy.
2141cc406Sopenharmony_ci
3141cc406Sopenharmony_ci    Copyright (C) 2020 Povilas Kanapickas <povilas@radix.lt>
4141cc406Sopenharmony_ci
5141cc406Sopenharmony_ci    This file is part of the SANE package.
6141cc406Sopenharmony_ci
7141cc406Sopenharmony_ci    This program is free software; you can redistribute it and/or
8141cc406Sopenharmony_ci    modify it under the terms of the GNU General Public License as
9141cc406Sopenharmony_ci    published by the Free Software Foundation; either version 2 of the
10141cc406Sopenharmony_ci    License, or (at your option) any later version.
11141cc406Sopenharmony_ci
12141cc406Sopenharmony_ci    This program is distributed in the hope that it will be useful, but
13141cc406Sopenharmony_ci    WITHOUT ANY WARRANTY; without even the implied warranty of
14141cc406Sopenharmony_ci    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15141cc406Sopenharmony_ci    General Public License for more details.
16141cc406Sopenharmony_ci
17141cc406Sopenharmony_ci    You should have received a copy of the GNU General Public License
18141cc406Sopenharmony_ci    along with this program.  If not, see <https://www.gnu.org/licenses/>.
19141cc406Sopenharmony_ci*/
20141cc406Sopenharmony_ci
21141cc406Sopenharmony_ci#define DEBUG_DECLARE_ONLY
22141cc406Sopenharmony_ci
23141cc406Sopenharmony_ci#include "low.h"
24141cc406Sopenharmony_ci
25141cc406Sopenharmony_cinamespace genesys {
26141cc406Sopenharmony_ci
27141cc406Sopenharmony_ciStaticInit<std::vector<MemoryLayout>> s_memory_layout;
28141cc406Sopenharmony_ci
29141cc406Sopenharmony_civoid genesys_init_memory_layout_tables()
30141cc406Sopenharmony_ci{
31141cc406Sopenharmony_ci    s_memory_layout.init();
32141cc406Sopenharmony_ci
33141cc406Sopenharmony_ci    MemoryLayout ml;
34141cc406Sopenharmony_ci    ml.models = { ModelId::CANON_IMAGE_FORMULA_101 };
35141cc406Sopenharmony_ci    // FIXME: this scanner does not set all required registers
36141cc406Sopenharmony_ci    ml.regs = {
37141cc406Sopenharmony_ci        { 0xe0, 0x00 }, { 0xe1, 0xb0 }, { 0xe2, 0x05 }, { 0xe3, 0xe7 },
38141cc406Sopenharmony_ci        { 0xe4, 0x05 }, { 0xe5, 0xe8 }, { 0xe6, 0x0b }, { 0xe7, 0x1f },
39141cc406Sopenharmony_ci        { 0xe8, 0x0b }, { 0xe9, 0x20 },
40141cc406Sopenharmony_ci    };
41141cc406Sopenharmony_ci    s_memory_layout->push_back(ml);
42141cc406Sopenharmony_ci
43141cc406Sopenharmony_ci
44141cc406Sopenharmony_ci    ml = MemoryLayout();
45141cc406Sopenharmony_ci    ml.models = { ModelId::PLUSTEK_OPTICBOOK_3800 };
46141cc406Sopenharmony_ci    // FIXME: this scanner does not set all required registers
47141cc406Sopenharmony_ci    ml.regs = {
48141cc406Sopenharmony_ci        { 0xe0, 0x00 }, { 0xe1, 0x68 }, { 0xe2, 0x03 }, { 0xe3, 0x00 },
49141cc406Sopenharmony_ci        { 0xe4, 0x03 }, { 0xe5, 0x01 }, { 0xe6, 0x05 }, { 0xe7, 0x99 },
50141cc406Sopenharmony_ci        { 0xe8, 0x05 }, { 0xe9, 0x9a },
51141cc406Sopenharmony_ci    };
52141cc406Sopenharmony_ci    s_memory_layout->push_back(ml);
53141cc406Sopenharmony_ci
54141cc406Sopenharmony_ci    ml = MemoryLayout();
55141cc406Sopenharmony_ci    ml.models = { ModelId::PLUSTEK_OPTICFILM_7400, ModelId::PLUSTEK_OPTICFILM_8200I };
56141cc406Sopenharmony_ci    ml.regs = {
57141cc406Sopenharmony_ci        { 0x81, 0x6d }, { 0x82, 0x00 }, { 0x83, 0x00 }, { 0x84, 0x00 },
58141cc406Sopenharmony_ci        { 0x85, 0x00 }, { 0x86, 0x00 },
59141cc406Sopenharmony_ci        { 0xd0, 0x0a }, { 0xd1, 0x0a }, { 0xd2, 0x0a },
60141cc406Sopenharmony_ci        { 0xe0, 0x00 }, { 0xe1, 0x68 }, { 0xe2, 0x03 }, { 0xe3, 0x00 },
61141cc406Sopenharmony_ci        { 0xe4, 0x03 }, { 0xe5, 0x01 }, { 0xe6, 0x05 }, { 0xe7, 0x99 },
62141cc406Sopenharmony_ci        { 0xe8, 0x05 }, { 0xe9, 0x9a }, { 0xea, 0x08 }, { 0xeb, 0x32 },
63141cc406Sopenharmony_ci        { 0xec, 0x08 }, { 0xed, 0x33 }, { 0xee, 0x0a }, { 0xef, 0xcb },
64141cc406Sopenharmony_ci        { 0xf0, 0x0a }, { 0xf1, 0xcc }, { 0xf2, 0x0d }, { 0xf3, 0x64 },
65141cc406Sopenharmony_ci        { 0xf4, 0x0d }, { 0xf5, 0x65 }, { 0xf6, 0x0f }, { 0xf7, 0xfd },
66141cc406Sopenharmony_ci    };
67141cc406Sopenharmony_ci    s_memory_layout->push_back(ml);
68141cc406Sopenharmony_ci
69141cc406Sopenharmony_ci
70141cc406Sopenharmony_ci    /*  On GL847 and GL124, the values of the base address for shading data must be multiplied by
71141cc406Sopenharmony_ci        8192=0x4000 to give address on AHB
72141cc406Sopenharmony_ci
73141cc406Sopenharmony_ci        On GL847 and GL124, the values of the base address for scanned data must be multiplied by
74141cc406Sopenharmony_ci        1024*2=0x0800 to give address on AHB
75141cc406Sopenharmony_ci    */
76141cc406Sopenharmony_ci    ml = MemoryLayout();
77141cc406Sopenharmony_ci    ml.models = { ModelId::CANON_5600F };
78141cc406Sopenharmony_ci    ml.regs = {
79141cc406Sopenharmony_ci        { 0xd0, 0x0a },
80141cc406Sopenharmony_ci        { 0xe0, 0x01 }, { 0xe1, 0x2c }, { 0xe2, 0x06 }, { 0xe3, 0x4e },
81141cc406Sopenharmony_ci        { 0xe4, 0x06 }, { 0xe5, 0x4f }, { 0xe6, 0x0b }, { 0xe7, 0x71 },
82141cc406Sopenharmony_ci        { 0xe8, 0x0b }, { 0xe9, 0x72 }, { 0xea, 0x10 }, { 0xeb, 0x94 },
83141cc406Sopenharmony_ci        { 0xec, 0x10 }, { 0xed, 0x95 }, { 0xee, 0x15 }, { 0xef, 0xb7 },
84141cc406Sopenharmony_ci        { 0xf0, 0x15 }, { 0xf1, 0xb8 }, { 0xf2, 0x1a }, { 0xf3, 0xda },
85141cc406Sopenharmony_ci        { 0xf4, 0x1a }, { 0xf5, 0xdb }, { 0xf6, 0x1f }, { 0xf7, 0xfd },
86141cc406Sopenharmony_ci        { 0xf8, 0x05 }
87141cc406Sopenharmony_ci    };
88141cc406Sopenharmony_ci    s_memory_layout->push_back(ml);
89141cc406Sopenharmony_ci
90141cc406Sopenharmony_ci
91141cc406Sopenharmony_ci    ml = MemoryLayout();
92141cc406Sopenharmony_ci    ml.models = { ModelId::CANON_LIDE_100 };
93141cc406Sopenharmony_ci    ml.regs = {
94141cc406Sopenharmony_ci        { 0xd0, 0x0a }, { 0xd1, 0x15 }, { 0xd2, 0x20 },
95141cc406Sopenharmony_ci        { 0xe0, 0x00 }, { 0xe1, 0xac }, { 0xe2, 0x02 }, { 0xe3, 0x55 },
96141cc406Sopenharmony_ci        { 0xe4, 0x02 }, { 0xe5, 0x56 }, { 0xe6, 0x03 }, { 0xe7, 0xff },
97141cc406Sopenharmony_ci        { 0xe8, 0x00 }, { 0xe9, 0xac }, { 0xea, 0x02 }, { 0xeb, 0x55 },
98141cc406Sopenharmony_ci        { 0xec, 0x02 }, { 0xed, 0x56 }, { 0xee, 0x03 }, { 0xef, 0xff },
99141cc406Sopenharmony_ci        { 0xf0, 0x00 }, { 0xf1, 0xac }, { 0xf2, 0x02 }, { 0xf3, 0x55 },
100141cc406Sopenharmony_ci        { 0xf4, 0x02 }, { 0xf5, 0x56 }, { 0xf6, 0x03 }, { 0xf7, 0xff },
101141cc406Sopenharmony_ci    };
102141cc406Sopenharmony_ci    s_memory_layout->push_back(ml);
103141cc406Sopenharmony_ci
104141cc406Sopenharmony_ci
105141cc406Sopenharmony_ci    ml = MemoryLayout();
106141cc406Sopenharmony_ci    ml.models = { ModelId::CANON_LIDE_200 };
107141cc406Sopenharmony_ci    ml.regs = {
108141cc406Sopenharmony_ci        { 0xd0, 0x0a }, { 0xd1, 0x1f }, { 0xd2, 0x34 },
109141cc406Sopenharmony_ci        { 0xe0, 0x01 }, { 0xe1, 0x24 }, { 0xe2, 0x02 }, { 0xe3, 0x91 },
110141cc406Sopenharmony_ci        { 0xe4, 0x02 }, { 0xe5, 0x92 }, { 0xe6, 0x03 }, { 0xe7, 0xff },
111141cc406Sopenharmony_ci        { 0xe8, 0x01 }, { 0xe9, 0x24 }, { 0xea, 0x02 }, { 0xeb, 0x91 },
112141cc406Sopenharmony_ci        { 0xec, 0x02 }, { 0xed, 0x92 }, { 0xee, 0x03 }, { 0xef, 0xff },
113141cc406Sopenharmony_ci        { 0xf0, 0x01 }, { 0xf1, 0x24 }, { 0xf2, 0x02 }, { 0xf3, 0x91 },
114141cc406Sopenharmony_ci        { 0xf4, 0x02 }, { 0xf5, 0x92 }, { 0xf6, 0x03 }, { 0xf7, 0xff },
115141cc406Sopenharmony_ci    };
116141cc406Sopenharmony_ci    s_memory_layout->push_back(ml);
117141cc406Sopenharmony_ci
118141cc406Sopenharmony_ci
119141cc406Sopenharmony_ci    ml = MemoryLayout();
120141cc406Sopenharmony_ci    ml.models = { ModelId::CANON_LIDE_700F };
121141cc406Sopenharmony_ci    ml.regs = {
122141cc406Sopenharmony_ci        { 0xd0, 0x0a }, { 0xd1, 0x33 }, { 0xd2, 0x5c },
123141cc406Sopenharmony_ci        { 0xe0, 0x02 }, { 0xe1, 0x14 }, { 0xe2, 0x09 }, { 0xe3, 0x09 },
124141cc406Sopenharmony_ci        { 0xe4, 0x09 }, { 0xe5, 0x0a }, { 0xe6, 0x0f }, { 0xe7, 0xff },
125141cc406Sopenharmony_ci        { 0xe8, 0x02 }, { 0xe9, 0x14 }, { 0xea, 0x09 }, { 0xeb, 0x09 },
126141cc406Sopenharmony_ci        { 0xec, 0x09 }, { 0xed, 0x0a }, { 0xee, 0x0f }, { 0xef, 0xff },
127141cc406Sopenharmony_ci        { 0xf0, 0x02 }, { 0xf1, 0x14 }, { 0xf2, 0x09 }, { 0xf3, 0x09 },
128141cc406Sopenharmony_ci        { 0xf4, 0x09 }, { 0xf5, 0x0a }, { 0xf6, 0x0f }, { 0xf7, 0xff },
129141cc406Sopenharmony_ci    };
130141cc406Sopenharmony_ci    s_memory_layout->push_back(ml);
131141cc406Sopenharmony_ci
132141cc406Sopenharmony_ci
133141cc406Sopenharmony_ci    ml = MemoryLayout();
134141cc406Sopenharmony_ci    ml.models = { ModelId::CANON_LIDE_110, ModelId::CANON_LIDE_120 };
135141cc406Sopenharmony_ci    ml.regs = {
136141cc406Sopenharmony_ci        { 0xd0, 0x0a }, { 0xd1, 0x15 }, { 0xd2, 0x20 },
137141cc406Sopenharmony_ci        { 0xe0, 0x00 }, { 0xe1, 0xac }, { 0xe2, 0x08 }, { 0xe3, 0x55 },
138141cc406Sopenharmony_ci        { 0xe4, 0x08 }, { 0xe5, 0x56 }, { 0xe6, 0x0f }, { 0xe7, 0xff },
139141cc406Sopenharmony_ci        { 0xe8, 0x00 }, { 0xe9, 0xac }, { 0xea, 0x08 }, { 0xeb, 0x55 },
140141cc406Sopenharmony_ci        { 0xec, 0x08 }, { 0xed, 0x56 }, { 0xee, 0x0f }, { 0xef, 0xff },
141141cc406Sopenharmony_ci        { 0xf0, 0x00 }, { 0xf1, 0xac }, { 0xf2, 0x08 }, { 0xf3, 0x55 },
142141cc406Sopenharmony_ci        { 0xf4, 0x08 }, { 0xf5, 0x56 }, { 0xf6, 0x0f }, { 0xf7, 0xff },
143141cc406Sopenharmony_ci
144141cc406Sopenharmony_ci    };
145141cc406Sopenharmony_ci    s_memory_layout->push_back(ml);
146141cc406Sopenharmony_ci
147141cc406Sopenharmony_ci
148141cc406Sopenharmony_ci    ml = MemoryLayout();
149141cc406Sopenharmony_ci    ml.models = { ModelId::CANON_LIDE_210, ModelId::CANON_LIDE_220 };
150141cc406Sopenharmony_ci    ml.regs = {
151141cc406Sopenharmony_ci        { 0xd0, 0x0a }, { 0xd1, 0x1f }, { 0xd2, 0x34 },
152141cc406Sopenharmony_ci        { 0xe0, 0x01 }, { 0xe1, 0x24 }, { 0xe2, 0x08 }, { 0xe3, 0x91 },
153141cc406Sopenharmony_ci        { 0xe4, 0x08 }, { 0xe5, 0x92 }, { 0xe6, 0x0f }, { 0xe7, 0xff },
154141cc406Sopenharmony_ci        { 0xe8, 0x01 }, { 0xe9, 0x24 }, { 0xea, 0x08 }, { 0xeb, 0x91 },
155141cc406Sopenharmony_ci        { 0xec, 0x08 }, { 0xed, 0x92 }, { 0xee, 0x0f }, { 0xef, 0xff },
156141cc406Sopenharmony_ci        { 0xf0, 0x01 }, { 0xf1, 0x24 }, { 0xf2, 0x08 }, { 0xf3, 0x91 },
157141cc406Sopenharmony_ci        { 0xf4, 0x08 }, { 0xf5, 0x92 }, { 0xf6, 0x0f }, { 0xf7, 0xff },
158141cc406Sopenharmony_ci    };
159141cc406Sopenharmony_ci    s_memory_layout->push_back(ml);
160141cc406Sopenharmony_ci}
161141cc406Sopenharmony_ci
162141cc406Sopenharmony_ci} // namespace genesys
163