Get rid of unnecessary forward declarations.

merge-requests/1/head
Jan Hauffa 2011-04-17 13:45:42 +02:00 zatwierdzone przez m. allan noah
rodzic da64a1fc1e
commit 41ac627e5f
5 zmienionych plików z 649 dodań i 750 usunięć

Wyświetl plik

@ -51,6 +51,7 @@
#include "mustek_usb2_high.h"
#define SCAN_BUFFER_SIZE (64 * 1024)
#define MAX_RESOLUTIONS 12
#define DEF_LINEARTTHRESHOLD 128
@ -78,6 +79,20 @@ enum
NUM_OPTIONS
};
typedef enum
{
RO_RGB,
RO_BGR
} RGBORDER;
typedef struct
{
RGBORDER roRgbOrder;
unsigned short wWantedLineNum;
unsigned short wXferedLineNum;
SANE_Byte * pBuffer;
} IMAGEROWS, *LPIMAGEROWS;
typedef struct
{

Wyświetl plik

@ -64,6 +64,11 @@
#include "mustek_usb2_asic.h"
static SANE_Status PrepareScanChip (PAsic chip);
static SANE_Status WaitCarriageHome (PAsic chip);
static SANE_Status WaitUnitReady (PAsic chip);
/* ---------------------- low level ASIC functions -------------------------- */
static SANE_Byte RegisterBankStatus = ~0;
@ -119,7 +124,7 @@ Mustek_ClearFIFO (PAsic chip)
}
static SANE_Status
SwitchBank (PAsic chip, unsigned short reg)
Mustek_SwitchBank (PAsic chip, unsigned short reg)
{
SANE_Status status;
SANE_Byte buf[4];
@ -128,7 +133,7 @@ SwitchBank (PAsic chip, unsigned short reg)
bank = HIBYTE(reg);
if (bank > SELECT_REGISTER_BANK2)
{
DBG (DBG_ERR, "SwitchBank: invalid register %d\n", reg);
DBG (DBG_ERR, "Mustek_SwitchBank: invalid register %d\n", reg);
return SANE_STATUS_INVAL;
}
@ -156,7 +161,7 @@ Mustek_SendData (PAsic chip, unsigned short reg, SANE_Byte data)
SANE_Byte buf[4];
DBG (DBG_ASIC, "Mustek_SendData: Enter. reg=%x,data=%x\n", reg, data);
status = SwitchBank (chip, reg);
status = Mustek_SwitchBank (chip, reg);
if (status != SANE_STATUS_GOOD)
return status;
@ -204,10 +209,10 @@ Mustek_WriteAddressLineForRegister (PAsic chip, SANE_Byte x)
}
static SANE_Status
SetRWSize (PAsic chip, SANE_Byte ReadWrite, unsigned int size)
Mustek_SetRWSize (PAsic chip, SANE_Byte ReadWrite, unsigned int size)
{
SANE_Status status;
DBG (DBG_ASIC, "SetRWSize: Enter\n");
DBG (DBG_ASIC, "Mustek_SetRWSize: Enter\n");
if (ReadWrite == READ_RAM)
size >>= 1;
@ -223,7 +228,7 @@ SetRWSize (PAsic chip, SANE_Byte ReadWrite, unsigned int size)
return status;
status = Mustek_SendData (chip, ES01_7F_DMA_SIZE_BYTE3, BYTE3 (size));
DBG (DBG_ASIC, "SetRWSize: Exit\n");
DBG (DBG_ASIC, "Mustek_SetRWSize: Exit\n");
return status;
}
@ -243,7 +248,7 @@ Mustek_DMARead (PAsic chip, unsigned int size, SANE_Byte * lpData)
{
cur_read_size = (size > DMA_BLOCK_SIZE) ? DMA_BLOCK_SIZE : size;
status = SetRWSize (chip, READ_RAM, cur_read_size);
status = Mustek_SetRWSize (chip, READ_RAM, cur_read_size);
if (status != SANE_STATUS_GOOD)
return status;
@ -285,7 +290,7 @@ Mustek_DMAWrite (PAsic chip, unsigned int size, SANE_Byte * lpData)
{
cur_write_size = (size > DMA_BLOCK_SIZE) ? DMA_BLOCK_SIZE : size;
status = SetRWSize (chip, WRITE_RAM, cur_write_size);
status = Mustek_SetRWSize (chip, WRITE_RAM, cur_write_size);
if (status != SANE_STATUS_GOOD)
return status;
@ -329,7 +334,7 @@ Mustek_SendData2Byte (PAsic chip, unsigned short reg, SANE_Byte data)
dataBuf[3] = data;
isTransfer = SANE_FALSE;
status = SwitchBank (chip, reg);
status = Mustek_SwitchBank (chip, reg);
if (status != SANE_STATUS_GOOD)
return status;
@ -348,7 +353,7 @@ LLFSetRamAddress (PAsic chip, unsigned int dwStartAddr, unsigned int dwEndAddr,
{
SANE_Status status;
DBG (DBG_ASIC, "LLFSetRamAddress:Enter\n");
DBG (DBG_ASIC, "LLFSetRamAddress: Enter\n");
/* Set start address. Unit is a word. */
Mustek_SendData (chip, ES01_A0_HostStartAddr0_7, BYTE0 (dwStartAddr));
@ -1177,33 +1182,6 @@ PrepareScanChip (PAsic chip)
return status;
}
static SANE_Status
SafeInitialChip (PAsic chip)
{
SANE_Status status;
DBG (DBG_ASIC, "SafeInitialChip: Enter\n");
status = PrepareScanChip (chip);
if (status != SANE_STATUS_GOOD)
return status;
DBG (DBG_ASIC, "isFirstOpenChip=%d\n", chip->isFirstOpenChip);
if (chip->isFirstOpenChip)
{
status = DRAM_Test (chip);
if (status != SANE_STATUS_GOOD)
{
DBG (DBG_ASIC, "DRAM_Test: Error\n");
return status;
}
chip->isFirstOpenChip = SANE_FALSE;
}
DBG (DBG_ASIC, "SafeInitialChip: Exit\n");
return status;
}
static SANE_Status
DRAM_Test (PAsic chip)
{
@ -1248,6 +1226,33 @@ DRAM_Test (PAsic chip)
return SANE_STATUS_GOOD;
}
static SANE_Status
SafeInitialChip (PAsic chip)
{
SANE_Status status;
DBG (DBG_ASIC, "SafeInitialChip: Enter\n");
status = PrepareScanChip (chip);
if (status != SANE_STATUS_GOOD)
return status;
DBG (DBG_ASIC, "isFirstOpenChip=%d\n", chip->isFirstOpenChip);
if (chip->isFirstOpenChip)
{
status = DRAM_Test (chip);
if (status != SANE_STATUS_GOOD)
{
DBG (DBG_ASIC, "DRAM_Test: Error\n");
return status;
}
chip->isFirstOpenChip = SANE_FALSE;
}
DBG (DBG_ASIC, "SafeInitialChip: Exit\n");
return status;
}
static SANE_Status
GetChipStatus (PAsic chip, SANE_Byte Selector, SANE_Byte * ChipStatus)
{
@ -1513,7 +1518,7 @@ SetLEDTime (PAsic chip)
DBG (DBG_ASIC, "SetLEDTime: Exit\n");
}
static void
void
SetAFEGainOffset (PAsic chip)
{
int i, j;
@ -1869,7 +1874,7 @@ attach_one_scanner (SANE_String_Const devname)
return SANE_STATUS_GOOD;
}
static SANE_Status
SANE_Status
Asic_Open (PAsic chip)
{
SANE_Status status;
@ -1950,7 +1955,7 @@ Asic_Open (PAsic chip)
return SANE_STATUS_GOOD;
}
static SANE_Status
SANE_Status
Asic_Close (PAsic chip)
{
SANE_Status status;
@ -1983,7 +1988,7 @@ Asic_Close (PAsic chip)
return status;
}
static void
void
Asic_Initialize (PAsic chip)
{
DBG (DBG_ASIC, "Asic_Initialize: Enter\n");
@ -2004,7 +2009,7 @@ Asic_Initialize (PAsic chip)
DBG (DBG_ASIC, "Asic_Initialize: Exit\n");
}
static SANE_Status
SANE_Status
Asic_TurnLamp (PAsic chip, SANE_Bool isLampOn)
{
DBG (DBG_ASIC, "Asic_TurnLamp: Enter\n");
@ -2026,7 +2031,7 @@ Asic_TurnLamp (PAsic chip, SANE_Bool isLampOn)
}
static SANE_Status
SANE_Status
Asic_TurnTA (PAsic chip, SANE_Bool isTAOn)
{
DBG (DBG_ASIC, "Asic_TurnTA: Enter\n");
@ -2128,7 +2133,7 @@ GetDummyCycleNumber (PAsic chip, unsigned short wYResolution,
return bDummyCycleNum;
}
static SANE_Status
SANE_Status
Asic_SetWindow (PAsic chip, SCANSOURCE lsLightSource,
SANE_Byte bScanType, SANE_Byte bScanBits,
unsigned short wXResolution, unsigned short wYResolution,
@ -2437,7 +2442,7 @@ Asic_SetWindow (PAsic chip, SCANSOURCE lsLightSource,
return status;
}
static SANE_Status
SANE_Status
Asic_ScanStart (PAsic chip)
{
SANE_Status status;
@ -2465,7 +2470,7 @@ Asic_ScanStart (PAsic chip)
return SANE_STATUS_GOOD;
}
static SANE_Status
SANE_Status
Asic_ScanStop (PAsic chip)
{
SANE_Status status;
@ -2526,7 +2531,7 @@ Asic_ScanStop (PAsic chip)
return SANE_STATUS_GOOD;
}
static SANE_Status
SANE_Status
Asic_ReadImage (PAsic chip, SANE_Byte * pBuffer, unsigned short LinesCount)
{
SANE_Status status;
@ -2554,7 +2559,7 @@ Asic_ReadImage (PAsic chip, SANE_Byte * pBuffer, unsigned short LinesCount)
}
#if SANE_UNUSED
static SANE_Status
SANE_Status
Asic_CheckFunctionKey (PAsic chip, SANE_Byte * key)
{
SANE_Status status;
@ -2602,7 +2607,7 @@ Asic_CheckFunctionKey (PAsic chip, SANE_Byte * key)
}
#endif
static SANE_Status
SANE_Status
Asic_IsTAConnected (PAsic chip, SANE_Bool * hasTA)
{
SANE_Status status;
@ -2632,7 +2637,7 @@ Asic_IsTAConnected (PAsic chip, SANE_Bool * hasTA)
return SANE_STATUS_GOOD;
}
static SANE_Status
SANE_Status
Asic_ReadCalibrationData (PAsic chip, SANE_Byte * pBuffer,
unsigned int dwXferBytes, SANE_Byte bScanBits)
{
@ -2703,7 +2708,7 @@ Asic_ReadCalibrationData (PAsic chip, SANE_Byte * pBuffer,
return status;
}
static SANE_Status
SANE_Status
Asic_MotorMove (PAsic chip, SANE_Bool isForward, unsigned int dwTotalSteps)
{
SANE_Status status;
@ -2724,7 +2729,7 @@ Asic_MotorMove (PAsic chip, SANE_Bool isForward, unsigned int dwTotalSteps)
return status;
}
static SANE_Status
SANE_Status
Asic_CarriageHome (PAsic chip)
{
SANE_Status status;
@ -2750,7 +2755,7 @@ Asic_CarriageHome (PAsic chip)
return status;
}
static SANE_Status
SANE_Status
Asic_SetShadingTable (PAsic chip, unsigned short * lpWhiteShading,
unsigned short * lpDarkShading,
unsigned short wXResolution, unsigned short wWidth)

Wyświetl plik

@ -49,7 +49,7 @@
#define MUSTEK_USB2_ASIC_H
/* ---------------------- low level asic defines -------------------------- */
/* ---------------------- low level ASIC defines -------------------------- */
#ifndef LOBYTE
#define LOBYTE(w) (SANE_Byte)((unsigned short)(w) & 0x00ff)
@ -953,117 +953,38 @@ typedef struct
extern SANE_String_Const device_name;
void SetAFEGainOffset (PAsic chip);
static SANE_Status WriteIOControl (PAsic chip, unsigned short wValue,
unsigned short wIndex,
unsigned short wLength, SANE_Byte * lpBuf);
static SANE_Status ReadIOControl (PAsic chip, unsigned short wValue,
unsigned short wIndex, unsigned short wLength,
SANE_Byte * lpBuf);
static SANE_Status Mustek_ClearFIFO (PAsic chip);
static SANE_Status SwitchBank (PAsic chip, unsigned short reg);
static SANE_Status Mustek_SendData (PAsic chip, unsigned short reg,
SANE_Byte data);
static SANE_Status Mustek_ReceiveData (PAsic chip, SANE_Byte * reg);
static SANE_Status Mustek_WriteAddressLineForRegister (PAsic chip, SANE_Byte x);
static SANE_Status SetRWSize (PAsic chip, SANE_Byte ReadWrite,
unsigned int size);
static SANE_Status Mustek_DMARead (PAsic chip, unsigned int size,
SANE_Byte * lpData);
static SANE_Status Mustek_DMAWrite (PAsic chip, unsigned int size,
SANE_Byte * lpData);
static SANE_Status Mustek_SendData2Byte (PAsic chip, unsigned short reg,
SANE_Byte data);
static SANE_Status LLFSetRamAddress (PAsic chip, unsigned int dwStartAddr,
unsigned int dwEndAddr,
SANE_Byte byAccessTarget);
static SANE_Status LLFRamAccess (PAsic chip, LLF_RAMACCESS * RamAccess);
static void LLFSetMotorCurrentAndPhase (PAsic chip,
LLF_MOTOR_CURRENT_AND_PHASE *
MotorCurrentAndPhase);
static SANE_Status LLFSetMotorTable (PAsic chip, unsigned int dwTableBaseAddr,
unsigned short *MotorTablePtr);
static SANE_Status LLFSetShadingTable (PAsic chip, unsigned int dwTableBaseAddr,
unsigned int dwTableSize,
unsigned short *ShadingTablePtr);
static SANE_Status LLFMotorMove (PAsic chip, LLF_MOTORMOVE * LLF_MotorMove);
static void SetMotorStepTable (PAsic chip, LLF_MOTORMOVE * MotorStepsTable,
unsigned short wStartY,
unsigned int dwScanImageSteps,
unsigned short wYResolution);
static void SetMotorStepTableForCalibration (PAsic chip,
LLF_MOTORMOVE * MotorStepsTable,
unsigned int dwScanImageSteps);
static void CalculateScanMotorTable (LLF_CALCULATEMOTORTABLE *
lpCalculateMotorTable);
static void CalculateMoveMotorTable (LLF_CALCULATEMOTORTABLE *
lpCalculateMotorTable);
static SANE_Byte CalculateMotorCurrent (unsigned short dwMotorSpeed);
static SANE_Status MotorMove (PAsic chip, unsigned short wStartSpeed,
unsigned short wEndSpeed,
unsigned int dwFixMoveSpeed,
SANE_Byte bMotorCurrent,
unsigned int dwTotalSteps, SANE_Byte bActionType);
static void InitTiming (PAsic chip);
static SANE_Status OpenScanChip (PAsic chip);
static SANE_Status CloseScanChip (PAsic chip);
static SANE_Status PrepareScanChip (PAsic chip);
static SANE_Status SafeInitialChip (PAsic chip);
static SANE_Status DRAM_Test (PAsic chip);
static SANE_Status GetChipStatus (PAsic chip, SANE_Byte Selector,
SANE_Byte * ChipStatus);
static SANE_Status IsCarriageHome (PAsic chip, SANE_Bool * LampHome);
static SANE_Status WaitCarriageHome (PAsic chip);
static SANE_Status WaitUnitReady (PAsic chip);
static void SetCCDTiming (PAsic chip);
static void SetLineTimeAndExposure (PAsic chip);
static void SetLEDTime (PAsic chip);
static void SetAFEGainOffset (PAsic chip);
static void SetScanMode (PAsic chip, SANE_Byte bScanBits);
static void SetPackAddress (PAsic chip, unsigned short wWidth,
unsigned short wX, double XRatioAdderDouble,
double XRatioTypeDouble, SANE_Byte bClearPulseWidth,
unsigned short * pValidPixelNumber);
static void SetExtraSettings (PAsic chip, unsigned short wXResolution,
unsigned short wCCD_PixelNumber,
SANE_Bool bypassShading);
static SANE_Status Asic_Open (PAsic chip);
static SANE_Status Asic_Close (PAsic chip);
static void Asic_Initialize (PAsic chip);
static SANE_Status Asic_TurnLamp (PAsic chip, SANE_Bool isLampOn);
static SANE_Status Asic_TurnTA (PAsic chip, SANE_Bool isTAOn);
static SANE_Status Asic_SetWindow (PAsic chip, SCANSOURCE lsLightSource,
SANE_Byte bScanType, SANE_Byte bScanBits,
unsigned short wXResolution,
unsigned short wYResolution,
unsigned short wX, unsigned short wY,
unsigned short wWidth,
unsigned short wLength);
static SANE_Status Asic_ScanStart (PAsic chip);
static SANE_Status Asic_ScanStop (PAsic chip);
static SANE_Status Asic_ReadImage (PAsic chip, SANE_Byte * pBuffer,
unsigned short LinesCount);
SANE_Status Asic_Open (PAsic chip);
SANE_Status Asic_Close (PAsic chip);
void Asic_Initialize (PAsic chip);
SANE_Status Asic_TurnLamp (PAsic chip, SANE_Bool isLampOn);
SANE_Status Asic_TurnTA (PAsic chip, SANE_Bool isTAOn);
SANE_Status Asic_SetWindow (PAsic chip, SCANSOURCE lsLightSource,
SANE_Byte bScanType, SANE_Byte bScanBits,
unsigned short wXResolution,
unsigned short wYResolution,
unsigned short wX, unsigned short wY,
unsigned short wWidth, unsigned short wLength);
SANE_Status Asic_ScanStart (PAsic chip);
SANE_Status Asic_ScanStop (PAsic chip);
SANE_Status Asic_ReadImage (PAsic chip, SANE_Byte * pBuffer,
unsigned short LinesCount);
#if SANE_UNUSED
static SANE_Status Asic_CheckFunctionKey (PAsic chip, SANE_Byte * key);
SANE_Status Asic_CheckFunctionKey (PAsic chip, SANE_Byte * key);
#endif
static SANE_Status Asic_IsTAConnected (PAsic chip, SANE_Bool *hasTA);
SANE_Status Asic_IsTAConnected (PAsic chip, SANE_Bool *hasTA);
/* called by AdjustAD and FindTopLeft */
static SANE_Status Asic_ReadCalibrationData (PAsic chip, SANE_Byte * pBuffer,
unsigned int dwXferBytes,
SANE_Byte bScanBits);
SANE_Status Asic_ReadCalibrationData (PAsic chip, SANE_Byte * pBuffer,
unsigned int dwXferBytes,
SANE_Byte bScanBits);
static SANE_Status Asic_MotorMove (PAsic chip, SANE_Bool isForward,
unsigned int dwTotalSteps);
static SANE_Status Asic_CarriageHome (PAsic chip);
static SANE_Status Asic_SetShadingTable (PAsic chip,
unsigned short * lpWhiteShading,
unsigned short * lpDarkShading,
unsigned short wXResolution,
unsigned short wWidth);
SANE_Status Asic_MotorMove (PAsic chip, SANE_Bool isForward,
unsigned int dwTotalSteps);
SANE_Status Asic_CarriageHome (PAsic chip);
SANE_Status Asic_SetShadingTable (PAsic chip, unsigned short * lpWhiteShading,
unsigned short * lpDarkShading,
unsigned short wXResolution,
unsigned short wWidth);
#endif

Plik diff jest za duży Load Diff

Wyświetl plik

@ -50,11 +50,6 @@
#include "mustek_usb2_asic.h"
typedef enum
{
RO_RGB,
RO_BGR
} RGBORDER;
typedef enum
{
@ -66,14 +61,6 @@ typedef enum
} COLORMODE;
typedef struct
{
RGBORDER roRgbOrder;
unsigned short wWantedLineNum;
unsigned short wXferedLineNum;
SANE_Byte * pBuffer;
} IMAGEROWS, *LPIMAGEROWS;
typedef struct
{
COLORMODE cmColorMode;
@ -128,32 +115,16 @@ extern unsigned short * g_pGammaTable;
extern SCANSOURCE g_ssScanSource;
extern Asic g_chip;
static void MustScanner_Init (void);
static SANE_Bool MustScanner_PowerControl (SANE_Bool isLampOn,
SANE_Bool isTALampOn);
static SANE_Bool MustScanner_BackHome (void);
static unsigned short MustScanner_FiltLower (unsigned short * pSort,
unsigned short TotalCount,
unsigned short LowCount,
unsigned short HighCount);
static void *MustScanner_ReadDataFromScanner (void * dummy);
static void MustScanner_PrepareCalculateMaxMin (unsigned short wResolution);
static SANE_Bool MustScanner_CalculateMaxMin (SANE_Byte * pBuffer,
unsigned short * lpMaxValue,
unsigned short * lpMinValue);
static SANE_Bool MustScanner_ScanSuggest (PTARGETIMAGE pTarget);
static SANE_Bool MustScanner_StopScan (void);
static SANE_Bool MustScanner_PrepareScan (void);
static SANE_Bool MustScanner_GetRows (SANE_Byte * lpBlock,
unsigned short * Rows,
SANE_Bool isOrderInvert);
static SANE_Bool MustScanner_Reset (SCANSOURCE ssScanSource);
static SANE_Bool MustScanner_SetupScan (TARGETIMAGE *pTarget);
static SANE_Bool MustScanner_AdjustAD (void);
static SANE_Bool MustScanner_FindTopLeft (unsigned short * lpwStartX,
unsigned short * lpwStartY);
static SANE_Bool MustScanner_LineCalibration16Bits (void);
void MustScanner_Init (void);
SANE_Bool MustScanner_PowerControl (SANE_Bool isLampOn, SANE_Bool isTALampOn);
SANE_Bool MustScanner_BackHome (void);
SANE_Bool MustScanner_GetRows (SANE_Byte * lpBlock, unsigned short * Rows,
SANE_Bool isOrderInvert);
SANE_Bool MustScanner_ScanSuggest (PTARGETIMAGE pTarget);
SANE_Bool MustScanner_StopScan (void);
SANE_Bool MustScanner_PrepareScan (void);
SANE_Bool MustScanner_Reset (SCANSOURCE ssScanSource);
SANE_Bool MustScanner_SetupScan (TARGETIMAGE *pTarget);
#endif