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_GL847_REGISTERS_H 22 #define BACKEND_GENESYS_GL847_REGISTERS_H 23 24 #include <cstdint> 25 26 namespace genesys { 27 namespace gl847 { 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_AFEMOD = 0x30; 64 static constexpr RegMask REG_0x04_FILTER = 0x0c; 65 static constexpr RegMask REG_0x04_FESET = 0x03; 66 static constexpr RegShift REG_0x04S_AFEMOD = 4; 67 68 static constexpr RegAddr REG_0x05 = 0x05; 69 static constexpr RegMask REG_0x05_DPIHW = 0xc0; 70 static constexpr RegMask REG_0x05_DPIHW_600 = 0x00; 71 static constexpr RegMask REG_0x05_DPIHW_1200 = 0x40; 72 static constexpr RegMask REG_0x05_DPIHW_2400 = 0x80; 73 static constexpr RegMask REG_0x05_DPIHW_4800 = 0xc0; 74 static constexpr RegMask REG_0x05_MTLLAMP = 0x30; 75 static constexpr RegMask REG_0x05_GMMENB = 0x08; 76 static constexpr RegMask REG_0x05_MTLBASE = 0x03; 77 78 static constexpr RegAddr REG_0x06 = 0x06; 79 static constexpr RegMask REG_0x06_SCANMOD = 0xe0; 80 static constexpr RegMask REG_0x06S_SCANMOD = 5; 81 static constexpr RegMask REG_0x06_PWRBIT = 0x10; 82 static constexpr RegMask REG_0x06_GAIN4 = 0x08; 83 static constexpr RegMask REG_0x06_OPTEST = 0x07; 84 85 static constexpr RegMask REG_0x07_LAMPSIM = 0x80; 86 87 static constexpr RegMask REG_0x08_DRAM2X = 0x80; 88 static constexpr RegMask REG_0x08_MPENB = 0x20; 89 static constexpr RegMask REG_0x08_CIS_LINE = 0x10; 90 static constexpr RegMask REG_0x08_IR1ENB = 0x08; 91 static constexpr RegMask REG_0x08_IR2ENB = 0x04; 92 static constexpr RegMask REG_0x08_ENB24M = 0x01; 93 94 static constexpr RegMask REG_0x09_MCNTSET = 0xc0; 95 static constexpr RegMask REG_0x09_EVEN1ST = 0x20; 96 static constexpr RegMask REG_0x09_BLINE1ST = 0x10; 97 static constexpr RegMask REG_0x09_BACKSCAN = 0x08; 98 static constexpr RegMask REG_0x09_ENHANCE = 0x04; 99 static constexpr RegMask REG_0x09_SHORTTG = 0x02; 100 static constexpr RegMask REG_0x09_NWAIT = 0x01; 101 102 static constexpr RegShift REG_0x09S_MCNTSET = 6; 103 static constexpr RegShift REG_0x09S_CLKSET = 4; 104 105 static constexpr RegMask REG_0x0A_LPWMEN = 0x10; 106 107 static constexpr RegAddr REG_0x0B = 0x0b; 108 static constexpr RegMask REG_0x0B_DRAMSEL = 0x07; 109 static constexpr RegMask REG_0x0B_ENBDRAM = 0x08; 110 static constexpr RegMask REG_0x0B_RFHDIS = 0x10; 111 static constexpr RegMask REG_0x0B_CLKSET = 0xe0; 112 static constexpr RegMask REG_0x0B_24MHZ = 0x00; 113 static constexpr RegMask REG_0x0B_30MHZ = 0x20; 114 static constexpr RegMask REG_0x0B_40MHZ = 0x40; 115 static constexpr RegMask REG_0x0B_48MHZ = 0x60; 116 static constexpr RegMask REG_0x0B_60MHZ = 0x80; 117 118 static constexpr RegAddr REG_0x0C = 0x0c; 119 static constexpr RegMask REG_0x0C_CCDLMT = 0x0f; 120 121 static constexpr RegAddr REG_0x0D = 0x0d; 122 static constexpr RegMask REG_0x0D_FULLSTP = 0x10; 123 static constexpr RegMask REG_0x0D_SEND = 0x80; 124 static constexpr RegMask REG_0x0D_CLRMCNT = 0x04; 125 static constexpr RegMask REG_0x0D_CLRDOCJM = 0x02; 126 static constexpr RegMask REG_0x0D_CLRLNCNT = 0x01; 127 128 static constexpr RegAddr REG_0x0F = 0x0f; 129 130 static constexpr RegMask REG_0x16_CTRLHI = 0x80; 131 static constexpr RegMask REG_0x16_TOSHIBA = 0x40; 132 static constexpr RegMask REG_0x16_TGINV = 0x20; 133 static constexpr RegMask REG_0x16_CK1INV = 0x10; 134 static constexpr RegMask REG_0x16_CK2INV = 0x08; 135 static constexpr RegMask REG_0x16_CTRLINV = 0x04; 136 static constexpr RegMask REG_0x16_CKDIS = 0x02; 137 static constexpr RegMask REG_0x16_CTRLDIS = 0x01; 138 139 static constexpr RegMask REG_0x17_TGMODE = 0xc0; 140 static constexpr RegMask REG_0x17_TGMODE_NO_DUMMY = 0x00; 141 static constexpr RegMask REG_0x17_TGMODE_REF = 0x40; 142 static constexpr RegMask REG_0x17_TGMODE_XPA = 0x80; 143 static constexpr RegMask REG_0x17_TGW = 0x3f; 144 static constexpr RegMask REG_0x17S_TGW = 0; 145 146 static constexpr RegAddr REG_0x18 = 0x18; 147 static constexpr RegMask REG_0x18_CNSET = 0x80; 148 static constexpr RegMask REG_0x18_DCKSEL = 0x60; 149 static constexpr RegMask REG_0x18_CKTOGGLE = 0x10; 150 static constexpr RegMask REG_0x18_CKDELAY = 0x0c; 151 static constexpr RegMask REG_0x18_CKSEL = 0x03; 152 153 static constexpr RegMask REG_0x1A_SW2SET = 0x80; 154 static constexpr RegMask REG_0x1A_SW1SET = 0x40; 155 static constexpr RegMask REG_0x1A_MANUAL3 = 0x02; 156 static constexpr RegMask REG_0x1A_MANUAL1 = 0x01; 157 static constexpr RegMask REG_0x1A_CK4INV = 0x08; 158 static constexpr RegMask REG_0x1A_CK3INV = 0x04; 159 static constexpr RegMask REG_0x1A_LINECLP = 0x02; 160 161 static constexpr RegAddr REG_0x1C = 0x1c; 162 static constexpr RegMask REG_0x1C_TGTIME = 0x07; 163 164 static constexpr RegMask REG_0x1D_CK4LOW = 0x80; 165 static constexpr RegMask REG_0x1D_CK3LOW = 0x40; 166 static constexpr RegMask REG_0x1D_CK1LOW = 0x20; 167 static constexpr RegMask REG_0x1D_TGSHLD = 0x1f; 168 static constexpr RegMask REG_0x1DS_TGSHLD = 0; 169 170 static constexpr RegAddr REG_0x1E = 0x1e; 171 static constexpr RegMask REG_0x1E_WDTIME = 0xf0; 172 static constexpr RegMask REG_0x1ES_WDTIME = 4; 173 static constexpr RegMask REG_0x1E_LINESEL = 0x0f; 174 static constexpr RegMask REG_0x1ES_LINESEL = 0; 175 176 static constexpr RegAddr REG_FEDCNT = 0x1f; 177 178 static constexpr RegAddr REG_0x24 = 0x1c; 179 static constexpr RegAddr REG_0x40 = 0x40; 180 static constexpr RegMask REG_0x40_CHKVER = 0x10; 181 static constexpr RegMask REG_0x40_HISPDFLG = 0x04; 182 static constexpr RegMask REG_0x40_MOTMFLG = 0x02; 183 static constexpr RegMask REG_0x40_DATAENB = 0x01; 184 185 static constexpr RegMask REG_0x41_PWRBIT = 0x80; 186 static constexpr RegMask REG_0x41_BUFEMPTY = 0x40; 187 static constexpr RegMask REG_0x41_FEEDFSH = 0x20; 188 static constexpr RegMask REG_0x41_SCANFSH = 0x10; 189 static constexpr RegMask REG_0x41_HOMESNR = 0x08; 190 static constexpr RegMask REG_0x41_LAMPSTS = 0x04; 191 static constexpr RegMask REG_0x41_FEBUSY = 0x02; 192 static constexpr RegMask REG_0x41_MOTORENB = 0x01; 193 194 static constexpr RegMask REG_0x58_VSMP = 0xf8; 195 static constexpr RegShift REG_0x58S_VSMP = 3; 196 static constexpr RegMask REG_0x58_VSMPW = 0x07; 197 static constexpr RegShift REG_0x58S_VSMPW = 0; 198 199 static constexpr RegMask REG_0x59_BSMP = 0xf8; 200 static constexpr RegShift REG_0x59S_BSMP = 3; 201 static constexpr RegMask REG_0x59_BSMPW = 0x07; 202 static constexpr RegShift REG_0x59S_BSMPW = 0; 203 204 static constexpr RegMask REG_0x5A_ADCLKINV = 0x80; 205 static constexpr RegMask REG_0x5A_RLCSEL = 0x40; 206 static constexpr RegMask REG_0x5A_CDSREF = 0x30; 207 static constexpr RegShift REG_0x5AS_CDSREF = 4; 208 static constexpr RegMask REG_0x5A_RLC = 0x0f; 209 static constexpr RegShift REG_0x5AS_RLC = 0; 210 211 static constexpr RegMask REG_0x5E_DECSEL = 0xe0; 212 static constexpr RegShift REG_0x5ES_DECSEL = 5; 213 static constexpr RegMask REG_0x5E_STOPTIM = 0x1f; 214 static constexpr RegShift REG_0x5ES_STOPTIM = 0; 215 216 static constexpr RegAddr REG_0x60 = 0x60; 217 static constexpr RegMask REG_0x60_Z1MOD = 0x1f; 218 static constexpr RegAddr REG_0x61 = 0x61; 219 static constexpr RegMask REG_0x61_Z1MOD = 0xff; 220 static constexpr RegAddr REG_0x62 = 0x62; 221 static constexpr RegMask REG_0x62_Z1MOD = 0xff; 222 223 static constexpr RegAddr REG_0x63 = 0x63; 224 static constexpr RegMask REG_0x63_Z2MOD = 0x1f; 225 static constexpr RegAddr REG_0x64 = 0x64; 226 static constexpr RegMask REG_0x64_Z2MOD = 0xff; 227 static constexpr RegAddr REG_0x65 = 0x65; 228 static constexpr RegMask REG_0x65_Z2MOD = 0xff; 229 230 static constexpr RegShift REG_0x60S_STEPSEL = 5; 231 static constexpr RegMask REG_0x60_STEPSEL = 0xe0; 232 static constexpr RegMask REG_0x60_FULLSTEP = 0x00; 233 static constexpr RegMask REG_0x60_HALFSTEP = 0x20; 234 static constexpr RegMask REG_0x60_EIGHTHSTEP = 0x60; 235 static constexpr RegMask REG_0x60_16THSTEP = 0x80; 236 237 static constexpr RegShift REG_0x63S_FSTPSEL = 5; 238 static constexpr RegMask REG_0x63_FSTPSEL = 0xe0; 239 static constexpr RegMask REG_0x63_FULLSTEP = 0x00; 240 static constexpr RegMask REG_0x63_HALFSTEP = 0x20; 241 static constexpr RegMask REG_0x63_EIGHTHSTEP = 0x60; 242 static constexpr RegMask REG_0x63_16THSTEP = 0x80; 243 244 static constexpr RegAddr REG_0x67 = 0x67; 245 static constexpr RegMask REG_0x67_MTRPWM = 0x80; 246 247 static constexpr RegAddr REG_0x68 = 0x68; 248 static constexpr RegMask REG_0x68_FASTPWM = 0x80; 249 250 static constexpr RegAddr REG_0x6B = 0x6b; 251 static constexpr RegMask REG_0x6B_MULTFILM = 0x80; 252 static constexpr RegMask REG_0x6B_GPOM13 = 0x40; 253 static constexpr RegMask REG_0x6B_GPOM12 = 0x20; 254 static constexpr RegMask REG_0x6B_GPOM11 = 0x10; 255 static constexpr RegMask REG_0x6B_GPO18 = 0x02; 256 static constexpr RegMask REG_0x6B_GPO17 = 0x01; 257 258 static constexpr RegShift REG_0x6C = 0x6c; 259 static constexpr RegMask REG_0x6C_GPIO16 = 0x80; 260 static constexpr RegMask REG_0x6C_GPIO15 = 0x40; 261 static constexpr RegMask REG_0x6C_GPIO14 = 0x20; 262 static constexpr RegMask REG_0x6C_GPIO13 = 0x10; 263 static constexpr RegMask REG_0x6C_GPIO12 = 0x08; 264 static constexpr RegMask REG_0x6C_GPIO11 = 0x04; 265 static constexpr RegMask REG_0x6C_GPIO10 = 0x02; 266 static constexpr RegMask REG_0x6C_GPIO9 = 0x01; 267 static constexpr RegMask REG_0x6C_GPIOH = 0xff; 268 static constexpr RegMask REG_0x6C_GPIOL = 0xff; 269 270 static constexpr RegAddr REG_0x6D = 0x6d; 271 static constexpr RegAddr REG_0x6E = 0x6e; 272 static constexpr RegAddr REG_0x6F = 0x6f; 273 static constexpr RegAddr REG_0x7E = 0x7e; 274 275 static constexpr RegMask REG_0x87_LEDADD = 0x04; 276 277 static constexpr RegAddr REG_0x9E = 0x9e; 278 static constexpr RegAddr REG_0x9F = 0x9f; 279 280 static constexpr RegAddr REG_0xA6 = 0xa6; 281 static constexpr RegAddr REG_0xA7 = 0xa7; 282 static constexpr RegAddr REG_0xA8 = 0xa8; 283 static constexpr RegAddr REG_0xA9 = 0xa9; 284 static constexpr RegAddr REG_0xAB = 0xab; 285 286 static constexpr RegAddr REG_EXPR = 0x10; 287 static constexpr RegAddr REG_EXPG = 0x12; 288 static constexpr RegAddr REG_EXPB = 0x14; 289 static constexpr RegAddr REG_EXPDMY = 0x19; 290 static constexpr RegAddr REG_STEPNO = 0x21; 291 static constexpr RegAddr REG_FWDSTEP = 0x22; 292 static constexpr RegAddr REG_BWDSTEP = 0x23; 293 static constexpr RegAddr REG_FASTNO = 0x24; 294 static constexpr RegAddr REG_DPISET = 0x2c; 295 static constexpr RegAddr REG_STRPIXEL = 0x30; 296 static constexpr RegAddr REG_ENDPIXEL = 0x32; 297 static constexpr RegAddr REG_LINCNT = 0x25; 298 static constexpr RegAddr REG_MAXWD = 0x35; 299 static constexpr RegAddr REG_LPERIOD = 0x38; 300 static constexpr RegAddr REG_FEEDL = 0x3d; 301 static constexpr RegAddr REG_FMOVDEC = 0x5f; 302 static constexpr RegAddr REG_FSHDEC = 0x69; 303 static constexpr RegAddr REG_FMOVNO = 0x6a; 304 static constexpr RegAddr REG_CK1MAP = 0x74; 305 static constexpr RegAddr REG_CK3MAP = 0x77; 306 static constexpr RegAddr REG_CK4MAP = 0x7a; 307 308 } // namespace gl847 309 } // namespace genesys 310 311 #endif // BACKEND_GENESYS_GL847_REGISTERS_H 312