MT2523 API Reference  LinkIt SDK v4
hal_nvic.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2017 MediaTek Inc. All rights reserved.
4  *
5  * This software/firmware and related documentation ("MediaTek Software") are
6  * protected under relevant copyright laws. The information contained herein
7  * is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
8  * Without the prior written permission of MediaTek and/or its licensors,
9  * any reproduction, modification, use or disclosure of MediaTek Software,
10  * and information contained herein, in whole or in part, shall be strictly prohibited.
11  * You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
12  * if you have agreed to and been bound by the applicable license agreement with
13  * MediaTek ("License Agreement") and been granted explicit permission to do so within
14  * the License Agreement ("Permitted User"). If you are not a Permitted User,
15  * please cease any access or use of MediaTek Software immediately.
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
18  * ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
19  * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
21  * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
22  * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
23  * SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
24  * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
25  * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
26  * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
27  * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
28  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
29  * CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
30  * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
31  * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
32  * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
33  */
34 
35 #ifndef __HAL_NVIC_H__
36 #define __HAL_NVIC_H__
37 #include "hal_platform.h"
38 
39 #ifdef HAL_NVIC_MODULE_ENABLED
40 
142 #ifdef __cplusplus
143 extern "C" {
144 #endif
145 
146 
152 typedef enum {
159 
160 
175 typedef void (*hal_nvic_isr_t)(hal_nvic_irq_t irq_number);
187 #define HAL_NVIC_QUERY_EXCEPTION_NUMBER ((SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) >> SCB_ICSR_VECTACTIVE_Pos)
188 
193 /*****************************************************************************
194 * Functions
195 *****************************************************************************/
196 
205 hal_nvic_status_t hal_nvic_register_isr_handler(hal_nvic_irq_t irq_number, hal_nvic_isr_t isr_handler);
206 
207 
212 
217 hal_nvic_status_t hal_nvic_enable_irq(hal_nvic_irq_t irq_number);
218 
223 hal_nvic_status_t hal_nvic_disable_irq(hal_nvic_irq_t irq_number);
224 
233 uint32_t hal_nvic_get_pending_irq(hal_nvic_irq_t irq_number);
234 
239 hal_nvic_status_t hal_nvic_set_pending_irq(hal_nvic_irq_t irq_number);
240 
245 hal_nvic_status_t hal_nvic_clear_pending_irq(hal_nvic_irq_t irq_number);
246 
252 hal_nvic_status_t hal_nvic_set_priority(hal_nvic_irq_t irq_number, uint32_t priority);
253 
261 uint32_t hal_nvic_get_priority(hal_nvic_irq_t irq_number);
262 
273 
283 
284 
285 #ifdef __cplusplus
286 }
287 #endif
288 
289 
295 #endif /*HAL_NVIC_MODULE_ENABLED*/
296 #endif /* __HAL_NVIC_H__ */
297 
hal_nvic_status_t hal_nvic_restore_interrupt_mask(uint32_t mask)
This function restores the IRQ settings as specified in the mask.
hal_nvic_status_t hal_nvic_disable_irq(hal_nvic_irq_t irq_number)
This function disables a device-specific interrupt in the NVIC interrupt controller.
hal_nvic_status_t hal_nvic_set_pending_irq(hal_nvic_irq_t irq_number)
This function sets the pending bit of an external interrupt.
hal_nvic_status_t hal_nvic_register_isr_handler(hal_nvic_irq_t irq_number, hal_nvic_isr_t isr_handler)
This function is used to register a callback (an ISR) for NVIC IRQ.
hal_nvic_status_t
This enum defines the return status of the NVIC API.
Definition: hal_nvic.h:152
hal_nvic_status_t hal_nvic_set_priority(hal_nvic_irq_t irq_number, uint32_t priority)
This function sets the priority of an interrupt.
hal_nvic_status_t hal_nvic_init(void)
This function initializes the NVIC IRQ with default priority.
No error occurred.
Definition: hal_nvic.h:157
NVIC unspecified error.
Definition: hal_nvic.h:156
uint32_t hal_nvic_get_priority(hal_nvic_irq_t irq_number)
This function reads the priority of an interrupt.
hal_nvic_status_t hal_nvic_clear_pending_irq(hal_nvic_irq_t irq_number)
This function clears the pending bit of an external interrupt.
hal_nvic_status_t hal_nvic_enable_irq(hal_nvic_irq_t irq_number)
This function enables a device-specific interrupt in the NVIC interrupt controller.
ISR routine is null.
Definition: hal_nvic.h:153
Incorrect IRQ number.
Definition: hal_nvic.h:154
void(* hal_nvic_isr_t)(hal_nvic_irq_t irq_number)
This defines the callback function prototype.
Definition: hal_nvic.h:175
hal_nvic_status_t hal_nvic_save_and_set_interrupt_mask(uint32_t *mask)
This function saves the current IRQ settings in a temporary variable, and then disables the IRQ by se...
uint32_t hal_nvic_get_pending_irq(hal_nvic_irq_t irq_number)
This function reads the pending register in the NVIC and returns the pending bit for the specified in...
Invalid parameter.
Definition: hal_nvic.h:155