1 /******************************************************************************
3 * Copyright (C) 2014 - 2015 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 ******************************************************************************/
34 #include "xil_types.h"
37 * _exit - Does not return.
39 * If R5 application runs in lock-step mode, the comparators are enabled by
40 * boot code after resetting the debug logic. The debugger does not have access
41 * while the R5 application is being run to avoid any intervention. After the
42 * application runs, the debug logic need to be taken out of reset for the
43 * debugger to gain access. Therefore the debug logic is enabled and
44 * comparators are disabled in case of R5 running in lock-step mode with
45 * debug logic reset in JTAG boot mode.
48 #define RPU_GLBL_CNTL_REG 0xFF9A0000U
49 #define RPU_ERR_INJ_REG 0xFF9A0020U
50 #define RST_LPD_DBG_REG 0xFF5E0240U
51 #define BOOT_MODE_USER_REG 0xFF5E0200U
53 #define lock_step 0x00000008U
54 #define fault_log_enable 0x00000101U
55 #define debug_reset 0x00000032U
56 #define jtag_boot 0x0000000FU
57 __attribute__((weak)) void _exit (sint32 status)
61 * Enables the debug logic and disable the comparators
62 * when in JTAG boot mode and R5 is in lock-step mode
63 * if the fault log is enabled
65 u32 debug_reg, err_inj_reg;
66 if((Xil_In32(BOOT_MODE_USER_REG) & jtag_boot) == 0){
67 if((Xil_In32(RPU_GLBL_CNTL_REG) & lock_step) == 0){
68 if((Xil_In32(RPU_ERR_INJ_REG) & fault_log_enable) != 0) {
69 if((Xil_In32(RST_LPD_DBG_REG) & debug_reset) != 0) {
70 err_inj_reg = Xil_In32(RPU_ERR_INJ_REG);
71 err_inj_reg = err_inj_reg & (~fault_log_enable);
72 Xil_Out32(RPU_ERR_INJ_REG, err_inj_reg);
74 debug_reg = Xil_In32(RST_LPD_DBG_REG);
75 debug_reg = debug_reg & (~debug_reset);
76 Xil_Out32(RST_LPD_DBG_REG, debug_reg);