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_GL646_REGISTERS_H
22#define BACKEND_GENESYS_GL646_REGISTERS_H
23
24#include <cstdint>
25
26namespace genesys {
27namespace gl646 {
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_FASTMOD = 0x10;
38static constexpr RegMask REG_0x01_COMPENB = 0x08;
39static constexpr RegMask REG_0x01_DRAMSEL = 0x04;
40static constexpr RegMask REG_0x01_SHDAREA = 0x02;
41static constexpr RegMask REG_0x01_SCAN = 0x01;
42
43static constexpr RegMask REG_0x02_NOTHOME = 0x80;
44static constexpr RegMask REG_0x02_ACDCDIS = 0x40;
45static constexpr RegMask REG_0x02_AGOHOME = 0x20;
46static constexpr RegMask REG_0x02_MTRPWR = 0x10;
47static constexpr RegMask REG_0x02_FASTFED = 0x08;
48static constexpr RegMask REG_0x02_MTRREV = 0x04;
49static constexpr RegMask REG_0x02_STEPSEL = 0x03;
50
51static constexpr RegMask REG_0x02_FULLSTEP = 0x00;
52static constexpr RegMask REG_0x02_HALFSTEP = 0x01;
53static constexpr RegMask REG_0x02_QUATERSTEP = 0x02;
54
55static constexpr RegMask REG_0x03_TG3 = 0x80;
56static constexpr RegMask REG_0x03_AVEENB = 0x40;
57static constexpr RegMask REG_0x03_XPASEL = 0x20;
58static constexpr RegMask REG_0x03_LAMPPWR = 0x10;
59static constexpr RegMask REG_0x03_LAMPDOG = 0x08;
60static constexpr RegMask REG_0x03_LAMPTIM = 0x07;
61
62static constexpr RegMask REG_0x04_LINEART = 0x80;
63static constexpr RegMask REG_0x04_BITSET = 0x40;
64static constexpr RegMask REG_0x04_ADTYPE = 0x30;
65static constexpr RegMask REG_0x04_FILTER = 0x0c;
66static constexpr RegMask REG_0x04_FESET = 0x03;
67
68static constexpr RegAddr REG_0x05 = 0x05;
69static constexpr RegMask REG_0x05_DPIHW = 0xc0;
70static constexpr RegMask REG_0x05_DPIHW_600 = 0x00;
71static constexpr RegMask REG_0x05_DPIHW_1200 = 0x40;
72static constexpr RegMask REG_0x05_DPIHW_2400 = 0x80;
73static constexpr RegMask REG_0x05_DPIHW_4800 = 0xc0;
74static constexpr RegMask REG_0x05_GMMTYPE = 0x30;
75static constexpr RegMask REG_0x05_GMM14BIT = 0x10;
76static constexpr RegMask REG_0x05_GMMENB = 0x08;
77static constexpr RegMask REG_0x05_LEDADD = 0x04;
78static constexpr RegMask REG_0x05_BASESEL = 0x03;
79
80static constexpr RegAddr REG_0x06 = 0x06;
81static constexpr RegMask REG_0x06_PWRBIT = 0x10;
82static constexpr RegMask REG_0x06_GAIN4 = 0x08;
83static constexpr RegMask REG_0x06_OPTEST = 0x07;
84
85static constexpr RegMask REG_0x07_DMASEL = 0x02;
86static constexpr RegMask REG_0x07_DMARDWR = 0x01;
87
88static constexpr RegMask REG_0x16_CTRLHI = 0x80;
89static constexpr RegMask REG_0x16_SELINV = 0x40;
90static constexpr RegMask REG_0x16_TGINV = 0x20;
91static constexpr RegMask REG_0x16_CK1INV = 0x10;
92static constexpr RegMask REG_0x16_CK2INV = 0x08;
93static constexpr RegMask REG_0x16_CTRLINV = 0x04;
94static constexpr RegMask REG_0x16_CKDIS = 0x02;
95static constexpr RegMask REG_0x16_CTRLDIS = 0x01;
96
97static constexpr RegMask REG_0x17_TGMODE = 0xc0;
98static constexpr RegMask REG_0x17_TGMODE_NO_DUMMY = 0x00;
99static constexpr RegMask REG_0x17_TGMODE_REF = 0x40;
100static constexpr RegMask REG_0x17_TGMODE_XPA = 0x80;
101static constexpr RegMask REG_0x17_TGW = 0x3f;
102
103static constexpr RegMask REG_0x18_CNSET = 0x80;
104static constexpr RegMask REG_0x18_DCKSEL = 0x60;
105static constexpr RegMask REG_0x18_CKTOGGLE = 0x10;
106static constexpr RegMask REG_0x18_CKDELAY = 0x0c;
107static constexpr RegMask REG_0x18_CKSEL = 0x03;
108
109static constexpr RegMask REG_0x1D_CKMANUAL = 0x80;
110
111static constexpr RegMask REG_0x1E_WDTIME = 0xf0;
112static constexpr RegMask REG_0x1E_LINESEL = 0x0f;
113
114static constexpr RegMask REG_0x41_PWRBIT = 0x80;
115static constexpr RegMask REG_0x41_BUFEMPTY = 0x40;
116static constexpr RegMask REG_0x41_FEEDFSH = 0x20;
117static constexpr RegMask REG_0x41_SCANFSH = 0x10;
118static constexpr RegMask REG_0x41_HOMESNR = 0x08;
119static constexpr RegMask REG_0x41_LAMPSTS = 0x04;
120static constexpr RegMask REG_0x41_FEBUSY = 0x02;
121static constexpr RegMask REG_0x41_MOTMFLG = 0x01;
122
123static constexpr RegMask REG_0x66_LOW_CURRENT = 0x10;
124
125static constexpr RegMask REG_0x6A_FSTPSEL = 0xc0;
126static constexpr RegMask REG_0x6A_FASTPWM = 0x3f;
127
128static constexpr RegMask REG_0x6C_TGTIME = 0xc0;
129static constexpr RegMask REG_0x6C_Z1MOD = 0x38;
130static constexpr RegMask REG_0x6C_Z2MOD = 0x07;
131
132static constexpr RegAddr REG_EXPR = 0x10;
133static constexpr RegAddr REG_EXPG = 0x12;
134static constexpr RegAddr REG_EXPB = 0x14;
135static constexpr RegAddr REG_SCANFED = 0x1f;
136static constexpr RegAddr REG_BUFSEL = 0x20;
137static constexpr RegAddr REG_LINCNT = 0x25;
138static constexpr RegAddr REG_DPISET = 0x2c;
139static constexpr RegAddr REG_STRPIXEL = 0x30;
140static constexpr RegAddr REG_ENDPIXEL = 0x32;
141static constexpr RegAddr REG_DUMMY = 0x34;
142static constexpr RegAddr REG_MAXWD = 0x35;
143static constexpr RegAddr REG_LPERIOD = 0x38;
144static constexpr RegAddr REG_FEEDL = 0x3d;
145static constexpr RegAddr REG_VALIDWORD = 0x42;
146static constexpr RegAddr REG_FEDCNT = 0x48;
147static constexpr RegAddr REG_SCANCNT = 0x4b;
148static constexpr RegAddr REG_Z1MOD = 0x60;
149static constexpr RegAddr REG_Z2MOD = 0x62;
150
151} // namespace gl646
152} // namespace genesys
153
154#endif // BACKEND_GENESYS_GL646_REGISTERS_H
155