diff options
author | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-01-14 01:56:59 +0000 |
---|---|---|
committer | Miguel Freitas <miguelfreitas@users.sourceforge.net> | 2003-01-14 01:56:59 +0000 |
commit | 8cbefe95bd4c6e1e715af0f9667c0c2d3d1f9eff (patch) | |
tree | 29791509737b2f36e45d1686d73d6272b7a67f59 /src/video_out/libdha/irq.c | |
parent | 74641d0374d17b28fb4636f890bd62e43c9a603c (diff) | |
download | xine-lib-8cbefe95bd4c6e1e715af0f9667c0c2d3d1f9eff.tar.gz xine-lib-8cbefe95bd4c6e1e715af0f9667c0c2d3d1f9eff.tar.bz2 |
ops, missing files
CVS patchset: 3910
CVS date: 2003/01/14 01:56:59
Diffstat (limited to 'src/video_out/libdha/irq.c')
-rw-r--r-- | src/video_out/libdha/irq.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/video_out/libdha/irq.c b/src/video_out/libdha/irq.c new file mode 100644 index 000000000..6ac852857 --- /dev/null +++ b/src/video_out/libdha/irq.c @@ -0,0 +1,62 @@ +/* HW IRQ support */ +#include <stdio.h> +#include <sys/ioctl.h> +#include <sys/mman.h> /* mlock */ +#include <pthread.h> +#include <errno.h> +#include <unistd.h> +#include <fcntl.h> +#include "libdha.h" +#include "kernelhelper/dhahelper.h" + + +static int libdha_fd=-1; +static int hwirq_locks=0; + +int hwirq_install(int bus, int dev, int func, + int ar, u_long ao, uint32_t ad) +{ + int retval; + if( libdha_fd == -1) libdha_fd = open("/dev/dhahelper",O_RDWR); + hwirq_locks++; + if (libdha_fd > 0) + { + dhahelper_irq_t _irq; + _irq.bus = bus; + _irq.dev = dev; + _irq.func = func; + _irq.ack_region = ar; + _irq.ack_offset = ao; + _irq.ack_data = ad; + retval = ioctl(libdha_fd, DHAHELPER_INSTALL_IRQ, &_irq); + return retval; + } + return errno; +} + +int hwirq_wait(unsigned irqnum) +{ + int retval; + if (libdha_fd > 0) + { + dhahelper_irq_t _irq; + _irq.num = irqnum; + retval = ioctl(libdha_fd, DHAHELPER_ACK_IRQ, &_irq); + return retval; + } + return EINVAL; +} + +int hwirq_uninstall(int bus, int dev, int func) +{ + if (libdha_fd > 0) + { + dhahelper_irq_t _irq; + _irq.bus = bus; + _irq.dev = dev; + _irq.func = func; + ioctl(libdha_fd, DHAHELPER_FREE_IRQ, &_irq); + } + if(!hwirq_locks) { close(libdha_fd); libdha_fd=-1; } + return 0; +} |