diff options
author | Simon Howard | 2009-03-10 22:19:29 +0000 |
---|---|---|
committer | Simon Howard | 2009-03-10 22:19:29 +0000 |
commit | c423d770e9a05e762a2382e342ddd0bb7e6f3996 (patch) | |
tree | 2cf7e6148c8951766aad6ad84f119ce55db3cb35 | |
parent | 02e3e618472e4afa9a58950a9853aa0356b59504 (diff) | |
download | chocolate-doom-c423d770e9a05e762a2382e342ddd0bb7e6f3996.tar.gz chocolate-doom-c423d770e9a05e762a2382e342ddd0bb7e6f3996.tar.bz2 chocolate-doom-c423d770e9a05e762a2382e342ddd0bb7e6f3996.zip |
Fix outb() call, display error message if unable to gain port
permissions.
Subversion-branch: /branches/opl-branch
Subversion-revision: 1460
-rw-r--r-- | opl/opl_linux.c | 9 |
1 files changed, 7 insertions, 2 deletions
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 <stdio.h> +#include <string.h> +#include <errno.h> #include <unistd.h> #include <sys/io.h> @@ -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 = |