blob: 8f45f94ed554ca2e733167615d530618a4d5b32f [file] [log] [blame]
Kevin Peng33d03942021-06-08 11:28:41 +08001/*
Gergely Korcsák97102692024-02-09 15:23:33 +01002 * Copyright (c) 2021-2024, Arm Limited. All rights reserved.
Chris Brandeecbd8f2024-03-28 12:08:47 -07003 * Copyright (c) 2024 Cypress Semiconductor Corporation (an Infineon
4 * company) or an affiliate of Cypress Semiconductor Corporation. All rights
5 * reserved.
Kevin Peng33d03942021-06-08 11:28:41 +08006 *
7 * SPDX-License-Identifier: BSD-3-Clause
8 *
9 */
10
Gergely Korcsák97102692024-02-09 15:23:33 +010011#include "tfm_hal_device_header.h"
Kevin Peng33d03942021-06-08 11:28:41 +080012#include "fih.h"
Kevin Pengaaf994d2021-07-20 17:38:18 +080013#include "psa/service.h"
Kevin Peng33d03942021-06-08 11:28:41 +080014
15void tfm_idle_thread(void)
16{
17 while (1) {
Kevin Pengaaf994d2021-07-20 17:38:18 +080018 /*
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) {
chesun018c292242023-03-02 11:25:49 +080024 __DSB();
Kevin Pengaaf994d2021-07-20 17:38:18 +080025 __WFI();
26 }
Kevin Peng33d03942021-06-08 11:28:41 +080027 }
28
29#ifdef TFM_FIH_PROFILE_ON
Chris Brandeecbd8f2024-03-28 12:08:47 -070030 (void)fih_delay();
Kevin Peng33d03942021-06-08 11:28:41 +080031
32 while (1) {
Kevin Pengaaf994d2021-07-20 17:38:18 +080033 /*
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) {
chesun018c292242023-03-02 11:25:49 +080039 __DSB();
Kevin Pengaaf994d2021-07-20 17:38:18 +080040 __WFI();
41 }
Kevin Peng33d03942021-06-08 11:28:41 +080042 }
43#endif
44}