enable flashing via the parallel port on i386; bump PKGNAME

from Claus Kestel with help from sturm@
This commit is contained in:
martin 2008-10-12 08:29:39 +00:00
parent 9ff5af73e3
commit 3c0c796159
2 changed files with 44 additions and 1 deletions

View File

@ -1,8 +1,9 @@
# $OpenBSD: Makefile,v 1.3 2007/09/16 02:53:14 merdely Exp $
# $OpenBSD: Makefile,v 1.4 2008/10/12 08:29:39 martin Exp $
COMMENT= AVR microcontroller hardware in-system programmer
DISTNAME= uisp-20050207
PKGNAME= ${DISTNAME}p0
CATEGORIES= devel
HOMEPAGE= http://www.nongnu.org/uisp/
@ -19,6 +20,9 @@ WANTLIB= c m stdc++
MASTER_SITES= http://savannah.nongnu.org/download/uisp/
CONFIGURE_STYLE= gnu
.if ${MACHINE_ARCH} == "i386"
CONFIGURE_ENV= LIBS="-li386"
.endif
MAKE_FLAGS= CXX="${CXX} ${CXXFLAGS}"
.include <bsd.port.mk>

View File

@ -0,0 +1,39 @@
$OpenBSD: patch-src_DAPA_C,v 1.1 2008/10/12 08:29:39 martin Exp $
--- src/DAPA.C.orig Tue Dec 28 15:39:38 2004
+++ src/DAPA.C Sun Jun 8 18:04:35 2008
@@ -84,6 +84,35 @@
#define ioport_enable(port, num) i386_set_ioperm(port, num, 1)
#define ioport_disable(port, num) i386_set_ioperm(port, num, 0)
+#elif defined(__OpenBSD__) && defined(__i386__)
+
+#include <sys/types.h>
+#include <machine/sysarch.h>
+#include <i386/pio.h>
+
+#define IOPAGES 32
+
+#define ioport_read(port) inb(port)
+#define ioport_write(port, val) outb(port, val)
+#define ioport_enable(port, num) set_ioperm_obsd(port, num, 1)
+#define ioport_disable(port, num) set_ioperm_obsd(port, num, 0)
+
+int
+set_ioperm_obsd(int parport_port, int num, int flag)
+{
+ int i=0;
+ u_long iopermtable[IOPAGES] = {};
+
+ /* get current i/o permission table */
+ i386_get_ioperm(iopermtable);
+
+ /* request access to desired i/o port */
+ for (i=0; i<num; i++)
+ iopermtable[parport_port / IOPAGES] &= ~(flag << parport_port % IOPAGES + i);
+
+ return i386_set_ioperm(iopermtable);
+}
+
#else
/* Direct I/O port access not supported - ppdev/ppi kernel driver