Lines Matching refs:ps

13  * - 0.42 - removed setting of ps->sCaps.dwFlag in p12InitiateComponentModel()
70 static void p12ButtonSetup( pScanData ps, Byte nrOfButtons )
72 ps->Device.buttons = nrOfButtons;
74 ps->Device.Model1Mono &= ~_BUTTON_MODE;
75 ps->Device.Model1Color &= ~_BUTTON_MODE;
77 ps->AsicReg.RD_MotorDriverType |= _BUTTON_DISABLE;
78 ps->Scan.motorPower |= _BUTTON_DISABLE;
83 static void p12InitiateComponentModel( pScanData ps )
86 ps->Device.buttons = 0;
87 ps->Device.Model1Mono = _BUTTON_MODE + _CCD_SHIFT_GATE + _SCAN_GRAYTYPE;
88 ps->Device.Model1Color = _BUTTON_MODE + _CCD_SHIFT_GATE;
89 ps->Device.dwModelOriginY = 64;
90 ps->Device.fTpa = _FALSE;
91 ps->Device.ModelCtrl = (_LED_ACTIVITY | _LED_CONTROL);
93 /* ps->sCaps.dwFlag should have been set correctly in models.c */
95 switch( ps->Device.bPCBID ) {
99 ps->sCaps.Model = MODEL_OP_P12;
104 ps->Device.fTpa = _TRUE;
105 ps->sCaps.dwFlag |= SFLAG_TPA;
110 p12ButtonSetup( ps, 4 );
115 ps->Device.fTpa = _TRUE;
116 ps->sCaps.dwFlag |= SFLAG_TPA;
117 p12ButtonSetup( ps, 4 );
122 ps->Device.dwModelOriginY = 64 + 20;
123 p12ButtonSetup( ps, 5 );
128 ps->Device.dwModelOriginY = 64 + 20;
129 ps->Device.fTpa = _TRUE;
130 ps->sCaps.dwFlag |= SFLAG_TPA;
131 p12ButtonSetup( ps, 5 );
136 p12ButtonSetup( ps, 1 );
141 ps-> Device.fTpa = _TRUE;
142 ps->sCaps.dwFlag |= SFLAG_TPA;
143 p12ButtonSetup( ps, 1 );
148 ps->Device.dwModelOriginY = 24; /* 1200 dpi */
154 ps->Device.dwModelOriginY = 64 - 33;
155 p12ButtonSetup( ps, 2 );
156 ps->sCaps.Model = MODEL_GEN_CPV2;
161 ps->sCaps.Model = MODEL_OP_P12;
165 if( _MOTOR0_2003 == ps->Device.bMotorID ) {
166 ps->Device.f2003 = _TRUE;
167 ps->Device.XStepMono = 10;
168 ps->Device.XStepColor = 6;
169 ps->Device.XStepBack = 5;
170 ps->AsicReg.RD_MotorDriverType |= _MOTORR_STRONG;
172 ps->Device.f2003 = _FALSE;
173 ps->Device.XStepMono = 8;
174 ps->Device.XStepColor = 4;
175 ps->Device.XStepBack = 5;
176 ps->AsicReg.RD_MotorDriverType |= _MOTORR_WEAK;
183 static void p12SetupScannerVariables( pScanData ps )
191 ps->Device.lUpNormal = 0;
192 ps->Device.lUpNegative = 20;
193 ps->Device.lUpPositive = -30;
195 ps->Device.lLeftNormal = 51;
197 ps->OpenScanPath( ps );
198 ps->ReInitAsic( ps, _FALSE );
199 ps->CloseScanPath( ps );
205 static void p12SetupScanningCondition( pScanData ps )
210 pUChar pState = ps->Bufs.b1.pReadBuf;
214 P12SetGeneralRegister( ps );
216 IORegisterToScanner( ps, ps->RegResetMTSC );
219 if( ps->DataInf.wPhyDataType <= COLOR_TRUE24 ) {
220 ps->Scan.dwMaxReadFifo =
221 ps->Scan.dwMinReadFifo = ps->DataInf.dwAsicBytesPerPlane * 2;
223 ps->Scan.dwMaxReadFifo =
224 ps->Scan.dwMinReadFifo = ps->DataInf.dwAppPixelsPerLine << 1;
227 if( ps->Scan.dwMinReadFifo < 1024)
228 ps->Scan.dwMinReadFifo = ps->Scan.dwMaxReadFifo = 1024;
230 ps->Scan.dwMaxReadFifo += (ps->DataInf.dwAsicBytesPerPlane / 2);
234 ps->Scan.dwMinReadFifo, ps->Scan.dwMaxReadFifo );
237 if( ps->DataInf.wPhyDataType > COLOR_256GRAY ) {
239 ps->Scan.bFifoSelect = ps->RegBFifoOffset;
241 if( !ps->Scan.p48BitBuf.pb ) {
246 ps->DataInf.dwAsicBytesPerPlane - ps->Scan.bd_rk.wRedKeep;
249 ps->DataInf.dwAsicBytesPerPlane - ps->Scan.gd_gk.wGreenKeep;
255 ps->AsicReg.RD_BufFullSize = _SIZE_REDFIFO;
259 ps->AsicReg.RD_BufFullSize = _SIZE_GREENFIFO;
262 lGreen = (ULong)(-lGreen * ps->DataInf.dwAsicBytesPerPlane);
264 if( ps->DataInf.wPhyDataType > COLOR_TRUE24 )
267 ps->Scan.dwMinReadFifo += (ULong)lGreen;
268 ps->Scan.dwMaxReadFifo += (ULong)lGreen;
272 ps->AsicReg.RD_BufFullSize = _SIZE_BLUEFIFO;
276 ps->AsicReg.RD_BufFullSize = _SIZE_BLUEFIFO;
279 ps->Scan.bFifoSelect = ps->RegGFifoOffset;
281 ps->AsicReg.RD_BufFullSize = _SIZE_GRAYFIFO;
284 ps->AsicReg.RD_BufFullSize -= (ps->DataInf.dwAsicBytesPerPlane << 1);
286 if( ps->DataInf.wPhyDataType > COLOR_TRUE24 )
287 ps->AsicReg.RD_BufFullSize >>= 1;
289 ps->AsicReg.RD_BufFullSize |= channel;
291 ps->Scan.bRefresh = (Byte)(ps->Scan.dwInterval << 1);
292 ps->AsicReg.RD_LineControl = (_LOBYTE (ps->Shade.wExposure));
293 ps->AsicReg.RD_ExtLineControl = (_HIBYTE (ps->Shade.wExposure));
294 ps->AsicReg.RD_XStepTime = (_LOBYTE (ps->Shade.wXStep));
295 ps->AsicReg.RD_ExtXStepTime = (_HIBYTE (ps->Shade.wXStep));
296 ps->AsicReg.RD_Motor0Control = _FORWARD_MOTOR;
297 ps->AsicReg.RD_StepControl = _MOTOR0_SCANSTATE;
298 ps->AsicReg.RD_ModeControl = (_ModeScan | _ModeFifoGSel);
300 DBG( DBG_LOW, "bRefresh = %i\n", ps->Scan.bRefresh );
302 if( ps->DataInf.wPhyDataType == COLOR_BW ) {
303 ps->AsicReg.RD_ScanControl = _SCAN_BITMODE;
305 if( !(ps->DataInf.dwScanFlag & SCANDEF_Inverse))
306 ps->AsicReg.RD_ScanControl |= _P98_SCANDATA_INVERT;
308 } else if( ps->DataInf.wPhyDataType <= COLOR_TRUE24 )
309 ps->AsicReg.RD_ScanControl = _SCAN_BYTEMODE;
311 ps->AsicReg.RD_ScanControl = _SCAN_12BITMODE;
313 if(!(ps->DataInf.dwScanFlag & SCANDEF_RightAlign))
314 ps->AsicReg.RD_ScanControl |= _BITALIGN_LEFT;
316 if( ps->DataInf.dwScanFlag & SCANDEF_Inverse)
317 ps->AsicReg.RD_ScanControl |= _P98_SCANDATA_INVERT;
320 ps->AsicReg.RD_ScanControl |= _SCAN_1ST_AVERAGE;
321 IOSelectLampSource( ps );
323 DBG( DBG_LOW, "RD_ScanControl = 0x%02x\n", ps->AsicReg.RD_ScanControl );
325 ps->AsicReg.RD_MotorTotalSteps = (ULong)ps->DataInf.crImage.cy * 4 +
326 ((ps->Device.f0_8_16) ? 32 : 16) +
327 ((ps->Scan.bDiscardAll) ? 32 : 0);
329 ps->AsicReg.RD_ScanControl1 = (_MTSC_ENABLE | _SCANSTOPONBUFFULL |
332 ps->AsicReg.RD_Dpi = ps->DataInf.xyPhyDpi.x;
334 if(!(ps->DataInf.dwScanFlag & SCANDEF_TPA )) {
336 ps->AsicReg.RD_Origin = (UShort)(ps->Device.lLeftNormal * 2 +
337 ps->Device.DataOriginX +
338 ps->DataInf.crImage.x );
340 } else if( ps->DataInf.dwScanFlag & SCANDEF_Transparency ) {
341 ps->AsicReg.RD_Origin =
342 (UShort)(ps->Scan.posBegin + ps->DataInf.crImage.x);
344 ps->AsicReg.RD_Origin =
345 (UShort)(ps->Scan.negBegin + ps->DataInf.crImage.x);
348 if( ps->Shade.bIntermediate & _ScanMode_AverageOut )
349 ps->AsicReg.RD_Origin >>= 1;
351 if( ps->DataInf.wPhyDataType == COLOR_BW )
352 ps->AsicReg.RD_Pixels = (UShort)ps->DataInf.dwAsicBytesPerPlane;
354 ps->AsicReg.RD_Pixels = (UShort)ps->DataInf.dwAppPixelsPerLine;
357 ps->AsicReg.RD_Origin, ps->AsicReg.RD_Pixels );
360 memset( ps->a_nbNewAdrPointer, 0, _SCANSTATE_BYTES );
361 memset( ps->Bufs.b1.pReadBuf, 0, _NUMBER_OF_SCANSTEPS );
363 if( ps->DataInf.wPhyDataType <= COLOR_256GRAY )
369 channel; channel -= ps->Scan.dwInterval ) {
371 if( ps->Scan.dwInterlace )
372 pState[ ps->Scan.dwInterlace] = _SS_STEP;
373 pState += ps->Scan.dwInterval;
375 for( channel = 0, pState = ps->Bufs.b1.pReadBuf;
377 ps->a_nbNewAdrPointer[channel] = pState [0] | (pState [1] << 4);
384 while(!(IOGetScanState( ps, _FALSE ) & _SCANSTATE_STOP) &&
388 IODownloadScanStates( ps );
389 IODataToRegister( ps, ps->RegLineControl, ps->AsicReg.RD_LineControl);
390 IODataToRegister( ps, ps->RegExtendedLineControl,
391 ps->AsicReg.RD_ExtLineControl);
392 IODataToRegister( ps, ps->RegXStepTime, ps->AsicReg.RD_XStepTime);
393 IODataToRegister( ps, ps->RegExtendedXStep, ps->AsicReg.RD_ExtXStepTime);
394 IODataToRegister( ps, ps->RegMotorDriverType,
395 ps->AsicReg.RD_MotorDriverType);
396 IODataToRegister( ps, ps->RegStepControl, ps->AsicReg.RD_StepControl);
397 IODataToRegister( ps, ps->RegMotor0Control, ps->AsicReg.RD_Motor0Control);
398 IODataToRegister( ps, ps->RegModelControl,ps->AsicReg.RD_ModelControl);
399 IODataToRegister( ps, ps->RegDpiLow, (_LOBYTE(ps->AsicReg.RD_Dpi)));
400 IODataToRegister( ps, ps->RegDpiHigh, (_HIBYTE(ps->AsicReg.RD_Dpi)));
401 IODataToRegister( ps, ps->RegScanPosLow, (_LOBYTE(ps->AsicReg.RD_Origin)));
402 IODataToRegister( ps, ps->RegScanPosHigh,(_HIBYTE(ps->AsicReg.RD_Origin)));
403 IODataToRegister( ps, ps->RegWidthPixelsLow,
404 (_LOBYTE(ps->AsicReg.RD_Pixels)));
405 IODataToRegister( ps, ps->RegWidthPixelsHigh,
406 (_HIBYTE(ps->AsicReg.RD_Pixels)));
407 IODataToRegister( ps, ps->RegThresholdLow,
408 (_LOBYTE(ps->AsicReg.RD_ThresholdControl)));
409 IODataToRegister( ps, ps->RegThresholdHigh,
410 (_HIBYTE(ps->AsicReg.RD_ThresholdControl)));
411 IODataToRegister( ps, ps->RegMotorTotalStep0,
412 (_LOBYTE(ps->AsicReg.RD_MotorTotalSteps)));
413 IODataToRegister( ps, ps->RegMotorTotalStep1,
414 (_HIBYTE(ps->AsicReg.RD_MotorTotalSteps)));
415 IODataToRegister( ps, ps->RegScanControl, ps->AsicReg.RD_ScanControl);
417 IORegisterToScanner( ps, ps->RegInitDataFifo);
423 static void p12ProgramCCD( pScanData ps)
429 (unsigned long)ps->Device.pCCDRegisters,
430 ((unsigned long)ps->Device.wNumCCDRegs * ps->Shade.bIntermediate));
433 ps->Device.wNumCCDRegs, ps->Shade.bIntermediate );
435 rp = ps->Device.pCCDRegisters +
436 (ULong)ps->Device.wNumCCDRegs * ps->Shade.bIntermediate;
438 for( w = ps->Device.wNumCCDRegs; w--; rp++ ) {
441 IODataToRegister( ps, rp->bReg, rp->bParam );
449 static void p12Init98003( pScanData ps, Bool shading )
454 ps->Device.bDACType = IODataFromRegister( ps, ps->RegResetConfig );
455 ps->Device.bMotorID = (Byte)(ps->Device.bDACType & _MOTOR0_MASK);
457 ps->AsicReg.RD_MotorDriverType =
458 (Byte)((ps->Device.bDACType & _MOTOR0_MASK) >> 3);
459 ps->AsicReg.RD_MotorDriverType |=
460 (Byte)((ps->Device.bDACType & _MOTOR1_MASK) >> 1);
463 ps->Scan.motorPower = ps->AsicReg.RD_MotorDriverType | _MOTORR_STRONG;
465 ps->Device.bDACType &= _ADC_MASK;
468 ps->Device.bPCBID = IODataFromRegister( ps, ps->RegConfiguration );
469 ps->Device.bCCDID = ps->Device.bPCBID & 0x07;
470 ps->Device.bPCBID &= 0xf0;
472 if( _AGFA_SCANNER == ps->Device.bPCBID )
473 ps->Device.bDACType = _DA_WOLFSON8141;
476 ps->Device.bPCBID, ps->Device.bCCDID, ps->Device.bDACType );
478 p12InitiateComponentModel( ps );
481 ps->sCaps.dwFlag |= ((ULong)(ps->Device.bCCDID | ps->Device.bPCBID) << 16);
483 P12InitCCDandDAC( ps, shading );
485 if( ps->Shade.bIntermediate & _ScanMode_Mono )
486 ps->AsicReg.RD_Model1Control = ps->Device.Model1Mono;
488 ps->AsicReg.RD_Model1Control = ps->Device.Model1Color;
490 IODataToRegister( ps, ps->RegPllPredivider, 1 );
491 IODataToRegister( ps, ps->RegPllMaindivider, 0x20 );
492 IODataToRegister( ps, ps->RegPllPostdivider, 2 );
493 IODataToRegister( ps, ps->RegClockSelector, 3 ); /* 2 */
494 IODataToRegister( ps, ps->RegMotorDriverType,
495 ps->AsicReg.RD_MotorDriverType );
498 IODataToRegister( ps, ps->RegWaitStateInsert, 11 );
499 IODataToRegister( ps, ps->RegModel1Control, ps->AsicReg.RD_Model1Control );
501 p12ProgramCCD( ps );
507 static void p12InitializeAsicRegister( pScanData ps )
509 memset( &ps->AsicReg, 0, sizeof(RegData));
515 static void p12PutToIdleMode( pScanData ps )
519 ps->OpenScanPath( ps );
528 IODataToRegister( ps, p12CcdStop[i].bReg, p12CcdStop[i].bParam );
531 ps->CloseScanPath( ps );
537 static int p12Calibration( pScanData ps )
546 ps->OpenScanPath( ps );
548 _ASSERT(ps->WaitForShading);
549 result = ps->WaitForShading( ps );
550 ps->CloseScanPath( ps );
563 _LOC int P12InitAsic( pScanData ps )
572 p12InitializeAsicRegister( ps );
574 ps->IO.bOpenCount = 0;
579 ps->RegSwitchBus = 0;
580 ps->RegEPPEnable = 1;
581 ps->RegECPEnable = 2;
582 ps->RegReadDataMode = 3;
583 ps->RegWriteDataMode = 4;
584 ps->RegInitDataFifo = 5;
585 ps->RegForceStep = 6;
586 ps->RegInitScanState = 7;
587 ps->RegRefreshScanState = 8;
588 ps->RegWaitStateInsert = 0x0a;
589 ps->RegRFifoOffset = 0x0a;
590 ps->RegGFifoOffset = 0x0b;
591 ps->RegBFifoOffset = 0x0c;
592 ps->RegBitDepth = 0x13;
593 ps->RegStepControl = 0x14;
594 ps->RegMotor0Control = 0x15;
595 ps->RegXStepTime = 0x16;
596 ps->RegGetScanState = 0x17;
597 ps->RegAsicID = 0x18;
598 ps->RegMemoryLow = 0x19;
599 ps->RegMemoryHigh = 0x1a;
600 ps->RegModeControl = 0x1b;
601 ps->RegLineControl = 0x1c;
602 ps->RegScanControl = 0x1d;
603 ps->RegConfiguration = 0x1e;
604 ps->RegModelControl = 0x1f;
605 ps->RegModel1Control = 0x20;
606 ps->RegDpiLow = 0x21;
607 ps->RegDpiHigh = 0x22;
608 ps->RegScanPosLow = 0x23;
609 ps->RegScanPosHigh = 0x24;
610 ps->RegWidthPixelsLow = 0x25;
611 ps->RegWidthPixelsHigh = 0x26;
612 ps->RegThresholdLow = 0x27;
613 ps->RegThresholdHigh = 0x28;
614 ps->RegThresholdGapControl = 0x29;
615 ps->RegADCAddress = 0x2a;
616 ps->RegADCData = 0x2b;
617 ps->RegADCPixelOffset = 0x2c;
618 ps->RegADCSerialOutStr = 0x2d;
619 ps->RegResetConfig = 0x2e;
620 ps->RegLensPosition = 0x2f;
621 ps->RegStatus = 0x30;
622 ps->RegScanStateControl = 0x31;
623 ps->RegRedChDarkOffsetLow = 0x33;
624 ps->RegRedChDarkOffsetHigh = 0x34;
625 ps->RegGreenChDarkOffsetLow = 0x35;
626 ps->RegGreenChDarkOffsetHigh= 0x36;
627 ps->RegBlueChDarkOffsetLow = 0x37;
628 ps->RegBlueChDarkOffsetHigh = 0x38;
629 ps->RegResetPulse0 = 0x39;
630 ps->RegResetPulse1 = 0x3a;
631 ps->RegCCDClampTiming0 = 0x3b;
632 ps->RegCCDClampTiming1 = 0x3c;
633 ps->RegVSMPTiming0 = 0x41;
634 ps->RegVSMPTiming1 = 0x42;
635 ps->RegCCDQ1Timing0 = 0x43;
636 ps->RegCCDQ1Timing1 = 0x44;
637 ps->RegCCDQ1Timing2 = 0x45;
638 ps->RegCCDQ1Timing3 = 0x46;
639 ps->RegCCDQ2Timing0 = 0x47;
640 ps->RegCCDQ2Timing1 = 0x48;
641 ps->RegCCDQ2Timing2 = 0x49;
642 ps->RegCCDQ2Timing3 = 0x4a;
643 ps->RegADCclockTiming0 = 0x4b;
644 ps->RegADCclockTiming1 = 0x4c;
645 ps->RegADCclockTiming2 = 0x4d;
646 ps->RegADCclockTiming3 = 0x4e;
647 ps->RegADCDVTiming0 = 0x50;
648 ps->RegADCDVTiming1 = 0x51;
649 ps->RegADCDVTiming2 = 0x52;
650 ps->RegADCDVTiming3 = 0x53;
652 ps->RegFifoFullLength0 = 0x54;
653 ps->RegFifoFullLength1 = 0x55;
654 ps->RegFifoFullLength2 = 0x56;
656 ps->RegMotorTotalStep0 = 0x57;
657 ps->RegMotorTotalStep1 = 0x58;
658 ps->RegMotorFreeRunCount0 = 0x59;
659 ps->RegMotorFreeRunCount1 = 0x5a;
660 ps->RegScanControl1 = 0x5b;
661 ps->RegMotorFreeRunTrigger = 0x5c;
663 ps->RegResetMTSC = 0x5d;
665 ps->RegMotor1Control = 0x62;
666 ps->RegMotor2Control = 0x63;
667 ps->RegMotorDriverType = 0x64;
669 ps->RegStatus2 = 0x66;
671 ps->RegExtendedLineControl = 0x6d;
672 ps->RegExtendedXStep = 0x6e;
674 ps->RegPllPredivider = 0x71;
675 ps->RegPllMaindivider = 0x72;
676 ps->RegPllPostdivider = 0x73;
677 ps->RegClockSelector = 0x74;
678 ps->RegTestMode = 0xf0;
683 ps->SetupScannerVariables = p12SetupScannerVariables;
684 ps->SetupScanningCondition = p12SetupScanningCondition;
685 ps->Calibration = p12Calibration;
686 ps->PutToIdleMode = p12PutToIdleMode;
687 ps->ReInitAsic = p12Init98003;
689 ps->CtrlReadHighNibble = _CTRL_GENSIGNAL + _CTRL_AUTOLF + _CTRL_STROBE;
690 ps->CtrlReadLowNibble = _CTRL_GENSIGNAL + _CTRL_AUTOLF;
692 ps->IO.useEPPCmdMode = _FALSE;
698 result = DacInitialize( ps );
702 result = ImageInitialize( ps );
706 result = IOFuncInitialize( ps );
710 result = IOInitialize( ps );
714 result = MotorInitialize( ps );
718 if( _FALSE == ps->OpenScanPath( ps )) {
724 ps->Device.bPCBID = IODataFromRegister( ps, ps->RegConfiguration );
725 ps->Device.bCCDID = ps->Device.bPCBID & 0x07;
726 ps->Device.bPCBID &= 0xf0;
728 DBG( DBG_LOW, "PCB-ID=0x%02x, CCD-ID=0x%02x\n", ps->Device.bPCBID, ps->Device.bCCDID );
731 p12InitiateComponentModel( ps );
733 ps->CloseScanPath( ps );
736 if( _OPTICWORKS2000 == ps->Device.bPCBID ) {
748 _LOC void P12SetGeneralRegister( pScanData ps )
752 ps->Scan.fMotorBackward = _FALSE;
753 ps->Scan.fRefreshState = _FALSE;
755 if( COLOR_BW == ps->DataInf.wPhyDataType )
756 ps->AsicReg.RD_ScanControl = _SCAN_BITMODE;
758 if( ps->DataInf.wPhyDataType <= COLOR_TRUE24 )
759 ps->AsicReg.RD_ScanControl = _SCAN_BYTEMODE;
761 ps->AsicReg.RD_ScanControl = _SCAN_12BITMODE;
764 IOSelectLampSource( ps );
766 if( ps->Shade.bIntermediate & _ScanMode_AverageOut )
767 ps->AsicReg.RD_ModelControl = ps->Device.ModelCtrl | _ModelDpi300;
769 ps->AsicReg.RD_ModelControl = ps->Device.ModelCtrl | _ModelDpi600;
771 ps->AsicReg.RD_Motor0Control = _MotorOn | _MotorHQuarterStep | _MotorPowerEnable;
772 ps->AsicReg.RD_ScanControl1 = _SCANSTOPONBUFFULL | _MFRC_BY_XSTEP;
773 ps->AsicReg.RD_StepControl = _MOTOR0_SCANSTATE;