summaryrefslogtreecommitdiff
path: root/sanei/sanei_ab306.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2023-02-12 17:36:29 +0100
committerJörg Frings-Fürst <debian@jff.email>2023-02-12 17:36:29 +0100
commit882fd010527b8d8823f09e19edbed3746265fa08 (patch)
treebe5c7cace6697afc753c152d13ad5145d0884a42 /sanei/sanei_ab306.c
parent527bedac30eb120915718eb7997e6dacd583512e (diff)
parente0d94cf4d39395df1e2c6bb4d967200298c13881 (diff)
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'sanei/sanei_ab306.c')
-rw-r--r--sanei/sanei_ab306.c42
1 files changed, 8 insertions, 34 deletions
diff --git a/sanei/sanei_ab306.c b/sanei/sanei_ab306.c
index aa642c9..5c1f200 100644
--- a/sanei/sanei_ab306.c
+++ b/sanei/sanei_ab306.c
@@ -47,33 +47,7 @@
#include <sys/types.h>
-#ifdef HAVE_SYS_IO_H
-# include <sys/io.h> /* use where available (glibc 2.x, for example) */
-# ifndef SANE_HAVE_SYS_IO_H_WITH_INB_OUTB
-# define IO_SUPPORT_MISSING
-# endif
-#elif HAVE_ASM_IO_H
-# include <asm/io.h> /* ugly, but backwards compatible */
-#elif defined (__i386__) && defined (__GNUC__)
-
-static __inline__ void
-outb (u_char value, u_long port)
-{
- __asm__ __volatile__ ("outb %0,%1" : : "a" (value), "d" ((u_short) port));
-}
-
-static __inline__ u_char
-inb (u_long port)
-{
- u_char value;
-
- __asm__ __volatile__ ("inb %1,%0" : "=a" (value) : "d" ((u_short)port));
- return value;
-}
-
-#else
-# define IO_SUPPORT_MISSING
-#endif
+#include "../include/sane/sanei_directio.h"
#include "../include/sane/sane.h"
#include "../include/sane/sanei.h"
@@ -149,7 +123,7 @@ ab306_outb (Port *p, u_long addr, u_char val)
return;
}
else
- outb (val, addr);
+ sanei_outb (addr, val);
}
static int
@@ -166,7 +140,7 @@ ab306_inb (Port *p, u_long addr)
return ch;
}
else
- return inb (addr);
+ return sanei_inb (addr);
}
/* Send a single command-byte over the AB306N-interface. */
@@ -299,11 +273,11 @@ sanei_ab306_open (const char *dev, int *fdp)
byte = wakeup[j];
if (j == NELEMS(wakeup) - 1)
byte |= i;
- outb (byte, AB306_CIO);
+ sanei_outb (AB306_CIO, byte);
}
#else /* !defined(__FreeBSD__) */
- if (ioperm (AB306_CIO, 1, 1) != 0)
+ if (sanei_ioperm (AB306_CIO, 1, 1) != 0)
{
DBG(1, "sanei_ab306_ioport: using /dev/port access\n");
if (port[i].port_fd < 0)
@@ -329,7 +303,7 @@ sanei_ab306_open (const char *dev, int *fdp)
byte = wakeup[j];
if (j == NELEMS(wakeup) - 1)
byte |= i;
- outb (byte, AB306_CIO);
+ sanei_outb (AB306_CIO, byte);
}
status = sanei_ab306_get_io_privilege (i);
if (status != SANE_STATUS_GOOD)
@@ -373,7 +347,7 @@ sanei_ab306_get_io_privilege (int fd)
if (dev_io_fd < 0)
return SANE_STATUS_IO_ERROR;
#else /* !defined(__FreeBSD__) */
- if (ioperm (port[fd].base, 3, 1) != 0)
+ if (sanei_ioperm (port[fd].base, 3, 1) != 0)
return SANE_STATUS_IO_ERROR;
#endif /* !defined(__FreeBSD__) */
}
@@ -493,7 +467,7 @@ sanei_ab306_rdata (int fd, int planes, SANE_Byte * buf, int lines, int bpl)
/* the pixel-loop: */
for (bcnt = 0; bcnt < xmax; bcnt++)
{
- *(u_char *) buf = inb (p->base);
+ *(u_char *) buf = sanei_inb (p->base);
++buf;
}
}