From c423d770e9a05e762a2382e342ddd0bb7e6f3996 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Tue, 10 Mar 2009 22:19:29 +0000 Subject: Fix outb() call, display error message if unable to gain port permissions. Subversion-branch: /branches/opl-branch Subversion-revision: 1460 --- opl/opl_linux.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'opl') diff --git a/opl/opl_linux.c b/opl/opl_linux.c index 438b091a..d1d1e466 100644 --- a/opl/opl_linux.c +++ b/opl/opl_linux.c @@ -27,6 +27,9 @@ #ifdef HAVE_IOPERM +#include +#include +#include #include #include @@ -35,12 +38,14 @@ static unsigned int opl_port_base; -static void OPL_Linux_Init(unsigned int port_base) +static int OPL_Linux_Init(unsigned int port_base) { // Try to get permissions: if (ioperm(port_base, 2, 1) < 0) { + fprintf(stderr, "Failed to get I/O port permissions for 0x%x: %s\n", + port_base, strerror(errno)); return 0; } @@ -63,7 +68,7 @@ static unsigned int OPL_Linux_PortRead(opl_port_t port) static void OPL_Linux_PortWrite(opl_port_t port, unsigned int value) { - outb(opl_port_base + port, value); + outb(value, opl_port_base + port); } opl_driver_t opl_linux_driver = -- cgit v1.2.3