]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_R5_UltraScale_MPSoC/RTOSDemo_R5_bsp/psu_cortexr5_0/libsrc/standalone_v5_4/src/xil_exception.c
Update some more standard demos for use on 64-bit architectures.
[freertos] / FreeRTOS / Demo / CORTEX_R5_UltraScale_MPSoC / RTOSDemo_R5_bsp / psu_cortexr5_0 / libsrc / standalone_v5_4 / src / xil_exception.c
1 /******************************************************************************
2 *
3 * Copyright (C) 2014 - 2015 Xilinx, Inc. All rights reserved.
4 *
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:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
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.
18 *
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
25 * SOFTWARE.
26 *
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.
30 *
31 ******************************************************************************/
32 /****************************************************************************/
33 /**
34 *
35 * @file xil_exception.c
36 *
37 * This file contains low-level driver functions for the Cortex R5 exception
38 * Handler.
39 *
40 * <pre>
41 * MODIFICATION HISTORY:
42 *
43 * Ver   Who      Date     Changes
44 * ----- -------- -------- -----------------------------------------------
45 * 5.00  pkp      02/20/14 First release
46 *
47 * </pre>
48 *
49 *****************************************************************************/
50
51 /***************************** Include Files ********************************/
52
53 #include "xil_types.h"
54 #include "xil_assert.h"
55 #include "xil_exception.h"
56 #include "xpseudo_asm.h"
57 #include "xdebug.h"
58 /************************** Constant Definitions ****************************/
59
60 /**************************** Type Definitions ******************************/
61
62 typedef struct {
63         Xil_ExceptionHandler Handler;
64         void *Data;
65 } XExc_VectorTableEntry;
66
67 /***************** Macros (Inline Functions) Definitions ********************/
68
69 /************************** Function Prototypes *****************************/
70 static void Xil_ExceptionNullHandler(void *Data);
71 /************************** Variable Definitions *****************************/
72 /*
73  * Exception vector table to store handlers for each exception vector.
74  */
75 XExc_VectorTableEntry XExc_VectorTable[XIL_EXCEPTION_ID_LAST + 1] =
76 {
77         {Xil_ExceptionNullHandler, NULL},
78         {Xil_ExceptionNullHandler, NULL},
79         {Xil_ExceptionNullHandler, NULL},
80         {Xil_PrefetchAbortHandler, NULL},
81         {Xil_DataAbortHandler, NULL},
82         {Xil_ExceptionNullHandler, NULL},
83         {Xil_ExceptionNullHandler, NULL},
84 };
85
86 /*****************************************************************************/
87
88 /****************************************************************************/
89 /**
90 *
91 * This function is a stub Handler that is the default Handler that gets called
92 * if the application has not setup a Handler for a specific  exception. The
93 * function interface has to match the interface specified for a Handler even
94 * though none of the arguments are used.
95 *
96 * @param        Data is unused by this function.
97 *
98 * @return       None.
99 *
100 * @note         None.
101 *
102 *****************************************************************************/
103 static void Xil_ExceptionNullHandler(void *Data)
104 {
105         (void *)Data;
106 DieLoop: goto DieLoop;
107 }
108
109 /****************************************************************************/
110 /**
111 * The function is a common API used to initialize exception handlers across all
112 * processors supported. For ARM CortexR5, the exception handlers are being
113 * initialized statically and hence this function does not do anything.
114 *
115 *
116 * @param        None.
117 *
118 * @return       None.
119 *
120 * @note         None.
121 *
122 *****************************************************************************/
123 void Xil_ExceptionInit(void)
124 {
125         return;
126 }
127
128 /*****************************************************************************/
129 /**
130 *
131 * Makes the connection between the Id of the exception source and the
132 * associated Handler that is to run when the exception is recognized. The
133 * argument provided in this call as the Data is used as the argument
134 * for the Handler when it is called.
135 *
136 * @param        exception_id contains the ID of the exception source and should
137 *               be in the range of 0 to XIL_EXCEPTION_ID_LAST.
138                 See xil_exception_l.h for further information.
139 * @param        Handler to the Handler for that exception.
140 * @param        Data is a reference to Data that will be passed to the
141 *               Handler when it gets called.
142 *
143 * @return       None.
144 *
145 * @note         None.
146 *
147 ****************************************************************************/
148 void Xil_ExceptionRegisterHandler(u32 Exception_id,
149                                     Xil_ExceptionHandler Handler,
150                                     void *Data)
151 {
152         XExc_VectorTable[Exception_id].Handler = Handler;
153         XExc_VectorTable[Exception_id].Data = Data;
154 }
155
156 /*****************************************************************************/
157 /**
158 *
159 * Removes the Handler for a specific exception Id. The stub Handler is then
160 * registered for this exception Id.
161 *
162 * @param        exception_id contains the ID of the exception source and should
163 *               be in the range of 0 to XIL_EXCEPTION_ID_LAST.
164 *               See xil_exception_l.h for further information.
165
166 * @return       None.
167 *
168 * @note         None.
169 *
170 ****************************************************************************/
171 void Xil_ExceptionRemoveHandler(u32 Exception_id)
172 {
173         Xil_ExceptionRegisterHandler(Exception_id,
174                                        Xil_ExceptionNullHandler,
175                                        NULL);
176 }
177 /*****************************************************************************/
178 /**
179 *
180 * Default Data abort handler which prints a debug message on console if
181 * Debug flag is enabled
182 *
183 * @param        None
184 *
185 * @return       None.
186 *
187 * @note         None.
188 *
189 ****************************************************************************/
190
191 void Xil_DataAbortHandler(void *CallBackRef){
192
193         xdbg_printf(XDBG_DEBUG_ERROR, "Data abort \n");
194         while(1) {
195                 ;
196         }
197 }
198
199 /*****************************************************************************/
200 /**
201 *
202 * Default Prefetch abort handler which printsa debug message on console if
203 * Debug flag is enabled
204 *
205 * @param        None
206 *
207 * @return       None.
208 *
209 * @note         None.
210 *
211 ****************************************************************************/
212 void Xil_PrefetchAbortHandler(void *CallBackRef){
213
214         xdbg_printf(XDBG_DEBUG_ERROR, "Prefetch abort \n");
215         while(1) {
216                 ;
217         }
218 }