blob: b469abbb6864e27569602af6f14433aa851b4f3a [file] [log] [blame]
Kevin Pengec239bb2021-09-03 15:40:27 +08001/*
Dávid Házi6f462292022-10-05 21:38:01 +02002 * Copyright (c) 2021-2022, Arm Limited. All rights reserved.
Chris Brand11ff8a52022-10-18 17:46:50 -07003 * Copyright (c) 2022 Cypress Semiconductor Corporation (an Infineon
4 * company) or an affiliate of Cypress Semiconductor Corporation. All rights
5 * reserved.
Kevin Pengec239bb2021-09-03 15:40:27 +08006 *
7 * SPDX-License-Identifier: BSD-3-Clause
8 *
9 */
10
11#include <stdint.h>
12
13#include "cmsis.h"
14#include "spm_ipc.h"
15#include "tfm_hal_interrupt.h"
16#include "tfm_peripherals_def.h"
Kevin Peng3f67b2e2021-10-18 17:47:27 +080017#include "ffm/interrupt.h"
Kevin Pengec239bb2021-09-03 15:40:27 +080018#include "load/interrupt_defs.h"
19
20static struct irq_t timer0_irq = {0};
21
22void TFM_TIMER0_IRQ_Handler(void)
23{
24 spm_handle_interrupt(timer0_irq.p_pt, timer0_irq.p_ildi);
25}
26
27enum tfm_hal_status_t tfm_timer0_irq_init(void *p_pt,
Chris Brand11ff8a52022-10-18 17:46:50 -070028 const struct irq_load_info_t *p_ildi)
Kevin Pengec239bb2021-09-03 15:40:27 +080029{
30 timer0_irq.p_ildi = p_ildi;
31 timer0_irq.p_pt = p_pt;
32
33 NVIC_SetPriority(TFM_TIMER0_IRQ, DEFAULT_IRQ_PRIORITY);
34 NVIC_ClearTargetState(TFM_TIMER0_IRQ);
35 NVIC_DisableIRQ(TFM_TIMER0_IRQ);
36
37 return TFM_HAL_SUCCESS;
38}
Ken Liu02a87ca2021-10-01 14:29:05 +080039
40#ifdef PSA_API_TEST_IPC
41
42static struct irq_t ff_test_uart_irq;
43
44void FF_TEST_UART_IRQ_Handler(void)
45{
46 spm_handle_interrupt(ff_test_uart_irq.p_pt, ff_test_uart_irq.p_ildi);
47}
48
49enum tfm_hal_status_t ff_test_uart_irq_init(void *p_pt,
Chris Brand11ff8a52022-10-18 17:46:50 -070050 const struct irq_load_info_t *p_ildi)
Ken Liu02a87ca2021-10-01 14:29:05 +080051{
52 ff_test_uart_irq.p_ildi = p_ildi;
53 ff_test_uart_irq.p_pt = p_pt;
54
55 NVIC_SetPriority(FF_TEST_UART_IRQ, DEFAULT_IRQ_PRIORITY);
56 NVIC_ClearTargetState(FF_TEST_UART_IRQ);
57 NVIC_DisableIRQ(FF_TEST_UART_IRQ);
58
59 return TFM_HAL_SUCCESS;
60}
61
62#endif