blob: 46e4a504f6c607bc76c9f0b775c5b0cdc791dec7 [file] [log] [blame]
Kevin Peng33d03942021-06-08 11:28:41 +08001/*
2 * Copyright (c) 2021, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#include "cmsis.h"
9#include "fih.h"
Kevin Pengaaf994d2021-07-20 17:38:18 +080010#include "psa/service.h"
Kevin Peng33d03942021-06-08 11:28:41 +080011
12void tfm_idle_thread(void)
13{
14 while (1) {
Kevin Pengaaf994d2021-07-20 17:38:18 +080015 /*
16 * There could be other Partitions becoming RUNABLE after wake up.
17 * This is a dummy psa_wait to let SPM check possible scheduling.
18 * It does not expect any signals.
19 */
20 if (psa_wait(PSA_WAIT_ANY, PSA_POLL) == 0) {
chesun018c292242023-03-02 11:25:49 +080021 __DSB();
Kevin Pengaaf994d2021-07-20 17:38:18 +080022 __WFI();
23 }
Kevin Peng33d03942021-06-08 11:28:41 +080024 }
25
26#ifdef TFM_FIH_PROFILE_ON
27 fih_delay();
28
29 while (1) {
Kevin Pengaaf994d2021-07-20 17:38:18 +080030 /*
31 * There could be other Partitions becoming RUNABLE after wake up.
32 * This is a dummy psa_wait to let SPM check possible scheduling.
33 * It does not expect any signals.
34 */
35 if (psa_wait(PSA_WAIT_ANY, PSA_POLL) == 0) {
chesun018c292242023-03-02 11:25:49 +080036 __DSB();
Kevin Pengaaf994d2021-07-20 17:38:18 +080037 __WFI();
38 }
Kevin Peng33d03942021-06-08 11:28:41 +080039 }
40#endif
41}