1 /* sane - Scanner Access Now Easy.
2    Copyright (C) 1997 Geoffrey T. Dairiki
3    This file is part of the SANE package.
4 
5    This program is free software; you can redistribute it and/or
6    modify it under the terms of the GNU General Public License as
7    published by the Free Software Foundation; either version 2 of the
8    License, or (at your option) any later version.
9 
10    This program is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <https://www.gnu.org/licenses/>.
17 
18    As a special exception, the authors of SANE give permission for
19    additional uses of the libraries contained in this release of SANE.
20 
21    The exception is that, if you link a SANE library with other files
22    to produce an executable, this does not by itself cause the
23    resulting executable to be covered by the GNU General Public
24    License.  Your use of that executable is in no way restricted on
25    account of linking the SANE library code into it.
26 
27    This exception does not, however, invalidate any other reasons why
28    the executable file might be covered by the GNU General Public
29    License.
30 
31    If you submit changes to SANE to the maintainers to be included in
32    a subsequent release, you agree by submitting the changes that
33    those changes may be distributed with this exception intact.
34 
35    If you write modifications of your own for SANE, it is your choice
36    whether to permit this exception to apply to your modifications.
37    If you do not wish that, delete this exception notice.
38 
39    This file is part of a SANE backend for HP Scanners supporting
40    HP Scanner Control Language (SCL).
41 */
42 
43 #ifndef HP_SCL_INCLUDED
44 #define HP_SCL_INCLUDED
45 
46 #define HP_SCL_PACK(id, group, char) \
47         ((SANE_Word)(id) << 16 | ((group) & 0xFF) << 8 | ((char) & 0xFF))
48 #define SCL_INQ_ID(code)		((code) >> 16)
49 #define SCL_GROUP_CHAR(code)		((char)(((code) >> 8) & 0xFF))
50 #define SCL_PARAM_CHAR(code)		((char)((code) & 0xFF))
51 
52 #define HP_SCL_CONTROL(id,g,c)		HP_SCL_PACK(id,g,c)
53 #define HP_SCL_COMMAND(g,c)		HP_SCL_PACK(0,g,c)
54 #define HP_SCL_PARAMETER(id)		HP_SCL_PACK(id, 0, 0)
55 #define HP_SCL_DATA_TYPE(id)		HP_SCL_PACK(id, 1, 0)
56 
57 #define IS_SCL_CONTROL(scl)	(SCL_INQ_ID(scl) && SCL_PARAM_CHAR(scl))
58 #define IS_SCL_COMMAND(scl)	(!SCL_INQ_ID(scl) && SCL_PARAM_CHAR(scl))
59 #define IS_SCL_PARAMETER(scl)	(SCL_INQ_ID(scl) && !SCL_PARAM_CHAR(scl))
60 #define IS_SCL_DATA_TYPE(scl)	(SCL_GROUP_CHAR(scl) == '\001')
61 
62 #define SCL_AUTO_BKGRND		HP_SCL_CONTROL(10307, 'a', 'B')
63 #define SCL_COMPRESSION		HP_SCL_CONTROL(10308, 'a', 'C')
64 #define SCL_DOWNLOAD_TYPE	HP_SCL_CONTROL(10309, 'a', 'D')
65 #define SCL_X_SCALE		HP_SCL_CONTROL(10310, 'a', 'E')
66 #define SCL_Y_SCALE		HP_SCL_CONTROL(10311, 'a', 'F')
67 #define SCL_DATA_WIDTH		HP_SCL_CONTROL(10312, 'a', 'G')
68 #define SCL_INVERSE_IMAGE	HP_SCL_CONTROL(10314, 'a', 'I')
69 #define SCL_BW_DITHER		HP_SCL_CONTROL(10315, 'a', 'J')
70 #define SCL_CONTRAST		HP_SCL_CONTROL(10316, 'a', 'K')
71 #define SCL_BRIGHTNESS		HP_SCL_CONTROL(10317, 'a', 'L')
72 #define SCL_MIRROR_IMAGE        HP_SCL_CONTROL(10318, 'a', 'M')
73 #define SCL_SHARPENING		HP_SCL_CONTROL(10319, 'a', 'N')
74 #define SCL_RESERVED1           HP_SCL_CONTROL(10320, 'a', 'O')
75 #define SCL_X_RESOLUTION	HP_SCL_CONTROL(10323, 'a', 'R')
76 #define SCL_Y_RESOLUTION	HP_SCL_CONTROL(10324, 'a', 'S')
77 #define SCL_OUTPUT_DATA_TYPE	HP_SCL_CONTROL(10325, 'a', 'T')
78 #define SCL_DOWNLOAD_LENGTH	HP_SCL_CONTROL(10328, 'a', 'W')
79 #define SCL_PRELOAD_ADF         HP_SCL_CONTROL(10468, 'f', 'C')
80 #define SCL_MEDIA               HP_SCL_CONTROL(10469, 'f', 'D')
81 #define SCL_10470               HP_SCL_CONTROL(10470, 'f', 'E')
82 #define SCL_LAMPTEST            HP_SCL_CONTROL(10477, 'f', 'L')
83 #define SCL_X_EXTENT		HP_SCL_CONTROL(10481, 'f', 'P')
84 #define SCL_Y_EXTENT		HP_SCL_CONTROL(10482, 'f', 'Q')
85 #define SCL_START_SCAN		HP_SCL_COMMAND('f', 'S')
86 #define SCL_10485               HP_SCL_CONTROL(10485, 'f', 'T')
87 #define SCL_10488               HP_SCL_CONTROL(10488, 'f', 'W')
88 #define SCL_X_POS		HP_SCL_CONTROL(10489, 'f', 'X')
89 #define SCL_Y_POS		HP_SCL_CONTROL(10490, 'f', 'Y')
90 #define SCL_XPA_SCAN		HP_SCL_COMMAND('u', 'D')
91 #define SCL_SPEED		HP_SCL_CONTROL(10950, 'u', 'E')
92 #define SCL_FILTER		HP_SCL_CONTROL(10951, 'u', 'F')
93 #define SCL_10952		HP_SCL_CONTROL(10952, 'u', 'G')
94 #define SCL_XPA_DISABLE         HP_SCL_CONTROL(10953, 'u', 'H')
95 #define SCL_TONE_MAP		HP_SCL_CONTROL(10956, 'u', 'K')
96 #define SCL_CALIBRATE		HP_SCL_COMMAND('u', 'R')
97 #define SCL_ADF_SCAN		HP_SCL_COMMAND('u', 'S')
98 #define SCL_MATRIX		HP_SCL_CONTROL(10965, 'u', 'T')
99 #define SCL_UNLOAD		HP_SCL_CONTROL(10966, 'u', 'U')
100 #define SCL_10967		HP_SCL_CONTROL(10967, 'u', 'V')
101 #define SCL_CHANGE_DOC		HP_SCL_CONTROL(10969, 'u', 'X')
102 #define SCL_ADF_BFEED		HP_SCL_CONTROL(10970, 'u', 'Y')
103 /* Clear Errors does not follow command syntax Esc*o0E, it is only Esc*oE */
104 /* #define SCL_CLEAR_ERRORS	HP_SCL_COMMAND('o', 'E')  */
105 
106 #define SCL_INQUIRE_PRESENT_VALUE	HP_SCL_COMMAND('s', 'R')
107 #define SCL_INQUIRE_MINIMUM_VALUE	HP_SCL_COMMAND('s', 'L')
108 #define SCL_INQUIRE_MAXIMUM_VALUE	HP_SCL_COMMAND('s', 'H')
109 #define SCL_INQUIRE_DEVICE_PARAMETER	HP_SCL_COMMAND('s', 'E')
110 #define SCL_UPLOAD_BINARY_DATA		HP_SCL_COMMAND('s', 'U')
111 
112 #define SCL_HP_MODEL_1		HP_SCL_PARAMETER(3)
113 #define SCL_HP_MODEL_2		HP_SCL_PARAMETER(10)
114 #define SCL_HP_MODEL_3		HP_SCL_PARAMETER(9)
115 #define SCL_HP_MODEL_4		HP_SCL_PARAMETER(11)
116 #define SCL_HP_MODEL_5		HP_SCL_PARAMETER(12)
117 #define SCL_HP_MODEL_6		HP_SCL_PARAMETER(14)
118 #define SCL_HP_MODEL_8		HP_SCL_PARAMETER(15)
119 #define SCL_HP_MODEL_9		HP_SCL_PARAMETER(16)
120 #define SCL_HP_MODEL_10		HP_SCL_PARAMETER(17)
121 #define SCL_HP_MODEL_11		HP_SCL_PARAMETER(18)
122 #define SCL_HP_MODEL_12		HP_SCL_PARAMETER(19)
123 #define SCL_HP_MODEL_14		HP_SCL_PARAMETER(21)
124 #define SCL_HP_MODEL_16		HP_SCL_PARAMETER(31)
125 #define SCL_HP_MODEL_17		HP_SCL_PARAMETER(32)
126 
127 #define SCL_ADF_CAPABILITY      HP_SCL_PARAMETER(24)
128 #define SCL_ADF_BIN		HP_SCL_PARAMETER(25)
129 #define SCL_ADF_RDY_UNLOAD	HP_SCL_PARAMETER(27)
130 
131 #define SCL_CURRENT_ERROR_STACK	HP_SCL_PARAMETER(257)
132 #define SCL_CURRENT_ERROR	HP_SCL_PARAMETER(259)
133 #define SCL_OLDEST_ERROR	HP_SCL_PARAMETER(261)
134 #define SCL_PIXELS_PER_LINE	HP_SCL_PARAMETER(1024)
135 #define SCL_BYTES_PER_LINE	HP_SCL_PARAMETER(1025)
136 #define SCL_NUMBER_OF_LINES	HP_SCL_PARAMETER(1026)
137 #define SCL_ADF_READY		HP_SCL_PARAMETER(1027)
138 
139 #define SCL_DEVPIX_RESOLUTION	HP_SCL_PARAMETER(1028)
140 
141 #define SCL_AUTO_SPEED		HP_SCL_PARAMETER(1040)
142 
143 #define SCL_FRONT_BUTTON        HP_SCL_PARAMETER(1044)
144 
145 #define SCL_PRELOADED		HP_SCL_PARAMETER(1045)
146 
147 /* The following is not documented */
148 #define SCL_SECONDARY_SCANDIR   HP_SCL_PARAMETER(1047)
149 
150 #define SCL_BW8x8DITHER		HP_SCL_DATA_TYPE(0)
151 #define SCL_8x8TONE_MAP		HP_SCL_DATA_TYPE(1)
152 #define SCL_8x9MATRIX_COEFF	HP_SCL_DATA_TYPE(2)
153 #define SCL_8x8DITHER		HP_SCL_DATA_TYPE(3)
154 #define SCL_CAL_STRIP		HP_SCL_DATA_TYPE(4)
155 #define SCL_BW16x16DITHER	HP_SCL_DATA_TYPE(5)
156 #define SCL_10x8TONE_MAP	HP_SCL_DATA_TYPE(6)
157 #define SCL_10x3MATRIX_COEFF	HP_SCL_DATA_TYPE(8)
158 #define SCL_10x9MATRIX_COEFF	HP_SCL_DATA_TYPE(9)
159 #define SCL_7x12TONE_MAP	HP_SCL_DATA_TYPE(10)
160 #define SCL_BW7x12TONE_MAP	HP_SCL_DATA_TYPE(11)
161 #define SCL_RGB_GAINS     	HP_SCL_DATA_TYPE(11)
162 #define SCL_CALIB_MAP     	HP_SCL_DATA_TYPE(14)
163 
164 #endif /*  HP_SCL_INCLUDED */
165