1 /******************************************************************************
3 * Copyright (C) 2014 Xilinx, Inc. All rights reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to deal
7 * in the Software without restriction, including without limitation the rights
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * Use of the Software is limited solely to applications:
16 * (a) running on a Xilinx device, or
17 * (b) that interact with a Xilinx device through a bus or interconnect.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
24 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 * Except as contained in this notice, the name of the Xilinx shall not be used
28 * in advertising or otherwise to promote the sale, use or other dealings in
29 * this Software without prior written authorization from Xilinx.
31 ******************************************************************************/
32 /****************************************************************************/
35 * @file xil_exception.c
37 * This file contains low-level driver functions for the Cortex A53 exception
41 * MODIFICATION HISTORY:
43 * Ver Who Date Changes
44 * ----- -------- -------- -----------------------------------------------
45 * 5.00 pkp 05/29/14 First release
48 *****************************************************************************/
50 /***************************** Include Files ********************************/
52 #include "xil_types.h"
53 #include "xil_assert.h"
54 #include "xil_exception.h"
55 #include "xpseudo_asm.h"
57 /************************** Constant Definitions ****************************/
59 /**************************** Type Definitions ******************************/
62 Xil_ExceptionHandler Handler;
64 } XExc_VectorTableEntry;
66 /***************** Macros (Inline Functions) Definitions ********************/
68 /************************** Function Prototypes *****************************/
70 static void Xil_ExceptionNullHandler(void *Data);
72 /************************** Variable Definitions *****************************/
74 * Exception vector table to store handlers for each exception vector.
76 XExc_VectorTableEntry XExc_VectorTable[XIL_EXCEPTION_ID_LAST + 1] =
78 {Xil_ExceptionNullHandler, NULL},
79 {Xil_SyncAbortHandler, NULL},
80 {Xil_ExceptionNullHandler, NULL},
81 {Xil_ExceptionNullHandler, NULL},
82 {Xil_SErrorAbortHandler, NULL},
85 /****************************************************************************/
88 * This function is a stub Handler that is the default Handler that gets called
89 * if the application has not setup a Handler for a specific exception. The
90 * function interface has to match the interface specified for a Handler even
91 * though none of the arguments are used.
93 * @param Data is unused by this function.
99 *****************************************************************************/
100 static void Xil_ExceptionNullHandler(void *Data)
103 DieLoop: goto DieLoop;
106 /****************************************************************************/
109 * The function is a common API used to initialize exception handlers across all
110 * processors supported. For ARM CortexA53, the exception handlers are being
111 * initialized statically and hence this function does not do anything.
120 *****************************************************************************/
121 void Xil_ExceptionInit(void)
126 /*****************************************************************************/
129 * Makes the connection between the Id of the exception source and the
130 * associated Handler that is to run when the exception is recognized. The
131 * argument provided in this call as the Data is used as the argument
132 * for the Handler when it is called.
134 * @param exception_id contains the ID of the exception source and should
135 * be in the range of 0 to XIL_EXCEPTION_ID_LAST.
136 See xil_exception_l.h for further information.
137 * @param Handler to the Handler for that exception.
138 * @param Data is a reference to Data that will be passed to the
139 * Handler when it gets called.
145 ****************************************************************************/
146 void Xil_ExceptionRegisterHandler(u32 Exception_id,
147 Xil_ExceptionHandler Handler,
150 XExc_VectorTable[Exception_id].Handler = Handler;
151 XExc_VectorTable[Exception_id].Data = Data;
154 /*****************************************************************************/
157 * Removes the Handler for a specific exception Id. The stub Handler is then
158 * registered for this exception Id.
160 * @param exception_id contains the ID of the exception source and should
161 * be in the range of 0 to XIL_EXCEPTION_ID_LAST.
162 * See xil_exception_l.h for further information.
168 ****************************************************************************/
169 void Xil_ExceptionRemoveHandler(u32 Exception_id)
171 Xil_ExceptionRegisterHandler(Exception_id,
172 Xil_ExceptionNullHandler,
175 /*****************************************************************************/
178 * Default Synchronous abort handler which prints a debug message on console if
179 * Debug flag is enabled
187 ****************************************************************************/
189 void Xil_SyncAbortHandler(void *CallBackRef){
190 xdbg_printf(XDBG_DEBUG_ERROR, "Synchronous abort \n");
196 /*****************************************************************************/
199 * Default SError abort handler which prints a debug message on console if
200 * Debug flag is enabled
208 ****************************************************************************/
209 void Xil_SErrorAbortHandler(void *CallBackRef){
210 xdbg_printf(XDBG_DEBUG_ERROR, "Synchronous abort \n");