kopia lustrzana https://gitlab.com/sane-project/backends
				
				
				
			Portability fixes and tweaks for sm3600
							rodzic
							
								
									f0d0397273
								
							
						
					
					
						commit
						41b72dc6e6
					
				|  | @ -1,3 +1,12 @@ | |||
| 2004-04-15  Marian Eichholz <eichholz@computer.org> | ||||
| 
 | ||||
| 	* backend/sm3600.h backend/sm3600-scanmtek.c | ||||
| 	  backend/sm3600-color.c backend/sm3600-gray.c | ||||
| 	  backend/sm3600-homerun.c: Many fixes for MacOS-X problems pointed | ||||
| 	  out by Mattias Ellert, thanks: Waiting longer for DoJog() command | ||||
| 	  completion, new function for transmitting the line gain correction | ||||
| 	  data with correct endianess, Chassis-Gray-Level lowered. | ||||
| 
 | ||||
| 2004-04-14  Karl Heinz Kremer <khk@khk.net> | ||||
| 
 | ||||
| 	* backend/epson.conf: Added "usb" entry for libusb | ||||
|  |  | |||
|  | @ -271,23 +271,8 @@ TState StartScanColor(TInstance *this) | |||
|   UploadGammaTable(this,0x4000,this->agammaB); | ||||
|   INST_ASSERT(); | ||||
| 
 | ||||
| #ifndef SM3600_NO_GAIN_CORRECTION | ||||
|   RegWrite(this,0x3D,1,0x0F | 0x80); /* 10XXXXXX : one offset table */ | ||||
|   RegWrite(this,0x3F,1,0x18); /* 16KB gain at 0x06000 */ | ||||
|   { | ||||
|     unsigned short uwGain[8192]; | ||||
|     int i,iOff; | ||||
| 
 | ||||
|     /*
 | ||||
|       Oopsi: correction data starts at the left of the scanning window! | ||||
|     */ | ||||
|     iOff=this->param.x/2+this->calibration.xMargin; | ||||
|     for (i=iOff; i<MAX_PIXEL_PER_SCANLINE; i++) | ||||
|       uwGain[i-iOff]=this->calibration.achStripeY[i]<<4; | ||||
|     for (i=0; i<0x4000; i+=0x1000) | ||||
|       MemWriteArray(this,(0x6000+i)>>1,0x1000,(unsigned char*)&uwGain[i>>1]); | ||||
|   } | ||||
| #endif | ||||
|   UploadGainCorrection(this); | ||||
|   INST_ASSERT(); | ||||
| 
 | ||||
|   /* enough for 1/100 inch sensor distance */ | ||||
|   this->state.cBacklog=1+2*this->state.ySensorSkew; | ||||
|  |  | |||
|  | @ -346,23 +346,8 @@ TState StartScanGray(TInstance *this) | |||
|   RegWrite(this,0x40,1,0x20); /* FIFO at   0x08000 */ | ||||
|   UploadGammaTable(this,0,this->agammaY); INST_ASSERT(); | ||||
| 
 | ||||
| #ifndef SM3600_NO_GAIN_CORRECTION | ||||
|   RegWrite(this,0x3D,1,0x0F | 0x80); /* 10XXXXXX : one offset table */ | ||||
|   RegWrite(this,0x3F,1,0x08); /* 16KB gain at 0x02000 */ | ||||
|   { | ||||
|     unsigned short uwGain[8192]; | ||||
|     int i,iOff; | ||||
| 
 | ||||
|     /*
 | ||||
|       Oopsi: correction data starts at the left of the scanning window! | ||||
|     */ | ||||
|     iOff=this->param.x/2+this->calibration.xMargin; | ||||
|     for (i=iOff; i<MAX_PIXEL_PER_SCANLINE; i++) | ||||
|       uwGain[i-iOff]=this->calibration.achStripeY[i]<<4; | ||||
|     for (i=0; i<0x4000; i+=0x1000) | ||||
|       MemWriteArray(this,(0x2000+i)>>1,0x1000,(unsigned char*)&uwGain[i>>1]); | ||||
|   } | ||||
| #endif | ||||
|   UploadGainCorrection(this); | ||||
|   INST_ASSERT(); | ||||
| 
 | ||||
|   /* for halftone dithering we need one history line */ | ||||
|   this->state.pchBuf=malloc(USB_CHUNK_SIZE); | ||||
|  |  | |||
|  | @ -56,9 +56,11 @@ slider movement | |||
| /* tuning constants for DoOriginate */ | ||||
| #define CCH_BONSAI              60 | ||||
| #define BLACK_HOLE_GRAY         30 | ||||
| #define CHASSIS_GRAY_LEVEL      100 | ||||
| #define BLACK_BED_LEVEL         10 | ||||
| 
 | ||||
| /* changed by user request from 100, there are probably darker stripes */ | ||||
| #define CHASSIS_GRAY_LEVEL      75 | ||||
| 
 | ||||
| typedef enum { ltHome, ltUnknown, ltBed, ltError } TLineType; | ||||
| 
 | ||||
| #define INST_ASSERT2() { if (this->nErrorState) return ltError; } | ||||
|  | @ -492,6 +494,6 @@ TState DoJog(TInstance *this, int nDistance) | |||
|     } | ||||
|   INST_ASSERT(); | ||||
|   usleep(100); | ||||
|   return WaitWhileBusy(this,100); | ||||
|   return WaitWhileBusy(this,1000); /* thanks Mattias Ellert */ | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -272,3 +272,41 @@ TState UploadGammaTable(TInstance *this, int iByteAddress, SANE_Int *pnGamma) | |||
|   free(puchGamma); | ||||
|   return rc; | ||||
| } | ||||
| 
 | ||||
| /* **********************************************************************
 | ||||
| 
 | ||||
| UploadGainCorrection() | ||||
| 
 | ||||
| ********************************************************************** */ | ||||
| 
 | ||||
| __SM3600EXPORT__ | ||||
| TState UploadGainCorrection(TInstance *this) | ||||
| { | ||||
| #ifndef SM3600_NO_GAIN_CORRECTION | ||||
|   RegWrite(this,0x3D,1,0x0F | 0x80); /* 10XXXXXX : one offset table */ | ||||
|   RegWrite(this,0x3F,1,0x18); /* 16KB gain at 0x06000 */ | ||||
|   { | ||||
|     struct TGain { | ||||
|       unsigned char uchLow; | ||||
|       unsigned char uchHigh; | ||||
|     } aGain[8192]; | ||||
|     int i,iOff; | ||||
|     unsigned short uwGain; | ||||
| 
 | ||||
|     /*
 | ||||
|       Oopsi: correction data starts at the left of the scanning window! | ||||
|     */ | ||||
|     iOff=this->param.x/2+this->calibration.xMargin; | ||||
|     memset(aGain,0,sizeof(aGain)); | ||||
|     for (i=iOff; i<MAX_PIXEL_PER_SCANLINE; i++) | ||||
|       { | ||||
| 	uwGain=this->calibration.achStripeY[i]<<4; | ||||
| 	aGain[i-iOff].uchLow =(unsigned char)(uwGain&0xFF); | ||||
| 	aGain[i-iOff].uchHigh=(unsigned char)(uwGain>>8); | ||||
|       } | ||||
|     for (i=0; i<0x2000; i+=0x1000) | ||||
|       MemWriteArray(this,(0x6000+i)>>1,0x1000,(unsigned char*)(aGain+i)); | ||||
|   } | ||||
| #endif | ||||
|   return SANE_STATUS_GOOD; | ||||
| } | ||||
|  |  | |||
|  | @ -683,7 +683,7 @@ sane_get_parameters (SANE_Handle handle, SANE_Parameters *p) | |||
|   GetAreaSize(this); | ||||
|   p->pixels_per_line=this->state.cxPixel; | ||||
|   /* TODO: we need a more stable cyPixel prediction */ | ||||
|   p->lines=this->state.cyPixel+1; | ||||
|   p->lines=this->state.cyPixel; | ||||
|   p->last_frame=SANE_TRUE; | ||||
|   switch (this->mode) | ||||
|     { | ||||
|  |  | |||
|  | @ -283,6 +283,7 @@ __SM3600EXPORT__ TState DoLampSwitch(TInstance *this,int nPattern); | |||
| #endif | ||||
| __SM3600EXPORT__ TState DoCalibration(TInstance *this); | ||||
| __SM3600EXPORT__ TState UploadGammaTable(TInstance *this, int iByteAddress, SANE_Int *pnGamma); | ||||
| __SM3600EXPORT__ TState UploadGainCorrection(TInstance *this); | ||||
| 
 | ||||
| /* sm3600-scanusb.c */ | ||||
| __SM3600EXPORT__ TState RegWrite(TInstance *this,int iRegister, int cb, unsigned long ulValue); | ||||
|  |  | |||
		Ładowanie…
	
		Reference in New Issue
	
	 Marian Eichholz
						Marian Eichholz