1 /*
2  * Copyright (c) 2022, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #include "cmsis.h"
9 
tfm_hal_system_reset(void)10 void tfm_hal_system_reset(void)
11 {
12     struct rss_sysctrl_t *rss_sysctrl = (void *)RSS_SYSCTRL_BASE_S;
13 
14     __DSB();
15     rss_sysctrl->swreset = 0x1u << 5;
16     __DSB();
17 
18     while(1) {
19         __NOP();
20     }
21 }
22 
tfm_hal_system_halt(void)23 void tfm_hal_system_halt(void)
24 {
25     /*
26      * Disable IRQs to stop all threads, not just the thread that
27      * halted the system.
28      */
29     __disable_irq();
30 
31     /*
32      * Enter sleep to reduce power consumption and do it in a loop in
33      * case a signal wakes up the CPU.
34      */
35     while (1) {
36         __WFE();
37     }
38 }
39