1 /*
2  * Copyright (c) 2021-2024, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #include <stdint.h>
9 
10 #include "tfm_hal_device_header.h"
11 #include "tfm_hal_interrupt.h"
12 
13 /*
14  * This file contains the interrupt HAL API implementations base on NVIC.
15  * Platforms that use NVIC as interrupt controller can use it directly, or have
16  * their own implementations.
17  */
18 
tfm_hal_irq_enable(uint32_t irq_num)19 enum tfm_hal_status_t tfm_hal_irq_enable(uint32_t irq_num)
20 {
21     NVIC_EnableIRQ((IRQn_Type)irq_num);
22 
23     return TFM_HAL_SUCCESS;
24 }
25 
tfm_hal_irq_disable(uint32_t irq_num)26 enum tfm_hal_status_t tfm_hal_irq_disable(uint32_t irq_num)
27 {
28     NVIC_DisableIRQ((IRQn_Type)irq_num);
29 
30     return TFM_HAL_SUCCESS;
31 }
32 
tfm_hal_irq_clear_pending(uint32_t irq_num)33 enum tfm_hal_status_t tfm_hal_irq_clear_pending(uint32_t irq_num)
34 {
35     NVIC_ClearPendingIRQ((IRQn_Type)irq_num);
36 
37     return TFM_HAL_SUCCESS;
38 }
39