summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/Makefile.am9
-rw-r--r--include/sane/sanei_backend.h8
-rw-r--r--include/sane/sanei_directio.h71
3 files changed, 76 insertions, 12 deletions
diff --git a/include/Makefile.am b/include/Makefile.am
index c949491..f807e61 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -11,8 +11,9 @@ EXTRA_DIST = lalloca.h lassert.h lgetopt.h md5.h font_6x11.h
EXTRA_DIST += sane/config.h.in sane/sanei.h sane/sanei_ab306.h \
sane/sanei_access.h sane/sanei_auth.h sane/sanei_backend.h \
sane/sanei_cderror.h sane/sanei_codec_ascii.h sane/sanei_codec_bin.h \
- sane/sanei_config.h sane/sanei_debug.h sane/sanei_jinclude.h \
- sane/sanei_jpeg.h sane/sanei_lm983x.h sane/sanei_net.h sane/sanei_pa4s2.h \
- sane/sanei_pio.h sane/sanei_pp.h sane/sanei_pv8630.h sane/sanei_scsi.h \
- sane/sanei_tcp.h sane/sanei_thread.h sane/sanei_udp.h sane/sanei_usb.h \
+ sane/sanei_config.h sane/sanei_debug.h sane/sanei_directio.h \
+ sane/sanei_jinclude.h sane/sanei_jpeg.h sane/sanei_lm983x.h \
+ sane/sanei_net.h sane/sanei_pa4s2.h sane/sanei_pio.h sane/sanei_pp.h \
+ sane/sanei_pv8630.h sane/sanei_scsi.h sane/sanei_tcp.h \
+ sane/sanei_thread.h sane/sanei_udp.h sane/sanei_usb.h \
sane/sanei_wire.h sane/sanei_magic.h sane/sanei_ir.h
diff --git a/include/sane/sanei_backend.h b/include/sane/sanei_backend.h
index 32d8ce0..db4d7b8 100644
--- a/include/sane/sanei_backend.h
+++ b/include/sane/sanei_backend.h
@@ -24,14 +24,6 @@
# define __func__ "(unknown)"
#endif
-#ifdef HAVE_SYS_HW_H
- /* OS/2 i/o-port access compatibility macros: */
-# define inb(p) _inp8 (p)
-# define outb(v,p) _outp8 ((p),(v))
-# define ioperm(b,l,o) _portaccess ((b),(b)+(l)-1)
-# define HAVE_IOPERM 1
-#endif
-
#ifndef HAVE_OS2_H
#include <fcntl.h>
#ifndef O_NONBLOCK
diff --git a/include/sane/sanei_directio.h b/include/sane/sanei_directio.h
new file mode 100644
index 0000000..944605d
--- /dev/null
+++ b/include/sane/sanei_directio.h
@@ -0,0 +1,71 @@
+#ifndef __SANEI_DIRECTIO_H__
+#define __SANEI_DIRECTIO_H__
+
+#ifdef HAVE_SYS_IO_H
+#include <sys/io.h>
+#endif
+
+#ifdef ENABLE_PARPORT_DIRECTIO
+
+#if (! defined SANE_INB ) && ( defined HAVE_SYS_HW_H ) /* OS/2 EMX case */
+#define SANE_INB 1
+#endif /* OS/2 EMX case */
+
+
+
+#if (! defined SANE_INB ) && ( defined HAVE_MACHINE_CPUFUNC_H ) /* FreeBSD case */
+#define SANE_INB 2
+#endif /* FreeBSD case */
+
+
+/* linux GCC on i386 */
+#if ( ! defined SANE_INB ) && ( defined HAVE_SYS_IO_H ) && ( defined __GNUC__ ) && ( defined __i386__ )
+#define SANE_INB 3
+#endif /* linux GCC on i386 */
+
+
+/* linux GCC non i386 */
+#if ( ! defined SANE_INB ) && ( defined HAVE_SYS_IO_H ) && ( defined __GNUC__ ) && ( ! defined __i386__ )
+#define SANE_INB 4
+#endif /* linux GCC non i386 */
+
+
+/* ICC on i386 */
+#if ( ! defined SANE_INB ) && ( defined __INTEL_COMPILER ) && ( defined __i386__ )
+#define SANE_INB 5
+#endif /* ICC on i386 */
+
+/* direct io requested, but no valid inb/oub */
+#if ( ! defined SANE_INB) && ( defined ENABLE_PARPORT_DIRECTIO )
+#warning "ENABLE_PARPORT_DIRECTIO cannot be used du to lack of inb/out definition"
+#undef ENABLE_PARPORT_DIRECTIO
+#endif
+
+#endif /* ENABLE_PARPORT_DIRECTIO */
+
+/*
+ * no inb/outb without --enable-parport-directio *
+ */
+#ifndef ENABLE_PARPORT_DIRECTIO
+#define SANE_INB 0
+#endif /* ENABLE_PARPORT_DIRECTIO is not defined */
+
+/* we need either direct io or ppdev */
+#if ! defined ENABLE_PARPORT_DIRECTIO && ! defined HAVE_LINUX_PPDEV_H && ! defined HAVE_DEV_PPBUS_PPI_H
+#define IO_SUPPORT_MISSING
+#endif
+
+
+extern int sanei_ioperm (int start, int length, int enable);
+extern unsigned char sanei_inb (unsigned int port);
+extern void sanei_outb (unsigned int port, unsigned char value);
+extern void sanei_insb (unsigned int port, unsigned char *addr,
+ unsigned long count);
+extern void sanei_insl (unsigned int port, unsigned char *addr,
+ unsigned long count);
+extern void sanei_outsb (unsigned int port, const unsigned char *addr,
+ unsigned long count);
+extern void sanei_outsl (unsigned int port, const unsigned char *addr,
+ unsigned long count);
+
+#endif // __SANEI_DIRECTIO_H__