1 /*
2  * Copyright (c) 2021-2024, Arm Limited. All rights reserved.
3  * Copyright (c) 2024 Cypress Semiconductor Corporation (an Infineon
4  * company) or an affiliate of Cypress Semiconductor Corporation. All rights
5  * reserved.
6  *
7  * SPDX-License-Identifier: BSD-3-Clause
8  *
9  */
10 
11 #include "tfm_hal_device_header.h"
12 #include "fih.h"
13 #include "psa/service.h"
14 
tfm_idle_thread(void)15 void tfm_idle_thread(void)
16 {
17     while (1) {
18         /*
19          * There could be other Partitions becoming RUNABLE after wake up.
20          * This is a dummy psa_wait to let SPM check possible scheduling.
21          * It does not expect any signals.
22          */
23         if (psa_wait(PSA_WAIT_ANY, PSA_POLL) == 0) {
24             __DSB();
25             __WFI();
26         }
27     }
28 
29 #ifdef TFM_FIH_PROFILE_ON
30     (void)fih_delay();
31 
32     while (1) {
33         /*
34          * There could be other Partitions becoming RUNABLE after wake up.
35          * This is a dummy psa_wait to let SPM check possible scheduling.
36          * It does not expect any signals.
37          */
38         if (psa_wait(PSA_WAIT_ANY, PSA_POLL) == 0) {
39             __DSB();
40             __WFI();
41         }
42     }
43 #endif
44 }
45