kopia lustrzana https://gitlab.com/sane-project/backends
moving critical timing for backward movement to niash_core
rodzic
b4a33c8861
commit
2cb4f0227e
|
@ -1,3 +1,8 @@
|
||||||
|
2004-10-27 Ullrich Sigwanz <usigwanz@freesurf.ch>
|
||||||
|
|
||||||
|
* backend/niash_core.c backend/niash.c: moving critical timing
|
||||||
|
for backward movement to niash_core
|
||||||
|
|
||||||
2004-10-24 Henning Meier-Geinitz <henning@meier-geinitz.de>
|
2004-10-24 Henning Meier-Geinitz <henning@meier-geinitz.de>
|
||||||
|
|
||||||
* doc/descriptions/unsupported.desc
|
* doc/descriptions/unsupported.desc
|
||||||
|
|
|
@ -1394,17 +1394,10 @@ sane_read (SANE_Handle h, SANE_Byte * buf, SANE_Int maxlen, SANE_Int * len)
|
||||||
/* time to read the next line? */
|
/* time to read the next line? */
|
||||||
if (s->iBytesLeft == 0)
|
if (s->iBytesLeft == 0)
|
||||||
{
|
{
|
||||||
SANE_Bool fJustDone = SANE_FALSE;
|
|
||||||
/* read a line from the transfer buffer */
|
/* read a line from the transfer buffer */
|
||||||
if (CircBufferGetLineEx (s->HWParams.iXferHandle, p, p->pabLineBuf,
|
if (CircBufferGetLineEx (s->HWParams.iXferHandle, p, p->pabLineBuf,
|
||||||
s->HWParams.iReversedHead, &fJustDone))
|
s->HWParams.iReversedHead, SANE_TRUE))
|
||||||
{
|
{
|
||||||
if (fJustDone)
|
|
||||||
{
|
|
||||||
DBG (DBG_MSG, "\n");
|
|
||||||
DBG (DBG_MSG, "sane_read: returning cartridge\n");
|
|
||||||
FinishScan (&s->HWParams);
|
|
||||||
}
|
|
||||||
pMode->adaptFormat (p->pabLineBuf, s->iPixelsPerLine,
|
pMode->adaptFormat (p->pabLineBuf, s->iPixelsPerLine,
|
||||||
s->aValues[optThreshold].w);
|
s->aValues[optThreshold].w);
|
||||||
s->iBytesLeft = pMode->bytesPerLine (s->iPixelsPerLine);
|
s->iBytesLeft = pMode->bytesPerLine (s->iPixelsPerLine);
|
||||||
|
@ -1414,10 +1407,10 @@ sane_read (SANE_Handle h, SANE_Byte * buf, SANE_Int maxlen, SANE_Int * len)
|
||||||
because we try read after the end of the buffer */
|
because we try read after the end of the buffer */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
FinishScan (&s->HWParams);
|
||||||
CircBufferExit (p);
|
CircBufferExit (p);
|
||||||
free (p->pabLineBuf);
|
free (p->pabLineBuf);
|
||||||
p->pabLineBuf = NULL;
|
p->pabLineBuf = NULL;
|
||||||
FinishScan (&s->HWParams);
|
|
||||||
*len = 0;
|
*len = 0;
|
||||||
DBG (DBG_MSG, "\n");
|
DBG (DBG_MSG, "\n");
|
||||||
DBG (DBG_MSG, "sane_read: read after end of buffer\n");
|
DBG (DBG_MSG, "sane_read: read after end of buffer\n");
|
||||||
|
|
|
@ -725,13 +725,10 @@ InitScan (TScanParams * pParams, THWParams * pHWParams)
|
||||||
|
|
||||||
static SANE_Bool
|
static SANE_Bool
|
||||||
XferBufferGetLine (int iHandle, TDataPipe * p, unsigned char *pabLine,
|
XferBufferGetLine (int iHandle, TDataPipe * p, unsigned char *pabLine,
|
||||||
SANE_Bool * pfJustDone)
|
SANE_Bool fReturn)
|
||||||
{
|
{
|
||||||
unsigned char bData;
|
unsigned char bData, bData2;
|
||||||
if (pfJustDone)
|
SANE_Bool fJustDone = SANE_FALSE;
|
||||||
{
|
|
||||||
*pfJustDone = SANE_FALSE;
|
|
||||||
}
|
|
||||||
/* all calculated transfers done ? */
|
/* all calculated transfers done ? */
|
||||||
if (p->iLinesLeft == 0)
|
if (p->iLinesLeft == 0)
|
||||||
return SANE_FALSE;
|
return SANE_FALSE;
|
||||||
|
@ -753,17 +750,21 @@ XferBufferGetLine (int iHandle, TDataPipe * p, unsigned char *pabLine,
|
||||||
"reading reduced number of lines: %d instead of %d\n",
|
"reading reduced number of lines: %d instead of %d\n",
|
||||||
iLines, p->iLinesPerXferBuf);
|
iLines, p->iLinesPerXferBuf);
|
||||||
}
|
}
|
||||||
if (pfJustDone)
|
fJustDone = SANE_TRUE;
|
||||||
{
|
|
||||||
*pfJustDone = SANE_TRUE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
/* reading old buffer level */
|
||||||
NiashReadReg (iHandle, 0x20, &bData);
|
NiashReadReg (iHandle, 0x20, &bData);
|
||||||
DBG (DBG_MSG, "buffer level = %3d, <reading %5d unsigned chars>, ",
|
|
||||||
(int) bData, iLines * p->iBytesPerLine);
|
|
||||||
NiashReadBulk (iHandle, p->pabXferBuf, iLines * p->iBytesPerLine);
|
NiashReadBulk (iHandle, p->pabXferBuf, iLines * p->iBytesPerLine);
|
||||||
NiashReadReg (iHandle, 0x20, &bData);
|
/* reding new buffer level */
|
||||||
DBG (DBG_MSG, "buffer level = %3d\r", bData);
|
NiashReadReg (iHandle, 0x20, &bData2);
|
||||||
|
if (fJustDone && fReturn)
|
||||||
|
{
|
||||||
|
NiashWriteReg (iHandle, 0x02, 0x80);
|
||||||
|
DBG (DBG_MSG, "returning scanner head\n");
|
||||||
|
}
|
||||||
|
DBG (DBG_MSG,
|
||||||
|
"buffer level = %3d, <reading %5d unsigned chars>, buffer level = %3d\r",
|
||||||
|
(int) bData, iLines * p->iBytesPerLine, (int) bData2);
|
||||||
fflush (stdout);
|
fflush (stdout);
|
||||||
}
|
}
|
||||||
/* copy one line */
|
/* copy one line */
|
||||||
|
@ -793,7 +794,7 @@ XferBufferInit (int iHandle, TDataPipe * p)
|
||||||
/* skip garbage lines */
|
/* skip garbage lines */
|
||||||
for (i = 0; i < p->iSkipLines; i++)
|
for (i = 0; i < p->iSkipLines; i++)
|
||||||
{
|
{
|
||||||
XferBufferGetLine (iHandle, p, NULL, NULL);
|
XferBufferGetLine (iHandle, p, NULL, SANE_FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -809,13 +810,13 @@ CircBufferFill (int iHandle, TDataPipe * p, SANE_Bool iReversedHead)
|
||||||
{
|
{
|
||||||
XferBufferGetLine (iHandle, p,
|
XferBufferGetLine (iHandle, p,
|
||||||
&p->pabCircBuf[p->iRedLine * p->iBytesPerLine],
|
&p->pabCircBuf[p->iRedLine * p->iBytesPerLine],
|
||||||
NULL);
|
SANE_FALSE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
XferBufferGetLine (iHandle, p,
|
XferBufferGetLine (iHandle, p,
|
||||||
&p->pabCircBuf[p->iBluLine * p->iBytesPerLine],
|
&p->pabCircBuf[p->iBluLine * p->iBytesPerLine],
|
||||||
NULL);
|
SANE_FALSE);
|
||||||
}
|
}
|
||||||
/* advance pointers */
|
/* advance pointers */
|
||||||
p->iRedLine = (p->iRedLine + 1) % p->iLinesPerCircBuf;
|
p->iRedLine = (p->iRedLine + 1) % p->iLinesPerCircBuf;
|
||||||
|
@ -925,10 +926,10 @@ _UnscrambleLine (unsigned char *pabLine,
|
||||||
|
|
||||||
|
|
||||||
/* gets an unscrambled line from the circular buffer. the first couple of lines contain garbage,
|
/* gets an unscrambled line from the circular buffer. the first couple of lines contain garbage,
|
||||||
if pfJustDone!=NULL this element will be set SANE_TRUE, when the last scan was done*/
|
if fReturn==SANE_TRUE, the head will return automatically on an end of scan */
|
||||||
STATIC SANE_Bool
|
STATIC SANE_Bool
|
||||||
CircBufferGetLineEx (int iHandle, TDataPipe * p, unsigned char *pabLine,
|
CircBufferGetLineEx (int iHandle, TDataPipe * p, unsigned char *pabLine,
|
||||||
SANE_Bool iReversedHead, SANE_Bool * pfJustDone)
|
SANE_Bool iReversedHead, SANE_Bool fReturn)
|
||||||
{
|
{
|
||||||
int iLineCount;
|
int iLineCount;
|
||||||
for (iLineCount = 0; iLineCount < p->iScaleDownLpi; ++iLineCount)
|
for (iLineCount = 0; iLineCount < p->iScaleDownLpi; ++iLineCount)
|
||||||
|
@ -937,16 +938,14 @@ CircBufferGetLineEx (int iHandle, TDataPipe * p, unsigned char *pabLine,
|
||||||
{
|
{
|
||||||
if (!XferBufferGetLine (iHandle, p,
|
if (!XferBufferGetLine (iHandle, p,
|
||||||
&p->pabCircBuf[p->iRedLine *
|
&p->pabCircBuf[p->iRedLine *
|
||||||
p->iBytesPerLine],
|
p->iBytesPerLine], fReturn))
|
||||||
pfJustDone))
|
|
||||||
return SANE_FALSE;
|
return SANE_FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!XferBufferGetLine (iHandle, p,
|
if (!XferBufferGetLine (iHandle, p,
|
||||||
&p->pabCircBuf[p->iBluLine *
|
&p->pabCircBuf[p->iBluLine *
|
||||||
p->iBytesPerLine],
|
p->iBytesPerLine], fReturn))
|
||||||
pfJustDone))
|
|
||||||
return SANE_FALSE;
|
return SANE_FALSE;
|
||||||
}
|
}
|
||||||
if (pabLine != NULL)
|
if (pabLine != NULL)
|
||||||
|
@ -973,7 +972,7 @@ STATIC SANE_Bool
|
||||||
CircBufferGetLine (int iHandle, TDataPipe * p, unsigned char *pabLine,
|
CircBufferGetLine (int iHandle, TDataPipe * p, unsigned char *pabLine,
|
||||||
SANE_Bool iReversedHead)
|
SANE_Bool iReversedHead)
|
||||||
{
|
{
|
||||||
return CircBufferGetLineEx (iHandle, p, pabLine, iReversedHead, NULL);
|
return CircBufferGetLineEx (iHandle, p, pabLine, iReversedHead, SANE_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -125,10 +125,11 @@ STATIC SANE_Bool CircBufferGetLine (int iHandle, TDataPipe * p,
|
||||||
SANE_Bool iReversedHead);
|
SANE_Bool iReversedHead);
|
||||||
|
|
||||||
/* returns false, when trying to read after end of buffer
|
/* returns false, when trying to read after end of buffer
|
||||||
if pfJustDone!=NULL this element will be set SANE_TRUE, when the last scan was done*/
|
if fReturn==SANE_TRUE, the head will return automatically on an end of scan */
|
||||||
|
|
||||||
STATIC SANE_Bool
|
STATIC SANE_Bool
|
||||||
CircBufferGetLineEx (int iHandle, TDataPipe * p, unsigned char *pabLine,
|
CircBufferGetLineEx (int iHandle, TDataPipe * p, unsigned char *pabLine,
|
||||||
SANE_Bool iReversedHead, SANE_Bool * pfJustDone);
|
SANE_Bool iReversedHead, SANE_Bool fReturn);
|
||||||
|
|
||||||
STATIC void CircBufferExit (TDataPipe * p);
|
STATIC void CircBufferExit (TDataPipe * p);
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue