1 #ifndef __SANEI_DIRECTIO_H__ 2 #define __SANEI_DIRECTIO_H__ 3 4 #ifdef HAVE_SYS_IO_H 5 #include <sys/io.h> 6 #endif 7 8 #ifdef ENABLE_PARPORT_DIRECTIO 9 10 #if (! defined SANE_INB ) && ( defined HAVE_SYS_HW_H ) /* OS/2 EMX case */ 11 #define SANE_INB 1 12 #endif /* OS/2 EMX case */ 13 14 15 16 #if (! defined SANE_INB ) && ( defined HAVE_MACHINE_CPUFUNC_H ) /* FreeBSD case */ 17 #define SANE_INB 2 18 #endif /* FreeBSD case */ 19 20 21 /* linux GCC on i386 */ 22 #if ( ! defined SANE_INB ) && ( defined HAVE_SYS_IO_H ) && ( defined __GNUC__ ) && ( defined __i386__ ) 23 #define SANE_INB 3 24 #endif /* linux GCC on i386 */ 25 26 27 /* linux GCC non i386 */ 28 #if ( ! defined SANE_INB ) && ( defined HAVE_SYS_IO_H ) && ( defined __GNUC__ ) && ( ! defined __i386__ ) 29 #define SANE_INB 4 30 #endif /* linux GCC non i386 */ 31 32 33 /* ICC on i386 */ 34 #if ( ! defined SANE_INB ) && ( defined __INTEL_COMPILER ) && ( defined __i386__ ) 35 #define SANE_INB 5 36 #endif /* ICC on i386 */ 37 38 /* direct io requested, but no valid inb/oub */ 39 #if ( ! defined SANE_INB) && ( defined ENABLE_PARPORT_DIRECTIO ) 40 #warning "ENABLE_PARPORT_DIRECTIO cannot be used du to lack of inb/out definition" 41 #undef ENABLE_PARPORT_DIRECTIO 42 #endif 43 44 #endif /* ENABLE_PARPORT_DIRECTIO */ 45 46 /* 47 * no inb/outb without --enable-parport-directio * 48 */ 49 #ifndef ENABLE_PARPORT_DIRECTIO 50 #define SANE_INB 0 51 #endif /* ENABLE_PARPORT_DIRECTIO is not defined */ 52 53 /* we need either direct io or ppdev */ 54 #if ! defined ENABLE_PARPORT_DIRECTIO && ! defined HAVE_LINUX_PPDEV_H && ! defined HAVE_DEV_PPBUS_PPI_H 55 #define IO_SUPPORT_MISSING 56 #endif 57 58 59 extern int sanei_ioperm (int start, int length, int enable); 60 extern unsigned char sanei_inb (unsigned int port); 61 extern void sanei_outb (unsigned int port, unsigned char value); 62 extern void sanei_insb (unsigned int port, unsigned char *addr, 63 unsigned long count); 64 extern void sanei_insl (unsigned int port, unsigned char *addr, 65 unsigned long count); 66 extern void sanei_outsb (unsigned int port, const unsigned char *addr, 67 unsigned long count); 68 extern void sanei_outsl (unsigned int port, const unsigned char *addr, 69 unsigned long count); 70 71 #endif // __SANEI_DIRECTIO_H__ 72