1 /*
2  * Copyright (c) 2019-2022, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #include "cmsis.h"
9 #include "systimer_armv8-m_drv.h"
10 #include "tfm_plat_test.h"
11 #include "device_definition.h"
12 
13 /* Interrupt interval is set to 1 ms */
14 #define TIMER_RELOAD_VALUE          (SYSTIMER0_ARMV8M_DEFAULT_FREQ_HZ / 1000)
15 
tfm_plat_test_secure_timer_start(void)16 void tfm_plat_test_secure_timer_start(void)
17 {
18     systimer_armv8_m_init(&SYSTIMER0_ARMV8_M_DEV_S);
19     systimer_armv8_m_set_autoinc_reload(&SYSTIMER0_ARMV8_M_DEV_S, TIMER_RELOAD_VALUE);
20     systimer_armv8_m_enable_autoinc(&SYSTIMER0_ARMV8_M_DEV_S);
21     systimer_armv8_m_enable_interrupt(&SYSTIMER0_ARMV8_M_DEV_S);
22 }
23 
tfm_plat_test_secure_timer_clear_intr(void)24 void tfm_plat_test_secure_timer_clear_intr(void)
25 {
26     systimer_armv8_m_clear_autoinc_interrupt(&SYSTIMER0_ARMV8_M_DEV_S);
27 }
28 
tfm_plat_test_secure_timer_stop(void)29 void tfm_plat_test_secure_timer_stop(void)
30 {
31     systimer_armv8_m_uninit(&SYSTIMER0_ARMV8_M_DEV_S);
32     systimer_armv8_m_clear_autoinc_interrupt(&SYSTIMER0_ARMV8_M_DEV_S);
33 }
34