Lines Matching refs:ps
24 * - switching from Full- to Halfstep at ps->PhysicalDpi now in
95 static void p48xxSetMemoryBankForProgram( pScanData ps , Byte bBankAndSize )
98 IODataToRegister( ps, ps->RegModeControl, _ModeProgram );
101 IODataToRegister( ps, ps->RegMemAccessControl, bBankAndSize );
104 IORegisterToScanner( ps, ps->RegInitDataFifo );
110 static int p48xxDoTest( pScanData ps )
137 ps->OpenScanPath( ps );
139 p48xxSetMemoryBankForProgram( ps, cntr );
146 IOMoveDataToScanner( ps, (pUChar)buffer, _TEST_SZ );
152 p48xxSetMemoryBankForProgram( ps, _BankAndSizeForTest );
154 ps->CloseScanPath( ps );
157 IOReadScannerImageData( ps, (pUChar)buffer, _TEST_SZ );
173 ps->OpenScanPath( ps );
174 p48xxSetMemoryBankForProgram( ps, cntr );
175 ps->CloseScanPath( ps );
178 IOReadScannerImageData( ps, (pUChar)buffer, _TEST_SZ);
207 tmpByte = IODataRegisterFromScanner( ps, 0x18 );
211 tmpByte = IODataRegisterFromScanner( ps, 0x0e );
213 tmpByte, cntr, ps->sCaps.AsicID );
217 (ps->sCaps.AsicID == _ASIC_IS_96003)) {
229 if( _OVR_PLUSTEK_A3I == ps->ModelOverride ) {
232 ModelSetA3I( ps );
234 ModelSet12000( ps );
239 ModelSet9630( ps );
257 ModelSet4830( ps );
259 ModelSet600( ps );
276 static void p48xxSetAsicRegisters( pScanData ps )
278 memset( &ps->AsicReg, 0, sizeof(ps->AsicReg));
279 memset( &ps->Asic96Reg, 0, sizeof(ps->Asic96Reg));
280 memset( ps->a_nbNewAdrPointer, 0, _SCANSTATE_BYTES );
282 ps->AsicReg.RD_LineControl = ps->TimePerLine;
283 ps->AsicReg.RD_ScanControl = _SCAN_LAMP_ON;
284 ps->AsicReg.RD_ModelControl = ps->Device.ModelCtrl | _ModelWhiteIs0;
285 ps->AsicReg.RD_Origin = 0;
286 ps->AsicReg.RD_Pixels = 5110; /*ps->RdPix;*/
287 ps->Asic96Reg.RD_MotorControl = 0;
288 ps->Asic96Reg.RD_WatchDogControl = 0; /* org. val = 0x8f; */
290 IOPutOnAllRegisters( ps );
296 static int p48xxCheck4800Memory( pScanData ps )
311 ps->OpenScanPath( ps );
312 p48xxSetMemoryBankForProgram( ps, _BankAndSizeForTest );
317 IOMoveDataToScanner( ps, buffer, 1280 ); /* fill to buffer */
318 p48xxSetMemoryBankForProgram( ps, _BankAndSizeForTest );
319 ps->CloseScanPath( ps );
322 IOReadScannerImageData( ps, buffer + 1280, 1280 );
341 static int p48xxInitAllModules( pScanData ps )
345 result = DacInitialize( ps );
349 result = ImageInitialize( ps );
353 result = IOFuncInitialize( ps );
357 result = IOInitialize( ps );
361 result = MotorInitialize( ps );
369 if( _FALSE == MiscAllPointersSet( ps ))
378 static int p48xxReadWriteTest( pScanData ps )
388 ps->RedDataReady = 0x01; /* normal for Red and Green */
389 ps->GreenDataReady = 0x02;
390 ps->AsicRedColor = 0x01;
391 ps->AsicGreenColor = 0x03;
396 if ( _NO_BASE == ps->sCaps.wIOBase ) {
399 ps->sCaps.AsicID = IODataRegisterFromScanner( ps, ps->RegAsicID );
401 if ( _ASIC_IS_96003 == ps->sCaps.AsicID ) {
404 DBG( DBG_LOW, "Found a 96003 ASIC at Reg 0x%x\n", ps->RegAsicID );
405 ModelSet4830( ps );
409 if ( _ASIC_IS_96001 == ps->sCaps.AsicID ) {
411 ps->RegAsicID );
412 ModelSet4800( ps );
415 ps->sCaps.AsicID );
424 p48xxSetAsicRegisters( ps );
426 if ( _ASIC_IS_96003 == ps->sCaps.AsicID ) {
427 retval = p48xxDoTest( ps );
435 p48xxSetAsicRegisters( ps );
436 retval = p48xxInitAllModules( ps );
446 return p48xxCheck4800Memory( ps );
460 static void p48xxSetupScannerVariables( pScanData ps )
467 ps->OpenScanPath( ps );
469 IODataToRegister( ps, ps->RegModelControl2, _Model2ChannelMult );
471 if( 2 == IODataFromRegister( ps, ps->RegWriteIOBusDecode1 )) {
474 ps->f97003 = _TRUE;
475 ps->b97003DarkR = 8;
476 ps->b97003DarkG = 8;
477 ps->b97003DarkB = 8;
479 ps->Asic96Reg.u26.RD_ModelControl2 = _Model2ChannelMult;
483 ps->f97003 = _FALSE;
484 ps->Asic96Reg.u26.RD_ModelControl2 = _Model2DirectOutPort;
487 IODataToRegister( ps, ps->RegModelControl2,
488 ps->Asic96Reg.u26.RD_ModelControl2 );
490 tmp = IODataFromRegister( ps, ps->RegStatus );
501 ps->fSonyCCD = _FALSE;
504 ps->fSonyCCD = _TRUE;
508 ps->CloseScanPath( ps );
510 ps->b1stColorByte = ps->AsicRedColor;
511 ps->b1stColor = ps->RedDataReady;
513 if (ps->fSonyCCD) {
515 ps->b2ndColorByte = ps->AsicGreenColor;
516 ps->b2ndColor = ps->GreenDataReady;
517 ps->b3rdColorByte = _ASIC_BLUECOLOR;
518 ps->b3rdColor = _BLUE_DATA_READY;
522 ps->b2ndColorByte = _ASIC_BLUECOLOR;
523 ps->b2ndColor = _BLUE_DATA_READY;
524 ps->b3rdColorByte = ps->AsicGreenColor;
525 ps->b3rdColor = ps->GreenDataReady;
528 ps->b1stMask = (Byte)~ps->b1stColor;
529 ps->b2ndMask = (Byte)~ps->b2ndColor;
530 ps->b3rdMask = (Byte)~ps->b3rdColor;
532 ps->b1stLinesOffset = 17;
533 ps->b2ndLinesOffset = 9;
540 if( _PORT_SPP != ps->IO.portMode ) {
552 IOReadScannerImageData( ps, pBuf, (_BUF_SIZE_BASE_CONST * 2));
558 ps->bExtraAdd = 0;
560 ps->bExtraAdd = 2;
565 ps->bExtraAdd = 2; /* poor resource */
568 ps->bExtraAdd = 0;
575 static void p48xxSetGeneralRegister( pScanData ps )
577 if( MODEL_OP_A3I == ps->sCaps.Model ) {
578 ps->AsicReg.RD_ModelControl = _ModelDpi400 | _ModelWhiteIs0 |
582 ps->AsicReg.RD_ModeControl = _ModeScan;
584 /* WORK: ps->PhysicalDpi should be correct, but the we have to work
586 * if ( ps->DataInf.xyAppDpi.y <= ps->PhysicalDpi ) {
588 if ( ps->DataInf.xyAppDpi.y <= 300 ) {
590 if ( ps->DataInf.xyAppDpi.y <= ps->PhysicalDpi ) {
592 ps->Asic96Reg.RD_MotorControl = (ps->FullStep | ps->IgnorePF |
593 ps->MotorOn | _MotorDirForward);
595 ps->Asic96Reg.RD_MotorControl = (ps->IgnorePF | ps->MotorOn |
599 if ( ps->DataInf.wPhyDataType == COLOR_BW ) {
600 ps->AsicReg.RD_ScanControl = ps->bLampOn;
602 if (!(ps->DataInf.dwScanFlag & SCANDEF_Inverse))
603 ps->AsicReg.RD_ScanControl |= _P96_SCANDATA_INVERT;
607 ps->AsicReg.RD_ScanControl = ps->bLampOn | _SCAN_BYTEMODE;
609 if (ps->DataInf.dwScanFlag & SCANDEF_Inverse)
610 ps->AsicReg.RD_ScanControl |= _P96_SCANDATA_INVERT;
613 if (ps->DataInf.xyPhyDpi.x <= 200)
614 ps->AsicReg.RD_ScanControl |= _SCAN_1ST_AVERAGE;
616 DBG( DBG_LOW, "RD_ModeControl = 0x%02x\n", ps->AsicReg.RD_ModeControl );
617 DBG( DBG_LOW, "RD_MotorControl = 0x%02x\n", ps->Asic96Reg.RD_MotorControl );
618 DBG( DBG_LOW, "RD_ScanControl = 0x%02x\n", ps->AsicReg.RD_ScanControl );
624 static void p48xxSetupScanningCondition( pScanData ps )
628 IORegisterDirectToScanner( ps, ps->RegInitDataFifo );
631 if( MODEL_OP_A3I == ps->sCaps.Model )
632 ps->wLinesPer64kTime = (UShort)(65555UL / ps->DataInf.dwAsicBytesPerPlane *
635 ps->wLinesPer64kTime = (UShort)(65555UL / ps->DataInf.dwAsicBytesPerPlane *
638 DBG( DBG_LOW, "wLinesPer64kTime = %u\n", ps->wLinesPer64kTime );
640 ps->InitialSetCurrentSpeed( ps );
642 DBG( DBG_LOW, "Current Speed = %u\n", ps->bCurrentSpeed );
644 ps->bMinReadFifo = (Byte)((ps->DataInf.dwAsicBytesPerPlane + 511) / 512);
645 DBG( DBG_LOW, "MinReadFifo = %u\n", ps->bMinReadFifo );
647 p48xxSetGeneralRegister( ps );
652 if( ps->DataInf.wPhyDataType >= COLOR_256GRAY &&
653 !(ps->bCurrentSpeed & 1) && (ps->DataInf.xyAppDpi.y <= 300)) {
655 if( !(ps->bCurrentSpeed & 1) && (ps->DataInf.xyAppDpi.y <= ps->PhysicalDpi)) {
657 ps->fHalfStepTableFlag = _TRUE;
658 ps->Asic96Reg.RD_MotorControl &= ps->StepMask;
661 ps->AsicReg.RD_Dpi = ps->DataInf.xyPhyDpi.x;
662 DBG( DBG_LOW, "RD_Dpi = %u\n", ps->AsicReg.RD_Dpi );
664 /* SetStartStopRegister (ps) */
665 ps->AsicReg.RD_Origin = (UShort)(ps->Offset70 + ps->Device.DataOriginX +
666 ps->DataInf.crImage.x);
668 if (ps->DataInf.wPhyDataType < COLOR_256GRAY) {
669 ps->AsicReg.RD_Pixels =
670 (UShort)(ps->DataInf.dwAsicPixelsPerPlane + 7) & 0xfff8;
672 ps->AsicReg.RD_Pixels = (UShort)ps->DataInf.dwAsicPixelsPerPlane;
675 DBG( DBG_LOW, "RD_Pixels = %u\n", ps->AsicReg.RD_Pixels );
678 IORegisterDirectToScanner( ps, ps->RegInitDataFifo);
679 ps->SetupMotorRunTable( ps );
681 IOSetToMotorRegister( ps );
683 ps->pCurrentColorRunTable = ps->pColorRunTable;
684 ps->bCurrentLineCount = 0;
686 IOPutOnAllRegisters( ps );
688 ps->OpenScanPath( ps );
695 if((600 == ps->PhysicalDpi) && (1 == ps->bCurrentSpeed)) {
697 ps->Asic96Reg.RD_MotorControl &= ~ps->FullStep;
700 IODataToRegister( ps, ps->RegMotorControl,
701 (Byte)(ps->Asic96Reg.RD_MotorControl & ~ps->MotorOn));
702 IODataToRegister( ps, ps->RegMotorControl, ps->Asic96Reg.RD_MotorControl);
703 IORegisterToScanner( ps, ps->RegInitDataFifo );
705 ps->CloseScanPath( ps );
711 static void p48xxPutToIdleMode( pScanData ps )
718 ps->Asic96Reg.RD_MotorControl = 0;
719 IOCmdRegisterToScanner( ps, ps->RegMotorControl, 0 );
728 static int p48xxCalibration( pScanData ps )
732 ps->Scan.bFifoSelect = ps->RegGFifoOffset;
736 _ASSERT(ps->WaitForShading);
737 if (ps->WaitForShading( ps )) {
739 if(!(ps->DataInf.dwScanFlag & SCANDEF_TPA)) {
742 MotorP96AheadToDarkArea( ps );
744 if( ps->Scan.fRefreshState ) {
745 ps->Scan.fRefreshState = _FALSE;
747 if (!ps->fReshaded) {
748 ps->fReshaded = _TRUE;
750 if (ps->fColorMoreRedFlag || ps->fColorMoreBlueFlag) {
759 ps->fScanningStatus = _FALSE;
760 ps->DataInf.dwAppLinesPerArea = 0;
765 if((ps->sCaps.AsicID != _ASIC_IS_96001) &&
766 (ps->DataInf.wPhyDataType != COLOR_BW)) {
767 DacP96WriteBackToGammaShadingRAM(ps);
770 if( ps->DataInf.dwScanFlag & SCANDEF_TPA ) {
771 ps->bExtraMotorCtrl = 0;
772 ps->Scan.fMotorBackward = _TRUE;
773 MotorP96ConstantMoveProc( ps, 4000 );
779 _ASSERT(ps->WaitForPositionY);
780 ps->WaitForPositionY(ps);
789 _LOC int P48xxInitAsic( pScanData ps )
793 ps->IO.bOpenCount = 0;
795 ps->RegSwitchBus = 0;
796 ps->RegReadDataMode = 1;
797 ps->RegWriteDataMode = 2;
798 ps->RegEPPEnable = 3;
799 ps->RegInitDataFifo = 4;
800 ps->RegForceStep = 5;
801 ps->RegInitScanState = 6;
802 ps->RegRefreshScanState = 7;
803 ps->RegStatus = 0x10;
804 ps->RegFifoOffset = 0x11;
805 ps->RegGetScanState = 0x12;
806 ps->RegAsicID = 0x13; /* Determine the asic */
807 ps->RegReadIOBufBus = 0x17;
808 ps->RegModeControl = 0x18;
809 ps->RegLineControl = 0x19;
810 ps->RegScanControl = 0x1a;
811 ps->RegMotorControl = 0x1b;
812 ps->RegModelControl = 0x1c;
813 ps->RegMemAccessControl = 0x1d;
814 ps->RegDpiLow = 0x1e;
815 ps->RegDpiHigh = 0x1f;
816 ps->RegScanPosLow = 0x20;
817 ps->RegScanPosHigh = 0x21;
818 ps->RegWidthPixelsLow = 0x22;
819 ps->RegWidthPixelsHigh = 0x23;
820 ps->RegThresholdControl = 0x24;
821 ps->RegWatchDogControl = 0x25;
822 ps->RegModelControl2 = 0x26;
823 ps->RegThresholdGapControl = 0x27;
824 ps->RegRedChShadingOffset = 0x28;
825 ps->RegGreenChShadingOffset = 0x29;
826 ps->RegRedDCAdjust = 0x27; /* not sure why these are dup's */
827 ps->RegGreenDCAdjust = 0x28;
828 ps->RegBlueDCAdjust = 0x29;
829 ps->RegBlueChShadingOffset = 0x2a;
830 ps->RegRedChDarkOffset = 0x2b;
831 ps->RegGreenChDarkOffset = 0x2c;
832 ps->RegBlueChDarkOffset = 0x2d;
833 ps->RegWriteIOBusDecode1 = 0x2e;
834 ps->RegWriteIOBusDecode2 = 0x2f;
835 ps->RegScanStateControl = 0x30;
836 ps->RegRedChEvenOffset = 0x31;
837 ps->RegGreenChEvenOffset = 0x32;
838 ps->RegBlueChEvenOffset = 0x33;
839 ps->RegRedChOddOffset = 0x34;
840 ps->RegGreenChOddOffset = 0x35;
841 ps->RegBlueChOddOffset = 0x36;
842 ps->RegRedGainOutDirect = 0x37;
843 ps->RegGreenGainOutDirect = 0x38;
844 ps->RegBlueGainOutDirect = 0x39;
845 ps->RegLedControl = 0x3a;
846 ps->RegShadingCorrectCtrl = 0x3b;
847 ps->RegScanStateBegin = 0x40; /* (0, 1) */
848 ps->RegScanStateEnd = 0x5f; /* (62, 63) */
853 ps->ReadWriteTest = p48xxReadWriteTest;
854 ps->SetupScannerVariables = p48xxSetupScannerVariables;
855 ps->SetupScanningCondition = p48xxSetupScanningCondition;
856 ps->PutToIdleMode = p48xxPutToIdleMode;
857 ps->Calibration = p48xxCalibration;
862 ps->CtrlReadHighNibble = _CTRL_GENSIGNAL + _CTRL_AUTOLF;
863 ps->CtrlReadLowNibble = _CTRL_GENSIGNAL + _CTRL_AUTOLF + _CTRL_STROBE;
865 ps->MotorFreeRun = 0x80;
866 ps->bLampOn = _SCAN_LAMP_ON;
867 ps->f97003 = _FALSE;
872 return p48xxInitAllModules( ps );