PatchworkOS  da8a090
A non-POSIX operating system.
Loading...
Searching...
No Matches
irq.h File Reference
#include <kernel/cpu/interrupt.h>
#include <kernel/sync/rwlock.h>
#include <stdbool.h>
#include <stdint.h>
#include <sys/list.h>
Include dependency graph for irq.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  irq_func_data_t
 Data passed to IRQ functions. More...
 
struct  irq_handler_t
 Structure to hold an IRQ function and its data. More...
 
struct  irq_t
 IRQ structure. More...
 
struct  irq_domain_t
 IRQ domain structure. More...
 
struct  irq_chip_t
 IRQ chip structure. More...
 

Macros

#define IRQ_PHYS_NONE   UINT32_MAX
 Constant representing no physical IRQ.
 
#define IRQ_INVOKE(virt)   asm volatile("int %0" : : "i"(virt));
 Invoke the given virtual IRQ.
 

Typedefs

typedef struct cpu cpu_t
 
typedef struct irq_chip irq_chip_t
 
typedef struct irq_domain irq_domain_t
 
typedef struct irq irq_t
 
typedef uint32_t irq_phys_t
 Physical IRQ numbers.
 
typedef uint8_t irq_virt_t
 Virtual IRQ numbers.
 
typedef void(* irq_func_t) (irq_func_data_t *data)
 Callback function type for IRQs.
 

Enumerations

enum  irq_flags_t {
  IRQ_POLARITY_HIGH = 0 << 0 , IRQ_POLARITY_LOW = 1 << 0 , IRQ_TRIGGER_LEVEL = 0 << 1 , IRQ_TRIGGER_EDGE = 1 << 1 ,
  IRQ_EXCLUSIVE = 0 << 2 , IRQ_SHARED = 1 << 2
}
 IRQ flags. More...
 

Functions

void irq_init (void)
 Initialize the IRQ subsystem.
 
void irq_dispatch (interrupt_frame_t *frame, cpu_t *self)
 Dispatch an IRQ.
 
uint64_t irq_virt_alloc (irq_virt_t *out, irq_phys_t phys, irq_flags_t flags, cpu_t *cpu)
 Allocate a virtual IRQ mapped to the given physical IRQ.
 
void irq_virt_free (irq_virt_t virt)
 Free a previously allocated virtual IRQ.
 
uint64_t irq_virt_set_affinity (irq_virt_t virt, cpu_t *cpu)
 Change the CPU responsible for an IRQ.
 
uint64_t irq_chip_register (irq_chip_t *chip, irq_phys_t start, irq_phys_t end, void *private)
 Register an IRQ chip for a range of physical IRQs.
 
void irq_chip_unregister (irq_chip_t *chip, irq_phys_t start, irq_phys_t end)
 Unregister all instances of the given IRQ chip within the specified range.
 
uint64_t irq_chip_amount (void)
 Get the number of registered IRQ chips.
 
uint64_t irq_handler_register (irq_virt_t virt, irq_func_t func, void *private)
 Register an IRQ handler for a virtual IRQ.
 
void irq_handler_unregister (irq_func_t func, irq_virt_t virt)
 Unregister an IRQ handler.
 

Typedef Documentation

◆ cpu_t

typedef struct cpu cpu_t

Definition at line 10 of file irq.h.

◆ irq_chip_t

typedef struct irq_chip irq_chip_t

Definition at line 12 of file irq.h.

◆ irq_domain_t

typedef struct irq_domain irq_domain_t

Definition at line 13 of file irq.h.

◆ irq_t

typedef struct irq irq_t

Definition at line 14 of file irq.h.