Lines Matching refs:port
130 u_int in_use; /**< port in use? */
131 u_int claimed; /**< port claimed? */
133 int caps; /**< port capabilities */
140 static PortRec port[_MAX_PORTS];
160 static PortRec port[] = {
168 /** depending on the interface we use, define the port macros
198 #define inb_data(fd) sanei_inb(port[fd].base)
199 #define inb_stat(fd) sanei_inb(port[fd].base + 1)
200 #define inb_ctrl(fd) sanei_inb(port[fd].base + 2)
201 #define inb_eppdata(fd) sanei_inb(port[fd].base + 4)
203 #define outb_data(fd,val) sanei_outb(port[fd].base, val)
204 #define outb_stat(fd,val) sanei_outb(port[fd].base + 1, val)
205 #define outb_ctrl(fd,val) sanei_outb(port[fd].base + 2, val)
206 #define outb_addr(fd,val) sanei_outb(port[fd].base + 3, val)
207 #define outb_eppdata(fd,val) sanei_outb(port[fd].base + 4, val)
214 #define inbyte400(fd) sanei_inb(port[fd].base + 0x400)
215 #define inbyte402(fd) sanei_inb(port[fd].base + 0x402)
216 #define outbyte400(fd,val) sanei_outb(port[fd].base + 0x400, val)
217 #define outbyte402(fd,val) sanei_outb(port[fd].base + 0x402, val)
251 return "Error initializing port";
260 return "Invalid port";
314 /** probe the parallel port
326 DBG( 4, "pp_probe: port 0x%04lx\n", port[fd].base );
338 DBG( 4, "pp_probe: SPP port present\n" );
393 /* check for PS/2 compatible port */
405 DBG( 4, "pp_probe: PS/2 bidirectional port present\n");
410 if( port[fd].base & 0x007 ) {
545 /** set the parallel port mode
552 if( 0 == (mode & port[fd].caps)) {
679 DBG( 6, "pp_init: port %d is `%s`\n", i, pplist.portv[i]->name);
690 memset( port, 0, sizeof(port));
728 DBG( 5, "pp_open: reading port number\n" );
733 DBG( 1, "pp_open: `%s` is not a valid port number\n", dev);
740 DBG( 6, "pp_open: read port number 0x%03lx\n", base );
749 DBG( 5, "pp_open: looking up port in list\n" );
766 for( i = 0; i < NELEMS(port); i++ ) {
767 if( port[i].base == base )
771 if (NELEMS (port) <= i) {
780 DBG( 6, "pp_open: port is in list at port[%d]\n", i);
782 if( port[i].in_use == SANE_TRUE) {
787 DBG( 1, "pp_open: port 0x%03lx is already in use\n", base );
793 port[i].in_use = SANE_TRUE;
794 port[i].claimed = SANE_FALSE;
799 result = ieee1284_open( pplist.portv[i], 0, &port[i].caps );
803 port[i].in_use = SANE_FALSE;
814 if( sanei_ioperm( port[i].base, 5, 1 )) {
815 DBG( 1, "pp_open: cannot get io privilege for port 0x%03lx\n",
816 port[i].base);
818 port[i].in_use = SANE_FALSE;
826 port[i].ecp_ctrl = inbyte402(i);
827 port[i].ctrl = inb_ctrl(i);
830 /* check the capabilities of this port */
831 port[i].caps = pp_probe( i );
834 port[i].caps = pp_showcaps( port[i].caps );
849 DBG( 6, "pp_close: this is port '%s'\n", pplist.portv[fd]->name );
851 DBG( 6, "pp_close: this is port 0x%03lx\n", port[fd].base );
853 outb_ctrl( fd, port[fd].ctrl );
855 outbyte402( fd, port[fd].ecp_ctrl );
859 if( port[fd].claimed == SANE_TRUE ) {
863 DBG( 5, "pp_close: trying to free io port\n" );
867 if( sanei_ioperm( port[fd].base, 5, 0 )) {
870 DBG( 1, "pp_close: can't free port '%s' (%s)\n",
873 DBG( 1, "pp_close: can't free port 0x%03lx\n", port[fd].base );
879 DBG( 5, "pp_close: marking port as unused\n" );
880 port[fd].in_use = SANE_FALSE;
932 if((fd < 0) || (fd >= NELEMS (port))) {
938 if( port[fd].in_use == SANE_FALSE ) {
940 DBG( 2, "sanei_pp_close: port is not in use\n" );
942 DBG( 6, "sanei_pp_close: port is '%s'\n", pplist.portv[fd]->name );
944 DBG( 6, "sanei_pp_close: port is 0x%03lx\n", port[fd].base );
979 port[fd].claimed = SANE_TRUE;
997 port[fd].claimed = SANE_FALSE;
1011 if ((fd < 0) || (fd >= NELEMS (port))) {
1030 if ((fd < 0) || (fd >= NELEMS (port))) {
1049 if ((fd < 0) || (fd >= NELEMS (port))) {
1068 if ((fd < 0) || (fd >= NELEMS (port))) {
1087 if ((fd < 0) || (fd >= NELEMS (port))) {
1105 if ((fd < 0) || (fd >= NELEMS (port))) {
1122 if ((fd < 0) || (fd >= NELEMS (port))) {
1140 if ((fd < 0) || (fd >= NELEMS (port))) {
1155 if ((fd < 0) || (fd >= NELEMS (port))) {
1162 *mode = port[fd].caps;
1175 if ((fd < 0) || (fd >= NELEMS (port))) {
1201 /* negotiation might fails, but the port-mode should be set... */
1244 if ((fd < 0) || (fd >= NELEMS (port))) {