Skip to contentSkip to navigationSkip to topbar
On this page

Interrupt Functions


(warning)

Microvisor Public Beta

Microvisor is in a pre-release phase and the information contained in this document is subject to change. Some features referenced below may not be fully available until Microvisor's General Availability (GA) release.

The Microvisor system calls currently include the following functions for managing non-secure interrupt latency modes:

A 'fast' interrupt is one that Microvisor permits to pre-empt secure threads. This reduces latency, typically to under 20µs, but at a cost. See below for more information.


Return values and errors

return-values-and-errors page anchor

All of the functions described below return a 32-bit integer that is one of the values from the standard Microvisor enumeration MvStatus. All possible error values for a given system call are provided with each function's description.

Success is always signaled by a return value of zero (MV_STATUS_OKAY).


mvSetFastInterrupt()

mvsetfastinterrupt page anchor

Mark an interrupt to be served with low latency

Declaration

declaration page anchor
extern enum MvStatus mvSetFastInterrupt(uint32_t irqn);
ParameterDescription
irqnThe number of the IRQ to be served with low latency
Error ValueDescription
MV_STATUS_INVALIDINTERRUPTirqn is not available to non-secure code
MV_STATUS_INVALIDVECTORVTOR or interrupt vector is not in non-secure memory
MV_STATUS_UNAVAILABLEFast interrupts are unavailable — code is being shut down after a hung interrupt or interrupt flood

Use mvSetFastInterrupt() to allow the specified interrupt to pre-empt secure threads in order to reduce latency, typically to less than 20µs.

This call only allows the interrupt to take place in low-latency mode — you must call mvEnableFastInterrupt() or mvEnableAllFastInterrupts() to be begin using it.

(error)

Danger

You may be tempted to switch all of your application's interrupts into low-latency mode, but switching any single interrupt comes at a cost: while it is in low-latency mode, its interrupt service routine (ISR) will not be able to perform a non-local return, such as an RTOS context switch. If your application is written in C, the ISR must be a regular function that returns early via return, or automatically at the end of the function. An ISR written in assembly must end in the usual way by branching to a value stored in the ARM Link Register on entry.


mvClearFastInterrupt()

mvclearfastinterrupt page anchor

Move an interrupt out of low-latency mode

extern enum MvStatus mvClearFastInterrupt(uint32_t irqn);
ParameterDescription
irqnThe number of the IRQ to be removed from low-latency mode
Error ValueDescription
MV_STATUS_INVALIDINTERRUPTirqn is not available to non-secure code
MV_STATUS_UNAVAILABLEFast interrupts are unavailable — code is being shut down after a hung interrupt or interrupt flood

Calling mvClearFastInterrupt() will bring the specified interrupt out of low-latency mode, i.e., it will not be able to pre-empt secure threads.

Specifying an interrupt that is not in low-latency has no effect. Clearing an enabled fast interrupt will implicitly deactivate it.


mvEnableFastInterrupt()

mvenablefastinterrupt page anchor

Activate a specific low-latency interrupt

extern enum MvStatus mvEnableFastInterrupt(uint32_t irqn);
ParameterDescription
irqnThe number of the fast IRQ to be activated
Error ValueDescription
MV_STATUS_INVALIDINTERRUPTirqn is not available to non-secure code
MV_STATUS_UNAVAILABLEFast interrupts are unavailable — code is being shut down after a hung interrupt or interrupt flood

Use mvEnableFastInterrupt() to activate an interrupt that was recently moved to low-latency mode by a call to mvSetFastInterrupt(), or to re-activate a fast interrupt that has been suspended by a call to mvDisableFastInterrupt() or mvDisableAllFastInterrupts().


mvEnableAllFastInterrupts()

mvenableallfastinterrupts page anchor

Activate all low-latency interrupts simultaneously

extern enum MvStatus mvEnableAllFastInterrupts(void);
Error ValueDescription
MV_STATUS_UNAVAILABLEFast interrupts are unavailable — code is being shut down after a hung interrupt or interrupt flood

Use this function to activate all deactivated low-latency interrupts at once.


mvDisableFastInterrupt()

mvdisablefastinterrupt page anchor

Deactivate a specific low-latency interrupt

extern enum MvStatus mvDisableFastInterrupt(uint32_t irqn);
ParameterDescription
irqnThe number of the fast IRQ to be deactivated
Error ValueDescription
MV_STATUS_INVALIDINTERRUPTirqn is not available to non-secure code
MV_STATUS_UNAVAILABLEFast interrupts are unavailable — code is being shut down after a hung interrupt or interrupt flood

Use mvDisableFastInterrupt() to deactivate an interrupt before moving it out of low-latency mode, or to temporarily suspend it. Paused interrupts can be reactivated by a call to mvEnableFastInterrupt() or mvEnableAllFastInterrupts().


mvDisableAllFastInterrupts()

mvdisableallfastinterrupts page anchor

Deactivate all low-latency interrupts simultaneously

extern enum MvStatus mvDisableAllFastInterrupts(void);
Error ValueDescription
MV_STATUS_UNAVAILABLEFast interrupts are unavailable — code is being shut down after a hung interrupt or interrupt flood

Use this function to deactivate all activated low-latency interrupts at once.

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.