]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blob - pdk_k2g_1_0_1_0_eng/packages/ti/csl/arch/m4/interrupt.h
Add alpha files for car
[processor-sdk/performance-audio-sr.git] / pdk_k2g_1_0_1_0_eng / packages / ti / csl / arch / m4 / interrupt.h
1 /*
2  *  Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
3  *
4  *  Redistribution and use in source and binary forms, with or without
5  *  modification, are permitted provided that the following conditions
6  *  are met:
7  *
8  *    Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  *
11  *    Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the
14  *    distribution.
15  *
16  *    Neither the name of Texas Instruments Incorporated nor the names of
17  *    its contributors may be used to endorse or promote products derived
18  *    from this software without specific prior written permission.
19  *
20  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
34 /**
35  *  \file  interrupt.h
36  *
37  *  \brief This file contains the API prototypes for configuring INTC for
38  *         ARM Cortex-M3
39  */
41 /* ========================================================================== */
42 /*                             Include Files                                  */
43 /* ========================================================================== */
44 #ifndef INTERRUPT_H
45 #define INTERRUPT_H
47 #include <stdint.h>
48 #include <ti/csl/hw_types.h>
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
54 /* ========================================================================== */
55 /*                                 Macros                                     */
56 /* ========================================================================== */
57 typedef void *IntrHandle;
58 typedef void  (*IntrFuncPtr)(void *ptr);
60 /*
61 ** Vector table size
62 */
63 #define NUM_ELEMENTS_VECTOR_TABLE                      ((uint32_t) 136U)
65 /**
66  * \brief   List of Exceptions in M4. These exceptions are interrupts from
67  *          1 to 15 in Vector table
68  *
69  **/
71 /** \brief Exception for RESET*/
72  #define EXCEPTION_M4_RESET_NUM_1                                (1U)
73 /** \brief Exception for External NMI inputs*/
74 #define EXCEPTION_M4_NMI_NUM_2                                  (2U)
75 /** \brief Exception for All fault conditions, if the fault handle is not
76  *         enabled */
77 #define EXCEPTION_M4_HARD_FAULT_NUM_3                           (3U)
78 /** \brief Exception for Memory management fault; access to illegal locations*/
79 #define EXCEPTION_M4_MEM_MANAGE_NUM_4                           (4U)
80 /** \brief Exception for Bus error*/
81 #define EXCEPTION_M4_BUS_FAULT_NUM_5                            (5U)
82 /** \brief Exception for Program error*/
83 #define EXCEPTION_M4_USUAGE_FAULT_NUM_6                         (6U)
84 /** \brief Reserved*/
85 #define EXCEPTION_M4_RESERVED_NUM_7                             (7U)
86 /** \brief Reserved*/
87 #define EXCEPTION_M4_RESERVED_NUM_8                             (8U)
88 /** \brief Reserved*/
89 #define EXCEPTION_M4_RESERVED_NUM_9                             (9U)
90 /** \brief Reserved*/
91 #define EXCEPTION_M4_RESERVED_NUM_10                            (10U)
92 /** \brief Exception for Service system Call*/
93 #define EXCEPTION_M4_SVCALL_NUM_11                              (11U)
94 /** \brief Exception for BP,WP or external debug req*/
95 #define EXCEPTION_M4_DEBUG_MONITOR_NUM_12                       (12U)
96 /** \brief Reserved*/
97 #define EXCEPTION_M4_RESERVED_NUM_13                            (13U)
98 /** \brief Exception for Pendable request for system device*/
99 #define EXCEPTION_M4_PENDSV_NUM_14                              (14U)
100 /** \brief Exception for System Tick Timer*/
101 #define EXCEPTION_M4_SYSTICK_NUM_15                             (15U)
103 /* ========================================================================== */
104 /*                          Function Declarations                             */
105 /* ========================================================================== */
106 uint32_t disableInterrupt(void);
107 void restoreInterrupt(uint32_t dummyArg);
109 /**
110  * \brief   This API is used to initialize the interrupt controller. This API
111  *          shall be called before using the interrupt controller.
112  *
113  * \param   None
114  *
115  * \return  None.
116  *
117  **/
118 void Intc_Init(void);
120 /**
121  * \brief    Registers an interrupt Handler in the interrupt vector table for
122  *           system interrupts.
123  *
124  * \param    intrNum - Interrupt Number
125  * \param    fnHandler - Function pointer to the ISR
126  * \param    fun_arg - Argument to the ISR
127  *
128  * Note: When the interrupt occurs for the sytem interrupt number indicated,
129  * the control goes to the ISR given as the parameter.
130  *
131  * \return      None.
132  **/
133 void Intc_IntRegister(uint16_t intrNum, IntrFuncPtr fptr, void *fun_arg);
135 /**
136  * \brief   Unregisters an interrupt
137  *
138  * \param   intrNum - Interrupt Number
139  *
140  * Note: Once an interrupt is unregistered it will enter infinite loop once
141  * an interrupt occurs
142  *
143  * \return      None.
144  **/
145 void Intc_IntUnregister(uint16_t intrNum);
147 /**
148  * \brief   This API assigns a priority to an interrupt and routes it to
149  *          either IRQ or to FIQ. Priority 0 is the highest priority level
150  *          Among the host interrupts, FIQ has more priority than IRQ.
151  *
152  * \param   intrNum  - Interrupt number
153  * \param   priority - Interrupt priority level
154  * \param   hostIntRoute - The host interrupt IRQ/FIQ to which the interrupt
155  *                         is to be routed.
156  *     'priority' can take any value from 0 to 127, 0 being the highest and
157  *     127 being the lowest priority.
158  *
159  *     'hostIntRoute' can take one of the following values \n
160  *             ROUTE_IRQ - To route the interrupt to IRQ \n
161  *             ROUTE_FIQ - To route the interrupt to FIQ
162  *
163  * \return  None.
164  *
165  **/
166 void Intc_IntPrioritySet(uint16_t intrNum, uint16_t priority,
167                          uint8_t hostIntRoute);
169 /**
170  * \brief   This API enables the system interrupt in INTC. However, for
171  *          the interrupt generation, make sure that the interrupt is
172  *          enabled at the peripheral level also.
173  *
174  * \param   intrNum  - Interrupt number
175  *
176  * \return  None.
177  *
178  **/
179 void Intc_SystemEnable(uint16_t intrNum);
181 /**
182  * \brief   This API disables the system interrupt in INTC.
183  *
184  * \param   intrNum  - Interrupt number
185  *
186  * \return  None.
187  *
188  **/
189 void Intc_SystemDisable(uint16_t intrNum);
191 /**
192  * \brief  Read and save the stasus and Disables the processor IRQ .
193  *         Prevents the processor to respond to IRQs.
194  *
195  * \param    None
196  *
197  * \return   Current status of IRQ
198  *
199  *
200  **/
201 uint8_t Intc_IntDisable(void);
203 /**
204  * \brief  Restore the processor IRQ only status. This does not affect
205  *          the set of interrupts enabled/disabled in the AINTC.
206  *
207  * \param    The status returned by the IntDisable fundtion.
208  *
209  * \return   None
210  *
211  **/
212 void Intc_IntEnable(uint8_t status);
214 /**
215  * \brief   This API clears the pending system interrupt in INTC.
216  **/
217 void Intc_IntClrPend(uint16_t intrNum);
219 #ifdef __cplusplus
221 #endif
222 #endif
223 /********************************* End of file ******************************/