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_GL124_REGISTERS_H 22#define BACKEND_GENESYS_GL124_REGISTERS_H 23 24#include <cstdint> 25 26namespace genesys { 27namespace gl124 { 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_FILTER = 0x30; 64static constexpr RegMask REG_0x04_AFEMOD = 0x07; 65 66static constexpr RegAddr REG_0x05 = 0x05; 67static constexpr RegMask REG_0x05_DPIHW = 0xc0; 68static constexpr RegMask REG_0x05_DPIHW_600 = 0x00; 69static constexpr RegMask REG_0x05_DPIHW_1200 = 0x40; 70static constexpr RegMask REG_0x05_DPIHW_2400 = 0x80; 71static constexpr RegMask REG_0x05_DPIHW_4800 = 0xc0; 72static constexpr RegMask REG_0x05_MTLLAMP = 0x30; 73static constexpr RegMask REG_0x05_GMMENB = 0x08; 74static constexpr RegMask REG_0x05_ENB20M = 0x04; 75static constexpr RegMask REG_0x05_MTLBASE = 0x03; 76 77static constexpr RegAddr REG_0x06 = 0x06; 78static constexpr RegMask REG_0x06_SCANMOD = 0xe0; 79static constexpr RegMask REG_0x06S_SCANMOD = 5; 80static constexpr RegMask REG_0x06_PWRBIT = 0x10; 81static constexpr RegMask REG_0x06_GAIN4 = 0x08; 82static constexpr RegMask REG_0x06_OPTEST = 0x07; 83 84static constexpr RegMask REG_0x07_LAMPSIM = 0x80; 85 86static constexpr RegMask REG_0x08_DRAM2X = 0x80; 87static constexpr RegMask REG_0x08_MPENB = 0x20; 88static constexpr RegMask REG_0x08_CIS_LINE = 0x10; 89static constexpr RegMask REG_0x08_IR2_ENB = 0x08; 90static constexpr RegMask REG_0x08_IR1_ENB = 0x04; 91static constexpr RegMask REG_0x08_ENB24M = 0x01; 92 93static constexpr RegMask REG_0x09_MCNTSET = 0xc0; 94static constexpr RegMask REG_0x09_EVEN1ST = 0x20; 95static constexpr RegMask REG_0x09_BLINE1ST = 0x10; 96static constexpr RegMask REG_0x09_BACKSCAN = 0x08; 97static constexpr RegMask REG_0x09_OUTINV = 0x04; 98static constexpr RegMask REG_0x09_SHORTTG = 0x02; 99 100static constexpr RegShift REG_0x09S_MCNTSET = 6; 101static constexpr RegShift REG_0x09S_CLKSET = 4; 102 103static constexpr RegAddr REG_0x0A = 0x0a; 104static constexpr RegMask REG_0x0A_SIFSEL = 0xc0; 105static constexpr RegShift REG_0x0AS_SIFSEL = 6; 106static constexpr RegMask REG_0x0A_SHEETFED = 0x20; 107static constexpr RegMask REG_0x0A_LPWMEN = 0x10; 108 109static constexpr RegAddr REG_0x0B = 0x0b; 110static constexpr RegMask REG_0x0B_DRAMSEL = 0x07; 111static constexpr RegMask REG_0x0B_16M = 0x01; 112static constexpr RegMask REG_0x0B_64M = 0x02; 113static constexpr RegMask REG_0x0B_128M = 0x03; 114static constexpr RegMask REG_0x0B_256M = 0x04; 115static constexpr RegMask REG_0x0B_512M = 0x05; 116static constexpr RegMask REG_0x0B_1G = 0x06; 117static constexpr RegMask REG_0x0B_ENBDRAM = 0x08; 118static constexpr RegMask REG_0x0B_RFHDIS = 0x10; 119static constexpr RegMask REG_0x0B_CLKSET = 0xe0; 120static constexpr RegMask REG_0x0B_24MHZ = 0x00; 121static constexpr RegMask REG_0x0B_30MHZ = 0x20; 122static constexpr RegMask REG_0x0B_40MHZ = 0x40; 123static constexpr RegMask REG_0x0B_48MHZ = 0x60; 124static constexpr RegMask REG_0x0B_60MHZ = 0x80; 125 126static constexpr RegAddr REG_0x0D = 0x0d; 127static constexpr RegMask REG_0x0D_MTRP_RDY = 0x80; 128static constexpr RegMask REG_0x0D_FULLSTP = 0x10; 129static constexpr RegMask REG_0x0D_CLRMCNT = 0x04; 130static constexpr RegMask REG_0x0D_CLRDOCJM = 0x02; 131static constexpr RegMask REG_0x0D_CLRLNCNT = 0x01; 132 133static constexpr RegAddr REG_0x0F = 0x0f; 134 135static constexpr RegMask REG_0x16_CTRLHI = 0x80; 136static constexpr RegMask REG_0x16_TOSHIBA = 0x40; 137static constexpr RegMask REG_0x16_TGINV = 0x20; 138static constexpr RegMask REG_0x16_CK1INV = 0x10; 139static constexpr RegMask REG_0x16_CK2INV = 0x08; 140static constexpr RegMask REG_0x16_CTRLINV = 0x04; 141static constexpr RegMask REG_0x16_CKDIS = 0x02; 142static constexpr RegMask REG_0x16_CTRLDIS = 0x01; 143 144static constexpr RegMask REG_0x17_TGMODE = 0xc0; 145static constexpr RegMask REG_0x17_SNRSYN = 0x0f; 146 147static constexpr RegAddr REG_0x18 = 0x18; 148static constexpr RegMask REG_0x18_CNSET = 0x80; 149static constexpr RegMask REG_0x18_DCKSEL = 0x60; 150static constexpr RegMask REG_0x18_CKTOGGLE = 0x10; 151static constexpr RegMask REG_0x18_CKDELAY = 0x0c; 152static constexpr RegMask REG_0x18_CKSEL = 0x03; 153 154static constexpr RegMask REG_0x1A_SW2SET = 0x80; 155static constexpr RegMask REG_0x1A_SW1SET = 0x40; 156static constexpr RegMask REG_0x1A_MANUAL3 = 0x02; 157static constexpr RegMask REG_0x1A_MANUAL1 = 0x01; 158static constexpr RegMask REG_0x1A_CK4INV = 0x08; 159static constexpr RegMask REG_0x1A_CK3INV = 0x04; 160static constexpr RegMask REG_0x1A_LINECLP = 0x02; 161 162static constexpr RegMask REG_0x1C_TBTIME = 0x07; 163 164static constexpr RegAddr REG_0x1D = 0x1d; 165static constexpr RegMask REG_0x1D_CK4LOW = 0x80; 166static constexpr RegMask REG_0x1D_CK3LOW = 0x40; 167static constexpr RegMask REG_0x1D_CK1LOW = 0x20; 168static constexpr RegMask REG_0x1D_LINESEL = 0x1f; 169static constexpr RegShift REG_0x1DS_LINESEL = 0; 170 171static constexpr RegAddr REG_0x1E = 0x1e; 172static constexpr RegMask REG_0x1E_WDTIME = 0xf0; 173static constexpr RegShift REG_0x1ES_WDTIME = 4; 174 175static constexpr RegAddr REG_0x30 = 0x30; 176static constexpr RegAddr REG_0x31 = 0x31; 177static constexpr RegAddr REG_0x32 = 0x32; 178static constexpr RegMask REG_0x32_GPIO16 = 0x80; 179static constexpr RegMask REG_0x32_GPIO15 = 0x40; 180static constexpr RegMask REG_0x32_GPIO14 = 0x20; 181static constexpr RegMask REG_0x32_GPIO13 = 0x10; 182static constexpr RegMask REG_0x32_GPIO12 = 0x08; 183static constexpr RegMask REG_0x32_GPIO11 = 0x04; 184static constexpr RegMask REG_0x32_GPIO10 = 0x02; 185static constexpr RegMask REG_0x32_GPIO9 = 0x01; 186static constexpr RegAddr REG_0x33 = 0x33; 187static constexpr RegAddr REG_0x34 = 0x34; 188static constexpr RegAddr REG_0x35 = 0x35; 189static constexpr RegAddr REG_0x36 = 0x36; 190static constexpr RegAddr REG_0x37 = 0x37; 191static constexpr RegAddr REG_0x38 = 0x38; 192static constexpr RegAddr REG_0x39 = 0x39; 193 194static constexpr RegAddr REG_0x60 = 0x60; 195static constexpr RegMask REG_0x60_LED4TG = 0x80; 196static constexpr RegMask REG_0x60_YENB = 0x40; 197static constexpr RegMask REG_0x60_YBIT = 0x20; 198static constexpr RegMask REG_0x60_ACYNCNRLC = 0x10; 199static constexpr RegMask REG_0x60_ENOFFSET = 0x08; 200static constexpr RegMask REG_0x60_LEDADD = 0x04; 201static constexpr RegMask REG_0x60_CK4ADC = 0x02; 202static constexpr RegMask REG_0x60_AUTOCONF = 0x01; 203 204static constexpr RegAddr REG_0x80 = 0x80; 205static constexpr RegAddr REG_0x81 = 0x81; 206 207static constexpr RegAddr REG_0xA0 = 0xa0; 208static constexpr RegMask REG_0xA0_FSTPSEL = 0x38; 209static constexpr RegShift REG_0xA0S_FSTPSEL = 3; 210static constexpr RegMask REG_0xA0_STEPSEL = 0x07; 211static constexpr RegShift REG_0xA0S_STEPSEL = 0; 212 213static constexpr RegAddr REG_0xA1 = 0xa1; 214static constexpr RegAddr REG_0xA2 = 0xa2; 215static constexpr RegAddr REG_0xA3 = 0xa3; 216static constexpr RegAddr REG_0xA4 = 0xa4; 217static constexpr RegAddr REG_0xA5 = 0xa5; 218static constexpr RegAddr REG_0xA6 = 0xa6; 219static constexpr RegAddr REG_0xA7 = 0xa7; 220static constexpr RegAddr REG_0xA8 = 0xa8; 221static constexpr RegAddr REG_0xA9 = 0xa9; 222static constexpr RegAddr REG_0xAA = 0xaa; 223static constexpr RegAddr REG_0xAB = 0xab; 224static constexpr RegAddr REG_0xAC = 0xac; 225static constexpr RegAddr REG_0xAD = 0xad; 226static constexpr RegAddr REG_0xAE = 0xae; 227static constexpr RegAddr REG_0xAF = 0xaf; 228static constexpr RegAddr REG_0xB0 = 0xb0; 229static constexpr RegAddr REG_0xB1 = 0xb1; 230 231static constexpr RegAddr REG_0xB2 = 0xb2; 232static constexpr RegMask REG_0xB2_Z1MOD = 0x1f; 233static constexpr RegAddr REG_0xB3 = 0xb3; 234static constexpr RegMask REG_0xB3_Z1MOD = 0xff; 235static constexpr RegAddr REG_0xB4 = 0xb4; 236static constexpr RegMask REG_0xB4_Z1MOD = 0xff; 237 238static constexpr RegAddr REG_0xB5 = 0xb5; 239static constexpr RegMask REG_0xB5_Z2MOD = 0x1f; 240static constexpr RegAddr REG_0xB6 = 0xb6; 241static constexpr RegMask REG_0xB6_Z2MOD = 0xff; 242static constexpr RegAddr REG_0xB7 = 0xb7; 243static constexpr RegMask REG_0xB7_Z2MOD = 0xff; 244 245static constexpr RegAddr REG_0x100 = 0x100; 246static constexpr RegMask REG_0x100_DOCSNR = 0x80; 247static constexpr RegMask REG_0x100_ADFSNR = 0x40; 248static constexpr RegMask REG_0x100_COVERSNR = 0x20; 249static constexpr RegMask REG_0x100_CHKVER = 0x10; 250static constexpr RegMask REG_0x100_DOCJAM = 0x08; 251static constexpr RegMask REG_0x100_HISPDFLG = 0x04; 252static constexpr RegMask REG_0x100_MOTMFLG = 0x02; 253static constexpr RegMask REG_0x100_DATAENB = 0x01; 254 255static constexpr RegAddr REG_0x114 = 0x114; 256static constexpr RegAddr REG_0x115 = 0x115; 257 258static constexpr RegAddr REG_LINCNT = 0x25; 259static constexpr RegAddr REG_MAXWD = 0x28; 260static constexpr RegAddr REG_DPISET = 0x2c; 261static constexpr RegAddr REG_FEEDL = 0x3d; 262static constexpr RegAddr REG_CK1MAP = 0x74; 263static constexpr RegAddr REG_CK3MAP = 0x77; 264static constexpr RegAddr REG_CK4MAP = 0x7a; 265static constexpr RegAddr REG_LPERIOD = 0x7d; 266static constexpr RegAddr REG_DUMMY = 0x80; 267static constexpr RegAddr REG_STRPIXEL = 0x82; 268static constexpr RegAddr REG_ENDPIXEL = 0x85; 269static constexpr RegAddr REG_EXPDMY = 0x88; 270static constexpr RegAddr REG_EXPR = 0x8a; 271static constexpr RegAddr REG_EXPG = 0x8d; 272static constexpr RegAddr REG_EXPB = 0x90; 273static constexpr RegAddr REG_SEGCNT = 0x93; 274static constexpr RegAddr REG_TG0CNT = 0x96; 275static constexpr RegAddr REG_SCANFED = 0xa2; 276static constexpr RegAddr REG_STEPNO = 0xa4; 277static constexpr RegAddr REG_FWDSTEP = 0xa6; 278static constexpr RegAddr REG_BWDSTEP = 0xa8; 279static constexpr RegAddr REG_FASTNO = 0xaa; 280static constexpr RegAddr REG_FSHDEC = 0xac; 281static constexpr RegAddr REG_FMOVNO = 0xae; 282static constexpr RegAddr REG_FMOVDEC = 0xb0; 283static constexpr RegAddr REG_Z1MOD = 0xb2; 284static constexpr RegAddr REG_Z2MOD = 0xb5; 285 286static constexpr RegAddr REG_TRUER = 0x110; 287static constexpr RegAddr REG_TRUEG = 0x111; 288static constexpr RegAddr REG_TRUEB = 0x112; 289 290} // namespace gl124 291} // namespace genesys 292 293#endif // BACKEND_GENESYS_GL843_REGISTERS_H 294