OR1K support
|
Typedefs | |
typedef void(* | or1k_interrupt_handler_fptr )(void *data) |
Functions | |
void | or1k_interrupt_handler_add (uint32_t line, or1k_interrupt_handler_fptr handler, void *data) |
void | or1k_interrupt_enable (int line) |
void | or1k_interrupt_disable (int line) |
uint32_t | or1k_interrupts_disable (void) |
void | or1k_interrupts_enable (void) |
void | or1k_interrupts_restore (uint32_t status) |
uint32_t | or1k_critical_start () |
void | or1k_critical_end (uint32_t restore) |
Interrupt control function prototypes
typedef void(* or1k_interrupt_handler_fptr)(void *data) |
Function pointer to interrupt handler functions
void or1k_critical_end | ( | uint32_t | restore | ) |
Enable timer and interrupt exception
Restore the timer and interrupt exception enable. The restore value is the return value from or1k_critical_start().
restore | Interrupt and timer exception enable restore value |
uint32_t or1k_critical_start | ( | ) |
Disable timer and interrupt exception
This function disables the timer and interrupt exception to guard critical sections. It returns the status of the enable bits before the critical section, that is restored with or1k_critical_end().
Example:
void or1k_interrupt_disable | ( | int | line | ) |
Disable interrupts from a given line
Mask given interrupt line. It can be unmasked using or1k_interrupt_enable().
line | Interrupt line to disable |
void or1k_interrupt_enable | ( | int | line | ) |
Enable interrupts from a given line
Unmask the given interrupt line. It is also important to enable interrupts in general, e.g., using or1k_interrupts_enable().
line | Interrupt line to enable |
void or1k_interrupt_handler_add | ( | uint32_t | line, |
or1k_interrupt_handler_fptr | handler, | ||
void * | data | ||
) |
Add interrupt handler for interrupt line
Registers a callback function for a certain interrupt line.
line | Interrupt line/id to register a handler for |
handler | Handler to register |
data | Data value passed to the handler |
uint32_t or1k_interrupts_disable | ( | void | ) |
Disable interrupts
This disables the interrupt exception. This is sufficient to disable all interrupts. It does not change the mask register (which is modified using or1k_interrupt_enable() and or1k_interrupt_disable()).
The interrupt exception can be enabled using or1k_interrupts_enable().
Finally, the status of the interrupt exception enable flag is returned by this function. That allows to call this function even if interrupts are already disabled. To restore the value of the interrupt exception enable flag, use the or1k_interrupts_restore() function. That way you avoid to accidentally enable interrupts. Example:
This code will preserve the original status of the interrupt enable flag.
void or1k_interrupts_enable | ( | void | ) |
Enable interrupt exception
Enable the interrupt exception. Beside the interrupt exception, it is also necessary to enable the individual interrupt lines using or1k_interrupt_enable().
You should avoid using this function together with or1k_interrupts_disable() to guard atomic blocks as it unconditionally enables the interrupt exception (see documentation of or1k_interrupts_disable()).
void or1k_interrupts_restore | ( | uint32_t | status | ) |
Restore interrupt exception enable flag
This function restores the given status to the processor. or1k_interrupts_restore(0) is identical to or1k_interrupts_disable() and or1k_interrupts_restore(SPR_SR_IEE) is identical to or1k_interrupts_enable().
It is for example used to guard an atomic block and restore the original status of the interrupt exception enable flag as returned by or1k_interrupts_disable(). See the documentation of or1k_interrupts_disable() for a usage example.
status | Status of the flag to restore |