moving critical timing for backward movement to niash_core

merge-requests/1/head
Ullrich Sigwanz 2004-10-27 18:06:19 +00:00
rodzic b4a33c8861
commit 2cb4f0227e
4 zmienionych plików z 33 dodań i 35 usunięć

Wyświetl plik

@ -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>
* doc/descriptions/unsupported.desc

Wyświetl plik

@ -1394,17 +1394,10 @@ sane_read (SANE_Handle h, SANE_Byte * buf, SANE_Int maxlen, SANE_Int * len)
/* time to read the next line? */
if (s->iBytesLeft == 0)
{
SANE_Bool fJustDone = SANE_FALSE;
/* read a line from the transfer buffer */
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,
s->aValues[optThreshold].w);
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 */
else
{
FinishScan (&s->HWParams);
CircBufferExit (p);
free (p->pabLineBuf);
p->pabLineBuf = NULL;
FinishScan (&s->HWParams);
*len = 0;
DBG (DBG_MSG, "\n");
DBG (DBG_MSG, "sane_read: read after end of buffer\n");

Wyświetl plik

@ -725,13 +725,10 @@ InitScan (TScanParams * pParams, THWParams * pHWParams)
static SANE_Bool
XferBufferGetLine (int iHandle, TDataPipe * p, unsigned char *pabLine,
SANE_Bool * pfJustDone)
SANE_Bool fReturn)
{
unsigned char bData;
if (pfJustDone)
{
*pfJustDone = SANE_FALSE;
}
unsigned char bData, bData2;
SANE_Bool fJustDone = SANE_FALSE;
/* all calculated transfers done ? */
if (p->iLinesLeft == 0)
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",
iLines, p->iLinesPerXferBuf);
}
if (pfJustDone)
{
*pfJustDone = SANE_TRUE;
}
fJustDone = SANE_TRUE;
}
/* reading old buffer level */
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);
NiashReadReg (iHandle, 0x20, &bData);
DBG (DBG_MSG, "buffer level = %3d\r", bData);
/* reding new buffer level */
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);
}
/* copy one line */
@ -793,7 +794,7 @@ XferBufferInit (int iHandle, TDataPipe * p)
/* skip garbage lines */
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,
&p->pabCircBuf[p->iRedLine * p->iBytesPerLine],
NULL);
SANE_FALSE);
}
else
{
XferBufferGetLine (iHandle, p,
&p->pabCircBuf[p->iBluLine * p->iBytesPerLine],
NULL);
SANE_FALSE);
}
/* advance pointers */
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,
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
CircBufferGetLineEx (int iHandle, TDataPipe * p, unsigned char *pabLine,
SANE_Bool iReversedHead, SANE_Bool * pfJustDone)
SANE_Bool iReversedHead, SANE_Bool fReturn)
{
int iLineCount;
for (iLineCount = 0; iLineCount < p->iScaleDownLpi; ++iLineCount)
@ -937,16 +938,14 @@ CircBufferGetLineEx (int iHandle, TDataPipe * p, unsigned char *pabLine,
{
if (!XferBufferGetLine (iHandle, p,
&p->pabCircBuf[p->iRedLine *
p->iBytesPerLine],
pfJustDone))
p->iBytesPerLine], fReturn))
return SANE_FALSE;
}
else
{
if (!XferBufferGetLine (iHandle, p,
&p->pabCircBuf[p->iBluLine *
p->iBytesPerLine],
pfJustDone))
p->iBytesPerLine], fReturn))
return SANE_FALSE;
}
if (pabLine != NULL)
@ -973,7 +972,7 @@ STATIC SANE_Bool
CircBufferGetLine (int iHandle, TDataPipe * p, unsigned char *pabLine,
SANE_Bool iReversedHead)
{
return CircBufferGetLineEx (iHandle, p, pabLine, iReversedHead, NULL);
return CircBufferGetLineEx (iHandle, p, pabLine, iReversedHead, SANE_FALSE);
}

Wyświetl plik

@ -125,10 +125,11 @@ STATIC SANE_Bool CircBufferGetLine (int iHandle, TDataPipe * p,
SANE_Bool iReversedHead);
/* 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
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);