2 /************************************************************************************\
4 marvelli.h - HP SANE backend support for Marvell based multi-function peripherals
6 (c) 2008 Copyright Hewlett-Packard Development Company, LP
8 Permission is hereby granted, free of charge, to any person obtaining a copy
9 of this software and associated documentation files (the "Software"), to deal
10 in the Software without restriction, including without limitation the rights
11 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
12 of the Software, and to permit persons to whom the Software is furnished to do
13 so, subject to the following conditions:
15 The above copyright notice and this permission notice shall be included in all
16 copies or substantial portions of the Software.
18 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
20 FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
21 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
22 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 Author: David Suffield, Yashwant Sahu
27 \************************************************************************************/
32 #define MARVELL_CONTRAST_MIN -127
33 #define MARVELL_CONTRAST_MAX 127
34 #define MARVELL_CONTRAST_DEFAULT 0
36 #define MM_PER_INCH 25.4
38 enum MARVELL_OPTION_NUMBER
40 MARVELL_OPTION_COUNT = 0,
41 MARVELL_OPTION_GROUP_SCAN_MODE,
42 MARVELL_OPTION_SCAN_MODE,
43 MARVELL_OPTION_SCAN_RESOLUTION,
44 MARVELL_OPTION_INPUT_SOURCE, /* platen, ADF */
45 MARVELL_OPTION_GROUP_ADVANCED,
46 MARVELL_OPTION_CONTRAST,
47 MARVELL_OPTION_GROUP_GEOMETRY,
55 #define MAX_LIST_SIZE 32
56 #define MAX_STRING_SIZE 32
60 CE_BLACK_AND_WHITE1 = 1,
79 struct marvell_session
81 char *tag; /* handle identifier */
82 HPMUD_DEVICE dd; /* hpiod device descriptor */
83 HPMUD_CHANNEL cd; /* hpiod soap channel descriptor */
84 char uri[HPMUD_LINE_SIZE];
85 char model[HPMUD_LINE_SIZE];
88 IP_IMAGE_TRAITS image_traits; /* specified by image processor */
90 SANE_Option_Descriptor option[MARVELL_OPTION_MAX];
92 SANE_String_Const scan_mode_list[CE_MAX];
93 enum COLOR_ENTRY scan_mode_map[CE_MAX];
94 enum COLOR_ENTRY current_scan_mode;
96 SANE_String_Const input_source_list[IS_MAX];
97 enum INPUT_SOURCE input_source_map[IS_MAX];
98 enum INPUT_SOURCE current_input_source;
100 SANE_Int resolution_list[MAX_LIST_SIZE];
101 SANE_Int current_resolution;
103 SANE_Range contrast_range;
104 SANE_Int current_contrast;
106 SANE_Range tlxRange, tlyRange, brxRange, bryRange;
107 SANE_Fixed currentTlx, currentTly, currentBrx, currentBry;
108 SANE_Fixed effectiveTlx, effectiveTly, effectiveBrx, effectiveBry;
109 SANE_Fixed min_width, min_height;
113 int cnt; /* number bytes available in buf[] */
114 unsigned char buf[32768]; /* line buffer (max = 1200dpi * 8.5inches * 3pixels) */
116 void *hpmud_handle; /* returned by dlopen */
117 void *bb_handle; /* returned by dlopen */
119 int (*bb_open)(struct marvell_session *ps);
120 int (*bb_close)(struct marvell_session *ps);
121 int (*bb_get_parameters)(struct marvell_session *ps, SANE_Parameters *pp, int scan_started);
122 int (*bb_is_paper_in_adf)(struct marvell_session *ps); /* 0 = no paper in adf, 1 = paper in adf, 2 = no adf, -1 = error */
123 int (*bb_start_scan)(struct marvell_session *ps);
124 int (*bb_get_image_data)(struct marvell_session *ps, int max_length); /* see cnt and buf above */
125 int (*bb_end_page)(struct marvell_session *ps, int io_error);
126 int (*bb_end_scan)(struct marvell_session *ps, int io_error);
127 /* Add new elements here. */
128 void *math_handle; /* returned by dlopen */
129 enum HPMUD_SCANSRC scansrc; /* 0=NA */
130 enum MARVELL_VERSION version;
133 #endif // _MARVELLI_H