diff options
author | Damien Zammit <damien@zamaudio.com> | 2024-03-26 04:59:09 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2024-03-26 19:47:46 +0100 |
commit | 19b16e8e8c730fe7383db5fdea82500070ceda56 (patch) | |
tree | 8ad4656bb2ead74ebd5d7c16d8065124dc64c73e /libirqhelp/irqhelp.h | |
parent | 9f803eacded5409e66f1fd77f5425f4911f2ed8e (diff) | |
download | hurd-19b16e8e8c730fe7383db5fdea82500070ceda56.tar.gz hurd-19b16e8e8c730fe7383db5fdea82500070ceda56.tar.bz2 hurd-19b16e8e8c730fe7383db5fdea82500070ceda56.zip |
libirqhelp: Add library
Add a helper library for attaching interrupt handlers in userspace.
Message-ID: <20240326045846.1661099-2-damien@zamaudio.com>
Diffstat (limited to 'libirqhelp/irqhelp.h')
-rw-r--r-- | libirqhelp/irqhelp.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/libirqhelp/irqhelp.h b/libirqhelp/irqhelp.h new file mode 100644 index 00000000..4ebbed8b --- /dev/null +++ b/libirqhelp/irqhelp.h @@ -0,0 +1,49 @@ +/* Library providing helper functions for userspace irq handling. + Copyright (C) 2022 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or (at + your option) any later version. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#ifndef _HURD_IRQHELP_ +#define _HURD_IRQHELP_ + +#include <mach.h> +#include <hurd/hurd_types.h> +#include <pthread.h> +#include <stdlib.h> + +struct irq; + +/* Call once before using other functions */ +error_t irqhelp_init(void); + +/* Accepts gsi or bus/dev/fun or both, but cant be all -1. + If gsi is -1, will lookup the gsi via ACPI. + If bus/dev/fun are -1, must pass in gsi. + Returns a pointer to be used with other functions. */ +struct irq * irqhelp_install_interrupt_handler(int gsi, int bus, int dev, int fun, + void (*handler)(void *), void *context); +/* Install as pthread */ +void * irqhelp_server_loop(void *arg); + +/* Enable an irq */ +void irqhelp_enable_irq(struct irq *irq); + +/* Disable an irq */ +void irqhelp_disable_irq(struct irq *irq); + +/* Call to deregister a handler */ +error_t irqhelp_remove_interrupt_handler(struct irq *irq); + +#endif |