Skip to content

Commit 06fb938

Browse files
committed
vIRQ: Add counterpart of NVIC_SystemReset API
1 parent 068ddcc commit 06fb938

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

api/inc/cmsis_nvic_virtual.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@
2929
#define NVIC_GetActive __NVIC_GetActive
3030
#define NVIC_SetPriority vIRQ_SetPriority
3131
#define NVIC_GetPriority vIRQ_GetPriority
32+
#define NVIC_SystemReset vIRQ_SystemReset
3233

3334
#endif /* __UVISOR_API_NVIC_VIRTUAL_H__ */

api/inc/interrupts.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,9 @@ UVISOR_EXTERN void vIRQ_DisableAll(void);
6060
* ::vIRQ_DisableAll for more information. */
6161
UVISOR_EXTERN void vIRQ_EnableAll(void);
6262

63+
/** Reset the device.
64+
* @warning Currently only the debug box can reset the device.
65+
*/
66+
UVISOR_EXTERN void vIRQ_SystemReset(void);
67+
6368
#endif /* __UVISOR_API_INTERRUPTS_H__ */

api/src/interrupts.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,13 @@ int vIRQ_GetLevel(void)
165165
return UVISOR_SVC(UVISOR_SVC_ID_IRQ_LEVEL_GET, "");
166166
}
167167
}
168+
169+
void vIRQ_SystemReset(void)
170+
{
171+
if(__uvisor_mode == 0) {
172+
NVIC_SystemReset();
173+
}
174+
else {
175+
UVISOR_SVC(UVISOR_SVC_ID_DEBUG_REBOOT, "");
176+
}
177+
}

0 commit comments

Comments
 (0)