2 * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
8 * o Redistributions of source code must retain the above copyright notice, this list
9 * of conditions and the following disclaimer.
11 * o Redistributions in binary form must reproduce the above copyright notice, this
12 * list of conditions and the following disclaimer in the documentation and/or
13 * other materials provided with the distribution.
15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #if !defined(__FSL_INTERRUPT_MANAGER_H__)
31 #define __FSL_INTERRUPT_MANAGER_H__
36 #include "fsl_interrupt_features.h"
37 #include "device/fsl_device_registers.h"
39 /*! @addtogroup interrupt_manager*/
44 /*******************************************************************************
46 ******************************************************************************/
48 /*******************************************************************************
50 ******************************************************************************/
52 #if defined(__cplusplus)
54 #endif /* __cplusplus*/
56 /*! @name interrupt_manager APIs*/
60 * @brief Installs an interrupt handler routine for a given IRQ number.
62 * This function lets the application register/replace the interrupt
63 * handler for a specified IRQ number. The IRQ number is different than the vector
64 * number. IRQ 0 starts from the vector 16 address. See a chip-specific reference
65 * manual for details and the startup_MKxxxx.s file for each chip
66 * family to find out the default interrupt handler for each device. This
67 * function converts the IRQ number to the vector number by adding 16 to
70 * @param irqNumber IRQ number
71 * @param handler Interrupt handler routine address pointer
73 void INT_SYS_InstallHandler(IRQn_Type irqNumber
, void (*handler
)(void));
76 * @brief Enables an interrupt for a given IRQ number.
78 * This function enables the individual interrupt for a specified IRQ
79 * number. It calls the system NVIC API to access the interrupt control
80 * register. The input IRQ number does not include the core interrupt, only
81 * the peripheral interrupt, from 0 to a maximum supported IRQ.
83 * @param irqNumber IRQ number
85 static inline void INT_SYS_EnableIRQ(IRQn_Type irqNumber
)
87 /* check IRQ number */
88 assert(0 <= irqNumber
);
89 assert(irqNumber
<= FSL_FEATURE_INTERRUPT_IRQ_MAX
);
91 /* call core API to enable the IRQ*/
92 NVIC_EnableIRQ(irqNumber
);
96 * @brief Disables an interrupt for a given IRQ number.
98 * This function enables the individual interrupt for a specified IRQ
99 * number. It calls the system NVIC API to access the interrupt control
102 * @param irqNumber IRQ number
104 static inline void INT_SYS_DisableIRQ(IRQn_Type irqNumber
)
106 /* check IRQ number */
107 assert(0 <= irqNumber
);
108 assert(irqNumber
<= FSL_FEATURE_INTERRUPT_IRQ_MAX
);
110 /* call core API to disable the IRQ*/
111 NVIC_DisableIRQ(irqNumber
);
115 * @brief Enables system interrupt.
117 * This function enables the global interrupt by calling the core API.
120 void INT_SYS_EnableIRQGlobal(void);
123 * @brief Disable system interrupt.
125 * This function disables the global interrupt by calling the core API.
128 void INT_SYS_DisableIRQGlobal(void);
132 #if defined(__cplusplus)
134 #endif /* __cplusplus*/
138 #endif /* __FSL_INTERRUPT_MANAGER_H__*/
139 /*******************************************************************************
141 ******************************************************************************/