1141cc406Sopenharmony_ci/* HP Scanjet 3900 series - Debugging functions for standalone 2141cc406Sopenharmony_ci 3141cc406Sopenharmony_ci Copyright (C) 2005-2008 Jonathan Bravo Lopez <jkdsoft@gmail.com> 4141cc406Sopenharmony_ci 5141cc406Sopenharmony_ci This file is part of the SANE package. 6141cc406Sopenharmony_ci 7141cc406Sopenharmony_ci This program is free software; you can redistribute it and/or 8141cc406Sopenharmony_ci modify it under the terms of the GNU General Public License 9141cc406Sopenharmony_ci as published by the Free Software Foundation; either version 2 10141cc406Sopenharmony_ci of the License, or (at your option) any later version. 11141cc406Sopenharmony_ci 12141cc406Sopenharmony_ci This program is distributed in the hope that it will be useful, 13141cc406Sopenharmony_ci but WITHOUT ANY WARRANTY; without even the implied warranty of 14141cc406Sopenharmony_ci MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15141cc406Sopenharmony_ci GNU General Public License for more details. 16141cc406Sopenharmony_ci 17141cc406Sopenharmony_ci You should have received a copy of the GNU General Public License 18141cc406Sopenharmony_ci along with this program. If not, see <https://www.gnu.org/licenses/>. 19141cc406Sopenharmony_ci 20141cc406Sopenharmony_ci As a special exception, the authors of SANE give permission for 21141cc406Sopenharmony_ci additional uses of the libraries contained in this release of SANE. 22141cc406Sopenharmony_ci 23141cc406Sopenharmony_ci The exception is that, if you link a SANE library with other files 24141cc406Sopenharmony_ci to produce an executable, this does not by itself cause the 25141cc406Sopenharmony_ci resulting executable to be covered by the GNU General Public 26141cc406Sopenharmony_ci License. Your use of that executable is in no way restricted on 27141cc406Sopenharmony_ci account of linking the SANE library code into it. 28141cc406Sopenharmony_ci 29141cc406Sopenharmony_ci This exception does not, however, invalidate any other reasons why 30141cc406Sopenharmony_ci the executable file might be covered by the GNU General Public 31141cc406Sopenharmony_ci License. 32141cc406Sopenharmony_ci 33141cc406Sopenharmony_ci If you submit changes to SANE to the maintainers to be included in 34141cc406Sopenharmony_ci a subsequent release, you agree by submitting the changes that 35141cc406Sopenharmony_ci those changes may be distributed with this exception intact. 36141cc406Sopenharmony_ci 37141cc406Sopenharmony_ci If you write modifications of your own for SANE, it is your choice 38141cc406Sopenharmony_ci whether to permit this exception to apply to your modifications. 39141cc406Sopenharmony_ci If you do not wish that, delete this exception notice. 40141cc406Sopenharmony_ci*/ 41141cc406Sopenharmony_ci 42141cc406Sopenharmony_ci/* debugging level messages */ 43141cc406Sopenharmony_ci#define DBG_ERR 0x00 /* Only important errors */ 44141cc406Sopenharmony_ci#define DBG_VRB 0x01 /* verbose messages */ 45141cc406Sopenharmony_ci#define DBG_FNC 0x02 /* Function names and parameters */ 46141cc406Sopenharmony_ci#define DBG_CTL 0x03 /* USB Ctl data */ 47141cc406Sopenharmony_ci#define DBG_BLK 0x04 /* USB Bulk data */ 48141cc406Sopenharmony_ci 49141cc406Sopenharmony_ci#include <stdarg.h> 50141cc406Sopenharmony_ci#ifdef HAVE_TIFFIO_H 51141cc406Sopenharmony_ci#include <tiffio.h> /* dbg_tiff_save */ 52141cc406Sopenharmony_ci#endif 53141cc406Sopenharmony_ci 54141cc406Sopenharmony_ci/* headers */ 55141cc406Sopenharmony_ci 56141cc406Sopenharmony_cistatic void dump_shading (struct st_calibration *myCalib); 57141cc406Sopenharmony_cistatic char *dbg_scantype (SANE_Int type); 58141cc406Sopenharmony_cistatic void dbg_scanmodes (struct st_device *dev); 59141cc406Sopenharmony_cistatic void dbg_motorcurves (struct st_device *dev); 60141cc406Sopenharmony_cistatic void dbg_motormoves (struct st_device *dev); 61141cc406Sopenharmony_cistatic void dbg_hwdcfg (struct st_hwdconfig *params); 62141cc406Sopenharmony_cistatic void dbg_ScanParams (struct st_scanparams *params); 63141cc406Sopenharmony_cistatic void dbg_calibtable (struct st_gain_offset *params); 64141cc406Sopenharmony_cistatic char *dbg_colour (SANE_Int colour); 65141cc406Sopenharmony_cistatic void dbg_motorcfg (struct st_motorcfg *motorcfg); 66141cc406Sopenharmony_cistatic void dbg_buttons (struct st_buttons *buttons); 67141cc406Sopenharmony_cistatic void dbg_sensor (struct st_sensorcfg *sensor); 68141cc406Sopenharmony_cistatic void dbg_timing (struct st_timing *mt); 69141cc406Sopenharmony_cistatic void dbg_sensorclock (struct st_cph *cph); 70141cc406Sopenharmony_cistatic void dbg_tiff_save (char *sFile, SANE_Int width, SANE_Int height, 71141cc406Sopenharmony_ci SANE_Int depth, SANE_Int colortype, SANE_Int res_x, 72141cc406Sopenharmony_ci SANE_Int res_y, SANE_Byte * buffer, SANE_Int size); 73141cc406Sopenharmony_cistatic void dbg_autoref (struct st_scanparams *scancfg, SANE_Byte * pattern, 74141cc406Sopenharmony_ci SANE_Int ser1, SANE_Int ser2, SANE_Int ler); 75141cc406Sopenharmony_ci 76141cc406Sopenharmony_ci#ifdef developing 77141cc406Sopenharmony_cistatic void dbg_buffer (SANE_Int level, char *title, SANE_Byte * buffer, 78141cc406Sopenharmony_ci SANE_Int size, SANE_Int start); 79141cc406Sopenharmony_cistatic void dbg_registers (SANE_Byte * buffer); 80141cc406Sopenharmony_ci#endif 81141cc406Sopenharmony_ci 82141cc406Sopenharmony_ci#ifdef STANDALONE 83141cc406Sopenharmony_ci 84141cc406Sopenharmony_ci/* implementation */ 85141cc406Sopenharmony_ci 86141cc406Sopenharmony_ciint DBG_LEVEL = 0; 87141cc406Sopenharmony_ci 88141cc406Sopenharmony_cistatic void 89141cc406Sopenharmony_ciDBG (int level, const char *msg, ...) 90141cc406Sopenharmony_ci{ 91141cc406Sopenharmony_ci va_list ap; 92141cc406Sopenharmony_ci va_start (ap, msg); 93141cc406Sopenharmony_ci 94141cc406Sopenharmony_ci if (level <= DBG_LEVEL) 95141cc406Sopenharmony_ci vfprintf (stderr, msg, ap); 96141cc406Sopenharmony_ci 97141cc406Sopenharmony_ci va_end (ap); 98141cc406Sopenharmony_ci} 99141cc406Sopenharmony_ci 100141cc406Sopenharmony_ci#endif 101141cc406Sopenharmony_ci 102141cc406Sopenharmony_ci/* debugging functions */ 103141cc406Sopenharmony_ci 104141cc406Sopenharmony_cistatic void 105141cc406Sopenharmony_cidump_shading (struct st_calibration *myCalib) 106141cc406Sopenharmony_ci{ 107141cc406Sopenharmony_ci if (myCalib != NULL) 108141cc406Sopenharmony_ci { 109141cc406Sopenharmony_ci SANE_Int colour, a; 110141cc406Sopenharmony_ci FILE *shadingfile[3]; 111141cc406Sopenharmony_ci 112141cc406Sopenharmony_ci shadingfile[0] = fopen ("RShading.txt", "w"); 113141cc406Sopenharmony_ci shadingfile[1] = fopen ("GShading.txt", "w"); 114141cc406Sopenharmony_ci shadingfile[2] = fopen ("BShading.txt", "w"); 115141cc406Sopenharmony_ci 116141cc406Sopenharmony_ci for (colour = 0; colour < 3; colour++) 117141cc406Sopenharmony_ci { 118141cc406Sopenharmony_ci if (shadingfile[colour] != NULL) 119141cc406Sopenharmony_ci { 120141cc406Sopenharmony_ci for (a = 0; a < myCalib->shadinglength; a++) 121141cc406Sopenharmony_ci fprintf (shadingfile[colour], "%04i: %04x %04x\n", a, 122141cc406Sopenharmony_ci (unsigned int) myCalib->white_shading[colour][a], 123141cc406Sopenharmony_ci (unsigned int) myCalib->black_shading[colour][a]); 124141cc406Sopenharmony_ci fclose (shadingfile[colour]); 125141cc406Sopenharmony_ci } 126141cc406Sopenharmony_ci } 127141cc406Sopenharmony_ci } 128141cc406Sopenharmony_ci} 129141cc406Sopenharmony_ci 130141cc406Sopenharmony_cistatic char * 131141cc406Sopenharmony_cidbg_scantype (SANE_Int type) 132141cc406Sopenharmony_ci{ 133141cc406Sopenharmony_ci switch (type) 134141cc406Sopenharmony_ci { 135141cc406Sopenharmony_ci case ST_NORMAL: 136141cc406Sopenharmony_ci return "ST_NORMAL"; 137141cc406Sopenharmony_ci break; 138141cc406Sopenharmony_ci case ST_TA: 139141cc406Sopenharmony_ci return "ST_TA"; 140141cc406Sopenharmony_ci break; 141141cc406Sopenharmony_ci case ST_NEG: 142141cc406Sopenharmony_ci return "ST_NEG"; 143141cc406Sopenharmony_ci break; 144141cc406Sopenharmony_ci default: 145141cc406Sopenharmony_ci return "Unknown"; 146141cc406Sopenharmony_ci break; 147141cc406Sopenharmony_ci } 148141cc406Sopenharmony_ci} 149141cc406Sopenharmony_ci 150141cc406Sopenharmony_cistatic void 151141cc406Sopenharmony_cidbg_sensorclock (struct st_cph *cph) 152141cc406Sopenharmony_ci{ 153141cc406Sopenharmony_ci if (cph != NULL) 154141cc406Sopenharmony_ci { 155141cc406Sopenharmony_ci DBG (DBG_FNC, " -> cph->p1 = %f\n", cph->p1); 156141cc406Sopenharmony_ci DBG (DBG_FNC, " -> cph->p2 = %f\n", cph->p2); 157141cc406Sopenharmony_ci DBG (DBG_FNC, " -> cph->ps = %i\n", cph->ps); 158141cc406Sopenharmony_ci DBG (DBG_FNC, " -> cph->ge = %i\n", cph->ge); 159141cc406Sopenharmony_ci DBG (DBG_FNC, " -> cph->go = %i\n", cph->go); 160141cc406Sopenharmony_ci } 161141cc406Sopenharmony_ci else 162141cc406Sopenharmony_ci DBG (DBG_FNC, " -> cph is NULL\n"); 163141cc406Sopenharmony_ci} 164141cc406Sopenharmony_ci 165141cc406Sopenharmony_cistatic void 166141cc406Sopenharmony_cidbg_timing (struct st_timing *mt) 167141cc406Sopenharmony_ci{ 168141cc406Sopenharmony_ci if (mt != NULL) 169141cc406Sopenharmony_ci { 170141cc406Sopenharmony_ci DBG (DBG_FNC, " -> mt->cdss[0] = %i\n", _B0 (mt->cdss[0])); 171141cc406Sopenharmony_ci DBG (DBG_FNC, " -> mt->cdsc[0] = %i\n", _B0 (mt->cdsc[0])); 172141cc406Sopenharmony_ci DBG (DBG_FNC, " -> mt->cdss[1] = %i\n", _B0 (mt->cdss[1])); 173141cc406Sopenharmony_ci DBG (DBG_FNC, " -> mt->cdsc[1] = %i\n", _B0 (mt->cdsc[1])); 174141cc406Sopenharmony_ci DBG (DBG_FNC, " -> mt->cnpp = %i\n", _B0 (mt->cnpp)); 175141cc406Sopenharmony_ci DBG (DBG_FNC, " -> mt->cvtrp0 = %i\n", _B0 (mt->cvtrp[0])); 176141cc406Sopenharmony_ci DBG (DBG_FNC, " -> mt->cvtrp1 = %i\n", _B0 (mt->cvtrp[1])); 177141cc406Sopenharmony_ci DBG (DBG_FNC, " -> mt->cvtrp2 = %i\n", _B0 (mt->cvtrp[2])); 178141cc406Sopenharmony_ci DBG (DBG_FNC, " -> mt->cvtrfpw = %i\n", _B0 (mt->cvtrfpw)); 179141cc406Sopenharmony_ci DBG (DBG_FNC, " -> mt->cvtrbpw = %i\n", _B0 (mt->cvtrbpw)); 180141cc406Sopenharmony_ci DBG (DBG_FNC, " -> mt->cvtrw = %i\n", _B0 (mt->cvtrw)); 181141cc406Sopenharmony_ci DBG (DBG_FNC, " -> mt->clamps = 0x%08x\n", mt->clamps); 182141cc406Sopenharmony_ci DBG (DBG_FNC, " -> mt->clampe = 0x%08x\n", mt->clampe); 183141cc406Sopenharmony_ci DBG (DBG_FNC, " -> mt->adcclkp0 = %f\n", mt->adcclkp[0]); 184141cc406Sopenharmony_ci DBG (DBG_FNC, " -> mt->adcclkp1 = %f\n", mt->adcclkp[1]); 185141cc406Sopenharmony_ci DBG (DBG_FNC, " -> mt->adcclkp2e = %i\n", mt->adcclkp2e); 186141cc406Sopenharmony_ci DBG (DBG_FNC, " -> mt->cphbp2s = %i\n", mt->cphbp2s); 187141cc406Sopenharmony_ci DBG (DBG_FNC, " -> mt->cphbp2e = %i\n", mt->cphbp2e); 188141cc406Sopenharmony_ci } 189141cc406Sopenharmony_ci else 190141cc406Sopenharmony_ci DBG (DBG_FNC, " -> mt is NULL\n"); 191141cc406Sopenharmony_ci} 192141cc406Sopenharmony_ci 193141cc406Sopenharmony_cistatic void 194141cc406Sopenharmony_cidbg_sensor (struct st_sensorcfg *sensor) 195141cc406Sopenharmony_ci{ 196141cc406Sopenharmony_ci if (sensor != NULL) 197141cc406Sopenharmony_ci { 198141cc406Sopenharmony_ci DBG (DBG_FNC, 199141cc406Sopenharmony_ci " -> type, name, res , {chn_color }, {chn_gray}, {rgb_order }, line_dist, evnodd_dist\n"); 200141cc406Sopenharmony_ci DBG (DBG_FNC, 201141cc406Sopenharmony_ci " -> ----, ----, --- , {--, --, --}, {--, -- }, {--, --, --}, ---------, -----------\n"); 202141cc406Sopenharmony_ci DBG (DBG_FNC, 203141cc406Sopenharmony_ci " -> %4i, %4i, %4i, {%2i, %2i, %2i}, {%2i, %2i }, {%2i, %2i, %2i}, %9i, %11i\n", 204141cc406Sopenharmony_ci sensor->type, sensor->name, sensor->resolution, 205141cc406Sopenharmony_ci sensor->channel_color[0], sensor->channel_color[1], 206141cc406Sopenharmony_ci sensor->channel_color[2], sensor->channel_gray[0], 207141cc406Sopenharmony_ci sensor->channel_gray[1], sensor->rgb_order[0], 208141cc406Sopenharmony_ci sensor->rgb_order[1], sensor->rgb_order[2], sensor->line_distance, 209141cc406Sopenharmony_ci sensor->evenodd_distance); 210141cc406Sopenharmony_ci } 211141cc406Sopenharmony_ci else 212141cc406Sopenharmony_ci DBG (DBG_FNC, " -> sensor is NULL\n"); 213141cc406Sopenharmony_ci} 214141cc406Sopenharmony_ci 215141cc406Sopenharmony_cistatic void 216141cc406Sopenharmony_cidbg_buttons (struct st_buttons *buttons) 217141cc406Sopenharmony_ci{ 218141cc406Sopenharmony_ci if (buttons != NULL) 219141cc406Sopenharmony_ci { 220141cc406Sopenharmony_ci DBG (DBG_FNC, " -> count, btn1, btn2, btn3, btn4, btn5, btn6\n"); 221141cc406Sopenharmony_ci DBG (DBG_FNC, " -> -----, ----, ----, ----, ----, ----, ----\n"); 222141cc406Sopenharmony_ci DBG (DBG_FNC, " -> %5i, %4i, %4i, %4i, %4i, %4i, %4i\n", 223141cc406Sopenharmony_ci buttons->count, buttons->mask[0], buttons->mask[1], 224141cc406Sopenharmony_ci buttons->mask[2], buttons->mask[3], buttons->mask[4], 225141cc406Sopenharmony_ci buttons->mask[5]); 226141cc406Sopenharmony_ci } 227141cc406Sopenharmony_ci else 228141cc406Sopenharmony_ci DBG (DBG_FNC, " -> buttons is NULL\n"); 229141cc406Sopenharmony_ci} 230141cc406Sopenharmony_ci 231141cc406Sopenharmony_cistatic void 232141cc406Sopenharmony_cidbg_scanmodes (struct st_device *dev) 233141cc406Sopenharmony_ci{ 234141cc406Sopenharmony_ci if (dev->scanmodes_count > 0) 235141cc406Sopenharmony_ci { 236141cc406Sopenharmony_ci SANE_Int a; 237141cc406Sopenharmony_ci struct st_scanmode *reg; 238141cc406Sopenharmony_ci 239141cc406Sopenharmony_ci DBG (DBG_FNC, 240141cc406Sopenharmony_ci " -> ##, ST , CM , RES , TM, CV, SR, CLK, CTPC , BKS , STT, DML, { Exposure times }, { Max exposure times }, MP , MExp16, MExpF, MExp, MRI, MSI, MMTIR, MMTIRH, SK\n"); 241141cc406Sopenharmony_ci DBG (DBG_FNC, 242141cc406Sopenharmony_ci " -> --, ---------, ----------, --- , --, --, --, ---, ------, ----, ---, ---, {------ ------ ------}, {------ ------ ------}, ---, ------, -----, ----, ---, ---, -----, ------, --\n"); 243141cc406Sopenharmony_ci for (a = 0; a < dev->scanmodes_count; a++) 244141cc406Sopenharmony_ci { 245141cc406Sopenharmony_ci reg = dev->scanmodes[a]; 246141cc406Sopenharmony_ci if (reg != NULL) 247141cc406Sopenharmony_ci { 248141cc406Sopenharmony_ci DBG (DBG_FNC, 249141cc406Sopenharmony_ci " -> %2i, %9s, %10s, %4i, %2i, %2i, %2i, %3i, %6i, %4i, %3i, %3i, {%6i, %6i, %6i}, {%6i, %6i, %6i}, %3i, %6i, %5i, %4i, %3i, %3i, %5i, %6i, %2i\n", 250141cc406Sopenharmony_ci a, dbg_scantype (reg->scantype), 251141cc406Sopenharmony_ci dbg_colour (reg->colormode), reg->resolution, reg->timing, 252141cc406Sopenharmony_ci reg->motorcurve, reg->samplerate, reg->systemclock, 253141cc406Sopenharmony_ci reg->ctpc, reg->motorbackstep, reg->scanmotorsteptype, 254141cc406Sopenharmony_ci reg->dummyline, reg->expt[0], reg->expt[1], reg->expt[2], 255141cc406Sopenharmony_ci reg->mexpt[0], reg->mexpt[1], reg->mexpt[2], 256141cc406Sopenharmony_ci reg->motorplus, reg->multiexposurefor16bitmode, 257141cc406Sopenharmony_ci reg->multiexposureforfullspeed, reg->multiexposure, 258141cc406Sopenharmony_ci reg->mri, reg->msi, reg->mmtir, reg->mmtirh, 259141cc406Sopenharmony_ci reg->skiplinecount); 260141cc406Sopenharmony_ci } 261141cc406Sopenharmony_ci } 262141cc406Sopenharmony_ci } 263141cc406Sopenharmony_ci} 264141cc406Sopenharmony_ci 265141cc406Sopenharmony_cistatic void 266141cc406Sopenharmony_cidbg_motorcurves (struct st_device *dev) 267141cc406Sopenharmony_ci{ 268141cc406Sopenharmony_ci if (dev->mtrsetting != NULL) 269141cc406Sopenharmony_ci { 270141cc406Sopenharmony_ci struct st_motorcurve *mtc; 271141cc406Sopenharmony_ci SANE_Int a = 0; 272141cc406Sopenharmony_ci 273141cc406Sopenharmony_ci while (a < dev->mtrsetting_count) 274141cc406Sopenharmony_ci { 275141cc406Sopenharmony_ci DBG (DBG_FNC, " -> Motorcurve %2i: ", a); 276141cc406Sopenharmony_ci mtc = dev->mtrsetting[a]; 277141cc406Sopenharmony_ci if (mtc != NULL) 278141cc406Sopenharmony_ci { 279141cc406Sopenharmony_ci DBG (DBG_FNC, "mri=%i msi=%i skip=%i bckstp=%i\n", mtc->mri, 280141cc406Sopenharmony_ci mtc->msi, mtc->skiplinecount, mtc->motorbackstep); 281141cc406Sopenharmony_ci if (mtc->curve_count > 0) 282141cc406Sopenharmony_ci { 283141cc406Sopenharmony_ci char *sdata = (char *) malloc (256); 284141cc406Sopenharmony_ci if (sdata != NULL) 285141cc406Sopenharmony_ci { 286141cc406Sopenharmony_ci char *sline = (char *) malloc (256); 287141cc406Sopenharmony_ci if (sline != NULL) 288141cc406Sopenharmony_ci { 289141cc406Sopenharmony_ci SANE_Int count; 290141cc406Sopenharmony_ci struct st_curve *crv; 291141cc406Sopenharmony_ci 292141cc406Sopenharmony_ci DBG (DBG_FNC, 293141cc406Sopenharmony_ci " -> ##, dir, type , count, from, to , steps\n"); 294141cc406Sopenharmony_ci DBG (DBG_FNC, 295141cc406Sopenharmony_ci " -> --, ---, ----------, -----, ----, ----, -----\n"); 296141cc406Sopenharmony_ci 297141cc406Sopenharmony_ci count = 0; 298141cc406Sopenharmony_ci while (count < mtc->curve_count) 299141cc406Sopenharmony_ci { 300141cc406Sopenharmony_ci memset (sline, 0, 256); 301141cc406Sopenharmony_ci 302141cc406Sopenharmony_ci snprintf (sdata, 256, " -> %02i, ", count); 303141cc406Sopenharmony_ci strcat (sline, sdata); 304141cc406Sopenharmony_ci 305141cc406Sopenharmony_ci crv = mtc->curve[count]; 306141cc406Sopenharmony_ci if (crv != NULL) 307141cc406Sopenharmony_ci { 308141cc406Sopenharmony_ci if (crv->crv_speed == ACC_CURVE) 309141cc406Sopenharmony_ci strcat (sline, "ACC, "); 310141cc406Sopenharmony_ci else 311141cc406Sopenharmony_ci strcat (sline, "DEC, "); 312141cc406Sopenharmony_ci 313141cc406Sopenharmony_ci switch (crv->crv_type) 314141cc406Sopenharmony_ci { 315141cc406Sopenharmony_ci case CRV_NORMALSCAN: 316141cc406Sopenharmony_ci strcat (sline, "NORMALSCAN, "); 317141cc406Sopenharmony_ci break; 318141cc406Sopenharmony_ci case CRV_PARKHOME: 319141cc406Sopenharmony_ci strcat (sline, "PARKHOME , "); 320141cc406Sopenharmony_ci break; 321141cc406Sopenharmony_ci case CRV_SMEARING: 322141cc406Sopenharmony_ci strcat (sline, "SMEARING , "); 323141cc406Sopenharmony_ci break; 324141cc406Sopenharmony_ci case CRV_BUFFERFULL: 325141cc406Sopenharmony_ci strcat (sline, "BUFFERFULL, "); 326141cc406Sopenharmony_ci break; 327141cc406Sopenharmony_ci default: 328141cc406Sopenharmony_ci snprintf (sdata, 256, "unknown %2i, ", 329141cc406Sopenharmony_ci crv->crv_type); 330141cc406Sopenharmony_ci strcat (sline, sdata); 331141cc406Sopenharmony_ci break; 332141cc406Sopenharmony_ci } 333141cc406Sopenharmony_ci 334141cc406Sopenharmony_ci snprintf (sdata, 256, "%5i, ", 335141cc406Sopenharmony_ci crv->step_count); 336141cc406Sopenharmony_ci strcat (sline, sdata); 337141cc406Sopenharmony_ci if (crv->step_count > 0) 338141cc406Sopenharmony_ci { 339141cc406Sopenharmony_ci SANE_Int stpcount = 0; 340141cc406Sopenharmony_ci 341141cc406Sopenharmony_ci snprintf (sdata, 256, "%4i, %4i| ", 342141cc406Sopenharmony_ci crv->step[0], 343141cc406Sopenharmony_ci crv->step[crv->step_count - 344141cc406Sopenharmony_ci 1]); 345141cc406Sopenharmony_ci strcat (sline, sdata); 346141cc406Sopenharmony_ci 347141cc406Sopenharmony_ci while (stpcount < crv->step_count) 348141cc406Sopenharmony_ci { 349141cc406Sopenharmony_ci if (stpcount == 10) 350141cc406Sopenharmony_ci { 351141cc406Sopenharmony_ci strcat (sline, "..."); 352141cc406Sopenharmony_ci break; 353141cc406Sopenharmony_ci } 354141cc406Sopenharmony_ci if (stpcount > 0) 355141cc406Sopenharmony_ci strcat (sline, ", "); 356141cc406Sopenharmony_ci 357141cc406Sopenharmony_ci snprintf (sdata, 256, "%4i", 358141cc406Sopenharmony_ci crv->step[stpcount]); 359141cc406Sopenharmony_ci strcat (sline, sdata); 360141cc406Sopenharmony_ci 361141cc406Sopenharmony_ci stpcount++; 362141cc406Sopenharmony_ci } 363141cc406Sopenharmony_ci strcat (sline, "\n"); 364141cc406Sopenharmony_ci } 365141cc406Sopenharmony_ci else 366141cc406Sopenharmony_ci strcat (sline, "NONE\n"); 367141cc406Sopenharmony_ci } 368141cc406Sopenharmony_ci else 369141cc406Sopenharmony_ci strcat (sline, "NULL ...\n"); 370141cc406Sopenharmony_ci 371141cc406Sopenharmony_ci DBG (DBG_FNC, "%s", sline); 372141cc406Sopenharmony_ci 373141cc406Sopenharmony_ci count++; 374141cc406Sopenharmony_ci } 375141cc406Sopenharmony_ci 376141cc406Sopenharmony_ci free (sline); 377141cc406Sopenharmony_ci } 378141cc406Sopenharmony_ci free (sdata); 379141cc406Sopenharmony_ci } 380141cc406Sopenharmony_ci } 381141cc406Sopenharmony_ci } 382141cc406Sopenharmony_ci else 383141cc406Sopenharmony_ci DBG (DBG_FNC, "NULL\n"); 384141cc406Sopenharmony_ci a++; 385141cc406Sopenharmony_ci } 386141cc406Sopenharmony_ci } 387141cc406Sopenharmony_ci} 388141cc406Sopenharmony_ci 389141cc406Sopenharmony_cistatic void 390141cc406Sopenharmony_cidbg_motormoves (struct st_device *dev) 391141cc406Sopenharmony_ci{ 392141cc406Sopenharmony_ci if (dev->motormove_count > 0) 393141cc406Sopenharmony_ci { 394141cc406Sopenharmony_ci SANE_Int a; 395141cc406Sopenharmony_ci struct st_motormove *reg; 396141cc406Sopenharmony_ci 397141cc406Sopenharmony_ci DBG (DBG_FNC, " -> ##, CLK, CTPC, STT, CV\n"); 398141cc406Sopenharmony_ci DBG (DBG_FNC, " -> --, ---, ----, ---, --\n"); 399141cc406Sopenharmony_ci for (a = 0; a < dev->motormove_count; a++) 400141cc406Sopenharmony_ci { 401141cc406Sopenharmony_ci reg = dev->motormove[a]; 402141cc406Sopenharmony_ci if (reg != NULL) 403141cc406Sopenharmony_ci { 404141cc406Sopenharmony_ci DBG (DBG_FNC, " -> %2i, %3i, %4i, %3i, %2i\n", 405141cc406Sopenharmony_ci a, reg->systemclock, reg->ctpc, 406141cc406Sopenharmony_ci reg->scanmotorsteptype, reg->motorcurve); 407141cc406Sopenharmony_ci } 408141cc406Sopenharmony_ci } 409141cc406Sopenharmony_ci } 410141cc406Sopenharmony_ci} 411141cc406Sopenharmony_ci 412141cc406Sopenharmony_cistatic void 413141cc406Sopenharmony_cidbg_hwdcfg (struct st_hwdconfig *params) 414141cc406Sopenharmony_ci{ 415141cc406Sopenharmony_ci if (params != NULL) 416141cc406Sopenharmony_ci { 417141cc406Sopenharmony_ci DBG (DBG_FNC, " -> Low level config:\n"); 418141cc406Sopenharmony_ci DBG (DBG_FNC, " -> startpos = %i\n", params->startpos); 419141cc406Sopenharmony_ci DBG (DBG_FNC, " -> arrangeline = %s\n", 420141cc406Sopenharmony_ci (params->arrangeline == 421141cc406Sopenharmony_ci FIX_BY_SOFT) ? "FIX_BY_SOFT" : (params->arrangeline == 422141cc406Sopenharmony_ci FIX_BY_HARD) ? "FIX_BY_HARD" : 423141cc406Sopenharmony_ci "FIX_BY_NONE"); 424141cc406Sopenharmony_ci DBG (DBG_FNC, " -> scantype = %s\n", 425141cc406Sopenharmony_ci dbg_scantype (params->scantype)); 426141cc406Sopenharmony_ci DBG (DBG_FNC, " -> compression = %i\n", params->compression); 427141cc406Sopenharmony_ci DBG (DBG_FNC, " -> use_gamma_tables = %i\n", 428141cc406Sopenharmony_ci params->use_gamma_tables); 429141cc406Sopenharmony_ci DBG (DBG_FNC, " -> gamma_tablesize = %i\n", 430141cc406Sopenharmony_ci params->gamma_tablesize); 431141cc406Sopenharmony_ci DBG (DBG_FNC, " -> white_shading = %i\n", 432141cc406Sopenharmony_ci params->white_shading); 433141cc406Sopenharmony_ci DBG (DBG_FNC, " -> black_shading = %i\n", 434141cc406Sopenharmony_ci params->black_shading); 435141cc406Sopenharmony_ci DBG (DBG_FNC, " -> unk3 = %i\n", params->unk3); 436141cc406Sopenharmony_ci DBG (DBG_FNC, " -> motorplus = %i\n", params->motorplus); 437141cc406Sopenharmony_ci DBG (DBG_FNC, " -> static_head = %i\n", params->static_head); 438141cc406Sopenharmony_ci DBG (DBG_FNC, " -> motor_direction = %s\n", 439141cc406Sopenharmony_ci (params->motor_direction == MTR_FORWARD) ? "FORWARD" : "BACKWARD"); 440141cc406Sopenharmony_ci DBG (DBG_FNC, " -> dummy_scan = %i\n", params->dummy_scan); 441141cc406Sopenharmony_ci DBG (DBG_FNC, " -> highresolution = %i\n", 442141cc406Sopenharmony_ci params->highresolution); 443141cc406Sopenharmony_ci DBG (DBG_FNC, " -> sensorevenodddistance = %i\n", 444141cc406Sopenharmony_ci params->sensorevenodddistance); 445141cc406Sopenharmony_ci DBG (DBG_FNC, " -> calibrate = %i\n", params->calibrate); 446141cc406Sopenharmony_ci } 447141cc406Sopenharmony_ci} 448141cc406Sopenharmony_ci 449141cc406Sopenharmony_cistatic void 450141cc406Sopenharmony_cidbg_ScanParams (struct st_scanparams *params) 451141cc406Sopenharmony_ci{ 452141cc406Sopenharmony_ci if (params != NULL) 453141cc406Sopenharmony_ci { 454141cc406Sopenharmony_ci DBG (DBG_FNC, " -> Scan params:\n"); 455141cc406Sopenharmony_ci DBG (DBG_FNC, " -> colormode = %s\n", 456141cc406Sopenharmony_ci dbg_colour (params->colormode)); 457141cc406Sopenharmony_ci DBG (DBG_FNC, " -> depth = %i\n", params->depth); 458141cc406Sopenharmony_ci DBG (DBG_FNC, " -> samplerate = %i\n", params->samplerate); 459141cc406Sopenharmony_ci DBG (DBG_FNC, " -> timing = %i\n", params->timing); 460141cc406Sopenharmony_ci DBG (DBG_FNC, " -> channel = %i\n", params->channel); 461141cc406Sopenharmony_ci DBG (DBG_FNC, " -> sensorresolution = %i\n", params->sensorresolution); 462141cc406Sopenharmony_ci DBG (DBG_FNC, " -> resolution_x = %i\n", params->resolution_x); 463141cc406Sopenharmony_ci DBG (DBG_FNC, " -> resolution_y = %i\n", params->resolution_y); 464141cc406Sopenharmony_ci DBG (DBG_FNC, " -> left = %i\n", params->coord.left); 465141cc406Sopenharmony_ci DBG (DBG_FNC, " -> width = %i\n", params->coord.width); 466141cc406Sopenharmony_ci DBG (DBG_FNC, " -> top = %i\n", params->coord.top); 467141cc406Sopenharmony_ci DBG (DBG_FNC, " -> height = %i\n", params->coord.height); 468141cc406Sopenharmony_ci DBG (DBG_FNC, " -> shadinglength = %i\n", params->shadinglength); 469141cc406Sopenharmony_ci DBG (DBG_FNC, " -> v157c = %i\n", params->v157c); 470141cc406Sopenharmony_ci DBG (DBG_FNC, " -> bytesperline = %i\n", params->bytesperline); 471141cc406Sopenharmony_ci DBG (DBG_FNC, " -> expt = %i\n", params->expt); 472141cc406Sopenharmony_ci DBG (DBG_FNC, " *> startpos = %i\n", params->startpos); 473141cc406Sopenharmony_ci DBG (DBG_FNC, " *> leftleading = %i\n", params->leftleading); 474141cc406Sopenharmony_ci DBG (DBG_FNC, " *> ser = %i\n", params->ser); 475141cc406Sopenharmony_ci DBG (DBG_FNC, " *> ler = %i\n", params->ler); 476141cc406Sopenharmony_ci DBG (DBG_FNC, " *> scantype = %s\n", 477141cc406Sopenharmony_ci dbg_scantype (params->scantype)); 478141cc406Sopenharmony_ci } 479141cc406Sopenharmony_ci} 480141cc406Sopenharmony_ci 481141cc406Sopenharmony_cistatic void 482141cc406Sopenharmony_cidbg_calibtable (struct st_gain_offset *params) 483141cc406Sopenharmony_ci{ 484141cc406Sopenharmony_ci if (params != NULL) 485141cc406Sopenharmony_ci { 486141cc406Sopenharmony_ci DBG (DBG_FNC, " -> Calib table:\n"); 487141cc406Sopenharmony_ci DBG (DBG_FNC, " -> type R G B\n"); 488141cc406Sopenharmony_ci DBG (DBG_FNC, " -> ----- --- --- ---B\n"); 489141cc406Sopenharmony_ci DBG (DBG_FNC, " -> edcg1 = %3i , %3i , %3i\n", params->edcg1[0], 490141cc406Sopenharmony_ci params->edcg1[1], params->edcg1[2]); 491141cc406Sopenharmony_ci DBG (DBG_FNC, " -> edcg2 = %3i , %3i , %3i\n", params->edcg2[0], 492141cc406Sopenharmony_ci params->edcg2[1], params->edcg2[2]); 493141cc406Sopenharmony_ci DBG (DBG_FNC, " -> odcg1 = %3i , %3i , %3i\n", params->odcg1[0], 494141cc406Sopenharmony_ci params->odcg1[1], params->odcg1[2]); 495141cc406Sopenharmony_ci DBG (DBG_FNC, " -> odcg2 = %3i , %3i , %3i\n", params->odcg2[0], 496141cc406Sopenharmony_ci params->odcg2[1], params->odcg2[2]); 497141cc406Sopenharmony_ci DBG (DBG_FNC, " -> pag = %3i , %3i , %3i\n", params->pag[0], 498141cc406Sopenharmony_ci params->pag[1], params->pag[2]); 499141cc406Sopenharmony_ci DBG (DBG_FNC, " -> vgag1 = %3i , %3i , %3i\n", params->vgag1[0], 500141cc406Sopenharmony_ci params->vgag1[1], params->vgag1[2]); 501141cc406Sopenharmony_ci DBG (DBG_FNC, " -> vgag2 = %3i , %3i , %3i\n", params->vgag2[0], 502141cc406Sopenharmony_ci params->vgag2[1], params->vgag2[2]); 503141cc406Sopenharmony_ci } 504141cc406Sopenharmony_ci} 505141cc406Sopenharmony_ci 506141cc406Sopenharmony_cistatic char * 507141cc406Sopenharmony_cidbg_colour (SANE_Int colour) 508141cc406Sopenharmony_ci{ 509141cc406Sopenharmony_ci switch (colour) 510141cc406Sopenharmony_ci { 511141cc406Sopenharmony_ci case CM_COLOR: 512141cc406Sopenharmony_ci return "CM_COLOR"; 513141cc406Sopenharmony_ci break; 514141cc406Sopenharmony_ci case CM_GRAY: 515141cc406Sopenharmony_ci return "CM_GRAY"; 516141cc406Sopenharmony_ci break; 517141cc406Sopenharmony_ci case CM_LINEART: 518141cc406Sopenharmony_ci return "CM_LINEART"; 519141cc406Sopenharmony_ci break; 520141cc406Sopenharmony_ci default: 521141cc406Sopenharmony_ci return "Unknown"; 522141cc406Sopenharmony_ci break; 523141cc406Sopenharmony_ci } 524141cc406Sopenharmony_ci} 525141cc406Sopenharmony_ci 526141cc406Sopenharmony_cistatic void 527141cc406Sopenharmony_cidbg_motorcfg (struct st_motorcfg *motorcfg) 528141cc406Sopenharmony_ci{ 529141cc406Sopenharmony_ci if (motorcfg != NULL) 530141cc406Sopenharmony_ci { 531141cc406Sopenharmony_ci DBG (DBG_FNC, 532141cc406Sopenharmony_ci " -> type, res , freq, speed, base, high, park, change\n"); 533141cc406Sopenharmony_ci DBG (DBG_FNC, 534141cc406Sopenharmony_ci " -> ----, --- , ----, -----, ----, ----, ----, ------\n"); 535141cc406Sopenharmony_ci DBG (DBG_FNC, " -> %4i, %4i, %4i, %5i, %4i, %4i, %4i, %6i\n", 536141cc406Sopenharmony_ci motorcfg->type, motorcfg->resolution, motorcfg->pwmfrequency, 537141cc406Sopenharmony_ci motorcfg->basespeedpps, motorcfg->basespeedmotormove, 538141cc406Sopenharmony_ci motorcfg->highspeedmotormove, motorcfg->parkhomemotormove, 539141cc406Sopenharmony_ci motorcfg->changemotorcurrent); 540141cc406Sopenharmony_ci } 541141cc406Sopenharmony_ci} 542141cc406Sopenharmony_ci 543141cc406Sopenharmony_cistatic void 544141cc406Sopenharmony_cidbg_tiff_save (char *sFile, SANE_Int width, SANE_Int height, SANE_Int depth, 545141cc406Sopenharmony_ci SANE_Int colortype, SANE_Int res_x, SANE_Int res_y, 546141cc406Sopenharmony_ci SANE_Byte * buffer, SANE_Int size) 547141cc406Sopenharmony_ci{ 548141cc406Sopenharmony_ci#ifdef HAVE_TIFFIO_H 549141cc406Sopenharmony_ci if (buffer != NULL) 550141cc406Sopenharmony_ci { 551141cc406Sopenharmony_ci char *path = getenv ("HOME"); 552141cc406Sopenharmony_ci 553141cc406Sopenharmony_ci if (path != NULL) 554141cc406Sopenharmony_ci { 555141cc406Sopenharmony_ci char filename[512]; 556141cc406Sopenharmony_ci TIFF *image; 557141cc406Sopenharmony_ci 558141cc406Sopenharmony_ci if (snprintf (filename, 512, "%s/%s", path, sFile) > 0) 559141cc406Sopenharmony_ci { 560141cc406Sopenharmony_ci /* Open the TIFF file */ 561141cc406Sopenharmony_ci if ((image = TIFFOpen (filename, "w")) != NULL) 562141cc406Sopenharmony_ci { 563141cc406Sopenharmony_ci char desc[256]; 564141cc406Sopenharmony_ci 565141cc406Sopenharmony_ci SANE_Int spp = (colortype == CM_GRAY) ? 1 : 3; 566141cc406Sopenharmony_ci SANE_Int ct = 567141cc406Sopenharmony_ci (colortype == 568141cc406Sopenharmony_ci CM_GRAY) ? PHOTOMETRIC_MINISBLACK : PHOTOMETRIC_RGB; 569141cc406Sopenharmony_ci 570141cc406Sopenharmony_ci snprintf (desc, 256, "Created with hp3900 %s", 571141cc406Sopenharmony_ci BACKEND_VRSN); 572141cc406Sopenharmony_ci 573141cc406Sopenharmony_ci /* We need to set some values for basic tags before we can add any data */ 574141cc406Sopenharmony_ci TIFFSetField (image, TIFFTAG_IMAGEWIDTH, width); 575141cc406Sopenharmony_ci TIFFSetField (image, TIFFTAG_IMAGELENGTH, height); 576141cc406Sopenharmony_ci TIFFSetField (image, TIFFTAG_BITSPERSAMPLE, depth); 577141cc406Sopenharmony_ci TIFFSetField (image, TIFFTAG_SAMPLESPERPIXEL, spp); 578141cc406Sopenharmony_ci 579141cc406Sopenharmony_ci TIFFSetField (image, TIFFTAG_PHOTOMETRIC, ct); 580141cc406Sopenharmony_ci TIFFSetField (image, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB); 581141cc406Sopenharmony_ci TIFFSetField (image, TIFFTAG_PLANARCONFIG, 582141cc406Sopenharmony_ci PLANARCONFIG_CONTIG); 583141cc406Sopenharmony_ci 584141cc406Sopenharmony_ci TIFFSetField (image, TIFFTAG_XRESOLUTION, (double) res_x); 585141cc406Sopenharmony_ci TIFFSetField (image, TIFFTAG_YRESOLUTION, (double) res_y); 586141cc406Sopenharmony_ci TIFFSetField (image, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH); 587141cc406Sopenharmony_ci TIFFSetField (image, TIFFTAG_IMAGEDESCRIPTION, desc); 588141cc406Sopenharmony_ci 589141cc406Sopenharmony_ci /* Write the information to the file */ 590141cc406Sopenharmony_ci TIFFWriteRawStrip (image, 0, buffer, size); 591141cc406Sopenharmony_ci TIFFClose (image); 592141cc406Sopenharmony_ci } 593141cc406Sopenharmony_ci } 594141cc406Sopenharmony_ci else 595141cc406Sopenharmony_ci DBG (DBG_ERR, "- dbg_tiff_save: Error generating filename\n"); 596141cc406Sopenharmony_ci } 597141cc406Sopenharmony_ci else 598141cc406Sopenharmony_ci DBG (DBG_ERR, 599141cc406Sopenharmony_ci "- dbg_tiff_save: Environment HOME variable does not exist\n"); 600141cc406Sopenharmony_ci } 601141cc406Sopenharmony_ci#else 602141cc406Sopenharmony_ci /* silent gcc */ 603141cc406Sopenharmony_ci (void) sFile; 604141cc406Sopenharmony_ci (void) width; 605141cc406Sopenharmony_ci (void) height; 606141cc406Sopenharmony_ci (void) depth; 607141cc406Sopenharmony_ci (void) colortype; 608141cc406Sopenharmony_ci (void) res_x; 609141cc406Sopenharmony_ci (void) res_y; 610141cc406Sopenharmony_ci (void) buffer; 611141cc406Sopenharmony_ci (void) size; 612141cc406Sopenharmony_ci 613141cc406Sopenharmony_ci DBG (DBG_ERR, "- dbg_tiff_save: tiffio not supported\n"); 614141cc406Sopenharmony_ci#endif 615141cc406Sopenharmony_ci} 616141cc406Sopenharmony_ci 617141cc406Sopenharmony_cistatic void 618141cc406Sopenharmony_cidbg_autoref (struct st_scanparams *scancfg, SANE_Byte * pattern, 619141cc406Sopenharmony_ci SANE_Int ser1, SANE_Int ser2, SANE_Int ler) 620141cc406Sopenharmony_ci{ 621141cc406Sopenharmony_ci /* this function generates post-autoref.tiff */ 622141cc406Sopenharmony_ci SANE_Byte *img = 623141cc406Sopenharmony_ci malloc (sizeof (SANE_Byte) * 624141cc406Sopenharmony_ci (scancfg->coord.width * scancfg->coord.height * 3)); 625141cc406Sopenharmony_ci 626141cc406Sopenharmony_ci if (img != NULL) 627141cc406Sopenharmony_ci { 628141cc406Sopenharmony_ci SANE_Int c, value; 629141cc406Sopenharmony_ci 630141cc406Sopenharmony_ci /* generate image from 1 gray channel to 3 color channels */ 631141cc406Sopenharmony_ci for (c = 0; c < (scancfg->coord.width * scancfg->coord.height); c++) 632141cc406Sopenharmony_ci { 633141cc406Sopenharmony_ci value = *(pattern + c); 634141cc406Sopenharmony_ci *(img + (3 * c)) = value; 635141cc406Sopenharmony_ci *(img + (3 * c) + 1) = value; 636141cc406Sopenharmony_ci *(img + (3 * c) + 2) = value; 637141cc406Sopenharmony_ci } 638141cc406Sopenharmony_ci 639141cc406Sopenharmony_ci for (c = 0; c < scancfg->coord.height; c++) 640141cc406Sopenharmony_ci { 641141cc406Sopenharmony_ci /* line for first SER */ 642141cc406Sopenharmony_ci if (c < (ler + 5)) 643141cc406Sopenharmony_ci { 644141cc406Sopenharmony_ci *(img + (scancfg->coord.width * c * 3) + (3 * ser1)) = 0; 645141cc406Sopenharmony_ci *(img + (scancfg->coord.width * c * 3) + (3 * ser1) + 1) = 255; 646141cc406Sopenharmony_ci *(img + (scancfg->coord.width * c * 3) + (3 * ser1) + 2) = 0; 647141cc406Sopenharmony_ci } 648141cc406Sopenharmony_ci 649141cc406Sopenharmony_ci /* line for second SER */ 650141cc406Sopenharmony_ci if (c > (ler - 5)) 651141cc406Sopenharmony_ci { 652141cc406Sopenharmony_ci *(img + (scancfg->coord.width * c * 3) + (3 * ser2)) = 90; 653141cc406Sopenharmony_ci *(img + (scancfg->coord.width * c * 3) + (3 * ser2) + 1) = 90; 654141cc406Sopenharmony_ci *(img + (scancfg->coord.width * c * 3) + (3 * ser2) + 2) = 255; 655141cc406Sopenharmony_ci } 656141cc406Sopenharmony_ci 657141cc406Sopenharmony_ci /* vertical lines of the pointer */ 658141cc406Sopenharmony_ci if ((c > (ler - 5)) && (c < (ler + 5))) 659141cc406Sopenharmony_ci { 660141cc406Sopenharmony_ci if ((ser2 - 5) >= 0) 661141cc406Sopenharmony_ci { 662141cc406Sopenharmony_ci *(img + (scancfg->coord.width * c * 3) + (3 * (ser2 - 5))) = 663141cc406Sopenharmony_ci 255; 664141cc406Sopenharmony_ci *(img + (scancfg->coord.width * c * 3) + (3 * (ser2 - 5)) + 665141cc406Sopenharmony_ci 1) = 255; 666141cc406Sopenharmony_ci *(img + (scancfg->coord.width * c * 3) + (3 * (ser2 - 5)) + 667141cc406Sopenharmony_ci 2) = 0; 668141cc406Sopenharmony_ci } 669141cc406Sopenharmony_ci 670141cc406Sopenharmony_ci if ((ser2 + 5) < scancfg->coord.width) 671141cc406Sopenharmony_ci { 672141cc406Sopenharmony_ci *(img + (scancfg->coord.width * c * 3) + (3 * (ser2 + 5))) = 673141cc406Sopenharmony_ci 255; 674141cc406Sopenharmony_ci *(img + (scancfg->coord.width * c * 3) + (3 * (ser2 + 5)) + 675141cc406Sopenharmony_ci 1) = 255; 676141cc406Sopenharmony_ci *(img + (scancfg->coord.width * c * 3) + (3 * (ser2 + 5)) + 677141cc406Sopenharmony_ci 2) = 0; 678141cc406Sopenharmony_ci } 679141cc406Sopenharmony_ci } 680141cc406Sopenharmony_ci } 681141cc406Sopenharmony_ci 682141cc406Sopenharmony_ci /* line for first LER */ 683141cc406Sopenharmony_ci for (c = 0; c < scancfg->coord.width; c++) 684141cc406Sopenharmony_ci { 685141cc406Sopenharmony_ci if ((c > (ser1 - 5)) && (c < (ser2 + 5))) 686141cc406Sopenharmony_ci { 687141cc406Sopenharmony_ci if (c != (ser2 - 5)) 688141cc406Sopenharmony_ci { 689141cc406Sopenharmony_ci *(img + (scancfg->coord.width * ler * 3) + (3 * c)) = 255; 690141cc406Sopenharmony_ci *(img + (scancfg->coord.width * ler * 3) + (3 * c) + 1) = 691141cc406Sopenharmony_ci 90; 692141cc406Sopenharmony_ci *(img + (scancfg->coord.width * ler * 3) + (3 * c) + 2) = 693141cc406Sopenharmony_ci 90; 694141cc406Sopenharmony_ci } 695141cc406Sopenharmony_ci 696141cc406Sopenharmony_ci /* horizontal lines of the pointer */ 697141cc406Sopenharmony_ci if ((c > (ser2 - 5)) && (c < (ser2 + 5))) 698141cc406Sopenharmony_ci { 699141cc406Sopenharmony_ci if ((ler - 5) >= 0) 700141cc406Sopenharmony_ci { 701141cc406Sopenharmony_ci *(img + (scancfg->coord.width * (ler - 5) * 3) + 702141cc406Sopenharmony_ci (3 * c)) = 255; 703141cc406Sopenharmony_ci *(img + (scancfg->coord.width * (ler - 5) * 3) + 704141cc406Sopenharmony_ci (3 * c) + 1) = 255; 705141cc406Sopenharmony_ci *(img + (scancfg->coord.width * (ler - 5) * 3) + 706141cc406Sopenharmony_ci (3 * c) + 2) = 0; 707141cc406Sopenharmony_ci } 708141cc406Sopenharmony_ci 709141cc406Sopenharmony_ci if ((ler + 5) < scancfg->coord.height) 710141cc406Sopenharmony_ci { 711141cc406Sopenharmony_ci *(img + (scancfg->coord.width * (ler + 5) * 3) + 712141cc406Sopenharmony_ci (3 * c)) = 255; 713141cc406Sopenharmony_ci *(img + (scancfg->coord.width * (ler + 5) * 3) + 714141cc406Sopenharmony_ci (3 * c) + 1) = 255; 715141cc406Sopenharmony_ci *(img + (scancfg->coord.width * (ler + 5) * 3) + 716141cc406Sopenharmony_ci (3 * c) + 2) = 0; 717141cc406Sopenharmony_ci } 718141cc406Sopenharmony_ci } 719141cc406Sopenharmony_ci } 720141cc406Sopenharmony_ci } 721141cc406Sopenharmony_ci 722141cc406Sopenharmony_ci dbg_tiff_save ("post-autoref.tiff", scancfg->coord.width, 723141cc406Sopenharmony_ci scancfg->coord.height, 8, CM_COLOR, 724141cc406Sopenharmony_ci scancfg->resolution_x, scancfg->resolution_y, img, 725141cc406Sopenharmony_ci scancfg->coord.height * scancfg->coord.width * 3); 726141cc406Sopenharmony_ci 727141cc406Sopenharmony_ci /* free generated image */ 728141cc406Sopenharmony_ci free (img); 729141cc406Sopenharmony_ci } 730141cc406Sopenharmony_ci} 731141cc406Sopenharmony_ci 732141cc406Sopenharmony_ci#ifdef developing 733141cc406Sopenharmony_ci 734141cc406Sopenharmony_cistatic void 735141cc406Sopenharmony_cidbg_buffer (SANE_Int level, char *title, SANE_Byte * buffer, SANE_Int size, 736141cc406Sopenharmony_ci SANE_Int start) 737141cc406Sopenharmony_ci{ 738141cc406Sopenharmony_ci if (level <= DBG_LEVEL) 739141cc406Sopenharmony_ci { 740141cc406Sopenharmony_ci DBG (level, "%s ", title); 741141cc406Sopenharmony_ci if ((size > 0) && (buffer != NULL)) 742141cc406Sopenharmony_ci { 743141cc406Sopenharmony_ci SANE_Int cont, data, offset = 0; 744141cc406Sopenharmony_ci SANE_Int col = 0; 745141cc406Sopenharmony_ci char text[9]; 746141cc406Sopenharmony_ci char *sline = NULL; 747141cc406Sopenharmony_ci char *sdata = NULL; 748141cc406Sopenharmony_ci 749141cc406Sopenharmony_ci sline = (char *) malloc (81); 750141cc406Sopenharmony_ci if (sline != NULL) 751141cc406Sopenharmony_ci { 752141cc406Sopenharmony_ci sdata = (char *) malloc (81); 753141cc406Sopenharmony_ci if (sdata != NULL) 754141cc406Sopenharmony_ci { 755141cc406Sopenharmony_ci for (cont = 0; cont < size; cont++) 756141cc406Sopenharmony_ci { 757141cc406Sopenharmony_ci if (col == 0) 758141cc406Sopenharmony_ci { 759141cc406Sopenharmony_ci if (cont == 0) 760141cc406Sopenharmony_ci snprintf (sline, 80, " BF: "); 761141cc406Sopenharmony_ci else 762141cc406Sopenharmony_ci snprintf (sline, 80, " "); 763141cc406Sopenharmony_ci memset (&text, 0, sizeof (text)); 764141cc406Sopenharmony_ci } 765141cc406Sopenharmony_ci data = _B0 (buffer[cont]); 766141cc406Sopenharmony_ci text[col] = (data > 31) ? data : '·'; 767141cc406Sopenharmony_ci snprintf (sdata, 80, "%02x ", data); 768141cc406Sopenharmony_ci sline = strcat (sline, sdata); 769141cc406Sopenharmony_ci col++; 770141cc406Sopenharmony_ci offset++; 771141cc406Sopenharmony_ci if (col == 8) 772141cc406Sopenharmony_ci { 773141cc406Sopenharmony_ci col = 0; 774141cc406Sopenharmony_ci snprintf (sdata, 80, " : %s : 0x%04x\n", text, 775141cc406Sopenharmony_ci start + offset - 8); 776141cc406Sopenharmony_ci sline = strcat (sline, sdata); 777141cc406Sopenharmony_ci DBG (level, "%s", sline); 778141cc406Sopenharmony_ci memset (sline, 0, 81); 779141cc406Sopenharmony_ci } 780141cc406Sopenharmony_ci } 781141cc406Sopenharmony_ci if (col > 0) 782141cc406Sopenharmony_ci { 783141cc406Sopenharmony_ci for (cont = col; cont < 8; cont++) 784141cc406Sopenharmony_ci { 785141cc406Sopenharmony_ci snprintf (sdata, 80, "-- "); 786141cc406Sopenharmony_ci sline = strcat (sline, sdata); 787141cc406Sopenharmony_ci offset++; 788141cc406Sopenharmony_ci } 789141cc406Sopenharmony_ci snprintf (sdata, 80, " : %s : 0x%04x\n", text, 790141cc406Sopenharmony_ci start + offset - 8); 791141cc406Sopenharmony_ci sline = strcat (sline, sdata); 792141cc406Sopenharmony_ci DBG (level, "%s", sline); 793141cc406Sopenharmony_ci memset (sline, 0, 81); 794141cc406Sopenharmony_ci } 795141cc406Sopenharmony_ci free (sdata); 796141cc406Sopenharmony_ci } 797141cc406Sopenharmony_ci free (sline); 798141cc406Sopenharmony_ci } 799141cc406Sopenharmony_ci } 800141cc406Sopenharmony_ci else 801141cc406Sopenharmony_ci DBG (level, " BF: Empty buffer\n"); 802141cc406Sopenharmony_ci } 803141cc406Sopenharmony_ci} 804141cc406Sopenharmony_ci 805141cc406Sopenharmony_cistatic void 806141cc406Sopenharmony_cidbg_registers (SANE_Byte * buffer) 807141cc406Sopenharmony_ci{ 808141cc406Sopenharmony_ci /* buffer size must be RT_BUFFER_LEN bytes */ 809141cc406Sopenharmony_ci /*SANE_Int iValue, iValue2; 810141cc406Sopenharmony_ci double dValue; 811141cc406Sopenharmony_ci 812141cc406Sopenharmony_ci DBG(DBG_FNC, "\n----------------------------------------------------\n"); 813141cc406Sopenharmony_ci DBG(DBG_FNC, """RTS8822 Control Registers Info""\nAddress Info\n------- ----\n"); 814141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x000], 1); 815141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0000"); 816141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..3] = systemclock: 0x%02x\n", iValue & 0x0f); 817141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[4] = 0x%02x : MLOCK\n", (iValue >> 4) & 1); 818141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[5] = 0x%02x : Bit to reset scanner\n", (iValue >> 5) & 1); 819141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6] = 0x%02x : ?\n", (iValue >> 6) & 1); 820141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[7] = 0x%02x : RTS_IsExecuting\n", (iValue >> 7) & 1); 821141cc406Sopenharmony_ci 822141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x001], 1); 823141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0001 bit[0] = 0x%02x : ?\n", iValue & 1); 824141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[1] = 0x%02x : (is 1 if has motorcurves)\n", (iValue >> 1) & 1); 825141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[2] = 0x%02x : ?\n", (iValue >> 2) & 1); 826141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[3] = 0x%02x : ?\n", (iValue >> 3) & 1); 827141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[4] = 0x%02x : dummy scan\n", (iValue >> 4) & 1); 828141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[5..7] = 0x%02x : ?\n", (iValue >> 5) & 7); 829141cc406Sopenharmony_ci 830141cc406Sopenharmony_ci dbg_buffer(DBG_FNC, "\n0x0002", &buffer[0x002], 0x0e, 0x02); 831141cc406Sopenharmony_ci 832141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x010], 1); 833141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0010 bit[0..4] = 0x%02x : cvrs\n", iValue & 0x1f); 834141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[5] = 0x%02x : Enable CCD\n", ((iValue >> 5) & 1)); 835141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6] = 0x%02x : Enable CCD channel 1\n", ((iValue >> 6) & 1)); 836141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[7] = 0x%02x : Enable CCD channel 2\n", ((iValue >> 7) & 1)); 837141cc406Sopenharmony_ci 838141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x011], 1); 839141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0011 bit[0..6] = ?: 0x%02x\n", iValue & 0x3f); 840141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[7] = 0x%02x : sensor type (CCD=0|CIS=1)\n", (iValue >> 7) & 1); 841141cc406Sopenharmony_ci 842141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x012], 1); 843141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0012 bit[0..5] = 0x%02x [0x%02x,0x%02x,0x%02x] rgb channel order\n", (iValue & 0x3f), (iValue >> 4) & 3, (iValue >> 2) & 3, iValue & 3); 844141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6..7] = channels_per_dot : 0x%02x\n", (iValue >> 6) & 3); 845141cc406Sopenharmony_ci 846141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x013], 1); 847141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0013"); 848141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..1] = Pre-Amplifier Gain[RED] : 0x%02x\n", iValue & 3); 849141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[2..3] = Pre-Amplifier Gain[GREEN] : 0x%02x\n", (iValue >> 2) & 3); 850141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[4..5] = Pre-Amplifier Gain[BLUE] : 0x%02x\n", (iValue >> 4) & 3); 851141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6] = ? : 0x%02x\n", (iValue >> 6) & 1); 852141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[7] = Enable CCD channel 3: : 0x%02x\n", (iValue >> 7) & 1); 853141cc406Sopenharmony_ci 854141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x014], 1); 855141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0014"); 856141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..4] = Variable Gain Amplifier 1 [RED] : 0x%02x\n", iValue & 0x1f); 857141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[5..7] = Top Reference Voltage: 0x%02x\n", (iValue >> 5) & 3); 858141cc406Sopenharmony_ci 859141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x015], 1); 860141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0015"); 861141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..4] = Variable Gain Amplifier 1 [GREEN] : 0x%02x\n", iValue & 0x1f); 862141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[5..7] = Middle Reference Voltage: 0x%02x\n", (iValue >> 5) & 3); 863141cc406Sopenharmony_ci 864141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x016], 1); 865141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0016"); 866141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..4] = Variable Gain Amplifier 1 [BLUE] : 0x%02x\n", iValue & 0x1f); 867141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[5..7] = Bottom Reference Voltage: 0x%02x\n", (iValue >> 5) & 3); 868141cc406Sopenharmony_ci 869141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x017], 1); 870141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0017"); 871141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..4] = Variable Gain Amplifier 2 [RED] : 0x%02x\n", iValue & 0x1f); 872141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[5..7] = Top Reference Voltage: 0x%02x\n", (iValue >> 5) & 3); 873141cc406Sopenharmony_ci 874141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x018], 1); 875141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0018"); 876141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..4] = Variable Gain Amplifier 2 [GREEN] : 0x%02x\n", iValue & 0x1f); 877141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[5..7] = Middle Reference Voltage: 0x%02x\n", (iValue >> 5) & 3); 878141cc406Sopenharmony_ci 879141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x019], 1); 880141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0019"); 881141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..4] = Variable Gain Amplifier 2 [BLUE] : 0x%02x\n", iValue & 0x1f); 882141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[5..7] = Bottom Reference Voltage: 0x%02x\n", (iValue >> 5) & 3); 883141cc406Sopenharmony_ci 884141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x01a], 1); 885141cc406Sopenharmony_ci iValue2 = data_lsb_get(&buffer[0x01b], 1); 886141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x001a-0x001b\n"); 887141cc406Sopenharmony_ci DBG(DBG_FNC, " Red Even offset 1: 0x%02x\n", ((iValue2 & 0x80) << 1) | iValue); 888141cc406Sopenharmony_ci DBG(DBG_FNC, " Red Even offset 2: 0x%02x\n", iValue2 & 0x3f); 889141cc406Sopenharmony_ci 890141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x01c], 1); 891141cc406Sopenharmony_ci iValue2 = data_lsb_get(&buffer[0x01d], 1); 892141cc406Sopenharmony_ci DBG(DBG_FNC, "0x001c-0x001d\n"); 893141cc406Sopenharmony_ci DBG(DBG_FNC, " Red Odd offset 1: 0x%02x\n", ((iValue2 & 0x80) << 1) | iValue); 894141cc406Sopenharmony_ci DBG(DBG_FNC, " Red Odd offset 2: 0x%02x\n", iValue2 & 0x3f); 895141cc406Sopenharmony_ci 896141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x01e], 1); 897141cc406Sopenharmony_ci iValue2 = data_lsb_get(&buffer[0x01f], 1); 898141cc406Sopenharmony_ci DBG(DBG_FNC, "0x001e-0x001f\n"); 899141cc406Sopenharmony_ci DBG(DBG_FNC, " Green Even offset 1: 0x%02x\n", ((iValue2 & 0x80) << 1) | iValue); 900141cc406Sopenharmony_ci DBG(DBG_FNC, " Green Even offset 2: 0x%02x\n", iValue2 & 0x3f); 901141cc406Sopenharmony_ci 902141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x020], 1); 903141cc406Sopenharmony_ci iValue2 = data_lsb_get(&buffer[0x021], 1); 904141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0020-0x0021\n"); 905141cc406Sopenharmony_ci DBG(DBG_FNC, " Green Odd offset 1: 0x%02x\n", ((iValue2 & 0x80) << 1) | iValue); 906141cc406Sopenharmony_ci DBG(DBG_FNC, " Green Odd offset 2: 0x%02x\n", iValue2 & 0x3f); 907141cc406Sopenharmony_ci 908141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x022], 1); 909141cc406Sopenharmony_ci iValue2 = data_lsb_get(&buffer[0x023], 1); 910141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0022-0x0023\n"); 911141cc406Sopenharmony_ci DBG(DBG_FNC, " Blue Even offset 1: 0x%02x\n", ((iValue2 & 0x80) << 1) | iValue); 912141cc406Sopenharmony_ci DBG(DBG_FNC, " Blue Even offset 2: 0x%02x\n", iValue2 & 0x3f); 913141cc406Sopenharmony_ci 914141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x024], 1); 915141cc406Sopenharmony_ci iValue2 = data_lsb_get(&buffer[0x025], 1); 916141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0024-0x0025\n"); 917141cc406Sopenharmony_ci DBG(DBG_FNC, " Blue Odd offset 1: 0x%02x\n", ((iValue2 & 0x80) << 1) | iValue); 918141cc406Sopenharmony_ci DBG(DBG_FNC, " Blue Odd offset 2: 0x%02x\n", iValue2 & 0x3f); 919141cc406Sopenharmony_ci 920141cc406Sopenharmony_ci dbg_buffer(DBG_FNC, "\n0x0026", &buffer[0x026], 0x03, 0x26); 921141cc406Sopenharmony_ci 922141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x029], 1); 923141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0029"); 924141cc406Sopenharmony_ci DBG(DBG_FNC, " First connection to scanner? : 0x%02x\n", iValue); 925141cc406Sopenharmony_ci 926141cc406Sopenharmony_ci dbg_buffer(DBG_FNC, "\n0x002a", &buffer[0x02a], 0x06, 0x2a); 927141cc406Sopenharmony_ci 928141cc406Sopenharmony_ci DBG(DBG_FNC, "\nExposure times:\n"); 929141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x030], 3); 930141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0030 Line exposure time : %i us\n", iValue); 931141cc406Sopenharmony_ci 932141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x033], 3); 933141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0033 mexpts[RED] : %i us\n", iValue); 934141cc406Sopenharmony_ci 935141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x036], 3); 936141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0036 expts[RED] : %i us\n", iValue); 937141cc406Sopenharmony_ci 938141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x039], 3); 939141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0039 mexpts[GREEN]: %i us\n", iValue); 940141cc406Sopenharmony_ci 941141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x03c], 3); 942141cc406Sopenharmony_ci DBG(DBG_FNC, "0x003c expts[GREEN]: %i us\n", iValue); 943141cc406Sopenharmony_ci 944141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x03f], 3); 945141cc406Sopenharmony_ci DBG(DBG_FNC, "0x003f mexpts[BLUE] : %i us\n", iValue); 946141cc406Sopenharmony_ci 947141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x042], 3); 948141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0042 expts[BLUE] : %i us\n", iValue); 949141cc406Sopenharmony_ci 950141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x045], 1); 951141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0045 bit[0..4] = timing.cvtrfpw: 0x%02x\n", iValue & 0x1f); 952141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[5] = timing.cvtrp[2]: 0x%02x\n", (iValue >> 5) & 1); 953141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6] = timing.cvtrp[1]: 0x%02x\n", (iValue >> 6) & 1); 954141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[7] = timing.cvtrp[0]: 0x%02x\n", (iValue >> 7) & 1); 955141cc406Sopenharmony_ci 956141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x046], 1); 957141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0046"); 958141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..4] = timing.cvtrbpw: 0x%02x\n", iValue & 0x1f); 959141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[5..7] = ?: 0x%02x\n", (iValue >> 5) & 3); 960141cc406Sopenharmony_ci 961141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x047], 1); 962141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0047"); 963141cc406Sopenharmony_ci DBG(DBG_FNC, " timing.cvtrw: 0x%02x\n", iValue); 964141cc406Sopenharmony_ci 965141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x04c], 0x01) & 0x0f; 966141cc406Sopenharmony_ci dValue = iValue * pow(2, 32); 967141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x04a], 0x02); 968141cc406Sopenharmony_ci dValue = dValue + (iValue * pow(2, 16)) + data_lsb_get(&buffer[0x048], 0x02); 969141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0048 Linear image sensor clock 1\n"); 970141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..35] = timing.cph0p1: %.0f.\n", dValue); 971141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x04c], 0x01); 972141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[36] = timing.cph0go: 0x%02x\n", (iValue >> 4) & 1); 973141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[37] = timing.cph0ge: 0x%02x\n", (iValue >> 5) & 1); 974141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[38] = timing.cph0ps: 0x%02x\n", (iValue >> 6) & 1); 975141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[39] = ?: 0x%02x\n", (iValue >> 7) & 1); 976141cc406Sopenharmony_ci 977141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x051], 0x01) & 0x0f; 978141cc406Sopenharmony_ci dValue = iValue * pow(2, 32); 979141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x04f], 0x02); 980141cc406Sopenharmony_ci dValue = dValue + (iValue * pow(2, 16)) + data_lsb_get(&buffer[0x04d], 0x02); 981141cc406Sopenharmony_ci DBG(DBG_FNC, "0x004d"); 982141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..35] = timing.cph0p2: %.0f.\n", dValue); 983141cc406Sopenharmony_ci 984141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x056], 1) & 0x0f; 985141cc406Sopenharmony_ci dValue = iValue * pow(2, 32); 986141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x054], 2); 987141cc406Sopenharmony_ci dValue = dValue + (iValue * pow(2, 16)) + data_lsb_get(&buffer[0x052], 2); 988141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0052 Linear image sensor clock 2\n"); 989141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..35] = timing.cph1p1: %.0f.\n", dValue); 990141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x056], 1); 991141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[36] = timing.cph1go: 0x%02x\n", (iValue >> 4) & 1); 992141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[37] = timing.cph1ge: 0x%02x\n", (iValue >> 5) & 1); 993141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[38] = timing.cph1ps: 0x%02x\n", (iValue >> 6) & 1); 994141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[39] = ?: 0x%02x\n", (iValue >> 7) & 1); 995141cc406Sopenharmony_ci 996141cc406Sopenharmony_ci 997141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x05b], 0x01) & 0x0f; 998141cc406Sopenharmony_ci dValue = iValue * pow(2, 32); 999141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x059], 0x02); 1000141cc406Sopenharmony_ci dValue = dValue + (iValue * pow(2, 16)) + data_lsb_get(&buffer[0x057], 0x02); 1001141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0057"); 1002141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..35] = timing.cph1p2: %.0f.\n", dValue); 1003141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x05b], 0x01); 1004141cc406Sopenharmony_ci DBG(DBG_FNC, " bits[36..39] = %02x\n", (iValue >> 0x04) & 0x0f); 1005141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[36] = ?: %02x\n", (iValue >> 0x04) & 0x01); 1006141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[37] = ?: %02x\n", (iValue >> 0x05) & 0x01); 1007141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[38] = ?: %02x\n", (iValue >> 0x06) & 0x01); 1008141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[39] = ?: %02x\n", (iValue >> 0x07) & 0x01); 1009141cc406Sopenharmony_ci 1010141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x060], 0x01) & 0x0f; 1011141cc406Sopenharmony_ci dValue = iValue * pow(2, 32); 1012141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x05e], 0x02); 1013141cc406Sopenharmony_ci dValue = dValue + (iValue * pow(2, 16)) + data_lsb_get(&buffer[0x05c], 0x02); 1014141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x005c Linear Image Sensor Clock 3\n"); 1015141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..35] = timing.cph2p1: %.0f.\n", dValue); 1016141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x060], 0x01); 1017141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[36] = timing.cph2go: 0x%02x\n", (iValue >> 0x04) & 0x01); 1018141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[37] = timing.cph2ge: 0x%02x\n", (iValue >> 0x05) & 0x01); 1019141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[38] = timing.cph2ps: 0x%02x\n", (iValue >> 0x06) & 0x01); 1020141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[39] = ?: 0x%02x\n", (iValue >> 0x07) & 0x01); 1021141cc406Sopenharmony_ci 1022141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x065], 0x01) & 0x0f; 1023141cc406Sopenharmony_ci dValue = iValue * pow(2, 32); 1024141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x063], 0x02); 1025141cc406Sopenharmony_ci dValue = dValue + (iValue * pow(2, 16)) + data_lsb_get(&buffer[0x061], 0x02); 1026141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0061"); 1027141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..35] = timing.cph2p2: %.0f.\n", dValue); 1028141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x065], 0x01); 1029141cc406Sopenharmony_ci DBG(DBG_FNC, " bits[36..39] = 0x%02x\n", (iValue >> 0x04) & 0x0f); 1030141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[36] = ?: 0x%02x\n", (iValue >> 0x04) & 0x01); 1031141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[37] = ?: 0x%02x\n", (iValue >> 0x05) & 0x01); 1032141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[38] = ?: 0x%02x\n", (iValue >> 0x06) & 0x01); 1033141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[39] = ?: 0x%02x\n", (iValue >> 0x07) & 0x01); 1034141cc406Sopenharmony_ci 1035141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x06a], 0x01) & 0x0f; 1036141cc406Sopenharmony_ci dValue = iValue * pow(2, 32); 1037141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x068], 0x02); 1038141cc406Sopenharmony_ci dValue = dValue + (iValue * pow(2, 16)) + data_lsb_get(&buffer[0x066], 0x02); 1039141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0066 Linear Image Sensor Clock 4\n"); 1040141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..35] = timing.cph3p1: %.0f.\n", dValue); 1041141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x06a], 0x01); 1042141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[36] = timing.cph3go: 0x%02x\n", (iValue >> 0x04) & 0x01); 1043141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[37] = timing.cph3ge: 0x%02x\n", (iValue >> 0x05) & 0x01); 1044141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[38] = timing.cph3ps: 0x%02x\n", (iValue >> 0x06) & 0x01); 1045141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[39] = ?: 0x%02x\n", (iValue >> 0x07) & 0x01); 1046141cc406Sopenharmony_ci 1047141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x06f], 0x01) & 0x0f; 1048141cc406Sopenharmony_ci dValue = iValue * pow(2, 32); 1049141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x06d], 0x02); 1050141cc406Sopenharmony_ci dValue = dValue + (iValue * pow(2, 16)) + data_lsb_get(&buffer[0x06b], 0x02); 1051141cc406Sopenharmony_ci DBG(DBG_FNC, "0x006b"); 1052141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..35] = timing.cph3p2: %.0f.\n", dValue); 1053141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x06f], 0x01); 1054141cc406Sopenharmony_ci DBG(DBG_FNC, " bits[36..39] = 0x%02x\n", (iValue >> 0x04) & 0x0f); 1055141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[36] = ?: 0x%02x\n", (iValue >> 0x04) & 0x01); 1056141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[37] = ?: 0x%02x\n", (iValue >> 0x05) & 0x01); 1057141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[38] = ?: 0x%02x\n", (iValue >> 0x06) & 0x01); 1058141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[39] = ?: 0x%02x\n", (iValue >> 0x07) & 0x01); 1059141cc406Sopenharmony_ci 1060141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x074], 0x01) & 0x0f; 1061141cc406Sopenharmony_ci dValue = iValue * pow(2, 32); 1062141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x072], 0x02); 1063141cc406Sopenharmony_ci dValue = dValue + (iValue * pow(2, 16)) + data_lsb_get(&buffer[0x070], 0x02); 1064141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0070 Linear Image Sensor Clock 5\n"); 1065141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..35] = timing.cph4p1: %.0f.\n", dValue); 1066141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x074], 0x01); 1067141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[36] = timing.cph4go: 0x%02x\n", (iValue >> 0x04) & 0x01); 1068141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[37] = timing.cph4ge: 0x%02x\n", (iValue >> 0x05) & 0x01); 1069141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[38] = timing.cph4ps: 0x%02x\n", (iValue >> 0x06) & 0x01); 1070141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[39] = ?: 0x%02x\n", (iValue >> 0x07) & 0x01); 1071141cc406Sopenharmony_ci 1072141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x079], 0x01) & 0x0f; 1073141cc406Sopenharmony_ci dValue = iValue * pow(2, 32); 1074141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x077], 0x02); 1075141cc406Sopenharmony_ci dValue = dValue + (iValue * pow(2, 16)) + data_lsb_get(&buffer[0x075], 0x02); 1076141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0075"); 1077141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..35] = timing.cph4p2: %.0f.\n", dValue); 1078141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x079], 0x01); 1079141cc406Sopenharmony_ci DBG(DBG_FNC, " bits[36..39] = 0x%02x\n", (iValue >> 0x04) & 0x0f); 1080141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[36] = ?: 0x%02x\n", (iValue >> 0x04) & 0x01); 1081141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[37] = ?: 0x%02x\n", (iValue >> 0x05) & 0x01); 1082141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[38] = ?: 0x%02x\n", (iValue >> 0x06) & 0x01); 1083141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[39] = ?: 0x%02x\n", (iValue >> 0x07) & 0x01); 1084141cc406Sopenharmony_ci 1085141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x07e], 0x01) & 0x0f; 1086141cc406Sopenharmony_ci dValue = iValue * pow(2, 32); 1087141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x07c], 0x02); 1088141cc406Sopenharmony_ci dValue = dValue + (iValue * pow(2, 16)) + data_lsb_get(&buffer[0x07a], 0x02); 1089141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x007a Linear Image Sensor Clock 6\n"); 1090141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..35] = timing.cph5p1: %.0f.\n", dValue); 1091141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x07e], 0x01); 1092141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[36] = timing.cph5go: 0x%02x\n", (iValue >> 0x04) & 0x01); 1093141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[37] = timing.cph5ge: 0x%02x\n", (iValue >> 0x05) & 0x01); 1094141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[38] = timing.cph5ps: 0x%02x\n", (iValue >> 0x06) & 0x01); 1095141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[39] = ?: 0x%02x\n", (iValue >> 0x07) & 0x01); 1096141cc406Sopenharmony_ci 1097141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x083], 0x01) & 0x0f; 1098141cc406Sopenharmony_ci dValue = iValue * pow(2, 32); 1099141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x081], 0x02); 1100141cc406Sopenharmony_ci dValue = dValue + (iValue * pow(2, 16)) + data_lsb_get(&buffer[0x07f], 0x02); 1101141cc406Sopenharmony_ci DBG(DBG_FNC, "0x007f"); 1102141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..35] = timing.cph5p2: %.0f.\n", dValue); 1103141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x083], 0x01); 1104141cc406Sopenharmony_ci DBG(DBG_FNC, " bits[36..39] = 0x%02x\n", (iValue >> 0x04) & 0x0f); 1105141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[36] = ?: 0x%02x\n", (iValue >> 0x04) & 0x01); 1106141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[37] = ?: 0x%02x\n", (iValue >> 0x05) & 0x01); 1107141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[38] = ?: 0x%02x\n", (iValue >> 0x06) & 0x01); 1108141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[39] = ?: 0x%02x\n", (iValue >> 0x07) & 0x01); 1109141cc406Sopenharmony_ci 1110141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x084], 3); 1111141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0084"); 1112141cc406Sopenharmony_ci DBG(DBG_FNC, " timing.cphbp2s : 0x%06x\n", iValue); 1113141cc406Sopenharmony_ci 1114141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x087], 3); 1115141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0087"); 1116141cc406Sopenharmony_ci DBG(DBG_FNC, " timing.cphbp2e : 0x%06x\n", iValue); 1117141cc406Sopenharmony_ci 1118141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x08a], 3); 1119141cc406Sopenharmony_ci DBG(DBG_FNC, "0x008a"); 1120141cc406Sopenharmony_ci DBG(DBG_FNC, " timing.clamps : 0x%08x\n", iValue); 1121141cc406Sopenharmony_ci 1122141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x08d], 3); 1123141cc406Sopenharmony_ci DBG(DBG_FNC, "0x008d"); 1124141cc406Sopenharmony_ci DBG(DBG_FNC, " timing.clampe or cphbp2e : 0x%08x\n", iValue); 1125141cc406Sopenharmony_ci 1126141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x092], 0x01); 1127141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0092 Correlated-Double-Sample 1\n"); 1128141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..5] = timing.cdss[0]: 0x%02x\n", iValue & 0x3f); 1129141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6..7] = ?: 0x%02x\n", (iValue >> 6) & 3); 1130141cc406Sopenharmony_ci 1131141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x093], 0x01); 1132141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0093"); 1133141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..5] = timing.cdsc[0]: 0x%02x\n", iValue & 0x3f); 1134141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6..7] = ?: 0x%02x\n", (iValue >> 6) & 3); 1135141cc406Sopenharmony_ci 1136141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x094], 0x01); 1137141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0094 Correlated-Double-Sample 2\n"); 1138141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..5] = timing.cdss[1]: 0x%02x\n", iValue & 0x3f); 1139141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6..7] = ?: 0x%02x\n", (iValue >> 6) & 3); 1140141cc406Sopenharmony_ci 1141141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x095], 0x01); 1142141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0095"); 1143141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..5] = timing.cdsc[1]: 0x%02x\n", iValue & 0x3f); 1144141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6..7] = ?: 0x%02x\n", (iValue >> 6) & 3); 1145141cc406Sopenharmony_ci 1146141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x096], 0x01); 1147141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0096"); 1148141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..5] = timing.cnpp: 0x%02x\n", iValue & 0x3f); 1149141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6..7] = ?: 0x%02x\n", (iValue >> 6) & 3); 1150141cc406Sopenharmony_ci 1151141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x09b], 0x01) & 0x0f; 1152141cc406Sopenharmony_ci dValue = iValue * pow(2, 32); 1153141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x099], 0x02); 1154141cc406Sopenharmony_ci dValue = dValue + (iValue * pow(2, 16)) + data_lsb_get(&buffer[0x097], 0x02); 1155141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0097 Analog to Digital Converter clock 1\n"); 1156141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..35] = timing.adcclkp[0]: %.0f.\n", dValue); 1157141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x09b], 0x01); 1158141cc406Sopenharmony_ci DBG(DBG_FNC, " bits[36..39] = 0x%02x\n", (iValue >> 0x04) & 0x0f); 1159141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[36] = ?: 0x%02x\n", (iValue >> 0x04) & 0x01); 1160141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[37] = ?: 0x%02x\n", (iValue >> 0x05) & 0x01); 1161141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[38] = ?: 0x%02x\n", (iValue >> 0x06) & 0x01); 1162141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[39] = ?: 0x%02x\n", (iValue >> 0x07) & 0x01); 1163141cc406Sopenharmony_ci 1164141cc406Sopenharmony_ci dbg_buffer(DBG_FNC, "\n0x009c CIS sensor 1", &buffer[0x09c], 0x06, 0x9c); 1165141cc406Sopenharmony_ci dbg_buffer(DBG_FNC, "0x00a2 CIS sensor 2", &buffer[0x0a2], 0x06, 0xa2); 1166141cc406Sopenharmony_ci dbg_buffer(DBG_FNC, "0x00a8 CIS sensor 3", &buffer[0x0a8], 0x06, 0xa8); 1167141cc406Sopenharmony_ci 1168141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0ae], 0x01); 1169141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x00ae"); 1170141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..5] = ?: 0x%02x\n", iValue & 0x3f); 1171141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6..7] = ?: 0x%02x\n", (iValue >> 6) & 3); 1172141cc406Sopenharmony_ci 1173141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0af], 0x01); 1174141cc406Sopenharmony_ci DBG(DBG_FNC, "0x00af"); 1175141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..2] = ?: 0x%02x\n", iValue & 7); 1176141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[3..7] = ?: 0x%02x\n", (iValue >> 3) & 0x1f); 1177141cc406Sopenharmony_ci 1178141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0b0], 2); 1179141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x00b0"); 1180141cc406Sopenharmony_ci DBG(DBG_FNC, " Left : 0x%04x\n", iValue); 1181141cc406Sopenharmony_ci 1182141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0b2], 2); 1183141cc406Sopenharmony_ci DBG(DBG_FNC, "0x00b2"); 1184141cc406Sopenharmony_ci DBG(DBG_FNC, " Right: 0x%04x\n", iValue); 1185141cc406Sopenharmony_ci 1186141cc406Sopenharmony_ci dbg_buffer(DBG_FNC, "\n0x00b4", &buffer[0x0b4], 12, 0xb4); 1187141cc406Sopenharmony_ci 1188141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0c0], 0x01); 1189141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x00c0"); 1190141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..4] = resolution ratio: 0x%02x\n", iValue & 0x1f); 1191141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[5..7] = ?: 0x%02x\n", (iValue >> 5) & 7); 1192141cc406Sopenharmony_ci 1193141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0c5], 0x01) & 0x0f; 1194141cc406Sopenharmony_ci dValue = iValue * pow(2, 32); 1195141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0c3], 0x02); 1196141cc406Sopenharmony_ci dValue = dValue + (iValue * pow(2, 16)) + data_lsb_get(&buffer[0x0c1], 2); 1197141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x00c1 Analog to Digital Converter clock 2\n"); 1198141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..35] = timing.adcclkp[1]: %.0f.\n", dValue); 1199141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0c5], 0x01); 1200141cc406Sopenharmony_ci DBG(DBG_FNC, " bits[36..39] = 0x%02x\n", (iValue >> 0x04) & 0x0f); 1201141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[36] = ?: 0x%02x (equal to bit[32])\n", (iValue >> 0x04) & 0x01); 1202141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[37] = ?: 0x%02x\n", (iValue >> 0x05) & 0x01); 1203141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[38] = ?: 0x%02x\n", (iValue >> 0x06) & 0x01); 1204141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[39] = ?: 0x%02x\n", (iValue >> 0x07) & 0x01); 1205141cc406Sopenharmony_ci 1206141cc406Sopenharmony_ci dbg_buffer(DBG_FNC, "\n0x00c6", &buffer[0x0c6], 0x0a, 0xc6); 1207141cc406Sopenharmony_ci 1208141cc406Sopenharmony_ci iValue = ((buffer[0x0d4] & 0x0f) << 0x10) + data_lsb_get(&buffer[0x0d0], 0x02); 1209141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x00d0"); 1210141cc406Sopenharmony_ci DBG(DBG_FNC, " Top : 0x%04x\n", iValue); 1211141cc406Sopenharmony_ci 1212141cc406Sopenharmony_ci iValue = ((buffer[0x0d4] & 0xf0) << 0x06)+ data_lsb_get(&buffer[0x0d2], 0x02); 1213141cc406Sopenharmony_ci DBG(DBG_FNC, "x00d2"); 1214141cc406Sopenharmony_ci DBG(DBG_FNC, " Down: 0x%04x\n", iValue); 1215141cc406Sopenharmony_ci 1216141cc406Sopenharmony_ci iValue = _B0(buffer[0x0d5]); 1217141cc406Sopenharmony_ci DBG(DBG_FNC, "0x00d5"); 1218141cc406Sopenharmony_ci DBG(DBG_FNC, " ?: 0x%04x\n", iValue); 1219141cc406Sopenharmony_ci 1220141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0d6], 1); 1221141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x00d6"); 1222141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..3] = ? : 0x%02x\n", iValue & 0xf); 1223141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[4..7] = dummyline: 0x%02x\n", (iValue >> 4) & 0xf); 1224141cc406Sopenharmony_ci 1225141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0d7], 0x01); 1226141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x00d7"); 1227141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..5] = motor pwm frequency: 0x%02x\n", iValue & 0x3f); 1228141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6] = ?: 0x%02x\n", (iValue >> 6) & 1); 1229141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[7] = motor type: 0x%02x ", (iValue >> 7) & 1); 1230141cc406Sopenharmony_ci if (((iValue >> 7) & 1) == MT_OUTPUTSTATE) 1231141cc406Sopenharmony_ci DBG(DBG_FNC, ": Output state machine\n"); 1232141cc406Sopenharmony_ci else DBG(DBG_FNC, "On-Chip PWM\n"); 1233141cc406Sopenharmony_ci 1234141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0d8], 0x01); 1235141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x00d8"); 1236141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..5] = ?: 0x%02x\n", iValue & 0x3f); 1237141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6] = scantype (0=Normal|1=TMA) : 0x%02x\n", (iValue >> 6) & 1); 1238141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[7] = enable head movement : 0x%02x :", (iValue >> 7) & 1); 1239141cc406Sopenharmony_ci 1240141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0d9], 0x01); 1241141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x00d9"); 1242141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..2] = ?: 0x%02x\n", iValue & 7); 1243141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[3] = ?: 0x%02x\n", (iValue >> 3) & 1); 1244141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[4..6] = motor step type: 0x%02x: ", (iValue >> 4) & 7); 1245141cc406Sopenharmony_ci switch((iValue >> 4) & 7) 1246141cc406Sopenharmony_ci { 1247141cc406Sopenharmony_ci case 0: DBG(DBG_FNC, "full (1)\n"); break; 1248141cc406Sopenharmony_ci case 1: DBG(DBG_FNC, "half (1/2)\n"); break; 1249141cc406Sopenharmony_ci case 2: DBG(DBG_FNC, "quart (1/4)\n"); break; 1250141cc406Sopenharmony_ci case 3: DBG(DBG_FNC, "(1/8)\n"); break; 1251141cc406Sopenharmony_ci default: DBG(DBG_FNC, "unknown\n"); break; 1252141cc406Sopenharmony_ci } 1253141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[7] = Motor direction: 0x%02x = ", (iValue >> 7) & 1); 1254141cc406Sopenharmony_ci if (((iValue >> 7) & 1) == 0) 1255141cc406Sopenharmony_ci DBG(DBG_FNC, "Backward\n"); 1256141cc406Sopenharmony_ci else DBG(DBG_FNC, "Forward\n"); 1257141cc406Sopenharmony_ci 1258141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0dd], 0x01); 1259141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x00da"); 1260141cc406Sopenharmony_ci DBG(DBG_FNC, " msi = 0x%03x\n", ((iValue & 3) << 8) + data_lsb_get(&buffer[0x0da], 1)); 1261141cc406Sopenharmony_ci 1262141cc406Sopenharmony_ci DBG(DBG_FNC, "0x00db"); 1263141cc406Sopenharmony_ci DBG(DBG_FNC, " motorbackstep1 = 0x%03x\n", ((iValue & 0x0c) << 6) + data_lsb_get(&buffer[0x0db], 1)); 1264141cc406Sopenharmony_ci 1265141cc406Sopenharmony_ci DBG(DBG_FNC, "0x00dc"); 1266141cc406Sopenharmony_ci DBG(DBG_FNC, " motorbackstep2 = 0x%03x\n", ((iValue & 0x30) << 4) + data_lsb_get(&buffer[0x0dc], 1)); 1267141cc406Sopenharmony_ci 1268141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0dd], 0x01); 1269141cc406Sopenharmony_ci DBG(DBG_FNC, "0x00dd"); 1270141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[7] = Motor enabled?: 0x%02x = ", (iValue >> 7) & 1); 1271141cc406Sopenharmony_ci if (((iValue >> 7) & 1) == 0) 1272141cc406Sopenharmony_ci DBG(DBG_FNC, "Yes\n"); 1273141cc406Sopenharmony_ci else DBG(DBG_FNC, "No\n"); 1274141cc406Sopenharmony_ci 1275141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0de], 0x02); 1276141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x00de"); 1277141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[00..11] = ?: 0x%02x\n", iValue & 0xfff); 1278141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[12..15] = ?: 0x%02x\n", (iValue >> 12) & 0x0f); 1279141cc406Sopenharmony_ci 1280141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0df], 0x01); 1281141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x00df"); 1282141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..3] = ?: 0x%02x\n", iValue & 0x0f); 1283141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[4] = has_motorcurves?: 0x%02x\n", (iValue >> 4) & 0x01); 1284141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[5..7] = ?: 0x%02x\n", (iValue >> 5) & 7); 1285141cc406Sopenharmony_ci 1286141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0e0], 1); 1287141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x00e0 step size - 1 : 0x%02x\n", iValue); 1288141cc406Sopenharmony_ci 1289141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0e1], 3); 1290141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x00e1 0x%06x : last step of accurve.normalscan table\n", iValue); 1291141cc406Sopenharmony_ci 1292141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0e4], 3); 1293141cc406Sopenharmony_ci DBG(DBG_FNC, "0x00e4 0x%06x : last step of accurve.smearing table\n", iValue); 1294141cc406Sopenharmony_ci 1295141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0e7], 3); 1296141cc406Sopenharmony_ci DBG(DBG_FNC, "0x00e7 0x%06x : last step of accurve.parkhome table\n", iValue); 1297141cc406Sopenharmony_ci 1298141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0ea], 3); 1299141cc406Sopenharmony_ci DBG(DBG_FNC, "0x00ea 0x%06x : last step of deccurve.scanbufferfull table\n", iValue); 1300141cc406Sopenharmony_ci 1301141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0ed], 3); 1302141cc406Sopenharmony_ci DBG(DBG_FNC, "0x00ed 0x%06x : last step of deccurve.normalscan table\n", iValue); 1303141cc406Sopenharmony_ci 1304141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0f0], 3); 1305141cc406Sopenharmony_ci DBG(DBG_FNC, "0x00f0 0x%06x : last step of deccurve.smearing table\n", iValue); 1306141cc406Sopenharmony_ci 1307141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0f3], 3); 1308141cc406Sopenharmony_ci DBG(DBG_FNC, "0x00f3 0x%06x : last step of deccurve.parkhome table\n", iValue); 1309141cc406Sopenharmony_ci 1310141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0f6], 2); 1311141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x00f6 bit[00..13] = 0x%04x : ptr to accurve.normalscan step table\n", iValue & 0x3fff); 1312141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[14..15] = 0x%04x : ?\n",(iValue >> 14) & 3); 1313141cc406Sopenharmony_ci 1314141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0f8], 2); 1315141cc406Sopenharmony_ci DBG(DBG_FNC, "0x00f8"); 1316141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[00..13] = 0x%04x : ptr to deccurve.scanbufferfull step table\n", iValue & 0x3fff); 1317141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[14..15] = 0x%04x : ?\n",(iValue >> 14) & 3); 1318141cc406Sopenharmony_ci 1319141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0fa], 2); 1320141cc406Sopenharmony_ci DBG(DBG_FNC, "0x00fa"); 1321141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[00..13] = 0x%04x : ptr to accurve.smearing step table\n", iValue & 0x3fff); 1322141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[14..15] = 0x%04x : ?\n",(iValue >> 14) & 3); 1323141cc406Sopenharmony_ci 1324141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0fc], 2); 1325141cc406Sopenharmony_ci DBG(DBG_FNC, "0x00fc"); 1326141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[00..13] = 0x%04x : ptr to deccurve.smearing step table\n", iValue & 0x3fff); 1327141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[14..15] = 0x%04x : ?\n",(iValue >> 14) & 3); 1328141cc406Sopenharmony_ci 1329141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x0fe], 2); 1330141cc406Sopenharmony_ci DBG(DBG_FNC, "0x00fe"); 1331141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[00..13] = 0x%04x : ptr to deccurve.normalscan step table\n", iValue & 0x3fff); 1332141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[14..15] = 0x%04x : ?\n",(iValue >> 14) & 3); 1333141cc406Sopenharmony_ci 1334141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x100], 2); 1335141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0100"); 1336141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[00..13] = 0x%04x : ptr to accurve.parkhome step table\n", iValue & 0x3fff); 1337141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[14..15] = 0x%04x : ?\n",(iValue >> 14) & 3); 1338141cc406Sopenharmony_ci 1339141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x102], 2); 1340141cc406Sopenharmony_ci DBG(DBG_FNC, "0x0102"); 1341141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[00..13] = 0x%04x : ptr to deccurve.parkhome step table\n", iValue & 0x3fff); 1342141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[14..15] = 0x%04x : ?\n",(iValue >> 14) & 3); 1343141cc406Sopenharmony_ci 1344141cc406Sopenharmony_ci dbg_buffer(DBG_FNC, "\n0x0104 Motor resource", &buffer[0x104], 0x20, 0x104); 1345141cc406Sopenharmony_ci 1346141cc406Sopenharmony_ci dbg_buffer(DBG_FNC, "\n0x0124", &buffer[0x124], 0x22, 0x124); 1347141cc406Sopenharmony_ci 1348141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x146], 1); 1349141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0146"); 1350141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..3] = Lamp pulse-width modulation frequency : 0x%02x\n", iValue & 0xf); 1351141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[4] = timer enabled? : 0x%02x\n", (iValue >> 4) & 1); 1352141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[5] = ? : 0x%02x\n", (iValue >> 5) & 1); 1353141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6] = lamp turned on? : 0x%02x\n", (iValue >> 6) & 1); 1354141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[7] = sensor type : 0x%02x ", (iValue >> 7) & 1); 1355141cc406Sopenharmony_ci if (((iValue >> 7) & 1) != 0) 1356141cc406Sopenharmony_ci DBG(DBG_FNC, "CCD\n"); 1357141cc406Sopenharmony_ci else DBG(DBG_FNC, "CIS\n"); 1358141cc406Sopenharmony_ci 1359141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x147], 1); 1360141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0147"); 1361141cc406Sopenharmony_ci DBG(DBG_FNC, " time to turn off lamp = 0x%02x (minutes * 2.682163611980331)\n", iValue); 1362141cc406Sopenharmony_ci 1363141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x148], 1); 1364141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0148"); 1365141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..5] = Lamp pulse-width modulation duty cycle : 0x%02x\n", iValue & 0x3f); 1366141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6..7] = ? : 0x%02x\n",(iValue >> 6) & 3); 1367141cc406Sopenharmony_ci 1368141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x149], 1); 1369141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0149"); 1370141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..5] = even_odd_distance : 0x%02x\n", iValue & 0x3f); 1371141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6..7] = ? : 0x%02x\n",(iValue >> 6) & 3); 1372141cc406Sopenharmony_ci 1373141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x14a], 1); 1374141cc406Sopenharmony_ci DBG(DBG_FNC, "0x014a"); 1375141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..5] = sensor line distance : 0x%02x\n", iValue & 0x3f); 1376141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6..7] = ?: 0x%02x\n",(iValue >> 6) & 3); 1377141cc406Sopenharmony_ci 1378141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x14b], 1); 1379141cc406Sopenharmony_ci DBG(DBG_FNC, "0x014b"); 1380141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..5] = sensor line distance + even_odd_distance: 0x%02x\n", iValue & 0x3f); 1381141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6..7] = ?: 0x%02x\n",(iValue >> 6) & 3); 1382141cc406Sopenharmony_ci 1383141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x14c], 1); 1384141cc406Sopenharmony_ci DBG(DBG_FNC, "0x014c"); 1385141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..5] = sensor line distance * 2: 0x%02x\n", iValue & 0x3f); 1386141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6..7] = ?: 0x%02x\n", (iValue >> 6) & 3); 1387141cc406Sopenharmony_ci 1388141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x14d], 1); 1389141cc406Sopenharmony_ci DBG(DBG_FNC, "0x014d"); 1390141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..5] = (sensor line distance * 2) + even_odd_distance: 0x%02x\n", iValue & 0x3f); 1391141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6..7] = ?: 0x%02x\n", (iValue >> 6) & 3); 1392141cc406Sopenharmony_ci 1393141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x14e], 1); 1394141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x014e"); 1395141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..3] = ?: 0x%02x\n", iValue & 0xf); 1396141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[4] = ?: 0x%02x\n", (iValue >> 4) & 1); 1397141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[5..7] = ?: 0x%02x\n", (iValue >> 5) & 7); 1398141cc406Sopenharmony_ci 1399141cc406Sopenharmony_ci dbg_buffer(DBG_FNC, "\n0x014f", &buffer[0x14f], 0x05, 0x14f); 1400141cc406Sopenharmony_ci 1401141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x154], 1); 1402141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0154"); 1403141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..3] = ?: 0x%02x\n", iValue & 0xf); 1404141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[4..5] = ?: 0x%02x\n", (iValue >> 4) & 3); 1405141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6..7] = ?: 0x%02x\n", (iValue >> 6) & 7); 1406141cc406Sopenharmony_ci 1407141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x155], 1); 1408141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0155"); 1409141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..3] = ?: 0x%02x\n", iValue & 0x0f); 1410141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[4] = 0x%02x : ", (iValue >> 4) & 1); 1411141cc406Sopenharmony_ci if (((iValue >> 4) & 1) == 0) 1412141cc406Sopenharmony_ci DBG(DBG_FNC, "flb lamp\n"); 1413141cc406Sopenharmony_ci else DBG(DBG_FNC, "tma lamp\n"); 1414141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[5..7] = ? : 0x%02x\n", (iValue >> 5) & 7); 1415141cc406Sopenharmony_ci 1416141cc406Sopenharmony_ci dbg_buffer(DBG_FNC, "\n0x0156", &buffer[0x156], 0x02, 0x156); 1417141cc406Sopenharmony_ci 1418141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x158], 1); 1419141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0158"); 1420141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..3] = %02x : Scanner buttons ", iValue & 0x0f); 1421141cc406Sopenharmony_ci if ((iValue & 0x0f) == 0x0f) 1422141cc406Sopenharmony_ci DBG(DBG_FNC, "enabled\n"); 1423141cc406Sopenharmony_ci else DBG(DBG_FNC, "disabled\n"); 1424141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[4..7] = ? : 0x%02x\n", (iValue >> 4) & 0x0f); 1425141cc406Sopenharmony_ci 1426141cc406Sopenharmony_ci dbg_buffer(DBG_FNC, "\n0x0159", &buffer[0x159], 11, 0x159); 1427141cc406Sopenharmony_ci 1428141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x164], 1); 1429141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0164"); 1430141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..6] = ?: 0x%02x\n", iValue & 0x3f); 1431141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[7] = ? : 0x%02x\n", (iValue >> 7) & 1); 1432141cc406Sopenharmony_ci 1433141cc406Sopenharmony_ci dbg_buffer(DBG_FNC, "\n0x0165", &buffer[0x165], 3, 0x165); 1434141cc406Sopenharmony_ci 1435141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x168], 1); 1436141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0168 Buttons status : 0x%02x\n", iValue); 1437141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0] = button 1 : 0x%02x\n", iValue & 1); 1438141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[1] = button 2 : 0x%02x\n", (iValue >> 1) & 1); 1439141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[2] = button 4 : 0x%02x\n", (iValue >> 2) & 1); 1440141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[3] = button 3 : 0x%02x\n", (iValue >> 3) & 1); 1441141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[4] = button ? : 0x%02x\n", (iValue >> 4) & 1); 1442141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[5] = button ? : 0x%02x\n", (iValue >> 5) & 1); 1443141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6] = ? : 0x%02x\n", (iValue >> 6) & 1); 1444141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[7] = ? : 0x%02x\n", (iValue >> 7) & 1); 1445141cc406Sopenharmony_ci 1446141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x169], 1); 1447141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0169", iValue); 1448141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0] = ? : 0x%02x\n", iValue & 1); 1449141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[1] = tma attached? : 0x%02x\n", (iValue >> 1) & 1); 1450141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[2..7] = ? : 0x%02x\n", (iValue >> 2) & 0x3f); 1451141cc406Sopenharmony_ci 1452141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x16a], 1); 1453141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x016a Buttons status 2: 0x%02x\n", iValue); 1454141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0] = button 1 : 0x%02x\n", iValue & 1); 1455141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[1] = button 2 : 0x%02x\n", (iValue >> 1) & 1); 1456141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[2] = button 4 : 0x%02x\n", (iValue >> 2) & 1); 1457141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[3] = button 3 : 0x%02x\n", (iValue >> 3) & 1); 1458141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[4] = button ? : 0x%02x\n", (iValue >> 4) & 1); 1459141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[5] = button ? : 0x%02x\n", (iValue >> 5) & 1); 1460141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6] = ? : 0x%02x\n", (iValue >> 6) & 1); 1461141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[7] = ? : 0x%02x\n", (iValue >> 7) & 1); 1462141cc406Sopenharmony_ci 1463141cc406Sopenharmony_ci dbg_buffer(DBG_FNC, "\n0x016b", &buffer[0x16b], 4, 0x16b); 1464141cc406Sopenharmony_ci 1465141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x16f], 1); 1466141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x016f"); 1467141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..5] = ? : 0x%02x\n", iValue & 0x3f); 1468141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6] = is lamp at home? : 0x%02x\n", (iValue >> 6) & 1); 1469141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[7] = ?: %02x\n", (iValue >> 7) & 1); 1470141cc406Sopenharmony_ci 1471141cc406Sopenharmony_ci dbg_buffer(DBG_FNC, "\n0x0170", &buffer[0x170], 0x17, 0x170); 1472141cc406Sopenharmony_ci 1473141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x187], 1); 1474141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x0187"); 1475141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..3] = ? : 0x%02x\n", iValue & 0xf); 1476141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[4..7] = mclkioc : 0x%02x\n", (iValue >> 4) & 0xf); 1477141cc406Sopenharmony_ci 1478141cc406Sopenharmony_ci dbg_buffer(DBG_FNC, "\n0x0188", &buffer[0x188], 0x16, 0x188); 1479141cc406Sopenharmony_ci 1480141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x19e], 2); 1481141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x019e"); 1482141cc406Sopenharmony_ci DBG(DBG_FNC, " binary threshold low : 0x%04x\n", (iValue >> 8) + ((iValue << 8) & 0xff00)); 1483141cc406Sopenharmony_ci 1484141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x1a0], 2); 1485141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x01a0"); 1486141cc406Sopenharmony_ci DBG(DBG_FNC, " binary threshold high : 0x%04x\n", (iValue >> 8) + ((iValue << 8) & 0xff00)); 1487141cc406Sopenharmony_ci 1488141cc406Sopenharmony_ci dbg_buffer(DBG_FNC, "\n0x01a2", &buffer[0x1a2], 0x12, 0x1a2); 1489141cc406Sopenharmony_ci 1490141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x1b4], 2); 1491141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x01b4"); 1492141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[00..13] = Ptr to red gamma table (table_size * 0) : 0x%04x\n", (iValue & 0x3fff)); 1493141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[14..15] = ? : 0x%02x\n", (iValue >> 14) & 3); 1494141cc406Sopenharmony_ci 1495141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x1b6], 2); 1496141cc406Sopenharmony_ci DBG(DBG_FNC, "0x01b6"); 1497141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[00..13] = Ptr to green gamma table (table_size * 1) : 0x%04x\n", (iValue & 0x3fff)); 1498141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[14..15] = ? : 0x%02x\n", (iValue >> 14) & 3); 1499141cc406Sopenharmony_ci 1500141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x1b8], 2); 1501141cc406Sopenharmony_ci DBG(DBG_FNC, "0x01b8"); 1502141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[00..13] = Ptr to blue gamma table (table_size * 2) : 0x%04x\n", (iValue & 0x3fff)); 1503141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[14..15] = ? : 0x%02x\n", (iValue >> 14) & 3); 1504141cc406Sopenharmony_ci 1505141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x1ba], 1); 1506141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x01ba"); 1507141cc406Sopenharmony_ci DBG(DBG_FNC, " ? : 0x%02x\n", iValue); 1508141cc406Sopenharmony_ci 1509141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x1bb], 2); 1510141cc406Sopenharmony_ci DBG(DBG_FNC, "0x01bb"); 1511141cc406Sopenharmony_ci DBG(DBG_FNC, " ? : 0x%04x\n", iValue + ((data_lsb_get(&buffer[0x1bf], 1) & 1) << 16)); 1512141cc406Sopenharmony_ci 1513141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x1bd], 2); 1514141cc406Sopenharmony_ci DBG(DBG_FNC, "0x01bd"); 1515141cc406Sopenharmony_ci DBG(DBG_FNC, " ? : 0x%04x\n", iValue + (((data_lsb_get(&buffer[0x1bf], 1) >> 1) & 3) << 16)); 1516141cc406Sopenharmony_ci 1517141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x1c0], 3); 1518141cc406Sopenharmony_ci DBG(DBG_FNC, "0x01c0"); 1519141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0..19] = ? : 0x%06x\n", iValue & 0xfffff); 1520141cc406Sopenharmony_ci 1521141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x1bf], 2); 1522141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x01bf"); 1523141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[3..4] = ? : 0x%02x\n", (iValue >> 3) & 3); 1524141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[5..7] = ? : 0x%02x\n", (iValue >> 5) & 7); 1525141cc406Sopenharmony_ci 1526141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x1c2], 3); 1527141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x01c2"); 1528141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[4..23] = ? : 0x%06x\n", ((iValue >> 8) & 0xffff) + (((iValue >> 4) & 0xf) << 16)); 1529141cc406Sopenharmony_ci 1530141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x1c5], 3); 1531141cc406Sopenharmony_ci DBG(DBG_FNC, "0x01c5"); 1532141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[00..19] = ? : 0x%06x\n", iValue & 0xfffff); 1533141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[20..23] = ? : 0x%02x\n", (iValue >> 20) & 0xf); 1534141cc406Sopenharmony_ci 1535141cc406Sopenharmony_ci dbg_buffer(DBG_FNC, "\n0x01c8", &buffer[0x1c8], 7, 0x1c8); 1536141cc406Sopenharmony_ci 1537141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x1cf], 3); 1538141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x01cf"); 1539141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0] = ? : 0x%02x\n", iValue & 1); 1540141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[1] = shading base (0 = 0x4000|1= 0x2000) : 0x%02x\n", (iValue >> 1) & 1); 1541141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[2] = white shading correction : 0x%02x\n", (iValue >> 2) & 1); 1542141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[3] = black shading correction : 0x%02x\n", (iValue >> 3) & 1); 1543141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[4..5] = 0x%02x : ", (iValue >> 4) & 3); 1544141cc406Sopenharmony_ci switch ((iValue >> 4) & 3) 1545141cc406Sopenharmony_ci { 1546141cc406Sopenharmony_ci case 0: DBG(DBG_FNC, "8 bits per channel"); break; 1547141cc406Sopenharmony_ci case 1: DBG(DBG_FNC, "12 bits per channel"); break; 1548141cc406Sopenharmony_ci case 2: DBG(DBG_FNC, "16 bits per channel"); break; 1549141cc406Sopenharmony_ci case 3: DBG(DBG_FNC, "lineart mode"); break; 1550141cc406Sopenharmony_ci } 1551141cc406Sopenharmony_ci DBG(DBG_FNC, "\n"); 1552141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6] = samplerate: 0x%02x ", (iValue >> 6) & 1); 1553141cc406Sopenharmony_ci if (((iValue >> 6) & 1) == PIXEL_RATE) 1554141cc406Sopenharmony_ci DBG(DBG_FNC, "PIXEL_RATE\n"); 1555141cc406Sopenharmony_ci else DBG(DBG_FNC, "LINE_RATE\n"); 1556141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[7] = ? : 0x%02x\n", (iValue >> 7) & 1); 1557141cc406Sopenharmony_ci 1558141cc406Sopenharmony_ci iValue = data_lsb_get(&buffer[0x1d0], 1); 1559141cc406Sopenharmony_ci DBG(DBG_FNC, "\n0x01d0"); 1560141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[0] = 0x%02x\n", iValue & 1); 1561141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[1] = 0x%02x\n", (iValue >> 1) & 1); 1562141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[2..3] = gamma table size : 0x%02x ", (iValue >> 2) & 3); 1563141cc406Sopenharmony_ci switch ((iValue >> 2) & 3) 1564141cc406Sopenharmony_ci { 1565141cc406Sopenharmony_ci case 0: DBG(DBG_FNC, "bit[0] + 0x100") ;break; 1566141cc406Sopenharmony_ci case 1: DBG(DBG_FNC, "bit[0] + 0x400") ;break; 1567141cc406Sopenharmony_ci case 2: DBG(DBG_FNC, "bit[0] + 0x1000") ;break; 1568141cc406Sopenharmony_ci } 1569141cc406Sopenharmony_ci DBG(DBG_FNC, "\n"); 1570141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[4..5] = ? : 0x%02x\n", (iValue >> 4) & 3); 1571141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[6] = use gamma tables? : 0x%02x\n", (iValue >> 6) & 1); 1572141cc406Sopenharmony_ci DBG(DBG_FNC, " bit[7] = ? : 0x%02x\n", (iValue >> 7) & 1); 1573141cc406Sopenharmony_ci 1574141cc406Sopenharmony_ci dbg_buffer(DBG_FNC, "\n0x01d1", &buffer[0x1d1], 0x430, 0x1d1); 1575141cc406Sopenharmony_ci 1576141cc406Sopenharmony_ci DBG(DBG_FNC, "----------------------------------------------------\n\n"); 1577141cc406Sopenharmony_ci */ 1578141cc406Sopenharmony_ci /*exit(0); */ 1579141cc406Sopenharmony_ci} 1580141cc406Sopenharmony_ci#endif 1581