1 /* HP Scanjet 3900 series - RTS8822 internal config
2 
3    Copyright (C) 2005-2009 Jonathan Bravo Lopez <jkdsoft@gmail.com>
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
9    as published by the Free Software Foundation; either version 2
10    of the License, or (at your option) any later version.
11 
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU 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 /* returns device model according to given product and vendor id's */
43 static SANE_Int cfg_device_get(SANE_Int product, SANE_Int vendor);
44 
45 /* returns information and capabilities about selected chipset model */
46 static SANE_Int cfg_chipset_get(SANE_Int model, struct st_chip *chipset);
47 
48 /* returns the chipset model for each scanner */
49 static SANE_Int cfg_chipset_model_get(SANE_Int device);
50 
51 /* buttons for each scanner */
52 static SANE_Int cfg_buttons_get(struct st_buttons *reg);
53 
54 /* area constraints for each scanner */
55 static SANE_Int cfg_constrains_get(struct st_constrains *constrain);
56 
57 /* spectrum clock generator for each scanner */
58 static SANE_Int cfg_sscg_get(SANE_Int *enable, SANE_Int *mode, SANE_Int *clock);
59 
60 /* motor general configuration for each scanner */
61 static SANE_Int cfg_motor_get(struct st_motorcfg *reg);
62 
63 /* motor resource for each scanner */
64 static SANE_Byte *cfg_motor_resource_get(SANE_Byte *size);
65 
66 /* sensor general configuration for each scanner */
67 static SANE_Int cfg_sensor_get(struct st_sensorcfg *reg);
68 
69 /* reference voltages for each scanner */
70 static void cfg_refvoltages_get(SANE_Int sensortype, SANE_Byte *vrts, SANE_Byte *vrms, SANE_Byte *vrbs);
71 static void hp3800_refvoltages(SANE_Int usb, SANE_Int sensor, SANE_Byte *vrts, SANE_Byte *vrms, SANE_Byte *vrbs);
72 static void hp3970_refvoltages(SANE_Int usb, SANE_Int sensor, SANE_Byte *vrts, SANE_Byte *vrms, SANE_Byte *vrbs);
73 
74 /* offset calibration start and length */
75 static void cfg_offset_get(SANE_Int sensortype, SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width);
76 static void ua4900_offset(SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width);
77 static void hp3800_offset(SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width);
78 static void hp3970_offset(SANE_Int sensor, SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width);
79 static void hp4370_offset(SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width);
80 
81 /* autoref configuration */
82 static void cfg_autoref_get(struct st_autoref *reg);
83 
84 /* autoref start effective pixel */
85 static SANE_Int cfg_effectivepixel_get(SANE_Int sensortype, SANE_Int resolution);
86 static SANE_Int ua4900_effectivepixel(SANE_Int resolution);
87 static SANE_Int hp3800_effectivepixel(SANE_Int resolution);
88 static SANE_Int hp3970_effectivepixel(SANE_Int sensor, SANE_Int resolution);
89 static SANE_Int hp4370_effectivepixel(SANE_Int resolution);
90 
91 /* default values for gain and offset */
92 static SANE_Int cfg_gainoffset_get(SANE_Int sensortype, struct st_gain_offset *reg);
93 static SANE_Int bq5550_gainoffset(SANE_Int usb, struct st_gain_offset *myreg);
94 static SANE_Int ua4900_gainoffset(SANE_Int usb, struct st_gain_offset *myreg);
95 static SANE_Int hp3800_gainoffset(SANE_Int usb, struct st_gain_offset *myreg);
96 static SANE_Int hp3970_gainoffset(SANE_Int usb, SANE_Int sensor, struct st_gain_offset *myreg);
97 static SANE_Int hp4370_gainoffset(SANE_Int usb, struct st_gain_offset *myreg);
98 
99 /* values to detect optimum pulse-width modulation */
100 static SANE_Int cfg_checkstable_get(SANE_Int lamp, struct st_checkstable *check);
101 static SANE_Int ua4900_checkstable(SANE_Int lamp, struct st_checkstable *check);
102 static SANE_Int hp3800_checkstable(SANE_Int lamp, struct st_checkstable *check);
103 static SANE_Int hp3970_checkstable(SANE_Int lamp, struct st_checkstable *check);
104 static SANE_Int hp4370_checkstable(SANE_Int lamp, struct st_checkstable *check);
105 
106 /* fixed pulse-width modulation values */
107 static SANE_Int cfg_fixedpwm_get(SANE_Int sensortype, SANE_Int scantype);
108 static SANE_Int ua4900_fixedpwm(SANE_Int scantype, SANE_Int usb);
109 static SANE_Int hp3800_fixedpwm(SANE_Int scantype, SANE_Int usb);
110 static SANE_Int hp3970_fixedpwm(SANE_Int scantype, SANE_Int usb, SANE_Int sensor);
111 static SANE_Int hp4370_fixedpwm(SANE_Int scantype, SANE_Int usb);
112 
113 /* virtual origin (ser and ler references) */
114 static void cfg_vrefs_get(SANE_Int sensortype, SANE_Int res, SANE_Int *ser, SANE_Int *ler);
115 static void hp3800_vrefs(SANE_Int res, SANE_Int *ser, SANE_Int *ler);
116 static void hp3970_vrefs(SANE_Int usb, SANE_Int sensor, SANE_Int res, SANE_Int *ser, SANE_Int *ler);
117 static void hp4370_vrefs(SANE_Int res, SANE_Int *ser, SANE_Int *ler);
118 
119 /* scanmodes supported by each scanner */
120 static SANE_Int cfg_scanmode_get(SANE_Int sensortype, SANE_Int sm, struct st_scanmode *mymode);
121 static SANE_Int bq5550_scanmodes(SANE_Int usb, SANE_Int sm, struct st_scanmode *mymode);
122 static SANE_Int ua4900_scanmodes(SANE_Int usb, SANE_Int sm, struct st_scanmode *mymode);
123 static SANE_Int hp3800_scanmodes(SANE_Int usb, SANE_Int sm, struct st_scanmode *mymode);
124 static SANE_Int hp3970_scanmodes(SANE_Int usb, SANE_Int ccd, SANE_Int sm, struct st_scanmode *mymode);
125 static SANE_Int hp4370_scanmodes(SANE_Int usb, SANE_Int sm, struct st_scanmode *mymode);
126 
127 /* timing values for ccd sensors */
128 static SANE_Int cfg_timing_get(SANE_Int sensortype, SANE_Int tm, struct st_timing *reg);
129 static SANE_Int bq5550_timing_get(SANE_Int tm, struct st_timing *reg);
130 static SANE_Int ua4900_timing_get(SANE_Int tm, struct st_timing *reg);
131 static SANE_Int hp3800_timing_get(SANE_Int tm, struct st_timing *reg);
132 static SANE_Int hp3970_timing_get(SANE_Int sensortype, SANE_Int tm, struct st_timing *reg);
133 static SANE_Int hp4370_timing_get(SANE_Int tm, struct st_timing *reg);
134 
135 /* motor movements */
136 static SANE_Int cfg_motormove_get(SANE_Int sensortype, SANE_Int mm, struct st_motormove *reg);
137 static SANE_Int bq5550_motormove(SANE_Int item, struct st_motormove *reg);
138 static SANE_Int hp3800_motormove(SANE_Int item, struct st_motormove *reg);
139 static SANE_Int hp3970_motormove(SANE_Int usb, SANE_Int ccd, SANE_Int item, struct st_motormove *reg);
140 
141 /* motor curves */
142 static SANE_Int *cfg_motorcurve_get(void);
143 static SANE_Int *bq5550_motor(void);
144 static SANE_Int *hp3800_motor(void);
145 static SANE_Int *hp3970_motor(void);
146 static SANE_Int *hp4370_motor(void);
147 
148 /* shading cut values */
149 static void cfg_shading_cut_get(SANE_Int sensortype, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue);
150 static void ua4900_shading_cut(SANE_Int usb, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue);
151 static void hp3800_shading_cut(SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue);
152 static void hp3970_shading_cut(SANE_Int usb, SANE_Int ccd, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue);
153 static void hp4370_shading_cut(SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue);
154 
155 /* wrefs values */
156 static void cfg_wrefs_get(SANE_Int sensortype, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue);
157 static void ua4900_wrefs(SANE_Int usb, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue);
158 static void hp3800_wrefs(SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue);
159 static void hp3970_wrefs(SANE_Int usb, SANE_Int ccd, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue);
160 static void hp4370_wrefs(SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue);
161 
162 
163 /* DEPRECATED FUNCTIONS !!!!!!!!!!!!!!!!!!! */
164 
165 
166 static int get_value(int section, int option, int defvalue, int file);
167 
168 /* HP Scanjet 3800 */
169 static int hp3800_calibreflective(int option, int defvalue);
170 static int hp3800_calibtransparent(int option, int defvalue);
171 static int hp3800_calibnegative(int option, int defvalue);
172 static int srt_hp3800_scanparam_get(int option, int defvalue);
173 
174 /* UMAX Astra 4900 */
175 static int ua4900_calibreflective(int option, int defvalue);
176 static int ua4900_calibtransparent(int option, int defvalue);
177 static int ua4900_calibnegative(int option, int defvalue);
178 
179 /* HP Scanjet 3970 */
180 static int hp3970_calibreflective(int option, int defvalue);
181 static int hp3970_calibtransparent(int option, int defvalue);
182 static int hp3970_calibnegative(int option, int defvalue);
183 static int srt_hp3970_scanparam_get(int file, int option, int defvalue);
184 static int srt_hp3970_platform_get(int option, int defvalue);
185 
186 /* HP Scanjet 4370 */
187 static int hp4370_calibreflective(int option, int defvalue);
188 static int hp4370_calibtransparent(int option, int defvalue);
189 static int hp4370_calibnegative(int option, int defvalue);
190 static int srt_hp4370_scanparam_get(int file, int option, int defvalue);
191 
192 /* HP Scanjet g3110 */
193 static int hpg3110_calibnegative(int option, int defvalue);
194 static int hpg3110_calibtransparent(int option, int defvalue);
195 
196 /* ----- Implementation ----- */
197 
198 /* DEPRECATED enumerations */
199 
200 enum ConfigFiles
201 {
202 	FITCALIBRATE=0,
203 
204 	T_RTINIFILE, T_USB1INIFILE,
205 	S_RTINIFILE, S_USB1INIFILE
206 };
207 
208 enum fcsec6
209 {
210 	CALIBREFLECTIVE = 0, CALIBTRANSPARENT, CALIBNEGATIVEFILM,
211 
212 	SCANINFO,
213 	SCAN_CALI,
214 
215 	WSTRIPXPOS, WSTRIPYPOS,
216 	BSTRIPXPOS, BSTRIPYPOS,
217 
218 	BREFR, BREFG, BREFB,
219 
220 	REFBITDEPTH,
221 	OFFSETHEIGHT,
222 
223 	OFFSETNSIGMA, OFFSETTARGETMAX, OFFSETTARGETMIN,
224 	OFFSETAVGTARGETR, OFFSETAVGTARGETG, OFFSETAVGTARGETB,
225 
226 	ADCOFFEVENODD,
227 	CALIBOFFSET1ON,
228 
229 	ADCOFFQUICKWAY, ADCOFFPREDICTSTART, ADCOFFPREDICTEND,
230 
231 	OFFSETTUNESTEP1, OFFSETBOUNDARYRATIO1, OFFSETAVGRATIO1,
232 
233 	OFFSETEVEN1R, OFFSETEVEN1G, OFFSETEVEN1B,
234 	OFFSETODD1R,  OFFSETODD1G,  OFFSETODD1B,
235 
236 	ADCOFFPREDICTR,   ADCOFFPREDICTG,   ADCOFFPREDICTB,
237 	ADCOFFEVEN1R_1ST, ADCOFFEVEN1G_1ST, ADCOFFEVEN1B_1ST,
238 	ADCOFFODD1R_1ST,	ADCOFFODD1G_1ST,	ADCOFFODD1B_1ST,
239 
240 	PEAKR, PEAKG, PEAKB,
241 	MINR, MING, MINB,
242 
243 	CALIBOFFSET2ON,
244 	OFFSETTUNESTEP2, OFFSETBOUNDARYRATIO2, OFFSETAVGRATIO2,
245 
246 	OFFSETEVEN2R, OFFSETEVEN2G, OFFSETEVEN2B,
247 	OFFSETODD2R,  OFFSETODD2G,  OFFSETODD2B,
248 
249 	GAINHEIGHT, GAINTARGETFACTOR,
250 
251 	CALIBPAGON,
252 
253 	HIPAGR, HIPAGG, HIPAGB,
254 	LOPAGR, LOPAGG, LOPAGB,
255 	PAGR, PAGG, PAGB,
256 
257 	CALIBGAIN1ON, GAIN1R, GAIN1G, GAIN1B,
258 	CALIBGAIN2ON, GAIN2R, GAIN2G, GAIN2B,
259 
260 	TOTSHADING,
261 
262 	BSHADINGON, BSHADINGHEIGHT, BSHADINGPREDIFFR, BSHADINGPREDIFFG, BSHADINGPREDIFFB,
263 	BSHADINGDEFCUTOFF,
264 	WSHADINGON, WSHADINGHEIGHT, WSHADINGPREDIFFR, WSHADINGPREDIFFG, WSHADINGPREDIFFB,
265 
266 	PARKHOMEAFTERCALIB,
267 
268 	SHADINGTIME_16BIT, SHADOWTIME_16BIT, SHADINGTIME_8BIT, SHADOWTIME_8BIT,
269 	PREVIEWDPI,
270 
271 	FIRSTDCOFFSETEVEN0, FIRSTDCOFFSETODD0, FIRSTDCOFFSETEVEN1,
272 	FIRSTDCOFFSETODD1, FIRSTDCOFFSETEVEN2, FIRSTDCOFFSETODD2,
273 
274 	CALIBOFFSET10N, CALIBOFFSET20N,
275 	CALIBGAIN10N, CALIBGAIN20N,
276 	ARRANGELINE,
277 	COMPRESSION,
278 
279 	TA_X_START, TA_Y_START,
280 
281 	DPIGAINCONTROL600,
282 	DPIGAINCONTROL_TA600,
283 	DPIGAINCONTROL_NEG600,
284 
285 	CRVS, MLOCK,
286 	ENABLEWARMUP,
287 
288 	NMAXTARGET, NMINTARGET,
289 	NMAXTARGETTA, NMINTARGETTA,
290 	NMAXTARGETNEG, NMINTARGETNEG,
291 
292 	STABLEDIFF,
293 	DELTAPWM,
294 
295 	PWMLAMPLEVEL,
296 
297 	TMAPWMDUTY,
298 
299 	PAG1, PAG2, PAG3,
300 
301 	LEFTLEADING,
302 
303 	WAVE_XSTART,
304 
305 	WAVE_S575_XDUMMY_2400, WAVE_S575_XDUMMY_1200, WAVE_S575_XDUMMY_600,
306 
307 	ODD_DCOFFSET11, ODD_DCOFFSET12, ODD_DCOFFSET13,
308 	ODD_DCOFFSET21, ODD_DCOFFSET22, ODD_DCOFFSET23,
309 
310 	EVEN_DCOFFSET11, EVEN_DCOFFSET12, EVEN_DCOFFSET13,
311 	EVEN_DCOFFSET21, EVEN_DCOFFSET22, EVEN_DCOFFSET23,
312 
313 	DCGAIN11, DCGAIN12, DCGAIN13,
314 	DCGAIN21, DCGAIN22, DCGAIN23,
315 
316 	CRYSTALFREQ,
317 
318 	PGA1, PGA2, PGA3,
319 
320 	VGAGAIN11, VGAGAIN12, VGAGAIN13,
321 
322 	DCSTEPEVEN1, DCSTEPODD1,
323 	DCSTEPEVEN2, DCSTEPODD2,
324 	DCSTEPEVEN3, DCSTEPODD3,
325 
326 	FIRSTDCOFFSETEVEN11, FIRSTDCOFFSETODD11,
327 	FIRSTDCOFFSETEVEN12, FIRSTDCOFFSETODD12,
328 	FIRSTDCOFFSETEVEN13, FIRSTDCOFFSETODD13,
329 
330 	DCOFFSETEVEN11, DCOFFSETODD11,
331 	DCOFFSETEVEN12, DCOFFSETODD12,
332 	DCOFFSETEVEN13, DCOFFSETODD13,
333 
334 	SHADINGBASE, SHADINGFACT1, SHADINGFACT2, SHADINGFACT3,
335 
336 	PIXELDARKLEVEL,
337 
338 	EXPOSURETIME,
339 	SCANYSTART, SCANYLINES,
340 
341 	BINARYTHRESHOLDH, BINARYTHRESHOLDL,
342 	CLOSETIME,
343 	PLATFORM,
344 	SCAN_PARAM,
345 	USB1_PWM, USB2_PWM,
346 	WAVETEST,
347 	DMA_PARAM,
348 	TRUE_GRAY_PARAM,
349 	CALI_PARAM,
350 	DUMMYLINE,
351 
352 	MEXPT1, MEXPT2, MEXPT3,
353 	EXPT1, EXPT2, EXPT3,
354 
355 	STARTPOS,
356 	LINEDARLAMPOFF,
357 	MCLKIOC
358 };
359 
cfg_device_get(SANE_Int product, SANE_Int vendor)360 static SANE_Int cfg_device_get(SANE_Int product, SANE_Int vendor)
361 {
362 	struct st_myreg
363 	{
364 		SANE_Int vendor, product, device;
365 	};
366 
367 	struct st_myreg myreg[] =
368 	{
369 		/*vendor, prodct, device */
370 		{  0x4a5, 0x2211, BQ5550 }, /* BenQ 5550                  */
371 		{  0x6dc, 0x0020, UA4900 }, /* UMAX Astra 4900            */
372 		{  0x3f0, 0x2605, HP3800 }, /* HP Scanjet 3800            */
373 		{  0x3f0, 0x2805, HPG2710}, /* HP Scanjet G2710           */
374 		{  0x3f0, 0x2305, HP3970 }, /* HP Scanjet 3970c           */
375 		{  0x3f0, 0x2405, HP4070 }, /* HP Scanjet 4070 Photosmart */
376 		{  0x3f0, 0x4105, HP4370 }, /* HP Scanjet 4370            */
377 		{  0x3f0, 0x4205, HPG3010}, /* HP Scanjet G3010           */
378 		{  0x3f0, 0x4305, HPG3110}  /* HP Scanjet G3010           */
379 	};
380 
381 	SANE_Int rst = -1; /* default */
382 	SANE_Int a;
383 	SANE_Int count = sizeof(myreg) / sizeof(struct st_myreg);
384 
385 	for (a = 0; a < count; a++)
386 	{
387 		if ((vendor == myreg[a].vendor)&&(product == myreg[a].product))
388 		{
389 			rst = myreg[a].device;
390 
391 			break;
392 		}
393 	}
394 
395 	return rst;
396 }
397 
cfg_chipset_model_get(SANE_Int device)398 static SANE_Int cfg_chipset_model_get(SANE_Int device)
399 {
400 	/* returns the chipset model for each scanner */
401 	struct st_myreg
402 	{
403 		SANE_Int device, chipset;
404 	};
405 
406 	struct st_myreg myreg[] =
407 	{
408 		/*device , chipset      */
409 		{ HP3800 , RTS8822BL_03A },
410 		{ HPG2710, RTS8822BL_03A },
411 		{ BQ5550 , RTS8823L_01E  },
412 		{ UA4900 , RTS8822L_01H  },
413 		{ HP3970 , RTS8822L_01H  },
414 		{ HP4070 , RTS8822L_01H  },
415 		{ HP4370 , RTS8822L_02A  },
416 		{ HPG3010, RTS8822L_02A  },
417 		{ HPG3110, RTS8822L_02A  }
418 	};
419 
420 	SANE_Int rst = RTS8822L_01H; /* default */
421 	SANE_Int a;
422 	SANE_Int count = sizeof(myreg) / sizeof(struct st_myreg);
423 
424 	for (a = 0; a < count; a++)
425 	{
426 		if (device == myreg[a].device)
427 		{
428 			rst = myreg[a].chipset;
429 
430 			break;
431 		}
432 	}
433 
434 	return rst;
435 }
436 
cfg_chipset_get(SANE_Int model, struct st_chip *chipset)437 static SANE_Int cfg_chipset_get(SANE_Int model, struct st_chip *chipset)
438 {
439 	/* returns info and capabilities of selected chipset */
440 	SANE_Int rst = ERROR;
441 
442 	if (chipset != NULL)
443 	{
444 		struct st_chip data[] =
445 		{
446 			/* model      , capabilities, name            */
447 			{RTS8823L_01E , 0           , "RTS8823L-01E" },
448 			{RTS8822BL_03A, CAP_EEPROM  , "RTS8822BL-03A"},
449 			{RTS8822L_02A , CAP_EEPROM  , "RTS8822L-02A" },
450 			{RTS8822L_01H , CAP_EEPROM  , "RTS8822L-01H" }
451 		};
452 
453 		SANE_Int a;
454 
455 		for (a = 0; a < 4; a++)
456 		{
457 			if (model == data[a].model)
458 			{
459 				/* model found, fill information */
460 				chipset->model = data[a].model;
461 				chipset->capabilities = data[a].capabilities;
462 				chipset->name = strdup(data[a].name);
463 
464 				if (chipset->name != NULL)
465 					rst = OK;
466 
467 				break;
468 			}
469 		}
470 	}
471 
472 	return rst;
473 }
474 
475 /** SEC: Device's Buttons ---------- */
476 
cfg_buttons_get(struct st_buttons *reg)477 static SANE_Int cfg_buttons_get(struct st_buttons *reg)
478 {
479 	/* buttons for each scanner */
480 	SANE_Int rst = ERROR;
481 
482 	if (reg != NULL)
483 	{
484 		struct st_myreg
485 		{
486 			SANE_Int device;
487 			struct st_buttons value;
488 		};
489 
490 		struct st_myreg myreg[] =
491 		{
492 			/*device, {count, {btn1, btn2, btn3, btn4, btn5, btn6)} */
493 			{ BQ5550 , {3    , {0x01, 0x02, 0x08,   -1,   -1,   -1}}},
494 			{ UA4900 , {4    , {0x04, 0x08, 0x02, 0x01,   -1,   -1}}},
495 			{ HP3800 , {3    , {0x01, 0x02, 0x04,   -1,   -1,   -1}}},
496 			{ HPG2710, {3    , {0x01, 0x02, 0x04,   -1,   -1,   -1}}},
497 			{ HP3970 , {4    , {0x04, 0x08, 0x02, 0x01,   -1,   -1}}},
498 			{ HP4070 , {4    , {0x04, 0x08, 0x02, 0x01,   -1,   -1}}},
499 			{ HP4370 , {4    , {0x04, 0x08, 0x02, 0x01,   -1,   -1}}},
500 			{ HPG3010, {4    , {0x04, 0x08, 0x02, 0x01,   -1,   -1}}},
501 			{ HPG3110, {4    , {0x04, 0x08, 0x02, 0x01,   -1,   -1}}}
502 		};
503 
504 		SANE_Int a;
505 		SANE_Int count = sizeof(myreg) / sizeof(struct st_myreg);
506 
507 		for (a = 0; a < count; a++)
508 		{
509 			if (RTS_Debug->dev_model == myreg[a].device)
510 			{
511 				memcpy(reg, &myreg[a].value, sizeof(struct st_buttons));
512 				rst = OK;
513 
514 				break;
515 			}
516 		}
517 	}
518 
519 	return rst;
520 }
521 
522 /** SEC: Spectrum clock generator ---------- */
523 
cfg_sscg_get(SANE_Int *enable, SANE_Int *mode, SANE_Int *clock)524 static SANE_Int cfg_sscg_get(SANE_Int *enable, SANE_Int *mode, SANE_Int *clock)
525 {
526 	SANE_Int rst = ERROR;
527 
528 	if ((enable != NULL)&&(mode != NULL)&&(clock != NULL))
529 	{
530 		struct st_myreg
531 		{
532 			SANE_Int device;
533 			SANE_Int value[3];
534 		};
535 
536 		struct st_myreg myreg[] =
537 		{
538 			/*device, {enable, mode, clock} */
539 			{ BQ5550, {1     ,    1,     1}},
540 			{ UA4900, {1     ,    1,     0}},
541 			{ HP3800, {1     ,    1,     0}},
542 			{HPG2710, {1     ,    1,     0}},
543 			{ HP3970, {1     ,    1,     0}},
544 			{ HP4070, {1     ,    1,     0}},
545 			{ HP4370, {1     ,    1,     0}},
546 			{HPG3010, {1     ,    1,     0}},
547 			{HPG3110, {1     ,    1,     0}}
548 		};
549 
550 		SANE_Int a;
551 		SANE_Int count = sizeof(myreg) / sizeof(struct st_myreg);
552 
553 		/* default values */
554 		*enable = 0;
555 		*mode   = 0;
556 		*clock  = 3;
557 
558 		for (a = 0; a < count; a++)
559 		{
560 			if (RTS_Debug->dev_model == myreg[a].device)
561 			{
562 				*enable = myreg[a].value[0];
563 				*mode   = myreg[a].value[1];
564 				*clock  = myreg[a].value[2];
565 				rst = OK;
566 
567 				break;
568 			}
569 		}
570 	}
571 	return rst;
572 }
573 
574 /** SEC: Motors ---------- */
575 
cfg_motor_get(struct st_motorcfg *reg)576 static SANE_Int cfg_motor_get(struct st_motorcfg *reg)
577 {
578 	SANE_Int rst = ERROR;
579 
580 	if (reg != NULL)
581 	{
582 		struct st_myreg
583 		{
584 			SANE_Int device;
585 			struct st_motorcfg motor;
586 		};
587 
588 		struct st_myreg myreg[] =
589 		{
590 			/*device, {type          ,  res, freq, speed, basemove, highmove, parkmove, change}} */
591 			{ BQ5550, {MT_OUTPUTSTATE, 1200,   30,   800,        1,        0,        0,   TRUE}},
592 			{ UA4900, {MT_OUTPUTSTATE, 2400,   30,   800,        1,        0,        0,   TRUE}},
593 			{ HP3800, {MT_OUTPUTSTATE, 1200,   30,   800,        1,        0,        0,   TRUE}},
594 			{HPG2710, {MT_OUTPUTSTATE, 1200,   30,   800,        1,        0,        0,   TRUE}},
595 			{ HP3970, {MT_OUTPUTSTATE, 2400,   30,   800,        1,        0,        0,   TRUE}},
596 			{ HP4070, {MT_OUTPUTSTATE, 2400,   30,   800,        1,        0,        0,   TRUE}},
597 			{ HP4370, {MT_OUTPUTSTATE, 2400,   30,   800,        1,        0,        0,   TRUE}},
598 			{HPG3010, {MT_OUTPUTSTATE, 2400,   30,   800,        1,        0,        0,   TRUE}},
599 			{HPG3110, {MT_OUTPUTSTATE, 2400,   30,   800,        1,        0,        0,   TRUE}}
600 		};
601 
602 		SANE_Int a;
603 		SANE_Int count = sizeof(myreg) / sizeof(struct st_myreg);
604 
605 		/* default values */
606 		memset(reg, 0, sizeof(struct st_motorcfg));
607 		reg->type = -1;
608 
609 		for (a = 0; a < count; a++)
610 		{
611 			if (RTS_Debug->dev_model == myreg[a].device)
612 			{
613 				memcpy(reg, &myreg[a].motor, sizeof(struct st_motorcfg));
614 				rst = OK;
615 
616 				break;
617 			}
618 		}
619 	}
620 
621 	return rst;
622 }
623 
624 /** SEC: Sensors ---------- */
625 
cfg_sensor_get(struct st_sensorcfg *reg)626 static SANE_Int cfg_sensor_get(struct st_sensorcfg *reg)
627 {
628 	SANE_Int rst = ERROR;
629 
630 	if (reg != NULL)
631 	{
632 		struct st_myreg
633 		{
634 			SANE_Int device;
635 			struct st_sensorcfg sensor;
636 		};
637 
638 		struct st_myreg myreg[] =
639 		{
640 			/*device, {type      , name   , resolution, {chnl_colors               }, {chnl_gray  }, {rgb_order                 }, line_dist, evenodd_dist} */
641 			{ BQ5550, {CCD_SENSOR,      -1, 1200      , {CL_BLUE, CL_GREEN, CL_RED }, {CL_GREEN, 0}, {CL_BLUE, CL_GREEN, CL_RED }, 24       , 4           }},
642 			{ UA4900, {CIS_SENSOR, SNYS575, 2400      , {CL_RED , CL_GREEN, CL_BLUE}, {CL_RED  , 0}, {CL_RED , CL_GREEN, CL_BLUE}, 24       , 0           }},
643 			{ HP3800, {CCD_SENSOR, TCD2905, 2400      , {CL_RED , CL_GREEN, CL_BLUE}, {CL_RED  , 0}, {CL_RED , CL_GREEN, CL_BLUE}, 64       , 8           }},
644 			{HPG2710, {CCD_SENSOR, TCD2905, 2400      , {CL_RED , CL_GREEN, CL_BLUE}, {CL_RED  , 0}, {CL_RED , CL_GREEN, CL_BLUE}, 64       , 8           }},
645 			{ HP3970, {CCD_SENSOR, TCD2952, 2400      , {CL_RED , CL_GREEN, CL_BLUE}, {CL_RED  , 0}, {CL_RED , CL_GREEN, CL_BLUE}, 24       , 4           }},
646 			{ HP4070, {CCD_SENSOR, TCD2952, 2400      , {CL_RED , CL_GREEN, CL_BLUE}, {CL_RED  , 0}, {CL_RED , CL_GREEN, CL_BLUE}, 24       , 4           }},
647 			{ HP4370, {CCD_SENSOR, TCD2958, 4800      , {CL_RED , CL_GREEN, CL_BLUE}, {CL_RED  , 0}, {CL_RED , CL_GREEN, CL_BLUE}, 128      , 6           }},
648 			{HPG3010, {CCD_SENSOR, TCD2958, 4800      , {CL_RED , CL_GREEN, CL_BLUE}, {CL_RED  , 0}, {CL_RED , CL_GREEN, CL_BLUE}, 128      , 6           }},
649 			{HPG3110, {CCD_SENSOR, TCD2958, 4800      , {CL_RED , CL_GREEN, CL_BLUE}, {CL_RED  , 0}, {CL_RED , CL_GREEN, CL_BLUE}, 128      , 6           }}
650 		};
651 
652 		SANE_Int a;
653 		SANE_Int count = sizeof(myreg) / sizeof(struct st_myreg);
654 
655 		/* default values */
656 		memset(reg, 0, sizeof(struct st_sensorcfg));
657 		reg->type = -1;
658 
659 		for (a = 0; a < count; a++)
660 		{
661 			if (RTS_Debug->dev_model == myreg[a].device)
662 			{
663 				memcpy(reg, &myreg[a].sensor, sizeof(struct st_sensorcfg));
664 				rst = OK;
665 
666 				break;
667 			}
668 		}
669 	}
670 
671 	return rst;
672 }
673 
674 /** SEC: Reference voltages ---------- */
675 
hp3800_refvoltages(SANE_Int usb, SANE_Int sensor, SANE_Byte *vrts, SANE_Byte *vrms, SANE_Byte *vrbs)676 static void hp3800_refvoltages(SANE_Int usb, SANE_Int sensor, SANE_Byte *vrts, SANE_Byte *vrms, SANE_Byte *vrbs)
677 {
678 	/* this function returns top, middle and bottom reference voltages for each scanner */
679 	struct st_reg
680 	{
681 		SANE_Int usb;
682 		SANE_Int sensor;
683 		SANE_Byte values[3];
684 	};
685 
686 	struct st_reg myreg[] =
687 	{
688 		/* usb, sensor    , {vrts, vrms, vrbs} */
689 		{USB20, CCD_SENSOR, {   2,    3,    2}},
690 		{USB11, CCD_SENSOR, {   2,    3,    2}},
691 	};
692 
693 	if ((vrts != NULL)&&(vrms != NULL)&&(vrbs != NULL))
694 	{
695 		SANE_Int a;
696 		SANE_Int count = sizeof(myreg) / sizeof(struct st_reg);
697 
698 		*vrts = *vrms = *vrbs = 0;
699 
700 		for (a = 0; a < count; a++)
701 		{
702 			if ((myreg[a].usb == usb)&&(myreg[a].sensor == sensor))
703 			{
704 				*vrts = myreg[a].values[0];
705 				*vrms = myreg[a].values[1];
706 				*vrbs = myreg[a].values[2];
707 			}
708 		}
709 	}
710 }
711 
hp3970_refvoltages(SANE_Int usb, SANE_Int sensor, SANE_Byte *vrts, SANE_Byte *vrms, SANE_Byte *vrbs)712 static void hp3970_refvoltages(SANE_Int usb, SANE_Int sensor, SANE_Byte *vrts, SANE_Byte *vrms, SANE_Byte *vrbs)
713 {
714 	/* this function returns top, middle and bottom reference voltages for each scanner */
715 	struct st_reg
716 	{
717 		SANE_Int usb;
718 		SANE_Int sensor;
719 		SANE_Byte values[3];
720 	};
721 
722 	struct st_reg myreg[] =
723 	{
724 		/* usb, sensor     , {vrts, vrms, vrbs} */
725 		{USB20, CCD_SENSOR, {   0,    0,    0}},
726 		{USB11, CCD_SENSOR, {   0,    0,    0}},
727 		{USB20, CIS_SENSOR, {   0,    0,    0}},
728 		{USB11, CIS_SENSOR, {   0,    0,    0}}
729 	};
730 
731 	if ((vrts != NULL)&&(vrms != NULL)&&(vrbs != NULL))
732 	{
733 		SANE_Int a;
734 		SANE_Int count = sizeof(myreg) / sizeof(struct st_reg);
735 
736 		*vrts = *vrms = *vrbs = 0;
737 
738 		for (a = 0; a < count; a++)
739 		{
740 			if ((myreg[a].usb == usb)&&(myreg[a].sensor == sensor))
741 			{
742 				*vrts = myreg[a].values[0];
743 				*vrms = myreg[a].values[1];
744 				*vrbs = myreg[a].values[2];
745 			}
746 		}
747 	}
748 }
749 
cfg_refvoltages_get(SANE_Int sensortype, SANE_Byte *vrts, SANE_Byte *vrms, SANE_Byte *vrbs)750 static void cfg_refvoltages_get(SANE_Int sensortype, SANE_Byte *vrts, SANE_Byte *vrms, SANE_Byte *vrbs)
751 {
752 	/* this function returns top, middle and bottom reference voltages for each scanner */
753 	switch(RTS_Debug->dev_model)
754 	{
755 		case HP3800:
756 		case HPG2710:
757 			hp3800_refvoltages(RTS_Debug->usbtype, sensortype, vrts, vrms, vrbs);
758 			break;
759 		default:
760 			/* at this momment all analyzed scanners have the same values */
761 			hp3970_refvoltages(RTS_Debug->usbtype, sensortype, vrts, vrms, vrbs);
762 			break;
763 	}
764 }
765 
766 /** SEC: Calibration Offset ---------- */
767 
hp3800_offset(SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width)768 static void hp3800_offset(SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width)
769 {
770 	/* this function provides left coordinate and width to calculate offset
771 	   Sensor = Toshiba T2905
772 	 */
773 
774 	struct st_ofst
775 	{
776 		SANE_Int left;
777 		SANE_Int width;
778 	};
779 
780 	struct st_reg
781 	{
782 		SANE_Int resolution;
783 		struct st_ofst values[3];
784 	};
785 
786 	struct st_reg myreg[] =
787 	{
788 		/*res , {ref(L,W), tma(L,W), neg(L,W)} */
789 		{ 2400, {{15, 20}, {15, 20}, {15, 20}}},
790 		{ 1200, {{10, 10}, {10, 10}, {10, 10}}},
791 		{  600, {{ 2, 10}, { 5, 10}, { 5, 10}}},
792 		{  300, {{ 1,  5}, { 1,  5}, { 1,  5}}},
793 		{  150, {{ 0,  3}, { 0,  3}, { 0,  3}}}
794 	};
795 
796 	if ((left != NULL)&&(width != NULL))
797 	{
798 		SANE_Int a;
799 		SANE_Int count = sizeof(myreg) / sizeof(struct st_reg);
800 
801 		for (a = 0; a < count; a++)
802 		{
803 			if (myreg[a].resolution == resolution)
804 			{
805 				scantype--;
806 
807 				*left  = myreg[a].values[scantype].left;
808 				*width = myreg[a].values[scantype].width;
809 
810 				break;
811 			}
812 		}
813 	}
814 }
815 
hp3970_offset(SANE_Int sensor, SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width)816 static void hp3970_offset(SANE_Int sensor, SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width)
817 {
818 	/* this function provides left coordinate and width to calculate offset */
819 
820 	struct st_ofst
821 	{
822 		SANE_Int left;
823 		SANE_Int width;
824 	};
825 
826 	struct st_reg
827 	{
828 		SANE_Int sensor;
829 		SANE_Int resolution;
830 		struct st_ofst values[3];
831 	};
832 
833 	struct st_reg myreg[] =
834 	{
835 		/* sensor   , res , {ref(L,W), tma(L,W), neg(L,W)} */
836 		{CCD_SENSOR, 2400, {{16, 20}, {16, 20}, {16, 20}}},
837 		{CCD_SENSOR, 1200, {{16, 10}, {16, 10}, {16, 10}}},
838 		{CCD_SENSOR,  600, {{15, 10}, {15, 10}, {15, 10}}},
839 		{CCD_SENSOR,  300, {{ 7,  5}, { 7,  5}, { 7,  5}}},
840 		{CCD_SENSOR,  200, {{ 7,  3}, { 7,  3}, { 7,  3}}},
841 		{CCD_SENSOR,  100, {{ 3,  3}, { 3,  3}, { 3,  3}}},
842 
843 		/* sensor  , res , {ref(L,W), tma(L,W), neg(L,W)} */
844 		{CIS_SENSOR, 2400, {{84, 20}, {84, 20}, {84, 20}}},
845 		{CIS_SENSOR, 1200, {{54, 10}, {54, 10}, {54, 10}}},
846 		{CIS_SENSOR,  600, {{28, 10}, {28, 10}, {28, 10}}},
847 		{CIS_SENSOR,  300, {{15,  5}, {15,  5}, {15,  5}}},
848 		{CIS_SENSOR,  200, {{ 5,  3}, { 5,  3}, { 5,  3}}},
849 		{CIS_SENSOR,  100, {{ 2,  3}, { 2,  3}, { 2,  3}}}
850 	};
851 
852 	if ((left != NULL)&&(width != NULL))
853 	{
854 		SANE_Int a;
855 		SANE_Int count = sizeof(myreg) / sizeof(struct st_reg);
856 
857 		for (a = 0; a < count; a++)
858 		{
859 			if ((myreg[a].sensor == sensor)&&(myreg[a].resolution == resolution))
860 			{
861 				scantype--;
862 
863 				*left  = myreg[a].values[scantype].left;
864 				*width = myreg[a].values[scantype].width;
865 
866 				break;
867 			}
868 		}
869 	}
870 }
871 
hp4370_offset(SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width)872 static void hp4370_offset(SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width)
873 {
874 	/* this function provides left coordinate and width to calculate offset */
875 
876 	struct st_ofst
877 	{
878 		SANE_Int left;
879 		SANE_Int width;
880 	};
881 
882 	struct st_reg
883 	{
884 		SANE_Int resolution;
885 		struct st_ofst values[3];
886 	};
887 
888 	struct st_reg myreg[] =
889 	{
890 		/* res, {ref(L,W), tma(L,W), neg(L,W)} */
891 		{ 4800, {{42, 20}, {42, 20}, {52, 26}}},
892 		{ 2400, {{14, 20}, {14, 20}, {14, 26}}},
893 		{ 1200, {{ 8, 14}, { 8, 14}, { 8, 14}}},
894 		{  600, {{ 4,  8}, { 4,  8}, { 4,  8}}},
895 		{  300, {{ 2,  4}, { 2,  4}, { 2,  4}}},
896 		{  150, {{ 1,  2}, { 1,  2}, { 1,  2}}}
897 	};
898 
899 	if ((left != NULL)&&(width != NULL))
900 	{
901 		SANE_Int a;
902 		SANE_Int count = sizeof(myreg) / sizeof(struct st_reg);
903 
904 		for (a = 0; a < count; a++)
905 		{
906 			if (myreg[a].resolution == resolution)
907 			{
908 				scantype--;
909 
910 				*left  = myreg[a].values[scantype].left;
911 				*width = myreg[a].values[scantype].width;
912 
913 				break;
914 			}
915 		}
916 	}
917 }
918 
ua4900_offset(SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width)919 static void ua4900_offset(SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width)
920 {
921 	/* this function provides left coordinate and width to calculate offset */
922 
923 	struct st_ofst
924 	{
925 		SANE_Int left;
926 		SANE_Int width;
927 	};
928 
929 	struct st_reg
930 	{
931 		SANE_Int resolution;
932 		struct st_ofst values[3];
933 	};
934 
935 	struct st_reg myreg[] =
936 	{
937 		/* res , {ref(L,W), tma(L,W), neg(L,W)} */
938 		{  2400, {{20, 20}, {16, 20}, {16, 20}}},
939 		{  1200, {{20, 10}, {10, 10}, {10, 10}}},
940 		{   600, {{ 7, 10}, {15, 10}, {15, 10}}},
941 		{   300, {{ 5, 10}, { 7,  8}, { 7,  8}}},
942 		{   200, {{ 2, 10}, { 7,  6}, { 7,  6}}},
943 		{   100, {{ 0, 10}, { 3,  4}, { 3,  4}}}
944 	};
945 
946 	if ((left != NULL)&&(width != NULL))
947 	{
948 		SANE_Int a;
949 		SANE_Int count = sizeof(myreg) / sizeof(struct st_reg);
950 
951 		for (a = 0; a < count; a++)
952 		{
953 			if (myreg[a].resolution == resolution)
954 			{
955 				scantype--;
956 
957 				*left  = myreg[a].values[scantype].left;
958 				*width = myreg[a].values[scantype].width;
959 
960 				break;
961 			}
962 		}
963 	}
964 }
965 
cfg_offset_get(SANE_Int sensortype, SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width)966 static void cfg_offset_get(SANE_Int sensortype, SANE_Int resolution, SANE_Int scantype, SANE_Int *left, SANE_Int *width)
967 {
968 	switch(RTS_Debug->dev_model)
969 	{
970 		case UA4900:
971 			ua4900_offset(resolution, scantype, left, width);
972 			break;
973 
974 		case HP3800:
975 		case HPG2710:
976 			hp3800_offset(resolution, scantype, left, width);
977 			break;
978 
979 		case HPG3010:
980 		case HPG3110:
981 		case HP4370:
982 			hp4370_offset(resolution, scantype, left, width);
983 			break;
984 
985 		default:
986 			hp3970_offset(sensortype, resolution, scantype, left, width);
987 			break;
988 	}
989 }
990 
991 /** SEC: Device constraints ---------- */
992 
cfg_constrains_get(struct st_constrains *constrain)993 static SANE_Int cfg_constrains_get(struct st_constrains *constrain)
994 {
995 	SANE_Int rst = ERROR;
996 
997 	struct st_reg
998 	{
999 		SANE_Int device;
1000 		struct st_constrains constrain;
1001 	};
1002 
1003 	struct st_reg reg[] =
1004 	{
1005 		/* constraints are set in millimeters */
1006 		/*device ,   reflective               , negative                  , transparent                   */
1007 		/*       , {{left, width, top, height}, {left, width, top, height}, {left, width, top, height}}}, */
1008 		{ BQ5550 , {{   0,   220,   0,    300}, {  88,    42,   0,     83}, {  88,    42,   0,     83}}},
1009 		{ HP3800 , {{   0,   220,   0,    300}, {  89,    45,   0,     85}, {  89,    45,   0,    100}}},
1010 		{HPG2710 , {{   0,   220,   0,    300}, {  89,    45,   0,     85}, {  89,    45,   0,    100}}},
1011 		{ HP3970 , {{   0,   220,   0,    300}, {  88,    42,   0,     83}, {  88,    42,   0,     83}}},
1012 		{ HP4070 , {{   0,   220,   0,    300}, {  58,    99,   0,    197}, {  58,    99,   0,    197}}},
1013 		{ HP4370 , {{   0,   220,   0,    300}, {  90,    45,   0,     85}, {  90,    45,   0,    100}}},
1014 		{ UA4900 , {{   0,   220,   0,    300}, {  88,    42,   0,     83}, {  88,    42,   0,     83}}},
1015 		{HPG3010 , {{   0,   220,   0,    300}, {  90,    45,   0,     85}, {  89,    45,   0,    100}}},
1016 		{HPG3110 , {{   0,   220,   0,    300}, {  92,    28,   0,    190}, {  85,    44,   0,    190}}}
1017 	};
1018 
1019 	if (constrain != NULL)
1020 	{
1021 		SANE_Int a;
1022 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1023 
1024 		for (a = 0; a < count; a++)
1025 		{
1026 			if (reg[a].device == RTS_Debug->dev_model)
1027 			{
1028 				memcpy(constrain, &reg[a].constrain, sizeof(struct st_constrains));
1029 				rst = OK;
1030 				break;
1031 			}
1032 		}
1033 	}
1034 
1035 	return rst;
1036 }
1037 
1038 /** SEC: Motor resource ------------------- */
cfg_motor_resource_get(SANE_Byte *size)1039 static SANE_Byte *cfg_motor_resource_get(SANE_Byte *size)
1040 {
1041 	/* this function returns the proper motor resources for a given device */
1042 	SANE_Byte *rst = NULL;
1043 
1044 	/* Until now, resource size is always 32 bytes */
1045 	rst = (SANE_Byte *)malloc(sizeof(SANE_Byte) * 32);
1046 	if (size != NULL)
1047 		*size = 0;
1048 
1049 	if (rst != NULL)
1050 	{
1051 		memset(rst, 0, sizeof(SANE_Byte) * 32);
1052 
1053 		switch(RTS_Debug->dev_model)
1054 		{
1055 			case BQ5550:
1056 				{
1057 					SANE_Byte Resource[] = {0xff, 0xb4, 0xb0, 0xd4, 0xd0, 0x70, 0x50, 0x54, 0x30, 0x34, 0x14, 0x38, 0x18, 0x0c, 0x08, 0x28, 0x04, 0x24, 0x20, 0x44, 0x40, 0xe0, 0xc0, 0xc4, 0xa0, 0xa4, 0x84, 0xa8, 0x88, 0x9c, 0x98, 0xb8};
1058 					memcpy(rst, &Resource, sizeof(SANE_Byte) * 32);
1059 					if (size != NULL)
1060 						*size = 32;
1061 				}
1062 				break;
1063 			default:
1064 				{
1065 					SANE_Byte Resource[] = {0xff, 0x90, 0xb0, 0xd4, 0xd0, 0x70, 0x50, 0x54, 0x30, 0x10, 0x14, 0x38, 0x18, 0x0c, 0x08, 0x28, 0x04, 0x00, 0x20, 0x44, 0x40, 0xe0, 0xc0, 0xc4, 0xa0, 0x80, 0x84, 0xa8, 0x88, 0x9c, 0x98, 0xb8};
1066 					memcpy(rst, &Resource, sizeof(SANE_Byte) * 32);
1067 					if (size != NULL)
1068 						*size = 32;
1069 				}
1070 				break;
1071 		}
1072 	}
1073 
1074 	return rst;
1075 }
1076 
1077 /** SEC: Auto reference position ---------- */
1078 
cfg_autoref_get(struct st_autoref *reg)1079 static void cfg_autoref_get(struct st_autoref *reg)
1080 {
1081 	if (reg != NULL)
1082 	{
1083 		struct st_reg
1084 		{
1085 			SANE_Int device;
1086 			struct st_autoref value;
1087 		};
1088 
1089 		struct st_reg myreg[] =
1090 		{
1091 			/* x and y offsets are based on 2400 dpi */
1092 			/* device, { type              , x  , y  , resolution, extern_boundary}*/
1093 			{ BQ5550 , {REF_NONE           , -40, -40, 600       , 40}},
1094 			{ UA4900 , {REF_NONE           , -40, -40, 600       , 40}},
1095 			{ HP3800 , {REF_TAKEFROMSCANNER,  88, 624, 600       , 40}},
1096 			{HPG2710 , {REF_TAKEFROMSCANNER,  88, 624, 600       , 40}},
1097 			{ HP3970 , {REF_TAKEFROMSCANNER,  88, 717, 600       , 40}},
1098 			{ HP4070 , {REF_TAKEFROMSCANNER,  88, 717, 600       , 40}},
1099 			{ HP4370 , {REF_TAKEFROMSCANNER,  88, 717, 600       , 40}},
1100 			{HPG3010 , {REF_TAKEFROMSCANNER,  88, 717, 600       , 40}},
1101 			{HPG3110 , {REF_TAKEFROMSCANNER,  88, 717, 600       , 40}}
1102 		};
1103 
1104 		SANE_Int a;
1105 		SANE_Int count = sizeof(myreg) / sizeof(struct st_reg);
1106 
1107 		for (a = 0; a < count; a++)
1108 		{
1109 			if (myreg[a].device == RTS_Debug->dev_model)
1110 			{
1111 				memcpy(reg, &myreg[a].value, sizeof(struct st_autoref));
1112 				break;
1113 			}
1114 		}
1115 	}
1116 }
1117 
hp3800_effectivepixel(SANE_Int resolution)1118 static SANE_Int hp3800_effectivepixel(SANE_Int resolution)
1119 {
1120 	struct st_reg
1121 	{
1122 		SANE_Int resolution;
1123 		SANE_Int pixel;
1124 	};
1125 
1126 	struct st_reg reg[] =
1127 	{
1128 		/* res , pixel */
1129 		{  2400, 134 },
1130 		{  1200, 134 },
1131 		{   600, 230 },
1132 		{   300, 172 },
1133 		{   200, 230 },
1134 		{   100, 230 }
1135 	};
1136 
1137 	SANE_Int a;
1138 	SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1139 	SANE_Int rst = 230; /* default */
1140 
1141 	for (a = 0; a < count; a++)
1142 	{
1143 		if (reg[a].resolution == resolution)
1144 		{
1145 			rst = reg[a].pixel;
1146 			break;
1147 		}
1148 	}
1149 
1150 	return rst;
1151 }
1152 
hp3970_effectivepixel(SANE_Int sensor, SANE_Int resolution)1153 static SANE_Int hp3970_effectivepixel(SANE_Int sensor, SANE_Int resolution)
1154 {
1155 	struct st_reg
1156 	{
1157 		SANE_Int resolution;
1158 		SANE_Int pixel[2];
1159 	};
1160 
1161 	struct st_reg reg[] =
1162 	{
1163 		/* res , {Toshiba, sony}} */
1164 		{  2400, {134    , 218 }},
1165 		{  1200, {134    , 240 }},
1166 		{   600, {230    , 242 }},
1167 		{   300, {160    , 172 }},
1168 		{   200, {230    , 242 }},
1169 		{   100, {230    , 242 }}
1170 	};
1171 
1172 	SANE_Int a;
1173 	SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1174 	SANE_Int rst = 230; /* default */
1175 
1176 	for (a = 0; a < count; a++)
1177 	{
1178 		if (reg[a].resolution == resolution)
1179 		{
1180 			rst = (sensor == CCD_SENSOR)? reg[a].pixel[0] : reg[a].pixel[1];
1181 			break;
1182 		}
1183 	}
1184 
1185 	return rst;
1186 }
1187 
hp4370_effectivepixel(SANE_Int resolution)1188 static SANE_Int hp4370_effectivepixel(SANE_Int resolution)
1189 {
1190 	struct st_reg
1191 	{
1192 		SANE_Int resolution;
1193 		SANE_Int pixel;
1194 	};
1195 
1196 	struct st_reg reg[] =
1197 	{
1198 		/* res , pxl */
1199 		{  4800, 134},
1200 		{  2400, 134},
1201 		{  1200, 134},
1202 		{   600, 230},
1203 		{   300, 230},
1204 		{   150, 230}
1205 	};
1206 
1207 	SANE_Int a;
1208 	SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1209 	SANE_Int rst = 230; /* default */
1210 
1211 	for (a = 0; a < count; a++)
1212 	{
1213 		if (reg[a].resolution == resolution)
1214 		{
1215 			rst = reg[a].pixel;
1216 			break;
1217 		}
1218 	}
1219 
1220 	return rst;
1221 }
1222 
ua4900_effectivepixel(SANE_Int resolution)1223 static SANE_Int ua4900_effectivepixel(SANE_Int resolution)
1224 {
1225 	struct st_reg
1226 	{
1227 		SANE_Int resolution;
1228 		SANE_Int pixel;
1229 	};
1230 
1231 	struct st_reg reg[] =
1232 	{
1233 		/* res , pixel */
1234 		{  2400, 134 },
1235 		{  1200, 134 },
1236 		{   600, 230 },
1237 		{   300, 172 },
1238 		{   200, 230 },
1239 		{   100, 230 }
1240 	};
1241 
1242 	SANE_Int a;
1243 	SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1244 	SANE_Int rst = 230; /* default */
1245 
1246 	for (a = 0; a < count; a++)
1247 	{
1248 		if (reg[a].resolution == resolution)
1249 		{
1250 			rst = reg[a].pixel;
1251 			break;
1252 		}
1253 	}
1254 
1255 	return rst;
1256 }
1257 
cfg_effectivepixel_get(SANE_Int sensortype, SANE_Int resolution)1258 static SANE_Int cfg_effectivepixel_get(SANE_Int sensortype, SANE_Int resolution)
1259 {
1260 	SANE_Int rst;
1261 
1262 	switch(RTS_Debug->dev_model)
1263 	{
1264 		case UA4900:
1265 			rst = ua4900_effectivepixel(resolution);
1266 			break;
1267 
1268 		case HP3800:
1269 		case HPG2710:
1270 			rst = hp3800_effectivepixel(resolution);
1271 			break;
1272 
1273 		case HP4370:
1274 		case HPG3010:
1275 		case HPG3110:
1276 			rst = hp4370_effectivepixel(resolution);
1277 			break;
1278 
1279 		default:
1280 			rst = hp3970_effectivepixel(sensortype, resolution);
1281 			break;
1282 	}
1283 
1284 	return rst;
1285 }
1286 
1287 /** SEC: Gain and offset values ---------- */
1288 
bq5550_gainoffset(SANE_Int usb, struct st_gain_offset *myreg)1289 static SANE_Int bq5550_gainoffset(SANE_Int usb, struct st_gain_offset *myreg)
1290 {
1291 	struct st_reg
1292 	{
1293 		SANE_Int usb;
1294 		struct st_gain_offset values;
1295 	};
1296 
1297 	struct st_reg reg[] =
1298 	{
1299 		/* usb  , {{edcg1        }, {edcg2  }, {odcg1        }, {odcg2  }, {pag    }, {vgag1     }, {vgag2  }}} */
1300 		{  USB20, {{264, 264, 264}, {0, 0, 0}, {262, 262, 262}, {0, 0, 0}, {3, 3, 3}, {27, 27, 27}, {4, 4, 4}}},
1301 		{  USB11, {{264, 264, 264}, {0, 0, 0}, {262, 262, 262}, {0, 0, 0}, {3, 3, 3}, {27, 27, 27}, {4, 4, 4}}}
1302 	};
1303 
1304 	SANE_Int rst = ERROR;
1305 
1306 	if (myreg != NULL)
1307 	{
1308 		SANE_Int a;
1309 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1310 
1311 		for (a = 0; a < count; a++)
1312 		{
1313 			if (reg[a].usb == usb)
1314 			{
1315 				memcpy(myreg, &reg[a].values, sizeof(struct st_gain_offset));
1316 				rst = OK;
1317 				break;
1318 			}
1319 		}
1320 	}
1321 
1322 	return rst;
1323 }
1324 
hp3800_gainoffset(SANE_Int usb, struct st_gain_offset *myreg)1325 static SANE_Int hp3800_gainoffset(SANE_Int usb, struct st_gain_offset *myreg)
1326 {
1327 	struct st_reg
1328 	{
1329 		SANE_Int usb;
1330 		struct st_gain_offset values;
1331 	};
1332 
1333 	struct st_reg reg[] =
1334 	{
1335 		/* usb  , {{edcg1  }, {edcg2  }, {odcg1  }, {odcg2  }, {pag    }, {vgag1  }, {vgag2  }}} */
1336 		{  USB20, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {2, 2, 2}, {4, 4, 4}, {4, 4, 4}}},
1337 		{  USB11, {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {2, 2, 2}, {4, 4, 4}, {4, 4, 4}}}
1338 	};
1339 
1340 	SANE_Int rst = ERROR;
1341 
1342 	if (myreg != NULL)
1343 	{
1344 		SANE_Int a;
1345 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1346 
1347 		for (a = 0; a < count; a++)
1348 		{
1349 			if (reg[a].usb == usb)
1350 			{
1351 				memcpy(myreg, &reg[a].values, sizeof(struct st_gain_offset));
1352 				rst = OK;
1353 				break;
1354 			}
1355 		}
1356 	}
1357 
1358 	return rst;
1359 }
1360 
hp3970_gainoffset(SANE_Int usb, SANE_Int sensor, struct st_gain_offset *myreg)1361 static SANE_Int hp3970_gainoffset(SANE_Int usb, SANE_Int sensor, struct st_gain_offset *myreg)
1362 {
1363 	struct st_reg
1364 	{
1365 		SANE_Int usb;
1366 		SANE_Int sensor;
1367 		struct st_gain_offset values;
1368 	};
1369 
1370 	struct st_reg reg[] =
1371 	{
1372 		/* usb  , sensor    , {{edcg1        }, {edcg2  }, {odcg1        }, {odcg2  }, {pag    }, {vgag1  }, {vgag2  }}} */
1373 		{  USB20, CCD_SENSOR, {{280, 266, 286}, {0, 0, 0}, {280, 266, 286}, {0, 0, 0}, {3, 3, 3}, {7, 4, 4}, {7, 4, 4}}},
1374 		{  USB11, CCD_SENSOR, {{280, 266, 286}, {0, 0, 0}, {280, 266, 286}, {0, 0, 0}, {3, 3, 3}, {7, 4, 4}, {7, 4, 4}}},
1375 
1376 		{  USB20, CIS_SENSOR, {{280, 266, 286}, {0, 0, 0}, {280, 266, 286}, {0, 0, 0}, {3, 3, 3}, {7, 4, 4}, {7, 4, 4}}},
1377 		{  USB11, CIS_SENSOR, {{280, 266, 286}, {0, 0, 0}, {280, 266, 286}, {0, 0, 0}, {3, 3, 3}, {7, 4, 4}, {7, 4, 4}}}
1378 	};
1379 
1380 	SANE_Int rst = ERROR;
1381 
1382 	if (myreg != NULL)
1383 	{
1384 		SANE_Int a;
1385 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1386 
1387 		for (a = 0; count < 4; a++)
1388 		{
1389 			if ((reg[a].usb == usb)&&(reg[a].sensor == sensor))
1390 			{
1391 				memcpy(myreg, &reg[a].values, sizeof(struct st_gain_offset));
1392 				rst = OK;
1393 				break;
1394 			}
1395 		}
1396 	}
1397 
1398 	return rst;
1399 }
1400 
hp4370_gainoffset(SANE_Int usb, struct st_gain_offset *myreg)1401 static SANE_Int hp4370_gainoffset(SANE_Int usb, struct st_gain_offset *myreg)
1402 {
1403 	struct st_reg
1404 	{
1405 		SANE_Int usb;
1406 		struct st_gain_offset values;
1407 	};
1408 
1409 	struct st_reg reg[] =
1410 	{
1411 		/* usb  , {{edcg1        }, {edcg2  }, {odcg1        }, {odcg2  }, {pag    }, {vgag1  }, {vgag2  }} */
1412 		{  USB20, {{280, 266, 286}, {0, 0, 0}, {280, 266, 286}, {0, 0, 0}, {3, 3, 3}, {7, 4, 4}, {7, 4, 4}}},
1413 		{  USB11, {{280, 266, 286}, {0, 0, 0}, {280, 266, 286}, {0, 0, 0}, {3, 3, 3}, {7, 4, 4}, {7, 4, 4}}}
1414 	};
1415 
1416 	SANE_Int rst = ERROR;
1417 
1418 	if (myreg != NULL)
1419 	{
1420 		SANE_Int a;
1421 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1422 
1423 		for (a = 0; a < count; a++)
1424 		{
1425 			if (reg[a].usb == usb)
1426 			{
1427 				memcpy(myreg, &reg[a].values, sizeof(struct st_gain_offset));
1428 				rst = OK;
1429 				break;
1430 			}
1431 		}
1432 	}
1433 
1434 	return rst;
1435 }
1436 
ua4900_gainoffset(SANE_Int usb, struct st_gain_offset *myreg)1437 static SANE_Int ua4900_gainoffset(SANE_Int usb, struct st_gain_offset *myreg)
1438 {
1439 	struct st_reg
1440 	{
1441 		SANE_Int usb;
1442 		struct st_gain_offset values;
1443 	};
1444 
1445 	struct st_reg reg[] =
1446 	{
1447 		/* usb  , {{edcg1        }, {edcg2  }, {odcg1        }, {odcg2  }, {pag    }, {vgag1     }, {vgag2  }}} */
1448 		{  USB20, {{321, 321, 321}, {0, 0, 0}, {321, 321, 321}, {0, 0, 0}, {0, 0, 0}, {24, 21, 19}, {8, 8, 8}}},
1449 		{  USB11, {{321, 321, 321}, {0, 0, 0}, {321, 321, 321}, {0, 0, 0}, {0, 0, 0}, {16, 16, 16}, {4, 4, 4}}}
1450 	};
1451 
1452 	SANE_Int rst = ERROR;
1453 
1454 	if (myreg != NULL)
1455 	{
1456 		SANE_Int a;
1457 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1458 
1459 		for (a = 0; a < count; a++)
1460 		{
1461 			if (reg[a].usb == usb)
1462 			{
1463 				memcpy(myreg, &reg[a].values, sizeof(struct st_gain_offset));
1464 				rst = OK;
1465 				break;
1466 			}
1467 		}
1468 	}
1469 
1470 	return rst;
1471 }
1472 
cfg_gainoffset_get(SANE_Int sensortype, struct st_gain_offset *reg)1473 static SANE_Int cfg_gainoffset_get(SANE_Int sensortype, struct st_gain_offset *reg)
1474 {
1475 	SANE_Int rst;
1476 
1477 	switch(RTS_Debug->dev_model)
1478 	{
1479 		case BQ5550:
1480 			rst = bq5550_gainoffset(RTS_Debug->usbtype, reg);
1481 			break;
1482 
1483 		case UA4900:
1484 			rst = ua4900_gainoffset(RTS_Debug->usbtype, reg);
1485 			break;
1486 
1487 		case HP3800:
1488 		case HPG2710:
1489 			rst = hp3800_gainoffset(RTS_Debug->usbtype, reg);
1490 			break;
1491 
1492 		case HP4370:
1493 		case HPG3010:
1494 		case HPG3110:
1495 			rst = hp4370_gainoffset(RTS_Debug->usbtype, reg);
1496 			break;
1497 
1498 		default:
1499 			rst = hp3970_gainoffset(RTS_Debug->usbtype, sensortype, reg);
1500 			break;
1501 	}
1502 
1503 	return rst;
1504 }
1505 
1506 /** SEC: Pulse-width modulation check stable ---------- */
1507 
hp3800_checkstable(SANE_Int lamp, struct st_checkstable *check)1508 static SANE_Int hp3800_checkstable(SANE_Int lamp, struct st_checkstable *check)
1509 {
1510 	struct st_reg
1511 	{
1512 		SANE_Int lamp;
1513 		struct st_checkstable values;
1514 	};
1515 
1516 	struct st_reg reg[] =
1517 	{
1518 		/* lamp    , { diff, interval, tottime } */
1519 		{  0       , { 100.,      200,  10000}},
1520 		{  FLB_LAMP, { 100.,      200,  10000}},
1521 		{  TMA_LAMP, { 100.,      200,  10000}}
1522 	};
1523 
1524 	SANE_Int rst = ERROR;
1525 
1526 	SANE_Int a;
1527 	SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1528 
1529 	for (a = 0; a < count; a++)
1530 	{
1531 		if (reg[a].lamp == lamp)
1532 		{
1533 			memcpy(check, &reg[a].values, sizeof(struct st_checkstable));
1534 			rst = OK;
1535 			break;
1536 		}
1537 	}
1538 
1539 	return rst;
1540 }
1541 
hp3970_checkstable(SANE_Int lamp, struct st_checkstable *check)1542 static SANE_Int hp3970_checkstable(SANE_Int lamp, struct st_checkstable *check)
1543 {
1544 	struct st_reg
1545 	{
1546 		SANE_Int lamp;
1547 		struct st_checkstable values;
1548 	};
1549 
1550 	struct st_reg reg[] =
1551 	{
1552 		/* lamp    , { diff, interval, tottime } */
1553 		{  0       , {1000.,      200,   5000}},
1554 		{  FLB_LAMP, { 500.,      200,   5000}},
1555 		{  TMA_LAMP, { 500.,      200,   5000}}
1556 	};
1557 
1558 	SANE_Int rst = ERROR;
1559 
1560 	SANE_Int a;
1561 	SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1562 
1563 	for (a = 0; a < count; a++)
1564 	{
1565 		if (reg[a].lamp == lamp)
1566 		{
1567 			memcpy(check, &reg[a].values, sizeof(struct st_checkstable));
1568 			rst = OK;
1569 			break;
1570 		}
1571 	}
1572 
1573 	return rst;
1574 }
1575 
hp4370_checkstable(SANE_Int lamp, struct st_checkstable *check)1576 static SANE_Int hp4370_checkstable(SANE_Int lamp, struct st_checkstable *check)
1577 {
1578 	struct st_reg
1579 	{
1580 		SANE_Int lamp;
1581 		struct st_checkstable values;
1582 	};
1583 
1584 	struct st_reg reg[] =
1585 	{
1586 		/* lamp    , { diff, interval, tottime } */
1587 		{  0       , { 100.,      200,   5000}},
1588 		{  FLB_LAMP, { 300.,      200,   5000}},
1589 		{  TMA_LAMP, {   0.,      200,  25000}}
1590 	};
1591 
1592 	SANE_Int rst = ERROR;
1593 
1594 	SANE_Int a;
1595 	SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1596 
1597 	for (a = 0; a < count; a++)
1598 	{
1599 		if (reg[a].lamp == lamp)
1600 		{
1601 			memcpy(check, &reg[a].values, sizeof(struct st_checkstable));
1602 			rst = OK;
1603 			break;
1604 		}
1605 	}
1606 
1607 	return rst;
1608 }
1609 
ua4900_checkstable(SANE_Int lamp, struct st_checkstable *check)1610 static SANE_Int ua4900_checkstable(SANE_Int lamp, struct st_checkstable *check)
1611 {
1612 	struct st_reg
1613 	{
1614 		SANE_Int lamp;
1615 		struct st_checkstable values;
1616 	};
1617 
1618 	struct st_reg reg[] =
1619 	{
1620 		/* lamp    , { diff, interval, tottime } */
1621 		{  0       , { 100.,      200,   5000}},
1622 		{  FLB_LAMP, {  10.,      200,   5000}},
1623 		{  TMA_LAMP, {  10.,      200,  25000}}
1624 	};
1625 
1626 	SANE_Int rst = ERROR;
1627 
1628 	SANE_Int a;
1629 	SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1630 
1631 	for (a = 0; a < count; a++)
1632 	{
1633 		if (reg[a].lamp == lamp)
1634 		{
1635 			memcpy(check, &reg[a].values, sizeof(struct st_checkstable));
1636 			rst = OK;
1637 			break;
1638 		}
1639 	}
1640 
1641 	return rst;
1642 }
1643 
cfg_checkstable_get(SANE_Int lamp, struct st_checkstable *check)1644 static SANE_Int cfg_checkstable_get(SANE_Int lamp, struct st_checkstable *check)
1645 {
1646 	SANE_Int rst;
1647 
1648 	switch(RTS_Debug->dev_model)
1649 	{
1650 		case UA4900:
1651 			rst = ua4900_checkstable(lamp, check);
1652 			break;
1653 
1654 		case HP3800:
1655 		case HPG2710:
1656 			rst = hp3800_checkstable(lamp, check);
1657 			break;
1658 
1659 		case HP4370:
1660 		case HPG3010:
1661 		case HPG3110:
1662 			rst = hp4370_checkstable(lamp, check);
1663 			break;
1664 
1665 		default:
1666 			rst = hp3970_checkstable(lamp, check);
1667 			break;
1668 	}
1669 
1670 	return rst;
1671 }
1672 
1673 /** SEC: Fixed pulse-width modulation values ---------- */
1674 
hp3800_fixedpwm(SANE_Int scantype, SANE_Int usb)1675 static SANE_Int hp3800_fixedpwm(SANE_Int scantype, SANE_Int usb)
1676 {
1677 	struct st_reg
1678 	{
1679 		SANE_Int usb;
1680 		SANE_Int pwm[3];
1681 	};
1682 
1683 	struct st_reg reg[] =
1684 	{
1685 		/* usb  , { ST_NORMAL, ST_TA, ST_NEG} */
1686 		{  USB20, {         0,     0,      0}},
1687 		{  USB11, {         0,     0,      0}}
1688 	};
1689 
1690 	SANE_Int a, rst = 0x16;
1691 	SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1692 
1693 	for (a = 0; a < count; a++)
1694 	{
1695 		if (reg[a].usb == usb)
1696 		{
1697 			if ((scantype < ST_NORMAL)||(scantype > ST_NEG))
1698 				scantype = ST_NORMAL;
1699 
1700 			rst = reg[a].pwm[scantype - 1];
1701 			break;
1702 		}
1703 	}
1704 
1705 	return rst;
1706 }
1707 
hp3970_fixedpwm(SANE_Int scantype, SANE_Int usb, SANE_Int sensor)1708 static SANE_Int hp3970_fixedpwm(SANE_Int scantype, SANE_Int usb, SANE_Int sensor)
1709 {
1710 	struct st_reg
1711 	{
1712 		SANE_Int usb;
1713 		SANE_Int sensor;
1714 		SANE_Int pwm[3];
1715 	};
1716 
1717 	struct st_reg reg[] =
1718 	{
1719 		/* usb  , sensor    , { ST_NORMAL, ST_TA, ST_NEG} */
1720 		{  USB20, CCD_SENSOR, {        22,    22,     22}},
1721 		{  USB11, CCD_SENSOR, {        22,    22,     22}},
1722 
1723 		{  USB20, CIS_SENSOR, {        22,    22,     22}},
1724 		{  USB11, CIS_SENSOR, {        22,    22,     22}}
1725 	};
1726 
1727 	SANE_Int a, rst = 0x16;
1728 	SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1729 
1730 	for (a = 0; a < count; a++)
1731 	{
1732 		if ((reg[a].usb == usb)&&(reg[a].sensor == sensor))
1733 		{
1734 			if ((scantype < ST_NORMAL)||(scantype > ST_NEG))
1735 				scantype = ST_NORMAL;
1736 
1737 			rst = reg[a].pwm[scantype - 1];
1738 			break;
1739 		}
1740 	}
1741 
1742 	return rst;
1743 }
1744 
hp4370_fixedpwm(SANE_Int scantype, SANE_Int usb)1745 static SANE_Int hp4370_fixedpwm(SANE_Int scantype, SANE_Int usb)
1746 {
1747 	struct st_reg
1748 	{
1749 		SANE_Int usb;
1750 		SANE_Int pwm[3];
1751 	};
1752 
1753 	struct st_reg reg[] =
1754 	{
1755 		/* usb  , { ST_NORMAL, ST_TA, ST_NEG} */
1756 		{  USB20, {        20,    28,     28}},
1757 		{  USB11, {        20,    28,     28}}
1758 	};
1759 
1760 	SANE_Int a, rst = 0x16;
1761 	SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1762 
1763 	for (a = 0; a < count; a++)
1764 	{
1765 		if (reg[a].usb == usb)
1766 		{
1767 			if ((scantype < ST_NORMAL)||(scantype > ST_NEG))
1768 				scantype = ST_NORMAL;
1769 
1770 			rst = reg[a].pwm[scantype - 1];
1771 			break;
1772 		}
1773 	}
1774 
1775 	return rst;
1776 }
1777 
ua4900_fixedpwm(SANE_Int scantype, SANE_Int usb)1778 static SANE_Int ua4900_fixedpwm(SANE_Int scantype, SANE_Int usb)
1779 {
1780 	struct st_reg
1781 	{
1782 		SANE_Int usb;
1783 		SANE_Int pwm[3];
1784 	};
1785 
1786 	struct st_reg reg[] =
1787 	{
1788 		/* usb  , { ST_NORMAL, ST_TA, ST_NEG} */
1789 		{  USB20, {        20,    28,     28}},
1790 		{  USB11, {        20,    28,     28}}
1791 	};
1792 
1793 	SANE_Int a, rst = 0x16;
1794 	SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1795 
1796 	for (a = 0; a < count; a++)
1797 	{
1798 		if (reg[a].usb == usb)
1799 		{
1800 			if ((scantype < ST_NORMAL)||(scantype > ST_NEG))
1801 				scantype = ST_NORMAL;
1802 
1803 			rst = reg[a].pwm[scantype - 1];
1804 			break;
1805 		}
1806 	}
1807 
1808 	return rst;
1809 }
1810 
cfg_fixedpwm_get(SANE_Int sensortype, SANE_Int scantype)1811 static SANE_Int cfg_fixedpwm_get(SANE_Int sensortype, SANE_Int scantype)
1812 {
1813 	SANE_Int rst;
1814 
1815 	switch(RTS_Debug->dev_model)
1816 	{
1817 		case UA4900:
1818 			rst = ua4900_fixedpwm(scantype, RTS_Debug->usbtype);
1819 			break;
1820 
1821 		case HP3800:
1822 		case HPG2710:
1823 			rst = hp3800_fixedpwm(scantype, RTS_Debug->usbtype);
1824 			break;
1825 
1826 		case HP4370:
1827 		case HPG3010:
1828 		case HPG3110:
1829 			rst = hp4370_fixedpwm(scantype, RTS_Debug->usbtype);
1830 			break;
1831 
1832 		default:
1833 			rst = hp3970_fixedpwm(scantype, RTS_Debug->usbtype, sensortype);
1834 			break;
1835 	}
1836 
1837 	return rst;
1838 }
1839 
1840 /** SEC: Fixed reference positions ---------- */
1841 
cfg_vrefs_get(SANE_Int sensortype, SANE_Int res, SANE_Int *ser, SANE_Int *ler)1842 static void cfg_vrefs_get(SANE_Int sensortype, SANE_Int res, SANE_Int *ser, SANE_Int *ler)
1843 {
1844 	switch(RTS_Debug->dev_model)
1845 	{
1846 		case HP3800:
1847 		case HPG2710:
1848 			hp3800_vrefs(res, ser, ler);
1849 			break;
1850 
1851 		case HP4370:
1852 		case HPG3010:
1853 		case HPG3110:
1854 			hp4370_vrefs(res, ser, ler);
1855 			break;
1856 
1857 		default:
1858 			hp3970_vrefs(RTS_Debug->usbtype, sensortype, res, ser, ler);
1859 			break;
1860 	}
1861 }
1862 
hp3800_vrefs(SANE_Int res, SANE_Int *ser, SANE_Int *ler)1863 static void hp3800_vrefs(SANE_Int res, SANE_Int *ser, SANE_Int *ler)
1864 {
1865 	struct st_reg
1866 	{
1867 		SANE_Int resolution;
1868 		SANE_Int vref[2];
1869 	};
1870 
1871 	struct st_reg reg[] =
1872 	{
1873 		/* res, { ser,  ler} */
1874 		{  150, {  25,   50}},
1875 		{  300, {  50,  101}},
1876 		{  600, { 102,  202}},
1877 		{ 1200, { 204,  404}},
1878 		{ 2400, { 408,  808}}
1879 	};
1880 
1881 	if ((ser != NULL)&&(ler != NULL))
1882 	{
1883 		SANE_Int a;
1884 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1885 
1886 		/* values by default */
1887 		*ser = *ler = 0;
1888 
1889 		for (a = 0; a < count; a++)
1890 		{
1891 			if (reg[a].resolution == res)
1892 			{
1893 				*ser = reg[a].vref[0];
1894 				*ler = reg[a].vref[1];
1895 				break;
1896 			}
1897 		}
1898 	}
1899 }
1900 
hp3970_vrefs(SANE_Int usb, SANE_Int sensor, SANE_Int res, SANE_Int *ser, SANE_Int *ler)1901 static void hp3970_vrefs(SANE_Int usb, SANE_Int sensor, SANE_Int res, SANE_Int *ser, SANE_Int *ler)
1902 {
1903 	struct st_reg
1904 	{
1905 		SANE_Int usb;
1906 		SANE_Int sensor;
1907 		SANE_Int resolution;
1908 		SANE_Int vref[2];
1909 	};
1910 
1911 	/* I think these references should be the same in all usb versions and in
1912 	   all sensor types but windows driver has some different values in some cases.
1913 	*/
1914 
1915 	struct st_reg reg[] =
1916 	{
1917 		/* usb  , sensor    ,  res, { ser,  ler} */
1918 		{  USB20, CCD_SENSOR,  100, {  28,   60}},
1919 		{  USB20, CCD_SENSOR,  200, {  37,  117}},
1920 		{  USB20, CCD_SENSOR,  300, {  52,  162}},
1921 		{  USB20, CCD_SENSOR,  600, { 103,  344}},
1922 		{  USB20, CCD_SENSOR, 1200, { 156,  660}},
1923 		{  USB20, CCD_SENSOR, 2400, { 309, 1262}},
1924 
1925 		/* usb  , sensor    ,  res, { ser,  ler} */
1926 		{  USB11, CCD_SENSOR,  100, {  28,   60}},
1927 		{  USB11, CCD_SENSOR,  200, {  37,  117}},
1928 		{  USB11, CCD_SENSOR,  300, {  52,  162}},
1929 		{  USB11, CCD_SENSOR,  600, { 103,  344}},
1930 		{  USB11, CCD_SENSOR, 1200, { 156,  660}},
1931 		{  USB11, CCD_SENSOR, 2400, { 309, 1262}},
1932 
1933 		/* usb  , sensor    ,  res, { ser,  ler} */
1934 		{  USB20, CIS_SENSOR,  100, {  15,   60}},
1935 		{  USB20, CIS_SENSOR,  200, {  39,  117}},
1936 		{  USB20, CIS_SENSOR,  300, {  56,  161}},
1937 		{  USB20, CIS_SENSOR,  600, { 108,  342}},
1938 		{  USB20, CIS_SENSOR, 1200, { 221,  642}},
1939 		{  USB20, CIS_SENSOR, 2400, { 407, 1285}},
1940 
1941 		/* usb  , sensor    ,  res, { ser,  ler} */
1942 		{  USB11, CIS_SENSOR,  100, {  15,   60}},
1943 		{  USB11, CIS_SENSOR,  200, {  39,  117}},
1944 		{  USB11, CIS_SENSOR,  300, {  56,  161}},
1945 		{  USB11, CIS_SENSOR,  600, { 108,  342}},
1946 		{  USB11, CIS_SENSOR, 1200, { 221,  642}},
1947 		{  USB11, CIS_SENSOR, 2400, { 407, 1285}}
1948 	};
1949 
1950 	if ((ser != NULL)&&(ler != NULL))
1951 	{
1952 		SANE_Int a;
1953 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1954 
1955 		/* values by default */
1956 		*ser = *ler = 0;
1957 
1958 		for (a = 0; a < count; a++)
1959 		{
1960 			if ((reg[a].usb == usb)&&(reg[a].sensor == sensor)&&(reg[a].resolution == res))
1961 			{
1962 				*ser = reg[a].vref[0];
1963 				*ler = reg[a].vref[1];
1964 				break;
1965 			}
1966 		}
1967 	}
1968 }
1969 
hp4370_vrefs(SANE_Int res, SANE_Int *ser, SANE_Int *ler)1970 static void hp4370_vrefs(SANE_Int res, SANE_Int *ser, SANE_Int *ler)
1971 {
1972 	struct st_reg
1973 	{
1974 		SANE_Int resolution;
1975 		SANE_Int vref[2];
1976 	};
1977 
1978 	struct st_reg reg[] =
1979 	{
1980 		/* res, { ser,  ler} */
1981 		{  150, {  31,   81}},
1982 		{  300, {  61,  162}},
1983 		{  600, { 122,  324}},
1984 		{ 1200, { 244,  648}},
1985 		{ 2400, { 488, 1256}},
1986 		{ 4800, { 976, 2512}}
1987 	};
1988 
1989 	if ((ser != NULL)&&(ler != NULL))
1990 	{
1991 		SANE_Int a;
1992 		SANE_Int count = sizeof(reg) / sizeof(struct st_reg);
1993 
1994 		/* values by default */
1995 		*ser = *ler = 0;
1996 
1997 		for (a = 0; a < count; a++)
1998 		{
1999 			if (reg[a].resolution == res)
2000 			{
2001 				*ser = reg[a].vref[0];
2002 				*ler = reg[a].vref[1];
2003 				break;
2004 			}
2005 		}
2006 	}
2007 }
2008 
2009 /** SEC: Motor movements ---------- */
2010 
cfg_motormove_get(SANE_Int sensortype, SANE_Int item, struct st_motormove *reg)2011 static SANE_Int cfg_motormove_get(SANE_Int sensortype, SANE_Int item, struct st_motormove *reg)
2012 {
2013 	SANE_Int rst = ERROR;
2014 
2015 	switch(RTS_Debug->dev_model)
2016 	{
2017 		case BQ5550:
2018 			rst = bq5550_motormove(item, reg);
2019 			break;
2020 		case HP3800:
2021 		case HPG2710:
2022 			rst = hp3800_motormove(item, reg);
2023 			break;
2024 
2025 		default:
2026 			rst = hp3970_motormove(RTS_Debug->usbtype, sensortype, item, reg);
2027 			break;
2028 	}
2029 
2030 	return rst;
2031 }
2032 
bq5550_motormove(SANE_Int item, struct st_motormove *reg)2033 static SANE_Int bq5550_motormove(SANE_Int item, struct st_motormove *reg)
2034 {
2035 	SANE_Int rst = ERROR;
2036 
2037 	/* data is the same in all usb types and sensors so those args aren't needed */
2038 
2039 	if (reg != NULL)
2040 	{
2041 		struct st_motormove mv[] =
2042 		{
2043 			/* systemclock, ctpc, steptype , motorcurve } */
2044 			{  0x05       , 4059, STT_HALF ,  0         },
2045 			{  0x02       , 1200, STT_QUART, -1         }
2046 		};
2047 
2048 		rst = OK;
2049 
2050 		if ((item < 2)&&(item > -1))
2051 			memcpy(reg, &mv[item], sizeof(struct st_motormove));
2052 				else rst = ERROR;
2053 	}
2054 
2055 	return rst;
2056 }
2057 
hp3800_motormove(SANE_Int item, struct st_motormove *reg)2058 static SANE_Int hp3800_motormove(SANE_Int item, struct st_motormove *reg)
2059 {
2060 	SANE_Int rst = ERROR;
2061 
2062 	/* data is the same in all usb types and sensors so those args aren't needed */
2063 
2064 	if (reg != NULL)
2065 	{
2066 		struct st_motormove mv[] =
2067 		{
2068 			/* systemclock, ctpc, steptype, motorcurve } */
2069 			{  0x04       , 1991, STT_HALF,  2         },
2070 			{  0x02       , 1991, STT_HALF, -1         }
2071 		};
2072 
2073 		rst = OK;
2074 
2075 		if ((item < 2)&&(item > -1))
2076 			memcpy(reg, &mv[item], sizeof(struct st_motormove));
2077 				else rst = ERROR;
2078 	}
2079 
2080 	return rst;
2081 }
2082 
hp3970_motormove(SANE_Int usb, SANE_Int ccd, SANE_Int item, struct st_motormove *reg)2083 static SANE_Int hp3970_motormove(SANE_Int usb, SANE_Int ccd, SANE_Int item, struct st_motormove *reg)
2084 {
2085 	SANE_Int rst = ERROR;
2086 
2087 	struct st_mtmove
2088 	{
2089 		SANE_Int usbtype;
2090 		SANE_Int sensor;
2091 		struct st_motormove move;
2092 	};
2093 
2094 	if (reg != NULL)
2095 	{
2096 		struct st_mtmove mv[] =
2097 		{
2098 			/* usb, sensor    , {systemclock, ctpc, steptype, motorcurve } */
2099 			{USB20, CCD_SENSOR, {0x02       , 6431, STT_HALF,  1         }},
2100 			{USB20, CCD_SENSOR, {0x02       , 2000, STT_HALF, -1         }},
2101 
2102 			{USB20, CIS_SENSOR, {0x02       , 6431, STT_HALF,  1         }},
2103 			{USB20, CIS_SENSOR, {0x02       , 2000, STT_HALF, -1         }},
2104 
2105 			{USB11, CCD_SENSOR, {0x02       , 6431, STT_HALF,  1         }},
2106 			{USB11, CCD_SENSOR, {0x02       , 2000, STT_HALF, -1         }},
2107 
2108 			{USB11, CIS_SENSOR, {0x02       , 6431, STT_HALF,  1         }},
2109 			{USB11, CIS_SENSOR, {0x02       , 2000, STT_HALF, -1         }}
2110 		};
2111 
2112 		if (item < 2)
2113 		{
2114 			SANE_Int a, count = 0;
2115 			SANE_Int total = sizeof(mv) / sizeof(struct st_mtmove);
2116 
2117 			for (a = 0; a < total; a++)
2118 			{
2119 				if ((mv[a].usbtype == usb)&&(mv[a].sensor == ccd))
2120 				{
2121 					if (item == count)
2122 					{
2123 						memcpy(reg, &mv[a].move, sizeof(struct st_motormove));
2124 						rst = OK;
2125 						break;
2126 					} else count++;
2127 				}
2128 			}
2129 		}
2130 	}
2131 
2132 	return rst;
2133 }
2134 
2135 /** SEC: Scanning modes ---------- */
2136 
cfg_scanmode_get(SANE_Int sensortype, SANE_Int sm, struct st_scanmode *mymode)2137 static SANE_Int cfg_scanmode_get(SANE_Int sensortype, SANE_Int sm, struct st_scanmode *mymode)
2138 {
2139 	SANE_Int rst = ERROR;
2140 
2141 	switch(RTS_Debug->dev_model)
2142 	{
2143 		case BQ5550:
2144 			rst = bq5550_scanmodes(RTS_Debug->usbtype, sm, mymode);
2145 			break;
2146 
2147 		case UA4900:
2148 			rst = ua4900_scanmodes(RTS_Debug->usbtype, sm, mymode);
2149 			break;
2150 
2151 		case HP3800:
2152 		case HPG2710:
2153 			rst = hp3800_scanmodes(RTS_Debug->usbtype, sm, mymode);
2154 			break;
2155 
2156 		case HP4370:
2157 		case HPG3010:
2158 		case HPG3110:
2159 			rst = hp4370_scanmodes(RTS_Debug->usbtype, sm, mymode);
2160 			break;
2161 
2162 		default: /* hp3970 hp4070 */
2163 			rst = hp3970_scanmodes(RTS_Debug->usbtype, sensortype, sm, mymode);
2164 			break;
2165 	}
2166 
2167 	return rst;
2168 }
2169 
hp3970_scanmodes(SANE_Int usb, SANE_Int ccd, SANE_Int sm, struct st_scanmode *mymode)2170 static SANE_Int hp3970_scanmodes(SANE_Int usb, SANE_Int ccd, SANE_Int sm, struct st_scanmode *mymode)
2171 {
2172 	struct st_modes
2173 	{
2174 		SANE_Int usb;
2175 		SANE_Int sensor;
2176 		struct st_scanmode mode;
2177 	};
2178 
2179 	struct st_modes reg[] =
2180 	{
2181 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2182 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x04 , 24499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2183 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x05 , 14667, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2184 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  600, 0x02  ,  2   , PIXEL_RATE, 0x04 ,  5499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2185 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  300, 0x03  ,  3   , PIXEL_RATE, 0x04 ,  2751, 768    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2186 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  200, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2255, 1856   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2187 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  100, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2255, 1856   , STT_HALF, 0x02     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2188 
2189 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x04 , 24499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2190 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x05 , 14667, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2191 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  600, 0x07  ,  2   , LINE_RATE , 0x04 ,  5499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2192 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  300, 0x08  ,  3   , LINE_RATE , 0x04 ,  2751, 768    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2193 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  200, 0x09  ,  4   , LINE_RATE , 0x04 ,  2255, 1856   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2194 		{USB20, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  100, 0x09  ,  4   , LINE_RATE , 0x04 ,  2255, 1856   , STT_HALF, 0x02     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2195 
2196 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2197 		{USB20, CCD_SENSOR, {ST_TA    , CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x04 , 25599, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2198 		{USB20, CCD_SENSOR, {ST_TA    , CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x03 , 10899, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2199 		{USB20, CCD_SENSOR, {ST_TA    , CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x01 ,  5487, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2200 		{USB20, CCD_SENSOR, {ST_TA    , CM_COLOR ,  300, 0x03  ,  3   , PIXEL_RATE, 0x04 ,  8351, 512    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2201 		{USB20, CCD_SENSOR, {ST_TA    , CM_COLOR ,  200, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2202 		{USB20, CCD_SENSOR, {ST_TA    , CM_COLOR ,  100, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2203 
2204 		{USB20, CCD_SENSOR, {ST_TA    , CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x04 , 25599, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2205 		{USB20, CCD_SENSOR, {ST_TA    , CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x03 , 10899, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2206 		{USB20, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x01 ,  5487, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2207 		{USB20, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  300, 0x08  ,  3   , LINE_RATE , 0x04 ,  8351, 512    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2208 		{USB20, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  200, 0x09  ,  4   , LINE_RATE , 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2209 		{USB20, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  100, 0x09  ,  4   , LINE_RATE , 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2210 
2211 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt           }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2212 		{USB20, CCD_SENSOR, {ST_NEG   , CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x02 , 76799, 256    , STT_FULL, 0x00     , {25599, 51199, 0}, {25599, 25599, 76799},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2213 		{USB20, CCD_SENSOR, {ST_NEG   , CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x03 , 36467, 256    , STT_FULL, 0x00     , {12155, 24311, 0}, {12155, 12155, 36467},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2214 		{USB20, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x02 , 16463, 256    , STT_FULL, 0x00     , { 5487, 10975, 0}, { 5487,  5487, 16463},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2215 		{USB20, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  300, 0x03  , -1   , PIXEL_RATE, 0x02 ,  8351, 256    , STT_HALF, 0x00     , { 2783,  5567, 0}, { 2783,  2783,  8351},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2216 		{USB20, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  200, 0x04  , -1   , PIXEL_RATE, 0x02 ,  6191, 256    , STT_HALF, 0x00     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2217 		{USB20, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  100, 0x04  , -1   , PIXEL_RATE, 0x02 ,  6191, 256    , STT_HALF, 0x02     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2218 
2219 		{USB20, CCD_SENSOR, {ST_NEG   , CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x02 , 76799, 256    , STT_FULL, 0x00     , {25599, 51199, 0}, {25599, 25599, 76799},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2220 		{USB20, CCD_SENSOR, {ST_NEG   , CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x03 , 36467, 256    , STT_FULL, 0x00     , {12155, 24311, 0}, {12155, 12155, 36467},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2221 		{USB20, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x02 , 16463, 256    , STT_FULL, 0x00     , { 5487, 10975, 0}, { 5487,  5487, 16463},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2222 		{USB20, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  300, 0x08  , -1   , LINE_RATE , 0x02 ,  8351, 256    , STT_HALF, 0x00     , { 2783,  5567, 0}, { 2783,  2783,  8351},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2223 		{USB20, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  200, 0x09  , -1   , LINE_RATE , 0x02 ,  6191, 256    , STT_HALF, 0x00     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2224 		{USB20, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  100, 0x09  , -1   , LINE_RATE , 0x02 ,  6191, 256    , STT_HALF, 0x02     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2225 
2226 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2227 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x04 , 24499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2228 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x05 , 14667, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2229 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_COLOR ,  600, 0x02  ,  2   , PIXEL_RATE, 0x04 ,  5499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2230 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_COLOR ,  300, 0x03  ,  3   , PIXEL_RATE, 0x04 ,  2751, 768    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2231 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_COLOR ,  200, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2255, 1856   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2232 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_COLOR ,  100, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2255, 1856   , STT_HALF, 0x02     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2233 
2234 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x04 , 24499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2235 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x05 , 14667, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2236 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_GRAY  ,  600, 0x07  ,  2   , LINE_RATE , 0x04 ,  5499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2237 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_GRAY  ,  300, 0x08  ,  3   , LINE_RATE , 0x04 ,  2751, 768    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2238 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_GRAY  ,  200, 0x09  ,  4   , LINE_RATE , 0x04 ,  2255, 1856   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2239 		{USB20, CIS_SENSOR, {ST_NORMAL, CM_GRAY  ,  100, 0x09  ,  4   , LINE_RATE , 0x04 ,  2255, 1856   , STT_HALF, 0x02     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2240 
2241 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2242 		{USB20, CIS_SENSOR, {ST_TA    , CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x04 , 25599, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2243 		{USB20, CIS_SENSOR, {ST_TA    , CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x03 , 10899, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2244 		{USB20, CIS_SENSOR, {ST_TA    , CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x01 ,  5487, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2245 		{USB20, CIS_SENSOR, {ST_TA    , CM_COLOR ,  300, 0x03  ,  3   , PIXEL_RATE, 0x04 ,  8351, 512    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2246 		{USB20, CIS_SENSOR, {ST_TA    , CM_COLOR ,  200, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2247 		{USB20, CIS_SENSOR, {ST_TA    , CM_COLOR ,  100, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2248 
2249 		{USB20, CIS_SENSOR, {ST_TA    , CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x04 , 25599, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2250 		{USB20, CIS_SENSOR, {ST_TA    , CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x03 , 10899, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2251 		{USB20, CIS_SENSOR, {ST_TA    , CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x01 ,  5487, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2252 		{USB20, CIS_SENSOR, {ST_TA    , CM_GRAY  ,  300, 0x08  ,  3   , LINE_RATE , 0x04 ,  8351, 512    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2253 		{USB20, CIS_SENSOR, {ST_TA    , CM_GRAY  ,  200, 0x09  ,  4   , LINE_RATE , 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2254 		{USB20, CIS_SENSOR, {ST_TA    , CM_GRAY  ,  100, 0x09  ,  4   , LINE_RATE , 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2255 
2256 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt           }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2257 		{USB20, CIS_SENSOR, {ST_NEG   , CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x02 , 76799, 256    , STT_FULL, 0x00     , {25599, 51199, 0}, {25599, 25599, 76799},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2258 		{USB20, CIS_SENSOR, {ST_NEG   , CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x03 , 36467, 256    , STT_FULL, 0x00     , {12155, 24311, 0}, {12155, 12155, 36467},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2259 		{USB20, CIS_SENSOR, {ST_NEG   , CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x02 , 16463, 256    , STT_FULL, 0x00     , { 5487, 10975, 0}, { 5487,  5487, 16463},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2260 		{USB20, CIS_SENSOR, {ST_NEG   , CM_COLOR ,  300, 0x03  , -1   , PIXEL_RATE, 0x02 ,  8351, 256    , STT_HALF, 0x00     , { 2783,  5567, 0}, { 2783,  2783,  8351},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2261 		{USB20, CIS_SENSOR, {ST_NEG   , CM_COLOR ,  200, 0x04  , -1   , PIXEL_RATE, 0x02 ,  6191, 256    , STT_HALF, 0x00     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2262 		{USB20, CIS_SENSOR, {ST_NEG   , CM_COLOR ,  100, 0x04  , -1   , PIXEL_RATE, 0x02 ,  6191, 256    , STT_HALF, 0x02     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2263 
2264 		{USB20, CIS_SENSOR, {ST_NEG   , CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x02 , 76799, 256    , STT_FULL, 0x00     , {25599, 51199, 0}, {25599, 25599, 76799},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2265 		{USB20, CIS_SENSOR, {ST_NEG   , CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x03 , 36467, 256    , STT_FULL, 0x00     , {12155, 24311, 0}, {12155, 12155, 36467},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2266 		{USB20, CIS_SENSOR, {ST_NEG   , CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x02 , 16463, 256    , STT_FULL, 0x00     , { 5487, 10975, 0}, { 5487,  5487, 16463},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2267 		{USB20, CIS_SENSOR, {ST_NEG   , CM_GRAY  ,  300, 0x08  , -1   , LINE_RATE , 0x02 ,  8351, 256    , STT_HALF, 0x00     , { 2783,  5567, 0}, { 2783,  2783,  8351},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2268 		{USB20, CIS_SENSOR, {ST_NEG   , CM_GRAY  ,  200, 0x09  , -1   , LINE_RATE , 0x02 ,  6191, 256    , STT_HALF, 0x00     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2269 		{USB20, CIS_SENSOR, {ST_NEG   , CM_GRAY  ,  100, 0x09  , -1   , LINE_RATE , 0x02 ,  6191, 256    , STT_HALF, 0x02     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2270 
2271 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2272 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x03 , 21499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2273 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x04 , 14667, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2274 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x04 , 21999, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2275 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  300, 0x03  ,  3   , PIXEL_RATE, 0x04 , 10727, 768    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2276 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  200, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  5591, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2277 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  100, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2255, 1856   , STT_HALF, 0x02     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2278 
2279 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x02 , 21499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2280 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x04 , 14667, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2281 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  600, 0x07  ,  2   , LINE_RATE , 0x04 ,  6999, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2282 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  300, 0x08  ,  3   , LINE_RATE , 0x04 ,  4671, 768    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2283 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  200, 0x09  ,  4   , LINE_RATE , 0x04 ,  2255, 1856   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2284 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  100, 0x09  ,  4   , LINE_RATE , 0x04 ,  2255, 1856   , STT_HALF, 0x02     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2285 
2286 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2287 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x04 , 25599, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2288 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x03 , 10899, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2289 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x01 ,  5487, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2290 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR ,  300, 0x03  ,  3   , PIXEL_RATE, 0x04 ,  8351, 512    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2291 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR ,  200, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2292 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR ,  100, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2293 
2294 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x04 , 25599, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2295 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x03 , 10899, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2296 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x01 ,  5487, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2297 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  300, 0x08  ,  3   , LINE_RATE , 0x04 ,  8351, 512    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2298 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  200, 0x09  ,  4   , LINE_RATE , 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2299 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  100, 0x09  ,  4   , LINE_RATE , 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2300 
2301 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt           }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2302 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x02 , 76799, 256    , STT_FULL, 0x00     , {25599, 51199, 0}, {25599, 25599, 76799},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2303 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x03 , 36467, 256    , STT_FULL, 0x00     , {12155, 24311, 0}, {12155, 12155, 36467},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2304 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x02 , 16463, 256    , STT_FULL, 0x00     , { 5487, 10975, 0}, { 5487,  5487, 16463},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2305 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  300, 0x03  , -1   , PIXEL_RATE, 0x02 ,  8351, 256    , STT_HALF, 0x00     , { 2783,  5567, 0}, { 2783,  2783,  8351},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2306 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  200, 0x04  , -1   , PIXEL_RATE, 0x02 ,  6191, 256    , STT_HALF, 0x00     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2307 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  100, 0x04  , -1   , PIXEL_RATE, 0x02 ,  6191, 256    , STT_HALF, 0x02     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2308 
2309 		{USB11, CCD_SENSOR, {ST_NEG   , CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x02 , 76799, 256    , STT_FULL, 0x00     , {25599, 51199, 0}, {25599, 25599, 76799},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2310 		{USB11, CCD_SENSOR, {ST_NEG   , CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x03 , 36467, 256    , STT_FULL, 0x00     , {12155, 24311, 0}, {12155, 12155, 36467},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2311 		{USB11, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x02 , 16463, 256    , STT_FULL, 0x00     , { 5487, 10975, 0}, { 5487,  5487, 16463},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2312 		{USB11, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  300, 0x08  , -1   , LINE_RATE , 0x02 ,  8351, 256    , STT_HALF, 0x00     , { 2783,  5567, 0}, { 2783,  2783,  8351},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2313 		{USB11, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  200, 0x09  , -1   , LINE_RATE , 0x02 ,  6191, 256    , STT_HALF, 0x00     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2314 		{USB11, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  100, 0x09  , -1   , LINE_RATE , 0x02 ,  6191, 256    , STT_HALF, 0x02     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2315 
2316 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2317 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x02 , 21499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2318 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x03 , 14667, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2319 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x04 , 21999, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2320 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  300, 0x03  ,  3   , PIXEL_RATE, 0x04 , 10727, 768    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2321 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  200, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  5591, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2322 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_COLOR ,  100, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2255, 1856   , STT_HALF, 0x02     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2323 
2324 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x02 , 21499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2325 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x04 , 14667, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2326 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  600, 0x07  ,  2   , LINE_RATE , 0x04 ,  6999, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2327 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  300, 0x08  ,  3   , LINE_RATE , 0x04 ,  4671, 768    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2328 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  200, 0x09  ,  4   , LINE_RATE , 0x04 ,  2255, 1856   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2329 		{USB11, CCD_SENSOR, {ST_NORMAL, CM_GRAY  ,  100, 0x09  ,  4   , LINE_RATE , 0x04 ,  2255, 1856   , STT_HALF, 0x02     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2330 
2331 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2332 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x04 , 25599, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2333 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x03 , 10899, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2334 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x01 ,  5487, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2335 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR ,  300, 0x03  ,  3   , PIXEL_RATE, 0x04 ,  8351, 512    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2336 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR ,  200, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2337 		{USB11, CCD_SENSOR, {ST_TA    , CM_COLOR ,  100, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2338 
2339 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x04 , 25599, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2340 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x03 , 10899, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2341 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x01 ,  5487, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2342 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  300, 0x08  ,  3   , LINE_RATE , 0x04 ,  8351, 512    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2343 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  200, 0x09  ,  4   , LINE_RATE , 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2344 		{USB11, CCD_SENSOR, {ST_TA    , CM_GRAY  ,  100, 0x09  ,  4   , LINE_RATE , 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2345 
2346 		/* usb, sensor    , {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt           }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2347 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x02 , 76799, 256    , STT_FULL, 0x00     , {25599, 51199, 0}, {25599, 25599, 76799},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2348 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x03 , 36467, 256    , STT_FULL, 0x00     , {12155, 24311, 0}, {12155, 12155, 36467},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2349 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x02 , 16463, 256    , STT_FULL, 0x00     , { 5487, 10975, 0}, { 5487,  5487, 16463},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2350 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  300, 0x03  , -1   , PIXEL_RATE, 0x02 ,  8351, 256    , STT_HALF, 0x00     , { 2783,  5567, 0}, { 2783,  2783,  8351},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2351 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  200, 0x04  , -1   , PIXEL_RATE, 0x02 ,  6191, 256    , STT_HALF, 0x00     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2352 		{USB11, CCD_SENSOR, {ST_NEG   , CM_COLOR ,  100, 0x04  , -1   , PIXEL_RATE, 0x02 ,  6191, 256    , STT_HALF, 0x02     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2353 
2354 		{USB11, CIS_SENSOR, {ST_NEG   , CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x02 , 76799, 256    , STT_FULL, 0x00     , {25599, 51199, 0}, {25599, 25599, 76799},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2355 		{USB11, CIS_SENSOR, {ST_NEG   , CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x03 , 36467, 256    , STT_FULL, 0x00     , {12155, 24311, 0}, {12155, 12155, 36467},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2356 		{USB11, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x02 , 16463, 256    , STT_FULL, 0x00     , { 5487, 10975, 0}, { 5487,  5487, 16463},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2357 		{USB11, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  300, 0x08  , -1   , LINE_RATE , 0x02 ,  8351, 256    , STT_HALF, 0x00     , { 2783,  5567, 0}, { 2783,  2783,  8351},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2358 		{USB11, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  200, 0x09  , -1   , LINE_RATE , 0x02 ,  6191, 256    , STT_HALF, 0x00     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2359 		{USB11, CCD_SENSOR, {ST_NEG   , CM_GRAY  ,  100, 0x09  , -1   , LINE_RATE , 0x02 ,  6191, 256    , STT_HALF, 0x02     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }}
2360 	};
2361 
2362 	SANE_Int rst = ERROR;
2363 
2364 	if (mymode != NULL)
2365 	{
2366 		SANE_Int a;
2367 		SANE_Int total = sizeof(reg) / sizeof(struct st_modes);
2368 		SANE_Int count = 0;
2369 		struct st_modes *md;
2370 
2371 		for (a = 0; a < total; a++)
2372 		{
2373 			md = &reg[a];
2374 			if ((md->usb == usb)&&(md->sensor == ccd))
2375 			{
2376 				if (count == sm)
2377 				{
2378 					memcpy(mymode, &md->mode, sizeof(struct st_scanmode));
2379 					rst = OK;
2380 					break;
2381 				}
2382 
2383 				count++;
2384 			}
2385 		}
2386 	}
2387 
2388 	return rst;
2389 }
2390 
hp4370_scanmodes(SANE_Int usb, SANE_Int sm, struct st_scanmode *mymode)2391 static SANE_Int hp4370_scanmodes(SANE_Int usb, SANE_Int sm, struct st_scanmode *mymode)
2392 {
2393 	struct st_modes
2394 	{
2395 		SANE_Int usb;
2396 		struct st_scanmode mode;
2397 	};
2398 
2399 	struct st_modes reg[] =
2400 	{
2401 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt               }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2402 		{USB20, {ST_NORMAL, CM_COLOR , 4800, 0x00  , -1   , PIXEL_RATE, 0x05 , 47799, 256    , STT_HALF, 0x00     , {23899, 23899, 23899}, {23899, 23899, 23899},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2403 		{USB20, {ST_NORMAL, CM_COLOR , 2400, 0x01  , -1   , PIXEL_RATE, 0x05 , 31849, 256    , STT_FULL, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2404 		{USB20, {ST_NORMAL, CM_COLOR , 1200, 0x02  , -1   , PIXEL_RATE, 0x05 , 15999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2405 		{USB20, {ST_NORMAL, CM_COLOR ,  600, 0x03  ,  2   , PIXEL_RATE, 0x05 ,  7999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2406 		{USB20, {ST_NORMAL, CM_COLOR ,  300, 0x04  ,  3   , PIXEL_RATE, 0x04 ,  2799, 768    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2407 		{USB20, {ST_NORMAL, CM_COLOR ,  150, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2799, 1856   , STT_HALF, 0x01     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2408 
2409 		{USB20, {ST_NORMAL, CM_GRAY  , 4800, 0x05  , -1   , LINE_RATE , 0x05 , 47799, 256    , STT_HALF, 0x00     , {23899, 23899, 23899}, {23899, 23899, 23899},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2410 		{USB20, {ST_NORMAL, CM_GRAY  , 2400, 0x06  , -1   , LINE_RATE , 0x05 , 31849, 256    , STT_FULL, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2411 		{USB20, {ST_NORMAL, CM_GRAY  , 1200, 0x07  , -1   , LINE_RATE , 0x05 , 15999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2412 		{USB20, {ST_NORMAL, CM_GRAY  ,  600, 0x08  ,  2   , LINE_RATE , 0x05 ,  7999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2413 		{USB20, {ST_NORMAL, CM_GRAY  ,  300, 0x09  ,  3   , LINE_RATE , 0x04 ,  2799, 768    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2414 		{USB20, {ST_NORMAL, CM_GRAY  ,  150, 0x09  ,  4   , LINE_RATE , 0x04 ,  2799, 1856   , STT_HALF, 0x01     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2415 
2416 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt               }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2417 		{USB20, {ST_TA    , CM_COLOR , 4800, 0x0A  , -1   , PIXEL_RATE, 0x05 , 53999, 256    , STT_HALF, 0x00     , {26999, 26999, 26999}, {26999, 26999, 26999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2418 		{USB20, {ST_TA    , CM_COLOR , 2400, 0x01  , -1   , PIXEL_RATE, 0x05 , 35999, 256    , STT_FULL, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2419 		{USB20, {ST_TA    , CM_COLOR , 1200, 0x02  , -1   , PIXEL_RATE, 0x05 , 17999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2420 		{USB20, {ST_TA    , CM_COLOR ,  600, 0x03  ,  2   , PIXEL_RATE, 0x05 ,  8999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2421 		{USB20, {ST_TA    , CM_COLOR ,  300, 0x04  ,  3   , PIXEL_RATE, 0x04 ,  2959, 512    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2422 		{USB20, {ST_TA    , CM_COLOR ,  150, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2959, 1024   , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2423 
2424 		{USB20, {ST_TA    , CM_GRAY  , 4800, 0x0B  , -1   , LINE_RATE , 0x05 , 53999, 256    , STT_HALF, 0x00     , {26999, 26999, 26999}, {26999, 26999, 26999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2425 		{USB20, {ST_TA    , CM_GRAY  , 2400, 0x06  , -1   , LINE_RATE , 0x05 , 35999, 256    , STT_FULL, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2426 		{USB20, {ST_TA    , CM_GRAY  , 1200, 0x07  , -1   , LINE_RATE , 0x05 , 17999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2427 		{USB20, {ST_TA    , CM_GRAY  ,  600, 0x08  ,  3   , LINE_RATE , 0x05 ,  8999, 512    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2428 		{USB20, {ST_TA    , CM_GRAY  ,  300, 0x09  ,  4   , LINE_RATE , 0x04 ,  2959, 1024   , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2429 		{USB20, {ST_TA    , CM_GRAY  ,  150, 0x09  ,  4   , LINE_RATE , 0x05 ,  2959, 1024   , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2430 
2431 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt               }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2432 		{USB20, {ST_NEG   , CM_COLOR , 4800, 0x0C  , -1   , PIXEL_RATE, 0x05 , 60599, 256    , STT_HALF, 0x00     , {30299, 30299, 30299}, {30299, 30299, 30299},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2433 		{USB20, {ST_NEG   , CM_COLOR , 2400, 0x01  , -1   , PIXEL_RATE, 0x05 , 145799, 256   , STT_FULL, 0x00     , {48599, 97199,     0}, {48599, 48599, 145799},  0      ,  1     , -1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2434 		{USB20, {ST_NEG   , CM_COLOR , 1200, 0x02  , -1   , PIXEL_RATE, 0x05 , 89999, 256    , STT_FULL, 0x00     , {29999, 59999,     0}, {29999, 29999, 89999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2435 		{USB20, {ST_NEG   , CM_COLOR ,  600, 0x03  , -1   , PIXEL_RATE, 0x05 , 45999, 256    , STT_HALF, 0x00     , {15333, 30666,     0}, {15333, 15333, 45999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2436 		{USB20, {ST_NEG   , CM_COLOR ,  300, 0x04  , -1   , PIXEL_RATE, 0x04 , 14879, 256    , STT_HALF, 0x00     , { 4959,  9919,     0}, { 4959,  4959, 14879},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2437 		{USB20, {ST_NEG   , CM_COLOR ,  150, 0x04  ,  3   , PIXEL_RATE, 0x04 , 14879, 256    , STT_HALF, 0x00     , { 4959,  9919,     0}, { 4959,  4959, 14879},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2438 
2439 		{USB20, {ST_NEG   , CM_GRAY  , 4800, 0x0D  , -1   , LINE_RATE , 0x05 , 60599, 256    , STT_FULL, 0x00     , {30299, 30299, 30299}, {30299, 30299, 30299},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2440 		{USB20, {ST_NEG   , CM_GRAY  , 2400, 0x06  , -1   , LINE_RATE , 0x05 ,145799,  256   , STT_FULL, 0x00     , {48599, 97199,     0}, {48599, 48599, 145799},  0      ,  1     , -1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2441 		{USB20, {ST_NEG   , CM_GRAY  , 1200, 0x07  , -1   , LINE_RATE , 0x05 , 89999, 256    , STT_FULL, 0x00     , {29999, 59999,     0}, {29999, 29999, 89999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2442 		{USB20, {ST_NEG   , CM_GRAY  ,  600, 0x08  , -1   , LINE_RATE , 0x05 , 45999, 256    , STT_HALF, 0x00     , {15333, 30666,     0}, {15333, 15333, 45999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2443 		{USB20, {ST_NEG   , CM_GRAY  ,  300, 0x09  , -1   , LINE_RATE , 0x04 , 14879, 256    , STT_HALF, 0x00     , { 4959,  9919,     0}, { 4959,  4959, 14879},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2444 		{USB20, {ST_NEG   , CM_GRAY  ,  150, 0x09  ,  3   , LINE_RATE , 0x04 , 14879, 256    , STT_HALF, 0x00     , { 4959,  9919,     0}, { 4959,  4959, 14879},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2445 
2446 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt               }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2447 		{USB11, {ST_NORMAL, CM_COLOR , 4800, 0x00  , -1   , PIXEL_RATE, 0x05 , 47799, 64     , STT_HALF, 0x00     , {23899, 23899, 23899}, {23899, 23899, 23899},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2448 		{USB11, {ST_NORMAL, CM_COLOR , 2400, 0x01  , -1   , PIXEL_RATE, 0x05 , 31849, 256    , STT_FULL, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2449 		{USB11, {ST_NORMAL, CM_COLOR , 1200, 0x02  , -1   , PIXEL_RATE, 0x05 , 15999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2450 		{USB11, {ST_NORMAL, CM_COLOR ,  600, 0x03  ,  2   , PIXEL_RATE, 0x05 ,  7999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2451 		{USB11, {ST_NORMAL, CM_COLOR ,  300, 0x04  ,  3   , PIXEL_RATE, 0x04 ,  2799, 768    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2452 		{USB11, {ST_NORMAL, CM_COLOR ,  150, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2799, 1856   , STT_HALF, 0x01     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2453 
2454 		{USB11, {ST_NORMAL, CM_GRAY  , 4800, 0x05  , -1   , LINE_RATE , 0x05 , 47799, 64     , STT_HALF, 0x00     , {23899, 23899, 23899}, {23899, 23899, 23899},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2455 		{USB11, {ST_NORMAL, CM_GRAY  , 2400, 0x06  , -1   , LINE_RATE , 0x05 , 31849, 256    , STT_FULL, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2456 		{USB11, {ST_NORMAL, CM_GRAY  , 1200, 0x07  , -1   , LINE_RATE , 0x05 , 15999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2457 		{USB11, {ST_NORMAL, CM_GRAY  ,  600, 0x08  ,  2   , LINE_RATE , 0x05 ,  7999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2458 		{USB11, {ST_NORMAL, CM_GRAY  ,  300, 0x09  ,  3   , LINE_RATE , 0x04 ,  2799, 768    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2459 		{USB11, {ST_NORMAL, CM_GRAY  ,  150, 0x09  ,  4   , LINE_RATE , 0x04 ,  2799, 1856   , STT_HALF, 0x01     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2460 
2461 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt               }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2462 		{USB11, {ST_TA    , CM_COLOR , 4800, 0x0A  , -1   , PIXEL_RATE, 0x05 , 53999, 64     , STT_HALF, 0x00     , {26999, 26999, 26999}, {26999, 26999, 26999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2463 		{USB11, {ST_TA    , CM_COLOR , 2400, 0x01  , -1   , PIXEL_RATE, 0x05 , 35999, 256    , STT_FULL, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2464 		{USB11, {ST_TA    , CM_COLOR , 1200, 0x02  , -1   , PIXEL_RATE, 0x05 , 17999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2465 		{USB11, {ST_TA    , CM_COLOR ,  600, 0x03  ,  2   , PIXEL_RATE, 0x05 ,  8999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2466 		{USB11, {ST_TA    , CM_COLOR ,  300, 0x04  ,  3   , PIXEL_RATE, 0x04 ,  2959, 512    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2467 		{USB11, {ST_TA    , CM_COLOR ,  150, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2959, 1024   , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2468 
2469 		{USB11, {ST_TA    , CM_GRAY  , 4800, 0x0B  , -1   , LINE_RATE , 0x05 , 53999, 64     , STT_HALF, 0x00     , {26999, 26999, 26999}, {26999, 26999, 26999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2470 		{USB11, {ST_TA    , CM_GRAY  , 2400, 0x06  , -1   , LINE_RATE , 0x05 , 35999, 256    , STT_FULL, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2471 		{USB11, {ST_TA    , CM_GRAY  , 1200, 0x07  , -1   , LINE_RATE , 0x05 , 17999, 256    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2472 		{USB11, {ST_TA    , CM_GRAY  ,  600, 0x08  ,  3   , LINE_RATE , 0x05 ,  8999, 512    , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2473 		{USB11, {ST_TA    , CM_GRAY  ,  300, 0x09  ,  4   , LINE_RATE , 0x04 ,  2959, 1024   , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2474 		{USB11, {ST_TA    , CM_GRAY  ,  150, 0x09  ,  4   , LINE_RATE , 0x05 ,  2959, 1024   , STT_HALF, 0x00     , {    0,     0,     0}, {    0,     0,     0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2475 
2476 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt               }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2477 		{USB11, {ST_NEG   , CM_COLOR , 4800, 0x0C  , -1   , PIXEL_RATE, 0x05 , 60599, 64     , STT_HALF, 0x00     , {30299, 30299, 30299}, {30299, 30299, 30299},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2478 		{USB11, {ST_NEG   , CM_COLOR , 2400, 0x01  , -1   , PIXEL_RATE, 0x05 ,145799, 256    , STT_FULL, 0x00     , {48599, 97199,     0}, {48599, 48599,145799},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2479 		{USB11, {ST_NEG   , CM_COLOR , 1200, 0x02  , -1   , PIXEL_RATE, 0x05 , 89999, 256    , STT_FULL, 0x00     , {29999, 59999,     0}, {29999, 29999, 89999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2480 		{USB11, {ST_NEG   , CM_COLOR ,  600, 0x03  , -1   , PIXEL_RATE, 0x05 , 45999, 256    , STT_HALF, 0x00     , {15333, 30666,     0}, {15333, 15333, 45999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2481 		{USB11, {ST_NEG   , CM_COLOR ,  300, 0x04  , -1   , PIXEL_RATE, 0x04 , 14879, 256    , STT_HALF, 0x00     , { 4959,  9919,     0}, { 4959,  4959, 14879},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2482 		{USB11, {ST_NEG   , CM_COLOR ,  150, 0x04  ,  3   , PIXEL_RATE, 0x04 , 14879, 256    , STT_HALF, 0x00     , { 4959,  9919,     0}, { 4959,  4959, 14879},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2483 
2484 		{USB11, {ST_NEG   , CM_GRAY  , 4800, 0x0D  , -1   , LINE_RATE , 0x05 , 60599,  64    , STT_FULL, 0x00     , {30299, 30299, 30299}, {30299, 30299, 30299},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2485 		{USB11, {ST_NEG   , CM_GRAY  , 2400, 0x06  , -1   , LINE_RATE , 0x05 ,145799, 256    , STT_FULL, 0x00     , {48599, 97199,     0}, {48599, 48599,145799},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2486 		{USB11, {ST_NEG   , CM_GRAY  , 1200, 0x07  , -1   , LINE_RATE , 0x05 , 89999, 256    , STT_FULL, 0x00     , {29999, 59999,     0}, {29999, 29999, 59999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2487 		{USB11, {ST_NEG   , CM_GRAY  ,  600, 0x08  , -1   , LINE_RATE , 0x05 , 45999, 256    , STT_HALF, 0x00     , {15333, 30666,     0}, {15333, 15333, 45999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2488 		{USB11, {ST_NEG   , CM_GRAY  ,  300, 0x09  , -1   , LINE_RATE , 0x04 , 14879, 256    , STT_HALF, 0x00     , { 4959,  9919,     0}, { 4959,  4959, 14879},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2489 		{USB11, {ST_NEG   , CM_GRAY  ,  150, 0x09  ,  3   , LINE_RATE , 0x04 , 14879, 256    , STT_HALF, 0x00     , { 4959,  9919,     0}, { 4959,  4959, 14879},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }}
2490 	};
2491 
2492 	SANE_Int rst = ERROR;
2493 
2494 	if (mymode != NULL)
2495 	{
2496 		SANE_Int a;
2497 		SANE_Int total = sizeof(reg) / sizeof(struct st_modes);
2498 		SANE_Int count = 0;
2499 		struct st_modes *md;
2500 
2501 		for (a = 0; a < total; a++)
2502 		{
2503 			md = &reg[a];
2504 			if (md->usb == usb)
2505 			{
2506 				if (count == sm)
2507 				{
2508 					memcpy(mymode, &md->mode, sizeof(struct st_scanmode));
2509 					rst = OK;
2510 					break;
2511 				}
2512 
2513 				count++;
2514 			}
2515 		}
2516 	}
2517 
2518 	return rst;
2519 }
2520 
hp3800_scanmodes(SANE_Int usb, SANE_Int sm, struct st_scanmode *mymode)2521 static SANE_Int hp3800_scanmodes(SANE_Int usb, SANE_Int sm, struct st_scanmode *mymode)
2522 {
2523 	struct st_modes
2524 	{
2525 		SANE_Int usb;
2526 		struct st_scanmode mode;
2527 	};
2528 
2529 	struct st_modes reg[] =
2530 	{
2531 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2532 		{USB20, {ST_NORMAL, CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x05 , 23999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2533 		{USB20, {ST_NORMAL, CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x05 , 23999, 96     , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2534 		{USB20, {ST_NORMAL, CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x04 ,  7999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2535 		{USB20, {ST_NORMAL, CM_COLOR ,  300, 0x03  ,  9   , PIXEL_RATE, 0x04 ,  4999, 256    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2536 		{USB20, {ST_NORMAL, CM_COLOR ,  150, 0x03  , 10   , PIXEL_RATE, 0x04 ,  2999, 1024   , STT_HALF, 0x01     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2537 
2538 		{USB20, {ST_NORMAL, CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x05 , 23999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2539 		{USB20, {ST_NORMAL, CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x05 , 23999, 96     , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2540 		{USB20, {ST_NORMAL, CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x04 ,  7999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2541 		{USB20, {ST_NORMAL, CM_GRAY  ,  300, 0x08  ,  9   , LINE_RATE , 0x04 ,  4999, 256    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2542 		{USB20, {ST_NORMAL, CM_GRAY  ,  150, 0x08  , 10   , LINE_RATE , 0x04 ,  2999, 1024   , STT_HALF, 0x01     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2543 
2544 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2545 		{USB20, {ST_TA    , CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x05 , 23999, 96     , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2546 		{USB20, {ST_TA    , CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x05 , 23999, 96     , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2547 		{USB20, {ST_TA    , CM_COLOR ,  600, 0x09  , -1   , PIXEL_RATE, 0x04 ,  5999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2548 		{USB20, {ST_TA    , CM_COLOR ,  300, 0x03  ,  3   , PIXEL_RATE, 0x04 ,  2999, 256    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2549 		{USB20, {ST_TA    , CM_COLOR ,  150, 0x03  , 10   , PIXEL_RATE, 0x04 ,  2999, 1024   , STT_HALF, 0x01     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2550 
2551 		{USB20, {ST_TA    , CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x05 , 23999, 96     , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2552 		{USB20, {ST_TA    , CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x05 , 23999, 96     , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2553 		{USB20, {ST_TA    , CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x04 ,  5999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2554 		{USB20, {ST_TA    , CM_GRAY  ,  300, 0x08  ,  3   , LINE_RATE , 0x04 ,  2999, 256    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2555 		{USB20, {ST_TA    , CM_GRAY  ,  150, 0x08  , 10   , LINE_RATE , 0x04 ,  2999, 1024   , STT_HALF, 0x01     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2556 
2557 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt           }, {mexpt               }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2558 		{USB20, {ST_NEG   , CM_COLOR , 2400, 0x0A  , -1   , PIXEL_RATE, 0x04 ,127999, 96     , STT_HALF, 0x00     , {    0,     0, 0}, {127999,127999,127999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2559 		{USB20, {ST_NEG   , CM_COLOR , 1200, 0x0B  , -1   , PIXEL_RATE, 0x05 ,127999, 128    , STT_HALF, 0x00     , {    0,     0, 0}, {127999,127999,127999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2560 		{USB20, {ST_NEG   , CM_COLOR ,  600, 0x0C  , -1   , PIXEL_RATE, 0x04 , 31999, 128    , STT_HALF, 0x00     , {    0,     0, 0}, { 31999, 31999, 31999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2561 		{USB20, {ST_NEG   , CM_COLOR ,  300, 0x0D  , -1   , PIXEL_RATE, 0x04 , 15999, 256    , STT_HALF, 0x00     , {    0,     0, 0}, { 15999, 15999, 15999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2562 		{USB20, {ST_NEG   , CM_COLOR ,  150, 0x0D  , 10   , PIXEL_RATE, 0x04 , 15999, 1024   , STT_HALF, 0x01     , {    0,     0, 0}, { 15999, 15999, 15999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2563 
2564 		{USB20, {ST_NEG   , CM_GRAY  , 2400, 0x0F  , -1   , LINE_RATE , 0x05 ,127999, 96     , STT_HALF, 0x00     , {    0,     0, 0}, {127999,127999,127999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2565 		{USB20, {ST_NEG   , CM_GRAY  , 1200, 0x10  , -1   , LINE_RATE , 0x05 ,127999, 96     , STT_HALF, 0x00     , {    0,     0, 0}, {127999,127999,127999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2566 		{USB20, {ST_NEG   , CM_GRAY  ,  600, 0x11  , -1   , LINE_RATE , 0x04 , 31999, 128    , STT_HALF, 0x00     , {    0,     0, 0}, { 31999, 31999, 31999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2567 		{USB20, {ST_NEG   , CM_GRAY  ,  300, 0x12  , -1   , LINE_RATE , 0x04 , 15999, 256    , STT_HALF, 0x00     , {    0,     0, 0}, { 15999, 15999, 15999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2568 		{USB20, {ST_NEG   , CM_GRAY  ,  150, 0x12  , 10   , LINE_RATE , 0x04 , 15999, 1024   , STT_HALF, 0x01     , {    0,     0, 0}, { 15999, 15999, 15999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2569 
2570 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2571 		{USB11, {ST_NORMAL, CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x05 , 23999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  2     ,  5       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2572 		{USB11, {ST_NORMAL, CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x05 , 23999, 96     , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  2     ,  3       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2573 		{USB11, {ST_NORMAL, CM_COLOR ,  600, 0x02  , -1   , PIXEL_RATE, 0x04 ,  7999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2574 		{USB11, {ST_NORMAL, CM_COLOR ,  300, 0x03  ,  9   , PIXEL_RATE, 0x04 ,  4999, 256    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2575 		{USB11, {ST_NORMAL, CM_COLOR ,  150, 0x03  , 10   , PIXEL_RATE, 0x04 ,  2999, 1024   , STT_HALF, 0x01     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2576 
2577 		{USB11, {ST_NORMAL, CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x05 , 23999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  2     ,  2       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2578 		{USB11, {ST_NORMAL, CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x05 , 23999, 96     , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  2     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2579 		{USB11, {ST_NORMAL, CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x04 ,  7999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2580 		{USB11, {ST_NORMAL, CM_GRAY  ,  300, 0x08  ,  9   , LINE_RATE , 0x04 ,  4999, 256    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2581 		{USB11, {ST_NORMAL, CM_GRAY  ,  150, 0x08  , 10   , LINE_RATE , 0x04 ,  2999, 1024   , STT_HALF, 0x01     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2582 
2583 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2584 		{USB11, {ST_TA    , CM_COLOR , 2400, 0x00  , -1   , PIXEL_RATE, 0x05 , 23999, 96     , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2585 		{USB11, {ST_TA    , CM_COLOR , 1200, 0x01  , -1   , PIXEL_RATE, 0x05 , 23999, 96     , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2586 		{USB11, {ST_TA    , CM_COLOR ,  600, 0x09  , -1   , PIXEL_RATE, 0x04 ,  5999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2587 		{USB11, {ST_TA    , CM_COLOR ,  300, 0x03  ,  3   , PIXEL_RATE, 0x04 ,  2999, 256    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2588 		{USB11, {ST_TA    , CM_COLOR ,  150, 0x03  , 10   , PIXEL_RATE, 0x04 ,  2999, 1024   , STT_HALF, 0x01     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2589 
2590 		{USB11, {ST_TA    , CM_GRAY  , 2400, 0x05  , -1   , LINE_RATE , 0x05 , 23999, 96     , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2591 		{USB11, {ST_TA    , CM_GRAY  , 1200, 0x06  , -1   , LINE_RATE , 0x05 , 23999, 96     , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2592 		{USB11, {ST_TA    , CM_GRAY  ,  600, 0x07  , -1   , LINE_RATE , 0x04 ,  5999, 128    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2593 		{USB11, {ST_TA    , CM_GRAY  ,  300, 0x08  ,  3   , LINE_RATE , 0x04 ,  2999, 256    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2594 		{USB11, {ST_TA    , CM_GRAY  ,  150, 0x08  , 10   , LINE_RATE , 0x04 ,  2999, 1024   , STT_HALF, 0x01     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2595 
2596 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt           }, {mexpt               }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2597 		{USB11, {ST_NEG   , CM_COLOR , 2400, 0x0A  , -1   , PIXEL_RATE, 0x04 ,127999, 96     , STT_HALF, 0x00     , {    0,     0, 0}, {127999,127999,127999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2598 		{USB11, {ST_NEG   , CM_COLOR , 1200, 0x0B  , -1   , PIXEL_RATE, 0x05 ,127999, 128    , STT_HALF, 0x00     , {    0,     0, 0}, {127999,127999,127999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2599 		{USB11, {ST_NEG   , CM_COLOR ,  600, 0x0C  , -1   , PIXEL_RATE, 0x04 , 31999, 128    , STT_HALF, 0x00     , {    0,     0, 0}, { 31999, 31999, 31999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2600 		{USB11, {ST_NEG   , CM_COLOR ,  300, 0x0D  , -1   , PIXEL_RATE, 0x04 , 15999, 256    , STT_HALF, 0x00     , {    0,     0, 0}, { 15999, 15999, 15999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2601 		{USB11, {ST_NEG   , CM_COLOR ,  150, 0x0D  , 10   , PIXEL_RATE, 0x04 , 15999, 1024   , STT_HALF, 0x01     , {    0,     0, 0}, { 15999, 15999, 15999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2602 
2603 		{USB11, {ST_NEG   , CM_GRAY  , 2400, 0x0F  , -1   , LINE_RATE , 0x05 ,127999, 96     , STT_HALF, 0x00     , {    0,     0, 0}, {127999,127999,127999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2604 		{USB11, {ST_NEG   , CM_GRAY  , 1200, 0x10  , -1   , LINE_RATE , 0x05 ,127999, 96     , STT_HALF, 0x00     , {    0,     0, 0}, {127999,127999,127999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2605 		{USB11, {ST_NEG   , CM_GRAY  ,  600, 0x11  , -1   , LINE_RATE , 0x04 , 31999, 128    , STT_HALF, 0x00     , {    0,     0, 0}, { 31999, 31999, 31999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2606 		{USB11, {ST_NEG   , CM_GRAY  ,  300, 0x12  , -1   , LINE_RATE , 0x04 , 15999, 256    , STT_HALF, 0x00     , {    0,     0, 0}, { 15999, 15999, 15999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2607 		{USB11, {ST_NEG   , CM_GRAY  ,  150, 0x12  , 10   , LINE_RATE , 0x04 , 15999, 1024   , STT_HALF, 0x01     , {    0,     0, 0}, { 15999, 15999, 15999},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }}
2608 	};
2609 
2610 	SANE_Int rst = ERROR;
2611 
2612 	if (mymode != NULL)
2613 	{
2614 		SANE_Int a;
2615 		SANE_Int total = sizeof(reg) / sizeof(struct st_modes);
2616 		SANE_Int count = 0;
2617 		struct st_modes *md;
2618 
2619 		for (a = 0; a < total; a++)
2620 		{
2621 			md = &reg[a];
2622 			if (md->usb == usb)
2623 			{
2624 				if (count == sm)
2625 				{
2626 					memcpy(mymode, &md->mode, sizeof(struct st_scanmode));
2627 					rst = OK;
2628 					break;
2629 				}
2630 
2631 				count++;
2632 			}
2633 		}
2634 	}
2635 
2636 	return rst;
2637 }
2638 
bq5550_scanmodes(SANE_Int usb, SANE_Int sm, struct st_scanmode *mymode)2639 static SANE_Int bq5550_scanmodes(SANE_Int usb, SANE_Int sm, struct st_scanmode *mymode)
2640 {
2641 	struct st_modes
2642 	{
2643 		SANE_Int usb;
2644 		struct st_scanmode mode;
2645 	};
2646 
2647 	struct st_modes reg[] =
2648 	{
2649 		/* usb, {scantype , colormode , res , timing, curve, samplerate, clock, ctpc , backstp, steptype , dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2650 		{USB20, {ST_NORMAL, CM_COLOR  , 1200, 0x00  , -1   , PIXEL_RATE, 0x05 , 12999, 10     , STT_QUART, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  3       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2651 		{USB20, {ST_NORMAL, CM_COLOR  ,  600, 0x01  , -1   , PIXEL_RATE, 0x05 ,  6999, 32     , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  5       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2652 		{USB20, {ST_NORMAL, CM_COLOR  ,  300, 0x02  ,  0   , PIXEL_RATE, 0x05 ,  5599, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  3       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2653 		{USB20, {ST_NORMAL, CM_COLOR  ,  150, 0x02  ,  0   , PIXEL_RATE, 0x05 ,  6439, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  2       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2654 		{USB20, {ST_NORMAL, CM_COLOR  ,  100, 0x02  ,  0   , PIXEL_RATE, 0x05 ,  5759, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2655 
2656 		{USB20, {ST_NORMAL, CM_GRAY   , 1200, 0x03  , -1   , LINE_RATE , 0x05 , 12999, 10     , STT_QUART, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  3       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2657 		{USB20, {ST_NORMAL, CM_GRAY   ,  600, 0x04  , -1   , LINE_RATE , 0x05 ,  7199, 32     , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  2       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2658 		{USB20, {ST_NORMAL, CM_GRAY   ,  300, 0x05  ,  0   , LINE_RATE , 0x05 ,  5599, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2659 		{USB20, {ST_NORMAL, CM_GRAY   ,  150, 0x05  ,  0   , LINE_RATE , 0x05 ,  6239, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2660 		{USB20, {ST_NORMAL, CM_GRAY   ,  100, 0x05  ,  0   , LINE_RATE , 0x05 ,  5759, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2661 
2662 		{USB20, {ST_NORMAL, CM_LINEART, 1200, 0x03  , -1   , LINE_RATE , 0x05 , 12999, 10     , STT_QUART, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  3       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2663 		{USB20, {ST_NORMAL, CM_LINEART,  600, 0x04  , -1   , LINE_RATE , 0x05 ,  7199, 32     , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  2       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2664 		{USB20, {ST_NORMAL, CM_LINEART,  300, 0x05  ,  0   , LINE_RATE , 0x05 ,  5599, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2665 		{USB20, {ST_NORMAL, CM_LINEART,  150, 0x05  ,  0   , LINE_RATE , 0x05 ,  6239, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2666 		{USB20, {ST_NORMAL, CM_LINEART,  100, 0x05  ,  0   , LINE_RATE , 0x05 ,  5759, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2667 
2668 		/* usb, {scantype , colormode , res , timing, curve, samplerate, clock, ctpc , backstp, steptype , dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2669 		{USB20, {ST_TA    , CM_COLOR  , 1200, 0x00  , -1   , PIXEL_RATE, 0x05 ,  9899, 10     , STT_QUART, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2670 		{USB20, {ST_TA    , CM_COLOR  ,  600, 0x01  , -1   , PIXEL_RATE, 0x05 ,  9999, 32     , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2671 		{USB20, {ST_TA    , CM_COLOR  ,  300, 0x02  ,  0   , PIXEL_RATE, 0x05 ,  4799, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2672 		{USB20, {ST_TA    , CM_COLOR  ,  150, 0x02  ,  0   , PIXEL_RATE, 0x05 ,  4959, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2673 		{USB20, {ST_TA    , CM_COLOR  ,  100, 0x02  ,  0   , PIXEL_RATE, 0x05 ,  5059, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2674 
2675 		{USB20, {ST_TA    , CM_GRAY   , 1200, 0x03  , -1   , LINE_RATE , 0x05 ,  9899, 10     , STT_QUART, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2676 		{USB20, {ST_TA    , CM_GRAY   ,  600, 0x04  , -1   , LINE_RATE , 0x05 ,  9999, 32     , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2677 		{USB20, {ST_TA    , CM_GRAY   ,  300, 0x05  ,  0   , LINE_RATE , 0x05 ,  4799, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2678 		{USB20, {ST_TA    , CM_GRAY   ,  150, 0x05  ,  0   , LINE_RATE , 0x05 ,  4959, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2679 		{USB20, {ST_TA    , CM_GRAY   ,  100, 0x05  ,  0   , LINE_RATE , 0x05 ,  5059, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2680 
2681 		{USB20, {ST_TA    , CM_LINEART, 1200, 0x03  , -1   , LINE_RATE , 0x05 ,  9899, 10     , STT_QUART, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2682 		{USB20, {ST_TA    , CM_LINEART,  600, 0x04  , -1   , LINE_RATE , 0x05 ,  9999, 32     , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2683 		{USB20, {ST_TA    , CM_LINEART,  300, 0x05  ,  0   , LINE_RATE , 0x05 ,  4799, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2684 		{USB20, {ST_TA    , CM_LINEART,  150, 0x05  ,  0   , LINE_RATE , 0x05 ,  4959, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2685 		{USB20, {ST_TA    , CM_LINEART,  100, 0x05  ,  0   , LINE_RATE , 0x05 ,  5059, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2686 
2687 		/* usb, {scantype , colormode , res , timing, curve, samplerate, clock, ctpc , backstp, steptype , dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2688 		{USB20, {ST_NEG   , CM_COLOR  , 1200, 0x00  , -1   , PIXEL_RATE, 0x05 , 51899, 10     , STT_QUART, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2689 		{USB20, {ST_NEG   , CM_COLOR  ,  600, 0x01  , -1   , PIXEL_RATE, 0x05 , 51799, 32     , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2690 		{USB20, {ST_NEG   , CM_COLOR  ,  300, 0x02  ,  0   , PIXEL_RATE, 0x05 , 25899, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2691 		{USB20, {ST_NEG   , CM_COLOR  ,  150, 0x02  ,  0   , PIXEL_RATE, 0x05 , 25899, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2692 		{USB20, {ST_NEG   , CM_COLOR  ,  100, 0x02  ,  0   , PIXEL_RATE, 0x05 , 25499, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2693 
2694 		{USB20, {ST_NEG   , CM_GRAY   , 1200, 0x03  , -1   , LINE_RATE , 0x05 , 51899, 10     , STT_QUART, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2695 		{USB20, {ST_NEG   , CM_GRAY   ,  600, 0x04  , -1   , LINE_RATE , 0x05 , 51799, 32     , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2696 		{USB20, {ST_NEG   , CM_GRAY   ,  300, 0x05  ,  0   , LINE_RATE , 0x05 , 25899, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2697 		{USB20, {ST_NEG   , CM_GRAY   ,  150, 0x05  ,  0   , LINE_RATE , 0x05 , 25899, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2698 		{USB20, {ST_NEG   , CM_GRAY   ,  100, 0x05  ,  0   , LINE_RATE , 0x05 , 25499, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2699 
2700 		{USB20, {ST_NEG   , CM_LINEART, 1200, 0x03  , -1   , LINE_RATE , 0x05 , 51899, 10     , STT_QUART, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2701 		{USB20, {ST_NEG   , CM_LINEART,  600, 0x04  , -1   , LINE_RATE , 0x05 , 51799, 32     , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2702 		{USB20, {ST_NEG   , CM_LINEART,  300, 0x05  ,  0   , LINE_RATE , 0x05 , 25899, 128    , STT_FULL , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2703 		{USB20, {ST_NEG   , CM_LINEART,  150, 0x05  ,  0   , LINE_RATE , 0x05 , 25899, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2704 		{USB20, {ST_NEG   , CM_LINEART,  100, 0x05  ,  0   , LINE_RATE , 0x05 , 25499, 128    , STT_HALF , 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }}
2705 	};
2706 
2707 	SANE_Int rst = ERROR;
2708 
2709 	/* silence compiler */
2710 	(void) usb;
2711 
2712 	if (mymode != NULL)
2713 	{
2714 		SANE_Int a;
2715 		SANE_Int total = sizeof(reg) / sizeof(struct st_modes);
2716 		SANE_Int count = 0;
2717 		struct st_modes *md;
2718 
2719 		for (a = 0; a < total; a++)
2720 		{
2721 			md = &reg[a];
2722 			if (count == sm)
2723 			{
2724 				memcpy(mymode, &md->mode, sizeof(struct st_scanmode));
2725 				rst = OK;
2726 				break;
2727 			}
2728 
2729 			count++;
2730 		}
2731 	}
2732 
2733 	return rst;
2734 }
2735 
ua4900_scanmodes(SANE_Int usb, SANE_Int sm, struct st_scanmode *mymode)2736 static SANE_Int ua4900_scanmodes(SANE_Int usb, SANE_Int sm, struct st_scanmode *mymode)
2737 {
2738 	struct st_modes
2739 	{
2740 		SANE_Int usb;
2741 		struct st_scanmode mode;
2742 	};
2743 
2744 	struct st_modes reg[] =
2745 	{
2746 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2747 		{USB20, {ST_NORMAL, CM_COLOR , 1200, 0x00  , -1   , PIXEL_RATE, 0x05 , 14667, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2748 		{USB20, {ST_NORMAL, CM_COLOR ,  600, 0x01  ,  2   , PIXEL_RATE, 0x04 ,  5499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2749 		{USB20, {ST_NORMAL, CM_COLOR ,  300, 0x02  ,  3   , PIXEL_RATE, 0x04 ,  2751, 768    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2750 		{USB20, {ST_NORMAL, CM_COLOR ,  200, 0x03  ,  4   , PIXEL_RATE, 0x04 ,  2255, 1856   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2751 		{USB20, {ST_NORMAL, CM_COLOR ,  100, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  2255, 1856   , STT_HALF, 0x02     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2752 
2753 		{USB20, {ST_NORMAL, CM_GRAY  , 1200, 0x05  , -1   , LINE_RATE , 0x05 , 14667, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2754 		{USB20, {ST_NORMAL, CM_GRAY  ,  600, 0x06  ,  2   , LINE_RATE , 0x04 ,  5499, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2755 		{USB20, {ST_NORMAL, CM_GRAY  ,  300, 0x07  ,  3   , LINE_RATE , 0x04 ,  2751, 768    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2756 		{USB20, {ST_NORMAL, CM_GRAY  ,  200, 0x08  ,  4   , LINE_RATE , 0x04 ,  2255, 1856   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2757 		{USB20, {ST_NORMAL, CM_GRAY  ,  100, 0x09  ,  4   , LINE_RATE , 0x04 ,  2255, 1856   , STT_HALF, 0x02     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2758 
2759 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt      }, {mexpt     }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2760 		{USB20, {ST_TA    , CM_COLOR , 1200, 0x00  , -1   , PIXEL_RATE, 0x03 , 10899, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2761 		{USB20, {ST_TA    , CM_COLOR ,  600, 0x01  , -1   , PIXEL_RATE, 0x01 ,  5487, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2762 		{USB20, {ST_TA    , CM_COLOR ,  300, 0x02  ,  3   , PIXEL_RATE, 0x04 ,  8351, 512    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2763 		{USB20, {ST_TA    , CM_COLOR ,  200, 0x03  ,  4   , PIXEL_RATE, 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2764 		{USB20, {ST_TA    , CM_COLOR ,  100, 0x04  ,  4   , PIXEL_RATE, 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2765 
2766 		{USB20, {ST_TA    , CM_GRAY  , 1200, 0x05  , -1   , LINE_RATE , 0x03 , 10899, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2767 		{USB20, {ST_TA    , CM_GRAY  ,  600, 0x06  , -1   , LINE_RATE , 0x01 ,  5487, 256    , STT_FULL, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2768 		{USB20, {ST_TA    , CM_GRAY  ,  300, 0x07  ,  3   , LINE_RATE , 0x04 ,  8351, 512    , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2769 		{USB20, {ST_TA    , CM_GRAY  ,  200, 0x08  ,  4   , LINE_RATE , 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2770 		{USB20, {ST_TA    , CM_GRAY  ,  100, 0x09  ,  4   , LINE_RATE , 0x04 ,  7343, 1024   , STT_HALF, 0x00     , { 0,  0,  0}, { 0,  0,  0},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2771 
2772 		/* usb, {scantype , colormode, res , timing, curve, samplerate, clock, ctpc , backstp, steptype, dummyline, {expt           }, {mexpt              }, motorplus, mexpt16, mexptfull, mexposure, mri , msi , mmtir, mmtirh, skips } */
2773 		{USB20, {ST_NEG   , CM_COLOR , 1200, 0x00  , -1   , PIXEL_RATE, 0x03 , 36467, 256    , STT_FULL, 0x00     , {12155, 24311, 0}, {12155, 12155, 36467},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2774 		{USB20, {ST_NEG   , CM_COLOR ,  600, 0x01  , -1   , PIXEL_RATE, 0x02 , 16463, 256    , STT_FULL, 0x00     , { 5487, 10975, 0}, { 5487,  5487, 16463},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2775 		{USB20, {ST_NEG   , CM_COLOR ,  300, 0x02  , -1   , PIXEL_RATE, 0x02 ,  8351, 256    , STT_HALF, 0x00     , { 2783,  5567, 0}, { 2783,  2783,  8351},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2776 		{USB20, {ST_NEG   , CM_COLOR ,  200, 0x03  , -1   , PIXEL_RATE, 0x02 ,  6191, 256    , STT_HALF, 0x00     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2777 		{USB20, {ST_NEG   , CM_COLOR ,  100, 0x04  , -1   , PIXEL_RATE, 0x02 ,  6191, 256    , STT_HALF, 0x02     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2778 
2779 		{USB20, {ST_NEG   , CM_GRAY  , 1200, 0x05  , -1   , LINE_RATE , 0x03 , 36467, 256    , STT_FULL, 0x00     , {12155, 24311, 0}, {12155, 12155, 36467},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2780 		{USB20, {ST_NEG   , CM_GRAY  ,  600, 0x06  , -1   , LINE_RATE , 0x02 , 16463, 256    , STT_FULL, 0x00     , { 5487, 10975, 0}, { 5487,  5487, 16463},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2781 		{USB20, {ST_NEG   , CM_GRAY  ,  300, 0x07  , -1   , LINE_RATE , 0x02 ,  8351, 256    , STT_HALF, 0x00     , { 2783,  5567, 0}, { 2783,  2783,  8351},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2782 		{USB20, {ST_NEG   , CM_GRAY  ,  200, 0x08  , -1   , LINE_RATE , 0x02 ,  6191, 256    , STT_HALF, 0x00     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }},
2783 		{USB20, {ST_NEG   , CM_GRAY  ,  100, 0x09  , -1   , LINE_RATE , 0x02 ,  6191, 256    , STT_HALF, 0x02     , { 2063,  4127, 0}, { 2063,  2063,  6191},  0       ,  1     ,  1       , 0x01     , 0x01, 0x10, 0x02 , 0x02  , 0x00  }}
2784 	};
2785 
2786 	SANE_Int rst = ERROR;
2787 
2788 	if (mymode != NULL)
2789 	{
2790 		SANE_Int a;
2791 		SANE_Int total = sizeof(reg) / sizeof(struct st_modes);
2792 		SANE_Int count = 0;
2793 		struct st_modes *md;
2794 
2795 		for (a = 0; a < total; a++)
2796 		{
2797 			md = &reg[a];
2798 			if (md->usb == usb)
2799 			{
2800 				if (count == sm)
2801 				{
2802 					memcpy(mymode, &md->mode, sizeof(struct st_scanmode));
2803 					rst = OK;
2804 					break;
2805 				}
2806 
2807 				count++;
2808 			}
2809 		}
2810 	}
2811 
2812 	return rst;
2813 }
2814 
2815 /** SEC: Calibration wreferences ---------- */
2816 
hp3970_wrefs(SANE_Int usb, SANE_Int ccd, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)2817 static void hp3970_wrefs(SANE_Int usb, SANE_Int ccd, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)
2818 {
2819 	struct st_wref
2820 	{
2821 		SANE_Int usb;
2822 		SANE_Int sensor;
2823 		SANE_Int depth;
2824 		SANE_Int res;
2825 		SANE_Int transparent[3];
2826 		SANE_Int negative[3];
2827 	};
2828 
2829 	struct st_wref wrefs[] =
2830 	{
2831 		/*usb , sensor     , depth, res , {transparent  }, {negative} */
2832 		{USB20, CCD_SENSOR, 8    , 2400, { 78,  78,  68}, {120, 136, 157}},
2833 		{USB20, CCD_SENSOR, 8    , 1200, { 78,  78,  68}, {120, 136, 157}},
2834 		{USB20, CCD_SENSOR, 8    , 600 , { 79,  80,  70}, {119, 136, 157}},
2835 		{USB20, CCD_SENSOR, 8    , 300 , { 79,  80,  70}, {119, 136, 157}},
2836 		{USB20, CCD_SENSOR, 8    , 200 , { 79,  80,  70}, {119, 136, 157}},
2837 		{USB20, CCD_SENSOR, 8    , 100 , { 79,  80,  70}, {119, 136, 157}},
2838 
2839 		{USB20, CCD_SENSOR, 16   , 2400, { 81,  81,  71}, {119, 137, 158}},
2840 		{USB20, CCD_SENSOR, 16   , 1200, { 81,  81,  71}, {119, 137, 158}},
2841 		{USB20, CCD_SENSOR, 16   , 600 , { 81,  82,  72}, {119, 137, 158}},
2842 		{USB20, CCD_SENSOR, 16   , 300 , { 81,  82,  72}, {119, 137, 158}},
2843 		{USB20, CCD_SENSOR, 16   , 200 , { 81,  82,  72}, {119, 137, 158}},
2844 		{USB20, CCD_SENSOR, 16   , 100 , { 81,  82,  72}, {119, 137, 158}},
2845 
2846 		/*usb , sensor    , depth, res , {transparent  }, {negative     } */
2847 		{USB20, CIS_SENSOR, 8    , 2400, { 94,  85,  78}, { 94,  85,  78}},
2848 		{USB20, CIS_SENSOR, 8    , 1200, { 83,  82,  75}, {140, 155, 155}},
2849 		{USB20, CIS_SENSOR, 8    , 600 , { 84,  84,  76}, {145, 155, 165}},
2850 		{USB20, CIS_SENSOR, 8    , 300 , {146, 166, 166}, {146, 166, 166}},
2851 		{USB20, CIS_SENSOR, 8    , 200 , {145, 310, 160}, {145, 310, 160}},
2852 		{USB20, CIS_SENSOR, 8    , 100 , {140, 300, 155}, {140, 300, 155}},
2853 
2854 		{USB20, CIS_SENSOR, 16   , 2400, { 94,  85,  78}, { 94,  85,  78}},
2855 		{USB20, CIS_SENSOR, 16   , 1200, { 83,  82,  75}, {140, 155, 155}},
2856 		{USB20, CIS_SENSOR, 16   , 600 , { 84,  84,  76}, {145, 155, 165}},
2857 		{USB20, CIS_SENSOR, 16   , 300 , {146, 166, 166}, {146, 166, 166}},
2858 		{USB20, CIS_SENSOR, 16   , 200 , {145, 310, 160}, {145, 310, 160}},
2859 		{USB20, CIS_SENSOR, 16   , 100 , {140, 300, 155}, {140, 300, 155}},
2860 
2861 		/*usb , sensor     , depth, res , {transparent  }, {negative     } */
2862 		{USB11, CCD_SENSOR, 8    , 2400, { 78,  78,  68}, {120, 137, 158}},
2863 		{USB11, CCD_SENSOR, 8    , 1200, { 78,  78,  68}, {120, 137, 158}},
2864 		{USB11, CCD_SENSOR, 8    , 600 , { 79,  79,  70}, {120, 137, 158}},
2865 		{USB11, CCD_SENSOR, 8    , 300 , { 79,  79,  70}, {120, 137, 158}},
2866 		{USB11, CCD_SENSOR, 8    , 200 , { 79,  79,  70}, {120, 137, 158}},
2867 		{USB11, CCD_SENSOR, 8    , 100 , { 79,  79,  70}, {120, 137, 158}},
2868 
2869 		{USB11, CCD_SENSOR, 16   , 2400, { 80,  80,  70}, {120, 137, 158}},
2870 		{USB11, CCD_SENSOR, 16   , 1200, { 80,  80,  70}, {120, 137, 158}},
2871 		{USB11, CCD_SENSOR, 16   , 600 , { 80,  81,  71}, {120, 137, 158}},
2872 		{USB11, CCD_SENSOR, 16   , 300 , { 80,  81,  71}, {120, 137, 158}},
2873 		{USB11, CCD_SENSOR, 16   , 200 , { 80,  81,  71}, {120, 137, 158}},
2874 		{USB11, CCD_SENSOR, 16   , 100 , { 80,  81,  71}, {120, 137, 158}},
2875 
2876 		/*usb , sensor    , depth, res , {transparent  }, {negative} */
2877 		{USB11, CIS_SENSOR, 8    , 2400, { 94,  85,  78}, {94 , 85 ,  78}},
2878 		{USB11, CIS_SENSOR, 8    , 1200, { 83,  82,  75}, {140, 155, 155}},
2879 		{USB11, CIS_SENSOR, 8    , 600 , { 84,  84,  76}, {145, 155, 165}},
2880 		{USB11, CIS_SENSOR, 8    , 300 , {146, 166, 166}, {146, 166, 166}},
2881 		{USB11, CIS_SENSOR, 8    , 200 , {145, 310, 160}, {145, 310, 160}},
2882 		{USB11, CIS_SENSOR, 8    , 100 , {140, 300, 155}, {140, 300, 155}},
2883 
2884 		{USB11, CIS_SENSOR, 16   , 2400, { 94,  85,  78}, { 94,  85,  78}},
2885 		{USB11, CIS_SENSOR, 16   , 1200, { 83,  82,  75}, {140, 155, 155}},
2886 		{USB11, CIS_SENSOR, 16   , 600 , { 84,  84,  76}, {145, 155, 165}},
2887 		{USB11, CIS_SENSOR, 16   , 300 , {146, 166, 166}, {146, 166, 166}},
2888 		{USB11, CIS_SENSOR, 16   , 200 , {145, 310, 160}, {145, 310, 160}},
2889 		{USB11, CIS_SENSOR, 16   , 100 , {140, 300, 155}, {140, 300, 155}}
2890 	};
2891 
2892 	struct st_wref *rf;
2893 
2894 	*red = *green = *blue = 0x50;
2895 
2896 	if (res <= 100)
2897 		res = 100;
2898 	else if (res <= 200)
2899 		res = 200;
2900 	else if (res <= 300)
2901 		res = 300;
2902 	else if (res <= 600)
2903 		res = 600;
2904 	else if (res <= 1200)
2905 		res = 1200;
2906 	else res = 2400;
2907 
2908 	if (scantype != ST_NORMAL)
2909 	{
2910 		SANE_Int a;
2911 		SANE_Int count = sizeof(wrefs) / sizeof(struct st_wref);
2912 
2913 		for (a = 0; a < count; a++)
2914 		{
2915 			rf = &wrefs[a];
2916 			if ((rf->usb == usb)&&(rf->sensor == ccd)&&(rf->depth == depth)&&(rf->res == res))
2917 			{
2918 				switch(scantype)
2919 				{
2920 					case ST_NEG:
2921 						*red   = rf->negative[CL_RED];
2922 						*green = rf->negative[CL_GREEN];
2923 						*blue  = rf->negative[CL_BLUE];
2924 						break;
2925 					case ST_TA:
2926 						*red   = rf->transparent[CL_RED];
2927 						*green = rf->transparent[CL_GREEN];
2928 						*blue  = rf->transparent[CL_BLUE];
2929 						break;
2930 				}
2931 
2932 				break;
2933 			}
2934 		}
2935 	} else
2936 	{
2937 		/* reflective mode */
2938 		*red   = 233;
2939 		*green = 230;
2940 		*blue  = 222;
2941 	}
2942 }
2943 
ua4900_wrefs(SANE_Int usb, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)2944 static void ua4900_wrefs(SANE_Int usb, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)
2945 {
2946 	struct st_wref
2947 	{
2948 		SANE_Int usb;
2949 		SANE_Int depth;
2950 		SANE_Int res;
2951 		SANE_Int transparent[3];
2952 		SANE_Int negative[3];
2953 	};
2954 
2955 	struct st_wref wrefs[] =
2956 	{
2957 		/*usb , depth, res , {transparent  }, {negative     } */
2958 		{USB20, 8    , 1200, {136, 131, 121}, {215, 210, 260}},
2959 		{USB20, 8    , 600 , {133, 129, 118}, {219, 215, 264}},
2960 		{USB20, 8    , 300 , {133, 129, 119}, {218, 215, 261}},
2961 		{USB20, 8    , 200 , {133, 130, 119}, {218, 215, 261}},
2962 		{USB20, 8    , 100 , {132, 128, 118}, {218, 215, 261}},
2963 
2964 		{USB20, 16   , 1200, {264, 263, 266}, {  0,   0,   0}},
2965 		{USB20, 16   , 600 , {264, 265, 268}, {  0,   0,   0}},
2966 		{USB20, 16   , 300 , {264, 260, 263}, {  0,   0,   0}},
2967 		{USB20, 16   , 200 , {257, 255, 253}, {  0,   0,   0}},
2968 		{USB20, 16   , 100 , {258, 259, 256}, {  0,   0,   0}},
2969 
2970 		/*usb , depth, res , {transparent  }, {negative     } */
2971 		{USB11, 8    , 1200, {135, 130, 119}, {220, 215, 264}},
2972 		{USB11, 8    , 600 , {132, 128, 117}, {217, 213, 259}},
2973 		{USB11, 8    , 300 , {132, 128, 117}, {216, 211, 259}},
2974 		{USB11, 8    , 200 , {132, 128, 118}, {215, 352, 259}},
2975 		{USB11, 8    , 100 , {266, 264, 264}, {215, 352, 259}},
2976 
2977 		{USB11, 16   , 1200, {264, 263, 266}, {  0,   0,   0}},
2978 		{USB11, 16   , 600 , {257, 256, 253}, {  0,   0,   0}},
2979 		{USB11, 16   , 300 , {259, 252, 254}, {  0,   0,   0}},
2980 		{USB11, 16   , 200 , {257, 255, 253}, {  0,   0,   0}},
2981 		{USB11, 16   , 100 , {258, 259, 256}, {  0,   0,   0}}
2982 	};
2983 
2984 	struct st_wref *rf;
2985 
2986 	*red = *green = *blue = 0x50;
2987 
2988 	if (res <= 100)
2989 		res = 100;
2990 	else if (res <= 200)
2991 		res = 200;
2992 	else if (res <= 300)
2993 		res = 300;
2994 	else if (res <= 600)
2995 		res = 600;
2996 	else res = 1200;
2997 
2998 	if (scantype != ST_NORMAL)
2999 	{
3000 		SANE_Int a;
3001 		SANE_Int count = sizeof(wrefs) / sizeof(struct st_wref);
3002 
3003 		for (a = 0; a < count; a++)
3004 		{
3005 			rf = &wrefs[a];
3006 			if ((rf->usb == usb)&&(rf->depth == depth)&&(rf->res == res))
3007 			{
3008 				switch(scantype)
3009 				{
3010 					case ST_NEG:
3011 						*red   = rf->negative[CL_RED];
3012 						*green = rf->negative[CL_GREEN];
3013 						*blue  = rf->negative[CL_BLUE];
3014 						break;
3015 					case ST_TA:
3016 						*red   = rf->transparent[CL_RED];
3017 						*green = rf->transparent[CL_GREEN];
3018 						*blue  = rf->transparent[CL_BLUE];
3019 						break;
3020 				}
3021 
3022 				break;
3023 			}
3024 		}
3025 	} else
3026 	{
3027 		/* reflective mode */
3028 		*red   = 233;
3029 		*green = 230;
3030 		*blue  = 222;
3031 	}
3032 }
3033 
hp3800_wrefs(SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)3034 static void hp3800_wrefs(SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)
3035 {
3036 	/* in this scanner, values are the same in all usb versions and depths */
3037 	struct st_wref
3038 	{
3039 		SANE_Int res;
3040 		SANE_Int transparent[3];
3041 		SANE_Int negative[3];
3042 	};
3043 
3044 	struct st_wref wrefs[] =
3045 	{
3046 		/* res , {transparent  }, {negative     } */
3047 		{  2400, {276, 279, 243}, { 98, 162, 229}},
3048 		{  1200, {276, 279, 243}, { 98, 162, 229}},
3049 		{   600, {276, 279, 243}, {100, 162, 229}},
3050 		{   300, {276, 279, 243}, {100, 162, 229}},
3051 		{   150, {276, 279, 243}, {100, 162, 229}},
3052 	};
3053 
3054 	struct st_wref *rf;
3055 
3056 	*red = *green = *blue = 0x50;
3057 
3058 	if (res <= 150)
3059 		res = 150;
3060 	else if (res <= 300)
3061 		res = 300;
3062 	else if (res <= 600)
3063 		res = 600;
3064 	else if (res <= 1200)
3065 		res = 1200;
3066 	else res = 2400;
3067 
3068 	if (scantype != ST_NORMAL)
3069 	{
3070 		SANE_Int a;
3071 		SANE_Int count = sizeof(wrefs) / sizeof(struct st_wref);
3072 
3073 		for (a = 0; a < count; a++)
3074 		{
3075 			rf = &wrefs[a];
3076 			if (rf->res == res)
3077 			{
3078 				switch(scantype)
3079 				{
3080 					case ST_NEG:
3081 						*red   = rf->negative[CL_RED];
3082 						*green = rf->negative[CL_GREEN];
3083 						*blue  = rf->negative[CL_BLUE];
3084 						break;
3085 					case ST_TA:
3086 						*red   = rf->transparent[CL_RED];
3087 						*green = rf->transparent[CL_GREEN];
3088 						*blue  = rf->transparent[CL_BLUE];
3089 						break;
3090 				}
3091 
3092 				break;
3093 			}
3094 		}
3095 	} else
3096 	{
3097 		/* reflective mode */
3098 		*red   = 248;
3099 		*green = 250;
3100 		*blue  = 248;
3101 	}
3102 }
3103 
hp4370_wrefs(SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)3104 static void hp4370_wrefs(SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)
3105 {
3106 	struct st_wref
3107 	{
3108 		SANE_Int res;
3109 		SANE_Int transparent[3];
3110 		SANE_Int negative[3];
3111 	};
3112 
3113 	/* values are the same in all usb versions and depths */
3114 
3115 	struct st_wref wrefs[] =
3116 	{
3117 		/* res, {transparent  }, {negative} */
3118 		{ 4800, { 93,  93,  82}, {156, 308, 454}},
3119 		{ 2400, { 93,  93,  82}, {156, 156, 153}},
3120 		{ 1200, { 93,  93,  82}, {156, 156, 153}},
3121 		{  600, { 93,  93,  82}, {155, 155, 152}},
3122 		{  300, { 94,  94,  83}, {155, 155, 152}},
3123 		{  150, { 86,  87,  77}, {148, 145, 138}}
3124 	};
3125 
3126 	struct st_wref *rf;
3127 
3128 	SANE_Int a;
3129 
3130 	*red = *green = *blue = 0x50;
3131 
3132 	if (res <= 150)
3133 		res = 150;
3134 	else if (res <= 300)
3135 		res = 300;
3136 	else if (res <= 600)
3137 		res = 600;
3138 	else if (res <= 1200)
3139 		res = 1200;
3140 	else if (res <= 2400)
3141 		res = 2400;
3142 	else res = 4800;
3143 
3144 	if (scantype != ST_NORMAL)
3145 	{
3146 		SANE_Int count = sizeof(wrefs) / sizeof(struct st_wref);
3147 
3148 		for (a = 0; a < count; a++)
3149 		{
3150 			rf = &wrefs[a];
3151 			if (rf->res == res)
3152 			{
3153 				switch(scantype)
3154 				{
3155 					case ST_NEG:
3156 						*red   = rf->negative[CL_RED];
3157 						*green = rf->negative[CL_GREEN];
3158 						*blue  = rf->negative[CL_BLUE];
3159 						break;
3160 					case ST_TA:
3161 						*red   = rf->transparent[CL_RED];
3162 						*green = rf->transparent[CL_GREEN];
3163 						*blue  = rf->transparent[CL_BLUE];
3164 						break;
3165 				}
3166 
3167 				break;
3168 			}
3169 		}
3170 	} else
3171 	{
3172 		/* reflective mode */
3173 		*red   = 233;
3174 		*green = 232;
3175 		*blue  = 223;
3176 	}
3177 }
3178 
cfg_wrefs_get(SANE_Int sensortype, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)3179 static void cfg_wrefs_get(SANE_Int sensortype, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)
3180 {
3181 	switch(RTS_Debug->dev_model)
3182 	{
3183 		case UA4900:
3184 			ua4900_wrefs(RTS_Debug->usbtype, depth, res, scantype, red, green, blue);
3185 			break;
3186 
3187 		case HP3800:
3188 		case HPG2710:
3189 			hp3800_wrefs(res, scantype, red, green, blue);
3190 			break;
3191 
3192 		case HP4370:
3193 		case HPG3010:
3194 		case HPG3110:
3195 			hp4370_wrefs(res, scantype, red, green, blue);
3196 			break;
3197 
3198 		default:
3199 			/* hp3970 and hp4070 */
3200 			hp3970_wrefs(RTS_Debug->usbtype, sensortype, depth, res, scantype, red, green, blue);
3201 			break;
3202 	}
3203 }
3204 
hp3800_shading_cut(SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)3205 static void hp3800_shading_cut(SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)
3206 {
3207 	/*  values are the same in all usb versions and depths */
3208 	struct st_cut
3209 	{
3210 		SANE_Int res;
3211 		SANE_Int reflective[3];
3212 		SANE_Int transparent[3];
3213 		SANE_Int negative[3];
3214 	};
3215 
3216 	struct st_cut cuts[] =
3217 	{
3218 		/* res, {reflective }, {transparent  }, {negative       } */
3219 		{ 2400, { -6, -6, -6}, {-75, -75, -75}, {440, -300, -250}},
3220 		{ 1200, { -6, -6, -6}, {-75, -75, -75}, {440, -300, -250}},
3221 		{  600, { 10,  9, 12}, {-75, -75, -75}, {440, -300, -250}},
3222 		{  300, { -6, -6, -6}, {-75, -75, -75}, {440, -300, -250}},
3223 		{  150, { -6, -6, -6}, {-75, -75, -75}, {440, -300, -250}}
3224 	};
3225 
3226 	struct st_cut *ct;
3227 
3228 	SANE_Int a;
3229 	SANE_Int count = sizeof(cuts) / sizeof(struct st_cut);
3230 
3231 	*red = *green = *blue = 0;
3232 
3233 	if (res <= 150)
3234 		res = 150;
3235 	else if (res <= 300)
3236 		res = 300;
3237 	else if (res <= 600)
3238 		res = 600;
3239 	else if (res <= 1200)
3240 		res = 1200;
3241 	else res = 2400;
3242 
3243 	for (a = 0; a < count; a++)
3244 	{
3245 		ct = &cuts[a];
3246 		if (ct->res == res)
3247 		{
3248 			switch(scantype)
3249 			{
3250 				case ST_NEG:
3251 					*red   = ct->negative[CL_RED];
3252 					*green = ct->negative[CL_GREEN];
3253 					*blue  = ct->negative[CL_BLUE];
3254 					break;
3255 				case ST_TA:
3256 					*red   = ct->transparent[CL_RED];
3257 					*green = ct->transparent[CL_GREEN];
3258 					*blue  = ct->transparent[CL_BLUE];
3259 					break;
3260 				default: /* reflective */
3261 					*red   = ct->reflective[CL_RED];
3262 					*green = ct->reflective[CL_GREEN];
3263 					*blue  = ct->reflective[CL_BLUE];
3264 					break;
3265 			}
3266 			break;
3267 		}
3268 	}
3269 }
3270 
hp3970_shading_cut(SANE_Int usb, SANE_Int ccd, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)3271 static void hp3970_shading_cut(SANE_Int usb, SANE_Int ccd, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)
3272 {
3273 	struct st_cut
3274 	{
3275 		SANE_Int usb;
3276 		SANE_Int sensor;
3277 		SANE_Int depth;
3278 		SANE_Int res;
3279 		SANE_Int reflective[3];
3280 		SANE_Int transparent[3];
3281 		SANE_Int negative[3];
3282 	};
3283 
3284 	struct st_cut cuts[] =
3285 	{
3286 		/*usb , sensor     , depth, res , {reflective   }, {transparent  }, {negative} */
3287 		{USB20, CCD_SENSOR, 8    , 2400, {-15, -15, -15}, {  0,   0,   0}, {63, 0, 3}},
3288 		{USB20, CCD_SENSOR, 8    , 1200, {-15, -15, -15}, {  0,   0,   0}, {63, 0, 5}},
3289 		{USB20, CCD_SENSOR, 8    , 600 , {-15, -15, -15}, {  0,   0,   0}, {75, 0, 5}},
3290 		{USB20, CCD_SENSOR, 8    , 300 , {-15, -15, -15}, {  0,   0,   0}, {75, 0, 5}},
3291 		{USB20, CCD_SENSOR, 8    , 200 , {-15, -15, -15}, {  0,   0,   0}, {75, 0, 5}},
3292 		{USB20, CCD_SENSOR, 8    , 100 , {-15, -15, -15}, {  0,   0,   0}, {75, 0, 5}},
3293 
3294 		{USB20, CCD_SENSOR, 16   , 2400, {-15, -15, -15}, { -7,  -7,  -7}, {43, 0, 3}},
3295 		{USB20, CCD_SENSOR, 16   , 1200, {-15, -15, -15}, {-15, -15, -15}, {63, 0, 5}},
3296 		{USB20, CCD_SENSOR, 16   , 600 , {-15, -15, -15}, {-15, -15, -15}, {75, 0, 5}},
3297 		{USB20, CCD_SENSOR, 16   , 300 , {-15, -15, -15}, {-15, -15, -15}, {75, 0, 5}},
3298 		{USB20, CCD_SENSOR, 16   , 200 , {-15, -15, -15}, {-15, -15, -15}, {75, 0, 5}},
3299 		{USB20, CCD_SENSOR, 16   , 100 , {-15, -15, -15}, {-15, -15, -15}, {75, 0, 5}},
3300 
3301 		/*usb , sensor    , depth, res , {reflective   }, {transparent  }, {negative} */
3302 		{USB20, CIS_SENSOR, 8    , 2400, {-15, -15, -15}, {-68, -37, -43}, { 0, 0, 0}},
3303 		{USB20, CIS_SENSOR, 8    , 1200, {-15, -15, -15}, {-20, -20, -28}, { 0, 0, 0}},
3304 		{USB20, CIS_SENSOR, 8    , 600 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3305 		{USB20, CIS_SENSOR, 8    , 300 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3306 		{USB20, CIS_SENSOR, 8    , 200 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3307 		{USB20, CIS_SENSOR, 8    , 100 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3308 
3309 		{USB20, CIS_SENSOR, 16   , 2400, {-15, -15, -15}, {-68, -37, -43}, { 0, 0, 0}},
3310 		{USB20, CIS_SENSOR, 16   , 1200, {-15, -15, -15}, {-20, -20, -28}, { 0, 0, 0}},
3311 		{USB20, CIS_SENSOR, 16   , 600 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3312 		{USB20, CIS_SENSOR, 16   , 300 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3313 		{USB20, CIS_SENSOR, 16   , 200 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3314 		{USB20, CIS_SENSOR, 16   , 100 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3315 
3316 		/*usb , sensor     , depth, res , {reflective   }, {transparent  }, {negative} */
3317 		{USB11, CCD_SENSOR, 8    , 2400, {-15, -15, -15}, {  0,   0,   0}, {63, 0, 3}},
3318 		{USB11, CCD_SENSOR, 8    , 1200, {-15, -15, -15}, {  0,   0,   0}, {63, 0, 5}},
3319 		{USB11, CCD_SENSOR, 8    , 600 , {-15, -15, -15}, {  0,   0,   0}, {50, 0, 5}},
3320 		{USB11, CCD_SENSOR, 8    , 300 , {-15, -15, -15}, {  0,   0,   0}, {50, 0, 5}},
3321 		{USB11, CCD_SENSOR, 8    , 200 , {-15, -15, -15}, {  0,   0,   0}, {50, 0, 5}},
3322 		{USB11, CCD_SENSOR, 8    , 100 , {-15, -15, -15}, {  0,   0,   0}, {50, 0, 5}},
3323 
3324 		{USB11, CCD_SENSOR, 16   , 2400, {-15, -15, -15}, { -7,  -7,  -7}, {43, 0, 3}},
3325 		{USB11, CCD_SENSOR, 16   , 1200, {-15, -15, -15}, {-15, -15, -15}, {63, 0, 5}},
3326 		{USB11, CCD_SENSOR, 16   , 600 , {-15, -15, -15}, {-15, -15, -15}, {50, 0, 5}},
3327 		{USB11, CCD_SENSOR, 16   , 300 , {-15, -15, -15}, {-15, -15, -15}, {50, 0, 5}},
3328 		{USB11, CCD_SENSOR, 16   , 200 , {-15, -15, -15}, {-15, -15, -15}, {50, 0, 5}},
3329 		{USB11, CCD_SENSOR, 16   , 100 , {-15, -15, -15}, {-15, -15, -15}, {50, 0, 5}},
3330 
3331 		/*usb , sensor    , depth, res , {reflective   }, {transparent  }, {negative} */
3332 		{USB11, CIS_SENSOR, 8    , 2400, {-15, -15, -15}, {-68, -37, -43}, { 0, 0, 0}},
3333 		{USB11, CIS_SENSOR, 8    , 1200, {-15, -15, -15}, {-20, -20, -28}, { 0, 0, 0}},
3334 		{USB11, CIS_SENSOR, 8    , 600 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3335 		{USB11, CIS_SENSOR, 8    , 300 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3336 		{USB11, CIS_SENSOR, 8    , 200 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3337 		{USB11, CIS_SENSOR, 8    , 100 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3338 
3339 		{USB11, CIS_SENSOR, 16   , 2400, {-15, -15, -15}, {-68, -37, -43}, { 0, 0, 0}},
3340 		{USB11, CIS_SENSOR, 16   , 1200, {-15, -15, -15}, {-20, -20, -28}, { 0, 0, 0}},
3341 		{USB11, CIS_SENSOR, 16   , 600 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3342 		{USB11, CIS_SENSOR, 16   , 300 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3343 		{USB11, CIS_SENSOR, 16   , 200 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}},
3344 		{USB11, CIS_SENSOR, 16   , 100 , {-15, -15, -15}, {  0,   0,   0}, { 0, 0, 0}}
3345 	};
3346 
3347 	struct st_cut *ct;
3348 
3349 	SANE_Int a;
3350 	SANE_Int count = sizeof(cuts) / sizeof(struct st_cut);
3351 
3352 	*red = *green = *blue = 0;
3353 
3354 	if (res <= 100)
3355 		res = 100;
3356 	else if (res <= 200)
3357 		res = 200;
3358 	else if (res <= 300)
3359 		res = 300;
3360 	else if (res <= 600)
3361 		res = 600;
3362 	else if (res <= 1200)
3363 		res = 1200;
3364 	else res = 2400;
3365 
3366 	for (a = 0; a < count; a++)
3367 	{
3368 		ct = &cuts[a];
3369 		if ((ct->usb == usb)&&(ct->sensor == ccd)&&(ct->depth == depth)&&(ct->res == res))
3370 		{
3371 			switch(scantype)
3372 			{
3373 				case ST_NEG:
3374 					*red   = ct->negative[CL_RED];
3375 					*green = ct->negative[CL_GREEN];
3376 					*blue  = ct->negative[CL_BLUE];
3377 					break;
3378 				case ST_TA:
3379 					*red   = ct->transparent[CL_RED];
3380 					*green = ct->transparent[CL_GREEN];
3381 					*blue  = ct->transparent[CL_BLUE];
3382 					break;
3383 				default: /* reflective */
3384 					*red   = ct->reflective[CL_RED];
3385 					*green = ct->reflective[CL_GREEN];
3386 					*blue  = ct->reflective[CL_BLUE];
3387 					break;
3388 			}
3389 			break;
3390 		}
3391 	}
3392 }
3393 
hp4370_shading_cut(SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)3394 static void hp4370_shading_cut(SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)
3395 {
3396 	struct st_cut
3397 	{
3398 		SANE_Int depth;
3399 		SANE_Int res;
3400 		SANE_Int reflective[3];
3401 		SANE_Int transparent[3];
3402 		SANE_Int negative[3];
3403 	};
3404 
3405 	/* values are the same in all usb versions for each depth */
3406 	struct st_cut cuts[] =
3407 	{
3408 		/* depth, res , {reflective   }, {transparent  }, {negative    } */
3409 		{    8  , 4800, {  0,   0,   0}, { -3,  -3,  -3}, {35, -10,  -7}},
3410 		{    8  , 2400, {-15, -15, -15}, { -3,  -3,  -3}, {35, -10,  -7}},
3411 		{    8  , 1200, {-15, -15, -15}, { -3,  -3,  -3}, {35, -10, -22}},
3412 		{    8  , 600 , {-15, -15, -15}, { -2,  -2,  -2}, {38, -10, -22}},
3413 		{    8  , 300 , {-15, -15, -15}, { -2,  -2,  -2}, {38, -10, -22}},
3414 		{    8  , 150 , {-15, -15, -15}, {  0,   0,   0}, {50, -23, -14}},
3415 
3416 		{   16  , 4800, {  0,   0,   0}, { -3,  -3,  -3}, {35, -10,  -7}},
3417 		{   16  , 2400, {-15, -15, -15}, { -3,  -3,  -3}, {35, -10,  -7}},
3418 		{   16  , 1200, {-15, -15, -15}, { -3,  -3,  -3}, {35, -10, -22}},
3419 		{   16  , 600 , {-15, -15, -15}, { -2,  -2,  -2}, {38, -10, -22}},
3420 		{   16  , 300 , {-15, -15, -15}, { -2,  -2,  -2}, {38, -10, -22}},
3421 		{   16  , 150 , {-15, -15, -15}, {-15, -15, -15}, {40, -15,  -5}}
3422 	};
3423 
3424 	struct st_cut *ct;
3425 
3426 	SANE_Int a;
3427 	SANE_Int count = sizeof(cuts) / sizeof(struct st_cut);
3428 
3429 	*red = *green = *blue = 0;
3430 
3431 	if (res <= 150)
3432 		res = 150;
3433 	else if (res <= 300)
3434 		res = 300;
3435 	else if (res <= 600)
3436 		res = 600;
3437 	else if (res <= 1200)
3438 		res = 1200;
3439 	else if (res <= 2400)
3440 		res = 2400;
3441 	else res = 4800;
3442 
3443 	for (a = 0; a < count; a++)
3444 	{
3445 		ct = &cuts[a];
3446 		if ((ct->depth == depth)&&(ct->res == res))
3447 		{
3448 			switch(scantype)
3449 			{
3450 				case ST_NEG:
3451 					*red   = ct->negative[CL_RED];
3452 					*green = ct->negative[CL_GREEN];
3453 					*blue  = ct->negative[CL_BLUE];
3454 					break;
3455 				case ST_TA:
3456 					*red   = ct->transparent[CL_RED];
3457 					*green = ct->transparent[CL_GREEN];
3458 					*blue  = ct->transparent[CL_BLUE];
3459 					break;
3460 				default: /* reflective */
3461 					*red   = ct->reflective[CL_RED];
3462 					*green = ct->reflective[CL_GREEN];
3463 					*blue  = ct->reflective[CL_BLUE];
3464 					break;
3465 			}
3466 			break;
3467 		}
3468 	}
3469 }
3470 
ua4900_shading_cut(SANE_Int usb, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)3471 static void ua4900_shading_cut(SANE_Int usb, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)
3472 {
3473 	struct st_cut
3474 	{
3475 		SANE_Int usb;
3476 		SANE_Int depth;
3477 		SANE_Int res;
3478 		SANE_Int reflective[3];
3479 		SANE_Int transparent[3];
3480 		SANE_Int negative[3];
3481 	};
3482 
3483 	struct st_cut cuts[] =
3484 	{
3485 		/*usb , depth, res , {reflective   }, {transparent  }, {negative    } */
3486 		{USB20, 8    , 1200, {-15, -17, -13}, {  6,   0,   0}, {110, 15, 250}},
3487 		{USB20, 8    , 600 , {-16, -15, -15}, {  6,   7,   5}, {105, 11,  20}},
3488 		{USB20, 8    , 300 , {-15, -15, -15}, {  6,   7,   5}, {105, 10,  25}},
3489 		{USB20, 8    , 200 , {-15, -15, -15}, {  5,   5,   5}, {110, 15,  32}},
3490 		{USB20, 8    , 100 , {-15, -15, -15}, {  5,   5,   5}, {110, 15,  32}},
3491 
3492 		{USB20, 16   , 1200, {-15, -15, -15}, {  5,   5,   5}, { 0,   0,   0}},
3493 		{USB20, 16   , 600 , {-15, -15, -15}, {  5,   5,   5}, { 0,   0,   0}},
3494 		{USB20, 16   , 300 , {-15, -15, -15}, {  5,   5,   5}, { 0,   0,   0}},
3495 		{USB20, 16   , 200 , {-15, -15, -15}, {  5,   5,   5}, { 0,   0,   0}},
3496 		{USB20, 16   , 100 , {-15, -15, -15}, {  5,   5,   5}, { 0,   0,   0}},
3497 
3498 		/*usb , depth, res , {reflective   }, {transparent  }, {negative    } */
3499 		{USB11, 8    , 1200, {-15, -17, -13}, {  5,   5,   5}, {105, 12,  23}},
3500 		{USB11, 8    , 600 , {-17, -15, -16}, {  8,   8,   8}, {105, 12,  20}},
3501 		{USB11, 8    , 300 , {-15, -15, -15}, {  8,   8,   8}, {105, 15,  25}},
3502 		{USB11, 8    , 200 , {-15, -15, -15}, {  8,   8,   8}, {105, 40,  25}},
3503 		{USB11, 8    , 100 , {-15, -15, -15}, {  8,   8,   8}, {-20, 50,  23}},
3504 
3505 		{USB11, 16   , 1200, {-15, -15, -15}, {  5,   5,   5}, { 0,   0,   0}},
3506 		{USB11, 16   , 600 , {-15, -15, -15}, {  5,   5,   5}, { 0,   0,   0}},
3507 		{USB11, 16   , 300 , {-15, -15, -15}, {  5,   5,   5}, { 0,   0,   0}},
3508 		{USB11, 16   , 200 , {-15, -15, -15}, {  5,   5,   5}, { 0,   0,   0}},
3509 		{USB11, 16   , 100 , {-15, -15, -15}, {  5,   5,   5}, { 0,   0,   0}}
3510 	};
3511 
3512 	struct st_cut *ct;
3513 
3514 	SANE_Int a;
3515 	SANE_Int count = sizeof(cuts) / sizeof(struct st_cut);
3516 
3517 	*red = *green = *blue = 0;
3518 
3519 	if (res <= 100)
3520 		res = 100;
3521 	else if (res <= 200)
3522 		res = 200;
3523 	else if (res <= 300)
3524 		res = 300;
3525 	else if (res <= 600)
3526 		res = 600;
3527 	else res = 1200;
3528 
3529 	for (a = 0; a < count; a++)
3530 	{
3531 		ct = &cuts[a];
3532 		if ((ct->usb == usb)&&(ct->depth == depth)&&(ct->res == res))
3533 		{
3534 			switch(scantype)
3535 			{
3536 				case ST_NEG:
3537 					*red   = ct->negative[CL_RED];
3538 					*green = ct->negative[CL_GREEN];
3539 					*blue  = ct->negative[CL_BLUE];
3540 					break;
3541 				case ST_TA:
3542 					*red   = ct->transparent[CL_RED];
3543 					*green = ct->transparent[CL_GREEN];
3544 					*blue  = ct->transparent[CL_BLUE];
3545 					break;
3546 				default: /* reflective */
3547 					*red   = ct->reflective[CL_RED];
3548 					*green = ct->reflective[CL_GREEN];
3549 					*blue  = ct->reflective[CL_BLUE];
3550 					break;
3551 			}
3552 			break;
3553 		}
3554 	}
3555 }
3556 
cfg_shading_cut_get(SANE_Int sensortype, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)3557 static void cfg_shading_cut_get(SANE_Int sensortype, SANE_Int depth, SANE_Int res, SANE_Int scantype, SANE_Int *red, SANE_Int *green, SANE_Int *blue)
3558 {
3559 	switch(RTS_Debug->dev_model)
3560 	{
3561 		case UA4900:
3562 			ua4900_shading_cut(RTS_Debug->usbtype, depth, res, scantype, red, green, blue);
3563 			break;
3564 
3565 		case HP3800:
3566 		case HPG2710:
3567 			hp3800_shading_cut(res, scantype, red, green, blue);
3568 			break;
3569 
3570 		case HP4370:
3571 		case HPG3010:
3572 		case HPG3110:
3573 			hp4370_shading_cut(depth, res, scantype, red, green, blue);
3574 			break;
3575 
3576 		default:
3577 			/* hp3970 and hp4070 */
3578 			hp3970_shading_cut(RTS_Debug->usbtype, sensortype, depth, res, scantype, red, green, blue);
3579 			break;
3580 	}
3581 }
3582 
3583 /** SEC: Sensor Timings ---------- */
3584 
3585 /* ccd timing values for bq5550 scanner */
bq5550_timing_get(SANE_Int tm, struct st_timing *reg)3586 static SANE_Int bq5550_timing_get(SANE_Int tm, struct st_timing *reg)
3587 {
3588 	SANE_Int rst = ERROR;
3589 
3590 	if ((tm < 7)&&(reg != NULL))
3591 	{
3592 		/* bq5550 sensor timing values for each resolution and color mode */
3593 
3594 		struct st_timing data[] =
3595 		{
3596 			/* res , cnpp, {cvtrp 1 2 3     }, cvtrw, cvtrfpw, cvtrbpw, {{cphp1       , cphp2       , cphps, cphge, cphgo}, {cphp1       , cphp2       , cphps, cphge, cphgo}, {cphp1       , cphp2       , cphps, cphge, cphgo}, {cphp1       , cphp2       , cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}}, cphbp2s, cphbp2e, clamps, clampe , {cdss1, cdss2}, {cdsc1, cdsc2}, {cdscs1, cdscs2}, {adcclkp 1 y 2             }, adcclkp2e */
3597 			{0x04B0, 0x23, {0x00, 0x00, 0x00}, 0x16 , 0x02   , 0x02   , {{67645734915., 0.          , 0x00 , 0x01 , 0x00 }, {132120576.  , 0.          , 0x00 , 0x01 , 0x00 }, {68585259519., 0.          , 0x01 , 0x01 , 0x00 }, {134217216.  , 0.          , 0x01 , 0x01 , 0x01 }, {68585259519., 0.   , 0x01 , 0x01 , 0x00 }, {134217216.  , 0.   , 0x01 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x0F , 0x1F }, {0x12 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3598 			{0x0258, 0x23, {0x00, 0x00, 0x00}, 0x16 , 0x02   , 0x02   , {{66571993091., 0.          , 0x00 , 0x01 , 0x00 }, {132120576.  , 0.          , 0x00 , 0x01 , 0x00 }, {131071.     , 0.          , 0x00 , 0x01 , 0x00 }, {68719345664., 0.          , 0x00 , 0x01 , 0x01 }, {131071.     , 0.   , 0x00 , 0x01 , 0x00 }, {68719345664., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x10 , 0x1F }, {0x13 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3599 			{0x012C, 0x23, {0x00, 0x00, 0x00}, 0x16 , 0x02   , 0x02   , {{67645734915., 0.          , 0x00 , 0x01 , 0x00 }, {125829120.  , 0.          , 0x00 , 0x01 , 0x00 }, {67654057987., 0.          , 0x00 , 0x01 , 0x00 }, {1065418748. , 0.          , 0x00 , 0x01 , 0x01 }, {16383.      , 0.   , 0x00 , 0x01 , 0x00 }, {68182605824., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x10 , 0x1F }, {0x13 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3600 			{0x04B0, 0x23, {0x00, 0x00, 0x00}, 0x16 , 0x02   , 0x02   , {{67645734915., 0.          , 0x00 , 0x01 , 0x00 }, {132120576.  , 0.          , 0x00 , 0x01 , 0x00 }, {68585259519., 0.          , 0x01 , 0x01 , 0x00 }, {134217216.  , 0.          , 0x01 , 0x01 , 0x01 }, {68585259519., 0.   , 0x01 , 0x01 , 0x00 }, {134217216.  , 0.   , 0x01 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x0F , 0x1F }, {0x12 , 0x22 }, {0x00  , 0x00  }, {262140.     , 0.          }, 0x00},
3601 			{0x0258, 0x23, {0x00, 0x00, 0x00}, 0x16 , 0x02   , 0x02   , {{66571993091., 0.          , 0x00 , 0x01 , 0x00 }, {132120576.  , 0.          , 0x00 , 0x01 , 0x00 }, {131071.     , 0.          , 0x00 , 0x01 , 0x00 }, {68719345664., 0.          , 0x00 , 0x01 , 0x01 }, {131071.     , 0.   , 0x00 , 0x01 , 0x00 }, {68719345664., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x10 , 0x1F }, {0x13 , 0x22 }, {0x00  , 0x00  }, {262140.     , 0.          }, 0x00},
3602 			{0x012C, 0x23, {0x00, 0x00, 0x00}, 0x16 , 0x02   , 0x02   , {{67645734915., 0.          , 0x00 , 0x01 , 0x00 }, {125829120.  , 0.          , 0x00 , 0x01 , 0x00 }, {67654057987., 0.          , 0x00 , 0x01 , 0x00 }, {1065418748. , 0.          , 0x00 , 0x01 , 0x01 }, {16383.      , 0.   , 0x00 , 0x01 , 0x00 }, {68182605824., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x10 , 0x1F }, {0x13 , 0x22 }, {0x00  , 0x00  }, {524284.     , 0.          }, 0x00}
3603 		};
3604 
3605 		memcpy(reg, &data[tm], sizeof(struct st_timing));
3606 		rst = OK;
3607 	}
3608 
3609 	return rst;
3610 }
3611 
3612 /* ccd timing values for hp3800 scanner */
hp3800_timing_get(SANE_Int tm, struct st_timing *reg)3613 static SANE_Int hp3800_timing_get(SANE_Int tm, struct st_timing *reg)
3614 {
3615 	SANE_Int rst = ERROR;
3616 
3617 	if ((tm < 20)&&(reg != NULL))
3618 	{
3619 		/* Toshiba T2905 sensor timing values for each resolution and color mode */
3620 
3621 		struct st_timing data[] =
3622 		{
3623 			/* res , cnpp, {cvtrp 1 2 3     }, cvtrw, cvtrfpw, cvtrbpw, {{cphp1       , cphp2       , cphps, cphge, cphgo}, {cphp1       , cphp2       , cphps, cphge, cphgo}, {cphp1       , cphp2       , cphps, cphge, cphgo}, {cphp1       , cphp2       , cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}}, cphbp2s, cphbp2e, clamps, clampe , {cdss1, cdss2}, {cdsc1, cdsc2}, {cdscs1, cdscs2}, {adcclkp 1 y 2             }, adcclkp2e */
3624 			{0x0960, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{8589934588. , 0.          , 0x00 , 0x01 , 0x01 }, {68719476732., 0.          , 0x00 , 0x01 , 0x01 }, {134217216.  , 0.          , 0x01 , 0x01 , 0x00 }, {68585259519., 0.          , 0x01 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x01  , -1     , {0x0F , 0x20 }, {0x11 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3625 			{0x04B0, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{64692944895., 0.          , 0x00 , 0x01 , 0x01 }, {66571993087., 0.          , 0x00 , 0x01 , 0x01 }, {524287.     , 0.          , 0x00 , 0x01 , 0x00 }, {68718952448., 0.          , 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x01  , -1     , {0x10 , 0x20 }, {0x11 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3626 			{0x0258, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 0.          , 0x00 , 0x01 , 0x01 }, {68719476733., 0.          , 0x00 , 0x01 , 0x01 }, {1069563840. , 0.          , 0x00 , 0x01 , 0x00 }, {67649912895., 0.          , 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x01  , -1     , {0x02 , 0x21 }, {0x03 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3627 			{0x012C, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 0.          , 0x00 , 0x01 , 0x01 }, {68719476733., 0.          , 0x00 , 0x01 , 0x01 }, {477225440.  , 0.          , 0x00 , 0x01 , 0x00 }, {68242251295., 0.          , 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x01  , -1     , {0x02 , 0x21 }, {0x04 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3628 			{0x0096, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 0.          , 0x00 , 0x01 , 0x01 }, {68719476733., 0.          , 0x00 , 0x01 , 0x01 }, {13743895344., 0.          , 0x00 , 0x01 , 0x00 }, {54975581391., 0.          , 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x01  , -1     , {0x01 , 0x21 }, {0x02 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3629 
3630 			{0x0960, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{8589934588. , 0.          , 0x00 , 0x01 , 0x01 }, {68719476732., 0.          , 0x00 , 0x01 , 0x01 }, {134217216.  , 0.          , 0x01 , 0x01 , 0x00 }, {68585259519., 0.          , 0x01 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x01  , -1     , {0x0F , 0x20 }, {0x11 , 0x22 }, {0x00  , 0x00  }, {1048572.    , 0.          }, 0x00},
3631 			{0x04B0, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{64692944895., 0.          , 0x00 , 0x01 , 0x01 }, {66571993087., 0.          , 0x00 , 0x01 , 0x01 }, {524287.     , 0.          , 0x00 , 0x01 , 0x00 }, {68718952448., 0.          , 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x01  , -1     , {0x10 , 0x20 }, {0x11 , 0x22 }, {0x00  , 0x00  }, {1048572.    , 0.          }, 0x00},
3632 			{0x0258, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 0.          , 0x00 , 0x01 , 0x01 }, {68719476733., 0.          , 0x00 , 0x01 , 0x01 }, {1069563840. , 0.          , 0x00 , 0x01 , 0x00 }, {67649912895., 0.          , 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x01  , -1     , {0x02 , 0x21 }, {0x03 , 0x22 }, {0x00  , 0x00  }, {1048572.    , 0.          }, 0x00},
3633 			{0x012C, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 0.          , 0x00 , 0x01 , 0x01 }, {68719476733., 0.          , 0x00 , 0x01 , 0x01 }, {477225440.  , 0.          , 0x00 , 0x01 , 0x00 }, {68242251295., 0.          , 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x01  , -1     , {0x02 , 0x21 }, {0x04 , 0x22 }, {0x00  , 0x00  }, {1048572.    , 0.          }, 0x00},
3634 			{0x0258, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 0.          , 0x00 , 0x01 , 0x01 }, {68719476733., 0.          , 0x00 , 0x01 , 0x01 }, {266346464.  , 0.          , 0x00 , 0x01 , 0x00 }, {68453130271., 0.          , 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x01  , -1     , {0x04 , 0x21 }, {0x06 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3635 
3636 			{0x0960, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{8589934588. , 8589934588. , 0x00 , 0x01 , 0x01 }, {68719476732., 68719476732., 0x00 , 0x01 , 0x01 }, {134217216.  , 134217216.  , 0x01 , 0x01 , 0x00 }, {68585259519., 68585259519., 0x01 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0xFF   , 0x80FF , 0x01  , -1     , {0x0F , 0x20 }, {0x11 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3637 			{0x04B0, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{64692944895., 64692944895., 0x00 , 0x01 , 0x01 }, {66571993087., 66571993087., 0x00 , 0x01 , 0x01 }, {524287.     , 524287.     , 0x00 , 0x01 , 0x00 }, {68718952448., 68718952448., 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0xFF   , 0x80FF , 0x01  , -1     , {0x10 , 0x20 }, {0x11 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3638 			{0x0258, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 68719476732., 0x00 , 0x01 , 0x01 }, {68719476733., 68719476733., 0x00 , 0x01 , 0x01 }, {534781920.  , 534781920.  , 0x00 , 0x01 , 0x00 }, {68184694815., 68184694815., 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0xFF   , 0x20FF , 0x01  , -1     , {0x05 , 0x21 }, {0x07 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3639 			{0x012C, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 68719476732., 0x00 , 0x01 , 0x01 }, {68719476733., 68719476733., 0x00 , 0x01 , 0x01 }, {477225440.  , 477225440.  , 0x00 , 0x01 , 0x00 }, {68242251295., 68242251295., 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0xFF   , 0x11FF , 0x01  , -1     , {0x02 , 0x21 }, {0x04 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3640 			{0x0096, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 68719476732., 0x00 , 0x01 , 0x01 }, {68719476733., 68719476733., 0x00 , 0x01 , 0x01 }, {13743895344., 13743895344., 0x00 , 0x01 , 0x00 }, {54975581391., 54975581391., 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0xFF   , 0x110F , 0x01  , -1     , {0x01 , 0x21 }, {0x02 , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3641 
3642 			{0x0960, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{8589934588. , 8589934588. , 0x00 , 0x01 , 0x01 }, {68719476732., 68719476732., 0x00 , 0x01 , 0x01 }, {134217216.  , 134217216.  , 0x01 , 0x01 , 0x00 }, {68585259519., 68585259519., 0x01 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0xFF   , 0x80FF , 0x01  , -1     , {0x0F , 0x20 }, {0x11 , 0x22 }, {0x00  , 0x00  }, {1048572.    , 0.          }, 0x00},
3643 			{0x04B0, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{64692944895., 64692944895., 0x00 , 0x01 , 0x01 }, {66571993087., 66571993087., 0x00 , 0x01 , 0x01 }, {524287.     , 524287.     , 0x00 , 0x01 , 0x00 }, {68718952448., 68718952448., 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0xFF   , 0x80FF , 0x01  , -1     , {0x10 , 0x20 }, {0x11 , 0x22 }, {0x00  , 0x00  }, {1048572.    , 0.          }, 0x00},
3644 			{0x0258, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 68719476732., 0x00 , 0x01 , 0x01 }, {68719476733., 68719476733., 0x00 , 0x01 , 0x01 }, {534781920.  , 534781920.  , 0x00 , 0x01 , 0x00 }, {68184694815., 68184694815., 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0xFF   , 0x20FF , 0x01  , -1     , {0x05 , 0x21 }, {0x07 , 0x22 }, {0x00  , 0x00  }, {1048572.    , 0.          }, 0x00},
3645 			{0x012C, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 68719476732., 0x00 , 0x01 , 0x01 }, {68719476733., 68719476733., 0x00 , 0x01 , 0x01 }, {477225440.  , 477225440.  , 0x00 , 0x01 , 0x00 }, {68242251295., 68242251295., 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0xFF   , 0x110F , 0x01  , -1     , {0x02 , 0x21 }, {0x04 , 0x22 }, {0x00  , 0x00  }, {1048572.    , 0.          }, 0x00},
3646 			{0x0096, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{68719476732., 68719476732., 0x00 , 0x01 , 0x01 }, {68719476733., 68719476733., 0x00 , 0x01 , 0x01 }, {13743895344., 13743895344., 0x00 , 0x01 , 0x00 }, {54975581391., 54975581391., 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0xFF   , 0x110F , 0x01  , -1     , {0x01 , 0x21 }, {0x02 , 0x22 }, {0x00  , 0x00  }, {1048572.    , 0.          }, 0x00},
3647 		};
3648 
3649 		memcpy(reg, &data[tm], sizeof(struct st_timing));
3650 		rst = OK;
3651 	}
3652 
3653 	return rst;
3654 }
3655 
3656 /* ccd timing values for hp3970 scanner */
hp3970_timing_get(SANE_Int sensortype, SANE_Int tm, struct st_timing *reg)3657 static SANE_Int hp3970_timing_get(SANE_Int sensortype, SANE_Int tm, struct st_timing *reg)
3658 {
3659 	SANE_Int rst = ERROR;
3660 
3661 	if ((tm < 12)&&(reg != NULL))
3662 	{
3663 		rst = OK;
3664 		if (sensortype == CCD_SENSOR)
3665 		{
3666 			/* Toshiba T2952 sensor timing values for each resolution and color mode */
3667 			struct st_timing data[] =
3668 			{
3669 				/* res , cnpp, {cvtrp 1 2 3     }, cvtrw, cvtrfpw, cvtrbpw, {{cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}}, cphbp2s, cphbp2e, clamps, clampe , {cdss1, cdss2}, {cdsc1, cdsc2}, {cdscs1, cdscs2}, {adcclkp 1 y 2             }, adcclkp2e */
3670 				{0x0960, 0x0B, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {34376515584., 0.   , 0x00 , 0x01 , 0x00 }, {8455716864. , 0.   , 0x01 , 0x01 , 0x00 }, {60246982656., 0.   , 0x01 , 0x01 , 0x01 }, {68719214592., 0.   , 0x00 , 0x01 , 0x01 }, {68719214592., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x24000, {0x04 , 0x09 }, {0x06 , 0x0B }, {0x00  , 0x00  }, {27481079808., 0.          }, 0x00},
3671 				{0x04B0, 0x1A, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {64424511232., 0.   , 0x00 , 0x01 , 0x00 }, {68711088128., 0.   , 0x00 , 0x01 , 0x00 }, {8388352.    , 0.   , 0x00 , 0x01 , 0x01 }, {68719476480., 0.   , 0x00 , 0x01 , 0x01 }, {68719476480., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x08 , 0x15 }, {0x0C , 0x18 }, {0x00  , 0x00  }, {33351135232., 33351135232.}, 0x01},
3672 				{0x0258, 0x17, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {60129570816., 0.   , 0x00 , 0x01 , 0x00 }, {68719472640., 0.   , 0x00 , 0x01 , 0x01 }, {68719472640., 0.   , 0x00 , 0x01 , 0x01 }, {16773120.   , 0.   , 0x00 , 0x01 , 0x00 }, {68702699520., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x09 , 0x12 }, {0x0C , 0x14 }, {0x00  , 0x00  }, {64677150720., 0.          }, 0x00},
3673 				{0x012C, 0x17, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {51539611648., 0.   , 0x00 , 0x01 , 0x00 }, {68719472640., 0.   , 0x00 , 0x01 , 0x01 }, {68719472640., 0.   , 0x00 , 0x01 , 0x01 }, {1057222656. , 0.   , 0x00 , 0x01 , 0x00 }, {67662249984., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x04 , 0x15 }, {0x06 , 0x17 }, {0x00  , 0x00  }, {8084643840. , 0.          }, 0x00},
3674 				{0x00C8, 0x1D, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {68182605888., 0.   , 0x00 , 0x01 , 0x00 }, {68719476720., 0.   , 0x00 , 0x01 , 0x01 }, {68719476720., 0.   , 0x00 , 0x01 , 0x01 }, {16659267072., 0.   , 0x00 , 0x01 , 0x00 }, {52060209600., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x0A , 0x1B }, {0x0C , 0x1D }, {0x00  , 0x00  }, {4164816768. , 0.          }, 0x00},
3675 				{0x0960, 0x0B, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {34376515584., 0.   , 0x00 , 0x01 , 0x00 }, {8455716864. , 0.   , 0x01 , 0x01 , 0x00 }, {60246982656., 0.   , 0x01 , 0x01 , 0x01 }, {68719214592., 0.   , 0x00 , 0x01 , 0x01 }, {68719214592., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x24000, {0x04 , 0x09 }, {0x06 , 0x0B }, {0x00  , 0x00  }, {2113929216. , 0.          }, 0x00},
3676 				{0x04B0, 0x1A, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {64424511232., 0.   , 0x00 , 0x01 , 0x00 }, {68711088128., 0.   , 0x00 , 0x01 , 0x00 }, {8388352.    , 0.   , 0x00 , 0x01 , 0x01 }, {68719476480., 0.   , 0x00 , 0x01 , 0x01 }, {68719476480., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x08 , 0x15 }, {0x0C , 0x18 }, {0x00  , 0x00  }, {67104768.   , 67104768.   }, 0x01},
3677 				{0x0258, 0x17, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {60129570816., 0.   , 0x00 , 0x01 , 0x00 }, {68719472640., 0.   , 0x00 , 0x01 , 0x01 }, {68719472640., 0.   , 0x00 , 0x01 , 0x01 }, {16773120.   , 0.   , 0x00 , 0x01 , 0x00 }, {68702699520., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x09 , 0x12 }, {0x0C , 0x14 }, {0x00  , 0x00  }, {268369920.  , 0.          }, 0x00},
3678 				{0x012C, 0x17, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {51539611648., 0.   , 0x00 , 0x01 , 0x00 }, {68719472640., 0.   , 0x00 , 0x01 , 0x01 }, {68719472640., 0.   , 0x00 , 0x01 , 0x01 }, {1057222656. , 0.   , 0x00 , 0x01 , 0x00 }, {67662249984., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x04 , 0x15 }, {0x06 , 0x17 }, {0x00  , 0x00  }, {33546240.   , 0.          }, 0x00},
3679 				{0x00C8, 0x1D, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{68585258944., 0.   , 0x00 , 0x01 , 0x00 }, {536870784.  , 0.   , 0x00 , 0x01 , 0x00 }, {16659267072., 0.   , 0x00 , 0x01 , 0x00 }, {52060209600., 0.   , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }, {0.          , 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x0A , 0x1B }, {0x0C , 0x1C }, {0x00  , 0x00  }, {4194176.    , 0.          }, 0x00},
3680 				{0x0064, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {34359738368., 0.   , 0x00 , 0x01 , 0x00 }, {68719476735., 0.   , 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x01 , 0x01 }, {7635497415. , 0.   , 0x00 , 0x01 , 0x00 }, {61083979320., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x02 , 0x22 }, {0x03 , 0x23 }, {0x00  , 0x00  }, {2114445438. , 0.          }, 0x00},
3681 				{0x0064, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {34359738368., 0.   , 0x00 , 0x01 , 0x00 }, {68719476735., 0.   , 0x00 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x01 , 0x01 }, {7635497415. , 0.   , 0x00 , 0x01 , 0x00 }, {61083979320., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x02 , 0x22 }, {0x03 , 0x23 }, {0x00  , 0x00  }, {524286.     , 0.          }, 0x00}
3682 			};
3683 
3684 			memcpy(reg, &data[tm], sizeof(struct st_timing));
3685 		} else
3686 		{
3687 			/* Sony S575 sensor timing values for each resolution and color mode
3688 					I haven't found any hp3970 scanner using sony sensor but windows drivers support this case */
3689 			struct st_timing data[] =
3690 			{
3691 				/* res , cnpp, {cvtrp1  2    3  }, cvtrw, cvtrfpw, cvtrbpw, {{cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}}, cphbp2s, cphbp2e, clamps, clampe , {cdss1, cdss2}, {cdsc1, cdsc2}, {cdscs1, cdscs2}, {adcclkp 1 y 2             }, adcclkp2e */
3692 				{0x0960, 0x0B, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{60112764928., 0.   , 0x00 , 0x01 , 0x00 }, {34326183936., 0.   , 0x00 , 0x01 , 0x00 }, {1056964608. , 0.   , 0x01 , 0x01 , 0x00 }, {67645734912., 0.   , 0x01 , 0x01 , 0x01 }, {1056964608. , 0.   , 0x00 , 0x01 , 0x00 }, {67645734912., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x24000, {0x05 , 0x09 }, {0x07 , 0x0b }, {0x00  , 0x00  }, {27481079808., 0.          }, 0x00},
3693 				{0x04B0, 0x1A, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{68316823296., 0.   , 0x00 , 0x01 , 0x00 }, {42949672704., 0.   , 0x00 , 0x01 , 0x00 }, {4194048.    , 0.   , 0x00 , 0x01 , 0x00 }, {68715282432., 0.   , 0x00 , 0x01 , 0x01 }, {4194048.    , 0.   , 0x00 , 0x01 , 0x00 }, {68715282432., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x0B , 0x17 }, {0x0D , 0x19 }, {0x00  , 0x00  }, {16675567616., 16675567616.}, 0x01},
3694 				{0x0258, 0x17, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{67914166272., 0.   , 0x00 , 0x01 , 0x00 }, {42949668864., 0.   , 0x00 , 0x01 , 0x00 }, {16773120.   , 0.   , 0x00 , 0x01 , 0x00 }, {68702699520., 0.   , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }, {0.          , 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x09 , 0x15 }, {0x0B , 0x17 }, {0x00  , 0x00  }, {8084643840. , 0.          }, 0x00},
3695 				{0x012C, 0x17, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{60129538048., 0.   , 0x00 , 0x01 , 0x00 }, {34359730176., 0.   , 0x00 , 0x01 , 0x00 }, {1057222656. , 0.   , 0x00 , 0x01 , 0x00 }, {67662249984., 0.   , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }, {0.          , 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x04 , 0x15 }, {0x06 , 0x17 }, {0x00  , 0x00  }, {8084643840. , 0.          }, 0x00},
3696 				{0x00C8, 0x1D, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{68585258944., 0.   , 0x00 , 0x01 , 0x00 }, {536870784.  , 0.   , 0x00 , 0x01 , 0x00 }, {16659267072., 0.   , 0x00 , 0x01 , 0x00 }, {52060209600., 0.   , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }, {0.          , 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x0A , 0x1A }, {0x0C , 0x1C }, {0x00  , 0x00  }, {8329633536. , 0.          }, 0x00},
3697 				{0x0960, 0x0B, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{60112764928., 0.   , 0x00 , 0x01 , 0x00 }, {34326183936., 0.   , 0x00 , 0x01 , 0x00 }, {1056964608. , 0.   , 0x01 , 0x01 , 0x00 }, {67645734912., 0.   , 0x01 , 0x01 , 0x01 }, {1056964608. , 0.   , 0x00 , 0x01 , 0x00 }, {67645734912., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x24000, {0x05 , 0x09 }, {0x07 , 0x0B }, {0x00  , 0x00  }, {2113929216. , 0.          }, 0x00},
3698 				{0x04B0, 0x1A, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{68316823296., 0.   , 0x00 , 0x01 , 0x00 }, {42949672704., 0.   , 0x00 , 0x01 , 0x00 }, {4194048.    , 0.   , 0x00 , 0x01 , 0x00 }, {68715282432., 0.   , 0x00 , 0x01 , 0x01 }, {4194048.    , 0.   , 0x00 , 0x01 , 0x00 }, {68715282432., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x0B , 0x17 }, {0x0D , 0x19 }, {0x00  , 0x00  }, {33552384.   , 33552384.   }, 0x01},
3699 				{0x0258, 0x17, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{67914166272., 0.   , 0x00 , 0x01 , 0x00 }, {42949668864., 0.   , 0x00 , 0x01 , 0x00 }, {16773120.   , 0.   , 0x00 , 0x01 , 0x00 }, {68702699520., 0.   , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }, {0.          , 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x09 , 0x15 }, {0x0B , 0x17 }, {0x00  , 0x00  }, {33546240.   , 0.          }, 0x00},
3700 				{0x012C, 0x17, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{60129538048., 0.   , 0x00 , 0x01 , 0x00 }, {34359730176., 0.   , 0x00 , 0x01 , 0x00 }, {34359730176., 0.   , 0x00 , 0x01 , 0x00 }, {67662249984., 0.   , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }, {0.          , 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x04 , 0x15 }, {0x06 , 0x17 }, {0x00  , 0x00  }, {33546240.   , 0.          }, 0x00},
3701 				{0x00C8, 0x1D, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {68182605888., 0.   , 0x00 , 0x01 , 0x00 }, {68719476720., 0.   , 0x00 , 0x01 , 0x01 }, {68719476720., 0.   , 0x00 , 0x01 , 0x01 }, {16659267072., 0.   , 0x00 , 0x01 , 0x00 }, {52060209600., 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x0A , 0x1A }, {0x0C , 0x1D }, {0x00  , 0x00  }, {4194176.    , 0.          }, 0x00},
3702 				{0x0064, 0x23, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{51539607551., 0.   , 0x00 , 0x01 , 0x00 }, {34359738366., 0.   , 0x00 , 0x01 , 0x00 }, {7635497415. , 0.   , 0x00 , 0x01 , 0x00 }, {61083979320., 0.   , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }, {0.          , 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x02700, {0x02 , 0x22 }, {0x03 , 0x23 }, {0x00  , 0x00  }, {2114445438. , 0.          }, 0x00},
3703 				{0x0064, 0x23, {0x00, 0x00, 0x00}, 0x1E , 0x01   , 0x0F   , {{51539607551., 0.   , 0x00 , 0x01 , 0x00 }, {34359738366., 0.   , 0x00 , 0x01 , 0x00 }, {7635497415. , 0.   , 0x00 , 0x01 , 0x00 }, {61083979320., 0.   , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }, {0.          , 0.   , 0x00 , 0x01 , 0x01 }}, 0x00   , 0x00   , 0x01  , 0x02700, {0x02 , 0x22 }, {0x03 , 0x23 }, {0x00  , 0x00  }, {524286.     , 0.          }, 0x00}
3704 			};
3705 
3706 			memcpy(reg, &data[tm], sizeof(struct st_timing));
3707 		}
3708 	}
3709 
3710 	return rst;
3711 }
3712 
3713 /* ccd timing values for hp4370 scanner */
hp4370_timing_get(SANE_Int tm, struct st_timing *reg)3714 static SANE_Int hp4370_timing_get(SANE_Int tm, struct st_timing *reg)
3715 {
3716 	SANE_Int rst = ERROR;
3717 
3718 	if ((reg != NULL)&&(tm < 14))
3719 	{
3720 		/* Toshiba T2958 sensor timing values for each resolution and color mode */
3721 
3722 		struct st_timing data[] =
3723 		{
3724 			/* res , cnpp, {cvtrp 1 2 3     }, cvtrw, cvtrfpw, cvtrbpw, {{cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2       , cphps, cphge, cphgo}, {cphp1       , cphp2      , cphps, cphge, cphgo}, {cphp1       , cphp2       , cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}}, cphbp2s, cphbp2e, clamps, clampe , {cdss1, cdss2}, {cdsc1, cdsc2}, {cdscs1, cdscs2}, {adcclkp 1 y 2             }, adcclkp2e */
3725 			{0x12C0, 0x17, {0x00, 0x00, 0x00}, 0x0F , 0x05   , 0x0E   , {{0.          , 0.   , 0x00 , 0x01 , 0x01 }, {17179869183., 17179869183., 0x00 , 0x01 , 0x01 }, {1073479680. , 1073479680., 0x01 , 0x01 , 0x00 }, {67645997055., 67645997055., 0x01 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x5D5B , 0xBAB7 , 0x1A  , -1     , {0x08 , 0x15 }, {0x0A , 0x17 }, {0x00  , 0x00  }, {8084644321. , 8084644321. }, 0x00},
3726 			{0x0960, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x05   , 0x0E   , {{0.          , 0.   , 0x00 , 0x01 , 0x01 }, {17179869182., 0.          , 0x00 , 0x01 , 0x01 }, {268434432.  , 0.         , 0x01 , 0x01 , 0x00 }, {68451042303., 0.          , 0x01 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x1A  , -1     , {0x07 , 0x18 }, {0x0B , 0x1E }, {0x00  , 0x00  }, {67662254016., 0.          }, 0x00},
3727 			{0x04B0, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {68719475967., 0.          , 0x00 , 0x01 , 0x01 }, {1048572.    , 0.         , 0x00 , 0x01 , 0x01 }, {68718428163., 0.          , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x1F , 0x17 }, {0x21 , 0x19 }, {0x01  , 0x01  }, {34888349727., 0.          }, 0x00},
3728 			{0x0258, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {68719476731., 0.          , 0x00 , 0x01 , 0x01 }, {4261672960. , 0.         , 0x00 , 0x01 , 0x00 }, {64457803775., 0.          , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x1A  , 0x05500, {0x00 , 0x1F }, {0x03 , 0x21 }, {0x00  , 0x00  }, {8457781752. , 0.          }, 0x00},
3729 			{0x012C, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {51808043007., 0.          , 0x00 , 0x01 , 0x01 }, {8084644320. , 0.         , 0x00 , 0x01 , 0x00 }, {60634832415., 0.          , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x1A  , 0x05500, {0x09 , 0x20 }, {0x0A , 0x22 }, {0x00  , 0x00  }, {4228890876. , 0.          }, 0x00},
3730 			{0x12C0, 0x17, {0x00, 0x00, 0x00}, 0x0F , 0x05   , 0x0E   , {{0.          , 0.   , 0x00 , 0x01 , 0x01 }, {17179869183., 17179869183., 0x00 , 0x01 , 0x01 }, {1073479680. , 1073479680., 0x01 , 0x01 , 0x00 }, {67645997055., 67645997055., 0x01 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x5D5B , 0xBAB7 , 0x1A  , -1     , {0x08 , 0x15 }, {0x0A , 0x17 }, {0x00  , 0x00  }, {33546240.   , 33546240.   }, 0x00},
3731 			{0x0960, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x05   , 0x0E   , {{0.          , 0.   , 0x00 , 0x01 , 0x01 }, {17179869182., 0.          , 0x00 , 0x01 , 0x01 }, {268434432.  , 0.         , 0x01 , 0x01 , 0x00 }, {68451042303., 0.          , 0x01 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x1A  , -1     , {0x07 , 0x18 }, {0x0B , 0x1E }, {0x00  , 0x00  }, {16777152.   , 0.          }, 0x00},
3732 			{0x04B0, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {68719475967., 0.          , 0x00 , 0x01 , 0x01 }, {1048572.    , 0.         , 0x00 , 0x01 , 0x01 }, {68718428163., 0.          , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }, {0.          , 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x1F , 0x17 }, {0x21 , 0x19 }, {0x01  , 0x01  }, {536868864.  , 0.          }, 0x00},
3733 			{0x0258, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {68719476731., 0.          , 0x00 , 0x01 , 0x01 }, {4261672960. , 0.         , 0x00 , 0x01 , 0x00 }, {64457803775., 0.          , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x1A  , 0x05500, {0x00 , 0x1F }, {0x03 , 0x21 }, {0x00  , 0x00  }, {2097144.    , 0.          }, 0x00},
3734 			{0x012C, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x04   , 0x04   , {{0.          , 0.   , 0x00 , 0x01 , 0x00 }, {51808043007., 0.          , 0x00 , 0x01 , 0x01 }, {8084644320. , 0.         , 0x00 , 0x01 , 0x00 }, {60634832415., 0.          , 0x00 , 0x01 , 0x01 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }, {0.          , 0.   , 0x00 , 0x00 , 0x00 }}, 0x00   , 0x00   , 0x1A  , 0x05500, {0x09 , 0x20 }, {0x0A , 0x22 }, {0x00  , 0x00  }, {1048572.    , 0.          }, 0x00},
3735 			{0x12C0, 0x17, {0x00, 0x00, 0x00}, 0x0F , 0x05   , 0x0E   , {{0.          , 0.   , 0x00 , 0x01 , 0x01 }, {17179869183., 17179869183., 0x00 , 0x01 , 0x01 }, {1073479680. , 1073479680., 0x01 , 0x01 , 0x00 }, {67645997055., 67645997055., 0x01 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x6977 , 0xD2EF , 0x1A  , -1     , {0x07 , 0x15 }, {0x0A , 0x17 }, {0x00  , 0x00  }, {8084644321. , 8084644321. }, 0x00},
3736 			{0x12C0, 0x17, {0x00, 0x00, 0x00}, 0x0F , 0x05   , 0x0E   , {{0.          , 0.   , 0x00 , 0x01 , 0x01 }, {17179869183., 17179869183., 0x00 , 0x01 , 0x01 }, {1073479680. , 1073479680., 0x01 , 0x01 , 0x00 }, {67645997055., 67645997055., 0x01 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x6977 , 0xD2EF , 0x1A  , -1     , {0x07 , 0x15 }, {0x0A , 0x17 }, {0x00  , 0x00  }, {33546240.   , 33546240.   }, 0x00},
3737 			{0x12C0, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x05   , 0x0E   , {{0.          , 0.   , 0x00 , 0x01 , 0x01 }, {8589934591. , 8589934591. , 0x00 , 0x01 , 0x01 }, {134217216.  , 134217216. , 0x01 , 0x01 , 0x00 }, {68585259519., 68585259519., 0x01 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x765B , 0xECB7 , 0x1A  , -1     , {0x07 , 0x1B }, {0x0D , 0x21 }, {0x00  , 0x00  }, {8457781752. , 8457781752. }, 0x00},
3738 			{0x12C0, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x05   , 0x0E   , {{0.          , 0.   , 0x00 , 0x01 , 0x01 }, {8589934591. , 8589934591. , 0x00 , 0x01 , 0x01 }, {134217216.  , 134217216. , 0x01 , 0x01 , 0x00 }, {68585259519., 68585259519., 0x01 , 0x01 , 0x01 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }, {68719476735., 0.   , 0x00 , 0x00 , 0x00 }}, 0x765B , 0xECB7 , 0x1A  , -1     , {0x07 , 0x1B }, {0x0D , 0x21 }, {0x00  , 0x00  }, {2097144.    , 2097144.    }, 0x00}
3739 		};
3740 
3741 		memcpy(reg, &data[tm], sizeof(struct st_timing));
3742 		rst = OK;
3743 	}
3744 
3745 	return rst;
3746 }
3747 
3748 /* ccd timing values for ua4900 scanner */
ua4900_timing_get(SANE_Int tm, struct st_timing *reg)3749 static SANE_Int ua4900_timing_get(SANE_Int tm, struct st_timing *reg)
3750 {
3751 	SANE_Int rst = ERROR;
3752 
3753 	if ((tm < 10)&&(reg != NULL))
3754 	{
3755 		/* Sony S575 sensor timing values for each resolution and color mode */
3756 		struct st_timing data[] =
3757 		{
3758 			/* res , cnpp, {cvtrp1  2    3  }, cvtrw, cvtrfpw, cvtrbpw, {{cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}, {cphp1       , cphp2, cphps, cphge, cphgo}}, cphbp2s, cphbp2e, clamps, clampe , {cdss1, cdss2}, {cdsc1, cdsc2}, {cdscs1, cdscs2}, {adcclkp 1 y 2             }, adcclkp2e */
3759 			{0x04b0, 0x23, {0x00, 0x00, 0x00}, 0x1E , 0x03   , 0x03   , {{ 1073737728., 0.   , 0x01 , 0x01 , 0x00 }, {67645739007., 0.   , 0x01 , 0x01 , 0x01 }, {67645739007., 0.   , 0x01 , 0x01 , 0x01 }, { 1073737728., 0.   , 0x01 , 0x01 , 0x00 }, {25769803776., 0.   , 0x00 , 0x01 , 0x00 }, {         62., 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x08 , 0x1c }, {0x0A , 0x1e }, {0x00  , 0x00  }, {67662254016., 0.          }, 0x00},
3760 			{0x0258, 0x23, {0x00, 0x00, 0x00}, 0x0F , 0x03   , 0x03   , {{     262143., 0.   , 0x00 , 0x01 , 0x00 }, {68719214592., 0.   , 0x00 , 0x01 , 0x01 }, {68719214592., 0.   , 0x00 , 0x01 , 0x01 }, {     262143., 3.   , 0x00 , 0x01 , 0x00 }, { 2080374784., 0.   , 0x00 , 0x01 , 0x00 }, {64424509455., 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x10 , 0x1d }, {0x12 , 0x1f }, {0x00  , 0x00  }, {33831127008., 0.          }, 0x00},
3761 			{0x012c, 0x23, {0x00, 0x00, 0x00}, 0x1E , 0x03   , 0x03   , {{      32767., 0.   , 0x00 , 0x01 , 0x00 }, {68182605824., 0.   , 0x00 , 0x01 , 0x01 }, { 2130837500., 0.   , 0x00 , 0x01 , 0x01 }, {66588639235., 0.   , 0x00 , 0x01 , 0x00 }, {  117440512., 0.   , 0x00 , 0x01 , 0x00 }, {68182605825., 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x02700, {0x12 , 0x1f }, {0x14 , 0x21 }, {0x00  , 0x00  }, { 8457781752., 0.          }, 0x00},
3762 			{0x00c8, 0x23, {0x00, 0x00, 0x00}, 0x1E , 0x03   , 0x03   , {{51539608575., 0.   , 0x00 , 0x01 , 0x00 }, {16642998272., 0.   , 0x00 , 0x01 , 0x01 }, { 2082408447., 0.   , 0x00 , 0x01 , 0x01 }, {66637068288., 0.   , 0x00 , 0x01 , 0x00 }, {   14680064., 0.   , 0x00 , 0x01 , 0x00 }, {68652367872., 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x02700, {0x10 , 0x1f }, {0x12 , 0x21 }, {0x00  , 0x00  }, { 8457781752., 0.          }, 0x00},
3763 			{0x0064, 0x23, {0x00, 0x00, 0x00}, 0x1E , 0x03   , 0x03   , {{51539608575., 0.   , 0x00 , 0x01 , 0x00 }, {16642998272., 0.   , 0x00 , 0x01 , 0x01 }, { 2082408447., 0.   , 0x00 , 0x01 , 0x01 }, {66637068288., 0.   , 0x00 , 0x01 , 0x00 }, {   14680064., 0.   , 0x00 , 0x01 , 0x00 }, {68652367872., 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x02700, {0x10 , 0x1f }, {0x12 , 0x21 }, {0x00  , 0x00  }, { 8457781752., 0.          }, 0x00},
3764 			{0x04b0, 0x23, {0x00, 0x00, 0x00}, 0x1E , 0x03   , 0x03   , {{  268434432., 0.   , 0x01 , 0x01 , 0x00 }, {68451042303., 0.   , 0x01 , 0x01 , 0x01 }, {68451042303., 0.   , 0x01 , 0x01 , 0x01 }, {  268434432., 0.   , 0x01 , 0x01 , 0x00 }, {51539607552., 0.   , 0x00 , 0x01 , 0x00 }, {30.         , 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x11000, {0x08 , 0x1d }, {0x09 , 0x1e }, {0x00  , 0x00  }, {16777152.   , 0.          }, 0x00},
3765 			{0x0258, 0x1d, {0x00, 0x00, 0x00}, 0x0f , 0x03   , 0x03   , {{    2097088., 0.   , 0x00 , 0x01 , 0x00 }, {68717379632., 0.   , 0x00 , 0x01 , 0x01 }, {68717379632., 0.   , 0x00 , 0x01 , 0x01 }, {    2097088., 3.   , 0x00 , 0x01 , 0x00 }, { 1879048192., 0.   , 0x00 , 0x01 , 0x00 }, {60129542592., 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x05500, {0x0d , 0x16 }, {0x0f , 0x18 }, {0x00  , 0x00  }, {134213632.  , 0.          }, 0x00},
3766 			{0x012c, 0x23, {0x00, 0x00, 0x00}, 0x1E , 0x03   , 0x03   , {{64424510463., 0.   , 0x00 , 0x01 , 0x00 }, { 4278190080., 0.   , 0x00 , 0x01 , 0x01 }, {  267390975., 0.   , 0x00 , 0x01 , 0x01 }, {68452085760., 0.   , 0x00 , 0x01 , 0x00 }, {    6291456., 0.   , 0x00 , 0x01 , 0x00 }, {68652367872., 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x02700, {0x15 , 0x1f }, {0x17 , 0x21 }, {0x00  , 0x00  }, {2097144.    , 0.          }, 0x00},
3767 			{0x00C8, 0x23, {0x00, 0x00, 0x00}, 0x1E , 0x03   , 0x03   , {{51539608575., 0.   , 0x00 , 0x01 , 0x00 }, {16642998272., 0.   , 0x00 , 0x01 , 0x01 }, { 2082408447., 0.   , 0x00 , 0x01 , 0x01 }, {66637068288., 0.   , 0x00 , 0x01 , 0x00 }, {   14680064., 0.   , 0x00 , 0x01 , 0x00 }, {68652367872., 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x02700, {0x17 , 0x1f }, {0x19 , 0x21 }, {0x00  , 0x00  }, {2097144.    , 0.          }, 0x00},
3768 			{0x0064, 0x23, {0x00, 0x00, 0x00}, 0x1E , 0x03   , 0x03   , {{51539608575., 0.   , 0x00 , 0x01 , 0x00 }, {16642998272., 0.   , 0x00 , 0x01 , 0x01 }, { 2082408447., 0.   , 0x00 , 0x01 , 0x01 }, {66637068288., 0.   , 0x00 , 0x01 , 0x00 }, {   14680064., 0.   , 0x00 , 0x01 , 0x00 }, {68652367872., 0.   , 0x00 , 0x01 , 0x00 }}, 0x00   , 0x00   , 0x01  , 0x02700, {0x17 , 0x1f }, {0x19 , 0x21 }, {0x00  , 0x00  }, {2097144.    , 0.          }, 0x00}
3769 		};
3770 
3771 		memcpy(reg, &data[tm], sizeof(struct st_timing));
3772 		rst = OK;
3773 	}
3774 
3775 	return rst;
3776 }
3777 
cfg_timing_get(SANE_Int sensortype, SANE_Int tm, struct st_timing *reg)3778 static SANE_Int cfg_timing_get(SANE_Int sensortype, SANE_Int tm, struct st_timing *reg)
3779 {
3780 	/* return timing values for current device */
3781 
3782 	SANE_Int rst = ERROR;
3783 
3784 	switch(RTS_Debug->dev_model)
3785 	{
3786 		case BQ5550:
3787 			rst = bq5550_timing_get(tm, reg);
3788 			break;
3789 
3790 		case UA4900:
3791 			rst = ua4900_timing_get(tm, reg);
3792 			break;
3793 
3794 		case HP4370:
3795 		case HPG3010:
3796 		case HPG3110:
3797 			rst = hp4370_timing_get(tm, reg);
3798 			break;
3799 
3800 		case HP3800:
3801 		case HPG2710:
3802 			rst = hp3800_timing_get(tm, reg);
3803 			break;
3804 
3805 		default:
3806 			/* hp3970 and hp4070 */
3807 			rst = hp3970_timing_get(sensortype, tm, reg);
3808 			break;
3809 	}
3810 
3811 	return rst;
3812 }
3813 
3814 /** SEC: Motor curves ---------- */
3815 
bq5550_motornull3816 static SANE_Int *bq5550_motor()
3817 {
3818 	SANE_Int *rst = NULL;
3819 	SANE_Int steps[]  =
3820 	{
3821 		/* motorcurve 1   */
3822 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3823 		ACC_CURVE,CRV_NORMALSCAN, 20000 ,6323 ,4095 ,3270 ,2823 ,2533 ,2318 ,2151 ,2016 ,1905 ,1811 ,1730 ,1660 ,1599 ,1544 ,1494 ,1450 ,1409 ,1373 ,1339 ,1307 ,1278 ,1251 ,1225 ,1201 ,1179 ,1158 ,1138 ,1119 ,1101 ,1084 ,1067 ,1052 ,1037 ,1023 ,1009 ,996 ,984 ,972 ,960 ,949 ,938 ,928 ,918 ,909 ,899 ,890 ,882 ,873 ,865 ,857 ,849 ,842 ,835 ,828 ,821 ,814 ,807 ,801 ,795 ,789 ,783 ,777 ,772 ,766 ,761 ,756 ,751 ,746 ,741 ,736 ,731 ,727 ,722 ,718 ,714 ,709 ,705 ,701 ,697 ,693 ,690 ,686 ,682 ,678 ,675 ,671 ,668 ,665 ,661 ,658 ,655 ,652 ,649 ,645 ,642 ,640 ,637 ,634 ,631 ,628 ,625 ,623 ,620 ,617 ,615 ,612 ,610 ,607 ,605 ,602 ,600 ,597 ,595 ,593 ,591 ,588 ,586 ,584 ,582 ,580 ,577 ,575 ,573 ,571 ,569 ,567 ,565 ,563 ,562 ,560 ,558 ,556 ,554 ,552 ,550 ,549 ,547 ,545 ,543 ,542 ,540 ,538 ,537 ,535 ,534 ,532 ,530 ,529 ,527 ,526 ,524 ,523 ,521 ,520 ,518 ,517 ,515 ,514 ,513 ,511 ,510 ,508 ,507 ,506 ,504 ,503 ,502 ,501 ,499 ,498 ,497 ,495 ,494 ,493 ,492 ,491 ,489 ,488 ,487 ,486 ,485 ,484 ,482 ,481 ,480 ,479 ,478 ,477 ,476 ,475 ,474 ,473 ,472 ,470 ,469 ,468 ,467 ,466 ,465 ,464 ,463 ,462 ,461 ,460 ,460 ,459 ,458 ,457 ,456 ,455 ,454 ,453 ,452 ,451 ,450 ,449 ,449 ,448 ,447 ,446 ,445 ,444 ,443 ,443 ,442 ,441 ,440 ,439 ,438 ,438 ,437 ,436 ,435 ,434 ,434 ,433 ,432 ,431 ,431 ,430 ,429 ,428 ,428 ,427 ,426 ,425 ,425 ,424 ,423 ,422 ,422 ,421 ,420 ,420 ,419 ,418 ,418 ,417 ,416 ,416 ,415 ,414 ,414 ,413 ,412 ,412 ,411 ,410 ,410 ,409 ,408 ,408 ,407 ,407 ,406 ,405 ,405 ,404 ,404 ,403 ,402 ,402 ,401 ,401 ,400 ,399 ,399 ,398 ,398 ,397 ,397 ,396 ,395 ,395 ,394 ,394 ,393 ,393 ,392 ,392 ,391 ,390 ,390 ,389 ,389 ,388 ,388 ,387 ,387 ,386 ,386 ,385 ,385 ,384 ,384 ,383 ,383 ,382 ,382 ,381 ,381 ,380 ,380 ,379 ,379 ,378 ,378 ,377 ,377 ,377 ,376 ,376 ,375 ,375 ,374 ,374 ,373 ,373 ,372 ,372 ,372 ,371 ,371 ,370 ,370 ,369 ,369 ,368 ,368 ,368 ,367 ,367 ,366 ,366 ,365 ,365 ,365 ,364 ,364 ,363 ,363 ,363 ,362 ,362 ,361 ,361 ,361 ,360 ,360 ,359 ,359 ,359 ,358 ,358 ,357 ,357 ,357 ,356 ,356 ,356 ,355 ,355 ,354 ,354 ,354 ,353 ,353 ,353 ,352 ,352 ,351 ,351 ,351 ,350 ,350 ,350 ,349 ,349 ,349 ,348 ,348 ,348 ,347 ,347 ,347 ,346 ,346 ,346 ,345 ,345 ,345 ,344 ,344 ,344 ,343 ,343 ,343 ,342 ,342 ,342 ,341 ,341 ,341 ,340 ,340 ,340 ,339 ,339 ,339 ,338 ,338 ,338 ,337 ,337 ,337 ,337 ,336 ,336 ,336 ,335 ,335 ,335 ,334 ,334 ,334 ,334 ,333 ,333 ,333 ,332 ,332 ,332 ,332 ,331 ,331 ,331 ,330 ,330 ,330 ,330 ,329 ,329 ,329 ,328 ,328 ,328 ,328 ,327 ,327 ,327 ,326 ,326 ,326 ,326 ,325 ,325 ,325 ,325 ,324 ,324 ,324 ,324 ,323 ,323 ,323 ,323 ,322 ,322 ,322 ,321 ,321 ,321 ,321 ,320 ,320 ,320 ,320 ,319 ,319 ,319 ,319 ,318 ,318 ,318 ,318 ,317 ,317 ,317 ,317 ,317 ,316 ,316 ,316 ,316 ,315 ,315 ,315 ,315 ,314 ,314 ,314 ,314 ,313 ,313 ,313 ,313 ,313 ,312 ,312 ,312 ,312 ,311 ,311 ,311 ,311 ,311 ,310 ,310 ,310 ,310 ,309 ,309 ,309 ,309 ,309 ,308 ,308 ,308 ,308 ,307 ,307 ,307 ,307 ,307 ,306 ,306 ,306 ,306 ,306 ,305 ,305 ,305 ,305 ,305 ,304 ,304 ,304 ,304 ,303 ,303 ,303 ,303 ,303 ,302 ,302 ,302 ,302 ,302 ,301 ,301 ,301 ,301 ,301 ,300 ,300 ,300 ,300 ,300 ,300 ,299 ,299 ,299 ,299 ,299 ,298 ,298 ,298 ,298 ,298 ,297 ,297 ,297 ,297 ,297 ,297 ,296 ,296 ,296 ,296 ,296 ,295 ,295 ,295 ,295 ,295 ,295 ,294 ,294 ,294 ,294 ,294 ,293 ,293 ,293 ,293 ,293 ,293 ,292 ,292 ,292 ,292 ,292 ,292 ,291 ,291 ,291 ,291 ,291 ,290 ,290 ,290 ,290 ,290 ,290 ,289 ,289 ,289 ,289 ,289 ,289 ,288 ,288 ,288 ,288 ,288 ,288 ,288 ,287 ,287 ,287 ,287 ,287 ,287 ,286 ,286 ,286 ,286 ,286 ,286 ,285 ,285 ,285 ,285 ,285 ,285, 0,
3824 		ACC_CURVE,CRV_SMEARING  , 4000, 3877, 3377, 2777, 2127, 1724, 1449, 1250, 0,
3825 		DEC_CURVE,CRV_NORMALSCAN, 479 ,500 ,547 ,607 ,682 ,766 ,865 ,950 ,1040 ,1200 ,1369 ,1580 ,1810 ,2087 ,2500 ,3048 ,3877 ,4818 ,5822 ,6896, 0,
3826 		DEC_CURVE,CRV_SMEARING  , 1250, 1449, 1724, 2127, 2777, 3377, 3877, 4000, 0,
3827 		DEC_CURVE,CRV_BUFFERFULL, 479 ,500 ,547 ,607 ,682 ,766 ,865 ,950 ,1040 ,1200 ,1369 ,1580 ,1810 ,2087 ,2500 ,3048 ,3877 ,4818 ,5822 ,6896, 0,
3828 		-1
3829 	};
3830 
3831 	rst = (SANE_Int *)malloc(sizeof(steps));
3832 	if (rst != NULL)
3833 		memcpy(rst, &steps, sizeof(steps));
3834 
3835 	return rst;
3836 }
3837 
hp4370_motornull3838 static SANE_Int *hp4370_motor()
3839 {
3840 	SANE_Int *rst = NULL;
3841 	SANE_Int steps[]  =
3842 	{
3843 		/* motorcurve 1   */
3844 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3845 		ACC_CURVE,CRV_NORMALSCAN, 2000, 1984, 1968, 1953, 1937, 1921, 1906, 1890, 1874, 1859, 1843, 1827, 1812, 1796, 1781, 1765, 1749, 1734, 1715, 1700, 1684, 1669, 1653, 1637, 1622, 1606, 1590, 1572, 1556, 1541, 1525, 1510, 1494, 1478, 1463, 1447, 1431, 1416, 1400, 1384, 1366, 1351, 1335, 1319, 1304, 1288, 1272, 1257, 1241, 1225, 1210, 1194, 1179, 1160, 1145, 1129, 1113, 1098, 1082, 1066, 1051, 1035, 1017, 1001, 986, 970, 954, 939, 923, 907, 892, 876, 861, 845, 829, 814, 798, 782, 767, 749, 0,
3846 		ACC_CURVE,CRV_PARKHOME  , 4705, 2913, 2253, 1894, 1662, 1498, 1374, 1276, 1196, 1129, 1073, 1024, 981, 944, 910, 880, 852, 827, 804, 783, 764, 746, 729, 713, 699, 685, 672, 659, 648, 637, 626, 616, 607, 598, 589, 581, 573, 565, 558, 551, 544, 538, 532, 526, 520, 514, 509, 503, 500, 0,
3847 		ACC_CURVE,CRV_SMEARING  , 200, 12, 14, 16, 0,
3848 		DEC_CURVE,CRV_NORMALSCAN, 749, 1166, 1583, 2000, 0,
3849 		DEC_CURVE,CRV_PARKHOME  , 500, 503, 509, 514, 520, 526, 532, 538, 544, 551, 558, 565, 573, 581, 589, 598, 607, 616, 626, 637, 648, 659, 672, 685, 699, 713, 729, 746, 764, 783, 804, 827, 852, 880, 910, 944, 981, 1024, 1073, 1129, 1196, 1276, 1374, 1498, 1662, 1894, 2253, 2913, 4705, 0,
3850 		DEC_CURVE,CRV_SMEARING  , 300, 234, 167, 100, 0,
3851 		DEC_CURVE,CRV_BUFFERFULL, 1100, 867, 633, 400, 0,
3852 		-2,
3853 
3854 		/* motorcurve 2   */
3855 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3856 		ACC_CURVE,CRV_NORMALSCAN, 4705, 2664, 2061, 1732, 1521, 1370, 1257, 1167, 1094, 1033, 982, 937, 898, 864, 833, 805, 780, 757, 736, 717, 699, 683, 667, 653, 640, 627, 615, 604, 593, 583, 574, 564, 556, 547, 540, 532, 525, 518, 511, 505, 499, 493, 487, 481, 476, 471, 466, 461, 456, 452, 447, 443, 439, 435, 431, 427, 424, 420, 417, 413, 410, 407, 403, 400, 397, 394, 391, 389, 386, 383, 381, 378, 375, 373, 371, 368, 366, 364, 361, 359, 357, 355, 353, 351, 349, 347, 345, 343, 341, 339, 338, 336, 334, 332, 331, 329, 327, 326, 324, 323, 321, 320, 318, 317, 315, 314, 312, 311, 310, 308, 307, 306, 304, 303, 302, 301, 299, 298, 297, 296, 295, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 270, 269, 268, 267, 266, 265, 264, 264, 263, 262, 261, 260, 260, 259, 258, 257, 257, 256, 255, 255, 254, 253, 252, 252, 251, 250, 250, 249, 248, 248, 247, 246, 246, 245, 244, 244, 243, 242, 242, 241, 241, 240, 239, 239, 238, 238, 237, 237, 236, 235, 235, 234, 234, 233, 233, 232, 232, 231, 231, 230, 230, 229, 229, 228, 227, 227, 227, 226, 226, 225, 225, 224, 224, 223, 223, 222, 222, 221, 221, 220, 220, 219, 219, 219, 218, 218, 217, 217, 216, 216, 216, 215, 215, 214, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 210, 210, 209, 209, 208, 208, 208, 207, 207, 207, 206, 206, 206, 205, 205, 204, 204, 204, 203, 203, 203, 202, 202, 202, 201, 201, 201, 200, 200, 200, 199, 199, 199, 198, 198, 198, 197, 197, 197, 197, 196, 196, 196, 195, 195, 195, 194, 194, 194, 194, 193, 193, 193, 192, 192, 192, 192, 191, 191, 191, 190, 190, 190, 190, 189, 189, 189, 188, 188, 188, 188, 187, 187, 187, 187, 186, 186, 186, 186, 185, 185, 185, 185, 184, 184, 184, 184, 183, 183, 183, 183, 182, 182, 182, 182, 181, 181, 181, 181, 181, 180, 180, 180, 180, 179, 179, 179, 179, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 176, 176, 176, 176, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 171, 171, 171, 0,
3857 		ACC_CURVE,CRV_PARKHOME  , 4705, 2913, 2253, 1894, 1662, 1498, 1374, 1276, 1196, 1129, 1073, 1024, 981, 944, 910, 880, 852, 827, 804, 783, 764, 746, 729, 713, 699, 685, 672, 659, 648, 637, 626, 616, 607, 598, 589, 581, 573, 565, 558, 551, 544, 538, 532, 526, 520, 514, 509, 503, 500, 0,
3858 		ACC_CURVE,CRV_SMEARING  , 200, 12, 14, 16, 0,
3859 		DEC_CURVE,CRV_NORMALSCAN, 171, 172, 172, 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 207, 208, 209, 210, 211, 213, 214, 215, 217, 218, 219, 221, 222, 224, 225, 227, 228, 230, 232, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 258, 260, 262, 265, 268, 270, 273, 276, 279, 282, 285, 289, 292, 296, 299, 303, 307, 311, 316, 320, 325, 330, 335, 341, 347, 353, 359, 366, 373, 381, 390, 398, 408, 418, 429, 441, 455, 469, 485, 503, 523, 545, 571, 601, 636, 678, 730, 796, 883, 1005, 1195, 1544, 4705, 0,
3860 		DEC_CURVE,CRV_PARKHOME  , 500, 503, 509, 514, 520, 526, 532, 538, 544, 551, 558, 565, 573, 581, 589, 598, 607, 616, 626, 637, 648, 659, 672, 685, 699, 713, 729, 746, 764, 783, 804, 827, 852, 880, 910, 944, 981, 1024, 1073, 1129, 1196, 1276, 1374, 1498, 1662, 1894, 2253, 2913, 4705, 0,
3861 		DEC_CURVE,CRV_SMEARING  , 300, 234, 167, 100, 0,
3862 		DEC_CURVE,CRV_BUFFERFULL, 1100, 867, 633, 400, 0,
3863 		-2,
3864 
3865 		/* motorcurve 3   */
3866 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3867 		ACC_CURVE,CRV_NORMALSCAN, 5360, 3655, 2855, 2422, 2142, 1944, 1795, 1678, 1582, 1503, 1434, 1374, 0,
3868 		ACC_CURVE,CRV_PARKHOME  , 5360, 3362, 2628, 2229, 1973, 1791, 1654, 1547, 1458, 1384, 1319, 1264, 1214, 1170, 1131, 1096, 1063, 1034, 1006, 981, 958, 937, 916, 897, 880, 863, 847, 832, 818, 805, 792, 780, 769, 758, 747, 737, 727, 718, 709, 700, 692, 684, 677, 669, 662, 655, 648, 642, 636, 629, 624, 618, 612, 607, 602, 596, 591, 587, 582, 577, 573, 568, 564, 560, 556, 552, 548, 544, 540, 537, 533, 530, 526, 523, 520, 516, 513, 510, 507, 504, 501, 498, 496, 493, 490, 488, 485, 482, 480, 477, 475, 472, 470, 468, 466, 463, 461, 459, 457, 455, 453, 450, 448, 446, 444, 443, 441, 439, 437, 435, 433, 431, 430, 428, 426, 425, 423, 421, 420, 418, 416, 415, 413, 412, 410, 409, 407, 406, 405, 403, 402, 400, 399, 398, 396, 395, 394, 392, 391, 390, 389, 387, 386, 385, 384, 382, 381, 380, 379, 378, 377, 376, 374, 373, 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 353, 352, 351, 350, 349, 348, 0,
3869 		ACC_CURVE,CRV_SMEARING  , 5360, 3362, 2628, 2229, 1973, 1791, 1654, 1547, 0,
3870 		DEC_CURVE,CRV_NORMALSCAN, 1374, 1434, 1503, 1582, 1678, 1795, 1944, 2142, 2422, 2855, 3655, 5360, 0,
3871 		DEC_CURVE,CRV_PARKHOME  , 348, 351, 353, 356, 359, 362, 365, 368, 371, 374, 378, 381, 385, 389, 392, 396, 400, 405, 409, 413, 418, 423, 428, 433, 439, 444, 450, 457, 463, 470, 477, 485, 493, 501, 510, 520, 530, 540, 552, 564, 577, 591, 607, 624, 642, 662, 684, 709, 737, 769, 805, 847, 897, 958, 1034, 1131, 1264, 1458, 1791, 2628, 5360, 0,
3872 		DEC_CURVE,CRV_SMEARING  , 1547, 1654, 1791, 1973, 2229, 2628, 3362, 5360, 0,
3873 		DEC_CURVE,CRV_BUFFERFULL, 1374, 1434, 1503, 1582, 1678, 1795, 1944, 2142, 2422, 2855, 3655, 5360, 0,
3874 		-2,
3875 
3876 		/* motorcurve 4   */
3877 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3878 		ACC_CURVE,CRV_NORMALSCAN, 4705, 2664, 2061, 1732, 1521, 1370, 1257, 1167, 1094, 1033, 982, 937, 898, 864, 833, 805, 780, 757, 736, 717, 699, 683, 667, 653, 640, 627, 615, 604, 593, 583, 574, 564, 556, 547, 540, 532, 525, 518, 511, 505, 499, 493, 487, 481, 476, 471, 466, 461, 456, 452, 447, 443, 439, 435, 431, 427, 424, 420, 417, 413, 410, 407, 403, 400, 397, 394, 391, 389, 386, 383, 381, 378, 375, 373, 371, 368, 366, 364, 361, 359, 357, 355, 353, 351, 349, 347, 345, 343, 341, 339, 338, 336, 334, 332, 331, 329, 327, 326, 324, 323, 321, 320, 318, 317, 315, 314, 312, 311, 310, 308, 307, 306, 304, 303, 302, 301, 299, 298, 297, 296, 295, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 270, 269, 268, 267, 266, 265, 264, 264, 263, 262, 261, 260, 260, 259, 258, 257, 257, 256, 255, 255, 254, 253, 252, 252, 251, 250, 250, 249, 248, 248, 247, 246, 246, 245, 244, 244, 243, 242, 242, 241, 241, 240, 239, 239, 238, 238, 237, 237, 236, 235, 235, 234, 234, 233, 233, 232, 232, 231, 231, 230, 230, 229, 229, 228, 227, 227, 227, 226, 226, 225, 225, 224, 224, 223, 223, 222, 222, 221, 221, 220, 220, 219, 219, 219, 218, 218, 217, 217, 216, 216, 216, 215, 215, 214, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 210, 210, 209, 209, 208, 208, 208, 207, 207, 207, 206, 206, 206, 205, 205, 204, 204, 204, 203, 203, 203, 202, 202, 202, 201, 201, 201, 200, 200, 200, 199, 199, 199, 198, 198, 198, 197, 197, 197, 197, 196, 196, 196, 195, 195, 195, 194, 194, 194, 194, 193, 193, 193, 192, 192, 192, 192, 191, 191, 191, 190, 190, 190, 190, 189, 189, 189, 188, 188, 188, 188, 187, 187, 187, 187, 186, 186, 186, 186, 185, 185, 185, 185, 184, 184, 184, 184, 183, 183, 183, 183, 182, 182, 182, 182, 181, 181, 181, 181, 181, 180, 180, 180, 180, 179, 179, 179, 179, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 176, 176, 176, 176, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 171, 171, 171, 0,
3879 		ACC_CURVE,CRV_PARKHOME  , 4705, 2888, 2234, 1878, 1648, 1485, 1362, 1265, 1186, 1120, 1064, 1016, 973, 936, 903, 873, 845, 821, 798, 777, 758, 740, 723, 708, 693, 679, 666, 654, 643, 632, 621, 612, 602, 593, 585, 576, 569, 561, 554, 547, 540, 534, 528, 522, 516, 510, 505, 499, 494, 490, 485, 480, 476, 471, 467, 463, 459, 455, 451, 448, 444, 440, 437, 434, 430, 427, 424, 421, 418, 415, 412, 409, 407, 404, 401, 399, 396, 394, 391, 389, 387, 384, 382, 380, 378, 376, 374, 371, 369, 367, 366, 364, 362, 360, 358, 356, 354, 353, 351, 349, 348, 346, 344, 343, 341, 340, 338, 337, 335, 334, 332, 331, 329, 328, 327, 325, 324, 323, 321, 320, 319, 318, 316, 315, 314, 313, 312, 311, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 285, 284, 283, 282, 281, 280, 279, 279, 278, 277, 276, 275, 275, 274, 273, 272, 272, 271, 270, 269, 269, 268, 267, 267, 266, 265, 264, 264, 263, 262, 262, 261, 260, 260, 259, 259, 258, 257, 257, 256, 255, 255, 254, 254, 253, 252, 252, 251, 251, 250, 249, 249, 248, 248, 247, 247, 246, 246, 245, 245, 244, 243, 243, 242, 242, 241, 241, 240, 240, 239, 239, 238, 238, 237, 237, 237, 236, 236, 235, 235, 234, 234, 233, 233, 232, 232, 231, 231, 231, 230, 230, 229, 229, 228, 228, 228, 227, 227, 226, 226, 225, 225, 225, 224, 224, 223, 223, 223, 222, 222, 222, 221, 221, 220, 220, 220, 219, 219, 219, 218, 218, 217, 217, 217, 216, 216, 216, 215, 215, 215, 214, 214, 214, 213, 213, 213, 212, 212, 212, 211, 211, 211, 210, 210, 210, 209, 209, 209, 208, 208, 208, 207, 207, 207, 207, 206, 206, 206, 205, 205, 205, 204, 204, 204, 204, 203, 203, 203, 202, 202, 202, 202, 201, 201, 201, 200, 200, 200, 200, 199, 199, 199, 199, 198, 198, 198, 198, 197, 197, 197, 196, 196, 196, 196, 195, 195, 195, 195, 194, 194, 194, 194, 193, 193, 193, 193, 192, 192, 192, 192, 192, 191, 191, 191, 191, 190, 190, 190, 190, 189, 189, 189, 189, 189, 188, 188, 188, 188, 187, 187, 187, 187, 187, 186, 186, 186, 186, 186, 185, 185, 185, 185, 184, 184, 184, 184, 184, 183, 183, 183, 183, 183, 182, 182, 182, 182, 182, 181, 181, 181, 181, 181, 180, 180, 180, 180, 180, 180, 179, 179, 179, 179, 179, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 172, 171, 171, 171, 171, 0,
3880 		ACC_CURVE,CRV_SMEARING  , 4705, 3056, 2724, 2497, 1498, 1498, 1374, 1276, 1196, 1130, 1073, 1025, 982, 944, 911, 880, 853, 828, 805, 784, 764, 746, 730, 714, 699, 685, 675, 0,
3881 		DEC_CURVE,CRV_NORMALSCAN, 171, 172, 172, 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 207, 208, 209, 210, 211, 213, 214, 215, 217, 218, 219, 221, 222, 224, 225, 227, 228, 230, 232, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 258, 260, 262, 265, 268, 270, 273, 276, 279, 282, 285, 289, 292, 296, 299, 303, 307, 311, 316, 320, 325, 330, 335, 341, 347, 353, 359, 366, 373, 381, 390, 398, 408, 418, 429, 441, 455, 469, 485, 503, 523, 545, 571, 601, 636, 678, 730, 796, 883, 1005, 1195, 1544, 4705, 0,
3882 		DEC_CURVE,CRV_PARKHOME  , 171, 172, 172, 173, 173, 174, 174, 175, 175, 176, 176, 177, 177, 178, 179, 179, 180, 180, 181, 182, 182, 183, 183, 184, 185, 185, 186, 187, 187, 188, 189, 189, 190, 191, 192, 192, 193, 194, 195, 195, 196, 197, 198, 199, 199, 200, 201, 202, 203, 204, 205, 206, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 222, 223, 225, 226, 227, 228, 230, 231, 232, 234, 235, 237, 238, 240, 241, 243, 244, 246, 247, 249, 251, 253, 254, 256, 258, 260, 262, 264, 266, 268, 271, 273, 275, 278, 280, 282, 285, 288, 290, 293, 296, 299, 302, 305, 309, 312, 316, 319, 323, 327, 331, 336, 340, 345, 350, 355, 360, 365, 371, 377, 384, 391, 398, 406, 414, 422, 432, 441, 452, 463, 476, 489, 504, 520, 538, 558, 580, 605, 633, 667, 706, 752, 810, 883, 979, 1116, 1326, 1714, 4705, 0,
3883 		DEC_CURVE,CRV_SMEARING  , 675, 685, 699, 714, 730, 746, 764, 784, 805, 828, 853, 880, 911, 944, 982, 1025, 1073, 1130, 1196, 1276, 1374, 1498, 1498, 2497, 2724, 3056, 4705, 0,
3884 		DEC_CURVE,CRV_BUFFERFULL, 171, 172, 172, 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 207, 208, 209, 210, 211, 213, 214, 215, 217, 218, 219, 221, 222, 224, 225, 227, 228, 230, 232, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 258, 260, 262, 265, 268, 270, 273, 276, 279, 282, 285, 289, 292, 296, 299, 303, 307, 311, 316, 320, 325, 330, 335, 341, 347, 353, 359, 366, 373, 381, 390, 398, 408, 418, 429, 441, 455, 469, 485, 503, 523, 545, 571, 601, 636, 678, 730, 796, 883, 1005, 1195, 1544, 4705, 0,
3885 		-2,
3886 
3887 		/* motorcurve 5   */
3888 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3889 		ACC_CURVE,CRV_NORMALSCAN, 3763, 3763, 3763, 3763, 3763, 3763, 2444, 2178, 1997, 1198, 1198, 1098, 1020, 956, 903, 858, 819, 785, 754, 727, 703, 681, 662, 644, 626, 610, 596, 582, 571, 558, 547, 537, 527, 518, 509, 500, 492, 485, 478, 471, 464, 458, 452, 446, 440, 435, 430, 425, 420, 415, 410, 407, 402, 398, 394, 391, 386, 383, 380, 376, 373, 369, 366, 364, 360, 357, 355, 352, 349, 347, 344, 341, 338, 337, 334, 332, 329, 328, 325, 323, 321, 319, 317, 315, 313, 311, 310, 308, 306, 304, 302, 301, 299, 297, 295, 294, 293, 291, 290, 288, 286, 285, 284, 283, 281, 280, 278, 277, 275, 275, 274, 272, 271, 270, 268, 267, 266, 265, 264, 263, 262, 261, 259, 258, 257, 257, 256, 255, 254, 253, 251, 250, 249, 248, 248, 247, 246, 245, 244, 243, 243, 242, 241, 240, 239, 239, 238, 237, 236, 235, 235, 234, 233, 232, 231, 230, 230, 230, 229, 228, 228, 227, 226, 225, 225,224, 223, 222, 222, 221, 221, 221, 220, 219, 219, 218, 217, 217, 216, 215, 215, 214, 213, 213, 212, 212, 212, 211, 211, 210, 209, 209, 208, 208, 207, 207, 206, 206, 205, 204, 204, 203, 203, 203, 203, 202, 202, 201, 201, 200, 200, 199, 199, 198, 198, 197, 197, 196, 196, 195, 195, 194, 194, 194, 194, 194, 193, 193, 192, 192, 191, 191, 190, 190, 190, 189, 189, 188, 188, 188, 187, 187, 186, 186, 185, 185, 185, 185, 185, 185, 184, 184, 183, 183, 183, 182, 182, 182, 181, 181, 180, 180, 180, 179, 179, 179, 178, 178, 178, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 174, 174, 174, 173, 173, 173, 172, 172, 172, 171, 171, 171, 171, 170, 170, 170, 169, 169, 169, 169, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 165, 165, 165, 165, 164, 164, 164, 163, 163, 163, 163, 162, 162, 162, 162, 161, 161, 161, 161, 160, 160, 160, 160, 159, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 156, 156, 156, 156, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 153, 153, 153, 153, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 139, 139, 138, 138, 138, 138, 138, 138, 138, 137, 137, 137, 137, 137, 137, 137, 136, 136, 136, 136, 136, 136, 136, 135, 135, 135, 135, 135, 135, 135, 134, 134, 134, 134, 134, 134, 134, 134, 133, 133, 133, 133, 133, 133, 133, 133, 132, 132, 132, 132, 132, 132, 132, 132, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 130, 130, 130, 130, 130, 130, 130, 130, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 126, 126, 126, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 101, 101, 101, 101, 101, 101, 101, 101, 101,101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 0,
3890 		ACC_CURVE,CRV_PARKHOME  , 3763, 2330, 1803, 1515, 1330, 1198, 1099, 1021, 957, 904, 859, 819, 785, 755, 728, 704, 682, 662, 644, 626, 611, 597, 583, 571, 559, 548, 537, 527, 518, 509, 501, 493, 485, 478, 472, 464, 458, 453, 446, 441, 436, 430, 425, 420, 416, 411, 407, 402, 399, 394, 391, 387, 383, 380, 376, 374, 370, 366, 364, 361, 358, 355, 352, 349, 347, 344, 342, 339, 337, 335, 332, 330, 328, 326, 323, 321, 320, 318, 315, 313, 311, 310, 308, 306, 304, 302, 301, 300, 298, 296, 294, 293, 292, 290, 289, 287, 285, 284, 283, 282, 280, 279, 277, 276, 275, 274, 273, 271, 270, 269, 267, 266, 266, 265, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 239, 239, 238, 237, 236, 235, 234, 233, 233, 232, 231, 230, 230, 230, 229, 228, 227, 227, 226, 225, 224, 224, 223, 222, 221, 221, 221, 220, 220, 219, 218, 218, 217, 216, 216, 215, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 209, 209, 208, 208, 207, 207, 206, 205, 205, 204, 204, 203, 203, 203, 203, 202, 202, 201, 201, 200, 200, 199, 199, 198, 198, 197, 197, 196, 196, 195, 195, 194, 194, 194, 194, 194, 193, 193, 192, 192, 191, 191, 191, 190, 190, 189, 189, 188, 188, 188, 187, 187, 186, 186, 186, 185, 185, 185, 185, 185, 184, 184, 184, 183, 183, 182, 182, 182, 181, 181, 181, 180, 180, 180, 179, 179, 178, 178, 178, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 174, 174, 174, 174, 173, 173, 173, 172, 172, 172, 171, 171, 171, 170, 170, 170, 170, 169, 169, 169, 168, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 165, 165, 165, 165, 164, 164, 164, 163, 163, 163, 163, 162, 162, 162, 162, 161, 161, 161, 161, 160, 160, 160, 160, 160, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 156, 156, 156, 156, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 153, 153, 153, 153, 153, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 139, 139, 138, 0,
3891 		ACC_CURVE,CRV_SMEARING  , 3763, 2330, 1803, 1515, 1330, 1198, 1099, 1021, 957, 904, 859, 819, 785, 755, 728, 704, 682, 662, 644, 626, 611, 597, 583, 571, 559, 548, 537, 527, 518, 509, 501, 493, 485, 478, 472, 464, 458, 453, 446, 441, 436, 430, 425, 420, 416, 411, 407, 402, 399, 394, 391, 387, 383, 380, 376, 374, 370, 366, 364, 361, 358, 355, 352, 349, 347, 344, 342, 339, 337, 335, 332, 330, 328, 326, 323, 321, 320, 318, 315, 313, 311, 310, 308, 306, 304, 302, 301, 300, 298, 296, 294, 293, 292, 290, 289, 287, 285, 284, 283, 282, 280, 279, 277, 276, 275, 274, 273, 271, 270, 269, 267, 266, 266, 265, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 239, 239, 238, 237, 236, 235, 234, 233, 233, 232, 231, 230, 230, 230, 229, 228, 227, 227, 226, 225, 224, 224, 223, 222, 221, 221, 221, 220, 220, 219, 218, 218, 217, 216, 216, 215, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 209, 209, 208, 208, 207, 207, 206, 205, 205, 204, 204, 203, 203, 203, 203, 202, 202, 201, 201, 200, 200, 199, 199, 198, 198, 197, 197, 196, 196, 195, 195, 194, 194, 194, 194, 194, 193, 193, 192, 192, 191, 191, 191, 190, 190, 189, 189, 188, 188, 188, 187, 187, 186, 186, 186, 185, 185, 185, 185, 185, 184, 184, 184, 183, 183, 182, 182, 182, 181, 181, 181, 180, 180, 180, 179, 179, 178, 178, 178, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 174, 174, 174, 174, 173, 173, 173, 172, 172, 172, 171, 171, 171, 170, 170, 170, 170, 169, 169, 169, 168, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 165, 165, 165, 165, 164, 164, 164, 163, 163, 163, 163, 162, 162, 162, 162, 161, 161, 161, 161, 160, 160, 160, 160, 160, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 156, 156, 156, 156, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 153, 153, 153, 153, 153, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 139, 139, 138, 0,
3892 		DEC_CURVE,CRV_NORMALSCAN, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 278, 280, 282, 284, 286, 288, 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 310, 312, 314, 316, 318, 320, 322, 324, 326, 328, 330, 332, 334, 336, 338, 340, 342, 345, 348, 351, 354, 357, 360, 363, 366, 369, 372, 375, 378, 381, 384, 387, 391, 395, 399, 403, 407, 411, 415, 419, 422, 425, 429, 433, 437, 441, 445, 449, 453, 458, 463, 468, 473, 478, 483, 489, 495, 501, 507, 514, 521, 528, 536, 544, 553, 562, 572, 582, 593, 604, 616, 629, 643, 658, 674, 692, 711, 732, 755, 781, 810, 843, 880, 923, 974,1035, 1110, 1205, 1331, 1510, 1796, 2368, 3400, 4922, 0,
3893 		DEC_CURVE,CRV_PARKHOME  , 138, 142, 146, 149, 153, 158, 162, 167, 171, 176, 180, 186, 193, 202, 209, 216, 223, 232, 243, 254, 266, 279, 292, 306, 320, 335, 337, 351, 367, 380, 396, 414, 437, 464, 493, 520, 549, 583, 611, 644, 675, 711, 755, 785, 819, 859, 904, 957, 1021, 1099, 1198, 1330, 1515, 1803, 2330, 3763, 0,
3894 		DEC_CURVE,CRV_SMEARING  , 138, 139, 139, 139, 139, 139, 139, 139, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, 141, 141, 141, 142, 142, 142, 142, 142, 142, 143, 143, 143, 143, 143, 143, 144, 144, 144, 144, 144, 144, 145, 145, 145, 145, 145, 145, 146, 146, 146, 146, 146, 147, 147, 147, 147, 147, 147, 148, 148, 148, 148, 148, 148, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 150, 150, 150, 150, 150, 151, 151, 151, 151, 151, 152, 152, 152, 152, 152, 153, 153, 153, 153, 153, 154, 154, 154, 154, 154, 155, 155, 155, 155, 155, 156, 156, 156, 156, 157, 157, 157, 157, 157, 158, 158, 158, 158, 158, 158, 158, 158, 159, 159, 159, 159, 160, 160, 160, 160, 160, 161, 161, 161, 161, 162, 162, 162, 162, 163, 163, 163, 163, 164, 164, 164, 165, 165, 165, 165, 166, 166, 166, 166, 167, 167, 167, 167, 167, 167, 167, 168, 168, 168, 168, 169, 169, 169, 170, 170, 170, 170, 171, 171, 171, 172, 172, 172, 173, 173, 173, 174, 174, 174, 174, 175, 175, 175, 176, 176, 176, 176, 176, 176, 177, 177, 177, 178, 178, 178, 179, 179, 180, 180, 180, 181, 181, 181, 182, 182, 182, 183, 183, 184, 184, 184, 185, 185, 185, 185, 185, 186, 186, 186, 187, 187, 188, 188, 188, 189, 189, 190, 190, 191, 191, 191, 192, 192, 193, 193, 194, 194, 194, 194, 194, 195, 195, 196, 196, 197, 197, 198, 198, 199, 199, 200, 200, 201, 201, 202, 202, 203, 203, 203, 203, 204, 204, 205, 205, 206, 207, 207, 208, 208, 209, 209, 210, 211, 211, 212, 212, 212, 213, 213, 214, 214, 215, 216, 216, 217, 218, 218, 219, 220, 220, 221, 221, 221, 222, 223, 224, 224, 225, 226, 227, 227, 228, 229, 230, 230, 230, 231, 232, 233, 233, 234, 235, 236, 237, 238, 239, 239, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 265, 266, 266, 267, 269, 270, 271, 273, 274, 275, 276, 277, 279, 280, 282, 283, 284, 285, 287, 289, 290, 292, 293, 294, 296, 298, 300, 301, 302, 304, 306, 308, 310, 311, 313, 315, 318, 320, 321, 323, 326, 328, 330, 332, 335, 337, 339, 342, 344, 347, 349, 352, 355, 358, 361, 364, 366, 370, 374, 376, 380, 383, 387, 391, 394, 399, 402, 407, 411, 416, 420, 425, 430, 436, 441, 446, 453, 458, 464, 472, 478, 485, 493, 501, 509, 518, 527, 537, 548, 559, 571, 583, 597, 611, 626, 644, 662, 682, 704, 728, 755, 785, 819, 859, 904, 957, 1021, 1099, 1198, 1330, 1515, 1803, 2330, 3763, 0,
3895 		DEC_CURVE,CRV_BUFFERFULL, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 94, 94, 94, 95, 95, 95, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 104, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 113, 115, 117, 119, 121, 122, 124, 127, 130, 132, 135, 139, 142, 146, 149, 153, 158, 162, 167, 171, 176, 180, 186, 193, 202, 209, 216, 223, 232, 243, 254, 266, 279, 292, 306, 320, 335, 337, 351, 367, 380, 396, 414, 437, 464, 493, 520, 549, 583, 611, 644, 675, 711, 755, 785, 819, 859, 904, 957, 1021, 1099, 1198, 1330, 1515, 1803, 2330, 3763, 0,
3896 		-2,
3897 
3898 		/* motorcurve 6   */
3899 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3900 		ACC_CURVE,CRV_NORMALSCAN, 4705, 2664, 2061, 1732, 1521, 1370, 1257, 1167, 1094, 1033, 982, 937, 898, 864, 833, 805, 780, 757, 736, 717, 699, 683, 667, 653, 640, 627, 615, 604, 593, 583, 574, 564, 556, 547, 540, 532, 525, 518, 511, 505, 499, 493, 487, 481, 476, 471, 466, 461, 456, 452, 447, 443, 439, 435, 431, 427, 424, 420, 417, 413, 410, 407, 403, 400, 397, 394, 391, 389, 386, 383, 381, 378, 375, 373, 371, 368, 366, 364, 361, 359, 357, 355, 353, 351, 349, 347, 345, 343, 341, 339, 338, 336, 334, 332, 331, 329, 327, 326, 324, 323, 321, 320, 318, 317, 315, 314, 312, 311, 310, 308, 307, 306, 304, 303, 302, 301, 299, 298, 297, 296, 295, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 270, 269, 268, 267, 266, 265, 264, 264, 263, 262, 261, 260, 260, 259, 258, 257, 257, 256, 255, 255, 254, 253, 252, 252, 251, 250, 250, 249, 248, 248, 247, 246, 246, 245, 244, 244, 243, 242, 242, 241, 241, 240, 239, 239, 238, 238, 237, 237, 236, 235, 235, 234, 234, 233, 233, 232, 232, 231, 231, 230, 230, 229, 229, 228, 227, 227, 227, 226, 226, 225, 225, 224, 224, 223, 223, 222, 222, 221, 221, 220, 220, 219, 219, 219, 218, 218, 217, 217, 216, 216, 216, 215, 215, 214, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 210, 210, 209, 209, 208, 208, 208, 207, 207, 207, 206, 206, 206, 205, 205, 204, 204, 204, 203, 203, 203, 202, 202, 202, 201, 201, 201, 200, 200, 200, 199, 199, 199, 198, 198, 198, 197, 197, 197, 197, 196, 196, 196, 195, 195, 195, 194, 194, 194, 194, 193, 193, 193, 192, 192, 192, 192, 191, 191, 191, 190, 190, 190, 190, 189, 189, 189, 188, 188, 188, 188, 187, 187, 187, 187, 186, 186, 186, 186, 185, 185, 185, 185, 184, 184, 184, 184, 183, 183, 183, 183, 182, 182, 182, 182, 181, 181, 181, 181, 181, 180, 180, 180, 180, 179, 179, 179, 179, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 176, 176, 176, 176, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 171, 171, 171, 0,
3901 		ACC_CURVE,CRV_PARKHOME  , 4705, 2888, 2234, 1878, 1648, 1485, 1362, 1265, 1186, 1120, 1064, 1016, 973, 936, 903, 873, 845, 821, 798, 777, 758, 740, 723, 708, 693, 679, 666, 654, 643, 632, 621, 612, 602, 593, 585, 576, 569, 561, 554, 547, 540, 534, 528, 522, 516, 510, 505, 499, 494, 490, 485, 480, 476, 471, 467, 463, 459, 455, 451, 448, 444, 440, 437, 434, 430, 427, 424, 421, 418, 415, 412, 409, 407, 404, 401, 399, 396, 394, 391, 389, 387, 384, 382, 380, 378, 376, 374, 371, 369, 367, 366, 364, 362, 360, 358, 356, 354, 353, 351, 349, 348, 346, 344, 343, 341, 340, 338, 337, 335, 334, 332, 331, 329, 328, 327, 325, 324, 323, 321, 320, 319, 318, 316, 315, 314, 313, 312, 311, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 285, 284, 283, 282, 281, 280, 279, 279, 278, 277, 276, 275, 275, 274, 273, 272, 272, 271, 270, 269, 269, 268, 267, 267, 266, 265, 264, 264, 263, 262, 262, 261, 260, 260, 259, 259, 258, 257, 257, 256, 255, 255, 254, 254, 253, 252, 252, 251, 251, 250, 249, 249, 248, 248, 247, 247, 246, 246, 245, 245, 244, 243, 243, 242, 242, 241, 241, 240, 240, 239, 239, 238, 238, 237, 237, 237, 236, 236, 235, 235, 234, 234, 233, 233, 232, 232, 231, 231, 231, 230, 230, 229, 229, 228, 228, 228, 227, 227, 226, 226, 225, 225, 225, 224, 224, 223, 223, 223, 222, 222, 222, 221, 221, 220, 220, 220, 219, 219, 219, 218, 218, 217, 217, 217, 216, 216, 216, 215, 215, 215, 214, 214, 214, 213, 213, 213, 212, 212, 212, 211, 211, 211, 210, 210, 210, 209, 209, 209, 208, 208, 208, 207, 207, 207, 207, 206, 206, 206, 205, 205, 205, 204, 204, 204, 204, 203, 203, 203, 202, 202, 202, 202, 201, 201, 201, 200, 200, 200, 200, 199, 199, 199, 199, 198, 198, 198, 198, 197, 197, 197, 196, 196, 196, 196, 195, 195, 195, 195, 194, 194, 194, 194, 193, 193, 193, 193, 192, 192, 192, 192, 192, 191, 191, 191, 191, 190, 190, 190, 190, 189, 189, 189, 189, 189, 188, 188, 188, 188, 187, 187, 187, 187, 187, 186, 186, 186, 186, 186, 185, 185, 185, 185, 184, 184, 184, 184, 184, 183, 183, 183, 183, 183, 182, 182, 182, 182, 182, 181, 181, 181, 181, 181, 180, 180, 180, 180, 180, 180, 179, 179, 179, 179, 179, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 172, 171, 171, 171, 171, 0,
3902 		ACC_CURVE,CRV_SMEARING  , 4705, 3056, 2724, 2497, 1498, 1498, 1374, 1276, 1196, 1130, 1073, 1025, 982, 944, 911, 880, 853, 828, 805, 784, 764, 746, 730, 714, 699, 685, 675, 0,
3903 		DEC_CURVE,CRV_NORMALSCAN, 523, 545, 571, 601, 636, 678, 730, 796, 883, 1005, 1195, 1544, 4705, 0,
3904 		DEC_CURVE,CRV_PARKHOME  , 171, 172, 172, 173, 173, 174, 174, 175, 175, 176, 176, 177, 177, 178, 179, 179, 180, 180, 181, 182, 182, 183, 183, 184, 185, 185, 186, 187, 187, 188, 189, 189, 190, 191, 192, 192, 193, 194, 195, 195, 196, 197, 198, 199, 199, 200, 201, 202, 203, 204, 205, 206, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 222, 223, 225, 226, 227, 228, 230, 231, 232, 234, 235, 237, 238, 240, 241, 243, 244, 246, 247, 249, 251, 253, 254, 256, 258, 260, 262, 264, 266, 268, 271, 273, 275, 278, 280, 282, 285, 288, 290, 293, 296, 299, 302, 305, 309, 312, 316, 319, 323, 327, 331, 336, 340, 345, 350, 355, 360, 365, 371, 377, 384, 391, 398, 406, 414, 422, 432, 441, 452, 463, 476, 489, 504, 520, 538, 558, 580, 605, 633, 667, 706, 752, 810, 883, 979, 1116, 1326, 1714, 4705, 0,
3905 		DEC_CURVE,CRV_SMEARING  , 675, 685, 699, 714, 730, 746, 764, 784, 805, 828, 853, 880, 911, 944, 982, 1025, 1073, 1130, 1196, 1276, 1374, 1498, 1498, 2497, 2724, 3056, 4705, 0,
3906 		DEC_CURVE,CRV_BUFFERFULL, 171, 172, 172, 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 207, 208, 209, 210, 211, 213, 214, 215, 217, 218, 219, 221, 222, 224, 225, 227, 228, 230, 232, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 258, 260, 262, 265, 268, 270, 273, 276, 279, 282, 285, 289, 292, 296, 299, 303, 307, 311, 316, 320, 325, 330, 335, 341, 347, 353, 359, 366, 373, 381, 390, 398, 408, 418, 429, 441, 455, 469, 485, 503, 523, 545, 571, 601, 636, 678, 730, 796, 883, 1005, 1195, 1544, 4705, 0,
3907 		-2,
3908 
3909 		/* motorcurve 7   */
3910 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3911 		ACC_CURVE,CRV_NORMALSCAN, 3763, 3763, 3763, 3763, 3763, 3763, 2444, 2178, 1997, 1198, 1198, 1098, 1020, 956, 903, 858, 819, 785, 754, 727, 703, 681, 662, 644, 626, 610, 596, 582, 571, 558, 547, 537, 527, 518, 509, 500, 492, 485, 478, 471, 464, 458, 452, 446, 440, 435, 430, 425, 420, 415, 410, 407, 402, 398, 394, 391, 386, 383, 380, 376, 373, 369, 366, 364, 360, 357, 355, 352, 349, 347, 344, 341, 338, 337, 334, 332, 329, 328, 325, 323, 321, 319, 317, 315, 313, 311, 310, 308, 306, 304, 302, 301, 299, 297, 295, 294, 293, 291, 290, 288, 286, 285, 284, 283, 281, 280, 278, 277, 275, 275, 274, 272, 271, 270, 268, 267, 266, 265, 264, 263, 262, 261, 259, 258, 257, 257, 256, 255, 254, 253, 251, 250, 249, 248, 248, 247, 246, 245, 244, 243, 243, 242, 241, 240, 239, 239, 238, 237, 236, 235, 235, 234, 233, 232, 231, 230, 230, 230, 229, 228, 228, 227, 226, 225, 225,224, 223, 222, 222, 221, 221, 221, 220, 219, 219, 218, 217, 217, 216, 215, 215, 214, 213, 213, 212, 212, 212, 211, 211, 210, 209, 209, 208, 208, 207, 207, 206, 206, 205, 204, 204, 203, 203, 203, 203, 202, 202, 201, 201, 200, 200, 199, 199, 198, 198, 197, 197, 196, 196, 195, 195, 194, 194, 194, 194, 194, 193, 193, 192, 192, 191, 191, 190, 190, 190, 189, 189, 188, 188, 188, 187, 187, 186, 186, 185, 185, 185, 185, 185, 185, 184, 184, 183, 183, 183, 182, 182, 182, 181, 181, 180, 180, 180, 179, 179, 179, 178, 178, 178, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 174, 174, 174, 173, 173, 173, 172, 172, 172, 171, 171, 171, 171, 170, 170, 170, 169, 169, 169, 169, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 165, 165, 165, 165, 164, 164, 164, 163, 163, 163, 163, 162, 162, 162, 162, 161, 161, 161, 161, 160, 160, 160, 160, 159, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 156, 156, 156, 156, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 153, 153, 153, 153, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 139, 139, 138, 138, 138, 138, 138, 138, 138, 137, 137, 137, 137, 137, 137, 137, 136, 136, 136, 136, 136, 136, 136, 135, 135, 135, 135, 135, 135, 135, 134, 134, 134, 134, 134, 134, 134, 134, 133, 133, 133, 133, 133, 133, 133, 133, 132, 132, 132, 132, 132, 132, 132, 132, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 130, 130, 130, 130, 130, 130, 130, 130, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 126, 126, 126, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 101, 101, 101, 101, 101, 101, 101, 101, 101,101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 0,
3912 		ACC_CURVE,CRV_PARKHOME  , 3763, 2330, 1803, 1515, 1330, 1198, 1099, 1021, 957, 904, 859, 819, 785, 755, 728, 704, 682, 662, 644, 626, 611, 597, 583, 571, 559, 548, 537, 527, 518, 509, 501, 493, 485, 478, 472, 464, 458, 453, 446, 441, 436, 430, 425, 420, 416, 411, 407, 402, 399, 394, 391, 387, 383, 380, 376, 374, 370, 366, 364, 361, 358, 355, 352, 349, 347, 344, 342, 339, 337, 335, 332, 330, 328, 326, 323, 321, 320, 318, 315, 313, 311, 310, 308, 306, 304, 302, 301, 300, 298, 296, 294, 293, 292, 290, 289, 287, 285, 284, 283, 282, 280, 279, 277, 276, 275, 274, 273, 271, 270, 269, 267, 266, 266, 265, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 239, 239, 238, 237, 236, 235, 234, 233, 233, 232, 231, 230, 230, 230, 229, 228, 227, 227, 226, 225, 224, 224, 223, 222, 221, 221, 221, 220, 220, 219, 218, 218, 217, 216, 216, 215, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 209, 209, 208, 208, 207, 207, 206, 205, 205, 204, 204, 203, 203, 203, 203, 202, 202, 201, 201, 200, 200, 199, 199, 198, 198, 197, 197, 196, 196, 195, 195, 194, 194, 194, 194, 194, 193, 193, 192, 192, 191, 191, 191, 190, 190, 189, 189, 188, 188, 188, 187, 187, 186, 186, 186, 185, 185, 185, 185, 185, 184, 184, 184, 183, 183, 182, 182, 182, 181, 181, 181, 180, 180, 180, 179, 179, 178, 178, 178, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 174, 174, 174, 174, 173, 173, 173, 172, 172, 172, 171, 171, 171, 170, 170, 170, 170, 169, 169, 169, 168, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 165, 165, 165, 165, 164, 164, 164, 163, 163, 163, 163, 162, 162, 162, 162, 161, 161, 161, 161, 160, 160, 160, 160, 160, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 156, 156, 156, 156, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 153, 153, 153, 153, 153, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 139, 139, 138, 0,
3913 		ACC_CURVE,CRV_SMEARING  , 3763, 2330, 1803, 1515, 1330, 1198, 1099, 1021, 957, 904, 859, 819, 785, 755, 728, 704, 682, 662, 644, 626, 611, 597, 583, 571, 559, 548, 537, 527, 518, 509, 501, 493, 485, 478, 472, 464, 458, 453, 446, 441, 436, 430, 425, 420, 416, 411, 407, 402, 399, 394, 391, 387, 383, 380, 376, 374, 370, 366, 364, 361, 358, 355, 352, 349, 347, 344, 342, 339, 337, 335, 332, 330, 328, 326, 323, 321, 320, 318, 315, 313, 311, 310, 308, 306, 304, 302, 301, 300, 298, 296, 294, 293, 292, 290, 289, 287, 285, 284, 283, 282, 280, 279, 277, 276, 275, 274, 273, 271, 270, 269, 267, 266, 266, 265, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 239, 239, 238, 237, 236, 235, 234, 233, 233, 232, 231, 230, 230, 230, 229, 228, 227, 227, 226, 225, 224, 224, 223, 222, 221, 221, 221, 220, 220, 219, 218, 218, 217, 216, 216, 215, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 209, 209, 208, 208, 207, 207, 206, 205, 205, 204, 204, 203, 203, 203, 203, 202, 202, 201, 201, 200, 200, 199, 199, 198, 198, 197, 197, 196, 196, 195, 195, 194, 194, 194, 194, 194, 193, 193, 192, 192, 191, 191, 191, 190, 190, 189, 189, 188, 188, 188, 187, 187, 186, 186, 186, 185, 185, 185, 185, 185, 184, 184, 184, 183, 183, 182, 182, 182, 181, 181, 181, 180, 180, 180, 179, 179, 178, 178, 178, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 174, 174, 174, 174, 173, 173, 173, 172, 172, 172, 171, 171, 171, 170, 170, 170, 170, 169, 169, 169, 168, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 165, 165, 165, 165, 164, 164, 164, 163, 163, 163, 163, 162, 162, 162, 162, 161, 161, 161, 161, 160, 160, 160, 160, 160, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 156, 156, 156, 156, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 153, 153, 153, 153, 153, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 139, 139, 138, 0,
3914 		DEC_CURVE,CRV_NORMALSCAN, 522, 522, 528, 536, 544, 553, 562, 572, 582, 593, 604, 616, 629, 643, 658, 674, 692, 711, 732, 755, 781, 810, 843, 880, 923, 974, 1035, 1110, 1205, 1331, 1510, 1796, 2368, 3400, 4922, 0,
3915 		DEC_CURVE,CRV_PARKHOME  , 138, 142, 146, 149, 153, 158, 162, 167, 171, 176, 180, 186, 193, 202, 209, 216, 223, 232, 243, 254, 266, 279, 292, 306, 320, 335, 337, 351, 367, 380, 396, 414, 437, 464, 493, 520, 549, 583, 611, 644, 675, 711, 755, 785, 819, 859, 904, 957, 1021, 1099, 1198, 1330, 1515, 1803, 2330, 3763, 0,
3916 		DEC_CURVE,CRV_SMEARING  , 138, 139, 139, 139, 139, 139, 139, 139, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, 141, 141, 141, 142, 142, 142, 142, 142, 142, 143, 143, 143, 143, 143, 143, 144, 144, 144, 144, 144, 144, 145, 145, 145, 145, 145, 145, 146, 146, 146, 146, 146, 147, 147, 147, 147, 147, 147, 148, 148, 148, 148, 148, 148, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 150, 150, 150, 150, 150, 151, 151, 151, 151, 151, 152, 152, 152, 152, 152, 153, 153, 153, 153, 153, 154, 154, 154, 154, 154, 155, 155, 155, 155, 155, 156, 156, 156, 156, 157, 157, 157, 157, 157, 158, 158, 158, 158, 158, 158, 158, 158, 159, 159, 159, 159, 160, 160, 160, 160, 160, 161, 161, 161, 161, 162, 162, 162, 162, 163, 163, 163, 163, 164, 164, 164, 165, 165, 165, 165, 166, 166, 166, 166, 167, 167, 167, 167, 167, 167, 167, 168, 168, 168, 168, 169, 169, 169, 170, 170, 170, 170, 171, 171, 171, 172, 172, 172, 173, 173, 173, 174, 174, 174, 174, 175, 175, 175, 176, 176, 176, 176, 176, 176, 177, 177, 177, 178, 178, 178, 179, 179, 180, 180, 180, 181, 181, 181, 182, 182, 182, 183, 183, 184, 184, 184, 185, 185, 185, 185, 185, 186, 186, 186, 187, 187, 188, 188, 188, 189, 189, 190, 190, 191, 191, 191, 192, 192, 193, 193, 194, 194, 194, 194, 194, 195, 195, 196, 196, 197, 197, 198, 198, 199, 199, 200, 200, 201, 201, 202, 202, 203, 203, 203, 203, 204, 204, 205, 205, 206, 207, 207, 208, 208, 209, 209, 210, 211, 211, 212, 212, 212, 213, 213, 214, 214, 215, 216, 216, 217, 218, 218, 219, 220, 220, 221, 221, 221, 222, 223, 224, 224, 225, 226, 227, 227, 228, 229, 230, 230, 230, 231, 232, 233, 233, 234, 235, 236, 237, 238, 239, 239, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 265, 266, 266, 267, 269, 270, 271, 273, 274, 275, 276, 277, 279, 280, 282, 283, 284, 285, 287, 289, 290, 292, 293, 294, 296, 298, 300, 301, 302, 304, 306, 308, 310, 311, 313, 315, 318, 320, 321, 323, 326, 328, 330, 332, 335, 337, 339, 342, 344, 347, 349, 352, 355, 358, 361, 364, 366, 370, 374, 376, 380, 383, 387, 391, 394, 399, 402, 407, 411, 416, 420, 425, 430, 436, 441, 446, 453, 458, 464, 472, 478, 485, 493, 501, 509, 518, 527, 537, 548, 559, 571, 583, 597, 611, 626, 644, 662, 682, 704, 728, 755, 785, 819, 859, 904, 957, 1021, 1099, 1198, 1330, 1515, 1803, 2330, 3763, 0,
3917 		DEC_CURVE,CRV_BUFFERFULL, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 94, 94, 94, 95, 95, 95, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 104, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 113, 115, 117, 119, 121, 122, 124, 127, 130, 132, 135, 139, 142, 146, 149, 153, 158, 162, 167, 171, 176, 180, 186, 193, 202, 209, 216, 223, 232, 243, 254, 266, 279, 292, 306, 320, 335, 337, 351, 367, 380, 396, 414, 437, 464, 493, 520, 549, 583, 611, 644, 675, 711, 755, 785, 819, 859, 904, 957, 1021, 1099, 1198, 1330, 1515, 1803, 2330, 3763, 0,
3918 		-2,
3919 
3920 		/* motorcurve 8   */
3921 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3922 		ACC_CURVE,CRV_NORMALSCAN, 1046, 1046, 1046, 1046, 1046, 1046, 647, 501, 421, 370, 333, 305, 284, 266, 251, 239, 228, 218, 210, 202, 196, 190, 184, 179, 174, 170, 166, 162, 159, 155, 152, 149, 147, 144, 142, 139, 137, 135, 133, 131, 129, 127, 126, 124, 123, 121, 120, 118, 117, 116, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 100, 99, 98, 97, 96, 96, 95, 94, 94, 93, 92, 92, 91, 91, 90, 89, 89, 88, 88, 87, 87, 86, 86, 85, 85, 84, 84, 83, 83, 82, 82, 82, 81, 81, 80, 80, 79, 79, 79, 78, 78, 78, 77, 77, 76, 76, 76, 75, 75, 75, 74, 74, 74, 74, 73, 73, 73, 72, 72, 72, 71, 71, 71, 71, 70, 70, 70, 70, 69, 69, 69, 69, 68, 68, 68, 68, 67, 67, 67, 67, 66, 66, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64, 63, 63, 63, 63, 62, 62, 62, 62, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 53, 53, 53, 53, 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 23, 23, 0,
3923 		ACC_CURVE,CRV_PARKHOME  , 1045, 678, 604, 554, 332, 332, 304, 283, 265, 250, 238, 227, 217, 209, 201, 195, 189, 183, 178,173, 169, 165, 161, 158, 154, 151, 148, 146, 143, 141, 138, 136, 134, 132, 130, 128, 126, 125, 123, 122, 120, 119, 117, 116, 115, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103,102, 101, 100, 99, 99, 98, 97, 96, 95, 95, 94, 93, 93, 92, 91, 91, 90, 90, 89, 88, 88, 87, 87, 86, 86, 85, 85, 84, 84, 83, 83, 82, 82, 81, 81, 81, 80, 80, 79, 79, 78, 78, 78, 77, 77, 77, 76, 76, 75, 75, 75, 74, 74, 74, 73, 73, 73, 73, 72, 72, 72, 71, 71, 71, 70, 70, 70, 70, 69, 69, 69, 69, 68, 68, 68, 68, 67, 67, 67, 67, 66, 66, 66, 66, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 53, 53, 53, 53, 53, 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 39, 0,
3924 		ACC_CURVE,CRV_SMEARING  , 1045, 678, 604, 554, 332, 332, 304, 283, 265, 250, 238, 227, 217, 209, 201, 195, 189, 183, 178,173, 169, 165, 161, 158, 154, 151, 148, 146, 143, 141, 138, 136, 134, 132, 130, 128, 126, 125, 123, 122, 120, 119, 117, 116, 115, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103,102, 101, 100, 99, 99, 98, 97, 96, 95, 95, 94, 93, 93, 92, 91, 91, 90, 90, 89, 88, 88, 87, 87, 86, 86, 85, 85, 84, 84, 83, 83, 82, 82, 81, 81, 81, 80, 80, 79, 79, 78, 78, 78, 77, 77, 77, 76, 76, 75, 75, 75, 74, 74, 74, 73, 73, 73, 73, 72, 72, 72, 71, 71, 71, 70, 70, 70, 70, 69, 69, 69, 69, 68, 68, 68, 68, 67, 67, 67, 67, 66, 66, 66, 66, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 53, 53, 53, 53, 53, 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 39, 0,
3925 		DEC_CURVE,CRV_NORMALSCAN, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 34, 34, 35, 35, 36, 37, 38, 38, 39, 40, 41, 42, 43, 45, 46, 47, 48, 50, 51, 53, 54, 57, 59, 61, 63, 65, 68, 71, 75, 78, 82, 86, 90, 94, 94, 98, 103, 106, 111, 116, 122, 130, 138, 145, 153, 163, 171, 180, 188, 198, 211, 219, 228, 239, 252, 267, 284, 306, 334, 370, 422, 502, 648, 1045, 0,
3926 		DEC_CURVE,CRV_PARKHOME  , 39, 40, 41, 42, 43, 45, 46, 47, 48, 50, 51, 53, 54, 57, 59, 61, 63, 65, 68, 71, 75, 78, 82, 86, 90, 94, 94, 98, 103, 106, 111, 116, 122, 130, 138, 145, 153, 163, 171, 180, 188, 198, 211, 219, 228, 239, 252, 267, 284, 306, 334, 370, 422, 502, 648, 1045, 0,
3927 		DEC_CURVE,CRV_SMEARING  , 39, 39, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 57, 57, 57, 58, 58, 58, 58, 58, 58, 58, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 61, 61, 61, 61, 61, 61, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 68, 68, 68, 68, 69, 69, 69, 69, 70, 70, 70, 70, 71, 71, 71, 71, 72, 72, 72, 73, 73, 73, 73, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 81, 81, 81, 82, 82, 83, 83, 84, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 90, 90, 91, 91, 92, 93, 93, 94, 94, 95, 96, 96, 97, 98, 99, 99, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 136, 138, 140, 142, 145, 147, 150, 153, 156, 159, 163, 167, 171, 175, 180, 185, 190, 196, 203, 211, 219, 228, 239, 252, 267, 284, 306, 334, 370, 422, 502, 648, 1045, 0,
3928 		DEC_CURVE,CRV_BUFFERFULL, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 34, 34, 35, 35, 36, 37, 38, 38, 39, 40, 41, 42, 43, 45, 46, 47, 48, 50, 51, 53, 54, 57, 59, 61, 63, 65, 68, 71, 75, 78, 82, 86, 90, 94, 94, 98, 103, 106, 111, 116, 122, 130, 138, 145, 153, 163, 171, 180, 188, 198, 211, 219, 228, 239, 252, 267, 284, 306, 334, 370, 422, 502, 648, 1045, 0,
3929 		-1
3930 	};
3931 
3932 	rst = (SANE_Int *)malloc(sizeof(steps));
3933 	if (rst != NULL)
3934 		memcpy(rst, &steps, sizeof(steps));
3935 
3936 	return rst;
3937 }
3938 
hp3970_motornull3939 static SANE_Int *hp3970_motor()
3940 {
3941 	SANE_Int *rst = NULL;
3942 	SANE_Int steps[]  =
3943 	{
3944 		/* motorcurve 1   */
3945 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3946 		ACC_CURVE,CRV_NORMALSCAN, 2000, 1984, 1968, 1953, 1937, 1921, 1906, 1890, 1874, 1859, 1843, 1827, 1812, 1796, 1781, 1765, 1749, 1734, 1715, 1700, 1684, 1669, 1653, 1637, 1622, 1606, 1590, 1572, 1556, 1541, 1525, 1510, 1494, 1478, 1463, 1447, 1431, 1416, 1400, 1384, 1366, 1351, 1335, 1319, 1304, 1288, 1272, 1257, 1241, 1225, 1210, 1194, 1179, 1160, 1145, 1129, 1113, 1098, 1082, 1066, 1051, 1035, 1017, 1001, 986, 970, 954, 939, 923, 907, 892, 876, 861, 845, 829, 814, 798, 782, 767, 749, 0,
3947 		ACC_CURVE,CRV_PARKHOME  , 4705, 2913, 2253, 1894, 1662, 1498, 1374, 1276, 1196, 1129, 1073, 1024, 981, 944, 910, 880, 852, 827, 804, 783, 764, 746, 729, 713, 699, 685, 672, 659, 648, 637, 626, 616, 607, 598, 589, 581, 573, 565, 558, 551, 544, 538, 532, 526, 520, 514, 509, 503, 500, 0,
3948 		ACC_CURVE,CRV_SMEARING  , 200, 12, 14, 16, 0,
3949 		DEC_CURVE,CRV_NORMALSCAN, 749, 1166, 1583, 2000, 0,
3950 		DEC_CURVE,CRV_PARKHOME  , 500, 503, 509, 514, 520, 526, 532, 538, 544, 551, 558, 565, 573, 581, 589, 598, 607, 616, 626, 637, 648, 659, 672, 685, 699, 713, 729, 746, 764, 783, 804, 827, 852, 880, 910, 944, 981, 1024, 1073, 1129, 1196, 1276, 1374, 1498, 1662, 1894, 2253, 2913, 4705, 0,
3951 		DEC_CURVE,CRV_SMEARING  , 300, 234, 167, 100, 0,
3952 		DEC_CURVE,CRV_BUFFERFULL, 1100, 867, 633, 400, 0,
3953 		-2,
3954 
3955 		/* motorcurve 2   */
3956 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3957 		ACC_CURVE,CRV_NORMALSCAN, 4705, 2664, 2061, 1732, 1521, 1370, 1257, 1167, 1094, 1033, 982, 937, 898, 864, 833, 805, 780, 757, 736, 717, 699, 683, 667, 653, 640, 627, 615, 604, 593, 583, 574, 564, 556, 547, 540, 532, 525, 518, 511, 505, 499, 493, 487, 481, 476, 471, 466, 461, 456, 452, 447, 443, 439, 435, 431, 427, 424, 420, 417, 413, 410, 407, 403, 400, 397, 394, 391, 389, 386, 383, 381, 378, 375, 373, 371, 368, 366, 364, 361, 359, 357, 355, 353, 351, 349, 347, 345, 343, 341, 339, 338, 336, 334, 332, 331, 329, 327, 326, 324, 323, 321, 320, 318, 317, 315, 314, 312, 311, 310, 308, 307, 306, 304, 303, 302, 301, 299, 298, 297, 296, 295, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 270, 269, 268, 267, 266, 265, 264, 264, 263, 262, 261, 260, 260, 259, 258, 257, 257, 256, 255, 255, 254, 253, 252, 252, 251, 250, 250, 249, 248, 248, 247, 246, 246, 245, 244, 244, 243, 242, 242, 241, 241, 240, 239, 239, 238, 238, 237, 237, 236, 235, 235, 234, 234, 233, 233, 232, 232, 231, 231, 230, 230, 229, 229, 228, 227, 227, 227, 226, 226, 225, 225, 224, 224, 223, 223, 222, 222, 221, 221, 220, 220, 219, 219, 219, 218, 218, 217, 217, 216, 216, 216, 215, 215, 214, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 210, 210, 209, 209, 208, 208, 208, 207, 207, 207, 206, 206, 206, 205, 205, 204, 204, 204, 203, 203, 203, 202, 202, 202, 201, 201, 201, 200, 200, 200, 199, 199, 199, 198, 198, 198, 197, 197, 197, 197, 196, 196, 196, 195, 195, 195, 194, 194, 194, 194, 193, 193, 193, 192, 192, 192, 192, 191, 191, 191, 190, 190, 190, 190, 189, 189, 189, 188, 188, 188, 188, 187, 187, 187, 187, 186, 186, 186, 186, 185, 185, 185, 185, 184, 184, 184, 184, 183, 183, 183, 183, 182, 182, 182, 182, 181, 181, 181, 181, 181, 180, 180, 180, 180, 179, 179, 179, 179, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 176, 176, 176, 176, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 171, 171, 171, 0,
3958 		ACC_CURVE,CRV_PARKHOME  , 4705, 2913, 2253, 1894, 1662, 1498, 1374, 1276, 1196, 1129, 1073, 1024, 981, 944, 910, 880, 852, 827, 804, 783, 764, 746, 729, 713, 699, 685, 672, 659, 648, 637, 626, 616, 607, 598, 589, 581, 573, 565, 558, 551, 544, 538, 532, 526, 520, 514, 509, 503, 500, 0,
3959 		ACC_CURVE,CRV_SMEARING  , 200, 12, 14, 16, 0,
3960 		DEC_CURVE,CRV_NORMALSCAN, 171, 172, 172, 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 207, 208, 209, 210, 211, 213, 214, 215, 217, 218, 219, 221, 222, 224, 225, 227, 228, 230, 232, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 258, 260, 262, 265, 268, 270, 273, 276, 279, 282, 285, 289, 292, 296, 299, 303, 307, 311, 316, 320, 325, 330, 335, 341, 347, 353, 359, 366, 373, 381, 390, 398, 408, 418, 429, 441, 455, 469, 485, 503, 523, 545, 571, 601, 636, 678, 730, 796, 883, 1005, 1195, 1544, 4705, 0,
3961 		DEC_CURVE,CRV_PARKHOME  , 500, 503, 509, 514, 520, 526, 532, 538, 544, 551, 558, 565, 573, 581, 589, 598, 607, 616, 626, 637, 648, 659, 672, 685, 699, 713, 729, 746, 764, 783, 804, 827, 852, 880, 910, 944, 981, 1024, 1073, 1129, 1196, 1276, 1374, 1498, 1662, 1894, 2253, 2913, 4705, 0,
3962 		DEC_CURVE,CRV_SMEARING  , 300, 234, 167, 100, 0,
3963 		DEC_CURVE,CRV_BUFFERFULL, 1100, 867, 633, 400, 0,
3964 		-2,
3965 
3966 		/* motorcurve 3   */
3967 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3968 		ACC_CURVE,CRV_NORMALSCAN, 5360, 3655, 2855, 2422, 2142, 1944, 1795, 1678, 1582, 1503, 1434, 1374, 0,
3969 		ACC_CURVE,CRV_PARKHOME  , 5360, 3362, 2628, 2229, 1973, 1791, 1654, 1547, 1458, 1384, 1319, 1264, 1214, 1170, 1131, 1096, 1063, 1034, 1006, 981, 958, 937, 916, 897, 880, 863, 847, 832, 818, 805, 792, 780, 769, 758, 747, 737, 727, 718, 709, 700, 692, 684, 677, 669, 662, 655, 648, 642, 636, 629, 624, 618, 612, 607, 602, 596, 591, 587, 582, 577, 573, 568, 564, 560, 556, 552, 548, 544, 540, 537, 533, 530, 526, 523, 520, 516, 513, 510, 507, 504, 501, 498, 496, 493, 490, 488, 485, 482, 480, 477, 475, 472, 470, 468, 466, 463, 461, 459, 457, 455, 453, 450, 448, 446, 444, 443, 441, 439, 437, 435, 433, 431, 430, 428, 426, 425, 423, 421, 420, 418, 416, 415, 413, 412, 410, 409, 407, 406, 405, 403, 402, 400, 399, 398, 396, 395, 394, 392, 391, 390, 389, 387, 386, 385, 384, 382, 381, 380, 379, 378, 377, 376, 374, 373, 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, 360, 359, 358, 357, 356, 355, 354, 353, 353, 352, 351, 350, 349, 348, 0,
3970 		ACC_CURVE,CRV_SMEARING  , 5360, 3362, 2628, 2229, 1973, 1791, 1654, 1547, 0,
3971 		DEC_CURVE,CRV_NORMALSCAN, 1374, 1434, 1503, 1582, 1678, 1795, 1944, 2142, 2422, 2855, 3655, 5360, 0,
3972 		DEC_CURVE,CRV_PARKHOME  , 348, 351, 353, 356, 359, 362, 365, 368, 371, 374, 378, 381, 385, 389, 392, 396, 400, 405, 409, 413, 418, 423, 428, 433, 439, 444, 450, 457, 463, 470, 477, 485, 493, 501, 510, 520, 530, 540, 552, 564, 577, 591, 607, 624, 642, 662, 684, 709, 737, 769, 805, 847, 897, 958, 1034, 1131, 1264, 1458, 1791, 2628, 5360, 0,
3973 		DEC_CURVE,CRV_SMEARING  , 1547, 1654, 1791, 1973, 2229, 2628, 3362, 5360, 0,
3974 		DEC_CURVE,CRV_BUFFERFULL, 1374, 1434, 1503, 1582, 1678, 1795, 1944, 2142, 2422, 2855, 3655, 5360, 0,
3975 		-2,
3976 
3977 		/* motorcurve 4   */
3978 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3979 		ACC_CURVE,CRV_NORMALSCAN, 4705, 2664, 2061, 1732, 1521, 1370, 1257, 1167, 1094, 1033, 982, 937, 898, 864, 833, 805, 780, 757, 736, 717, 699, 683, 667, 653, 640, 627, 615, 604, 593, 583, 574, 564, 556, 547, 540, 532, 525, 518, 511, 505, 499, 493, 487, 481, 476, 471, 466, 461, 456, 452, 447, 443, 439, 435, 431, 427, 424, 420, 417, 413, 410, 407, 403, 400, 397, 394, 391, 389, 386, 383, 381, 378, 375, 373, 371, 368, 366, 364, 361, 359, 357, 355, 353, 351, 349, 347, 345, 343, 341, 339, 338, 336, 334, 332, 331, 329, 327, 326, 324, 323, 321, 320, 318, 317, 315, 314, 312, 311, 310, 308, 307, 306, 304, 303, 302, 301, 299, 298, 297, 296, 295, 293, 292, 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, 271, 270, 270, 269, 268, 267, 266, 265, 264, 264, 263, 262, 261, 260, 260, 259, 258, 257, 257, 256, 255, 255, 254, 253, 252, 252, 251, 250, 250, 249, 248, 248, 247, 246, 246, 245, 244, 244, 243, 242, 242, 241, 241, 240, 239, 239, 238, 238, 237, 237, 236, 235, 235, 234, 234, 233, 233, 232, 232, 231, 231, 230, 230, 229, 229, 228, 227, 227, 227, 226, 226, 225, 225, 224, 224, 223, 223, 222, 222, 221, 221, 220, 220, 219, 219, 219, 218, 218, 217, 217, 216, 216, 216, 215, 215, 214, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 210, 210, 209, 209, 208, 208, 208, 207, 207, 207, 206, 206, 206, 205, 205, 204, 204, 204, 203, 203, 203, 202, 202, 202, 201, 201, 201, 200, 200, 200, 199, 199, 199, 198, 198, 198, 197, 197, 197, 197, 196, 196, 196, 195, 195, 195, 194, 194, 194, 194, 193, 193, 193, 192, 192, 192, 192, 191, 191, 191, 190, 190, 190, 190, 189, 189, 189, 188, 188, 188, 188, 187, 187, 187, 187, 186, 186, 186, 186, 185, 185, 185, 185, 184, 184, 184, 184, 183, 183, 183, 183, 182, 182, 182, 182, 181, 181, 181, 181, 181, 180, 180, 180, 180, 179, 179, 179, 179, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 176, 176, 176, 176, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 171, 171, 171, 0,
3980 		ACC_CURVE,CRV_PARKHOME  , 4705, 2888, 2234, 1878, 1648, 1485, 1362, 1265, 1186, 1120, 1064, 1016, 973, 936, 903, 873, 845, 821, 798, 777, 758, 740, 723, 708, 693, 679, 666, 654, 643, 632, 621, 612, 602, 593, 585, 576, 569, 561, 554, 547, 540, 534, 528, 522, 516, 510, 505, 499, 494, 490, 485, 480, 476, 471, 467, 463, 459, 455, 451, 448, 444, 440, 437, 434, 430, 427, 424, 421, 418, 415, 412, 409, 407, 404, 401, 399, 396, 394, 391, 389, 387, 384, 382, 380, 378, 376, 374, 371, 369, 367, 366, 364, 362, 360, 358, 356, 354, 353, 351, 349, 348, 346, 344, 343, 341, 340, 338, 337, 335, 334, 332, 331, 329, 328, 327, 325, 324, 323, 321, 320, 319, 318, 316, 315, 314, 313, 312, 311, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, 285, 284, 283, 282, 281, 280, 279, 279, 278, 277, 276, 275, 275, 274, 273, 272, 272, 271, 270, 269, 269, 268, 267, 267, 266, 265, 264, 264, 263, 262, 262, 261, 260, 260, 259, 259, 258, 257, 257, 256, 255, 255, 254, 254, 253, 252, 252, 251, 251, 250, 249, 249, 248, 248, 247, 247, 246, 246, 245, 245, 244, 243, 243, 242, 242, 241, 241, 240, 240, 239, 239, 238, 238, 237, 237, 237, 236, 236, 235, 235, 234, 234, 233, 233, 232, 232, 231, 231, 231, 230, 230, 229, 229, 228, 228, 228, 227, 227, 226, 226, 225, 225, 225, 224, 224, 223, 223, 223, 222, 222, 222, 221, 221, 220, 220, 220, 219, 219, 219, 218, 218, 217, 217, 217, 216, 216, 216, 215, 215, 215, 214, 214, 214, 213, 213, 213, 212, 212, 212, 211, 211, 211, 210, 210, 210, 209, 209, 209, 208, 208, 208, 207, 207, 207, 207, 206, 206, 206, 205, 205, 205, 204, 204, 204, 204, 203, 203, 203, 202, 202, 202, 202, 201, 201, 201, 200, 200, 200, 200, 199, 199, 199, 199, 198, 198, 198, 198, 197, 197, 197, 196, 196, 196, 196, 195, 195, 195, 195, 194, 194, 194, 194, 193, 193, 193, 193, 192, 192, 192, 192, 192, 191, 191, 191, 191, 190, 190, 190, 190, 189, 189, 189, 189, 189, 188, 188, 188, 188, 187, 187, 187, 187, 187, 186, 186, 186, 186, 186, 185, 185, 185, 185, 184, 184, 184, 184, 184, 183, 183, 183, 183, 183, 182, 182, 182, 182, 182, 181, 181, 181, 181, 181, 180, 180, 180, 180, 180, 180, 179, 179, 179, 179, 179, 178, 178, 178, 178, 178, 177, 177, 177, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 175, 175, 174, 174, 174, 174, 174, 174, 173, 173, 173, 173, 173, 173, 172, 172, 172, 172, 172, 172, 171, 171, 171, 171, 0,
3981 		ACC_CURVE,CRV_SMEARING  , 4705, 3056, 2724, 2497, 1498, 1498, 1374, 1276, 1196, 1130, 1073, 1025, 982, 944, 911, 880, 853, 828, 805, 784, 764, 746, 730, 714, 699, 685, 675, 0,
3982 		DEC_CURVE,CRV_NORMALSCAN, 171, 172, 172, 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 207, 208, 209, 210, 211, 213, 214, 215, 217, 218, 219, 221, 222, 224, 225, 227, 228, 230, 232, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 258, 260, 262, 265, 268, 270, 273, 276, 279, 282, 285, 289, 292, 296, 299, 303, 307, 311, 316, 320, 325, 330, 335, 341, 347, 353, 359, 366, 373, 381, 390, 398, 408, 418, 429, 441, 455, 469, 485, 503, 523, 545, 571, 601, 636, 678, 730, 796, 883, 1005, 1195, 1544, 4705, 0,
3983 		DEC_CURVE,CRV_PARKHOME  , 171, 172, 172, 173, 173, 174, 174, 175, 175, 176, 176, 177, 177, 178, 179, 179, 180, 180, 181, 182, 182, 183, 183, 184, 185, 185, 186, 187, 187, 188, 189, 189, 190, 191, 192, 192, 193, 194, 195, 195, 196, 197, 198, 199, 199, 200, 201, 202, 203, 204, 205, 206, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 217, 218, 219, 220, 221, 222, 223, 225, 226, 227, 228, 230, 231, 232, 234, 235, 237, 238, 240, 241, 243, 244, 246, 247, 249, 251, 253, 254, 256, 258, 260, 262, 264, 266, 268, 271, 273, 275, 278, 280, 282, 285, 288, 290, 293, 296, 299, 302, 305, 309, 312, 316, 319, 323, 327, 331, 336, 340, 345, 350, 355, 360, 365, 371, 377, 384, 391, 398, 406, 414, 422, 432, 441, 452, 463, 476, 489, 504, 520, 538, 558, 580, 605, 633, 667, 706, 752, 810, 883, 979, 1116, 1326, 1714, 4705, 0,
3984 		DEC_CURVE,CRV_SMEARING  , 675, 685, 699, 714, 730, 746, 764, 784, 805, 828, 853, 880, 911, 944, 982, 1025, 1073, 1130, 1196, 1276, 1374, 1498, 1498, 2497, 2724, 3056, 4705, 0,
3985 		DEC_CURVE,CRV_BUFFERFULL, 171, 172, 172, 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 180, 181, 181, 182, 183, 184, 184, 185, 186, 187, 188, 189, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 207, 208, 209, 210, 211, 213, 214, 215, 217, 218, 219, 221, 222, 224, 225, 227, 228, 230, 232, 233, 235, 237, 239, 241, 243, 245, 247, 249, 251, 253, 255, 258, 260, 262, 265, 268, 270, 273, 276, 279, 282, 285, 289, 292, 296, 299, 303, 307, 311, 316, 320, 325, 330, 335, 341, 347, 353, 359, 366, 373, 381, 390, 398, 408, 418, 429, 441, 455, 469, 485, 503, 523, 545, 571, 601, 636, 678, 730, 796, 883, 1005, 1195, 1544, 4705, 0,
3986 		-2,
3987 
3988 		/* motorcurve 5   */
3989 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
3990 		ACC_CURVE,CRV_NORMALSCAN, 3763, 3763, 3763, 3763, 3763, 3763, 2444, 2178, 1997, 1198, 1198, 1098, 1020, 956, 903, 858, 819, 785, 754, 727, 703, 681, 662, 644, 626, 610, 596, 582, 571, 558, 547, 537, 527, 518, 509, 500, 492, 485, 478, 471, 464, 458, 452, 446, 440, 435, 430, 425, 420, 415, 410, 407, 402, 398, 394, 391, 386, 383, 380, 376, 373, 369, 366, 364, 360, 357, 355, 352, 349, 347, 344, 341, 338, 337, 334, 332, 329, 328, 325, 323, 321, 319, 317, 315, 313, 311, 310, 308, 306, 304, 302, 301, 299, 297, 295, 294, 293, 291, 290, 288, 286, 285, 284, 283, 281, 280, 278, 277, 275, 275, 274, 272, 271, 270, 268, 267, 266, 265, 264, 263, 262, 261, 259, 258, 257, 257, 256, 255, 254, 253, 251, 250, 249, 248, 248, 247, 246, 245, 244, 243, 243, 242, 241, 240, 239, 239, 238, 237, 236, 235, 235, 234, 233, 232, 231, 230, 230, 230, 229, 228, 228, 227, 226, 225, 225,224, 223, 222, 222, 221, 221, 221, 220, 219, 219, 218, 217, 217, 216, 215, 215, 214, 213, 213, 212, 212, 212, 211, 211, 210, 209, 209, 208, 208, 207, 207, 206, 206, 205, 204, 204, 203, 203, 203, 203, 202, 202, 201, 201, 200, 200, 199, 199, 198, 198, 197, 197, 196, 196, 195, 195, 194, 194, 194, 194, 194, 193, 193, 192, 192, 191, 191, 190, 190, 190, 189, 189, 188, 188, 188, 187, 187, 186, 186, 185, 185, 185, 185, 185, 185, 184, 184, 183, 183, 183, 182, 182, 182, 181, 181, 180, 180, 180, 179, 179, 179, 178, 178, 178, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 174, 174, 174, 173, 173, 173, 172, 172, 172, 171, 171, 171, 171, 170, 170, 170, 169, 169, 169, 169, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 165, 165, 165, 165, 164, 164, 164, 163, 163, 163, 163, 162, 162, 162, 162, 161, 161, 161, 161, 160, 160, 160, 160, 159, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 156, 156, 156, 156, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 153, 153, 153, 153, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 139, 139, 138, 138, 138, 138, 138, 138, 138, 137, 137, 137, 137, 137, 137, 137, 136, 136, 136, 136, 136, 136, 136, 135, 135, 135, 135, 135, 135, 135, 134, 134, 134, 134, 134, 134, 134, 134, 133, 133, 133, 133, 133, 133, 133, 133, 132, 132, 132, 132, 132, 132, 132, 132, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 130, 130, 130, 130, 130, 130, 130, 130, 129, 129, 129, 129, 129, 129, 129, 129, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 127, 127, 127, 127, 127, 127, 127, 127, 127, 126, 126, 126, 126, 126, 126, 126, 126, 126, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 124, 124, 124, 124, 124, 124, 124, 124, 124, 124, 123, 123, 123, 123, 123, 123, 123, 123, 123, 123, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 117, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 114, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 109, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 106, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 104, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 103, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 101, 101, 101, 101, 101, 101, 101, 101, 101,101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 101, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 0,
3991 		ACC_CURVE,CRV_PARKHOME  , 3763, 2330, 1803, 1515, 1330, 1198, 1099, 1021, 957, 904, 859, 819, 785, 755, 728, 704, 682, 662, 644, 626, 611, 597, 583, 571, 559, 548, 537, 527, 518, 509, 501, 493, 485, 478, 472, 464, 458, 453, 446, 441, 436, 430, 425, 420, 416, 411, 407, 402, 399, 394, 391, 387, 383, 380, 376, 374, 370, 366, 364, 361, 358, 355, 352, 349, 347, 344, 342, 339, 337, 335, 332, 330, 328, 326, 323, 321, 320, 318, 315, 313, 311, 310, 308, 306, 304, 302, 301, 300, 298, 296, 294, 293, 292, 290, 289, 287, 285, 284, 283, 282, 280, 279, 277, 276, 275, 274, 273, 271, 270, 269, 267, 266, 266, 265, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 239, 239, 238, 237, 236, 235, 234, 233, 233, 232, 231, 230, 230, 230, 229, 228, 227, 227, 226, 225, 224, 224, 223, 222, 221, 221, 221, 220, 220, 219, 218, 218, 217, 216, 216, 215, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 209, 209, 208, 208, 207, 207, 206, 205, 205, 204, 204, 203, 203, 203, 203, 202, 202, 201, 201, 200, 200, 199, 199, 198, 198, 197, 197, 196, 196, 195, 195, 194, 194, 194, 194, 194, 193, 193, 192, 192, 191, 191, 191, 190, 190, 189, 189, 188, 188, 188, 187, 187, 186, 186, 186, 185, 185, 185, 185, 185, 184, 184, 184, 183, 183, 182, 182, 182, 181, 181, 181, 180, 180, 180, 179, 179, 178, 178, 178, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 174, 174, 174, 174, 173, 173, 173, 172, 172, 172, 171, 171, 171, 170, 170, 170, 170, 169, 169, 169, 168, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 165, 165, 165, 165, 164, 164, 164, 163, 163, 163, 163, 162, 162, 162, 162, 161, 161, 161, 161, 160, 160, 160, 160, 160, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 156, 156, 156, 156, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 153, 153, 153, 153, 153, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 139, 139, 138, 0,
3992 		ACC_CURVE,CRV_SMEARING  , 3763, 2330, 1803, 1515, 1330, 1198, 1099, 1021, 957, 904, 859, 819, 785, 755, 728, 704, 682, 662, 644, 626, 611, 597, 583, 571, 559, 548, 537, 527, 518, 509, 501, 493, 485, 478, 472, 464, 458, 453, 446, 441, 436, 430, 425, 420, 416, 411, 407, 402, 399, 394, 391, 387, 383, 380, 376, 374, 370, 366, 364, 361, 358, 355, 352, 349, 347, 344, 342, 339, 337, 335, 332, 330, 328, 326, 323, 321, 320, 318, 315, 313, 311, 310, 308, 306, 304, 302, 301, 300, 298, 296, 294, 293, 292, 290, 289, 287, 285, 284, 283, 282, 280, 279, 277, 276, 275, 274, 273, 271, 270, 269, 267, 266, 266, 265, 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, 253, 252, 251, 250, 249, 248, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 239, 239, 238, 237, 236, 235, 234, 233, 233, 232, 231, 230, 230, 230, 229, 228, 227, 227, 226, 225, 224, 224, 223, 222, 221, 221, 221, 220, 220, 219, 218, 218, 217, 216, 216, 215, 214, 214, 213, 213, 212, 212, 212, 211, 211, 210, 209, 209, 208, 208, 207, 207, 206, 205, 205, 204, 204, 203, 203, 203, 203, 202, 202, 201, 201, 200, 200, 199, 199, 198, 198, 197, 197, 196, 196, 195, 195, 194, 194, 194, 194, 194, 193, 193, 192, 192, 191, 191, 191, 190, 190, 189, 189, 188, 188, 188, 187, 187, 186, 186, 186, 185, 185, 185, 185, 185, 184, 184, 184, 183, 183, 182, 182, 182, 181, 181, 181, 180, 180, 180, 179, 179, 178, 178, 178, 177, 177, 177, 176, 176, 176, 176, 176, 176, 175, 175, 175, 174, 174, 174, 174, 173, 173, 173, 172, 172, 172, 171, 171, 171, 170, 170, 170, 170, 169, 169, 169, 168, 168, 168, 168, 167, 167, 167, 167, 167, 167, 167, 166, 166, 166, 166, 165, 165, 165, 165, 164, 164, 164, 163, 163, 163, 163, 162, 162, 162, 162, 161, 161, 161, 161, 160, 160, 160, 160, 160, 159, 159, 159, 159, 158, 158, 158, 158, 158, 158, 158, 158, 157, 157, 157, 157, 157, 156, 156, 156, 156, 155, 155, 155, 155, 155, 154, 154, 154, 154, 154, 153, 153, 153, 153, 153, 152, 152, 152, 152, 152, 151, 151, 151, 151, 151, 150, 150, 150, 150, 150, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 148, 148, 148, 148, 148, 148, 147, 147, 147, 147, 147, 147, 146, 146, 146, 146, 146, 145, 145, 145, 145, 145, 145, 144, 144, 144, 144, 144, 144, 143, 143, 143, 143, 143, 143, 142, 142, 142, 142, 142, 142, 141, 141, 141, 141, 141, 141, 141, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 139, 139, 139, 139, 139, 139, 139, 138, 0,
3993 		DEC_CURVE,CRV_NORMALSCAN, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 87, 87, 87, 87, 87, 87, 87, 87, 88, 88, 88, 88, 88, 88, 88, 88, 89, 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, 90, 90, 91, 91, 91, 91, 91, 92, 92, 92, 92, 93, 93, 93, 93, 94, 94, 94, 95, 95, 95, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 104, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 113, 115, 117, 119, 121, 122, 124, 127, 130, 132, 135, 139, 142, 146, 149, 153, 158, 162, 167, 171, 176, 180, 186, 193, 202, 209, 216, 223, 232, 243, 254, 266, 279, 292, 306, 320, 335, 337, 351, 367, 380, 396, 414, 437, 464, 493, 520, 549, 583, 611, 644, 675, 711, 755, 785, 819, 859, 904, 957, 1021, 1099, 1198, 1330, 1515, 1803, 2330, 3763, 0,
3994 		DEC_CURVE,CRV_PARKHOME  , 138, 142, 146, 149, 153, 158, 162, 167, 171, 176, 180, 186, 193, 202, 209, 216, 223, 232, 243, 254, 266, 279, 292, 306, 320, 335, 337, 351, 367, 380, 396, 414, 437, 464, 493, 520, 549, 583, 611, 644, 675, 711, 755, 785, 819, 859, 904, 957, 1021, 1099, 1198, 1330, 1515, 1803, 2330, 3763, 0,
3995 		DEC_CURVE,CRV_SMEARING  , 138, 139, 139, 139, 139, 139, 139, 139, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 141, 141, 141, 141, 141, 141, 141, 142, 142, 142, 142, 142, 142, 143, 143, 143, 143, 143, 143, 144, 144, 144, 144, 144, 144, 145, 145, 145, 145, 145, 145, 146, 146, 146, 146, 146, 147, 147, 147, 147, 147, 147, 148, 148, 148, 148, 148, 148, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 150, 150, 150, 150, 150, 151, 151, 151, 151, 151, 152, 152, 152, 152, 152, 153, 153, 153, 153, 153, 154, 154, 154, 154, 154, 155, 155, 155, 155, 155, 156, 156, 156, 156, 157, 157, 157, 157, 157, 158, 158, 158, 158, 158, 158, 158, 158, 159, 159, 159, 159, 160, 160, 160, 160, 160, 161, 161, 161, 161, 162, 162, 162, 162, 163, 163, 163, 163, 164, 164, 164, 165, 165, 165, 165, 166, 166, 166, 166, 167, 167, 167, 167, 167, 167, 167, 168, 168, 168, 168, 169, 169, 169, 170, 170, 170, 170, 171, 171, 171, 172, 172, 172, 173, 173, 173, 174, 174, 174, 174, 175, 175, 175, 176, 176, 176, 176, 176, 176, 177, 177, 177, 178, 178, 178, 179, 179, 180, 180, 180, 181, 181, 181, 182, 182, 182, 183, 183, 184, 184, 184, 185, 185, 185, 185, 185, 186, 186, 186, 187, 187, 188, 188, 188, 189, 189, 190, 190, 191, 191, 191, 192, 192, 193, 193, 194, 194, 194, 194, 194, 195, 195, 196, 196, 197, 197, 198, 198, 199, 199, 200, 200, 201, 201, 202, 202, 203, 203, 203, 203, 204, 204, 205, 205, 206, 207, 207, 208, 208, 209, 209, 210, 211, 211, 212, 212, 212, 213, 213, 214, 214, 215, 216, 216, 217, 218, 218, 219, 220, 220, 221, 221, 221, 222, 223, 224, 224, 225, 226, 227, 227, 228, 229, 230, 230, 230, 231, 232, 233, 233, 234, 235, 236, 237, 238, 239, 239, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 265, 266, 266, 267, 269, 270, 271, 273, 274, 275, 276, 277, 279, 280, 282, 283, 284, 285, 287, 289, 290, 292, 293, 294, 296, 298, 300, 301, 302, 304, 306, 308, 310, 311, 313, 315, 318, 320, 321, 323, 326, 328, 330, 332, 335, 337, 339, 342, 344, 347, 349, 352, 355, 358, 361, 364, 366, 370, 374, 376, 380, 383, 387, 391, 394, 399, 402, 407, 411, 416, 420, 425, 430, 436, 441, 446, 453, 458, 464, 472, 478, 485, 493, 501, 509, 518, 527, 537, 548, 559, 571, 583, 597, 611, 626, 644, 662, 682, 704, 728, 755, 785, 819, 859, 904, 957, 1021, 1099, 1198, 1330, 1515, 1803, 2330, 3763, 0,
3996 		DEC_CURVE,CRV_BUFFERFULL, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, 94, 94, 94, 95, 95, 95, 95, 95, 96, 96, 97, 97, 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, 103, 104, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 113, 115, 117, 119, 121, 122, 124, 127, 130, 132, 135, 139, 142, 146, 149, 153, 158, 162, 167, 171, 176, 180, 186, 193, 202, 209, 216, 223, 232, 243, 254, 266, 279, 292, 306, 320, 335, 337, 351, 367, 380, 396, 414, 437, 464, 493, 520, 549, 583, 611, 644, 675, 711, 755, 785, 819, 859, 904, 957, 1021, 1099, 1198, 1330, 1515, 1803, 2330, 3763, 0,
3997 		-2,
3998 
3999 		/* motorcurve 6   */
4000 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4001 		ACC_CURVE,CRV_NORMALSCAN, 23999, 0,
4002 		ACC_CURVE,CRV_PARKHOME  , 5360, 3362, 2628, 2229, 1973, 1791, 1654, 1547, 1458, 1384, 1319, 1264, 1214, 1170, 1131, 1096, 1063, 1034, 1006, 981, 958, 937, 916, 897, 880, 863, 847, 832, 818, 805, 792, 780, 769, 758, 747, 737, 727, 718, 709, 700, 692, 0,
4003 		ACC_CURVE,CRV_SMEARING  , 23999, 0,
4004 		DEC_CURVE,CRV_NORMALSCAN, 23999, 0,
4005 		DEC_CURVE,CRV_PARKHOME  , 692, 700, 709, 718, 727, 737, 747, 758, 769, 780, 792, 805, 818, 832, 847, 863, 880, 897, 916, 937, 958, 981, 1006, 1034, 1063, 1096, 1131, 1170, 1214, 1264, 1319, 1384, 1458, 1547, 1654, 1791, 1973, 2229, 2628, 3362, 5360, 0,
4006 		DEC_CURVE,CRV_SMEARING  , 23999, 0,
4007 		DEC_CURVE,CRV_BUFFERFULL, 23999, 0,
4008 		-2,
4009 
4010 		/* motorcurve 7   */
4011 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4012 		ACC_CURVE,CRV_NORMALSCAN, 6667, 0,
4013 		ACC_CURVE,CRV_PARKHOME  , 5360, 3362, 2628, 2229, 1973, 1791, 1654, 1547, 1458, 1384, 1319, 1264, 1214, 1170, 1131, 1096, 1063, 1034, 1006, 981, 958, 937, 916, 897, 880, 863, 847, 832, 818, 805, 792, 780, 769, 758, 747, 737, 727, 718, 709, 700, 692, 0,
4014 		ACC_CURVE,CRV_SMEARING  , 6667, 0,
4015 		DEC_CURVE,CRV_NORMALSCAN, 6667, 0,
4016 		DEC_CURVE,CRV_PARKHOME  , 692, 700, 709, 718, 727, 737, 747, 758, 769, 780, 792, 805, 818, 832, 847, 863, 880, 897, 916, 937, 958, 981, 1006, 1034, 1063, 1096, 1131, 1170, 1214, 1264, 1319, 1384, 1458, 1547, 1654, 1791, 1973, 2229, 2628, 3362, 5360, 0,
4017 		DEC_CURVE,CRV_SMEARING  , 6667, 0,
4018 		DEC_CURVE,CRV_BUFFERFULL, 6667, 0,
4019 		-2,
4020 
4021 		/* motorcurve 8   */
4022 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4023 		ACC_CURVE,CRV_NORMALSCAN, 1046, 1046, 1046, 1046, 1046, 1046, 647, 501, 421, 370, 333, 305, 284, 266, 251, 239, 228, 218, 210, 202, 196, 190, 184, 179, 174, 170, 166, 162, 159, 155, 152, 149, 147, 144, 142, 139, 137, 135, 133, 131, 129, 127, 126, 124, 123, 121, 120, 118, 117, 116, 114, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, 102, 101, 100, 100, 99, 98, 97, 96, 96, 95, 94, 94, 93, 92, 92, 91, 91, 90, 89, 89, 88, 88, 87, 87, 86, 86, 85, 85, 84, 84, 83, 83, 82, 82, 82, 81, 81, 80, 80, 79, 79, 79, 78, 78, 78, 77, 77, 76, 76, 76, 75, 75, 75, 74, 74, 74, 74, 73, 73, 73, 72, 72, 72, 71, 71, 71, 71, 70, 70, 70, 70, 69, 69, 69, 69, 68, 68, 68, 68, 67, 67, 67, 67, 66, 66, 66, 66, 65, 65, 65, 65, 64, 64, 64, 64, 63, 63, 63, 63, 62, 62, 62, 62, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 53, 53, 53, 53, 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 23, 23, 0,
4024 		ACC_CURVE,CRV_PARKHOME  , 1045, 678, 604, 554, 332, 332, 304, 283, 265, 250, 238, 227, 217, 209, 201, 195, 189, 183, 178,173, 169, 165, 161, 158, 154, 151, 148, 146, 143, 141, 138, 136, 134, 132, 130, 128, 126, 125, 123, 122, 120, 119, 117, 116, 115, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103,102, 101, 100, 99, 99, 98, 97, 96, 95, 95, 94, 93, 93, 92, 91, 91, 90, 90, 89, 88, 88, 87, 87, 86, 86, 85, 85, 84, 84, 83, 83, 82, 82, 81, 81, 81, 80, 80, 79, 79, 78, 78, 78, 77, 77, 77, 76, 76, 75, 75, 75, 74, 74, 74, 73, 73, 73, 73, 72, 72, 72, 71, 71, 71, 70, 70, 70, 70, 69, 69, 69, 69, 68, 68, 68, 68, 67, 67, 67, 67, 66, 66, 66, 66, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 53, 53, 53, 53, 53, 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 39, 0,
4025 		ACC_CURVE,CRV_SMEARING  , 1045, 678, 604, 554, 332, 332, 304, 283, 265, 250, 238, 227, 217, 209, 201, 195, 189, 183, 178,173, 169, 165, 161, 158, 154, 151, 148, 146, 143, 141, 138, 136, 134, 132, 130, 128, 126, 125, 123, 122, 120, 119, 117, 116, 115, 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, 103,102, 101, 100, 99, 99, 98, 97, 96, 95, 95, 94, 93, 93, 92, 91, 91, 90, 90, 89, 88, 88, 87, 87, 86, 86, 85, 85, 84, 84, 83, 83, 82, 82, 81, 81, 81, 80, 80, 79, 79, 78, 78, 78, 77, 77, 77, 76, 76, 75, 75, 75, 74, 74, 74, 73, 73, 73, 73, 72, 72, 72, 71, 71, 71, 70, 70, 70, 70, 69, 69, 69, 69, 68, 68, 68, 68, 67, 67, 67, 67, 66, 66, 66, 66, 65, 65, 65, 65, 65, 64, 64, 64, 64, 64, 63, 63, 63, 63, 63, 62, 62, 62, 62, 62, 61, 61, 61, 61, 61, 61, 60, 60, 60, 60, 60, 60, 59, 59, 59, 59, 59, 59, 58, 58, 58, 58, 58, 58, 58, 57, 57, 57, 57, 57, 57, 57, 56, 56, 56, 56, 56, 56, 56, 55, 55, 55, 55, 55, 55, 55, 55, 54, 54, 54, 54, 54, 54, 54, 54, 53, 53, 53, 53, 53, 53, 53, 53, 53, 52, 52, 52, 52, 52, 52, 52, 52, 52, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 39, 0,
4026 		DEC_CURVE,CRV_NORMALSCAN, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 34, 34, 35, 35, 36, 37, 38, 38, 39, 40, 41, 42, 43, 45, 46, 47, 48, 50, 51, 53, 54, 57, 59, 61, 63, 65, 68, 71, 75, 78, 82, 86, 90, 94, 94, 98, 103, 106, 111, 116, 122, 130, 138, 145, 153, 163, 171, 180, 188, 198, 211, 219, 228, 239, 252, 267, 284, 306, 334, 370, 422, 502, 648, 1045, 0,
4027 		DEC_CURVE,CRV_PARKHOME  , 39, 40, 41, 42, 43, 45, 46, 47, 48, 50, 51, 53, 54, 57, 59, 61, 63, 65, 68, 71, 75, 78, 82, 86, 90, 94, 94, 98, 103, 106, 111, 116, 122, 130, 138, 145, 153, 163, 171, 180, 188, 198, 211, 219, 228, 239, 252, 267, 284, 306, 334, 370, 422, 502, 648, 1045, 0,
4028 		DEC_CURVE,CRV_SMEARING  , 39, 39, 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 56, 56, 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 57, 57, 57, 58, 58, 58, 58, 58, 58, 58, 59, 59, 59, 59, 59, 59, 59, 60, 60, 60, 60, 60, 60, 60, 61, 61, 61, 61, 61, 61, 62, 62, 62, 62, 62, 62, 63, 63, 63, 63, 63, 64, 64, 64, 64, 64, 65, 65, 65, 65, 65, 66, 66, 66, 66, 66, 67, 67, 67, 67, 67, 68, 68, 68, 68, 69, 69, 69, 69, 70, 70, 70, 70, 71, 71, 71, 71, 72, 72, 72, 73, 73, 73, 73, 74, 74, 74, 75, 75, 75, 76, 76, 76, 77, 77, 77, 78, 78, 78, 79, 79, 79, 80, 80, 81, 81, 81, 82, 82, 83, 83, 84, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 90, 90, 91, 91, 92, 93, 93, 94, 94, 95, 96, 96, 97, 98, 99, 99, 100, 101, 102, 103, 104, 105, 105, 106, 107, 108, 109, 110, 112, 113, 114, 115, 116, 118, 119, 120, 122, 123, 125, 127, 128, 130, 132, 134, 136, 138, 140, 142, 145, 147, 150, 153, 156, 159, 163, 167, 171, 175, 180, 185, 190, 196, 203, 211, 219, 228, 239, 252, 267, 284, 306, 334, 370, 422, 502, 648, 1045, 0,
4029 		DEC_CURVE,CRV_BUFFERFULL, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 30, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 34, 34, 35, 35, 36, 37, 38, 38, 39, 40, 41, 42, 43, 45, 46, 47, 48, 50, 51, 53, 54, 57, 59, 61, 63, 65, 68, 71, 75, 78, 82, 86, 90, 94, 94, 98, 103, 106, 111, 116, 122, 130, 138, 145, 153, 163, 171, 180, 188, 198, 211, 219, 228, 239, 252, 267, 284, 306, 334, 370, 422, 502, 648, 1045, 0,
4030 		-1
4031 	};
4032 
4033 	rst = (SANE_Int *)malloc(sizeof(steps));
4034 	if (rst != NULL)
4035 		memcpy(rst, &steps, sizeof(steps));
4036 
4037 	return rst;
4038 }
4039 
hp3800_motornull4040 static SANE_Int *hp3800_motor()
4041 {
4042 	SANE_Int *rst = NULL;
4043 	SANE_Int steps[]  =
4044 	{
4045 		/* motorcurve 1   */
4046 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4047 		ACC_CURVE,CRV_NORMALSCAN,2000,1984,1968,1953,1937,1921,1906,1890,1874,1859,1843,1827,1812,1796,1781,1765,1749,1734,1715,1700,1684,1669,1653,1637,1622,1606,1590,1572,1556,1541,1525,1510,1494,1478,1463,1447,1431,1416,1400,1384,1366,1351,1335,1319,1304,1288,1272,1257,1241,1225,1210,1194,1179,1160,1145,1129,1113,1098,1082,1066,1051,1035,1017,1001,986,970,954,939,923,907,892,876,861,845,829,814,798,782,767,749, 0,
4048 		ACC_CURVE,CRV_PARKHOME  ,4705,2913,2253,1894,1662,1498,1374,1276,1196,1129,1073,1024,981,944,910,880,852,827,804,783,764,746,729,713,699,685,672,659,648,637,626,616,607,598,589,581,573,565,558,551,544,538,532,526,520,514,509,503,500, 0,
4049 		ACC_CURVE,CRV_SMEARING  ,200,12,14,16, 0,
4050 		DEC_CURVE,CRV_NORMALSCAN,749,1166,1583,2000, 0,
4051 		DEC_CURVE,CRV_PARKHOME  ,500,503,509,514,520,526,532,538,544,551,558,565,573,581,589,598,607,616,626,637,648,659,672,685,699,713,729,746,764,783,804,827,852,880,910,944,981,1024,1073,1129,1196,1276,1374,1498,1662,1894,2253,2913,4705, 0,
4052 		DEC_CURVE,CRV_SMEARING  ,300,234,167,100, 0,
4053 		DEC_CURVE,CRV_BUFFERFULL,1100,867,633,400, 0,
4054 		-2,
4055 
4056 		/* motorcurve 2   */
4057 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4058 		ACC_CURVE,CRV_NORMALSCAN,4705,2664,2061,1732,1521,1370,1257,1167,1094,1033,982,937,898,864,833,805,780,757,736,717,699,683,667,653,640,627,615,604,593,583,574,564,556,547,540,532,525,518,511,505,499,493,487,481,476,471,466,461,456,452,447,443,439,435,431,427,424,420,417,413,410,407,403,400,397,394,391,389,386,383,381,378,375,373,371,368,366,364,361,359,357,355,353,351,349,347,345,343,341,339,338,336,334,332,331,329,327,326,324,323,321,320,318,317,315,314,312,311,310,308,307,306,304,303,302,301,299,298,297,296,295,293,292,291,290,289,288,287,286,285,284,283,282,281,280,279,278,277,276,275,274,273,272,271,270,270,269,268,267,266,265,264,264,263,262,261,260,260,259,258,257,257,256,255,255,254,253,252,252,251,250,250,249,248,248,247,246,246,245,244,244,243,242,242,241,241,240,239,239,238,238,237,237,236,235,235,234,234,233,233,232,232,231,231,230,230,229,229,228,227,227,227,226,226,225,225,224,224,223,223,222,222,221,221,220,220,219,219,219,218,218,217,217,216,216,216,215,215,214,214,214,213,213,212,212,212,211,211,210,210,210,209,209,208,208,208,207,207,207,206,206,206,205,205,204,204,204,203,203,203,202,202,202,201,201,201,200,200,200,199,199,199,198,198,198,197,197,197,197,196,196,196,195,195,195,194,194,194,194,193,193,193,192,192,192,192,191,191,191,190,190,190,190,189,189,189,188,188,188,188,187,187,187,187,186,186,186,186,185,185,185,185,184,184,184,184,183,183,183,183,182,182,182,182,181,181,181,181,181,180,180,180,180,179,179,179,179,178,178,178,178,178,177,177,177,177,177,176,176,176,176,175,175,175,175,175,174,174,174,174,174,173,173,173,173,173,172,172,172,172,172,171,171,171, 0,
4059 		ACC_CURVE,CRV_PARKHOME  ,4705,2913,2253,1894,1662,1498,1374,1276,1196,1129,1073,1024,981,944,910,880,852,827,804,783,764,746,729,713,699,685,672,659,648,637,626,616,607,598,589,581,573,565,558,551,544,538,532,526,520,514,509,503,500, 0,
4060 		ACC_CURVE,CRV_SMEARING  ,200,12,14,16, 0,
4061 		DEC_CURVE,CRV_NORMALSCAN,171,172,172,173,174,174,175,176,176,177,178,178,179,180,181,181,182,183,184,184,185,186,187,188,189,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,207,208,209,210,211,213,214,215,217,218,219,221,222,224,225,227,228,230,232,233,235,237,239,241,243,245,247,249,251,253,255,258,260,262,265,268,270,273,276,279,282,285,289,292,296,299,303,307,311,316,320,325,330,335,341,347,353,359,366,373,381,390,398,408,418,429,441,455,469,485,503,523,545,571,601,636,678,730,796,883,1005,1195,1544,4705, 0,
4062 		DEC_CURVE,CRV_PARKHOME  ,500,503,509,514,520,526,532,538,544,551,558,565,573,581,589,598,607,616,626,637,648,659,672,685,699,713,729,746,764,783,804,827,852,880,910,944,981,1024,1073,1129,1196,1276,1374,1498,1662,1894,2253,2913,4705, 0,
4063 		DEC_CURVE,CRV_SMEARING  ,300,234,167,100, 0,
4064 		DEC_CURVE,CRV_BUFFERFULL,1100,867,633,400, 0,
4065 		-2,
4066 
4067 		/* motorcurve 3   */
4068 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4069 		ACC_CURVE,CRV_NORMALSCAN,5360,3655,2855,2422,2142,1944,1795,1678,1582,1503,1434,1374, 0,
4070 		ACC_CURVE,CRV_PARKHOME  ,5360,3362,2628,2229,1973,1791,1654,1547,1458,1384,1319,1264,1214,1170,1131,1096,1063,1034,1006,981,958,937,916,897,880,863,847,832,818,805,792,780,769,758,747,737,727,718,709,700,692,684,677,669,662,655,648,642,636,629,624,618,612,607,602,596,591,587,582,577,573,568,564,560,556,552,548,544,540,537,533,530,526,523,520,516,513,510,507,504,501,498,496,493,490,488,485,482,480,477,475,472,470,468,466,463,461,459,457,455,453,450,448,446,444,443,441,439,437,435,433,431,430,428,426,425,423,421,420,418,416,415,413,412,410,409,407,406,405,403,402,400,399,398,396,395,394,392,391,390,389,387,386,385,384,382,381,380,379,378,377,376,374,373,372,371,370,369,368,367,366,365,364,363,362,361,360,359,358,357,356,355,354,353,353,352,351,350,349,348, 0,
4071 		ACC_CURVE,CRV_SMEARING  ,5360,3362,2628,2229,1973,1791,1654,1547, 0,
4072 		DEC_CURVE,CRV_NORMALSCAN,1374,1434,1503,1582,1678,1795,1944,2142,2422,2855,3655,5360, 0,
4073 		DEC_CURVE,CRV_PARKHOME  ,348,351,353,356,359,362,365,368,371,374,378,381,385,389,392,396,400,405,409,413,418,423,428,433,439,444,450,457,463,470,477,485,493,501,510,520,530,540,552,564,577,591,607,624,642,662,684,709,737,769,805,847,897,958,1034,1131,1264,1458,1791,2628,5360, 0,
4074 		DEC_CURVE,CRV_SMEARING  ,1547,1654,1791,1973,2229,2628,3362,5360, 0,
4075 		DEC_CURVE,CRV_BUFFERFULL,1374,1434,1503,1582,1678,1795,1944,2142,2422,2855,3655,5360, 0,
4076 		-2,
4077 
4078 		/* motorcurve 4   */
4079 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4080 		ACC_CURVE,CRV_NORMALSCAN,4705,2664,2061,1732,1521,1370,1257,1167,1094,1033,982,937,898,864,833,805,780,757,736,717,699,683,667,653,640,627,615,604,593,583,574,564,556,547,540,532,525,518,511,505,499,493,487,481,476,471,466,461,456,452,447,443,439,435,431,427,424,420,417,413,410,407,403,400,397,394,391,389,386,383,381,378,375,373,371,368,366,364,361,359,357,355,353,351,349,347,345,343,341,339,338,336,334,332,331,329,327,326,324,323,321,320,318,317,315,314,312,311,310,308,307,306,304,303,302,301,299,298,297,296,295,293,292,291,290,289,288,287,286,285,284,283,282,281,280,279,278,277,276,275,274,273,272,271,270,270,269,268,267,266,265,264,264,263,262,261,260,260,259,258,257,257,256,255,255,254,253,252,252,251,250,250,249,248,248,247,246,246,245,244,244,243,242,242,241,241,240,239,239,238,238,237,237,236,235,235,234,234,233,233,232,232,231,231,230,230,229,229,228,227,227,227,226,226,225,225,224,224,223,223,222,222,221,221,220,220,219,219,219,218,218,217,217,216,216,216,215,215,214,214,214,213,213,212,212,212,211,211,210,210,210,209,209,208,208,208,207,207,207,206,206,206,205,205,204,204,204,203,203,203,202,202,202,201,201,201,200,200,200,199,199,199,198,198,198,197,197,197,197,196,196,196,195,195,195,194,194,194,194,193,193,193,192,192,192,192,191,191,191,190,190,190,190,189,189,189,188,188,188,188,187,187,187,187,186,186,186,186,185,185,185,185,184,184,184,184,183,183,183,183,182,182,182,182,181,181,181,181,181,180,180,180,180,179,179,179,179,178,178,178,178,178,177,177,177,177,177,176,176,176,176,175,175,175,175,175,174,174,174,174,174,173,173,173,173,173,172,172,172,172,172,171,171,171, 0,
4081 		ACC_CURVE,CRV_PARKHOME  ,4705,2888,2234,1878,1648,1485,1362,1265,1186,1120,1064,1016,973,936,903,873,845,821,798,777,758,740,723,708,693,679,666,654,643,632,621,612,602,593,585,576,569,561,554,547,540,534,528,522,516,510,505,499,494,490,485,480,476,471,467,463,459,455,451,448,444,440,437,434,430,427,424,421,418,415,412,409,407,404,401,399,396,394,391,389,387,384,382,380,378,376,374,371,369,367,366,364,362,360,358,356,354,353,351,349,348,346,344,343,341,340,338,337,335,334,332,331,329,328,327,325,324,323,321,320,319,318,316,315,314,313,312,311,309,308,307,306,305,304,303,302,301,300,299,298,297,296,295,294,293,292,291,290,289,288,287,286,285,285,284,283,282,281,280,279,279,278,277,276,275,275,274,273,272,272,271,270,269,269,268,267,267,266,265,264,264,263,262,262,261,260,260,259,259,258,257,257,256,255,255,254,254,253,252,252,251,251,250,249,249,248,248,247,247,246,246,245,245,244,243,243,242,242,241,241,240,240,239,239,238,238,237,237,237,236,236,235,235,234,234,233,233,232,232,231,231,231,230,230,229,229,228,228,228,227,227,226,226,225,225,225,224,224,223,223,223,222,222,222,221,221,220,220,220,219,219,219,218,218,217,217,217,216,216,216,215,215,215,214,214,214,213,213,213,212,212,212,211,211,211,210,210,210,209,209,209,208,208,208,207,207,207,207,206,206,206,205,205,205,204,204,204,204,203,203,203,202,202,202,202,201,201,201,200,200,200,200,199,199,199,199,198,198,198,198,197,197,197,196,196,196,196,195,195,195,195,194,194,194,194,193,193,193,193,192,192,192,192,192,191,191,191,191,190,190,190,190,189,189,189,189,189,188,188,188,188,187,187,187,187,187,186,186,186,186,186,185,185,185,185,184,184,184,184,184,183,183,183,183,183,182,182,182,182,182,181,181,181,181,181,180,180,180,180,180,180,179,179,179,179,179,178,178,178,178,178,177,177,177,177,177,177,176,176,176,176,176,176,175,175,175,175,175,174,174,174,174,174,174,173,173,173,173,173,173,172,172,172,172,172,172,171,171,171,171, 0,
4082 		ACC_CURVE,CRV_SMEARING  ,4705,3056,2724,2497,1498,1498,1374,1276,1196,1130,1073,1025,982,944,911,880,853,828,805,784,764,746,730,714,699,685,675, 0,
4083 		DEC_CURVE,CRV_NORMALSCAN,171,172,172,173,174,174,175,176,176,177,178,178,179,180,181,181,182,183,184,184,185,186,187,188,189,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,207,208,209,210,211,213,214,215,217,218,219,221,222,224,225,227,228,230,232,233,235,237,239,241,243,245,247,249,251,253,255,258,260,262,265,268,270,273,276,279,282,285,289,292,296,299,303,307,311,316,320,325,330,335,341,347,353,359,366,373,381,390,398,408,418,429,441,455,469,485,503,523,545,571,601,636,678,730,796,883,1005,1195,1544,4705, 0,
4084 		DEC_CURVE,CRV_PARKHOME  ,171,172,172,173,173,174,174,175,175,176,176,177,177,178,179,179,180,180,181,182,182,183,183,184,185,185,186,187,187,188,189,189,190,191,192,192,193,194,195,195,196,197,198,199,199,200,201,202,203,204,205,206,206,207,208,209,210,211,212,213,214,215,217,218,219,220,221,222,223,225,226,227,228,230,231,232,234,235,237,238,240,241,243,244,246,247,249,251,253,254,256,258,260,262,264,266,268,271,273,275,278,280,282,285,288,290,293,296,299,302,305,309,312,316,319,323,327,331,336,340,345,350,355,360,365,371,377,384,391,398,406,414,422,432,441,452,463,476,489,504,520,538,558,580,605,633,667,706,752,810,883,979,1116,1326,1714,4705, 0,
4085 		DEC_CURVE,CRV_SMEARING  ,675,685,699,714,730,746,764,784,805,828,853,880,911,944,982,1025,1073,1130,1196,1276,1374,1498,1498,2497,2724,3056,4705, 0,
4086 		DEC_CURVE,CRV_BUFFERFULL,171,172,172,173,174,174,175,176,176,177,178,178,179,180,181,181,182,183,184,184,185,186,187,188,189,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,207,208,209,210,211,213,214,215,217,218,219,221,222,224,225,227,228,230,232,233,235,237,239,241,243,245,247,249,251,253,255,258,260,262,265,268,270,273,276,279,282,285,289,292,296,299,303,307,311,316,320,325,330,335,341,347,353,359,366,373,381,390,398,408,418,429,441,455,469,485,503,523,545,571,601,636,678,730,796,883,1005,1195,1544,4705, 0,
4087 		-2,
4088 
4089 		/* motorcurve 5   */
4090 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4091 		ACC_CURVE,CRV_NORMALSCAN,3763,3763,3763,3763,3763,3763,2444,2178,1997,1198,1198,1098,1020,956,903,858,819,785,754,727,703,681,662,644,626,610,596,582,571,558,547,537,527,518,509,500,492,485,478,471,464,458,452,446,440,435,430,425,420,415,410,407,402,398,394,391,386,383,380,376,373,369,366,364,360,357,355,352,349,347,344,341,338,337,334,332,329,328,325,323,321,319,317,315,313,311,310,308,306,304,302,301,299,297,295,294,293,291,290,288,286,285,284,283,281,280,278,277,275,275,274,272,271,270,268,267,266,265,264,263,262,261,259,258,257,257,256,255,254,253,251,250,249,248,248,247,246,245,244,243,243,242,241,240,239,239,238,237,236,235,235,234,233,232,231,230,230,230,229,228,228,227,226,225,225,224,223,222,222,221,221,221,220,219,219,218,217,217,216,215,215,214,213,213,212,212,212,211,211,210,209,209,208,208,207,207,206,206,205,204,204,203,203,203,203,202,202,201,201,200,200,199,199,198,198,197,197,196,196,195,195,194,194,194,194,194,193,193,192,192,191,191,190,190,190,189,189,188,188,188,187,187,186,186,185,185,185,185,185,185,184,184,183,183,183,182,182,182,181,181,180,180,180,179,179,179,178,178,178,177,177,177,176,176,176,176,176,176,175,175,175,174,174,174,173,173,173,172,172,172,171,171,171,171,170,170,170,169,169,169,169,168,168,168,167,167,167,167,167,167,167,166,166,166,166,165,165,165,165,164,164,164,163,163,163,163,162,162,162,162,161,161,161,161,160,160,160,160,159,159,159,159,159,158,158,158,158,158,158,158,158,157,157,157,157,157,156,156,156,156,155,155,155,155,155,154,154,154,154,154,153,153,153,153,152,152,152,152,152,151,151,151,151,151,150,150,150,150,150,149,149,149,149,149,149,149,149,149,149,149,148,148,148,148,148,147,147,147,147,147,147,146,146,146,146,146,145,145,145,145,145,145,144,144,144,144,144,144,143,143,143,143,143,143,142,142,142,142,142,142,141,141,141,141,141,141,140,140,140,140,140,140,140,140,140,140,140,140,140,139,139,139,139,139,139,139,138,138,138,138,138,138,138,137,137,137,137,137,137,137,136,136,136,136,136,136,136,135,135,135,135,135,135,135,134,134,134,134,134,134,134,134,133,133,133,133,133,133,133,133,132,132,132,132,132,132,132,132,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,130,130,130,130,130,130,130,130,129,129,129,129,129,129,129,129,129,128,128,128,128,128,128,128,128,128,127,127,127,127,127,127,127,127,127,126,126,126,126,126,126,126,126,126,125,125,125,125,125,125,125,125,125,125,124,124,124,124,124,124,124,124,124,124,123,123,123,123,123,123,123,123,123,123,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,121,121,121,121,121,121,121,121,121,121,121,120,120,120,120,120,120,120,120,120,120,120,119,119,119,119,119,119,119,119,119,119,119,119,118,118,118,118,118,118,118,118,118,118,118,118,117,117,117,117,117,117,117,117,117,117,117,117,116,116,116,116,116,116,116,116,116,116,116,116,115,115,115,115,115,115,115,115,115,115,115,115,115,114,114,114,114,114,114,114,114,114,114,114,114,114,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,113,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,111,111,111,111,111,111,111,111,111,111,111,111,111,111,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,110,109,109,109,109,109,109,109,109,109,109,109,109,109,109,109,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,108,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,105,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,104,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,103,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,102,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,101,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,96,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,95,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,94,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93, 0,
4092 		ACC_CURVE,CRV_PARKHOME  ,3763,2330,1803,1515,1330,1198,1099,1021,957,904,859,819,785,755,728,704,682,662,644,626,611,597,583,571,559,548,537,527,518,509,501,493,485,478,472,464,458,453,446,441,436,430,425,420,416,411,407,402,399,394,391,387,383,380,376,374,370,366,364,361,358,355,352,349,347,344,342,339,337,335,332,330,328,326,323,321,320,318,315,313,311,310,308,306,304,302,301,300,298,296,294,293,292,290,289,287,285,284,283,282,280,279,277,276,275,274,273,271,270,269,267,266,266,265,263,262,261,260,259,258,257,256,255,254,253,252,251,250,249,248,248,247,246,245,244,243,242,241,240,239,239,239,238,237,236,235,234,233,233,232,231,230,230,230,229,228,227,227,226,225,224,224,223,222,221,221,221,220,220,219,218,218,217,216,216,215,214,214,213,213,212,212,212,211,211,210,209,209,208,208,207,207,206,205,205,204,204,203,203,203,203,202,202,201,201,200,200,199,199,198,198,197,197,196,196,195,195,194,194,194,194,194,193,193,192,192,191,191,191,190,190,189,189,188,188,188,187,187,186,186,186,185,185,185,185,185,184,184,184,183,183,182,182,182,181,181,181,180,180,180,179,179,178,178,178,177,177,177,176,176,176,176,176,176,175,175,175,174,174,174,174,173,173,173,172,172,172,171,171,171,170,170,170,170,169,169,169,168,168,168,168,167,167,167,167,167,167,167,166,166,166,166,165,165,165,165,164,164,164,163,163,163,163,162,162,162,162,161,161,161,161,160,160,160,160,160,159,159,159,159,158,158,158,158,158,158,158,158,157,157,157,157,157,156,156,156,156,155,155,155,155,155,154,154,154,154,154,153,153,153,153,153,152,152,152,152,152,151,151,151,151,151,150,150,150,150,150,149,149,149,149,149,149,149,149,149,149,148,148,148,148,148,148,147,147,147,147,147,147,146,146,146,146,146,145,145,145,145,145,145,144,144,144,144,144,144,143,143,143,143,143,143,142,142,142,142,142,142,141,141,141,141,141,141,141,140,140,140,140,140,140,140,140,140,140,140,140,140,139,139,139,139,139,139,139,138, 0,
4093 		ACC_CURVE,CRV_SMEARING  ,3763,2330,1803,1515,1330,1198,1099,1021,957,904,859,819,785,755,728,704,682,662,644,626,611,597,583,571,559,548,540, 0,
4094 		DEC_CURVE,CRV_NORMALSCAN,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,87,87,87,87,87,87,87,87,88,88,88,88,88,88,88,88,89,89,89,89,89,89,89,90,90,90,90,90,90,91,91,91,91,91,92,92,92,92,93,93,93,93,94,94,94,95,95,95,95,95,96,96,97,97,98,98,99,99,100,100,101,101,102,102,103,104,104,105,106,107,108,109,110,111,112,113,113,115,117,119,121,122,124,127,130,132,135,139,142,146,149,153,158,162,167,171,176,180,186,193,202,209,216,223,232,243,254,266,279,292,306,320,335,337,351,367,380,396,414,437,464,493,520,549,583,611,644,675,711,755,785,819,859,904,957,1021,1099,1198,1330,1515,1803,2330,3763, 0,
4095 		DEC_CURVE,CRV_PARKHOME  ,138,142,146,149,153,158,162,167,171,176,180,186,193,202,209,216,223,232,243,254,266,279,292,306,320,335,337,351,367,380,396,414,437,464,493,520,549,583,611,644,675,711,755,785,819,859,904,957,1021,1099,1198,1330,1515,1803,2330,3763, 0,
4096 		DEC_CURVE,CRV_SMEARING  ,138,139,139,139,139,139,139,139,140,140,140,140,140,140,140,140,140,140,140,140,140,141,141,141,141,141,141,141,142,142,142,142,142,142,143,143,143,143,143,143,144,144,144,144,144,144,145,145,145,145,145,145,146,146,146,146,146,147,147,147,147,147,147,148,148,148,148,148,148,149,149,149,149,149,149,149,149,149,149,150,150,150,150,150,151,151,151,151,151,152,152,152,152,152,153,153,153,153,153,154,154,154,154,154,155,155,155,155,155,156,156,156,156,157,157,157,157,157,158,158,158,158,158,158,158,158,159,159,159,159,160,160,160,160,160,161,161,161,161,162,162,162,162,163,163,163,163,164,164,164,165,165,165,165,166,166,166,166,167,167,167,167,167,167,167,168,168,168,168,169,169,169,170,170,170,170,171,171,171,172,172,172,173,173,173,174,174,174,174,175,175,175,176,176,176,176,176,176,177,177,177,178,178,178,179,179,180,180,180,181,181,181,182,182,182,183,183,184,184,184,185,185,185,185,185,186,186,186,187,187,188,188,188,189,189,190,190,191,191,191,192,192,193,193,194,194,194,194,194,195,195,196,196,197,197,198,198,199,199,200,200,201,201,202,202,203,203,203,203,204,204,205,205,206,207,207,208,208,209,209,210,211,211,212,212,212,213,213,214,214,215,216,216,217,218,218,219,220,220,221,221,221,222,223,224,224,225,226,227,227,228,229,230,230,230,231,232,233,233,234,235,236,237,238,239,239,239,240,241,242,243,244,245,246,247,248,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,265,266,266,267,269,270,271,273,274,275,276,277,279,280,282,283,284,285,287,289,290,292,293,294,296,298,300,301,302,304,306,308,310,311,313,315,318,320,321,323,326,328,330,332,335,337,339,342,344,347,349,352,355,358,361,364,366,370,374,376,380,383,387,391,394,399,402,407,411,416,420,425,430,436,441,446,453,458,464,472,478,485,493,501,509,518,527,537,548,559,571,583,597,611,626,644,662,682,704,728,755,785,819,859,904,957,1021,1099,1198,1330,1515,1803,2330,3763, 0,
4097 		DEC_CURVE,CRV_BUFFERFULL,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,93,94,94,94,95,95,95,95,95,96,96,97,97,98,98,99,99,100,100,101,101,102,102,103,104,104,105,106,107,108,109,110,111,112,113,113,115,117,119,121,122,124,127,130,132,135,139,142,146,149,153,158,162,167,171,176,180,186,193,202,209,216,223,232,243,254,266,279,292,306,320,335,337,351,367,380,396,414,437,464,493,520,549,583,611,644,675,711,755,785,819,859,904,957,1021,1099,1198,1330,1515,1803,2330,3763, 0,
4098 		-2,
4099 
4100 		/* motorcurve 6   */
4101 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4102 		ACC_CURVE,CRV_NORMALSCAN,23999, 0,
4103 		ACC_CURVE,CRV_PARKHOME  ,5360,3362,2628,2229,1973,1791,1654,1547,1458,1384,1319,1264,1214,1170,1131,1096,1063,1034,1006,981,958,937,916,897,880,863,847,832,818,805,792,780,769,758,747,737,727,718,709,700,692, 0,
4104 		ACC_CURVE,CRV_SMEARING  ,23999, 0,
4105 		DEC_CURVE,CRV_NORMALSCAN,23999, 0,
4106 		DEC_CURVE,CRV_PARKHOME  ,692,700,709,718,727,737,747,758,769,780,792,805,818,832,847,863,880,897,916,937,958,981,1006,1034,1063,1096,1131,1170,1214,1264,1319,1384,1458,1547,1654,1791,1973,2229,2628,3362,5360, 0,
4107 		DEC_CURVE,CRV_SMEARING  ,23999, 0,
4108 		DEC_CURVE,CRV_BUFFERFULL,23999, 0,
4109 		-2,
4110 
4111 		/* motorcurve 7   */
4112 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4113 		ACC_CURVE,CRV_NORMALSCAN,6667, 0,
4114 		ACC_CURVE,CRV_PARKHOME  ,5360,3362,2628,2229,1973,1791,1654,1547,1458,1384,1319,1264,1214,1170,1131,1096,1063,1034,1006,981,958,937,916,897,880,863,847,832,818,805,792,780,769,758,747,737,727,718,709,700,692, 0,
4115 		ACC_CURVE,CRV_SMEARING  ,6667, 0,
4116 		DEC_CURVE,CRV_NORMALSCAN,6667, 0,
4117 		DEC_CURVE,CRV_PARKHOME  ,692,700,709,718,727,737,747,758,769,780,792,805,818,832,847,863,880,897,916,937,958,981,1006,1034,1063,1096,1131,1170,1214,1264,1319,1384,1458,1547,1654,1791,1973,2229,2628,3362,5360, 0,
4118 		DEC_CURVE,CRV_SMEARING  ,6667, 0,
4119 		DEC_CURVE,CRV_BUFFERFULL,6667, 0,
4120 		-2,
4121 
4122 		/* motorcurve 8   */
4123 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4124 		ACC_CURVE,CRV_NORMALSCAN,1046,1046,1046,1046,1046,1046,647,501,421,370,333,305,284,266,251,239,228,218,210,202,196,190,184,179,174,170,166,162,159,155,152,149,147,144,142,139,137,135,133,131,129,127,126,124,123,121,120,118,117,116,114,113,112,111,110,109,108,107,106,105,104,103,102,101,100,100,99,98,97,96,96,95,94,94,93,92,92,91,91,90,89,89,88,88,87,87,86,86,85,85,84,84,83,83,82,82,82,81,81,80,80,79,79,79,78,78,78,77,77,76,76,76,75,75,75,74,74,74,74,73,73,73,72,72,72,71,71,71,71,70,70,70,70,69,69,69,69,68,68,68,68,67,67,67,67,66,66,66,66,65,65,65,65,64,64,64,64,63,63,63,63,62,62,62,62,61,61,61,61,61,60,60,60,60,60,60,59,59,59,59,59,59,59,58,58,58,58,58,58,57,57,57,57,57,57,57,56,56,56,56,56,56,56,56,55,55,55,55,55,55,55,55,54,54,54,54,54,54,54,54,53,53,53,53,53,53,53,53,52,52,52,52,52,52,52,52,51,51,51,51,51,51,51,51,51,51,51,51,50,50,50,50,50,50,50,50,50,50,50,49,49,49,49,49,49,49,49,49,49,49,49,48,48,48,48,48,48,48,48,48,48,48,48,47,47,47,47,47,47,47,47,47,47,47,47,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,23,23, 0,
4125 		ACC_CURVE,CRV_PARKHOME  ,1045,678,604,554,332,332,304,283,265,250,238,227,217,209,201,195,189,183,178,173,169,165,161,158,154,151,148,146,143,141,138,136,134,132,130,128,126,125,123,122,120,119,117,116,115,113,112,111,110,109,108,107,106,105,104,103,102,101,100,99,99,98,97,96,95,95,94,93,93,92,91,91,90,90,89,88,88,87,87,86,86,85,85,84,84,83,83,82,82,81,81,81,80,80,79,79,78,78,78,77,77,77,76,76,75,75,75,74,74,74,73,73,73,73,72,72,72,71,71,71,70,70,70,70,69,69,69,69,68,68,68,68,67,67,67,67,66,66,66,66,65,65,65,65,65,64,64,64,64,64,63,63,63,63,63,62,62,62,62,62,61,61,61,61,61,61,60,60,60,60,60,60,59,59,59,59,59,59,58,58,58,58,58,58,58,57,57,57,57,57,57,57,56,56,56,56,56,56,56,55,55,55,55,55,55,55,55,54,54,54,54,54,54,54,54,53,53,53,53,53,53,53,53,53,52,52,52,52,52,52,52,52,52,51,51,51,51,51,51,51,51,51,51,50,50,50,50,50,50,50,50,50,50,50,49,49,49,49,49,49,49,49,49,49,49,48,48,48,48,48,48,48,48,48,48,48,48,47,47,47,47,47,47,47,47,47,47,47,47,47,46,46,46,46,46,46,46,46,46,46,46,46,46,46,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,39, 0,
4126 		ACC_CURVE,CRV_SMEARING  ,1045,678,604,554,332,332,304,283,265,250,238,227,217,209,201,195,189,183,178,173,169,165,161,158,154,151,148,146,143,141,138,136,134,132,130,128,126,125,123,122,120,119,117,116,115,113,112,111,110,109,108,107,106,105,104,103,102,101,100,99,99,98,97,96,95,95,94,93,93,92,91,91,90,90,89,88,88,87,87,86,86,85,85,84,84,83,83,82,82,81,81,81,80,80,79,79,78,78,78,77,77,77,76,76,75,75,75,74,74,74,73,73,73,73,72,72,72,71,71,71,70,70,70,70,69,69,69,69,68,68,68,68,67,67,67,67,66,66,66,66,65,65,65,65,65,64,64,64,64,64,63,63,63,63,63,62,62,62,62,62,61,61,61,61,61,61,60,60,60,60,60,60,59,59,59,59,59,59,58,58,58,58,58,58,58,57,57,57,57,57,57,57,56,56,56,56,56,56,56,55,55,55,55,55,55,55,55,54,54,54,54,54,54,54,54,53,53,53,53,53,53,53,53,53,52,52,52,52,52,52,52,52,52,51,51,51,51,51,51,51,51,51,51,50,50,50,50,50,50,50,50,50,50,50,49,49,49,49,49,49,49,49,49,49,49,48,48,48,48,48,48,48,48,48,48,48,48,47,47,47,47,47,47,47,47,47,47,47,47,47,46,46,46,46,46,46,46,46,46,46,46,46,46,46,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,39, 0,
4127 		DEC_CURVE,CRV_NORMALSCAN,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,27,27,27,27,27,27,27,27,27,27,27,27,28,28,28,28,28,28,28,28,29,29,29,29,29,29,29,30,30,30,30,31,31,31,31,32,32,32,32,33,33,34,34,35,35,36,37,38,38,39,40,41,42,43,45,46,47,48,50,51,53,54,57,59,61,63,65,68,71,75,78,82,86,90,94,94,98,103,106,111,116,122,130,138,145,153,163,171,180,188,198,211,219,228,239,252,267,284,306,334,370,422,502,648,1045, 0,
4128 		DEC_CURVE,CRV_PARKHOME  ,39,40,41,42,43,45,46,47,48,50,51,53,54,57,59,61,63,65,68,71,75,78,82,86,90,94,94,98,103,106,111,116,122,130,138,145,153,163,171,180,188,198,211,219,228,239,252,267,284,306,334,370,422,502,648,1045, 0,
4129 		DEC_CURVE,CRV_SMEARING  ,39,39,39,39,39,39,39,39,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,46,46,46,46,46,46,46,46,46,46,46,46,46,46,46,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,48,48,48,48,48,48,48,48,48,48,48,48,48,48,49,49,49,49,49,49,49,49,49,49,49,49,49,50,50,50,50,50,50,50,50,50,50,50,50,51,51,51,51,51,51,51,51,51,51,51,52,52,52,52,52,52,52,52,52,52,53,53,53,53,53,53,53,53,53,53,54,54,54,54,54,54,54,54,54,55,55,55,55,55,55,55,55,55,56,56,56,56,56,56,56,56,57,57,57,57,57,57,57,57,58,58,58,58,58,58,58,59,59,59,59,59,59,59,60,60,60,60,60,60,60,61,61,61,61,61,61,62,62,62,62,62,62,63,63,63,63,63,64,64,64,64,64,65,65,65,65,65,66,66,66,66,66,67,67,67,67,67,68,68,68,68,69,69,69,69,70,70,70,70,71,71,71,71,72,72,72,73,73,73,73,74,74,74,75,75,75,76,76,76,77,77,77,78,78,78,79,79,79,80,80,81,81,81,82,82,83,83,84,84,84,85,85,86,86,87,87,88,88,89,90,90,91,91,92,93,93,94,94,95,96,96,97,98,99,99,100,101,102,103,104,105,105,106,107,108,109,110,112,113,114,115,116,118,119,120,122,123,125,127,128,130,132,134,136,138,140,142,145,147,150,153,156,159,163,167,171,175,180,185,190,196,203,211,219,228,239,252,267,284,306,334,370,422,502,648,1045, 0,
4130 		DEC_CURVE,CRV_BUFFERFULL,1045,648,502,422,370,334,306,284,267,252,239,228,219,211,198,188,180,171,163,153,145,138,130,122,116,111,106,103,98,94,94,90,86,82,78,75,71,68,65,63,61,59,57,54,53,51,50,48,47,46,45,43,42,41,40,39,38,38,37,36,35,35,34,34,33,33,32,32,32,32,31,31,31,31,30,30,30,30,29,29,29,29,29,29,29,28,28,28,28,28,28,28,28,27,27,27,27,27,27,27,27,27,27,27,27,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25, 0,
4131 		-2,
4132 
4133 		/* motorcurve 9   */
4134 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4135 		ACC_CURVE,CRV_NORMALSCAN,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,447,439,431,424,417,410,404,398,392,387,381,376,371,367,362,358,354,350,346,342,338,335,331,328,325,322,319,316,313,310,308,305,302,300,298,295,293,291,288,286,284,282,280,278,276,274,272,271,269,267,265,264,262,261,259,257,256,254,253,252,250,249,247,246,245,244,242,241,240,239,237,236,235,234,233,232,231,230,228,227,226,225,224,223,222,221,221,220,219,218,217,216,215,214,213,213,212,211,210,209,209,208,207,206,206,205,204,203,203,202,201,200,200,199,198,198,197,196,196,195,195,194,193,193,192,192,191,190,190,189,189,188,187,187,186,186,185,185,184,184,183,183,182,182,181,181,180,180,179,179,178,178,177,177,176,176,175,175,175,174,174,173,173,172,172,172,171,171,170,170,170,169,169,168,168,168,167,167,166, 0,
4136 		ACC_CURVE,CRV_PARKHOME  ,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,447,439,431,424,417,410,404,398,392,387,381,376,371,367,362,358,354,350,346,342,338,335,331,328,325,322,319,316,313,310,308,305,302,300,298,295,293,291,288,286,284,282,280,278,276,274,272,271,269,267,265,264,262,261,259,257,256,254,253,252,250,249,247,246,245,244,242,241,240,239,237,236,235,234,233,232,231,230,228,227,226,225,224,223,222,221,221,220,219,218,217,216,215,214,213,213,212,211,210,209,209,208,207,206,206,205,204,203,203,202,201,200,200,199,198,198,197,196,196,195,195,194,193,193,192,192,191,190,190,189,189,188,187,187,186,186,185,185,184,184,183,183,182,182,181,181,180,180,179,179,178,178,177,177,176,176,175,175,175,174,174,173,173,172,172,172,171,171,170,170,170,169,169,168,168,168,167,167,166,166,166, 0,
4137 		ACC_CURVE,CRV_SMEARING  ,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,455, 0,
4138 		DEC_CURVE,CRV_NORMALSCAN,455,456,465,475,485,497,509,522,536,551,568,586,606,628,654,682,715,752,797,850,915,998,998,1664,1815,2036,3136,3136,3136,3136,3136,3136, 0,
4139 		DEC_CURVE,CRV_PARKHOME  ,455,456,465,475,485,497,509,522,536,551,568,586,606,628,654,682,715,752,797,850,915,998,998,1664,1815,2036,3136,3136,3136,3136,3136,3136, 0,
4140 		DEC_CURVE,CRV_SMEARING  ,455,456,465,475,485,497,509,522,536,551,568,586,606,628,654,682,715,752,797,850,915,998,998,1664,1815,2036,3136,3136,3136,3136,3136,3136, 0,
4141 		DEC_CURVE,CRV_BUFFERFULL,110,110,111,111,112,112,113,113,114,114,115,115,116,116,117,117,118,118,119,119,120,120,121,121,122,122,123,123,124,124,125,125,126,126,127,127,128,128,129,129,130,131,132,133,133,134,135,136,137,138,139,140,141,143,144,145,146,147,149,150,151,153,154,156,157,159,161,162,164,166,168,170,172,174,176,179,181,184,186,189,192,195,198,202,206,209,213,218,222,227,233,239,245,252,259,267,276,282,286,291,298,305,310,319,325,331,342,354,362,376,387,404,417,431,456,475,509,551,586,654,715,850,998,1664,3136,3136, 0,
4142 		-2,
4143 
4144 		/* motorcurve 10  */
4145 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4146 		ACC_CURVE,CRV_NORMALSCAN,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,447,439,431,424,417,410,404,398,392,387,381,376, 0,
4147 		ACC_CURVE,CRV_PARKHOME  ,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,447,439,431,424,417,410,404,398,392,387,381,376,371,367,362,358,354,350,346,342,338,335,331,328,325,322,319,316,313,310,308,305,302,300,298,295,293,291,288,286,284,282,280,278,276,274,272,271,269,267,265,264,262,261,259,257,256,254,253,252,250,249,247,246,245,244,242,241,240,239,237,236,235,234,233,232,231,230,228,227,226,225,224,223,222,221,221,220,219,218,217,216,215,214,213,213,212,211,210,209,209,208,207,206,206,205,204,203,203,202,201,200,200,199,198,198,197,196,196,195,195,194,193,193,192,192,191,190,190,189,189,188,187,187,186,186,185,185,184,184,183,183,182,182,181,181,180,180,179,179,178,178,177,177,176,176,175,175,175,174,174,173,173,172,172,172,171,171,170,170,170,169,169,168,168,168,167,167,166, 0,
4148 		ACC_CURVE,CRV_SMEARING  ,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,455, 0,
4149 		DEC_CURVE,CRV_NORMALSCAN,381,392,404,417,431,447,465,485,508,535,566,604,650,709,787,897,1067,2227,3136, 0,
4150 		DEC_CURVE,CRV_PARKHOME  ,455,456,465,475,485,497,509,522,536,551,568,586,606,628,654,682,715,752,797,850,915,998,998,1664,1815,2036,3136, 0,
4151 		DEC_CURVE,CRV_SMEARING  ,455,456,465,475,485,497,509,522,536,551,568,586,606,628,654,682,715,752,797,850,915,998,998,1664,1815,2036,3136, 0,
4152 		DEC_CURVE,CRV_BUFFERFULL,381,392,404,417,431,447,465,485,508,535,566,604,650,709,787,897,1067,2227,3136, 0,
4153 		-2,
4154 
4155 		/* motorcurve 11  */
4156 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4157 		ACC_CURVE,CRV_NORMALSCAN,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,447,439,431,424,417,410,404,398,392,387,381,376,371,367,362,358,354,350,346,342,338,335,331,328,325,322,319,316,313,310,308,305,302,300,298,295,293,291,288,286,284,282,280,278,276,274,272,271,269,267,265,264,262,261,259,257,256,254,253,252,250,249,247,246,245,244,242,241,240,239,237,236,235,234,233,232,231,230,228,227,226,225,224,223,222,221,221,220,219,218,217,216,215,214,213,213,212,211,210,209,209,208,207,206,206,205,204,203,203,202,201,200,200,199,198,198,197,196,196,195,195,194,193,193,192,192,191,190,190,189,189,188,187,187,186,186,185,185,184,184,183,183,182,182,181,181,180,180,179,179,178,178,177,177,176,176,175,175,175,174,174,173,173,172,172,172,171,171,170,170,170,169,169,168,168,168,167,167,166, 0,
4158 		ACC_CURVE,CRV_PARKHOME  ,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,447,439,431,424,417,410,404,398,392,387,381,376,371,367,362,358,354,350,346,342,338,335,331,328,325,322,319,316,313,310,308,305,302,300,298,295,293,291,288,286,284,282,280,278,276,274,272,271,269,267,265,264,262,261,259,257,256,254,253,252,250,249,247,246,245,244,242,241,240,239,237,236,235,234,233,232,231,230,228,227,226,225,224,223,222,221,221,220,219,218,217,216,215,214,213,213,212,211,210,209,209,208,207,206,206,205,204,203,203,202,201,200,200,199,198,198,197,196,196,195,195,194,193,193,192,192,191,190,190,189,189,188,187,187,186,186,185,185,184,184,183,183,182,182,181,181,180,180,179,179,178,178,177,177,176,176,175,175,175,174,174,173,173,172,172,172,171,171,170,170,170,169,169,168,168,168,167,167,166, 0,
4159 		ACC_CURVE,CRV_SMEARING  ,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,447,439,431,424,417,410,404,398,392,387,381,376,371,367,362,358,354,350,346,342,338,335,331,328,325,322,319,316,313,310,308,305,302,300,298,295,293,291,288,286,284,282,280,278,276,274,272,271,269,267,265,264,262,261,259,257,256,254,253,252,250,249,247,246,245,244,242,241,240,239,237,236,235,234,233,232,231,230,228,227,226,225,224,223,222,221,221,220,219,218,217,216,215,214,213,213,212,211,210,209,209,208,207,206,206,205,204,203,203,202,201,200,200,199,198,198,197,196,196,195,195,194,193,193,192,192,191,190,190,189,189,188,187,187,186,186,185,185,184,184,183,183,182,182,181,181,180,180,179,179,178,178,177,177,176,176,175,175,175,174,174,173,173,172,172,172,171,171,170,170,170,169,169,168,168,168,167,167,166, 0,
4160 		DEC_CURVE,CRV_NORMALSCAN,167,168,169,170,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,190,191,192,193,194,196,197,198,200,201,203,204,206,207,209,211,212,214,216,218,219,221,223,225,227,230,232,234,236,239,241,244,247,249,252,255,258,261,265,268,272,275,279,283,288,292,297,302,307,313,318,325,331,338,346,353,362,371,381,392,404,417,431,447,465,485,508,535,566,604,650,709,787,897,1067,2227,3136, 0,
4161 		DEC_CURVE,CRV_PARKHOME  ,455,456,465,475,485,497,509,522,536,551,568,586,606,628,654,682,715,752,797,850,915,998,998,1664,1815,2036,3136, 0,
4162 		DEC_CURVE,CRV_SMEARING  ,455,456,465,475,485,497,509,522,536,551,568,586,606,628,654,682,715,752,797,850,915,998,998,1664,1815,2036,3136, 0,
4163 		DEC_CURVE,CRV_BUFFERFULL,167,168,169,170,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,190,191,192,193,194,196,197,198,200,201,203,204,206,207,209,211,212,214,216,218,219,221,223,225,227,230,232,234,236,239,241,244,247,249,252,255,258,261,265,268,272,275,279,283,288,292,297,302,307,313,318,325,331,338,346,353,362,371,381,392,404,417,431,447,465,485,508,535,566,604,650,709,787,897,1067,2227,3136, 0,
4164 		-2,
4165 
4166 		/* motorcurve 12  */
4167 		1, 1, 1, 0, /* mri, msi, skiplinecount, motorbackstep */
4168 		ACC_CURVE,CRV_NORMALSCAN,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,447,439,431,424,417,410,404,398,392,387,381,376,371,367,362,358,354,350,346,342,338,335,331,328,325,322,319,316,313,310,308,305,302,300,298,295,293,291,288,286,284,282,280,278,276,274,272,271,269,267,265,264,262,261,259,257,256,254,253,252,250,249,247,246,245,244,242,241,240,239,237,236,235,234,233,232,231,230,228,227,226,225,224,223,222,221,221,220,219,218,217,216,215,214,213,213,212,211,210,209,209,208,207,206,206,205,204,203,203,202,201,200,200,199,198,198,197,196,196,195,195,194,193,193,192,192,191,190,190,189,189,188,187,187,186,186,185,185,184,184,183,183,182,182,181,181,180,180,179,179,178,178,177,177,176,176,175,175,175,174,174,173,173,172,172,172,171,171,170,170,170,169,169,168,168,168,167,167,166,166,166,165,165,165,164,164,163,163,163,162,162,162,161,161,161,160,160,160,159,159,159,158,158,158,157,157,157,156,156,156,156,155,155,155,154,154,154,153,153,153,153,152,152,152,151,151,151,151,150,150,150,150,149,149,149,148,148,148,148,147,147,147,147,146,146,146,146,145,145,145,145,144,144,144,144,144,143,143,143,143,142,142,142,142,141,141,141,141,141,140,140,140,140,140,139,139,139,139,138,138,138,138,138,137,137,137,137,137,136,136,136,136,136,135,135,135,135,135,135,134,134,134,134,134,133,133,133,133,133,133,132,132,132,132,132,131,131,131,131,131,131,130,130,130,130,130,130,129,129,129,129,129,129,128,128,128,128,128,128,127,127,127,127,127,127,127,126,126,126,126,126,126,125, 0,
4169 		ACC_CURVE,CRV_PARKHOME  ,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,447,439,431,424,417,410,404,398,392,387,381,376,371,367,362,358,354,350,346,342,338,335,331,328,325,322,319,316,313,310,308,305,302,300,298,295,293,291,288,286,284,282,280,278,276,274,272,271,269,267,265,264,262,261,259,257,256,254,253,252,250,249,247,246,245,244,242,241,240,239,237,236,235,234,233,232,231,230,228,227,226,225,224,223,222,221,221,220,219,218,217,216,215,214,213,213,212,211,210,209,209,208,207,206,206,205,204,203,203,202,201,200,200,199,198,198,197,196,196,195,195,194,193,193,192,192,191,190,190,189,189,188,187,187,186,186,185,185,184,184,183,183,182,182,181,181,180,180,179,179,178,178,177,177,176,176,175,175,175,174,174,173,173,172,172,172,171,171,170,170,170,169,169,168,168,168,167,167,166, 0,
4170 		ACC_CURVE,CRV_SMEARING  ,3136,3136,3136,3136,3136,3136,2036,1815,1664,998,998,915,850,797,752,715,682,654,628,606,586,568,551,536,522,509,497,485,475,465,456,455, 0,
4171 		DEC_CURVE,CRV_NORMALSCAN,110,110,110,110,110,110,110,110,111,111,111,111,111,112,112,112,112,112,113,113,113,113,114,114,114,114,115,115,115,115,115,116,116,116,116,117,117,117,117,118,118,118,118,119,119,119,120,120,120,120,121,121,121,121,122,122,122,123,123,123,124,124,124,124,125,125,125,126,126,126,127,127,127,128,128,128,129,129,129,130,130,130,131,131,132,132,132,133,133,133,134,134,135,135,135,136,136,137,137,138,138,138,139,139,140,140,141,141,142,142,142,143,143,144,144,145,145,146,146,147,148,148,149,149,150,150,151,151,152,153,153,154,154,155,156,156,157,158,158,159,160,160,161,162,163,163,164,165,166,166,167,168,169,170,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,190,191,192,193,194,196,197,198,200,201,203,204,206,207,209,211,212,214,216,218,219,221,223,225,227,230,232,234,236,239,241,244,247,249,252,255,258,261,265,268,272,275,279,283,288,292,297,302,307,313,318,325,331,338,346,353,362,371,381,392,404,417,431,447,465,485,508,535,566,604,650,709,787,897,1067,2227,3136, 0,
4172 		DEC_CURVE,CRV_PARKHOME  ,455,456,465,475,485,497,509,522,536,551,568,586,606,628,654,682,715,752,797,850,915,998,998,1664,1815,2036,3136, 0,
4173 		DEC_CURVE,CRV_SMEARING  ,455,456,465,475,485,497,509,522,536,551,568,586,606,628,654,682,715,752,797,850,915,998,998,1664,1815,2036,3136, 0,
4174 		DEC_CURVE,CRV_BUFFERFULL,110,110,111,111,112,112,113,113,114,114,115,115,116,116,117,117,118,118,119,119,120,120,121,121,122,122,123,123,124,124,125,125,126,126,127,127,128,128,129,129,130,131,132,133,133,134,135,136,137,138,139,140,141,143,144,145,146,147,149,150,151,153,154,156,157,159,161,162,164,166,168,170,172,174,176,179,181,184,186,189,192,195,198,202,206,209,213,218,222,227,233,239,245,252,259,267,276,282,286,291,298,305,310,319,325,331,342,354,362,376,387,404,417,431,456,475,509,551,586,654,715,850,998,1664,3136, 0,
4175 		-1
4176 	};
4177 
4178 	rst = (SANE_Int *)malloc(sizeof(steps));
4179 	if (rst != NULL)
4180 		memcpy(rst, &steps, sizeof(steps));
4181 
4182 	return rst;
4183 }
4184 
cfg_motorcurve_getnull4185 static SANE_Int *cfg_motorcurve_get()
4186 {
4187 	/* returns motor setting buffer for a device */
4188 
4189 	SANE_Int *rst = NULL;
4190 
4191 	switch(RTS_Debug->dev_model)
4192 	{
4193 		case BQ5550:
4194 			rst = bq5550_motor();
4195 			break;
4196 
4197 		case HP3800:
4198 		case HPG2710:
4199 			rst = hp3800_motor();
4200 			break;
4201 
4202 		case HP4370:
4203 		case HPG3010:
4204 		case HPG3110:
4205 			rst = hp4370_motor();
4206 			break;
4207 
4208 		default:
4209 			rst = hp3970_motor();
4210 			break;
4211 	}
4212 
4213 	return rst;
4214 }
4215 
4216 /* DEPRECATED functions */
4217 
ua4900_calibreflective(int option, int defvalue)4218 static int ua4900_calibreflective(int option, int defvalue)
4219 {
4220 	int rst = defvalue;
4221 
4222 	switch(option)
4223 	{
4224 		case WSTRIPXPOS: rst = 0; break;
4225 		case WSTRIPYPOS: rst = 0; break;
4226 		case BSTRIPXPOS: rst = 0; break;
4227 		case BSTRIPYPOS: rst = 0; break;
4228 		case BREFR: rst = 10; break;
4229 		case BREFG: rst = 10; break;
4230 		case BREFB: rst = 10; break;
4231 		case REFBITDEPTH: rst = 8; break;
4232 		case OFFSETHEIGHT: rst = 10; break;
4233 		case OFFSETNSIGMA: rst = 2; break;
4234 		case OFFSETTARGETMAX: rst = 50; break;
4235 		case OFFSETTARGETMIN: rst = 2; break;
4236 		case OFFSETAVGTARGETR: rst = 10; break;
4237 		case OFFSETAVGTARGETG: rst = 10; break;
4238 		case OFFSETAVGTARGETB: rst = 10; break;
4239 		case ADCOFFEVENODD: rst = 1; break;
4240 		case CALIBOFFSET1ON: rst = 2; break;
4241 		case ADCOFFQUICKWAY: rst = 1; break;
4242 		case ADCOFFPREDICTSTART: rst = 300; break;
4243 		case ADCOFFPREDICTEND: rst = 500; break;
4244 		case OFFSETTUNESTEP1: rst = 5; break;
4245 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
4246 		case OFFSETAVGRATIO1: rst = 100; break;
4247 		case OFFSETEVEN1R: rst = 310; break;
4248 		case OFFSETODD1R: rst = 310; break;
4249 		case OFFSETEVEN1G: rst = 313; break;
4250 		case OFFSETODD1G: rst = 313; break;
4251 		case OFFSETEVEN1B: rst = 319; break;
4252 		case OFFSETODD1B: rst = 319; break;
4253 		case ADCOFFPREDICTR: rst = 321; break;
4254 		case ADCOFFPREDICTG: rst = 321; break;
4255 		case ADCOFFPREDICTB: rst = 321; break;
4256 		case ADCOFFEVEN1R_1ST: rst = 344; break;
4257 		case ADCOFFODD1R_1ST: rst = 344; break;
4258 		case ADCOFFEVEN1G_1ST: rst = 328; break;
4259 		case ADCOFFODD1G_1ST: rst = 328; break;
4260 		case ADCOFFEVEN1B_1ST: rst = 341; break;
4261 		case ADCOFFODD1B_1ST: rst = 341; break;
4262 		case PEAKR: rst = 122; break;
4263 		case PEAKG: rst = 122; break;
4264 		case PEAKB: rst = 122; break;
4265 		case MINR: rst = 50; break;
4266 		case MING: rst = 50; break;
4267 		case MINB: rst = 50; break;
4268 		case CALIBOFFSET2ON: rst = 0; break;
4269 		case OFFSETTUNESTEP2: rst = 1; break;
4270 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
4271 		case OFFSETAVGRATIO2: rst = 100; break;
4272 		case OFFSETEVEN2R: rst = 0; break;
4273 		case OFFSETODD2R: rst = 0; break;
4274 		case OFFSETEVEN2G: rst = 0; break;
4275 		case OFFSETODD2G: rst = 0; break;
4276 		case OFFSETEVEN2B: rst = 0; break;
4277 		case OFFSETODD2B: rst = 0; break;
4278 		case GAINHEIGHT: rst = 10; break;
4279 		case GAINTARGETFACTOR: rst = 90; break;
4280 		case CALIBPAGON: rst = 0; break;
4281 		case PAGR: rst = 3; break;
4282 		case PAGG: rst = 3; break;
4283 		case PAGB: rst = 3; break;
4284 		case CALIBGAIN1ON: rst = 1; break;
4285 		case GAIN1R: rst = 8; break;
4286 		case GAIN1G: rst = 8; break;
4287 		case GAIN1B: rst = 8; break;
4288 		case CALIBGAIN2ON: rst = 0; break;
4289 		case GAIN2R: rst = 8; break;
4290 		case GAIN2G: rst = 8; break;
4291 		case GAIN2B: rst = 8; break;
4292 		case TOTSHADING: rst = 0; break;
4293 		case BSHADINGON: rst = -2; break;
4294 		case BSHADINGHEIGHT: rst = 10; break;
4295 		case BSHADINGPREDIFFR: rst = 2; break;
4296 		case BSHADINGPREDIFFG: rst = 1; break;
4297 		case BSHADINGPREDIFFB: rst = 2; break;
4298 		case BSHADINGDEFCUTOFF: rst = 0; break;
4299 		case WSHADINGON: rst = 3; break;
4300 		case WSHADINGHEIGHT: rst = 15; break;
4301 		case WSHADINGPREDIFFR: rst = -1; break;
4302 		case WSHADINGPREDIFFG: rst = -1; break;
4303 		case WSHADINGPREDIFFB: rst = -1; break;
4304 	}
4305 
4306 	return rst;
4307 }
4308 
hp3800_calibreflective(int option, int defvalue)4309 static int hp3800_calibreflective(int option, int defvalue)
4310 {
4311 	int rst = defvalue;
4312 	switch(option)
4313 	{
4314 		case WSTRIPXPOS: rst = 0; break;
4315 		case WSTRIPYPOS: rst = 0; break;
4316 		case BSTRIPXPOS: rst = 0; break;
4317 		case BSTRIPYPOS: rst = 0; break;
4318 		case BREFR: rst = 10; break;
4319 		case BREFG: rst = 10; break;
4320 		case BREFB: rst = 10; break;
4321 		case REFBITDEPTH: rst = 8; break;
4322 		case OFFSETHEIGHT: rst = 10; break;
4323 		case OFFSETNSIGMA: rst = 2; break;
4324 		case OFFSETTARGETMAX: rst = 50; break;
4325 		case OFFSETTARGETMIN: rst = 2; break;
4326 		case OFFSETAVGTARGETR: rst = 10; break;
4327 		case OFFSETAVGTARGETG: rst = 10; break;
4328 		case OFFSETAVGTARGETB: rst = 10; break;
4329 		case ADCOFFEVENODD: rst = 1; break;
4330 		case CALIBOFFSET1ON: rst = 2; break;
4331 		case ADCOFFQUICKWAY: rst = 1; break;
4332 		case ADCOFFPREDICTSTART: rst = 300; break;
4333 		case ADCOFFPREDICTEND: rst = 500; break;
4334 		case OFFSETTUNESTEP1: rst = 5; break;
4335 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
4336 		case OFFSETAVGRATIO1: rst = 100; break;
4337 		case OFFSETEVEN1R: rst = 310; break;
4338 		case OFFSETODD1R: rst = 310; break;
4339 		case OFFSETEVEN1G: rst = 317; break;
4340 		case OFFSETODD1G: rst = 317; break;
4341 		case OFFSETEVEN1B: rst = 293; break;
4342 		case OFFSETODD1B: rst = 293; break;
4343 		case ADCOFFPREDICTR: rst = 500; break;
4344 		case ADCOFFPREDICTG: rst = 500; break;
4345 		case ADCOFFPREDICTB: rst = 500; break;
4346 		case ADCOFFEVEN1R_1ST: rst = 128; break;
4347 		case ADCOFFODD1R_1ST: rst = 128; break;
4348 		case ADCOFFEVEN1G_1ST: rst = 128; break;
4349 		case ADCOFFODD1G_1ST: rst = 128; break;
4350 		case ADCOFFEVEN1B_1ST: rst = 128; break;
4351 		case ADCOFFODD1B_1ST: rst = 128; break;
4352 		case PEAKR: rst = 104; break;
4353 		case PEAKG: rst = 111; break;
4354 		case PEAKB: rst = 105; break;
4355 		case MINR: rst = 50; break;
4356 		case MING: rst = 56; break;
4357 		case MINB: rst = 57; break;
4358 		case CALIBOFFSET2ON: rst = 0; break;
4359 		case OFFSETTUNESTEP2: rst = 1; break;
4360 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
4361 		case OFFSETAVGRATIO2: rst = 100; break;
4362 		case OFFSETEVEN2R: rst = 0; break;
4363 		case OFFSETODD2R: rst = 0; break;
4364 		case OFFSETEVEN2G: rst = 0; break;
4365 		case OFFSETODD2G: rst = 0; break;
4366 		case OFFSETEVEN2B: rst = 0; break;
4367 		case OFFSETODD2B: rst = 0; break;
4368 		case GAINHEIGHT: rst = 10; break;
4369 		case GAINTARGETFACTOR: rst = 80; break;
4370 		case CALIBPAGON: rst = 0; break;
4371 		case PAGR: rst = 3; break;
4372 		case PAGG: rst = 3; break;
4373 		case PAGB: rst = 3; break;
4374 		case CALIBGAIN1ON: rst = 1; break;
4375 		case GAIN1R: rst = 23; break;
4376 		case GAIN1G: rst = 19; break;
4377 		case GAIN1B: rst = 0; break;
4378 		case CALIBGAIN2ON: rst = 0; break;
4379 		case GAIN2R: rst = 4; break;
4380 		case GAIN2G: rst = 4; break;
4381 		case GAIN2B: rst = 4; break;
4382 		case TOTSHADING: rst = 0; break;
4383 		case BSHADINGON: rst = -3; break;
4384 		case BSHADINGHEIGHT: rst = 20; break;
4385 		case BSHADINGPREDIFFR: rst = 2; break;
4386 		case BSHADINGPREDIFFG: rst = 2; break;
4387 		case BSHADINGPREDIFFB: rst = 2; break;
4388 		case BSHADINGDEFCUTOFF: rst = 0; break;
4389 		case WSHADINGON: rst = 3; break;
4390 		case WSHADINGHEIGHT: rst = 24; break;
4391 		case WSHADINGPREDIFFR: rst = -1; break;
4392 		case WSHADINGPREDIFFG: rst = -1; break;
4393 		case WSHADINGPREDIFFB: rst = -1; break;
4394 	}
4395 
4396 	return rst;
4397 }
4398 
hp3970_calibreflective(int option, int defvalue)4399 static int hp3970_calibreflective(int option, int defvalue)
4400 {
4401 	int rst = defvalue;
4402 	switch(option)
4403 	{
4404 		case WSTRIPXPOS: rst = 0; break;
4405 		case WSTRIPYPOS: rst = 0; break;
4406 		case BSTRIPXPOS: rst = 0; break;
4407 		case BSTRIPYPOS: rst = 0; break;
4408 		case BREFR: rst = 10; break;
4409 		case BREFG: rst = 10; break;
4410 		case BREFB: rst = 10; break;
4411 		case REFBITDEPTH: rst = 8; break;
4412 		case OFFSETHEIGHT: rst = 10; break;
4413 		case OFFSETNSIGMA: rst = 2; break;
4414 		case OFFSETTARGETMAX: rst = 50; break;
4415 		case OFFSETTARGETMIN: rst = 2; break;
4416 		case OFFSETAVGTARGETR: rst = 10; break;
4417 		case OFFSETAVGTARGETG: rst = 10; break;
4418 		case OFFSETAVGTARGETB: rst = 10; break;
4419 		case ADCOFFEVENODD: rst = 1; break;
4420 		case CALIBOFFSET1ON: rst = 2; break;
4421 		case ADCOFFQUICKWAY: rst = 1; break;
4422 		case ADCOFFPREDICTSTART: rst = 300; break;
4423 		case ADCOFFPREDICTEND: rst = 500; break;
4424 		case OFFSETTUNESTEP1: rst = 5; break;
4425 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
4426 		case OFFSETAVGRATIO1: rst = 100; break;
4427 		case OFFSETEVEN1R: rst = 327; break;
4428 		case OFFSETODD1R: rst = 327; break;
4429 		case OFFSETEVEN1G: rst = 315; break;
4430 		case OFFSETODD1G: rst = 315; break;
4431 		case OFFSETEVEN1B: rst = 322; break;
4432 		case OFFSETODD1B: rst = 322; break;
4433 		case ADCOFFPREDICTR: rst = 322; break;
4434 		case ADCOFFPREDICTG: rst = 310; break;
4435 		case ADCOFFPREDICTB: rst = 322; break;
4436 		case ADCOFFEVEN1R_1ST: rst = 344; break;
4437 		case ADCOFFODD1R_1ST: rst = 344; break;
4438 		case ADCOFFEVEN1G_1ST: rst = 328; break;
4439 		case ADCOFFODD1G_1ST: rst = 328; break;
4440 		case ADCOFFEVEN1B_1ST: rst = 341; break;
4441 		case ADCOFFODD1B_1ST: rst = 341; break;
4442 		case PEAKR: rst = 82; break;
4443 		case PEAKG: rst = 117; break;
4444 		case PEAKB: rst = 116; break;
4445 		case MINR: rst = 37; break;
4446 		case MING: rst = 51; break;
4447 		case MINB: rst = 53; break;
4448 		case CALIBOFFSET2ON: rst = 0; break;
4449 		case OFFSETTUNESTEP2: rst = 1; break;
4450 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
4451 		case OFFSETAVGRATIO2: rst = 100; break;
4452 		case OFFSETEVEN2R: rst = 0; break;
4453 		case OFFSETODD2R: rst = 0; break;
4454 		case OFFSETEVEN2G: rst = 0; break;
4455 		case OFFSETODD2G: rst = 0; break;
4456 		case OFFSETEVEN2B: rst = 0; break;
4457 		case OFFSETODD2B: rst = 0; break;
4458 		case GAINHEIGHT: rst = 10; break;
4459 		case GAINTARGETFACTOR: rst = 90; break;
4460 		case CALIBPAGON: rst = 0; break;
4461 		case PAGR: rst = 3; break;
4462 		case PAGG: rst = 3; break;
4463 		case PAGB: rst = 3; break;
4464 		case CALIBGAIN1ON: rst = 1; break;
4465 		case GAIN1R: rst = 28; break;
4466 		case GAIN1G: rst = 22; break;
4467 		case GAIN1B: rst = 21; break;
4468 		case CALIBGAIN2ON: rst = 0; break;
4469 		case GAIN2R: rst = 4; break;
4470 		case GAIN2G: rst = 4; break;
4471 		case GAIN2B: rst = 4; break;
4472 		case TOTSHADING: rst = 0; break;
4473 		case BSHADINGON: rst = -2; break;
4474 		case BSHADINGHEIGHT: rst = 10; break;
4475 		case BSHADINGPREDIFFR: rst = 2; break;
4476 		case BSHADINGPREDIFFG: rst = 2; break;
4477 		case BSHADINGPREDIFFB: rst = 2; break;
4478 		case BSHADINGDEFCUTOFF: rst = 0; break;
4479 		case WSHADINGON: rst = 3; break;
4480 		case WSHADINGHEIGHT: rst = 24; break;
4481 		case WSHADINGPREDIFFR: rst = -1; break;
4482 		case WSHADINGPREDIFFG: rst = -1; break;
4483 		case WSHADINGPREDIFFB: rst = -1; break;
4484 	}
4485 
4486 	return rst;
4487 }
4488 
hp4370_calibreflective(int option, int defvalue)4489 static int hp4370_calibreflective(int option, int defvalue)
4490 {
4491 	int rst = defvalue;
4492 	switch(option)
4493 	{
4494 		case WSTRIPXPOS: rst = 0; break;
4495 		case WSTRIPYPOS: rst = 0; break;
4496 		case BSTRIPXPOS: rst = 0; break;
4497 		case BSTRIPYPOS: rst = 0; break;
4498 		case BREFR: rst = 10; break;
4499 		case BREFG: rst = 10; break;
4500 		case BREFB: rst = 10; break;
4501 		case REFBITDEPTH: rst = 8; break;
4502 		case OFFSETHEIGHT: rst = 10; break;
4503 		case OFFSETNSIGMA: rst = 2; break;
4504 		case OFFSETTARGETMAX: rst = 50; break;
4505 		case OFFSETTARGETMIN: rst = 2; break;
4506 		case OFFSETAVGTARGETR: rst = 10; break;
4507 		case OFFSETAVGTARGETG: rst = 10; break;
4508 		case OFFSETAVGTARGETB: rst = 10; break;
4509 		case ADCOFFEVENODD: rst = 1; break;
4510 		case CALIBOFFSET1ON: rst = 2; break;
4511 		case ADCOFFQUICKWAY: rst = 1; break;
4512 		case ADCOFFPREDICTSTART: rst = 300; break;
4513 		case ADCOFFPREDICTEND: rst = 500; break;
4514 		case OFFSETTUNESTEP1: rst = 5; break;
4515 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
4516 		case OFFSETAVGRATIO1: rst = 100; break;
4517 		case OFFSETEVEN1R: rst = 305; break;
4518 		case OFFSETODD1R: rst = 3305; break;
4519 		case OFFSETEVEN1G: rst = 313; break;
4520 		case OFFSETODD1G: rst = 313; break;
4521 		case OFFSETEVEN1B: rst = 317; break;
4522 		case OFFSETODD1B: rst = 317; break;
4523 		case ADCOFFPREDICTR: rst = 500; break;
4524 		case ADCOFFPREDICTG: rst = 500; break;
4525 		case ADCOFFPREDICTB: rst = 500; break;
4526 		case ADCOFFEVEN1R_1ST: rst = 344; break;
4527 		case ADCOFFODD1R_1ST: rst = 344; break;
4528 		case ADCOFFEVEN1G_1ST: rst = 328; break;
4529 		case ADCOFFODD1G_1ST: rst = 328; break;
4530 		case ADCOFFEVEN1B_1ST: rst = 341; break;
4531 		case ADCOFFODD1B_1ST: rst = 341; break;
4532 		case PEAKR: rst = 159; break;
4533 		case PEAKG: rst = 191; break;
4534 		case PEAKB: rst = 191; break;
4535 		case MINR: rst = 146; break;
4536 		case MING: rst = 180; break;
4537 		case MINB: rst = 179; break;
4538 		case CALIBOFFSET2ON: rst = 0; break;
4539 		case OFFSETTUNESTEP2: rst = 1; break;
4540 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
4541 		case OFFSETAVGRATIO2: rst = 100; break;
4542 		case OFFSETEVEN2R: rst = 0; break;
4543 		case OFFSETODD2R: rst = 0; break;
4544 		case OFFSETEVEN2G: rst = 0; break;
4545 		case OFFSETODD2G: rst = 0; break;
4546 		case OFFSETEVEN2B: rst = 0; break;
4547 		case OFFSETODD2B: rst = 0; break;
4548 		case GAINHEIGHT: rst = 10; break;
4549 		case GAINTARGETFACTOR: rst = 80; break;
4550 		case CALIBPAGON: rst = 0; break;
4551 		case HIPAGR: rst = 3; break;
4552 		case HIPAGG: rst = 0; break;
4553 		case HIPAGB: rst = 0; break;
4554 		case PAGR: rst = 3; break;
4555 		case PAGG: rst = 3; break;
4556 		case PAGB: rst = 3; break;
4557 		case LOPAGR: rst = 3; break;
4558 		case LOPAGG: rst = 3; break;
4559 		case LOPAGB: rst = 3; break;
4560 		case CALIBGAIN1ON: rst = 1; break;
4561 		case GAIN1R: rst = 10; break;
4562 		case GAIN1G: rst = 2; break;
4563 		case GAIN1B: rst = 1; break;
4564 		case CALIBGAIN2ON: rst = 0; break;
4565 		case GAIN2R: rst = 4; break;
4566 		case GAIN2G: rst = 4; break;
4567 		case GAIN2B: rst = 4; break;
4568 		case TOTSHADING: rst = 0; break;
4569 		case BSHADINGON: rst = -2; break;
4570 		case BSHADINGHEIGHT: rst = 10; break;
4571 		case BSHADINGPREDIFFR: rst = 2; break;
4572 		case BSHADINGPREDIFFG: rst = 2; break;
4573 		case BSHADINGPREDIFFB: rst = 2; break;
4574 		case BSHADINGDEFCUTOFF: rst = 0; break;
4575 		case WSHADINGON: rst = 3; break;
4576 		case WSHADINGHEIGHT: rst = 24; break;
4577 		case WSHADINGPREDIFFR: rst = -1; break;
4578 		case WSHADINGPREDIFFG: rst = -1; break;
4579 		case WSHADINGPREDIFFB: rst = -1; break;
4580 	}
4581 
4582 	return rst;
4583 }
4584 
fc_calibreflective(int option, int defvalue)4585 static int fc_calibreflective(int option, int defvalue)
4586 {
4587 	int rst;
4588 
4589 	switch(RTS_Debug->dev_model)
4590 	{
4591 		case UA4900: rst = ua4900_calibreflective(option, defvalue); break;
4592 		case HPG2710:
4593 		case HP3800: rst = hp3800_calibreflective(option, defvalue); break;
4594 		case HPG3010:
4595 		case HPG3110:
4596 		case HP4370: rst = hp4370_calibreflective(option, defvalue); break;
4597 		default    : rst = hp3970_calibreflective(option, defvalue); break;
4598 	}
4599 
4600 	return rst;
4601 }
4602 
ua4900_calibtransparent(int option, int defvalue)4603 static int ua4900_calibtransparent(int option, int defvalue)
4604 {
4605 	int rst = defvalue;
4606 
4607 	switch(option)
4608 	{
4609 		case WSTRIPXPOS: rst = 0; break;
4610 		case WSTRIPYPOS: rst = 12100; break;
4611 		case BSTRIPXPOS: rst = 0; break;
4612 		case BSTRIPYPOS: rst = 0; break;
4613 		case BREFR: rst = 2; break;
4614 		case BREFG: rst = 2; break;
4615 		case BREFB: rst = 2; break;
4616 		case REFBITDEPTH: rst = 8; break;
4617 		case OFFSETHEIGHT: rst = 10; break;
4618 		case OFFSETNSIGMA: rst = 2; break;
4619 		case OFFSETTARGETMAX: rst = 50; break;
4620 		case OFFSETTARGETMIN: rst = 2; break;
4621 		case OFFSETAVGTARGETR: rst = 13; break;
4622 		case OFFSETAVGTARGETG: rst = 13; break;
4623 		case OFFSETAVGTARGETB: rst = 13; break;
4624 		case ADCOFFEVENODD: rst = 1; break;
4625 		case CALIBOFFSET1ON: rst = 2; break;
4626 		case ADCOFFQUICKWAY: rst = 1; break;
4627 		case ADCOFFPREDICTSTART: rst = 200; break;
4628 		case ADCOFFPREDICTEND: rst = 500; break;
4629 		case OFFSETTUNESTEP1: rst = 5; break;
4630 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
4631 		case OFFSETAVGRATIO1: rst = 100; break;
4632 		case OFFSETEVEN1R: rst = 321; break;
4633 		case OFFSETODD1R: rst = 321; break;
4634 		case OFFSETEVEN1G: rst = 321; break;
4635 		case OFFSETODD1G: rst = 321; break;
4636 		case OFFSETEVEN1B: rst = 321; break;
4637 		case OFFSETODD1B: rst = 321; break;
4638 		case ADCOFFPREDICTR: rst = 333; break;
4639 		case ADCOFFPREDICTG: rst = 313; break;
4640 		case ADCOFFPREDICTB: rst = 317; break;
4641 		case ADCOFFEVEN1R_1ST: rst = 69; break;
4642 		case ADCOFFODD1R_1ST: rst = 69; break;
4643 		case ADCOFFEVEN1G_1ST: rst = 87; break;
4644 		case ADCOFFODD1G_1ST: rst = 87; break;
4645 		case ADCOFFEVEN1B_1ST: rst = 106; break;
4646 		case ADCOFFODD1B_1ST: rst = 106; break;
4647 		case PEAKR: rst = 177; break;
4648 		case PEAKG: rst = 177; break;
4649 		case PEAKB: rst = 177; break;
4650 		case MINR: rst = 136; break;
4651 		case MING: rst = 136; break;
4652 		case MINB: rst = 136; break;
4653 		case CALIBOFFSET2ON: rst = 0; break;
4654 		case OFFSETTUNESTEP2: rst = 1; break;
4655 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
4656 		case OFFSETAVGRATIO2: rst = 100; break;
4657 		case OFFSETEVEN2R: rst = 0; break;
4658 		case OFFSETODD2R: rst = 0; break;
4659 		case OFFSETEVEN2G: rst = 0; break;
4660 		case OFFSETODD2G: rst = 0; break;
4661 		case OFFSETEVEN2B: rst = 0; break;
4662 		case OFFSETODD2B: rst = 0; break;
4663 		case GAINHEIGHT: rst = 30; break;
4664 		case GAINTARGETFACTOR: rst = 90; break;
4665 		case CALIBPAGON: rst = 0; break;
4666 		case PAGR: rst = 0; break;
4667 		case PAGG: rst = 0; break;
4668 		case PAGB: rst = 0; break;
4669 		case CALIBGAIN1ON: rst = 1; break;
4670 		case GAIN1R: rst = 24; break;
4671 		case GAIN1G: rst = 21; break;
4672 		case GAIN1B: rst = 19; break;
4673 		case CALIBGAIN2ON: rst = 0; break;
4674 		case GAIN2R: rst = 8; break;
4675 		case GAIN2G: rst = 8; break;
4676 		case GAIN2B: rst = 8; break;
4677 		case TOTSHADING: rst = 0; break;
4678 		case BSHADINGON: rst = 2; break;
4679 		case BSHADINGHEIGHT: rst = 10; break;
4680 		case BSHADINGPREDIFFR: rst = 2; break;
4681 		case BSHADINGPREDIFFG: rst = 2; break;
4682 		case BSHADINGPREDIFFB: rst = 2; break;
4683 		case BSHADINGDEFCUTOFF: rst = 0; break;
4684 		case WSHADINGON: rst = 3; break;
4685 		case WSHADINGHEIGHT: rst = 24; break;
4686 		case WSHADINGPREDIFFR: rst = -1; break;
4687 		case WSHADINGPREDIFFG: rst = -1; break;
4688 		case WSHADINGPREDIFFB: rst = -1; break;
4689 	}
4690 
4691 	return rst;
4692 }
4693 
hp3800_calibtransparent(int option, int defvalue)4694 static int hp3800_calibtransparent(int option, int defvalue)
4695 {
4696 	int rst = defvalue;
4697 	switch(option)
4698 	{
4699 		case WSTRIPXPOS: rst = 0; break;
4700 		case WSTRIPYPOS: rst = 4155; break;
4701 		case BSTRIPXPOS: rst = 0; break;
4702 		case BSTRIPYPOS: rst = 0; break;
4703 		case BREFR: rst = 2; break;
4704 		case BREFG: rst = 2; break;
4705 		case BREFB: rst = 2; break;
4706 		case REFBITDEPTH: rst = 8; break;
4707 		case OFFSETHEIGHT: rst = 10; break;
4708 		case OFFSETNSIGMA: rst = 2; break;
4709 		case OFFSETTARGETMAX: rst = 50; break;
4710 		case OFFSETTARGETMIN: rst = 2; break;
4711 		case OFFSETAVGTARGETR: rst = 10; break;
4712 		case OFFSETAVGTARGETG: rst = 10; break;
4713 		case OFFSETAVGTARGETB: rst = 10; break;
4714 		case ADCOFFEVENODD: rst = 1; break;
4715 		case CALIBOFFSET1ON: rst = 2; break;
4716 		case ADCOFFQUICKWAY: rst = 1; break;
4717 		case ADCOFFPREDICTSTART: rst = 200; break;
4718 		case ADCOFFPREDICTEND: rst = 500; break;
4719 		case OFFSETTUNESTEP1: rst = 5; break;
4720 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
4721 		case OFFSETAVGRATIO1: rst = 100; break;
4722 		case OFFSETEVEN1R: rst = 310; break;
4723 		case OFFSETODD1R: rst = 310; break;
4724 		case OFFSETEVEN1G: rst = 299; break;
4725 		case OFFSETODD1G: rst = 299; break;
4726 		case OFFSETEVEN1B: rst = 309; break;
4727 		case OFFSETODD1B: rst = 309; break;
4728 		case ADCOFFPREDICTR: rst = 333; break;
4729 		case ADCOFFPREDICTG: rst = 313; break;
4730 		case ADCOFFPREDICTB: rst = 317; break;
4731 		case ADCOFFEVEN1R_1ST: rst = 69; break;
4732 		case ADCOFFODD1R_1ST: rst = 69; break;
4733 		case ADCOFFEVEN1G_1ST: rst = 87; break;
4734 		case ADCOFFODD1G_1ST: rst = 87; break;
4735 		case ADCOFFEVEN1B_1ST: rst = 106; break;
4736 		case ADCOFFODD1B_1ST: rst = 106; break;
4737 		case PEAKR: rst = 67; break;
4738 		case PEAKG: rst = 61; break;
4739 		case PEAKB: rst = 57; break;
4740 		case MINR: rst = 10; break;
4741 		case MING: rst = 10; break;
4742 		case MINB: rst = 10; break;
4743 		case CALIBOFFSET2ON: rst = 0; break;
4744 		case OFFSETTUNESTEP2: rst = 1; break;
4745 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
4746 		case OFFSETAVGRATIO2: rst = 100; break;
4747 		case OFFSETEVEN2R: rst = 0; break;
4748 		case OFFSETODD2R: rst = 0; break;
4749 		case OFFSETEVEN2G: rst = 0; break;
4750 		case OFFSETODD2G: rst = 0; break;
4751 		case OFFSETEVEN2B: rst = 0; break;
4752 		case OFFSETODD2B: rst = 0; break;
4753 		case GAINHEIGHT: rst = 30; break;
4754 		case GAINTARGETFACTOR: rst = 90; break;
4755 		case CALIBPAGON: rst = 0; break;
4756 		case PAGR: rst = 3; break;
4757 		case PAGG: rst = 3; break;
4758 		case PAGB: rst = 2; break;
4759 		case CALIBGAIN1ON: rst = 1; break;
4760 		case GAIN1R: rst = 9; break;
4761 		case GAIN1G: rst = 12; break;
4762 		case GAIN1B: rst = 10; break;
4763 		case CALIBGAIN2ON: rst = 0; break;
4764 		case GAIN2R: rst = 4; break;
4765 		case GAIN2G: rst = 4; break;
4766 		case GAIN2B: rst = 4; break;
4767 		case TOTSHADING: rst = 0; break;
4768 		case BSHADINGON: rst = -3; break;
4769 		case BSHADINGHEIGHT: rst = 30; break;
4770 		case BSHADINGPREDIFFR: rst = 2; break;
4771 		case BSHADINGPREDIFFG: rst = 2; break;
4772 		case BSHADINGPREDIFFB: rst = 2; break;
4773 		case BSHADINGDEFCUTOFF: rst = 0; break;
4774 		case WSHADINGON: rst = 3; break;
4775 		case WSHADINGHEIGHT: rst = 24; break;
4776 		case WSHADINGPREDIFFR: rst = -1; break;
4777 		case WSHADINGPREDIFFG: rst = -1; break;
4778 		case WSHADINGPREDIFFB: rst = -1; break;
4779 	}
4780 
4781 	return rst;
4782 }
4783 
hp3970_calibtransparent(int option, int defvalue)4784 static int hp3970_calibtransparent(int option, int defvalue)
4785 {
4786 	int rst = defvalue;
4787 	switch(option)
4788 	{
4789 		case WSTRIPXPOS: rst = 0; break;
4790 		case WSTRIPYPOS: rst = 7500; break;
4791 		case BSTRIPXPOS: rst = 0; break;
4792 		case BSTRIPYPOS: rst = 0; break;
4793 		case BREFR: rst = 2; break;
4794 		case BREFG: rst = 2; break;
4795 		case BREFB: rst = 2; break;
4796 		case REFBITDEPTH: rst = 8; break;
4797 		case OFFSETHEIGHT: rst = 10; break;
4798 		case OFFSETNSIGMA: rst = 2; break;
4799 		case OFFSETTARGETMAX: rst = 50; break;
4800 		case OFFSETTARGETMIN: rst = 2; break;
4801 		case OFFSETAVGTARGETR: rst = 10; break;
4802 		case OFFSETAVGTARGETG: rst = 10; break;
4803 		case OFFSETAVGTARGETB: rst = 10; break;
4804 		case ADCOFFEVENODD: rst = 1; break;
4805 		case CALIBOFFSET1ON: rst = 2; break;
4806 		case ADCOFFQUICKWAY: rst = 1; break;
4807 		case ADCOFFPREDICTSTART: rst = 200; break;
4808 		case ADCOFFPREDICTEND: rst = 500; break;
4809 		case OFFSETTUNESTEP1: rst = 5; break;
4810 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
4811 		case OFFSETAVGRATIO1: rst = 100; break;
4812 		case OFFSETEVEN1R: rst = 323; break;
4813 		case OFFSETODD1R: rst = 323; break;
4814 		case OFFSETEVEN1G: rst = 327; break;
4815 		case OFFSETODD1G: rst = 327; break;
4816 		case OFFSETEVEN1B: rst = 327; break;
4817 		case OFFSETODD1B: rst = 327; break;
4818 		case ADCOFFPREDICTR: rst = 333; break;
4819 		case ADCOFFPREDICTG: rst = 313; break;
4820 		case ADCOFFPREDICTB: rst = 317; break;
4821 		case ADCOFFEVEN1R_1ST: rst = 69; break;
4822 		case ADCOFFODD1R_1ST: rst = 69; break;
4823 		case ADCOFFEVEN1G_1ST: rst = 87; break;
4824 		case ADCOFFODD1G_1ST: rst = 87; break;
4825 		case ADCOFFEVEN1B_1ST: rst = 106; break;
4826 		case ADCOFFODD1B_1ST: rst = 106; break;
4827 		case PEAKR: rst = 42; break;
4828 		case PEAKG: rst = 55; break;
4829 		case PEAKB: rst = 53; break;
4830 		case MINR: rst = 31; break;
4831 		case MING: rst = 39; break;
4832 		case MINB: rst = 38; break;
4833 		case CALIBOFFSET2ON: rst = 0; break;
4834 		case OFFSETTUNESTEP2: rst = 1; break;
4835 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
4836 		case OFFSETAVGRATIO2: rst = 100; break;
4837 		case OFFSETEVEN2R: rst = 0; break;
4838 		case OFFSETODD2R: rst = 0; break;
4839 		case OFFSETEVEN2G: rst = 0; break;
4840 		case OFFSETODD2G: rst = 0; break;
4841 		case OFFSETEVEN2B: rst = 0; break;
4842 		case OFFSETODD2B: rst = 0; break;
4843 		case GAINHEIGHT: rst = 30; break;
4844 		case GAINTARGETFACTOR: rst = 90; break;
4845 		case CALIBPAGON: rst = 0; break;
4846 		case PAGR: rst = 3; break;
4847 		case PAGG: rst = 3; break;
4848 		case PAGB: rst = 2; break;
4849 		case CALIBGAIN1ON: rst = 1; break;
4850 		case GAIN1R: rst = 21; break;
4851 		case GAIN1G: rst = 14; break;
4852 		case GAIN1B: rst = 12; break;
4853 		case CALIBGAIN2ON: rst = 0; break;
4854 		case GAIN2R: rst = 4; break;
4855 		case GAIN2G: rst = 4; break;
4856 		case GAIN2B: rst = 4; break;
4857 		case TOTSHADING: rst = 0; break;
4858 		case BSHADINGON: rst = 1; break;
4859 		case BSHADINGHEIGHT: rst = 30; break;
4860 		case BSHADINGPREDIFFR: rst = 2; break;
4861 		case BSHADINGPREDIFFG: rst = 2; break;
4862 		case BSHADINGPREDIFFB: rst = 2; break;
4863 		case BSHADINGDEFCUTOFF: rst = 0; break;
4864 		case WSHADINGON: rst = 3; break;
4865 		case WSHADINGHEIGHT: rst = 24; break;
4866 		case WSHADINGPREDIFFR: rst = -1; break;
4867 		case WSHADINGPREDIFFG: rst = -1; break;
4868 		case WSHADINGPREDIFFB: rst = -1; break;
4869 	}
4870 
4871 	return rst;
4872 }
4873 
hp4370_calibtransparent(int option, int defvalue)4874 static int hp4370_calibtransparent(int option, int defvalue)
4875 {
4876 	int rst = defvalue;
4877 	switch(option)
4878 	{
4879 		case WSTRIPXPOS: rst = 0; break;
4880 		case WSTRIPYPOS: rst = 6580; break;
4881 		case BSTRIPXPOS: rst = 0; break;
4882 		case BSTRIPYPOS: rst = 0; break;
4883 		case BREFR: rst = 2; break;
4884 		case BREFG: rst = 2; break;
4885 		case BREFB: rst = 2; break;
4886 		case REFBITDEPTH: rst = 8; break;
4887 		case OFFSETHEIGHT: rst = 10; break;
4888 		case OFFSETNSIGMA: rst = 2; break;
4889 		case OFFSETTARGETMAX: rst = 50; break;
4890 		case OFFSETTARGETMIN: rst = 2; break;
4891 		case OFFSETAVGTARGETR: rst = 10; break;
4892 		case OFFSETAVGTARGETG: rst = 10; break;
4893 		case OFFSETAVGTARGETB: rst = 10; break;
4894 		case ADCOFFEVENODD: rst = 1; break;
4895 		case CALIBOFFSET1ON: rst = 2; break;
4896 		case ADCOFFQUICKWAY: rst = 1; break;
4897 		case ADCOFFPREDICTSTART: rst = 200; break;
4898 		case ADCOFFPREDICTEND: rst = 500; break;
4899 		case OFFSETTUNESTEP1: rst = 5; break;
4900 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
4901 		case OFFSETAVGRATIO1: rst = 100; break;
4902 		case OFFSETEVEN1R: rst = 315; break;
4903 		case OFFSETODD1R: rst = 321; break;
4904 		case OFFSETEVEN1G: rst = 321; break;
4905 		case OFFSETODD1G: rst = 324; break;
4906 		case OFFSETEVEN1B: rst = 324; break;
4907 		case OFFSETODD1B: rst = 327; break;
4908 		case ADCOFFPREDICTR: rst = 333; break;
4909 		case ADCOFFPREDICTG: rst = 313; break;
4910 		case ADCOFFPREDICTB: rst = 317; break;
4911 		case ADCOFFEVEN1R_1ST: rst = 69; break;
4912 		case ADCOFFODD1R_1ST: rst = 69; break;
4913 		case ADCOFFEVEN1G_1ST: rst = 87; break;
4914 		case ADCOFFODD1G_1ST: rst = 87; break;
4915 		case ADCOFFEVEN1B_1ST: rst = 106; break;
4916 		case ADCOFFODD1B_1ST: rst = 106; break;
4917 		case PEAKR: rst = 62; break;
4918 		case PEAKG: rst = 66; break;
4919 		case PEAKB: rst = 54; break;
4920 		case MINR: rst = 42; break;
4921 		case MING: rst = 45; break;
4922 		case MINB: rst = 45; break;
4923 		case CALIBOFFSET2ON: rst = 0; break;
4924 		case OFFSETTUNESTEP2: rst = 1; break;
4925 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
4926 		case OFFSETAVGRATIO2: rst = 100; break;
4927 		case OFFSETEVEN2R: rst = 0; break;
4928 		case OFFSETODD2R: rst = 0; break;
4929 		case OFFSETEVEN2G: rst = 0; break;
4930 		case OFFSETODD2G: rst = 0; break;
4931 		case OFFSETEVEN2B: rst = 0; break;
4932 		case OFFSETODD2B: rst = 0; break;
4933 		case GAINHEIGHT: rst = 30; break;
4934 		case GAINTARGETFACTOR: rst = 80; break;
4935 		case CALIBPAGON: rst = 0; break;
4936 		case HIPAGR: rst = 3; break;
4937 		case HIPAGG: rst = 3; break;
4938 		case HIPAGB: rst = 2; break;
4939 		case LOPAGR: rst = 3; break;
4940 		case LOPAGG: rst = 3; break;
4941 		case LOPAGB: rst = 2; break;
4942 		case PAGR: rst = 3; break;
4943 		case PAGG: rst = 3; break;
4944 		case PAGB: rst = 2; break;
4945 		case CALIBGAIN1ON: rst = 1; break;
4946 		case GAIN1R: rst = 11; break;
4947 		case GAIN1G: rst = 9; break;
4948 		case GAIN1B: rst = 12; break;
4949 		case CALIBGAIN2ON: rst = 0; break;
4950 		case GAIN2R: rst = 4; break;
4951 		case GAIN2G: rst = 4; break;
4952 		case GAIN2B: rst = 4; break;
4953 		case TOTSHADING: rst = 0; break;
4954 		case BSHADINGON: rst = -2; break;
4955 		case BSHADINGHEIGHT: rst = 30; break;
4956 		case BSHADINGPREDIFFR: rst = 2; break;
4957 		case BSHADINGPREDIFFG: rst = 2; break;
4958 		case BSHADINGPREDIFFB: rst = 2; break;
4959 		case BSHADINGDEFCUTOFF: rst = 0; break;
4960 		case WSHADINGON: rst = 3; break;
4961 		case WSHADINGHEIGHT: rst = 24; break;
4962 		case WSHADINGPREDIFFR: rst = -1; break;
4963 		case WSHADINGPREDIFFG: rst = -1; break;
4964 		case WSHADINGPREDIFFB: rst = -1; break;
4965 	}
4966 
4967 	return rst;
4968 }
4969 
hpg3110_calibtransparent(int option, int defvalue)4970 static int hpg3110_calibtransparent(int option, int defvalue)
4971 {
4972 	int rst = defvalue;
4973 	switch(option)
4974 	{
4975 		case WSTRIPXPOS: rst = 0; break;
4976 		case WSTRIPYPOS: rst = 5100; break;
4977 		case BSTRIPXPOS: rst = 0; break;
4978 		case BSTRIPYPOS: rst = 0; break;
4979 		case BREFR: rst = 2; break;
4980 		case BREFG: rst = 2; break;
4981 		case BREFB: rst = 2; break;
4982 		case REFBITDEPTH: rst = 8; break;
4983 		case OFFSETHEIGHT: rst = 10; break;
4984 		case OFFSETNSIGMA: rst = 2; break;
4985 		case OFFSETTARGETMAX: rst = 50; break;
4986 		case OFFSETTARGETMIN: rst = 2; break;
4987 		case OFFSETAVGTARGETR: rst = 10; break;
4988 		case OFFSETAVGTARGETG: rst = 10; break;
4989 		case OFFSETAVGTARGETB: rst = 10; break;
4990 		case ADCOFFEVENODD: rst = 1; break;
4991 		case CALIBOFFSET1ON: rst = 2; break;
4992 		case ADCOFFQUICKWAY: rst = 1; break;
4993 		case ADCOFFPREDICTSTART: rst = 200; break;
4994 		case ADCOFFPREDICTEND: rst = 500; break;
4995 		case OFFSETTUNESTEP1: rst = 5; break;
4996 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
4997 		case OFFSETAVGRATIO1: rst = 100; break;
4998 		case OFFSETEVEN1R: rst = 315; break;
4999 		case OFFSETODD1R: rst = 321; break;
5000 		case OFFSETEVEN1G: rst = 321; break;
5001 		case OFFSETODD1G: rst = 324; break;
5002 		case OFFSETEVEN1B: rst = 324; break;
5003 		case OFFSETODD1B: rst = 327; break;
5004 		case ADCOFFPREDICTR: rst = 333; break;
5005 		case ADCOFFPREDICTG: rst = 313; break;
5006 		case ADCOFFPREDICTB: rst = 317; break;
5007 		case ADCOFFEVEN1R_1ST: rst = 69; break;
5008 		case ADCOFFODD1R_1ST: rst = 69; break;
5009 		case ADCOFFEVEN1G_1ST: rst = 87; break;
5010 		case ADCOFFODD1G_1ST: rst = 87; break;
5011 		case ADCOFFEVEN1B_1ST: rst = 106; break;
5012 		case ADCOFFODD1B_1ST: rst = 106; break;
5013 		case PEAKR: rst = 62; break;
5014 		case PEAKG: rst = 66; break;
5015 		case PEAKB: rst = 54; break;
5016 		case MINR: rst = 42; break;
5017 		case MING: rst = 45; break;
5018 		case MINB: rst = 45; break;
5019 		case CALIBOFFSET2ON: rst = 0; break;
5020 		case OFFSETTUNESTEP2: rst = 1; break;
5021 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
5022 		case OFFSETAVGRATIO2: rst = 100; break;
5023 		case OFFSETEVEN2R: rst = 0; break;
5024 		case OFFSETODD2R: rst = 0; break;
5025 		case OFFSETEVEN2G: rst = 0; break;
5026 		case OFFSETODD2G: rst = 0; break;
5027 		case OFFSETEVEN2B: rst = 0; break;
5028 		case OFFSETODD2B: rst = 0; break;
5029 		case GAINHEIGHT: rst = 30; break;
5030 		case GAINTARGETFACTOR: rst = 80; break;
5031 		case CALIBPAGON: rst = 0; break;
5032 		case HIPAGR: rst = 3; break;
5033 		case HIPAGG: rst = 3; break;
5034 		case HIPAGB: rst = 2; break;
5035 		case LOPAGR: rst = 3; break;
5036 		case LOPAGG: rst = 3; break;
5037 		case LOPAGB: rst = 2; break;
5038 		case PAGR: rst = 3; break;
5039 		case PAGG: rst = 3; break;
5040 		case PAGB: rst = 2; break;
5041 		case CALIBGAIN1ON: rst = 1; break;
5042 		case GAIN1R: rst = 11; break;
5043 		case GAIN1G: rst = 9; break;
5044 		case GAIN1B: rst = 12; break;
5045 		case CALIBGAIN2ON: rst = 0; break;
5046 		case GAIN2R: rst = 4; break;
5047 		case GAIN2G: rst = 4; break;
5048 		case GAIN2B: rst = 4; break;
5049 		case TOTSHADING: rst = 0; break;
5050 		case BSHADINGON: rst = -2; break;
5051 		case BSHADINGHEIGHT: rst = 30; break;
5052 		case BSHADINGPREDIFFR: rst = 2; break;
5053 		case BSHADINGPREDIFFG: rst = 2; break;
5054 		case BSHADINGPREDIFFB: rst = 2; break;
5055 		case BSHADINGDEFCUTOFF: rst = 0; break;
5056 		case WSHADINGON: rst = 3; break;
5057 		case WSHADINGHEIGHT: rst = 24; break;
5058 		case WSHADINGPREDIFFR: rst = -1; break;
5059 		case WSHADINGPREDIFFG: rst = -1; break;
5060 		case WSHADINGPREDIFFB: rst = -1; break;
5061 	}
5062 
5063 	return rst;
5064 }
5065 
fc_calibtransparent(int option, int defvalue)5066 static int fc_calibtransparent(int option, int defvalue)
5067 {
5068 	int rst;
5069 
5070 	switch(RTS_Debug->dev_model)
5071 	{
5072 		case UA4900: rst = ua4900_calibtransparent(option, defvalue); break;
5073 		case HPG2710:
5074 		case HP3800: rst = hp3800_calibtransparent(option, defvalue); break;
5075 		case HPG3010:
5076 		case HP4370: rst = hp4370_calibtransparent(option, defvalue); break;
5077 		case HPG3110: rst = hpg3110_calibtransparent(option, defvalue); break;
5078 		default    : rst = hp3970_calibtransparent(option, defvalue); break;
5079 	}
5080 
5081 	return rst;
5082 }
5083 
ua4900_calibnegative(int option, int defvalue)5084 static int ua4900_calibnegative(int option, int defvalue)
5085 {
5086 	int rst = defvalue;
5087 
5088 	switch(option)
5089 	{
5090 		case WSTRIPXPOS: rst = 0; break;
5091 		case WSTRIPYPOS: rst = 12100; break;
5092 		case BSTRIPXPOS: rst = 0; break;
5093 		case BSTRIPYPOS: rst = 0; break;
5094 		case BREFR: rst = 2; break;
5095 		case BREFG: rst = 2; break;
5096 		case BREFB: rst = 2; break;
5097 		case REFBITDEPTH: rst = 8; break;
5098 		case OFFSETHEIGHT: rst = 10; break;
5099 		case OFFSETNSIGMA: rst = 2; break;
5100 		case OFFSETTARGETMAX: rst = 50; break;
5101 		case OFFSETTARGETMIN: rst = 2; break;
5102 		case OFFSETAVGTARGETR: rst = 5; break;
5103 		case OFFSETAVGTARGETG: rst = 5; break;
5104 		case OFFSETAVGTARGETB: rst = 5; break;
5105 		case ADCOFFEVENODD: rst = 1; break;
5106 		case CALIBOFFSET1ON: rst = 2; break;
5107 		case ADCOFFQUICKWAY: rst = 1; break;
5108 		case ADCOFFPREDICTSTART: rst = 200; break;
5109 		case ADCOFFPREDICTEND: rst = 500; break;
5110 		case OFFSETTUNESTEP1: rst = 5; break;
5111 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
5112 		case OFFSETAVGRATIO1: rst = 100; break;
5113 		case OFFSETEVEN1R: rst = 283; break;
5114 		case OFFSETODD1R: rst = 283; break;
5115 		case OFFSETEVEN1G: rst = 279; break;
5116 		case OFFSETODD1G: rst = 279; break;
5117 		case OFFSETEVEN1B: rst = 295; break;
5118 		case OFFSETODD1B: rst = 295; break;
5119 		case ADCOFFPREDICTR: rst = 333; break;
5120 		case ADCOFFPREDICTG: rst = 313; break;
5121 		case ADCOFFPREDICTB: rst = 317; break;
5122 		case ADCOFFEVEN1R_1ST: rst = 69; break;
5123 		case ADCOFFODD1R_1ST: rst = 69; break;
5124 		case ADCOFFEVEN1G_1ST: rst = 87; break;
5125 		case ADCOFFODD1G_1ST: rst = 87; break;
5126 		case ADCOFFEVEN1B_1ST: rst = 106; break;
5127 		case ADCOFFODD1B_1ST: rst = 106; break;
5128 		case PEAKR: rst = 113; break;
5129 		case PEAKG: rst = 145; break;
5130 		case PEAKB: rst = 126; break;
5131 		case MINR: rst = 80; break;
5132 		case MING: rst = 105; break;
5133 		case MINB: rst = 96; break;
5134 		case CALIBOFFSET2ON: rst = 0; break;
5135 		case OFFSETTUNESTEP2: rst = 1; break;
5136 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
5137 		case OFFSETAVGRATIO2: rst = 100; break;
5138 		case OFFSETEVEN2R: rst = 0; break;
5139 		case OFFSETODD2R: rst = 0; break;
5140 		case OFFSETEVEN2G: rst = 0; break;
5141 		case OFFSETODD2G: rst = 0; break;
5142 		case OFFSETEVEN2B: rst = 0; break;
5143 		case OFFSETODD2B: rst = 0; break;
5144 		case GAINHEIGHT: rst = 10; break;
5145 		case GAINTARGETFACTOR: rst = 90; break;
5146 		case CALIBPAGON: rst = 0; break;
5147 		case PAGR: rst = 0; break;
5148 		case PAGG: rst = 0; break;
5149 		case PAGB: rst = 0; break;
5150 		case CALIBGAIN1ON: rst = 1; break;
5151 		case GAIN1R: rst = 8; break;
5152 		case GAIN1G: rst = 8; break;
5153 		case GAIN1B: rst = 8; break;
5154 		case CALIBGAIN2ON: rst = 0; break;
5155 		case GAIN2R: rst = 8; break;
5156 		case GAIN2G: rst = 8; break;
5157 		case GAIN2B: rst = 8; break;
5158 		case TOTSHADING: rst = 0; break;
5159 		case BSHADINGON: rst = 2; break;
5160 		case BSHADINGHEIGHT: rst = 10; break;
5161 		case BSHADINGPREDIFFR: rst = 2; break;
5162 		case BSHADINGPREDIFFG: rst = 2; break;
5163 		case BSHADINGPREDIFFB: rst = 2; break;
5164 		case BSHADINGDEFCUTOFF: rst = 0; break;
5165 		case WSHADINGON: rst = 3; break;
5166 		case WSHADINGHEIGHT: rst = 24; break;
5167 		case WSHADINGPREDIFFR: rst = -1; break;
5168 		case WSHADINGPREDIFFG: rst = -1; break;
5169 		case WSHADINGPREDIFFB: rst = -1; break;
5170 	}
5171 
5172 	return rst;
5173 }
5174 
hp3800_calibnegative(int option, int defvalue)5175 static int hp3800_calibnegative(int option, int defvalue)
5176 {
5177 	int rst = defvalue;
5178 
5179 	switch(option)
5180 	{
5181 		case WSTRIPXPOS: rst = 0; break;
5182 		case WSTRIPYPOS: rst = 4155; break;
5183 		case BSTRIPXPOS: rst = 0; break;
5184 		case BSTRIPYPOS: rst = 0; break;
5185 		case BREFR: rst = 10; break;
5186 		case BREFG: rst = 10; break;
5187 		case BREFB: rst = 10; break;
5188 		case REFBITDEPTH: rst = 8; break;
5189 		case OFFSETHEIGHT: rst = 10; break;
5190 		case OFFSETNSIGMA: rst = 2; break;
5191 		case OFFSETTARGETMAX: rst = 50; break;
5192 		case OFFSETTARGETMIN: rst = 2; break;
5193 		case OFFSETAVGTARGETR: rst = 10; break;
5194 		case OFFSETAVGTARGETG: rst = 10; break;
5195 		case OFFSETAVGTARGETB: rst = 10; break;
5196 		case ADCOFFEVENODD: rst = 1; break;
5197 		case CALIBOFFSET1ON: rst = 2; break;
5198 		case ADCOFFQUICKWAY: rst = 1; break;
5199 		case ADCOFFPREDICTSTART: rst = 200; break;
5200 		case ADCOFFPREDICTEND: rst = 500; break;
5201 		case OFFSETTUNESTEP1: rst = 5; break;
5202 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
5203 		case OFFSETAVGRATIO1: rst = 100; break;
5204 		case OFFSETEVEN1R: rst = 315; break;
5205 		case OFFSETODD1R: rst = 315; break;
5206 		case OFFSETEVEN1G: rst = 307; break;
5207 		case OFFSETODD1G: rst = 304; break;
5208 		case OFFSETEVEN1B: rst = 309; break;
5209 		case OFFSETODD1B: rst = 309; break;
5210 		case ADCOFFPREDICTR: rst = 333; break;
5211 		case ADCOFFPREDICTG: rst = 313; break;
5212 		case ADCOFFPREDICTB: rst = 317; break;
5213 		case ADCOFFEVEN1R_1ST: rst = 69; break;
5214 		case ADCOFFODD1R_1ST: rst = 69; break;
5215 		case ADCOFFEVEN1G_1ST: rst = 87; break;
5216 		case ADCOFFODD1G_1ST: rst = 87; break;
5217 		case ADCOFFEVEN1B_1ST: rst = 106; break;
5218 		case ADCOFFODD1B_1ST: rst = 106; break;
5219 		case PEAKR: rst = 37; break;
5220 		case PEAKG: rst = 234; break;
5221 		case PEAKB: rst = 202; break;
5222 		case MINR: rst = 32; break;
5223 		case MING: rst = 195; break;
5224 		case MINB: rst = 166; break;
5225 		case CALIBOFFSET2ON: rst = 0; break;
5226 		case OFFSETTUNESTEP2: rst = 1; break;
5227 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
5228 		case OFFSETAVGRATIO2: rst = 100; break;
5229 		case OFFSETEVEN2R: rst = 0; break;
5230 		case OFFSETODD2R: rst = 0; break;
5231 		case OFFSETEVEN2G: rst = 0; break;
5232 		case OFFSETODD2G: rst = 0; break;
5233 		case OFFSETEVEN2B: rst = 0; break;
5234 		case OFFSETODD2B: rst = 0; break;
5235 		case GAINHEIGHT: rst = 30; break;
5236 		case GAINTARGETFACTOR: rst = 90; break;
5237 		case CALIBPAGON: rst = 0; break;
5238 		case PAGR: rst = 3; break;
5239 		case PAGG: rst = 3; break;
5240 		case PAGB: rst = 3; break;
5241 		case CALIBGAIN1ON: rst = 1; break;
5242 		case GAIN1R: rst = 30; break;
5243 		case GAIN1G: rst = 3; break;
5244 		case GAIN1B: rst = 0; break;
5245 		case CALIBGAIN2ON: rst = 0; break;
5246 		case GAIN2R: rst = 4; break;
5247 		case GAIN2G: rst = 4; break;
5248 		case GAIN2B: rst = 4; break;
5249 		case TOTSHADING: rst = 0; break;
5250 		case BSHADINGON: rst = -2; break;
5251 		case BSHADINGHEIGHT: rst = 30; break;
5252 		case BSHADINGPREDIFFR: rst = 2; break;
5253 		case BSHADINGPREDIFFG: rst = 2; break;
5254 		case BSHADINGPREDIFFB: rst = 2; break;
5255 		case BSHADINGDEFCUTOFF: rst = 0; break;
5256 		case WSHADINGON: rst = 3; break;
5257 		case WSHADINGHEIGHT: rst = 24; break;
5258 		case WSHADINGPREDIFFR: rst = -1; break;
5259 		case WSHADINGPREDIFFG: rst = -1; break;
5260 		case WSHADINGPREDIFFB: rst = -1; break;
5261 	}
5262 
5263 	return rst;
5264 }
5265 
hp3970_calibnegative(int option, int defvalue)5266 static int hp3970_calibnegative(int option, int defvalue)
5267 {
5268 	int rst = defvalue;
5269 
5270 	switch(option)
5271 	{
5272 		case WSTRIPXPOS: rst = 0; break;
5273 		case WSTRIPYPOS: rst = 7500; break;
5274 		case BSTRIPXPOS: rst = 0; break;
5275 		case BSTRIPYPOS: rst = 0; break;
5276 		case BREFR: rst = 10; break;
5277 		case BREFG: rst = 10; break;
5278 		case BREFB: rst = 10; break;
5279 		case REFBITDEPTH: rst = 8; break;
5280 		case OFFSETHEIGHT: rst = 10; break;
5281 		case OFFSETNSIGMA: rst = 2; break;
5282 		case OFFSETTARGETMAX: rst = 50; break;
5283 		case OFFSETTARGETMIN: rst = 2; break;
5284 		case OFFSETAVGTARGETR: rst = 10; break;
5285 		case OFFSETAVGTARGETG: rst = 10; break;
5286 		case OFFSETAVGTARGETB: rst = 10; break;
5287 		case ADCOFFEVENODD: rst = 1; break;
5288 		case CALIBOFFSET1ON: rst = 2; break;
5289 		case ADCOFFQUICKWAY: rst = 1; break;
5290 		case ADCOFFPREDICTSTART: rst = 200; break;
5291 		case ADCOFFPREDICTEND: rst = 500; break;
5292 		case OFFSETTUNESTEP1: rst = 5; break;
5293 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
5294 		case OFFSETAVGRATIO1: rst = 100; break;
5295 		case OFFSETEVEN1R: rst = 294; break;
5296 		case OFFSETODD1R: rst = 294; break;
5297 		case OFFSETEVEN1G: rst = 276; break;
5298 		case OFFSETODD1G: rst = 276; break;
5299 		case OFFSETEVEN1B: rst = 266; break;
5300 		case OFFSETODD1B: rst = 266; break;
5301 		case ADCOFFPREDICTR: rst = 333; break;
5302 		case ADCOFFPREDICTG: rst = 313; break;
5303 		case ADCOFFPREDICTB: rst = 317; break;
5304 		case ADCOFFEVEN1R_1ST: rst = 69; break;
5305 		case ADCOFFODD1R_1ST: rst = 69; break;
5306 		case ADCOFFEVEN1G_1ST: rst = 87; break;
5307 		case ADCOFFODD1G_1ST: rst = 87; break;
5308 		case ADCOFFEVEN1B_1ST: rst = 106; break;
5309 		case ADCOFFODD1B_1ST: rst = 106; break;
5310 		case PEAKR: rst = 33; break;
5311 		case PEAKG: rst = 75; break;
5312 		case PEAKB: rst = 105; break;
5313 		case MINR: rst = 19; break;
5314 		case MING: rst = 34; break;
5315 		case MINB: rst = 42; break;
5316 		case CALIBOFFSET2ON: rst = 0; break;
5317 		case OFFSETTUNESTEP2: rst = 1; break;
5318 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
5319 		case OFFSETAVGRATIO2: rst = 100; break;
5320 		case OFFSETEVEN2R: rst = 0; break;
5321 		case OFFSETODD2R: rst = 0; break;
5322 		case OFFSETEVEN2G: rst = 0; break;
5323 		case OFFSETODD2G: rst = 0; break;
5324 		case OFFSETEVEN2B: rst = 0; break;
5325 		case OFFSETODD2B: rst = 0; break;
5326 		case GAINHEIGHT: rst = 30; break;
5327 		case GAINTARGETFACTOR: rst = 90; break;
5328 		case CALIBPAGON: rst = 0; break;
5329 		case PAGR: rst = 3; break;
5330 		case PAGG: rst = 3; break;
5331 		case PAGB: rst = 3; break;
5332 		case CALIBGAIN1ON: rst = 1; break;
5333 		case GAIN1R: rst = 23; break;
5334 		case GAIN1G: rst = 18; break;
5335 		case GAIN1B: rst = 23; break;
5336 		case CALIBGAIN2ON: rst = 0; break;
5337 		case GAIN2R: rst = 4; break;
5338 		case GAIN2G: rst = 4; break;
5339 		case GAIN2B: rst = 4; break;
5340 		case TOTSHADING: rst = 0; break;
5341 		case BSHADINGON: rst = 1; break;
5342 		case BSHADINGHEIGHT: rst = 30; break;
5343 		case BSHADINGPREDIFFR: rst = 2; break;
5344 		case BSHADINGPREDIFFG: rst = 2; break;
5345 		case BSHADINGPREDIFFB: rst = 2; break;
5346 		case BSHADINGDEFCUTOFF: rst = 0; break;
5347 		case WSHADINGON: rst = 3; break;
5348 		case WSHADINGHEIGHT: rst = 24; break;
5349 		case WSHADINGPREDIFFR: rst = -1; break;
5350 		case WSHADINGPREDIFFG: rst = -1; break;
5351 		case WSHADINGPREDIFFB: rst = -1; break;
5352 	}
5353 
5354 	return rst;
5355 }
5356 
hpg3110_calibnegative(int option, int defvalue)5357 static int hpg3110_calibnegative(int option, int defvalue)
5358 {
5359 	int rst = defvalue;
5360 
5361 	switch(option)
5362 	{
5363 		case WSTRIPXPOS: rst = 0; break;
5364 		case WSTRIPYPOS: rst = 5100; break;
5365 		case BSTRIPXPOS: rst = 0; break;
5366 		case BSTRIPYPOS: rst = 0; break;
5367 		case BREFR: rst = 10; break;
5368 		case BREFG: rst = 10; break;
5369 		case BREFB: rst = 10; break;
5370 		case REFBITDEPTH: rst = 8; break;
5371 		case OFFSETHEIGHT: rst = 10; break;
5372 		case OFFSETNSIGMA: rst = 2; break;
5373 		case OFFSETTARGETMAX: rst = 50; break;
5374 		case OFFSETTARGETMIN: rst = 2; break;
5375 		case OFFSETAVGTARGETR: rst = 10; break;
5376 		case OFFSETAVGTARGETG: rst = 10; break;
5377 		case OFFSETAVGTARGETB: rst = 10; break;
5378 		case ADCOFFEVENODD: rst = 1; break;
5379 		case CALIBOFFSET1ON: rst = 2; break;
5380 		case ADCOFFQUICKWAY: rst = 1; break;
5381 		case ADCOFFPREDICTSTART: rst = 200; break;
5382 		case ADCOFFPREDICTEND: rst = 500; break;
5383 		case OFFSETTUNESTEP1: rst = 5; break;
5384 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
5385 		case OFFSETAVGRATIO1: rst = 100; break;
5386 		case OFFSETEVEN1R: rst = 308; break;
5387 		case OFFSETODD1R: rst = 308; break;
5388 		case OFFSETEVEN1G: rst = 317; break;
5389 		case OFFSETODD1G: rst = 317; break;
5390 		case OFFSETEVEN1B: rst = 319; break;
5391 		case OFFSETODD1B: rst = 319; break;
5392 		case ADCOFFPREDICTR: rst = 333; break;
5393 		case ADCOFFPREDICTG: rst = 313; break;
5394 		case ADCOFFPREDICTB: rst = 317; break;
5395 		case ADCOFFEVEN1R_1ST: rst = 69; break;
5396 		case ADCOFFODD1R_1ST: rst = 69; break;
5397 		case ADCOFFEVEN1G_1ST: rst = 87; break;
5398 		case ADCOFFODD1G_1ST: rst = 87; break;
5399 		case ADCOFFEVEN1B_1ST: rst = 106; break;
5400 		case ADCOFFODD1B_1ST: rst = 106; break;
5401 		case PEAKR: rst = 116; break;
5402 		case PEAKG: rst = 126; break;
5403 		case PEAKB: rst = 102; break;
5404 		case MINR: rst = 103; break;
5405 		case MING: rst = 112; break;
5406 		case MINB: rst = 80; break;
5407 		case CALIBOFFSET2ON: rst = 0; break;
5408 		case OFFSETTUNESTEP2: rst = 1; break;
5409 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
5410 		case OFFSETAVGRATIO2: rst = 100; break;
5411 		case OFFSETEVEN2R: rst = 0; break;
5412 		case OFFSETODD2R: rst = 0; break;
5413 		case OFFSETEVEN2G: rst = 0; break;
5414 		case OFFSETODD2G: rst = 0; break;
5415 		case OFFSETEVEN2B: rst = 0; break;
5416 		case OFFSETODD2B: rst = 0; break;
5417 		case GAINHEIGHT: rst = 30; break;
5418 		case GAINTARGETFACTOR: rst = 80; break;
5419 		case CALIBPAGON: rst = 0; break;
5420 		case HIPAGR: rst = 3; break;
5421 		case HIPAGG: rst = 3; break;
5422 		case HIPAGB: rst = 3; break;
5423 		case LOPAGR: rst = 3; break;
5424 		case LOPAGG: rst = 3; break;
5425 		case LOPAGB: rst = 3; break;
5426 		case PAGR: rst = 3; break;
5427 		case PAGG: rst = 3; break;
5428 		case PAGB: rst = 3; break;
5429 		case CALIBGAIN1ON: rst = 1; break;
5430 		case GAIN1R: rst = 6; break;
5431 		case GAIN1G: rst = 1; break;
5432 		case GAIN1B: rst = 7; break;
5433 		case CALIBGAIN2ON: rst = 0; break;
5434 		case GAIN2R: rst = 4; break;
5435 		case GAIN2G: rst = 4; break;
5436 		case GAIN2B: rst = 4; break;
5437 		case TOTSHADING: rst = 0; break;
5438 		case BSHADINGON: rst = -2; break;
5439 		case BSHADINGHEIGHT: rst = 30; break;
5440 		case BSHADINGPREDIFFR: rst = 2; break;
5441 		case BSHADINGPREDIFFG: rst = 2; break;
5442 		case BSHADINGPREDIFFB: rst = 2; break;
5443 		case BSHADINGDEFCUTOFF: rst = 0; break;
5444 		case WSHADINGON: rst = 3; break;
5445 		case WSHADINGHEIGHT: rst = 24; break;
5446 		case WSHADINGPREDIFFR: rst = -1; break;
5447 		case WSHADINGPREDIFFG: rst = -1; break;
5448 		case WSHADINGPREDIFFB: rst = -1; break;
5449 	}
5450 
5451 	return rst;
5452 }
5453 
hp4370_calibnegative(int option, int defvalue)5454 static int hp4370_calibnegative(int option, int defvalue)
5455 {
5456 	int rst = defvalue;
5457 
5458 	switch(option)
5459 	{
5460 		case WSTRIPXPOS: rst = 0; break;
5461 		case WSTRIPYPOS: rst = 6580; break;
5462 		case BSTRIPXPOS: rst = 0; break;
5463 		case BSTRIPYPOS: rst = 0; break;
5464 		case BREFR: rst = 10; break;
5465 		case BREFG: rst = 10; break;
5466 		case BREFB: rst = 10; break;
5467 		case REFBITDEPTH: rst = 8; break;
5468 		case OFFSETHEIGHT: rst = 10; break;
5469 		case OFFSETNSIGMA: rst = 2; break;
5470 		case OFFSETTARGETMAX: rst = 50; break;
5471 		case OFFSETTARGETMIN: rst = 2; break;
5472 		case OFFSETAVGTARGETR: rst = 10; break;
5473 		case OFFSETAVGTARGETG: rst = 10; break;
5474 		case OFFSETAVGTARGETB: rst = 10; break;
5475 		case ADCOFFEVENODD: rst = 1; break;
5476 		case CALIBOFFSET1ON: rst = 2; break;
5477 		case ADCOFFQUICKWAY: rst = 1; break;
5478 		case ADCOFFPREDICTSTART: rst = 200; break;
5479 		case ADCOFFPREDICTEND: rst = 500; break;
5480 		case OFFSETTUNESTEP1: rst = 5; break;
5481 		case OFFSETBOUNDARYRATIO1: rst = 100; break;
5482 		case OFFSETAVGRATIO1: rst = 100; break;
5483 		case OFFSETEVEN1R: rst = 308; break;
5484 		case OFFSETODD1R: rst = 308; break;
5485 		case OFFSETEVEN1G: rst = 317; break;
5486 		case OFFSETODD1G: rst = 317; break;
5487 		case OFFSETEVEN1B: rst = 319; break;
5488 		case OFFSETODD1B: rst = 319; break;
5489 		case ADCOFFPREDICTR: rst = 333; break;
5490 		case ADCOFFPREDICTG: rst = 313; break;
5491 		case ADCOFFPREDICTB: rst = 317; break;
5492 		case ADCOFFEVEN1R_1ST: rst = 69; break;
5493 		case ADCOFFODD1R_1ST: rst = 69; break;
5494 		case ADCOFFEVEN1G_1ST: rst = 87; break;
5495 		case ADCOFFODD1G_1ST: rst = 87; break;
5496 		case ADCOFFEVEN1B_1ST: rst = 106; break;
5497 		case ADCOFFODD1B_1ST: rst = 106; break;
5498 		case PEAKR: rst = 116; break;
5499 		case PEAKG: rst = 126; break;
5500 		case PEAKB: rst = 102; break;
5501 		case MINR: rst = 103; break;
5502 		case MING: rst = 112; break;
5503 		case MINB: rst = 80; break;
5504 		case CALIBOFFSET2ON: rst = 0; break;
5505 		case OFFSETTUNESTEP2: rst = 1; break;
5506 		case OFFSETBOUNDARYRATIO2: rst = 100; break;
5507 		case OFFSETAVGRATIO2: rst = 100; break;
5508 		case OFFSETEVEN2R: rst = 0; break;
5509 		case OFFSETODD2R: rst = 0; break;
5510 		case OFFSETEVEN2G: rst = 0; break;
5511 		case OFFSETODD2G: rst = 0; break;
5512 		case OFFSETEVEN2B: rst = 0; break;
5513 		case OFFSETODD2B: rst = 0; break;
5514 		case GAINHEIGHT: rst = 30; break;
5515 		case GAINTARGETFACTOR: rst = 80; break;
5516 		case CALIBPAGON: rst = 0; break;
5517 		case HIPAGR: rst = 3; break;
5518 		case HIPAGG: rst = 3; break;
5519 		case HIPAGB: rst = 3; break;
5520 		case LOPAGR: rst = 3; break;
5521 		case LOPAGG: rst = 3; break;
5522 		case LOPAGB: rst = 3; break;
5523 		case PAGR: rst = 3; break;
5524 		case PAGG: rst = 3; break;
5525 		case PAGB: rst = 3; break;
5526 		case CALIBGAIN1ON: rst = 1; break;
5527 		case GAIN1R: rst = 6; break;
5528 		case GAIN1G: rst = 1; break;
5529 		case GAIN1B: rst = 7; break;
5530 		case CALIBGAIN2ON: rst = 0; break;
5531 		case GAIN2R: rst = 4; break;
5532 		case GAIN2G: rst = 4; break;
5533 		case GAIN2B: rst = 4; break;
5534 		case TOTSHADING: rst = 0; break;
5535 		case BSHADINGON: rst = -2; break;
5536 		case BSHADINGHEIGHT: rst = 30; break;
5537 		case BSHADINGPREDIFFR: rst = 2; break;
5538 		case BSHADINGPREDIFFG: rst = 2; break;
5539 		case BSHADINGPREDIFFB: rst = 2; break;
5540 		case BSHADINGDEFCUTOFF: rst = 0; break;
5541 		case WSHADINGON: rst = 3; break;
5542 		case WSHADINGHEIGHT: rst = 24; break;
5543 		case WSHADINGPREDIFFR: rst = -1; break;
5544 		case WSHADINGPREDIFFG: rst = -1; break;
5545 		case WSHADINGPREDIFFB: rst = -1; break;
5546 	}
5547 
5548 	return rst;
5549 }
5550 
fc_calibnegative(int option, int defvalue)5551 static int fc_calibnegative(int option, int defvalue)
5552 {
5553 	int rst;
5554 
5555 	switch(RTS_Debug->dev_model)
5556 	{
5557 		case UA4900: rst = ua4900_calibnegative(option, defvalue); break;
5558 		case HPG2710:
5559 		case HP3800: rst = hp3800_calibnegative(option, defvalue); break;
5560 		case HPG3010:
5561 		case HP4370: rst = hp4370_calibnegative(option, defvalue); break;
5562 		case HPG3110: rst = hpg3110_calibnegative(option, defvalue); break;
5563 		default    : rst = hp3970_calibnegative(option, defvalue); break;
5564 	}
5565 
5566 	return rst;
5567 }
5568 
fc_scaninfo_get(int option, int defvalue)5569 static int fc_scaninfo_get(int option, int defvalue)
5570 {
5571 	int value[] = {1, 0, 0, 0, 0, 100};
5572 	int ua4900_value[] = {1, 0xcdcdcdcd, 0xcdcdcdcd, 0xcdcdcdcd, 0xcdcdcdcd, 100};
5573 
5574 	int rst = defvalue;
5575 	int *myvalue = NULL;
5576 
5577 	switch(RTS_Debug->dev_model)
5578 	{
5579 		case UA4900: myvalue = ua4900_value; break;
5580 		default: myvalue = value; break;
5581 	}
5582 
5583 	switch(option)
5584 	{
5585 		case PARKHOMEAFTERCALIB: rst = myvalue[0]; break;
5586 		case SHADINGTIME_16BIT: rst = myvalue[1]; break;
5587 		case SHADOWTIME_16BIT: rst = myvalue[2]; break;
5588 		case SHADINGTIME_8BIT: rst = myvalue[3]; break;
5589 		case SHADOWTIME_8BIT: rst = myvalue[4]; break;
5590 		case PREVIEWDPI: rst = myvalue[5]; break;
5591 	}
5592 
5593 	return rst;
5594 }
5595 
5596 /* fitcalibrate */
fitcalibrate_get(int section, int option, int defvalue)5597 static int fitcalibrate_get(int section, int option, int defvalue)
5598 {
5599 	int rst = defvalue;
5600 
5601 	switch(section)
5602 	{
5603 		case CALIBREFLECTIVE:
5604 			rst = fc_calibreflective(option, defvalue); break;
5605 		case CALIBTRANSPARENT:
5606 			rst = fc_calibtransparent(option, defvalue); break;
5607 		case CALIBNEGATIVEFILM:
5608 			rst = fc_calibnegative(option, defvalue); break;
5609 		case SCANINFO:
5610 			rst = fc_scaninfo_get(option, defvalue); break;
5611 	}
5612 
5613 	return rst;
5614 }
5615 
srt_hp3800_scanparam_get(int option, int defvalue)5616 static int srt_hp3800_scanparam_get(int option, int defvalue)
5617 {
5618 	int rst = defvalue;
5619 
5620 	/* t_rtinifile */
5621 	int value3[] = {1, 0, 0, 0, 1, 12, 0, 1, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 0};
5622 
5623 	int *value = value3;
5624 
5625 	if (value != NULL)
5626 		switch(option)
5627 		{
5628 			case ARRANGELINE: rst = value[0]; break;
5629 			case COMPRESSION: rst = value[1]; break;
5630 			case TA_X_START:  rst = value[2]; break;
5631 			case TA_Y_START:  rst = value[3]; break;
5632 			case DPIGAINCONTROL600: rst = value[4]; break;
5633 			case CRVS:  rst = value[5]; break;
5634 			case MLOCK: rst = value[6]; break;
5635 			case ENABLEWARMUP:  rst = value[7]; break;
5636 			case NMAXTARGET:    rst = value[8]; break;
5637 			case NMINTARGET:    rst = value[9]; break;
5638 			case NMAXTARGETTA:  rst = value[10]; break;
5639 			case NMINTARGETTA:  rst = value[11]; break;
5640 			case NMAXTARGETNEG: rst = value[12]; break;
5641 			case NMINTARGETNEG: rst = value[13]; break;
5642 			case STABLEDIFF: rst = value[14]; break;
5643 			case DELTAPWM:   rst = value[15]; break;
5644 			case PWMLAMPLEVEL:   rst = value[16]; break;
5645 			case TMAPWMDUTY: rst = value[17]; break;
5646 			case LEFTLEADING: rst = value[18]; break;
5647 	}
5648 
5649 	return rst;
5650 }
5651 
srt_hp3970_scanparam_get(int file, int option, int defvalue)5652 static int srt_hp3970_scanparam_get(int file, int option, int defvalue)
5653 {
5654 	int rst = defvalue;
5655 	/* s_rtinifile */
5656 	int value1[] = {1, 0, 150, 0, 1, 6, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 360};
5657 	/* s_usb1inifile */
5658 	int value2[] = {1, 0, 150, 0, 1, 6, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 360};
5659 	/* t_rtinifile */
5660 	int value3[] = {1, 0, 150, 0, 1, 12, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 0};
5661 	/* t_usb1inifile */
5662 	int value4[] = {1, 0, 150, 0, 1, 12, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 0};
5663 
5664 	int *value = NULL;
5665 
5666 	switch(file)
5667 	{
5668 		case S_RTINIFILE: value = value1; break;
5669 		case S_USB1INIFILE: value = value2; break;
5670 		case T_RTINIFILE: value = value3; break;
5671 		case T_USB1INIFILE: value = value4; break;
5672 	}
5673 
5674 	if (value != NULL)
5675 		switch(option)
5676 		{
5677 			case ARRANGELINE: rst = value[0]; break;
5678 			case COMPRESSION: rst = value[1]; break;
5679 			case TA_X_START:  rst = value[2]; break;
5680 			case TA_Y_START:  rst = value[3]; break;
5681 			case DPIGAINCONTROL600: rst = value[4]; break;
5682 			case CRVS:  rst = value[5]; break;
5683 			case MLOCK: rst = value[6]; break;
5684 			case ENABLEWARMUP:  rst = value[7]; break;
5685 			case NMAXTARGET:    rst = value[8]; break;
5686 			case NMINTARGET:    rst = value[9]; break;
5687 			case NMAXTARGETTA:  rst = value[10]; break;
5688 			case NMINTARGETTA:  rst = value[11]; break;
5689 			case NMAXTARGETNEG: rst = value[12]; break;
5690 			case NMINTARGETNEG: rst = value[13]; break;
5691 			case STABLEDIFF: rst = value[14]; break;
5692 			case DELTAPWM:   rst = value[15]; break;
5693 			case PWMLAMPLEVEL:   rst = value[16]; break;
5694 			case TMAPWMDUTY: rst = value[17]; break;
5695 			case LEFTLEADING: rst = value[18]; break;
5696 	}
5697 
5698 	return rst;
5699 }
5700 
srt_hp4370_scanparam_get(int file, int option, int defvalue)5701 static int srt_hp4370_scanparam_get(int file, int option, int defvalue)
5702 {
5703 	/* s_rtinifile */
5704 	int value1[] = {1, 0, 150, 0, 1, 6, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 360};
5705 	/* s_usb1inifile */
5706 	int value2[] = {1, 0, 150, 0, 1, 6, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 360};
5707 	/* t_rtinifile */
5708 	int value3[] = {1, 0, 150, 0, 1, 12, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 0};
5709 	/* t_usb1inifile */
5710 	int value4[] = {1, 0, 150, 0, 1, 12, 0, 0, 170, 140, 40, 30, 40, 30, 1500, 20, 0, 36, 0};
5711 	int *value = NULL;
5712 
5713 	int rst = defvalue;
5714 
5715 	switch(file)
5716 	{
5717 		case S_RTINIFILE: value = value1; break;
5718 		case S_USB1INIFILE: value = value2; break;
5719 		case T_RTINIFILE: value = value3; break;
5720 		case T_USB1INIFILE: value = value4; break;
5721 	}
5722 
5723 	if (value != NULL)
5724 		switch(option)
5725 		{
5726 			case ARRANGELINE: rst = value[0]; break;
5727 			case COMPRESSION: rst = value[1]; break;
5728 			case TA_X_START:  rst = value[2]; break;
5729 			case TA_Y_START:  rst = value[3]; break;
5730 			case DPIGAINCONTROL600: rst = value[4]; break;
5731 			case CRVS:  rst = value[5]; break;
5732 			case MLOCK: rst = value[6]; break;
5733 			case ENABLEWARMUP: rst = value[7]; break;
5734 			case NMAXTARGET:   rst = value[8]; break;
5735 			case NMINTARGET:   rst = value[9]; break;
5736 			case NMAXTARGETTA: rst = value[10]; break;
5737 			case NMINTARGETTA: rst = value[11]; break;
5738 			case NMAXTARGETNEG: rst = value[12]; break;
5739 			case NMINTARGETNEG: rst = value[13]; break;
5740 			case STABLEDIFF: rst = value[14]; break;
5741 			case DELTAPWM: rst = value[15]; break;
5742 			case PWMLAMPLEVEL: rst = value[16]; break;
5743 			case TMAPWMDUTY: rst = value[17]; break;
5744 			case LEFTLEADING: rst = value[18]; break;
5745 	}
5746 
5747 	return rst;
5748 }
5749 
srt_scancali_get(int file, int option, int defvalue)5750 static int srt_scancali_get(int file, int option, int defvalue)
5751 {
5752 	int rst = defvalue;
5753 	/* s_rtinifile */
5754 	int value1[] = {3, 3, 3, 14, 4, 4, 41, 41, 42, 41, 41, 42, 91, 91,
5755 	                53, 53, 48, 48, 104, 104, 59, 59, 64,64};
5756 	/* s_usb1inifile */
5757 	int value2[] = {3, 3, 3, 14, 4, 4, 41, 41, 42, 41, 41, 42, 91, 91,
5758 	                53, 53, 48, 48, 104, 104, 59, 59, 64, 64};
5759 	/* t_rtinifile*/
5760 	int value3[] = {3, 3, 3, 14, 4, 4, 41, 41, 42, 41, 41, 42, 270, 270,
5761 	                511, 511, 511, 511, 270, 270, 511, 511, 511, 511};
5762 	/* t_usb1inifile*/
5763 	int value4[] = {3, 3, 3, 14, 4, 4, 41, 41, 42, 41, 41, 42, 270, 270,
5764 	                511, 511, 511, 511, 270, 270, 511, 511, 511, 511};
5765 	int *value = NULL;
5766 
5767 	switch(file)
5768 	{
5769 		case S_RTINIFILE: value = value1; break;
5770 		case S_USB1INIFILE: value = value2; break;
5771 		case T_RTINIFILE: value = value3; break;
5772 		case T_USB1INIFILE: value = value4; break;
5773 	}
5774 
5775 	if (value != NULL)
5776 		switch(option)
5777 		{
5778 			case PGA1: rst = value[0]; break;
5779 			case PGA2: rst = value[1]; break;
5780 			case PGA3: rst = value[2]; break;
5781 			case VGAGAIN11: rst = value[3]; break;
5782 			case VGAGAIN12: rst = value[4]; break;
5783 			case VGAGAIN13: rst = value[5]; break;
5784 			case DCSTEPEVEN1: rst = value[6]; break;
5785 			case DCSTEPODD1: rst = value[7]; break;
5786 			case DCSTEPEVEN2: rst = value[8]; break;
5787 			case DCSTEPODD2: rst = value[9]; break;
5788 			case DCSTEPEVEN3: rst = value[10]; break;
5789 			case DCSTEPODD3: rst = value[11]; break;
5790 			case FIRSTDCOFFSETEVEN11: rst = value[12]; break;
5791 			case FIRSTDCOFFSETODD11: rst = value[13]; break;
5792 			case FIRSTDCOFFSETEVEN12: rst = value[14]; break;
5793 			case FIRSTDCOFFSETODD12: rst = value[15]; break;
5794 			case FIRSTDCOFFSETEVEN13: rst = value[16]; break;
5795 			case FIRSTDCOFFSETODD13: rst = value[17]; break;
5796 			case DCOFFSETEVEN11: rst = value[18]; break;
5797 			case DCOFFSETODD11: rst = value[19]; break;
5798 			case DCOFFSETEVEN12: rst = value[20]; break;
5799 			case DCOFFSETODD12: rst = value[21]; break;
5800 			case DCOFFSETEVEN13: rst = value[22]; break;
5801 			case DCOFFSETODD13: rst = value[23]; break;
5802 		}
5803 
5804 	return rst;
5805 }
5806 
srt_truegrayparam_get(int file, int option, int defvalue)5807 static int srt_truegrayparam_get(int file, int option, int defvalue)
5808 {
5809 	int rst = defvalue;
5810 	/* s_rtinifile */
5811 	int value1[] = {100, 30, 59, 11};
5812 	/* s_usb1inifile */
5813 	int value2[] = {100, 30, 59, 11};
5814 	/* t_rtinifile */
5815 	int value3[] = {100, 30, 59, 11};
5816 	/* t_usb1inifile */
5817 	int value4[] = {100, 30, 59, 11};
5818 	int *value = NULL;
5819 
5820 	switch(file)
5821 	{
5822 		case S_RTINIFILE: value = value1; break;
5823 		case S_USB1INIFILE: value = value2; break;
5824 		case T_RTINIFILE: value = value3; break;
5825 		case T_USB1INIFILE: value = value4; break;
5826 	}
5827 
5828 	if (value != NULL)
5829 		switch(option)
5830 		{
5831 			case SHADINGBASE: rst = value[0]; break;
5832 			case SHADINGFACT1: rst = value[1]; break;
5833 			case SHADINGFACT2: rst = value[2]; break;
5834 			case SHADINGFACT3: rst = value[3]; break;
5835 		}
5836 
5837 	return rst;
5838 }
5839 
srt_caliparam_get(int file, int option, int defvalue)5840 static int srt_caliparam_get(int file, int option, int defvalue)
5841 {
5842 	int rst = defvalue;
5843 	/* s_rtinifile */
5844 	int value1[] = {0xffff};
5845 	/* s_usb1inifile */
5846 	int value2[] = {0xffff};
5847 	/* t_rtinifile */
5848 	int value3[] = {0xffff};
5849 	/* t_usb1inifile */
5850 	int value4[] = {0xffff};
5851 	int *value = NULL;
5852 
5853 	switch(file)
5854 	{
5855 		case S_RTINIFILE: value = value1; break;
5856 		case S_USB1INIFILE: value = value2; break;
5857 		case T_RTINIFILE: value = value3; break;
5858 		case T_USB1INIFILE: value = value4; break;
5859 	}
5860 
5861 	if (value != NULL)
5862 		switch(option)
5863 		{
5864 			case PIXELDARKLEVEL: rst = value[0]; break;
5865 		}
5866 
5867 	return rst;
5868 }
5869 
srt_hp3800_platform_get(int option, int defvalue)5870 static int srt_hp3800_platform_get(int option, int defvalue)
5871 {
5872 	/* s_rtinifile*/
5873 	int value1[] = {100, 99, 1214636};
5874 
5875 	int *value = value1;
5876 	int rst = defvalue;
5877 
5878 	if (value != NULL)
5879 	{
5880 		switch(option)
5881 		{
5882 			case BINARYTHRESHOLDH: rst = value[0]; break;
5883 			case BINARYTHRESHOLDL: rst = value[1]; break;
5884 			case CLOSETIME: rst = value[2]; break;
5885 		}
5886 	}
5887 
5888 	return rst;
5889 }
5890 
srt_hp3970_platform_get(int option, int defvalue)5891 static int srt_hp3970_platform_get(int option, int defvalue)
5892 {
5893 	/* s_rtinifile*/
5894 	int value1[] = {128, 127, 1214636};
5895 
5896 	int *value = value1;
5897 	int rst = defvalue;
5898 
5899 	if (value != NULL)
5900 	{
5901 		switch(option)
5902 		{
5903 			case BINARYTHRESHOLDH: rst = value[0]; break;
5904 			case BINARYTHRESHOLDL: rst = value[1]; break;
5905 			case CLOSETIME: rst = value[2]; break;
5906 		}
5907 	}
5908 
5909 	return rst;
5910 }
5911 
5912 
srt_ua4900_platform_get(int option, int defvalue)5913 static int srt_ua4900_platform_get(int option, int defvalue)
5914 {
5915 	int value1[] = {128, 127, 1214636};
5916 	int *value = value1;
5917 	int rst = defvalue;
5918 
5919 	if (value != NULL)
5920 	{
5921 		switch(option)
5922 		{
5923 			case BINARYTHRESHOLDH: rst = value[0]; break;
5924 			case BINARYTHRESHOLDL: rst = value[1]; break;
5925 			case CLOSETIME: rst = value[2]; break;
5926 		}
5927 	}
5928 
5929 	return rst;
5930 }
5931 
srt_hp4370_platform_get(int option, int defvalue)5932 static int srt_hp4370_platform_get(int option, int defvalue)
5933 {
5934 	/* t_rtinifile */
5935 	int value3[] = {128, 127, 1214636};
5936 
5937 	int *value = value3;
5938 	int rst = defvalue;
5939 
5940 	if (value != NULL)
5941 	{
5942 		switch(option)
5943 		{
5944 			case BINARYTHRESHOLDH: rst = value[0]; break;
5945 			case BINARYTHRESHOLDL: rst = value[1]; break;
5946 			case CLOSETIME: rst = value[2]; break;
5947 		}
5948 	}
5949 
5950 	return rst;
5951 }
5952 
srt_scaninfo_get(int file, int option, int defvalue)5953 static int srt_scaninfo_get(int file, int option, int defvalue)
5954 {
5955 	int rst = defvalue;
5956 	int value1[] = {0, 0, 0, 0};
5957 	int value2[] = {0, 0, 0, 0};
5958 	int value3[] = {0, 0, 0, 0};
5959 	int value4[] = {0, 0, 0, 0};
5960 	int *value = NULL;
5961 
5962 	switch(file)
5963 	{
5964 		case S_RTINIFILE: value = value1; break;
5965 		case S_USB1INIFILE: value = value2; break;
5966 		case T_RTINIFILE: value = value3; break;
5967 		case T_USB1INIFILE: value = value4; break;
5968 	}
5969 
5970 	if (value != NULL)
5971 	{
5972 		switch(option)
5973 		{
5974 			case SHADINGTIME_16BIT: rst = value[0]; break;
5975 			case SHADOWTIME_16BIT: rst = value[1]; break;
5976 			case SHADINGTIME_8BIT: rst = value[2]; break;
5977 			case SHADOWTIME_8BIT: rst = value[3]; break;
5978 		}
5979 	}
5980 
5981 	return rst;
5982 }
5983 
srt_sec_get(int file, int section, int option, int defvalue)5984 static int srt_sec_get(int file, int section, int option, int defvalue)
5985 {
5986 	int rst = defvalue;
5987 
5988 	switch(section)
5989 	{
5990 		case SCAN_PARAM:
5991 			switch(RTS_Debug->dev_model)
5992 			{
5993 				case HPG2710:
5994 				case HP3800: rst = srt_hp3800_scanparam_get(option, defvalue); break;
5995 				case HPG3010:
5996 				case HPG3110:
5997 				case HP4370: rst = srt_hp4370_scanparam_get(file, option, defvalue); break;
5998 				default    : rst = srt_hp3970_scanparam_get(file, option, defvalue); break;
5999 			}
6000 			break;
6001 		case SCAN_CALI:
6002 			rst = srt_scancali_get(file, option, defvalue); break;
6003 		case TRUE_GRAY_PARAM:
6004 			rst = srt_truegrayparam_get(file, option, defvalue); break;
6005 		case CALI_PARAM:
6006 			rst = srt_caliparam_get(file, option, defvalue); break;
6007 		case PLATFORM:
6008 			switch(RTS_Debug->dev_model)
6009 			{
6010 				case HPG2710:
6011 				case HP3800: rst = srt_hp3800_platform_get(option, defvalue); break;
6012 				case UA4900: rst = srt_ua4900_platform_get(option, defvalue); break;
6013 				case HPG3010:
6014 				case HPG3110:
6015 				case HP4370: rst = srt_hp4370_platform_get(option, defvalue); break;
6016 				default    : rst = srt_hp3970_platform_get(option, defvalue); break;
6017 			}
6018 			break;
6019 		case SCANINFO:
6020 			rst = srt_scaninfo_get(file, option, defvalue); break;
6021 	}
6022 
6023 	return rst;
6024 }
6025 
get_value(int section, int option, int defvalue, int file)6026 static int get_value(int section, int option, int defvalue, int file)
6027 {
6028 	int rst = defvalue;
6029 
6030 	switch(file)
6031 	{
6032 		case FITCALIBRATE:
6033 			rst = fitcalibrate_get(section, option, defvalue); break;
6034 		case S_RTINIFILE:
6035 		case S_USB1INIFILE:
6036 		case T_RTINIFILE:
6037 		case T_USB1INIFILE:
6038 			rst = srt_sec_get(file, section, option, defvalue); break;
6039 	}
6040 
6041 	return rst;
6042 }
6043