SANEI  1.2.1.189-7ab850
sanei_pp.h
Go to the documentation of this file.
1 /* sane - Scanner Access Now Easy.
2  Copyright (C) 2003 Gerhard Jaeger <gerhard@gjaeger.de>
3  This file is part of the SANE package.
4 
5  This program is free software; you can redistribute it and/or
6  modify it under the terms of the GNU General Public License as
7  published by the Free Software Foundation; either version 2 of the
8  License, or (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <https://www.gnu.org/licenses/>.
17 
18  As a special exception, the authors of SANE give permission for
19  additional uses of the libraries contained in this release of SANE.
20 
21  The exception is that, if you link a SANE library with other files
22  to produce an executable, this does not by itself cause the
23  resulting executable to be covered by the GNU General Public
24  License. Your use of that executable is in no way restricted on
25  account of linking the SANE library code into it.
26 
27  This exception does not, however, invalidate any other reasons why
28  the executable file might be covered by the GNU General Public
29  License.
30 
31  If you submit changes to SANE to the maintainers to be included in
32  a subsequent release, you agree by submitting the changes that
33  those changes may be distributed with this exception intact.
34 
35  If you write modifications of your own for SANE, it is your choice
36  whether to permit this exception to apply to your modifications.
37  If you do not wish that, delete this exception notice.
38 */
39 
45 #ifndef sanei_pp_h
46 #define sanei_pp_h
47 
48 #include <sys/types.h>
49 #include <sane/sane.h>
50 
53  SANEI_PP_MODE_SPP = (1<<1),
54  SANEI_PP_MODE_BIDI = (1<<2),
55  SANEI_PP_MODE_EPP = (1<<4),
56  SANEI_PP_MODE_ECP = (1<<8)
57 };
58 
59 #define SANEI_PP_DATAIN 1
60 #define SANEI_PP_DATAOUT 0
61 
62 /* @{ */
64 #define SANEI_PP_CTRL_STROBE 0x01
65 #define SANEI_PP_CTRL_AUTOLF 0x02
66 #define SANEI_PP_CTRL_NOT_INIT 0x04
67 #define SANEI_PP_CTRL_SELECT_IN 0x08
68 #define SANEI_PP_CTRL_ENABLE_IRQ 0x10
69 #define SANEI_PP_CTRL_DIRECTION 0x20
70 #define SANEI_PP_CTRL_RESERVED 0xc0
71 /* @} */
72 
77 extern SANE_Status sanei_pp_init( void );
78 
85 extern SANE_Status sanei_pp_open( const char *dev, int *fd );
86 
87 /* Close a previously opened parport device.
88  *
89  * @param fd - handle of the device to close
90  */
91 extern void sanei_pp_close( int fd );
92 
98 extern SANE_Status sanei_pp_claim( int fd );
99 
105 extern SANE_Status sanei_pp_release( int fd );
106 
113 extern SANE_Status sanei_pp_set_datadir( int fd, int rev );
114 
123 extern SANE_Bool sanei_pp_uses_directio( void );
124 
131 extern SANE_Status sanei_pp_getmodes( int fd, int *mode );
132 
139 extern SANE_Status sanei_pp_setmode( int fd, int mode );
140 
147 extern SANE_Status sanei_pp_outb_data( int fd, SANE_Byte val );
148 extern SANE_Status sanei_pp_outb_ctrl( int fd, SANE_Byte val );
149 extern SANE_Status sanei_pp_outb_addr( int fd, SANE_Byte val );
150 extern SANE_Status sanei_pp_outb_epp ( int fd, SANE_Byte val );
151 
156 extern SANE_Byte sanei_pp_inb_data( int fd );
157 extern SANE_Byte sanei_pp_inb_stat( int fd );
158 extern SANE_Byte sanei_pp_inb_ctrl( int fd );
159 extern SANE_Byte sanei_pp_inb_epp ( int fd );
160 
168 extern void sanei_pp_udelay( unsigned long usec );
169 
170 #endif
SANE_Byte sanei_pp_inb_data(int fd)
Read data from ports (spp-data, status, ctrl and epp-data)
SANE_Status sanei_pp_outb_data(int fd, SANE_Byte val)
Write data to ports (spp-data, ctrl, epp-address and epp-data)
SANE_Bool sanei_pp_uses_directio(void)
Check whether for libieee1284 usage.
sanei_pp_mode
some modes, we'd like to see/use.
Definition: sanei_pp.h:52
@ SANEI_PP_MODE_ECP
ECP.
Definition: sanei_pp.h:56
@ SANEI_PP_MODE_EPP
EPP.
Definition: sanei_pp.h:55
@ SANEI_PP_MODE_BIDI
BIDI.
Definition: sanei_pp.h:54
@ SANEI_PP_MODE_SPP
SPP.
Definition: sanei_pp.h:53
SANE_Status sanei_pp_open(const char *dev, int *fd)
Open a parport device.
SANE_Status sanei_pp_setmode(int fd, int mode)
Set the operation mode for a given device.
SANE_Status sanei_pp_claim(int fd)
Claim a parport device.
SANE_Status sanei_pp_set_datadir(int fd, int rev)
Set the data direction.
SANE_Status sanei_pp_release(int fd)
Release a previously claimed device.
SANE_Status sanei_pp_init(void)
Initialize sanei_pp.
void sanei_pp_udelay(unsigned long usec)
Delay execution for some micro-seconds.
SANE_Status sanei_pp_getmodes(int fd, int *mode)
Determine the available parallel port modes for a given device.