IRQ Handling

Provides an API to control interrupt processing. More...

Detailed Description

Provides an API to control interrupt processing.

Files

file  irq.h
 IRQ driver interface.
 

Functions

MAYBE_INLINE unsigned irq_disable (void)
 This function sets the IRQ disable bit in the status register. More...
 
MAYBE_INLINE unsigned irq_enable (void)
 This function clears the IRQ disable bit in the status register. More...
 
MAYBE_INLINE void irq_restore (unsigned state)
 This function restores the IRQ disable bit in the status register to the value contained within passed state. More...
 
MAYBE_INLINE bool irq_is_enabled (void)
 Test if IRQs are currently enabled. More...
 
MAYBE_INLINE bool irq_is_in (void)
 Check whether called from interrupt service routine. More...
 

Function Documentation

◆ irq_disable()

MAYBE_INLINE unsigned irq_disable ( void  )

This function sets the IRQ disable bit in the status register.

Returns
Previous value of status register. The return value should not be interpreted as a boolean value. The actual value is only significant for irq_restore().
See also
irq_restore

◆ irq_enable()

MAYBE_INLINE unsigned irq_enable ( void  )

This function clears the IRQ disable bit in the status register.

Returns
Previous value of status register. The return value should not be interpreted as a boolean value. The actual value is only significant for irq_restore().
Warning
This function is here primarily for internal use, and for compatibility with the Arduino environment (which lacks the "disable / restore" concept. Enabling interrupts when a different component disabled them can easily cause unintended behavior there.

Use irq_restore instead.

◆ irq_is_enabled()

MAYBE_INLINE bool irq_is_enabled ( void  )

Test if IRQs are currently enabled.

Warning
Use this function from thread context only. When used in interrupt context the returned state may be incorrect.
Returns
false if IRQs are currently disabled
true if IRQs are currently enabled

◆ irq_is_in()

MAYBE_INLINE bool irq_is_in ( void  )

Check whether called from interrupt service routine.

Returns
true, if in interrupt service routine, false if not

◆ irq_restore()

MAYBE_INLINE void irq_restore ( unsigned  state)

This function restores the IRQ disable bit in the status register to the value contained within passed state.

Parameters
[in]statestate to restore
See also
irq_disable