summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog2
-rw-r--r--backend/sm3600-color.c2
-rw-r--r--backend/sm3600-gray.c2
-rw-r--r--backend/sm3600-scanmtek.c16
-rw-r--r--backend/sm3600.h2
5 files changed, 12 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index e2442f4..38a23a0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,6 +13,8 @@
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.
+ * backend/sm3600.c : Fixed off-by-one-error in p->lines
+ backend/sm3600-scanmtek: Fixed just broken UploadGainCorrection()
2004-04-14 Karl Heinz Kremer <khk@khk.net>
diff --git a/backend/sm3600-color.c b/backend/sm3600-color.c
index 9b4a17f..9b3c540 100644
--- a/backend/sm3600-color.c
+++ b/backend/sm3600-color.c
@@ -271,7 +271,7 @@ TState StartScanColor(TInstance *this)
UploadGammaTable(this,0x4000,this->agammaB);
INST_ASSERT();
- UploadGainCorrection(this);
+ UploadGainCorrection(this,0x6000);
INST_ASSERT();
/* enough for 1/100 inch sensor distance */
diff --git a/backend/sm3600-gray.c b/backend/sm3600-gray.c
index 195258b..d9fda86 100644
--- a/backend/sm3600-gray.c
+++ b/backend/sm3600-gray.c
@@ -346,7 +346,7 @@ TState StartScanGray(TInstance *this)
RegWrite(this,0x40,1,0x20); /* FIFO at 0x08000 */
UploadGammaTable(this,0,this->agammaY); INST_ASSERT();
- UploadGainCorrection(this);
+ UploadGainCorrection(this, 0x2000);
INST_ASSERT();
/* for halftone dithering we need one history line */
diff --git a/backend/sm3600-scanmtek.c b/backend/sm3600-scanmtek.c
index 5297efa..4aa4f1b 100644
--- a/backend/sm3600-scanmtek.c
+++ b/backend/sm3600-scanmtek.c
@@ -280,16 +280,13 @@ UploadGainCorrection()
********************************************************************** */
__SM3600EXPORT__
-TState UploadGainCorrection(TInstance *this)
+TState UploadGainCorrection(TInstance *this, int iTableOffset)
{
-#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];
+ } aGain[0x2000]; /* 16 KB */
int i,iOff;
unsigned short uwGain;
@@ -297,16 +294,17 @@ TState UploadGainCorrection(TInstance *this)
Oopsi: correction data starts at the left of the scanning window!
*/
iOff=this->param.x/2+this->calibration.xMargin;
- memset(aGain,0,sizeof(aGain));
+ memset(aGain,0xFF,sizeof(aGain));
+ RegWrite(this,0x3D,1,0x0F | 0x80); /* 10XXXXXX : one offset table */
+ RegWrite(this,0x3F,1, iTableOffset==0x6000 ? 0x18 : 0x08); /* 16KB gain at 0x06000 or 0x02000 */
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));
+ for (i=0; i<0x4000; i+=0x1000)
+ MemWriteArray(this,(iTableOffset+i)>>1,0x1000,((unsigned char*)aGain)+i);
}
-#endif
return SANE_STATUS_GOOD;
}
diff --git a/backend/sm3600.h b/backend/sm3600.h
index 1dec468..2898900 100644
--- a/backend/sm3600.h
+++ b/backend/sm3600.h
@@ -283,7 +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);
+__SM3600EXPORT__ TState UploadGainCorrection(TInstance *this, int iTableOffset);
/* sm3600-scanusb.c */
__SM3600EXPORT__ TState RegWrite(TInstance *this,int iRegister, int cb, unsigned long ulValue);