My Kernel v0.1.0
Collaboration diagram for Interrputs:

Modules

 Interrupts - x86 specific
 

Data Structures

struct  interrupt_vector
 A single hardware IRQ vector. More...
 

Macros

#define INTERRUPT_HANDLER(_interrupt)   _interrupt##_handler
 Compute the interrupt's handler's name.
 
#define INTERRUPT_HANDLER_FUNCTION(_interrupt)    interrupt_return_t INTERRUPT_HANDLER(_interrupt)(void *data)
 Define an interrupt handler function for a given interrupt You must always use this function when defining an interrupt handler.
 
#define interrupts_disabled_scope()
 Define a scope inside which irqs are disabled on the current CPU. More...
 

Typedefs

typedef enum interrupt_return interrupt_return_t
 Values returned by an interrupt handler.
 
typedef struct interrupt_frame interrupt_frame
 Frame passed onto the interrupt handlers when triggering an interrupt. More...
 
typedef interrupt_return_t(* interrupt_handler_func_t) (void *)
 Function pointer to an interrupt handler.
 

Enumerations

enum  interrupt_return { INTERRUPT_HANDLED , INTERRUPT_IGNORED }
 Values returned by an interrupt handler. More...
 

Functions

error_t interrupts_install_handler (unsigned int irq, interrupt_handler_func_t, void *)
 Dynamically set an interrupt handler. More...
 
error_t interrupts_install_static_handler (unsigned int nr, struct interrupt_handler *)
 Install a pre-configured interrupt handler. More...
 
interrupt_handler_func_t interrupts_get_handler (unsigned int irq, void **)
 Retreive the current handler for a given IRQ. More...
 
static void interrupts_disable (void)
 Disable interrupts on the current CPU.
 
static void interrupts_enable (void)
 Enable interrupts on the current CPU.
 
static void interrupts_restore (bool enabled)
 Restore the previous interrupt state. More...
 

Detailed Description

Interrupts

Here are defined the interfaces used to setup and control interrupts.

As interrupts are an architecure-dependent mechanism, the actual definitions for the strucutre are present inside the 'arch' folder. This file only serves as a common entry point for arch-generic code that would need to interact with interrupts.

Warning
You should never include the arch specific headers directly

Macro Definition Documentation

◆ interrupts_disabled_scope

#define interrupts_disabled_scope ( )
Value:
for (scope_irq_off_t guard CLEANUP(scope_irq_off_destructor) = \
scope_irq_off_constructor(); \
!guard.done; guard.done = true)

WARNING: As this macro uses a for loop to function, any 'break' directive placed inside it will break out of the guarded scope instead of that of its containing loop.

Typedef Documentation

◆ interrupt_frame

Note
This is a only a forward declaration. The actual definition is done inside the arch-specific header.

Enumeration Type Documentation

◆ interrupt_return

Enumerator
INTERRUPT_HANDLED 

Interrupt was handled by the handler.

INTERRUPT_IGNORED 

Interrupt was for another handler.

Function Documentation

◆ interrupts_get_handler()

interrupt_handler_func_t interrupts_get_handler ( unsigned int  irq,
void **  pdata 
)
Parameters
irqThe interrupt number
[out]pdataIf not NULL, the handler's associated data is stored inside this pointer (optional)
Note
In the case of shared interrupts this function always returns the first installed handler.
Returns
The current handler function fo the IRQ

◆ interrupts_install_handler()

error_t interrupts_install_handler ( unsigned int  irq,
interrupt_handler_func_t  handler,
void *  data 
)
Parameters
irqThe IRQ number to associate the handler with
handlerThe handler function called when the interrupt occurs
dataData passed to the interrupt handler

◆ interrupts_install_static_handler()

error_t interrupts_install_static_handler ( unsigned int  nr,
struct interrupt_handler *  handler 
)

This function must be used only when configuring an interrupt handler at before the virtual memory subsystem is initialized (INIT_BOOTSTRAP).

The interrupt_handler strcuture is initialized and provided by the caller.

◆ interrupts_restore()

static void interrupts_restore ( bool  enabled)
inlinestatic
Parameters
enabledThe previous interrupt state (on/off).