Kevin Peng | ec239bb | 2021-09-03 15:40:27 +0800 | [diff] [blame] | 1 | /* |
Dávid Házi | 6f46229 | 2022-10-05 21:38:01 +0200 | [diff] [blame] | 2 | * Copyright (c) 2021-2022, Arm Limited. All rights reserved. |
Chris Brand | 11ff8a5 | 2022-10-18 17:46:50 -0700 | [diff] [blame] | 3 | * Copyright (c) 2022 Cypress Semiconductor Corporation (an Infineon |
| 4 | * company) or an affiliate of Cypress Semiconductor Corporation. All rights |
| 5 | * reserved. |
Kevin Peng | ec239bb | 2021-09-03 15:40:27 +0800 | [diff] [blame] | 6 | * |
| 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 Peng | 3f67b2e | 2021-10-18 17:47:27 +0800 | [diff] [blame] | 17 | #include "ffm/interrupt.h" |
Kevin Peng | ec239bb | 2021-09-03 15:40:27 +0800 | [diff] [blame] | 18 | #include "load/interrupt_defs.h" |
| 19 | |
| 20 | static struct irq_t timer0_irq = {0}; |
| 21 | |
| 22 | void TFM_TIMER0_IRQ_Handler(void) |
| 23 | { |
| 24 | spm_handle_interrupt(timer0_irq.p_pt, timer0_irq.p_ildi); |
| 25 | } |
| 26 | |
| 27 | enum tfm_hal_status_t tfm_timer0_irq_init(void *p_pt, |
Chris Brand | 11ff8a5 | 2022-10-18 17:46:50 -0700 | [diff] [blame] | 28 | const struct irq_load_info_t *p_ildi) |
Kevin Peng | ec239bb | 2021-09-03 15:40:27 +0800 | [diff] [blame] | 29 | { |
| 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 Liu | 02a87ca | 2021-10-01 14:29:05 +0800 | [diff] [blame] | 39 | |
| 40 | #ifdef PSA_API_TEST_IPC |
| 41 | |
| 42 | static struct irq_t ff_test_uart_irq; |
| 43 | |
| 44 | void 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 | |
| 49 | enum tfm_hal_status_t ff_test_uart_irq_init(void *p_pt, |
Chris Brand | 11ff8a5 | 2022-10-18 17:46:50 -0700 | [diff] [blame] | 50 | const struct irq_load_info_t *p_ildi) |
Ken Liu | 02a87ca | 2021-10-01 14:29:05 +0800 | [diff] [blame] | 51 | { |
| 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 |