diff options
author | Simon Howard | 2009-05-30 23:24:11 +0000 |
---|---|---|
committer | Simon Howard | 2009-05-30 23:24:11 +0000 |
commit | 98ee23f4268dbb1395aa0b2cbfad9f53d1092b33 (patch) | |
tree | 1d454e6a78ddccdb629aabad3f647c9242a628b0 /opl/opl_linux.c | |
parent | 6e4f6ab9626d81e4106d3ccc974a76d832fdff13 (diff) | |
download | chocolate-doom-98ee23f4268dbb1395aa0b2cbfad9f53d1092b33.tar.gz chocolate-doom-98ee23f4268dbb1395aa0b2cbfad9f53d1092b33.tar.bz2 chocolate-doom-98ee23f4268dbb1395aa0b2cbfad9f53d1092b33.zip |
Add initial callback/timer API.
Subversion-branch: /branches/opl-branch
Subversion-revision: 1538
Diffstat (limited to 'opl/opl_linux.c')
-rw-r--r-- | opl/opl_linux.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/opl/opl_linux.c b/opl/opl_linux.c index d1d1e466..4a10337f 100644 --- a/opl/opl_linux.c +++ b/opl/opl_linux.c @@ -35,6 +35,7 @@ #include "opl.h" #include "opl_internal.h" +#include "opl_timer.h" static unsigned int opl_port_base; @@ -51,11 +52,23 @@ static int OPL_Linux_Init(unsigned int port_base) opl_port_base = port_base; + // Start callback thread + + if (!OPL_Timer_StartThread()) + { + ioperm(port_base, 2, 0); + return 0; + } + return 1; } static void OPL_Linux_Shutdown(void) { + // Stop callback thread + + OPL_Timer_StopThread(); + // Release permissions ioperm(opl_port_base, 2, 0); @@ -77,7 +90,10 @@ opl_driver_t opl_linux_driver = OPL_Linux_Init, OPL_Linux_Shutdown, OPL_Linux_PortRead, - OPL_Linux_PortWrite + OPL_Linux_PortWrite, + OPL_Timer_SetCallback, + OPL_Timer_Lock, + OPL_Timer_Unlock }; #endif /* #ifdef HAVE_IOPERM */ |