1 /* 2 * Copyright (c) 2021-2022, Arm Limited. All rights reserved. 3 * Copyright (c) 2022 Cypress Semiconductor Corporation (an Infineon 4 * company) or an affiliate of Cypress Semiconductor Corporation. All rights 5 * reserved. 6 * 7 * SPDX-License-Identifier: BSD-3-Clause 8 * 9 */ 10 11 #include <stdint.h> 12 13 #include "cmsis.h" 14 #include "spm.h" 15 #include "tfm_hal_interrupt.h" 16 #include "tfm_peripherals_def.h" 17 #include "ffm/interrupt.h" 18 #include "load/interrupt_defs.h" 19 20 static struct irq_t timer0_irq = {0}; 21 TFM_TIMER0_IRQ_Handler(void)22void TFM_TIMER0_IRQ_Handler(void) 23 { 24 spm_handle_interrupt(timer0_irq.p_pt, timer0_irq.p_ildi); 25 } 26 tfm_timer0_irq_init(void * p_pt,const struct irq_load_info_t * p_ildi)27enum tfm_hal_status_t tfm_timer0_irq_init(void *p_pt, 28 const struct irq_load_info_t *p_ildi) 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 } 39 40 #ifdef PSA_API_TEST_IPC 41 42 static struct irq_t ff_test_uart_irq; 43 FF_TEST_UART_IRQ_Handler(void)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 ff_test_uart_irq_init(void * p_pt,const struct irq_load_info_t * p_ildi)49enum tfm_hal_status_t ff_test_uart_irq_init(void *p_pt, 50 const struct irq_load_info_t *p_ildi) 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 63