summaryrefslogtreecommitdiff
path: root/audio/rio/files/patch-ab
blob: 9947818f612701f203744b40794d865038c833a7 (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
44
45
46
47
48
49
*** rio.cpp.orig	Mon Mar 15 06:53:16 1999
--- rio.cpp	Fri Feb 18 11:02:11 2000
***************
*** 53,58 ****
--- 53,78 ----
  	#define		CLOCK_SECOND			1000
  	#define		DELETEARRAY				delete[]
  
+ #elif defined(__FreeBSD__)
+ 	// FreeBSD g++
+ 	// (anybody know if this stuff applies more generally to other BSDs?)
+ 	#include	<fcntl.h>
+ 	#include	<unistd.h>
+	#define		ffs _ffs_hack
+ 	#include	<machine/cpufunc.h>
+	#undef		ffs
+ 	#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[]
+ 
  #elif defined(__linux__)
  	// linux g++
  	#include	<unistd.h>
***************
*** 201,206 ****
--- 219,233 ----
  	m_iPortData = m_iPortBase + OFFSET_PORT_DATA;
  	m_iPortStatus = m_iPortBase + OFFSET_PORT_STATUS;
  	m_iPortControl = m_iPortBase + OFFSET_PORT_CONTROL;
+ 
+ 	// if FreeBSD
+ 	#if defined(__FreeBSD__)
+ 		// Request direct access to memory addresses
+ 		if (open("/dev/io", O_RDONLY) < 0) {
+ 			LogError( CRIO_ERROR_IOPRERM, "open(/dev/io) failed, reason '%s'", SZERROR );
+ 			return FALSE;
+ 		}
+ 	#endif
  
  	// if linux
  	#if defined(__linux__)