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 As a special exception, the authors of SANE give permission for 21 additional uses of the libraries contained in this release of SANE. 22 23 The exception is that, if you link a SANE library with other files 24 to produce an executable, this does not by itself cause the 25 resulting executable to be covered by the GNU General Public 26 License. Your use of that executable is in no way restricted on 27 account of linking the SANE library code into it. 28 29 This exception does not, however, invalidate any other reasons why 30 the executable file might be covered by the GNU General Public 31 License. 32 33 If you submit changes to SANE to the maintainers to be included in 34 a subsequent release, you agree by submitting the changes that 35 those changes may be distributed with this exception intact. 36 37 If you write modifications of your own for SANE, it is your choice 38 whether to permit this exception to apply to your modifications. 39 If you do not wish that, delete this exception notice. 40 */ 41 42 #ifndef BACKEND_GENESYS_GL843_REGISTERS_H 43 #define BACKEND_GENESYS_GL843_REGISTERS_H 44 45 #include <cstdint> 46 47 namespace genesys { 48 namespace gl843 { 49 50 using RegAddr = std::uint16_t; 51 using RegMask = std::uint8_t; 52 using RegShift = unsigned; 53 54 static constexpr RegAddr REG_0x01 = 0x01; 55 static constexpr RegMask REG_0x01_CISSET = 0x80; 56 static constexpr RegMask REG_0x01_DOGENB = 0x40; 57 static constexpr RegMask REG_0x01_DVDSET = 0x20; 58 static constexpr RegMask REG_0x01_STAGGER = 0x10; 59 static constexpr RegMask REG_0x01_COMPENB = 0x08; 60 static constexpr RegMask REG_0x01_TRUEGRAY = 0x04; 61 static constexpr RegMask REG_0x01_SHDAREA = 0x02; 62 static constexpr RegMask REG_0x01_SCAN = 0x01; 63 64 static constexpr RegAddr REG_0x02 = 0x02; 65 static constexpr RegMask REG_0x02_NOTHOME = 0x80; 66 static constexpr RegMask REG_0x02_ACDCDIS = 0x40; 67 static constexpr RegMask REG_0x02_AGOHOME = 0x20; 68 static constexpr RegMask REG_0x02_MTRPWR = 0x10; 69 static constexpr RegMask REG_0x02_FASTFED = 0x08; 70 static constexpr RegMask REG_0x02_MTRREV = 0x04; 71 static constexpr RegMask REG_0x02_HOMENEG = 0x02; 72 static constexpr RegMask REG_0x02_LONGCURV = 0x01; 73 74 static constexpr RegAddr REG_0x03 = 0x03; 75 static constexpr RegMask REG_0x03_LAMPDOG = 0x80; 76 static constexpr RegMask REG_0x03_AVEENB = 0x40; 77 static constexpr RegMask REG_0x03_XPASEL = 0x20; 78 static constexpr RegMask REG_0x03_LAMPPWR = 0x10; 79 static constexpr RegMask REG_0x03_LAMPTIM = 0x0f; 80 81 static constexpr RegAddr REG_0x04 = 0x04; 82 static constexpr RegMask REG_0x04_LINEART = 0x80; 83 static constexpr RegMask REG_0x04_BITSET = 0x40; 84 static constexpr RegMask REG_0x04_AFEMOD = 0x30; 85 static constexpr RegMask REG_0x04_FILTER = 0x0c; 86 static constexpr RegMask REG_0x04_FESET = 0x03; 87 88 static constexpr RegShift REG_0x04S_AFEMOD = 4; 89 90 static constexpr RegAddr REG_0x05 = 0x05; 91 static constexpr RegMask REG_0x05_DPIHW = 0xc0; 92 static constexpr RegMask REG_0x05_DPIHW_600 = 0x00; 93 static constexpr RegMask REG_0x05_DPIHW_1200 = 0x40; 94 static constexpr RegMask REG_0x05_DPIHW_2400 = 0x80; 95 static constexpr RegMask REG_0x05_DPIHW_4800 = 0xc0; 96 static constexpr RegMask REG_0x05_MTLLAMP = 0x30; 97 static constexpr RegMask REG_0x05_GMMENB = 0x08; 98 static constexpr RegMask REG_0x05_MTLBASE = 0x03; 99 100 static constexpr RegAddr REG_0x06 = 0x06; 101 static constexpr RegMask REG_0x06_SCANMOD = 0xe0; 102 static constexpr RegShift REG_0x06S_SCANMOD = 5; 103 static constexpr RegMask REG_0x06_PWRBIT = 0x10; 104 static constexpr RegMask REG_0x06_GAIN4 = 0x08; 105 static constexpr RegMask REG_0x06_OPTEST = 0x07; 106 107 static constexpr RegMask REG_0x07_LAMPSIM = 0x80; 108 109 static constexpr RegMask REG_0x08_DECFLAG = 0x40; 110 static constexpr RegMask REG_0x08_GMMFFR = 0x20; 111 static constexpr RegMask REG_0x08_GMMFFG = 0x10; 112 static constexpr RegMask REG_0x08_GMMFFB = 0x08; 113 static constexpr RegMask REG_0x08_GMMZR = 0x04; 114 static constexpr RegMask REG_0x08_GMMZG = 0x02; 115 static constexpr RegMask REG_0x08_GMMZB = 0x01; 116 117 static constexpr RegMask REG_0x09_MCNTSET = 0xc0; 118 static constexpr RegMask REG_0x09_EVEN1ST = 0x20; 119 static constexpr RegMask REG_0x09_BLINE1ST = 0x10; 120 static constexpr RegMask REG_0x09_BACKSCAN = 0x08; 121 static constexpr RegMask REG_0x09_ENHANCE = 0x04; 122 static constexpr RegMask REG_0x09_SHORTTG = 0x02; 123 static constexpr RegMask REG_0x09_NWAIT = 0x01; 124 125 static constexpr RegShift REG_0x09S_MCNTSET = 6; 126 static constexpr RegShift REG_0x09S_CLKSET = 4; 127 128 static constexpr RegAddr REG_0x0B = 0x0b; 129 static constexpr RegMask REG_0x0B_DRAMSEL = 0x07; 130 static constexpr RegMask REG_0x0B_ENBDRAM = 0x08; 131 static constexpr RegMask REG_0x0B_RFHDIS = 0x10; 132 static constexpr RegMask REG_0x0B_CLKSET = 0xe0; 133 static constexpr RegMask REG_0x0B_24MHZ = 0x00; 134 static constexpr RegMask REG_0x0B_30MHZ = 0x20; 135 static constexpr RegMask REG_0x0B_40MHZ = 0x40; 136 static constexpr RegMask REG_0x0B_48MHZ = 0x60; 137 static constexpr RegMask REG_0x0B_60MHZ = 0x80; 138 139 static constexpr RegAddr REG_0x0D = 0x0d; 140 static constexpr RegMask REG_0x0D_JAMPCMD = 0x80; 141 static constexpr RegMask REG_0x0D_DOCCMD = 0x40; 142 static constexpr RegMask REG_0x0D_CCDCMD = 0x20; 143 static constexpr RegMask REG_0x0D_FULLSTP = 0x10; 144 static constexpr RegMask REG_0x0D_SEND = 0x08; 145 static constexpr RegMask REG_0x0D_CLRMCNT = 0x04; 146 static constexpr RegMask REG_0x0D_CLRDOCJM = 0x02; 147 static constexpr RegMask REG_0x0D_CLRLNCNT = 0x01; 148 149 static constexpr RegAddr REG_0x0F = 0x0f; 150 151 static constexpr RegAddr REG_EXPR = 0x10; 152 static constexpr RegAddr REG_EXPG = 0x12; 153 static constexpr RegAddr REG_EXPB = 0x14; 154 155 static constexpr RegMask REG_0x16_CTRLHI = 0x80; 156 static constexpr RegMask REG_0x16_TOSHIBA = 0x40; 157 static constexpr RegMask REG_0x16_TGINV = 0x20; 158 static constexpr RegMask REG_0x16_CK1INV = 0x10; 159 static constexpr RegMask REG_0x16_CK2INV = 0x08; 160 static constexpr RegMask REG_0x16_CTRLINV = 0x04; 161 static constexpr RegMask REG_0x16_CKDIS = 0x02; 162 static constexpr RegMask REG_0x16_CTRLDIS = 0x01; 163 164 static constexpr RegMask REG_0x17_TGMODE = 0xc0; 165 static constexpr RegMask REG_0x17_TGMODE_NO_DUMMY = 0x00; 166 static constexpr RegMask REG_0x17_TGMODE_REF = 0x40; 167 static constexpr RegMask REG_0x17_TGMODE_XPA = 0x80; 168 static constexpr RegMask REG_0x17_TGW = 0x3f; 169 static constexpr RegShift REG_0x17S_TGW = 0; 170 171 static constexpr RegAddr REG_0x18 = 0x18; 172 static constexpr RegMask REG_0x18_CNSET = 0x80; 173 static constexpr RegMask REG_0x18_DCKSEL = 0x60; 174 static constexpr RegMask REG_0x18_CKTOGGLE = 0x10; 175 static constexpr RegMask REG_0x18_CKDELAY = 0x0c; 176 static constexpr RegMask REG_0x18_CKSEL = 0x03; 177 178 static constexpr RegAddr REG_EXPDMY = 0x19; 179 180 static constexpr RegMask REG_0x1A_TGLSW2 = 0x80; 181 static constexpr RegMask REG_0x1A_TGLSW1 = 0x40; 182 static constexpr RegMask REG_0x1A_MANUAL3 = 0x02; 183 static constexpr RegMask REG_0x1A_MANUAL1 = 0x01; 184 static constexpr RegMask REG_0x1A_CK4INV = 0x08; 185 static constexpr RegMask REG_0x1A_CK3INV = 0x04; 186 static constexpr RegMask REG_0x1A_LINECLP = 0x02; 187 188 static constexpr RegAddr REG_0x1C = 0x1c; 189 static constexpr RegMask REG_0x1C_TGTIME = 0x07; 190 191 static constexpr RegMask REG_0x1D_CK4LOW = 0x80; 192 static constexpr RegMask REG_0x1D_CK3LOW = 0x40; 193 static constexpr RegMask REG_0x1D_CK1LOW = 0x20; 194 static constexpr RegMask REG_0x1D_TGSHLD = 0x1f; 195 static constexpr RegShift REG_0x1DS_TGSHLD = 0; 196 197 198 static constexpr RegAddr REG_0x1E = 0x1e; 199 static constexpr RegMask REG_0x1E_WDTIME = 0xf0; 200 static constexpr RegShift REG_0x1ES_WDTIME = 4; 201 static constexpr RegMask REG_0x1E_LINESEL = 0x0f; 202 static constexpr RegShift REG_0x1ES_LINESEL = 0; 203 204 static constexpr RegAddr REG_0x21 = 0x21; 205 static constexpr RegAddr REG_STEPNO = 0x21; 206 static constexpr RegAddr REG_FWDSTEP = 0x22; 207 static constexpr RegAddr REG_BWDSTEP = 0x23; 208 static constexpr RegAddr REG_FASTNO = 0x24; 209 static constexpr RegAddr REG_LINCNT = 0x25; 210 211 static constexpr RegAddr REG_0x29 = 0x29; 212 static constexpr RegAddr REG_0x2A = 0x2a; 213 static constexpr RegAddr REG_0x2B = 0x2b; 214 static constexpr RegAddr REG_DPISET = 0x2c; 215 static constexpr RegAddr REG_0x2E = 0x2e; 216 static constexpr RegAddr REG_0x2F = 0x2f; 217 218 static constexpr RegAddr REG_STRPIXEL = 0x30; 219 static constexpr RegAddr REG_ENDPIXEL = 0x32; 220 static constexpr RegAddr REG_DUMMY = 0x34; 221 static constexpr RegAddr REG_MAXWD = 0x35; 222 static constexpr RegAddr REG_LPERIOD = 0x38; 223 static constexpr RegAddr REG_FEEDL = 0x3d; 224 225 static constexpr RegAddr REG_0x40 = 0x40; 226 static constexpr RegMask REG_0x40_DOCSNR = 0x80; 227 static constexpr RegMask REG_0x40_ADFSNR = 0x40; 228 static constexpr RegMask REG_0x40_COVERSNR = 0x20; 229 static constexpr RegMask REG_0x40_CHKVER = 0x10; 230 static constexpr RegMask REG_0x40_DOCJAM = 0x08; 231 static constexpr RegMask REG_0x40_HISPDFLG = 0x04; 232 static constexpr RegMask REG_0x40_MOTMFLG = 0x02; 233 static constexpr RegMask REG_0x40_DATAENB = 0x01; 234 235 static constexpr RegMask REG_0x41_PWRBIT = 0x80; 236 static constexpr RegMask REG_0x41_BUFEMPTY = 0x40; 237 static constexpr RegMask REG_0x41_FEEDFSH = 0x20; 238 static constexpr RegMask REG_0x41_SCANFSH = 0x10; 239 static constexpr RegMask REG_0x41_HOMESNR = 0x08; 240 static constexpr RegMask REG_0x41_LAMPSTS = 0x04; 241 static constexpr RegMask REG_0x41_FEBUSY = 0x02; 242 static constexpr RegMask REG_0x41_MOTORENB = 0x01; 243 244 static constexpr RegMask REG_0x58_VSMP = 0xf8; 245 static constexpr RegShift REG_0x58S_VSMP = 3; 246 static constexpr RegMask REG_0x58_VSMPW = 0x07; 247 static constexpr RegShift REG_0x58S_VSMPW = 0; 248 249 static constexpr RegMask REG_0x59_BSMP = 0xf8; 250 static constexpr RegShift REG_0x59S_BSMP = 3; 251 static constexpr RegMask REG_0x59_BSMPW = 0x07; 252 static constexpr RegShift REG_0x59S_BSMPW = 0; 253 254 static constexpr RegMask REG_0x5A_ADCLKINV = 0x80; 255 static constexpr RegMask REG_0x5A_RLCSEL = 0x40; 256 static constexpr RegMask REG_0x5A_CDSREF = 0x30; 257 static constexpr RegShift REG_0x5AS_CDSREF = 4; 258 static constexpr RegMask REG_0x5A_RLC = 0x0f; 259 static constexpr RegShift REG_0x5AS_RLC = 0; 260 261 static constexpr RegAddr REG_0x5E = 0x5e; 262 static constexpr RegMask REG_0x5E_DECSEL = 0xe0; 263 static constexpr RegShift REG_0x5ES_DECSEL = 5; 264 static constexpr RegMask REG_0x5E_STOPTIM = 0x1f; 265 static constexpr RegShift REG_0x5ES_STOPTIM = 0; 266 267 static constexpr RegAddr REG_FMOVDEC = 0x5f; 268 269 static constexpr RegAddr REG_0x60 = 0x60; 270 static constexpr RegMask REG_0x60_Z1MOD = 0x1f; 271 static constexpr RegAddr REG_0x61 = 0x61; 272 static constexpr RegMask REG_0x61_Z1MOD = 0xff; 273 static constexpr RegAddr REG_0x62 = 0x62; 274 static constexpr RegMask REG_0x62_Z1MOD = 0xff; 275 276 static constexpr RegAddr REG_0x63 = 0x63; 277 static constexpr RegMask REG_0x63_Z2MOD = 0x1f; 278 static constexpr RegAddr REG_0x64 = 0x64; 279 static constexpr RegMask REG_0x64_Z2MOD = 0xff; 280 static constexpr RegAddr REG_0x65 = 0x65; 281 static constexpr RegMask REG_0x65_Z2MOD = 0xff; 282 283 static constexpr RegAddr REG_0x67 = 0x67; 284 285 static constexpr RegAddr REG_0x68 = 0x68; 286 287 static constexpr RegShift REG_0x67S_STEPSEL = 6; 288 static constexpr RegMask REG_0x67_STEPSEL = 0xc0; 289 static constexpr RegMask REG_0x67_FULLSTEP = 0x00; 290 static constexpr RegMask REG_0x67_HALFSTEP = 0x20; 291 static constexpr RegMask REG_0x67_EIGHTHSTEP = 0x60; 292 static constexpr RegMask REG_0x67_16THSTEP = 0x80; 293 294 static constexpr RegShift REG_0x68S_FSTPSEL = 6; 295 static constexpr RegMask REG_0x68_FSTPSEL = 0xc0; 296 static constexpr RegMask REG_0x68_FULLSTEP = 0x00; 297 static constexpr RegMask REG_0x68_HALFSTEP = 0x20; 298 static constexpr RegMask REG_0x68_EIGHTHSTEP = 0x60; 299 static constexpr RegMask REG_0x68_16THSTEP = 0x80; 300 301 static constexpr RegAddr REG_FSHDEC = 0x69; 302 static constexpr RegAddr REG_FMOVNO = 0x6a; 303 304 static constexpr RegAddr REG_0x6B = 0x6b; 305 static constexpr RegMask REG_0x6B_MULTFILM = 0x80; 306 static constexpr RegMask REG_0x6B_GPOM13 = 0x40; 307 static constexpr RegMask REG_0x6B_GPOM12 = 0x20; 308 static constexpr RegMask REG_0x6B_GPOM11 = 0x10; 309 static constexpr RegMask REG_0x6B_GPOCK4 = 0x08; 310 static constexpr RegMask REG_0x6B_GPOCP = 0x04; 311 static constexpr RegMask REG_0x6B_GPOLEDB = 0x02; 312 static constexpr RegMask REG_0x6B_GPOADF = 0x01; 313 314 static constexpr RegAddr REG_0x6C = 0x6c; 315 static constexpr RegMask REG_0x6C_GPIO16 = 0x80; 316 static constexpr RegMask REG_0x6C_GPIO15 = 0x40; 317 static constexpr RegMask REG_0x6C_GPIO14 = 0x20; 318 static constexpr RegMask REG_0x6C_GPIO13 = 0x10; 319 static constexpr RegMask REG_0x6C_GPIO12 = 0x08; 320 static constexpr RegMask REG_0x6C_GPIO11 = 0x04; 321 static constexpr RegMask REG_0x6C_GPIO10 = 0x02; 322 static constexpr RegMask REG_0x6C_GPIO9 = 0x01; 323 static constexpr RegMask REG_0x6C_GPIOH = 0xff; 324 static constexpr RegMask REG_0x6C_GPIOL = 0xff; 325 326 static constexpr RegAddr REG_Z1MOD = 0x60; 327 static constexpr RegAddr REG_Z2MOD = 0x63; 328 329 static constexpr RegAddr REG_0x6D = 0x6d; 330 static constexpr RegAddr REG_0x6E = 0x6e; 331 static constexpr RegAddr REG_0x6F = 0x6f; 332 333 static constexpr RegAddr REG_CK1MAP = 0x74; 334 static constexpr RegAddr REG_CK3MAP = 0x77; 335 static constexpr RegAddr REG_CK4MAP = 0x7a; 336 337 static constexpr RegAddr REG_0x7E = 0x7e; 338 339 static constexpr RegAddr REG_0x80 = 0x80; 340 static constexpr RegMask REG_0x80_TABLE1_NORMAL = 0x03; 341 static constexpr RegShift REG_0x80S_TABLE1_NORMAL = 0; 342 static constexpr RegMask REG_0x80_TABLE2_BACK = 0x0c; 343 static constexpr RegShift REG_0x80S_TABLE2_BACK = 2; 344 static constexpr RegMask REG_0x80_TABLE4_FAST = 0x30; 345 static constexpr RegShift REG_0x80S_TABLE4_FAST = 4; 346 static constexpr RegMask REG_0x80_TABLE5_GO_HOME = 0xc0; 347 static constexpr RegShift REG_0x80S_TABLE5_GO_HOME = 6; 348 349 static constexpr RegAddr REG_0x9D = 0x9d; 350 static constexpr RegShift REG_0x9DS_STEPTIM = 2; 351 352 static constexpr RegMask REG_0x87_LEDADD = 0x04; 353 354 static constexpr RegAddr REG_0xA6 = 0xa6; 355 static constexpr RegMask REG_0xA6_GPIO24 = 0x80; 356 static constexpr RegMask REG_0xA6_GPIO23 = 0x40; 357 static constexpr RegMask REG_0xA6_GPIO22 = 0x20; 358 static constexpr RegMask REG_0xA6_GPIO21 = 0x10; 359 static constexpr RegMask REG_0xA6_GPIO20 = 0x08; 360 static constexpr RegMask REG_0xA6_GPIO19 = 0x04; 361 static constexpr RegMask REG_0xA6_GPIO18 = 0x02; 362 static constexpr RegMask REG_0xA6_GPIO17 = 0x01; 363 static constexpr RegAddr REG_0xA7 = 0xa7; 364 static constexpr RegMask REG_0xA7_GPOE24 = 0x80; 365 static constexpr RegMask REG_0xA7_GPOE23 = 0x40; 366 static constexpr RegMask REG_0xA7_GPOE22 = 0x20; 367 static constexpr RegMask REG_0xA7_GPOE21 = 0x10; 368 static constexpr RegMask REG_0xA7_GPOE20 = 0x08; 369 static constexpr RegMask REG_0xA7_GPOE19 = 0x04; 370 static constexpr RegMask REG_0xA7_GPOE18 = 0x02; 371 static constexpr RegMask REG_0xA7_GPOE17 = 0x01; 372 static constexpr RegAddr REG_0xA8 = 0xa8; 373 static constexpr RegMask REG_0xA8_GPOE27 = 0x20; 374 static constexpr RegMask REG_0xA8_GPOE26 = 0x10; 375 static constexpr RegMask REG_0xA8_GPOE25 = 0x08; 376 static constexpr RegMask REG_0xA8_GPO27 = 0x04; 377 static constexpr RegMask REG_0xA8_GPO26 = 0x02; 378 static constexpr RegMask REG_0xA8_GPO25 = 0x01; 379 static constexpr RegAddr REG_0xA9 = 0xa9; 380 static constexpr RegMask REG_0xA9_GPO33 = 0x20; 381 static constexpr RegMask REG_0xA9_GPO32 = 0x10; 382 static constexpr RegMask REG_0xA9_GPO31 = 0x08; 383 static constexpr RegMask REG_0xA9_GPO30 = 0x04; 384 static constexpr RegMask REG_0xA9_GPO29 = 0x02; 385 static constexpr RegMask REG_0xA9_GPO28 = 0x01; 386 387 } // namespace gl843 388 } // namespace genesys 389 390 #endif // BACKEND_GENESYS_GL843_REGISTERS_H 391