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:
mvSetFastInterrupt()
mvClearFastInterrupt()
mvEnableFastInterrupt()
mvEnableAllFastInterrupts()
mvDisableFastInterrupt()
mvDisableAllFastInterrupts()
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.
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
).
Mark an interrupt to be served with low latency
extern enum MvStatus mvSetFastInterrupt(uint32_t irqn);
Parameter | Description |
---|---|
irqn | The number of the IRQ to be served with low latency |
Error Value | Description |
---|---|
MV_STATUS_INVALIDINTERRUPT | irqn is not available to non-secure code |
MV_STATUS_INVALIDVECTOR | VTOR or interrupt vector is not in non-secure memory |
MV_STATUS_UNAVAILABLE | Fast 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.
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.
Move an interrupt out of low-latency mode
extern enum MvStatus mvClearFastInterrupt(uint32_t irqn);
Parameter | Description |
---|---|
irqn | The number of the IRQ to be removed from low-latency mode |
Error Value | Description |
---|---|
MV_STATUS_INVALIDINTERRUPT | irqn is not available to non-secure code |
MV_STATUS_UNAVAILABLE | Fast 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.
Activate a specific low-latency interrupt
extern enum MvStatus mvEnableFastInterrupt(uint32_t irqn);
Parameter | Description |
---|---|
irqn | The number of the fast IRQ to be activated |
Error Value | Description |
---|---|
MV_STATUS_INVALIDINTERRUPT | irqn is not available to non-secure code |
MV_STATUS_UNAVAILABLE | Fast 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()
.
Activate all low-latency interrupts simultaneously
extern enum MvStatus mvEnableAllFastInterrupts(void);
Error Value | Description |
---|---|
MV_STATUS_UNAVAILABLE | Fast 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.
Deactivate a specific low-latency interrupt
extern enum MvStatus mvDisableFastInterrupt(uint32_t irqn);
Parameter | Description |
---|---|
irqn | The number of the fast IRQ to be deactivated |
Error Value | Description |
---|---|
MV_STATUS_INVALIDINTERRUPT | irqn is not available to non-secure code |
MV_STATUS_UNAVAILABLE | Fast 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()
.
Deactivate all low-latency interrupts simultaneously
extern enum MvStatus mvDisableAllFastInterrupts(void);
Error Value | Description |
---|---|
MV_STATUS_UNAVAILABLE | Fast 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.