summaryrefslogtreecommitdiff
path: root/audio/mpmf20/files/patch-ab
blob: 8a6ff737e0b661bad35dd58f7e93962ac64b5652 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
--- mpmf20.cpp.orig	Mon Apr 12 08:49:40 1999
+++ mpmf20.cpp	Fri Feb 18 10:55:01 2000
@@ -23,6 +23,24 @@
 	#define		DELETEARRAY				delete[]
 	#define		STRICMP					stricmp
 
+#elif defined(__FreeBSD__)
+	// FreeBSD g++
+	#include	<fcntl.h>
+	#include	<unistd.h>
+	#include	<machine/cpufunc.h>
+	#if defined(__alpha__)
+		#include <sys/types.h>
+		extern "C" {
+			u_int8_t inb(u_int32_t);
+			void outb(u_int32_t, u_int8_t);
+		}
+	#endif
+	#define		OUTPORT(p,v)			outb( (p), (v) )
+	#define		INPORT(p)				inb( p )
+	#define		CLOCK_SECOND			CLOCKS_PER_SEC
+	#define		DELETEARRAY				delete[]
+	#define		STRICMP					strcasecmp
+
 #elif defined(__linux__)
 	// linux g++
 	#include	<unistd.h>
@@ -237,6 +255,15 @@
 	// init error
 	m_szError[ 0 ] = 0;
 	m_iIDError = CMPMF20_ERROR_NONE;
+
+	// if FreeBSD
+	#if defined(__FreeBSD__)
+		// request access to required ports
+		if (open("/dev/io", O_RDONLY) < 0) {
+			LogError( CMPMF20_ERROR_IOPRERM, "open(\"/dev/io\") failed, reason '%s'", SZERROR );
+			return FALSE;
+		}
+	#endif
 
 	// if linux
 	#if defined(__linux__)