Introduce structure for specifying model-specific parameters on the ASIC level.

merge-requests/1/head
Jan Hauffa 2011-04-25 19:26:32 +02:00 zatwierdzone przez m. allan noah
rodzic 529b6a1d6d
commit 5d556cd5e6
4 zmienionych plików z 29 dodań i 2 usunięć

Wyświetl plik

@ -102,6 +102,8 @@ static const Scanner_Model models[] = {
0x055f, 0x0409, /* USB vendor and product ID */
&paramsMustekBP2448TAPro,
{5 /* count */, 1200, 600, 300, 150, 75}, /* possible resolutions */
/* x and y size of scan area in mm */
@ -134,6 +136,8 @@ static const Scanner_Model models[] = {
0x05da, 0x3025, /* USB vendor and product ID */
&paramsMicrotek4800H48U,
{5 /* count */, 1200, 600, 300, 150, 75}, /* possible resolutions */
/* x and y size of scan area in mm */
@ -678,6 +682,7 @@ sane_open (SANE_String_Const devname, SANE_Handle * handle)
memset (s, 0, sizeof (*s));
s->model = device->model;
s->state.chip.device_name = device->name;
s->state.chip.params = device->model->asic_params;
Scanner_Init (&s->state);

Wyświetl plik

@ -103,6 +103,8 @@ typedef struct
unsigned short vendor_id;
unsigned short product_id;
const ASIC_ModelParams * asic_params;
/** @name Scanner model parameters */
/*@{ */
SANE_Word dpi_values[MAX_RESOLUTIONS]; /* possible resolutions */

Wyświetl plik

@ -63,6 +63,15 @@
#include "mustek_usb2_asic.h"
const ASIC_ModelParams paramsMustekBP2448TAPro = {
SDRAMCLK_DELAY_12_ns
};
const ASIC_ModelParams paramsMicrotek4800H48U = {
SDRAMCLK_DELAY_8_ns
};
static SANE_Status PrepareScanChip (ASIC * chip);
static SANE_Status WaitCarriageHome (ASIC * chip);
static SANE_Status WaitUnitReady (ASIC * chip);
@ -399,7 +408,8 @@ RamAccess (ASIC * chip, RAMACCESS * access)
if (status != SANE_STATUS_GOOD)
return status;
SendData (chip, ES01_79_AFEMCLK_SDRAMCLK_DELAY_CONTROL, SDRAMCLK_DELAY_12_ns);
SendData (chip, ES01_79_AFEMCLK_SDRAMCLK_DELAY_CONTROL,
chip->params->SDRAM_Delay);
if (access->IsWriteAccess)
{
@ -1836,7 +1846,8 @@ Asic_Open (ASIC * chip)
USB_POWER_SAVE_ENABLE | USB_REMOTE_WAKEUP_ENABLE |
LED_MODE_FLASH_SLOWLY);
SendData (chip, ES01_86_DisableAllClockWhenIdle, 0);
SendData (chip, ES01_79_AFEMCLK_SDRAMCLK_DELAY_CONTROL, SDRAMCLK_DELAY_12_ns);
SendData (chip, ES01_79_AFEMCLK_SDRAMCLK_DELAY_CONTROL,
chip->params->SDRAM_Delay);
/* SDRAM initialization sequence */
SendData (chip, ES01_87_SDRAM_Timing, 0xf1);

Wyświetl plik

@ -148,6 +148,11 @@ typedef struct
SANE_Byte bScanDecSteps;
} MOTORMOVE;
typedef struct
{
SANE_Byte SDRAM_Delay;
} ASIC_ModelParams;
typedef struct
{
/* AFE */
@ -194,6 +199,8 @@ typedef struct
SANE_String_Const device_name;
int fd; /* file descriptor of scanner */
const ASIC_ModelParams * params;
FIRMWARESTATE firmwarestate;
SANE_Bool isFirstOpenChip; /* == SANE_FALSE after first Asic_Open */
SANE_Bool isUsb20;
@ -967,6 +974,8 @@ typedef struct
#define ES01_2CE_VALID_PIXEL_PARAMETER_OF_SEGMENT15 0x2CE
#define ES01_2CF_VALID_PIXEL_PARAMETER_OF_SEGMENT16 0x2CF
extern const ASIC_ModelParams paramsMustekBP2448TAPro;
extern const ASIC_ModelParams paramsMicrotek4800H48U;
void SetAFEGainOffset (ASIC * chip);