pkgsrc/audio/rio/patches/patch-ab
agc 1e43bb2f84 Make this program work.
+ add -li386, and a check to make sure that root is running the program
  (for obvious reasons)
+ add a small shell script to find the lpt port easily

Initialisation of flash RAM on the rio is slow, but upload works quite
well and fast. Not yet tested with external flash media.
2000-01-11 11:31:18 +00:00

98 lines
3.1 KiB
Text

$NetBSD: patch-ab,v 1.3 2000/01/11 11:31:19 agc Exp $
Add NetBSD and Solaris platforms
Add inb() and outb() from XFree86 sources.
--- rio.cpp 1999/12/17 17:42:31 1.1
+++ rio.cpp 1999/12/17 17:44:25
+++ rio.cpp Fri Jan 7 12:43:45 2000
@@ -109,9 +109,89 @@
#define CLOCK_SECOND ((int)CLOCKS_PER_SEC)
#define DELETEARRAY delete
+#elif defined(__NetBSD__)
+ // NetBSD/i386 g++
+ #include <fcntl.h>
+ #include <unistd.h>
+ #include <machine/sysarch.h>
+ #include <machine/cpufunc.h>
+ #define OUTPORT(p,v) outb( p, v )
+ #define INPORT(p) inb( p )
+ #define CLOCK_SECOND CLOCKS_PER_SEC
+ #define DELETEARRAY delete[]
+
+#elif defined(__sun__) && defined(__svr4__)
+ // Solaris/i386 g++
+ #include <fcntl.h>
+ #include <unistd.h>
+ #include <sys/cpupart.h>
+ #include <sys/cpuvar.h>
+ #include <sys/ddi.h>
+ #include <sys/sunddi.h>
+ #define OUTPORT(p,v) outb( p, v )
+ #define INPORT(p) inb( p )
+ #define CLOCK_SECOND CLOCKS_PER_SEC
+ #define DELETEARRAY delete[]
+
#else
// not supported
#error ! ! compiler/platform not supported ! !
+#endif
+
+#if defined(__NetBSD__)
+/* copied from the XFree86 sources */
+/* xc/programs/Xserver/hw/xfree86/common/compiler.h */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.24.2.4 1998/10/18 20:42:10 hohndel Exp $ */
+/*
+ * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Thomas Roell not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Thomas Roell makes no representations
+ * about the suitability of this software for any purpose. It is provided
+ * "as is" without express or implied warranty.
+ *
+ * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+/* $XConsortium: compiler.h /main/16 1996/10/25 15:38:34 kaleb $ */
+/* also hacked by agc to do i386_iopl */
+static int ports_enabled;
+
+static __inline__ unsigned int
+inb(unsigned short int port)
+{
+ unsigned char ret;
+
+ if (!ports_enabled) {
+ i386_iopl(1);
+ ports_enabled = 1;
+ }
+ __asm__ __volatile__("inb %1,%0" :
+ "=a" (ret) :
+ "d" (port));
+ return ret;
+}
+
+static __inline__ void
+outb(unsigned short int port, unsigned char val)
+{
+ if (!ports_enabled) {
+ i386_iopl(1);
+ ports_enabled = 1;
+ }
+ __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port));
+}
#endif
// port offset constants