From d6badf6687e5a62ddddadfbba0296b0575b1ab8e Mon Sep 17 00:00:00 2001 From: Ullrich Sigwanz Date: Tue, 31 Aug 2004 18:43:58 +0000 Subject: [PATCH] removed niash_types.h --- backend/niash.c | 61 ++++++++-------- backend/niash_core.c | 162 ++++++++++-------------------------------- backend/niash_core.h | 27 +++---- backend/niash_types.h | 31 -------- backend/niash_xfer.c | 10 +-- backend/niash_xfer.h | 3 +- doc/niash/niash.TODO | 5 +- 7 files changed, 85 insertions(+), 214 deletions(-) delete mode 100644 backend/niash_types.h diff --git a/backend/niash.c b/backend/niash.c index 7437109ba..1c3397f78 100644 --- a/backend/niash.c +++ b/backend/niash.c @@ -58,9 +58,6 @@ #define ASSERT(cond) (!(cond) ? DBG(DBG_ASSERT, "!!! ASSERT(%S) FAILED!!!\n",STRINGIFY(cond));) -/* other definitions */ -#define TRUE 1 -#define FALSE 0 #define MM_TO_PIXEL(_mm_, _dpi_) ((_mm_) * (_dpi_) / 25.4 ) #define PIXEL_TO_MM(_pixel_, _dpi_) ((_pixel_) * 25.4 / (_dpi_) ) @@ -116,9 +113,9 @@ typedef struct /* fCancelled needed to let sane issue the cancel message instead of an error message */ - int fCancelled; /* TRUE if scanning cancelled */ + SANE_Bool fCancelled; /* SANE_TRUE if scanning cancelled */ - int fScanning; /* TRUE if actively scanning */ + SANE_Bool fScanning; /* SANE_TRUE if actively scanning */ int WarmUpTime; /* time to wait before a calibration starts */ unsigned char CalWhite[3]; /* values for the last calibration of white */ @@ -188,13 +185,13 @@ _TimeElapsed (struct timeval *start, struct timeval *now, int iTime) static void _WarmUpLamp (TScanner * s, int iMode) { - bool fLampOn; + SANE_Bool fLampOn; /* on startup don't care what was before assume lamp was off, and the previous cal values can never be reached */ if (iMode == WARMUP_AFTERSTART) { - fLampOn = FALSE; + fLampOn = SANE_FALSE; s->CalWhite[0] = s->CalWhite[1] = s->CalWhite[2] = (unsigned char) (-1); } else @@ -207,7 +204,7 @@ _WarmUpLamp (TScanner * s, int iMode) /* determine the time to wait at least */ s->WarmUpTime = aiWarmUpTime[iMode]; /* switch on the lamp */ - SetLamp (&s->HWParams, TRUE); + SetLamp (&s->HWParams, SANE_TRUE); } } @@ -218,17 +215,17 @@ _WaitForLamp (TScanner * s, unsigned char *pabCalibTable) int i; /* rgb loop */ int iCal = 0; /* counter */ int iCurrent = 0; /* buffer and time-holder swap flag */ - bool fHasCal; + SANE_Bool fHasCal; unsigned char CalWhite[2][3]; /* toggling buffer */ int iDelay = 0; /* delay loop counter */ - _WarmUpLamp (s, FALSE); + _WarmUpLamp (s, SANE_FALSE); /* get the time stamp for the wait loops */ if (s->WarmUpTime) gettimeofday (&now[iCurrent], 0); SimpleCalibExt (&s->HWParams, pabCalibTable, CalWhite[iCurrent]); - fHasCal = TRUE; + fHasCal = SANE_TRUE; DBG (DBG_MSG, "_WaitForLamp: first calibration\n"); @@ -240,13 +237,13 @@ _WaitForLamp (TScanner * s, unsigned char *pabCalibTable) the current one would have */ if (s->WarmUpTime && fHasCal) { - bool fOver = TRUE; + SANE_Bool fOver = SANE_TRUE; for (i = 0; fOver && i < 3; ++i) { if (!s->CalWhite[i]) - fOver = FALSE; + fOver = SANE_FALSE; else if (CalWhite[iCurrent][i] < s->CalWhite[i]) - fOver = FALSE; + fOver = SANE_FALSE; } /* warm up is not needed, when calibration data is above @@ -287,7 +284,7 @@ _WaitForLamp (TScanner * s, unsigned char *pabCalibTable) else DBG (DBG_MSG, "_WaitForLamp: delay loop %d \r", ++iDelay); sleep (1); - fHasCal = FALSE; + fHasCal = SANE_FALSE; gettimeofday (&now[!iCurrent], 0); } @@ -306,7 +303,7 @@ _WaitForLamp (TScanner * s, unsigned char *pabCalibTable) ++iCal; iCurrent = !iCurrent; /* swap the test-buffer, and time-holder */ SimpleCalibExt (&s->HWParams, pabCalibTable, CalWhite[iCurrent]); - fHasCal = TRUE; + fHasCal = SANE_TRUE; for (i = 0; i < 3; ++i) { @@ -654,8 +651,8 @@ sane_open (SANE_String_Const name, SANE_Handle * h) return SANE_STATUS_DEVICE_BUSY; } _InitOptions (s); - s->fScanning = FALSE; - s->fCancelled = FALSE; + s->fScanning = SANE_FALSE; + s->fCancelled = SANE_FALSE; *h = s; /* Turn on lamp by default at startup */ @@ -675,7 +672,7 @@ sane_close (SANE_Handle h) s = (TScanner *) h; /* turn off scanner lamp */ - SetLamp (&s->HWParams, FALSE); + SetLamp (&s->HWParams, SANE_FALSE); /* close scanner */ NiashClose (&s->HWParams); @@ -707,13 +704,13 @@ sane_control_option (SANE_Handle h, SANE_Int n, SANE_Action Action, void *pVal, SANE_Int * pInfo) { TScanner *s; - int fVal; + SANE_Bool fVal; static char szTable[15000]; char szTemp[16]; int *pi; int i; SANE_Int info; - bool fLampIsOn; + SANE_Bool fLampIsOn; SANE_Status status; DBG (DBG_MSG, "sane_control_option: option %d, action %d\n", n, Action); @@ -821,7 +818,7 @@ sane_control_option (SANE_Handle h, SANE_Int n, SANE_Action Action, if (fVal) _WarmUpLamp (s, WARMUP_INSESSION); else - SetLamp (&s->HWParams, FALSE); + SetLamp (&s->HWParams, SANE_FALSE); break; case optCalibrate: @@ -939,7 +936,7 @@ sane_start (SANE_Handle h) s->ScanParams.iWidth = par.pixels_per_line * iScaleDown; s->ScanParams.iHeight = par.lines * iScaleDown; s->ScanParams.iBottom = 14200UL; - s->ScanParams.fCalib = FALSE; + s->ScanParams.fCalib = SANE_FALSE; /* perform a simple calibration just before scanning */ _WaitForLamp (s, abCalibTable); @@ -978,8 +975,8 @@ sane_start (SANE_Handle h) s->ScanParams.iLpi * s->HWParams.iSensorSkew / HW_LPI, s->HWParams.iReversedHead, iScaleDown, iScaleDown); - s->fScanning = TRUE; - s->fCancelled = FALSE; + s->fScanning = SANE_TRUE; + s->fCancelled = SANE_FALSE; return SANE_STATUS_GOOD; } @@ -1001,7 +998,7 @@ sane_read (SANE_Handle h, SANE_Byte * buf, SANE_Int maxlen, SANE_Int * len) { DBG (DBG_MSG, "\n"); DBG (DBG_MSG, "sane_read: sane_read cancelled\n"); - s->fCancelled = FALSE; + s->fCancelled = SANE_FALSE; return SANE_STATUS_CANCELLED; } else @@ -1023,8 +1020,8 @@ sane_read (SANE_Handle h, SANE_Byte * buf, SANE_Int maxlen, SANE_Int * len) *len = 0; DBG (DBG_MSG, "\n"); DBG (DBG_MSG, "sane_read: end of scan\n"); - s->fCancelled = FALSE; - s->fScanning = FALSE; + s->fCancelled = SANE_FALSE; + s->fScanning = SANE_FALSE; return SANE_STATUS_EOF; } @@ -1048,8 +1045,8 @@ sane_read (SANE_Handle h, SANE_Byte * buf, SANE_Int maxlen, SANE_Int * len) *len = 0; DBG (DBG_MSG, "\n"); DBG (DBG_MSG, "sane_read: read after end of buffer\n"); - s->fCancelled = FALSE; - s->fScanning = FALSE; + s->fCancelled = SANE_FALSE; + s->fScanning = SANE_FALSE; return SANE_STATUS_EOF; } @@ -1079,8 +1076,8 @@ sane_cancel (SANE_Handle h) /* Make sure the scanner head returns home */ FinishScan (&s->HWParams); - s->fCancelled = TRUE; - s->fScanning = FALSE; + s->fCancelled = SANE_TRUE; + s->fScanning = SANE_FALSE; } diff --git a/backend/niash_core.c b/backend/niash_core.c index c508e0c4c..ff638712e 100644 --- a/backend/niash_core.c +++ b/backend/niash_core.c @@ -119,7 +119,7 @@ _ConvertMotorTable (unsigned char *pabOld, unsigned char *pabNew, int iSize, Returns TRUE if a NIASH chipset was found. *************************************************************************/ -static bool +static SANE_Bool _ProbeRegisters (THWParams * pHWParams) { unsigned char bData1, bData2; @@ -138,7 +138,7 @@ _ProbeRegisters (THWParams * pHWParams) if ((bData1 != 0x55) || (bData2 != 0xAA)) { DBG (DBG_ERR, " No NIASH chipset found!\n"); - return FALSE; + return SANE_FALSE; } /* check writeability of register 3 bit 1 */ @@ -179,7 +179,7 @@ _ProbeRegisters (THWParams * pHWParams) } } - return TRUE; + return SANE_TRUE; } @@ -204,10 +204,10 @@ NiashOpen (THWParams * pHWParams, const char *pszName) pHWParams->iSensorSkew = 8; pHWParams->iTopLeftX = 0; pHWParams->iTopLeftY = 3; - pHWParams->fReg07 = FALSE; + pHWParams->fReg07 = SANE_FALSE; pHWParams->iSkipLines = 0; pHWParams->iExpTime = 5408; - pHWParams->iReversedHead = TRUE; + pHWParams->iReversedHead = SANE_TRUE; switch (pHWParams->eModel) { @@ -224,12 +224,12 @@ NiashOpen (THWParams * pHWParams, const char *pszName) DBG (DBG_MSG, "Setting params for Hp3400c/Hp4300c\n"); pHWParams->iTopLeftX = 3; pHWParams->iTopLeftY = 14; - pHWParams->fReg07 = TRUE; + pHWParams->fReg07 = SANE_TRUE; break; case eAgfaTouch: DBG (DBG_MSG, "Setting params for AgfaTouch\n"); - pHWParams->iReversedHead = FALSE; /* head not reversed on Agfa Touch */ + pHWParams->iReversedHead = SANE_FALSE; /* head not reversed on Agfa Touch */ pHWParams->iTopLeftX = 3; pHWParams->iTopLeftY = 10; pHWParams->iSkipLines = 7; @@ -264,7 +264,7 @@ NiashClose (THWParams * pHWPar) static void -WriteRegWord (int iHandle, unsigned char bReg, word wData) +WriteRegWord (int iHandle, unsigned char bReg, SANE_Word wData) { NiashWriteReg (iHandle, bReg, wData & 0xFF); NiashWriteReg (iHandle, bReg + 1, (wData >> 8) & 0xFF); @@ -639,7 +639,7 @@ InitNiashCommon (TScanParams * pParams, THWParams * pHWParams) /* write registers */ -STATIC bool +STATIC SANE_Bool InitScan (TScanParams * pParams, THWParams * pHWParams) { int iHeight; @@ -658,20 +658,20 @@ InitScan (TScanParams * pParams, THWParams * pHWParams) break; default: DBG (DBG_ERR, "Invalid dpi (%d)\n", pParams->iDpi); - return FALSE; + return SANE_FALSE; } iHeight = (pParams->iBottom - pParams->iTop + 1); if (iHeight <= 0) { DBG (DBG_ERR, "Invalid height (%d)\n", iHeight); - return FALSE; + return SANE_FALSE; } if (pParams->iWidth <= 0) { DBG (DBG_ERR, "Invalid width (%d)\n", pParams->iWidth); - return FALSE; + return SANE_FALSE; } switch (pParams->iLpi) @@ -682,7 +682,7 @@ InitScan (TScanParams * pParams, THWParams * pHWParams) break; default: DBG (DBG_ERR, "Invalid lpi (%d)\n", pParams->iLpi); - return FALSE; + return SANE_FALSE; } /* exposure time (in units of 24/Fcrystal?), must be divisible by 8 !!! */ @@ -690,7 +690,7 @@ InitScan (TScanParams * pParams, THWParams * pHWParams) if ((iExpTime % 8) != 0) { DBG (DBG_ERR, "Invalid exposure time (%d)\n", iExpTime); - return FALSE; + return SANE_FALSE; } /* @@ -717,20 +717,20 @@ InitScan (TScanParams * pParams, THWParams * pHWParams) /* common NIASH init */ InitNiashCommon (pParams, pHWParams); - return TRUE; + return SANE_TRUE; } /************************************************************************/ -static bool +static SANE_Bool XferBufferGetLine (int iHandle, TDataPipe * p, unsigned char *pabLine) { unsigned char bData; /* all calculated transfers done ? */ if (p->iLinesLeft == 0) - return FALSE; + return SANE_FALSE; /* time for a fresh read? */ if (p->iCurLine == 0) @@ -758,7 +758,7 @@ XferBufferGetLine (int iHandle, TDataPipe * p, unsigned char *pabLine) /* one transfer line less to the XFerBuffer */ if (p->iLinesLeft > 0) --(p->iLinesLeft); - return TRUE; + return SANE_TRUE; } @@ -780,7 +780,7 @@ XferBufferInit (int iHandle, TDataPipe * p) /* static procedure that fills the circular buffer in advance to any circular buffer data retrieval */ static void -CircBufferFill (int iHandle, TDataPipe * p, bool iReversedHead) +CircBufferFill (int iHandle, TDataPipe * p, SANE_Bool iReversedHead) { int i; for (i = 0; i < p->iLinesPerCircBuf; i++) @@ -824,7 +824,7 @@ XferBufferExit (TDataPipe * p) static void _UnscrambleLine (unsigned char *pabLine, unsigned char *pabRed, unsigned char *pabGrn, - unsigned char *pabBlu, int iWidth, bool iReversedHead, + unsigned char *pabBlu, int iWidth, SANE_Bool iReversedHead, int iScaleDownDpi, int iBufWeight) { /* never change an approved algorithm ... @@ -903,9 +903,9 @@ _UnscrambleLine (unsigned char *pabLine, /* gets an unscrambled line from the circular buffer. the first couple of lines contain garbage */ -STATIC bool +STATIC SANE_Bool CircBufferGetLine (int iHandle, TDataPipe * p, unsigned char *pabLine, - bool iReversedHead) + SANE_Bool iReversedHead) { int iLineCount; for (iLineCount = 0; iLineCount < p->iScaleDownLpi; ++iLineCount) @@ -915,14 +915,14 @@ CircBufferGetLine (int iHandle, TDataPipe * p, unsigned char *pabLine, if (!XferBufferGetLine (iHandle, p, &p->pabCircBuf[p->iRedLine * p->iBytesPerLine])) - return FALSE; + return SANE_FALSE; } else { if (!XferBufferGetLine (iHandle, p, &p->pabCircBuf[p->iBluLine * p->iBytesPerLine])) - return FALSE; + return SANE_FALSE; } if (pabLine != NULL) @@ -940,14 +940,14 @@ CircBufferGetLine (int iHandle, TDataPipe * p, unsigned char *pabLine, p->iGrnLine = (p->iGrnLine + 1) % p->iLinesPerCircBuf; p->iBluLine = (p->iBluLine + 1) % p->iLinesPerCircBuf; } - return TRUE; + return SANE_TRUE; } STATIC void CircBufferInit (int iHandle, TDataPipe * p, int iWidth, int iHeight, - int iMisAlignment, bool iReversedHead, + int iMisAlignment, SANE_Bool iReversedHead, int iScaleDownDpi, int iScaleDownLpi) { @@ -1145,19 +1145,19 @@ CreateCalibTable (unsigned char *abWhite, unsigned char bBlackR, /************************************************************************* Lamp control functions *************************************************************************/ -STATIC bool -GetLamp (THWParams * pHWParams, bool * pfLampIsOn) +STATIC SANE_Bool +GetLamp (THWParams * pHWParams, SANE_Bool * pfLampIsOn) { unsigned char bData; NiashReadReg (pHWParams->iXferHandle, 0x03, &bData); *pfLampIsOn = ((bData & 0x01) != 0); - return TRUE; + return SANE_TRUE; } -STATIC bool -SetLamp (THWParams * pHWParams, bool fLampOn) +STATIC SANE_Bool +SetLamp (THWParams * pHWParams, SANE_Bool fLampOn) { unsigned char bData; int iHandle; @@ -1173,14 +1173,14 @@ SetLamp (THWParams * pHWParams, bool fLampOn) { NiashWriteReg (iHandle, 0x03, bData & ~0x01); } - return TRUE; + return SANE_TRUE; } /************************************************************************* Experimental simple calibration, but also returning the white levels *************************************************************************/ -STATIC bool +STATIC SANE_Bool SimpleCalibExt (THWParams * pHWPar, unsigned char *pabCalibTable, unsigned char *pabCalWhite) { @@ -1195,7 +1195,7 @@ SimpleCalibExt (THWParams * pHWPar, unsigned char *pabCalibTable, unsigned char *pabWhite; int iWhiteR, iWhiteG, iWhiteB; int iHandle; - bool iReversedHead; + SANE_Bool iReversedHead; int startWhiteY, endWhiteY; int startBlackY, endBlackY; int startBlackX, endBlackX; @@ -1215,7 +1215,7 @@ SimpleCalibExt (THWParams * pHWPar, unsigned char *pabCalibTable, Params.iLeft = 0; Params.iWidth = HW_PIXELS; Params.iHeight = 54; - Params.fCalib = TRUE; + Params.fCalib = SANE_TRUE; /* write gamma table with neutral gain / offset */ CalcGamma (abGamma, 1.0); @@ -1225,7 +1225,7 @@ SimpleCalibExt (THWParams * pHWPar, unsigned char *pabCalibTable, { if (pabCalWhite) pabCalWhite[0] = pabCalWhite[1] = pabCalWhite[2] = 0; - return FALSE; + return SANE_FALSE; } /* Definition of white and black areas */ @@ -1315,7 +1315,7 @@ SimpleCalibExt (THWParams * pHWPar, unsigned char *pabCalibTable, pabCalWhite[1] = iWhiteG; pabCalWhite[2] = iWhiteB; } - return TRUE; + return SANE_TRUE; } @@ -1331,91 +1331,3 @@ FinishScan (THWParams * pHWParams) NiashWriteReg (pHWParams->iXferHandle, 0x02, 0x80); } - - -/************************************************************************* - These function will only be available when compiled without the - sane-niash main file -*************************************************************************/ - -#ifndef WITH_NIASH -/************************************************************************* - Experimental simple calibration - - Basic idea: - * a strip starting at position 0 is scanned in - * per-pixel white level is determined by average of first 4 lines - * global black level is determined by minimum value of all lines -*************************************************************************/ -bool -SimpleCalib (THWParams * pHWPar, unsigned char *pabCalibTable) -{ - return SimpleCalibExt (pHWPar, pabCalibTable, NULL); -} - - -/* utility function to show a hexdump of a buffer */ -void -DumpHex (unsigned char *pabData, int iLen, int iWidth) -{ - int i; - for (i = 0; i < iLen; i++) - { - if ((i % iWidth) == 0) - { - printf ("\n%04X", i); - } - printf (" %02X", pabData[i]); - } - printf ("\n"); -} - -/************************************************************************* - ScanLines - ========= - Helper function to scan in an image and output the result to a file. - - IN pFile File to write image data to - pParams User-defineable settings describing the image to be scanned - pHWParams Scanner hardware settings - -*************************************************************************/ -void -ScanLines (FILE * pFile, TScanParams * pParams, THWParams * pHWParams) -{ - static unsigned char abBuf[HW_PIXELS * 3]; - int iBytesPerLine; - int iHeight; - int iHandle; - bool iReversedHead; - TDataPipe DataPipe; - - iHandle = pHWParams->iXferHandle; - - iHeight = pParams->iHeight; - iBytesPerLine = pParams->iWidth * 3; - DataPipe.iSkipLines = 0; - if (pHWParams->fReg07) - { - DataPipe.iSkipLines += - (pHWParams->iTopLeftY * pParams->iLpi * 10) / 254; - } - iReversedHead = pHWParams->iReversedHead; - - if (InitScan (pParams, pHWParams)) - { - CircBufferInit (iHandle, &DataPipe, - pParams->iWidth, pParams->iHeight, - pHWParams->iSensorSkew * pParams->iLpi / HW_LPI, - iReversedHead, 1, 1); - while (iHeight-- > 0) - { - CircBufferGetLine (iHandle, &DataPipe, abBuf, iReversedHead); - fwrite (abBuf, 1, iBytesPerLine, pFile); - } - CircBufferExit (&DataPipe); - } - FinishScan (pHWParams); -} - -#endif /* NO WITH_NIASH */ diff --git a/backend/niash_core.h b/backend/niash_core.h index b19eee1d3..9a6e38180 100644 --- a/backend/niash_core.h +++ b/backend/niash_core.h @@ -28,7 +28,6 @@ #include -#include "niash_types.h" #include "niash_xfer.h" /* for EScannerModel */ #define HP3300C_RIGHT 330 @@ -48,10 +47,10 @@ typedef struct int iTopLeftY; /* in mm */ int iSensorSkew; /* in units of 1/1200 inch */ int iSkipLines; /* lines of garbage to skip */ - bool fReg07; /* NIASH00019 */ - bool fGamma16; /* if TRUE, gamma entries are 16 bit */ + SANE_Bool fReg07; /* NIASH00019 */ + SANE_Bool fGamma16; /* if TRUE, gamma entries are 16 bit */ int iExpTime; - bool iReversedHead; /* Head is reversed */ + SANE_Bool iReversedHead; /* Head is reversed */ int iBufferSize; /* Size of internal scan buffer */ EScannerModel eModel; } THWParams; @@ -96,13 +95,13 @@ STATIC int NiashOpen (THWParams * pHWParams, const char *pszName); STATIC void NiashClose (THWParams * pHWParams); /* more sof. method that also returns the values of the white (RGB) value */ -STATIC bool SimpleCalibExt (THWParams * pHWPar, unsigned char *pabCalibTable, +STATIC SANE_Bool SimpleCalibExt (THWParams * pHWPar, unsigned char *pabCalibTable, unsigned char *pabCalWhite); -STATIC bool GetLamp (THWParams * pHWParams, bool * pfLampIsOn); -STATIC bool SetLamp (THWParams * pHWParams, bool fLampOn); +STATIC SANE_Bool GetLamp (THWParams * pHWParams, SANE_Bool * pfLampIsOn); +STATIC SANE_Bool SetLamp (THWParams * pHWParams, SANE_Bool fLampOn); -STATIC bool InitScan (TScanParams * pParams, THWParams * pHWParams); +STATIC SANE_Bool InitScan (TScanParams * pParams, THWParams * pHWParams); STATIC void FinishScan (THWParams * pHWParams); STATIC void CalcGamma (unsigned char *pabTable, double Gamma); @@ -117,18 +116,12 @@ STATIC void WriteGammaCalibTable (unsigned char *pabGammaR, /* iHeight is lines in scanner resolution */ STATIC void CircBufferInit (int iHandle, TDataPipe * p, int iWidth, int iHeight, - int iMisAlignment, bool iReversedHead, + int iMisAlignment, SANE_Bool iReversedHead, int iScaleDownDpi, int iScaleDownLpi); /* returns false, when trying to read after end of buffer */ -STATIC bool CircBufferGetLine (int iHandle, TDataPipe * p, - unsigned char *pabLine, bool iReversedHead); +STATIC SANE_Bool CircBufferGetLine (int iHandle, TDataPipe * p, + unsigned char *pabLine, SANE_Bool iReversedHead); STATIC void CircBufferExit (TDataPipe * p); -#ifndef WITH_NIASH -void DumpHex (unsigned char *pabData, int iLen, int iWidth); -void ScanLines (FILE * pFile, TScanParams * pParams, THWParams * pHWParams); -bool SimpleCalib (THWParams * pHWPar, unsigned char *pabCalibTable); -#endif /* NO WITH_NIASH */ - #endif /* _NIASH_CORE_H_ */ diff --git a/backend/niash_types.h b/backend/niash_types.h deleted file mode 100644 index 7f5e6be9b..000000000 --- a/backend/niash_types.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - Defines my types - - $Id$ -*/ - - -#ifndef _NIASH_TYPES_H_ -#define _NIASH_TYPES_H_ - -#ifndef byte -typedef unsigned char byte; -#endif - -#ifndef word -typedef int word; -#endif - -#ifndef bool -typedef int bool; -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -#endif /* _NIASH_TYPES_H_ */ diff --git a/backend/niash_xfer.c b/backend/niash_xfer.c index 86a2e97c0..72c479ee5 100644 --- a/backend/niash_xfer.c +++ b/backend/niash_xfer.c @@ -60,7 +60,7 @@ static TScannerModel *_pModel; Returns TRUE if a matching USB scanner was found */ -STATIC bool +STATIC SANE_Bool MatchUsbDevice (int iVendor, int iProduct, TScannerModel ** ppModel) { TScannerModel *pModels = ScannerModels; @@ -73,13 +73,13 @@ MatchUsbDevice (int iVendor, int iProduct, TScannerModel ** ppModel) DBG (DBG_MSG, "found %s %s\n", pModels->pszVendor, pModels->pszName); *ppModel = pModels; - return TRUE; + return SANE_TRUE; } /* next model to match */ pModels++; } DBG (DBG_MSG, "nothing found\n"); - return FALSE; + return SANE_FALSE; } /************************************************************************ @@ -228,7 +228,7 @@ NiashWriteBulk (int iHandle, unsigned char *pabBuf, int iSize) { /* byte abSetup[8] = {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; HP3400 probably needs 0x01, 0x01 */ - byte abSetup[8] = { 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + SANE_Byte abSetup[8] = { 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; size_t size; if (iHandle < 0) @@ -260,7 +260,7 @@ NiashWriteBulk (int iHandle, unsigned char *pabBuf, int iSize) static void NiashReadBulk (int iHandle, unsigned char *pabBuf, int iSize) { - byte abSetup[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + SANE_Byte abSetup[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; size_t size; if (iHandle < 0) diff --git a/backend/niash_xfer.h b/backend/niash_xfer.h index 19ec8ab13..0fa5c1bf6 100644 --- a/backend/niash_xfer.h +++ b/backend/niash_xfer.h @@ -27,7 +27,6 @@ #define _NIASH_XFER_H_ #include /* for FILE * */ -#include "niash_types.h" /* register codes for the USB - IEEE1284 bridge */ #define USB_SETUP 0x82 @@ -90,7 +89,7 @@ STATIC void NiashWriteBulk (int iXferHandle, unsigned char *pabBuf, STATIC void NiashReadBulk (int iXferHandle, unsigned char *pabBuf, int iSize); STATIC void NiashWakeup (int iXferHandle); -STATIC bool MatchUsbDevice (int iVendor, int iProduct, +STATIC SANE_Bool MatchUsbDevice (int iVendor, int iProduct, TScannerModel ** ppeModel); #endif /* _NIASH_XFER_H_ */ diff --git a/doc/niash/niash.TODO b/doc/niash/niash.TODO index d04757c91..ded62cab2 100644 --- a/doc/niash/niash.TODO +++ b/doc/niash/niash.TODO @@ -28,13 +28,14 @@ To do: - figure out what the USB interrupts mean that sometimes occur. -- Get rid of mytypes.h / fix types - Now an int is implicitly assumed to be 32 bit. Done ==== +- Get rid of mytypes.h / fix types + Now an int is implicitly assumed to be 32 bit. + - make backend comply with tstbackend -> all externs and publics removed when compiling towards sane