aboutsummaryrefslogtreecommitdiff
path: root/platform/include/tfm_plat_test.h
blob: 013081d2ccd23a42ea98e08517ee5df9ba76bb59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
 * Copyright (c) 2019-2021, Arm Limited. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 *
 */

#ifndef __TFM_PLAT_TEST_H__
#define __TFM_PLAT_TEST_H__

#include "tfm_plat_defs.h"

/**
 * \brief Busy wait until the user presses a specific button
 */
TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_CORE_TEST", "PSA-ROT")
void tfm_plat_test_wait_user_button_pressed(void);

/**
 * \brief Busy wait until the user releases a specific button
 */
TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_CORE_TEST", "PSA-ROT")
void tfm_plat_test_wait_user_button_released(void);

/**
 * \brief Get the status of the LEDs used by tests
 *
 * \return Returns the current status of LEDs
 */
TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_CORE_TEST", "PSA-ROT")
uint32_t tfm_plat_test_get_led_status(void);

/**
 * \brief Sets the status of the LEDs used by tests
 *
 * \param[in]  status  The status to be set
 */
TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_CORE_TEST", "PSA-ROT")
void tfm_plat_test_set_led_status(uint32_t status);

/**
 * \brief Get the mask of the LEDs used for testing
 *
 * \return Returns the mask of the LEDs used for testing
 */
TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_CORE_TEST", "PSA-ROT")
uint32_t tfm_plat_test_get_userled_mask(void);

/**
 * \brief starts Secure timer
 *
 * Configures a timer to start counting, and generate a timer interrupt after a
 * certain amount of time. For the test case to be useful, the timeout value of
 * the timer should be long enough so that the test service can go to the state
 * where it starts waiting for the interrupt.
 */
#ifdef TFM_ENABLE_SLIH_TEST
TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_SLIH_TEST", "APP-ROT")
#elif defined(TFM_ENABLE_FLIH_TEST)
TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_FLIH_TEST", "APP-ROT")
#endif
void tfm_plat_test_secure_timer_start(void);


/**
 * \brief Clears Secure timer interrupt
 */
#ifdef TFM_ENABLE_SLIH_TEST
TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_SLIH_TEST", "APP-ROT")
#elif TFM_ENABLE_FLIH_TEST
TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_FLIH_TEST", "APP-ROT")
#endif
void tfm_plat_test_secure_timer_clear_intr(void);

/**
 * \brief Stops the Secure timer and clears the timer interrupt.
 */
#ifdef TFM_ENABLE_SLIH_TEST
TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_SLIH_TEST", "APP-ROT")
#elif defined(TFM_ENABLE_FLIH_TEST)
TFM_LINK_SET_RO_IN_PARTITION_SECTION("TFM_SP_FLIH_TEST", "APP-ROT")
#endif
void tfm_plat_test_secure_timer_stop(void);

/**
 * \brief starts Non-secure timer
 *
 * Configures a timer to start counting, and generate a timer interrupt after a
 * certain amount of time. For the test case to be useful, the timeout value of
 * the timer should be long enough so that the test service can go to the state
 * where it starts waiting for the interrupt.
 */
void tfm_plat_test_non_secure_timer_start(void);

/**
 * \brief Stops the non-Secure timer and clears the timer interrupt.
 */
void tfm_plat_test_non_secure_timer_stop(void);


#endif /* __TFM_PLAT_TEST_H__ */