Mate Toth-Pal | d3c7766 | 2019-02-20 16:23:00 +0100 | [diff] [blame] | 1 | /* |
Raef Coles | 79d8208 | 2021-01-07 15:42:38 +0000 | [diff] [blame] | 2 | * Copyright (c) 2019-2021, Arm Limited. All rights reserved. |
Mate Toth-Pal | d3c7766 | 2019-02-20 16:23:00 +0100 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #ifndef __TFM_PLAT_TEST_H__ |
| 9 | #define __TFM_PLAT_TEST_H__ |
| 10 | |
| 11 | #include "tfm_plat_defs.h" |
| 12 | |
| 13 | /** |
| 14 | * \brief Busy wait until the user presses a specific button |
| 15 | */ |
Raef Coles | 79d8208 | 2021-01-07 15:42:38 +0000 | [diff] [blame] | 16 | TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_CORE_TEST", "PSA-ROT") |
Mate Toth-Pal | d3c7766 | 2019-02-20 16:23:00 +0100 | [diff] [blame] | 17 | void tfm_plat_test_wait_user_button_pressed(void); |
| 18 | |
| 19 | /** |
| 20 | * \brief Busy wait until the user releases a specific button |
| 21 | */ |
Raef Coles | 79d8208 | 2021-01-07 15:42:38 +0000 | [diff] [blame] | 22 | TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_CORE_TEST", "PSA-ROT") |
Mate Toth-Pal | d3c7766 | 2019-02-20 16:23:00 +0100 | [diff] [blame] | 23 | void tfm_plat_test_wait_user_button_released(void); |
| 24 | |
| 25 | /** |
| 26 | * \brief Get the status of the LEDs used by tests |
| 27 | * |
| 28 | * \return Returns the current status of LEDs |
| 29 | */ |
Raef Coles | 79d8208 | 2021-01-07 15:42:38 +0000 | [diff] [blame] | 30 | TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_CORE_TEST", "PSA-ROT") |
Mate Toth-Pal | d3c7766 | 2019-02-20 16:23:00 +0100 | [diff] [blame] | 31 | uint32_t tfm_plat_test_get_led_status(void); |
| 32 | |
| 33 | /** |
| 34 | * \brief Sets the status of the LEDs used by tests |
| 35 | * |
| 36 | * \param[in] status The status to be set |
| 37 | */ |
Raef Coles | 79d8208 | 2021-01-07 15:42:38 +0000 | [diff] [blame] | 38 | TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_CORE_TEST", "PSA-ROT") |
Mate Toth-Pal | d3c7766 | 2019-02-20 16:23:00 +0100 | [diff] [blame] | 39 | void tfm_plat_test_set_led_status(uint32_t status); |
| 40 | |
| 41 | /** |
| 42 | * \brief Get the mask of the LEDs used for testing |
| 43 | * |
| 44 | * \return Returns the mask of the LEDs used for testing |
| 45 | */ |
Raef Coles | 79d8208 | 2021-01-07 15:42:38 +0000 | [diff] [blame] | 46 | TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_CORE_TEST", "PSA-ROT") |
Mate Toth-Pal | d3c7766 | 2019-02-20 16:23:00 +0100 | [diff] [blame] | 47 | uint32_t tfm_plat_test_get_userled_mask(void); |
| 48 | |
Mate Toth-Pal | a9f8e9e | 2019-03-05 16:11:14 +0100 | [diff] [blame] | 49 | /** |
| 50 | * \brief starts Secure timer |
| 51 | * |
| 52 | * Configures a timer to start counting, and generate a timer interrupt after a |
| 53 | * certain amount of time. For the test case to be useful, the timeout value of |
| 54 | * the timer should be long enough so that the test service can go to the state |
| 55 | * where it starts waiting for the interrupt. |
| 56 | */ |
Kevin Peng | 6a121d0 | 2021-05-10 13:53:58 +0800 | [diff] [blame] | 57 | #ifdef TFM_ENABLE_SLIH_TEST |
| 58 | TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_SLIH_TEST", "APP-ROT") |
Kevin Peng | fb9f2ce | 2021-05-27 15:13:46 +0800 | [diff] [blame] | 59 | #elif defined(TFM_ENABLE_FLIH_TEST) |
| 60 | TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_FLIH_TEST", "APP-ROT") |
Kevin Peng | 6a121d0 | 2021-05-10 13:53:58 +0800 | [diff] [blame] | 61 | #endif |
Mate Toth-Pal | a9f8e9e | 2019-03-05 16:11:14 +0100 | [diff] [blame] | 62 | void tfm_plat_test_secure_timer_start(void); |
| 63 | |
Kevin Peng | 362817f | 2021-04-08 10:28:13 +0800 | [diff] [blame] | 64 | |
| 65 | /** |
| 66 | * \brief Clears Secure timer interrupt |
| 67 | */ |
| 68 | #ifdef TFM_ENABLE_SLIH_TEST |
| 69 | TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_SLIH_TEST", "APP-ROT") |
Kevin Peng | fb9f2ce | 2021-05-27 15:13:46 +0800 | [diff] [blame] | 70 | #elif TFM_ENABLE_FLIH_TEST |
| 71 | TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_FLIH_TEST", "APP-ROT") |
Kevin Peng | 362817f | 2021-04-08 10:28:13 +0800 | [diff] [blame] | 72 | #endif |
| 73 | void tfm_plat_test_secure_timer_clear_intr(void); |
| 74 | |
Mate Toth-Pal | a9f8e9e | 2019-03-05 16:11:14 +0100 | [diff] [blame] | 75 | /** |
| 76 | * \brief Stops the Secure timer and clears the timer interrupt. |
| 77 | */ |
Kevin Peng | 6a121d0 | 2021-05-10 13:53:58 +0800 | [diff] [blame] | 78 | #ifdef TFM_ENABLE_SLIH_TEST |
| 79 | TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_SLIH_TEST", "APP-ROT") |
Kevin Peng | fb9f2ce | 2021-05-27 15:13:46 +0800 | [diff] [blame] | 80 | #elif defined(TFM_ENABLE_FLIH_TEST) |
| 81 | TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_FLIH_TEST", "APP-ROT") |
Kevin Peng | 6a121d0 | 2021-05-10 13:53:58 +0800 | [diff] [blame] | 82 | #endif |
Mate Toth-Pal | a9f8e9e | 2019-03-05 16:11:14 +0100 | [diff] [blame] | 83 | void tfm_plat_test_secure_timer_stop(void); |
| 84 | |
| 85 | /** |
| 86 | * \brief starts Non-secure timer |
| 87 | * |
| 88 | * Configures a timer to start counting, and generate a timer interrupt after a |
| 89 | * certain amount of time. For the test case to be useful, the timeout value of |
| 90 | * the timer should be long enough so that the test service can go to the state |
| 91 | * where it starts waiting for the interrupt. |
| 92 | */ |
| 93 | void tfm_plat_test_non_secure_timer_start(void); |
| 94 | |
| 95 | /** |
| 96 | * \brief Stops the non-Secure timer and clears the timer interrupt. |
| 97 | */ |
| 98 | void tfm_plat_test_non_secure_timer_stop(void); |
| 99 | |
| 100 | |
Mate Toth-Pal | d3c7766 | 2019-02-20 16:23:00 +0100 | [diff] [blame] | 101 | #endif /* __TFM_PLAT_TEST_H__ */ |