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