Kevin Peng | 33d0394 | 2021-06-08 11:28:41 +0800 | [diff] [blame] | 1 | /* |
| 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 Peng | aaf994d | 2021-07-20 17:38:18 +0800 | [diff] [blame] | 10 | #include "psa/service.h" |
Kevin Peng | 33d0394 | 2021-06-08 11:28:41 +0800 | [diff] [blame] | 11 | |
| 12 | void tfm_idle_thread(void) |
| 13 | { |
| 14 | while (1) { |
Kevin Peng | aaf994d | 2021-07-20 17:38:18 +0800 | [diff] [blame] | 15 | /* |
| 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) { |
| 21 | __WFI(); |
| 22 | } |
Kevin Peng | 33d0394 | 2021-06-08 11:28:41 +0800 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | #ifdef TFM_FIH_PROFILE_ON |
| 26 | fih_delay(); |
| 27 | |
| 28 | while (1) { |
Kevin Peng | aaf994d | 2021-07-20 17:38:18 +0800 | [diff] [blame] | 29 | /* |
| 30 | * There could be other Partitions becoming RUNABLE after wake up. |
| 31 | * This is a dummy psa_wait to let SPM check possible scheduling. |
| 32 | * It does not expect any signals. |
| 33 | */ |
| 34 | if (psa_wait(PSA_WAIT_ANY, PSA_POLL) == 0) { |
| 35 | __WFI(); |
| 36 | } |
Kevin Peng | 33d0394 | 2021-06-08 11:28:41 +0800 | [diff] [blame] | 37 | } |
| 38 | #endif |
| 39 | } |