1/* sane - Scanner Access Now Easy. 2 3 Copyright (C) 2020 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<MemoryLayout>> s_memory_layout; 28 29void genesys_init_memory_layout_tables() 30{ 31 s_memory_layout.init(); 32 33 MemoryLayout ml; 34 ml.models = { ModelId::CANON_IMAGE_FORMULA_101 }; 35 // FIXME: this scanner does not set all required registers 36 ml.regs = { 37 { 0xe0, 0x00 }, { 0xe1, 0xb0 }, { 0xe2, 0x05 }, { 0xe3, 0xe7 }, 38 { 0xe4, 0x05 }, { 0xe5, 0xe8 }, { 0xe6, 0x0b }, { 0xe7, 0x1f }, 39 { 0xe8, 0x0b }, { 0xe9, 0x20 }, 40 }; 41 s_memory_layout->push_back(ml); 42 43 44 ml = MemoryLayout(); 45 ml.models = { ModelId::PLUSTEK_OPTICBOOK_3800 }; 46 // FIXME: this scanner does not set all required registers 47 ml.regs = { 48 { 0xe0, 0x00 }, { 0xe1, 0x68 }, { 0xe2, 0x03 }, { 0xe3, 0x00 }, 49 { 0xe4, 0x03 }, { 0xe5, 0x01 }, { 0xe6, 0x05 }, { 0xe7, 0x99 }, 50 { 0xe8, 0x05 }, { 0xe9, 0x9a }, 51 }; 52 s_memory_layout->push_back(ml); 53 54 ml = MemoryLayout(); 55 ml.models = { ModelId::PLUSTEK_OPTICFILM_7400, ModelId::PLUSTEK_OPTICFILM_8200I }; 56 ml.regs = { 57 { 0x81, 0x6d }, { 0x82, 0x00 }, { 0x83, 0x00 }, { 0x84, 0x00 }, 58 { 0x85, 0x00 }, { 0x86, 0x00 }, 59 { 0xd0, 0x0a }, { 0xd1, 0x0a }, { 0xd2, 0x0a }, 60 { 0xe0, 0x00 }, { 0xe1, 0x68 }, { 0xe2, 0x03 }, { 0xe3, 0x00 }, 61 { 0xe4, 0x03 }, { 0xe5, 0x01 }, { 0xe6, 0x05 }, { 0xe7, 0x99 }, 62 { 0xe8, 0x05 }, { 0xe9, 0x9a }, { 0xea, 0x08 }, { 0xeb, 0x32 }, 63 { 0xec, 0x08 }, { 0xed, 0x33 }, { 0xee, 0x0a }, { 0xef, 0xcb }, 64 { 0xf0, 0x0a }, { 0xf1, 0xcc }, { 0xf2, 0x0d }, { 0xf3, 0x64 }, 65 { 0xf4, 0x0d }, { 0xf5, 0x65 }, { 0xf6, 0x0f }, { 0xf7, 0xfd }, 66 }; 67 s_memory_layout->push_back(ml); 68 69 70 /* On GL847 and GL124, the values of the base address for shading data must be multiplied by 71 8192=0x4000 to give address on AHB 72 73 On GL847 and GL124, the values of the base address for scanned data must be multiplied by 74 1024*2=0x0800 to give address on AHB 75 */ 76 ml = MemoryLayout(); 77 ml.models = { ModelId::CANON_5600F }; 78 ml.regs = { 79 { 0xd0, 0x0a }, 80 { 0xe0, 0x01 }, { 0xe1, 0x2c }, { 0xe2, 0x06 }, { 0xe3, 0x4e }, 81 { 0xe4, 0x06 }, { 0xe5, 0x4f }, { 0xe6, 0x0b }, { 0xe7, 0x71 }, 82 { 0xe8, 0x0b }, { 0xe9, 0x72 }, { 0xea, 0x10 }, { 0xeb, 0x94 }, 83 { 0xec, 0x10 }, { 0xed, 0x95 }, { 0xee, 0x15 }, { 0xef, 0xb7 }, 84 { 0xf0, 0x15 }, { 0xf1, 0xb8 }, { 0xf2, 0x1a }, { 0xf3, 0xda }, 85 { 0xf4, 0x1a }, { 0xf5, 0xdb }, { 0xf6, 0x1f }, { 0xf7, 0xfd }, 86 { 0xf8, 0x05 } 87 }; 88 s_memory_layout->push_back(ml); 89 90 91 ml = MemoryLayout(); 92 ml.models = { ModelId::CANON_LIDE_100 }; 93 ml.regs = { 94 { 0xd0, 0x0a }, { 0xd1, 0x15 }, { 0xd2, 0x20 }, 95 { 0xe0, 0x00 }, { 0xe1, 0xac }, { 0xe2, 0x02 }, { 0xe3, 0x55 }, 96 { 0xe4, 0x02 }, { 0xe5, 0x56 }, { 0xe6, 0x03 }, { 0xe7, 0xff }, 97 { 0xe8, 0x00 }, { 0xe9, 0xac }, { 0xea, 0x02 }, { 0xeb, 0x55 }, 98 { 0xec, 0x02 }, { 0xed, 0x56 }, { 0xee, 0x03 }, { 0xef, 0xff }, 99 { 0xf0, 0x00 }, { 0xf1, 0xac }, { 0xf2, 0x02 }, { 0xf3, 0x55 }, 100 { 0xf4, 0x02 }, { 0xf5, 0x56 }, { 0xf6, 0x03 }, { 0xf7, 0xff }, 101 }; 102 s_memory_layout->push_back(ml); 103 104 105 ml = MemoryLayout(); 106 ml.models = { ModelId::CANON_LIDE_200 }; 107 ml.regs = { 108 { 0xd0, 0x0a }, { 0xd1, 0x1f }, { 0xd2, 0x34 }, 109 { 0xe0, 0x01 }, { 0xe1, 0x24 }, { 0xe2, 0x02 }, { 0xe3, 0x91 }, 110 { 0xe4, 0x02 }, { 0xe5, 0x92 }, { 0xe6, 0x03 }, { 0xe7, 0xff }, 111 { 0xe8, 0x01 }, { 0xe9, 0x24 }, { 0xea, 0x02 }, { 0xeb, 0x91 }, 112 { 0xec, 0x02 }, { 0xed, 0x92 }, { 0xee, 0x03 }, { 0xef, 0xff }, 113 { 0xf0, 0x01 }, { 0xf1, 0x24 }, { 0xf2, 0x02 }, { 0xf3, 0x91 }, 114 { 0xf4, 0x02 }, { 0xf5, 0x92 }, { 0xf6, 0x03 }, { 0xf7, 0xff }, 115 }; 116 s_memory_layout->push_back(ml); 117 118 119 ml = MemoryLayout(); 120 ml.models = { ModelId::CANON_LIDE_700F }; 121 ml.regs = { 122 { 0xd0, 0x0a }, { 0xd1, 0x33 }, { 0xd2, 0x5c }, 123 { 0xe0, 0x02 }, { 0xe1, 0x14 }, { 0xe2, 0x09 }, { 0xe3, 0x09 }, 124 { 0xe4, 0x09 }, { 0xe5, 0x0a }, { 0xe6, 0x0f }, { 0xe7, 0xff }, 125 { 0xe8, 0x02 }, { 0xe9, 0x14 }, { 0xea, 0x09 }, { 0xeb, 0x09 }, 126 { 0xec, 0x09 }, { 0xed, 0x0a }, { 0xee, 0x0f }, { 0xef, 0xff }, 127 { 0xf0, 0x02 }, { 0xf1, 0x14 }, { 0xf2, 0x09 }, { 0xf3, 0x09 }, 128 { 0xf4, 0x09 }, { 0xf5, 0x0a }, { 0xf6, 0x0f }, { 0xf7, 0xff }, 129 }; 130 s_memory_layout->push_back(ml); 131 132 133 ml = MemoryLayout(); 134 ml.models = { ModelId::CANON_LIDE_110, ModelId::CANON_LIDE_120 }; 135 ml.regs = { 136 { 0xd0, 0x0a }, { 0xd1, 0x15 }, { 0xd2, 0x20 }, 137 { 0xe0, 0x00 }, { 0xe1, 0xac }, { 0xe2, 0x08 }, { 0xe3, 0x55 }, 138 { 0xe4, 0x08 }, { 0xe5, 0x56 }, { 0xe6, 0x0f }, { 0xe7, 0xff }, 139 { 0xe8, 0x00 }, { 0xe9, 0xac }, { 0xea, 0x08 }, { 0xeb, 0x55 }, 140 { 0xec, 0x08 }, { 0xed, 0x56 }, { 0xee, 0x0f }, { 0xef, 0xff }, 141 { 0xf0, 0x00 }, { 0xf1, 0xac }, { 0xf2, 0x08 }, { 0xf3, 0x55 }, 142 { 0xf4, 0x08 }, { 0xf5, 0x56 }, { 0xf6, 0x0f }, { 0xf7, 0xff }, 143 144 }; 145 s_memory_layout->push_back(ml); 146 147 148 ml = MemoryLayout(); 149 ml.models = { ModelId::CANON_LIDE_210, ModelId::CANON_LIDE_220 }; 150 ml.regs = { 151 { 0xd0, 0x0a }, { 0xd1, 0x1f }, { 0xd2, 0x34 }, 152 { 0xe0, 0x01 }, { 0xe1, 0x24 }, { 0xe2, 0x08 }, { 0xe3, 0x91 }, 153 { 0xe4, 0x08 }, { 0xe5, 0x92 }, { 0xe6, 0x0f }, { 0xe7, 0xff }, 154 { 0xe8, 0x01 }, { 0xe9, 0x24 }, { 0xea, 0x08 }, { 0xeb, 0x91 }, 155 { 0xec, 0x08 }, { 0xed, 0x92 }, { 0xee, 0x0f }, { 0xef, 0xff }, 156 { 0xf0, 0x01 }, { 0xf1, 0x24 }, { 0xf2, 0x08 }, { 0xf3, 0x91 }, 157 { 0xf4, 0x08 }, { 0xf5, 0x92 }, { 0xf6, 0x0f }, { 0xf7, 0xff }, 158 }; 159 s_memory_layout->push_back(ml); 160} 161 162} // namespace genesys 163