2003-06-05 07:05:59 +00:00
|
|
|
#ifndef _HP5400_INTERNAL_H_
|
|
|
|
#define _HP5400_INTERNAL_H_
|
|
|
|
|
|
|
|
/* sane - Scanner Access Now Easy.
|
|
|
|
(C) 2003 Thomas Soumarmon <thomas.soumarmon@cogitae.net>
|
|
|
|
(c) 2003 Martijn van Oosterhout, kleptog@svana.org
|
|
|
|
(c) 2002 Bertrik Sikken, bertrik@zonnet.nl
|
|
|
|
|
|
|
|
This file is part of the SANE package.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License as
|
|
|
|
published by the Free Software Foundation; either version 2 of the
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful, but
|
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
|
|
|
MA 02111-1307, USA.
|
|
|
|
|
|
|
|
As a special exception, the authors of SANE give permission for
|
|
|
|
additional uses of the libraries contained in this release of SANE.
|
|
|
|
|
|
|
|
The exception is that, if you link a SANE library with other files
|
|
|
|
to produce an executable, this does not by itself cause the
|
|
|
|
resulting executable to be covered by the GNU General Public
|
|
|
|
License. Your use of that executable is in no way restricted on
|
|
|
|
account of linking the SANE library code into it.
|
|
|
|
|
|
|
|
This exception does not, however, invalidate any other reasons why
|
|
|
|
the executable file might be covered by the GNU General Public
|
|
|
|
License.
|
|
|
|
|
|
|
|
If you submit changes to SANE to the maintainers to be included in
|
|
|
|
a subsequent release, you agree by submitting the changes that
|
|
|
|
those changes may be distributed with this exception intact.
|
|
|
|
|
|
|
|
If you write modifications of your own for SANE, it is your choice
|
|
|
|
whether to permit this exception to apply to your modifications.
|
|
|
|
If you do not wish that, delete this exception notice.
|
|
|
|
|
|
|
|
HP5400/5470 Test util.
|
|
|
|
Currently is only able to read back the scanner version string,
|
|
|
|
but this basically demonstrates ability to communicate with the scanner.
|
|
|
|
|
|
|
|
Massively expanded. Can do calibration scan, upload gamma and calibration
|
|
|
|
tables and stores the results of a scan. - 19/02/2003 Martijn
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __GNUC__
|
|
|
|
#define PACKED __attribute__ ((packed))
|
|
|
|
#else
|
|
|
|
#define PACKED
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* If this is enabled, a copy of the raw data from the scanner will be saved to
|
|
|
|
imagedebug.dat and the attempted conversion to imagedebug.ppm */
|
|
|
|
/* #define IMAGE_DEBUG */
|
|
|
|
|
|
|
|
/* If this is defined you get extra info on the calibration */
|
|
|
|
/* #define CALIB_DEBUG */
|
|
|
|
|
|
|
|
#define CMD_GETVERSION 0x1200
|
|
|
|
#define CMD_GETUITEXT 0xf00b
|
|
|
|
#define CMD_GETCMDID 0xc500
|
|
|
|
#define CMD_SCANREQUEST 0x2505 /* This is for previews */
|
|
|
|
#define CMD_SCANREQUEST2 0x2500 /* This is for real scans */
|
|
|
|
#define CMD_SCANRESPONSE 0x3400
|
|
|
|
|
|
|
|
/* Testing stuff to make it work */
|
|
|
|
#define CMD_SETDPI 0x1500 /* ??? */
|
|
|
|
#define CMD_STOPSCAN 0x1B01 /* 0x40 = lamp in on, 0x00 = lamp is off */
|
|
|
|
#define CMD_STARTSCAN 0x1B05 /* 0x40 = lamp in on, 0x00 = lamp is off */
|
|
|
|
#define CMD_UNKNOWN 0x2300 /* Send fixed string */
|
|
|
|
#define CMD_UNKNOWN2 0xD600 /* ??? Set to 0x04 */
|
|
|
|
#define CMD_UNKNOWN3 0xC000 /* ??? Set to 02 03 03 3C */
|
|
|
|
#define CMD_SETOFFSET 0xE700 /* two ints in network order. X-offset, Y-offset of full scan */
|
|
|
|
/* Given values seem to be 0x0054 (=4.57mm) and 0x0282 (=54.36mm) */
|
|
|
|
|
|
|
|
#define CMD_INITBULK1 0x0087 /* send 0x14 */
|
|
|
|
#define CMD_INITBULK2 0x0083 /* send 0x24 */
|
|
|
|
#define CMD_INITBULK3 0x0082 /* transfer length 0xf000 */
|
|
|
|
|
|
|
|
|
|
|
|
struct ScanRequest
|
|
|
|
{
|
|
|
|
u_int8_t x1; /* Set to 0x08 */
|
|
|
|
u_int16_t dpix, dpiy; /* Set to 75, 150 or 300 in network order */
|
|
|
|
u_int16_t offx, offy; /* Offset to scan, in 1/300th of dpi, in network order */
|
|
|
|
u_int16_t lenx, leny; /* Size of scan, in 1/300th of dpi, in network order */
|
|
|
|
u_int16_t flags1, flags2, flags3; /* Undetermined flag info */
|
|
|
|
/* Known combinations are:
|
|
|
|
1st calibration scan: 0x0000, 0x0010, 0x1820 = 24bpp
|
|
|
|
2nd calibration scan: 0x0000, 0x0010, 0x3020 = 48bpp ???
|
|
|
|
3rd calibration scan: 0x0000, 0x0010, 0x3024 = 48bpp ???
|
|
|
|
Preview scan: 0x0080, 0x0000, 0x18E8 = 8bpp
|
|
|
|
4th & 5th like 2nd and 3rd
|
|
|
|
B&W scan: 0x0080, 0x0040, 0x08E8 = 8bpp
|
|
|
|
6th & 7th like 2nd and 3rd
|
|
|
|
True colour scan 0x0080, 0x0040, 0x18E8 = 24bpp
|
|
|
|
*/
|
|
|
|
u_int8_t zero; /* Seems to always be zero */
|
|
|
|
u_int16_t gamma[3]; /* Set to 100 in network order. Gamma? */
|
|
|
|
u_int16_t pad[3]; /* Zero padding ot 32 bytes??? */
|
|
|
|
}
|
|
|
|
PACKED;
|
|
|
|
|
|
|
|
/* More known combos (All 24-bit):
|
|
|
|
300 x 300 light calibration: 0x0000, 0x0010, 0x1820
|
|
|
|
300 x 300 dark calibration: 0x0000, 0x0010, 0x3024
|
|
|
|
75 x 75 preview scan: 0x0080, 0x0000, 0x18E8
|
|
|
|
300 x 300 full scan: 0x0080, 0x0000, 0x18E8
|
|
|
|
600 x 300 light calibration: 0x0000, 0x0010, 0x3000
|
|
|
|
600 x 300 dark calibration: 0x0000, 0x0010, 0x3004
|
|
|
|
600 x 600 full scan: 0x0080, 0x0000, 0x18C8
|
|
|
|
1200 x 300 light calibration: 0x0000, 0x0010, 0x3000
|
|
|
|
1200 x 300 dark calibration: 0x0000, 0x0010, 0x3004
|
|
|
|
1200 x 1200 full scan: 0x0080, 0x0000, 0x18C8
|
|
|
|
2400 x 300 light calibration: 0x0000, 0x0010, 0x3000
|
|
|
|
2400 x 300 dark calibration: 0x0000, 0x0010, 0x3004
|
|
|
|
2400 x 2400 full scan: 0x0080, 0x0000, 0x18C0
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct ScanResponse
|
|
|
|
{
|
|
|
|
u_int16_t x1; /* Usually 0x0000 or 0x4000 */
|
|
|
|
u_int32_t transfersize; /* Number of bytes to be transferred */
|
|
|
|
u_int32_t xsize; /* Shape of returned bitmap */
|
|
|
|
u_int16_t ysize; /* Why does the X get more bytes? */
|
|
|
|
u_int16_t pad[2]; /* Zero padding to 16 bytes??? */
|
|
|
|
}
|
|
|
|
PACKED;
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
int
|
|
|
|
InitScan2 (enum ScanType type, struct ScanRequest *req,
|
|
|
|
THWParams * pHWParams, struct ScanResponse *res,
|
|
|
|
int iColourOffset, int code);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
void
|
|
|
|
FinishScan (THWParams * pHWParams);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
int
|
|
|
|
WriteByte (int iHandle, int cmd, char data);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
int
|
|
|
|
SetLamp (THWParams * pHWParams, int fLampOn);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
int
|
|
|
|
WarmupLamp (int iHandle);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
int
|
|
|
|
SetCalibration (int iHandle, int numPixels,
|
|
|
|
unsigned int *low_vals[3],
|
|
|
|
unsigned int *high_vals[3], int dpi);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
void
|
|
|
|
WriteGammaCalibTable (int iHandle, const int *pabGammaR,
|
|
|
|
const int *pabGammaG,
|
|
|
|
const int *pabGammaB);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
void
|
|
|
|
SetDefaultGamma (int iHandle);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
void
|
|
|
|
CircBufferInit (int iHandle, TDataPipe * p, int iBytesPerLine,
|
|
|
|
int bpp, int iMisAlignment, int blksize,
|
|
|
|
int iTransferSize);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
int
|
|
|
|
CircBufferGetLine (int iHandle, TDataPipe * p, void *pabLine);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
void
|
|
|
|
CircBufferExit (TDataPipe * p);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
void
|
|
|
|
DecodeImage (FILE * file, int planes, int bpp, int xsize, int ysize,
|
|
|
|
const char *filename);
|
2003-10-06 11:25:50 +00:00
|
|
|
|
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
int
|
|
|
|
hp5400_test_scan_response (struct ScanResponse *resp,
|
|
|
|
struct ScanRequest *req);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
int
|
|
|
|
DoAverageScan (int iHandle, struct ScanRequest *req, int code,
|
|
|
|
unsigned int **array);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
int
|
|
|
|
DoScan (int iHandle, struct ScanRequest *req, const char *filename, int code,
|
|
|
|
struct ScanResponse *res);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
int
|
|
|
|
Calibrate (int iHandle, int dpi);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
int
|
|
|
|
hp5400_scan (int iHandle, TScanParams * params, THWParams * pHWParams,
|
|
|
|
const char *filename);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
int
|
|
|
|
PreviewScan (int iHandle);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
int
|
|
|
|
InitScanner (int iHandle);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
int
|
|
|
|
InitScan (enum ScanType scantype, TScanParams * pParams,
|
|
|
|
THWParams * pHWParams);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
void
|
|
|
|
FinishScan (THWParams * pHWParams);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
int
|
|
|
|
HP5400Open (THWParams * params, char *filename);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
void
|
|
|
|
HP5400Close (THWParams * params);
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-06-05 07:05:59 +00:00
|
|
|
int
|
|
|
|
HP5400Detect (char *filename,
|
|
|
|
int (*_ReportDevice) (TScannerModel * pModel,
|
|
|
|
char *pszDeviceName));
|
|
|
|
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-07-28 07:14:16 +00:00
|
|
|
int
|
|
|
|
InitHp5400_internal( void );
|
|
|
|
|
2003-10-06 11:25:50 +00:00
|
|
|
HP5400_SANE_STATIC
|
2003-07-28 07:14:16 +00:00
|
|
|
int
|
|
|
|
FreeHp5400_internal( void );
|
|
|
|
|
2003-06-05 07:05:59 +00:00
|
|
|
|
|
|
|
#ifdef STANDALONE
|
|
|
|
int
|
|
|
|
main (int argc, char *argv[]);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|