Added outb_eppdata() functionality (thanks to Anderson Lizardo).

merge-requests/1/head
Gerhard Jaeger 2005-04-25 09:51:32 +00:00
rodzic cc4a40095c
commit 7cc112b202
2 zmienionych plików z 31 dodań i 5 usunięć

Wyświetl plik

@ -140,7 +140,7 @@ extern SANE_Status sanei_pp_getmodes( int fd, int *mode );
*/
extern SANE_Status sanei_pp_setmode( int fd, int mode );
/** Write data to ports (spp-data, ctrl and epp-address)
/** Write data to ports (spp-data, ctrl, epp-address and epp-data)
*
* @param fd - handle of device to which shall be written to.
* @param val - data to write.
@ -149,6 +149,7 @@ extern SANE_Status sanei_pp_setmode( int fd, int mode );
extern SANE_Status sanei_pp_outb_data( int fd, SANE_Byte val );
extern SANE_Status sanei_pp_outb_ctrl( int fd, SANE_Byte val );
extern SANE_Status sanei_pp_outb_addr( int fd, SANE_Byte val );
extern SANE_Status sanei_pp_outb_epp ( int fd, SANE_Byte val );
/** Read data from ports (spp-data, status, ctrl and epp-data)
* @param fd - handle of device who should be read from.

Wyświetl plik

@ -216,6 +216,11 @@ static inline u_char inb_eppdata(int fd)
return val;
}
static inline void outb_eppdata(int fd, u_char val)
{
ieee1284_epp_write_data(pplist.portv[fd], 0, (const char *)&val, 1);
}
#define outb_data(fd,val) ieee1284_write_data(pplist.portv[fd], val)
#define outb_ctrl(fd,val) ieee1284_write_control(pplist.portv[fd], \
(val) ^ C1284_INVERTED)
@ -231,10 +236,11 @@ static inline void outb_addr(int fd, u_char val)
#define inb_ctrl(fd) inb(port[fd].base + 2)
#define inb_eppdata(fd) inb(port[fd].base + 4)
#define outb_data(fd,val) outb(val, port[fd].base)
#define outb_stat(fd,val) outb(val, port[fd].base + 1)
#define outb_ctrl(fd,val) outb(val, port[fd].base + 2)
#define outb_addr(fd,val) outb(val, port[fd].base + 3)
#define outb_data(fd,val) outb(val, port[fd].base)
#define outb_stat(fd,val) outb(val, port[fd].base + 1)
#define outb_ctrl(fd,val) outb(val, port[fd].base + 2)
#define outb_addr(fd,val) outb(val, port[fd].base + 3)
#define outb_eppdata(fd,val) outb(val, port[fd].base + 4)
#ifdef HAVE_IOPL
# define _SET_IOPL() iopl(3)
@ -1090,6 +1096,25 @@ sanei_pp_outb_addr( int fd, SANE_Byte val )
return SANE_STATUS_GOOD;
}
SANE_Status
sanei_pp_outb_epp( int fd, SANE_Byte val )
{
#ifdef _PARANOIA
DBG( 4, "sanei_pp_outb_epp: called for fd %d\n", fd );
#if defined(HAVE_LIBIEEE1284)
if ((fd < 0) || (fd >= pplist.portc)) {
#else
if ((fd < 0) || (fd >= NELEMS (port))) {
#endif
DBG( 2, "sanei_pp_outb_epp: invalid fd %d\n", fd );
return SANE_STATUS_INVAL;
}
#endif
outb_eppdata( fd, val );
return SANE_STATUS_GOOD;
}
SANE_Byte
sanei_pp_inb_data( int fd )
{