]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RX100-RSK_Renesas_e2studio/RTOSDemo/Renesas_Files/r_bsp/board/rskrx111/vecttbl.c
Commit 3 RX100 low power demos.
[freertos] / FreeRTOS / Demo / RX100-RSK_Renesas_e2studio / RTOSDemo / Renesas_Files / r_bsp / board / rskrx111 / vecttbl.c
1 /***********************************************************************************************************************\r
2 * DISCLAIMER\r
3 * This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products. No\r
4 * other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all\r
5 * applicable laws, including copyright laws.\r
6 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING\r
7 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,\r
8 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED. TO THE MAXIMUM\r
9 * EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES\r
10 * SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS\r
11 * SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\r
12 * Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of\r
13 * this software. By using this software, you agree to the additional terms and conditions found by accessing the\r
14 * following link:\r
15 * http://www.renesas.com/disclaimer\r
16 *\r
17 * Copyright (C) 2012 Renesas Electronics Corporation. All rights reserved.\r
18 ***********************************************************************************************************************/\r
19 /***********************************************************************************************************************\r
20 * File Name        : vecttbl.c\r
21 * Device(s)    : RX11x\r
22 * Description  : Definition of the fixed vector table and option setting memory.\r
23 ***********************************************************************************************************************/\r
24 /***********************************************************************************************************************\r
25 * History : DD.MM.YYYY Version  Description\r
26 *         : 08.11.2012 0.01     Beta Release\r
27 ***********************************************************************************************************************/\r
28 \r
29 /***********************************************************************************************************************\r
30 Includes   <System Includes> , "Project Includes"\r
31 ***********************************************************************************************************************/\r
32 /* Fixed size integers. */\r
33 #include <stdint.h>\r
34 /* Used for nop(). */\r
35 #include <machine.h>\r
36 /* BSP configuration. */\r
37 #include "platform.h"\r
38 \r
39 #pragma section IntPRG\r
40 \r
41 /***********************************************************************************************************************\r
42 * Function name: PowerON_Reset_PC\r
43 * Description  : The reset vector points to this function.  Code execution starts in this function after reset.\r
44 * Arguments    : none\r
45 * Return value : none\r
46 ***********************************************************************************************************************/\r
47 extern void PowerON_Reset_PC(void);\r
48 \r
49 /***********************************************************************************************************************\r
50 * Function name: excep_supervisor_inst_isr\r
51 * Description  : Supervisor Instruction Violation ISR\r
52 * Arguments    : none\r
53 * Return Value : none\r
54 ***********************************************************************************************************************/\r
55 #pragma interrupt (excep_supervisor_inst_isr)\r
56 void excep_supervisor_inst_isr(void)\r
57 {\r
58     /* If the user defined a callback function in r_bsp_config.h then it will be called here. */\r
59 #if defined(EXCEP_SUPERVISOR_ISR_CALLBACK)\r
60     EXCEP_SUPERVISOR_ISR_CALLBACK();\r
61 \r
62     /* If you do not put the MCU in Supervisor mode before returning then it will just execute the same violating\r
63        instruction again and come back in here. Since the PSW is restored from the stack when returning from the\r
64        exception, you would need to alter the saved PSW on the stack to change to Supervisor mode. We do not do this\r
65        here because the only 'safe' way to do this would be to write this function in assembly. Even then most users\r
66        would probably want to handle this someway instead of just going back to the application. */\r
67 #else\r
68     brk();\r
69 #endif\r
70 }\r
71 \r
72 /***********************************************************************************************************************\r
73 * Function name: excep_undefined_inst_isr\r
74 * Description  : Undefined instruction exception ISR\r
75 * Arguments    : none\r
76 * Return Value : none\r
77 ***********************************************************************************************************************/\r
78 #pragma interrupt (excep_undefined_inst_isr)\r
79 void excep_undefined_inst_isr(void)\r
80 {\r
81     /* If the user defined a callback function in r_bsp_config.h then it will be called here. */\r
82 #if defined(EXCEP_UNDEFINED_INSTR_ISR_CALLBACK)\r
83     EXCEP_UNDEFINED_INSTR_ISR_CALLBACK();\r
84 #else\r
85     brk();\r
86 #endif\r
87 }\r
88 \r
89 /***********************************************************************************************************************\r
90 * Function name: non_maskable_isr\r
91 * Description  : Non-maskable interrupt ISR\r
92 * Arguments    : none\r
93 * Return Value : none\r
94 ***********************************************************************************************************************/\r
95 #pragma interrupt (non_maskable_isr)\r
96 void non_maskable_isr(void)\r
97 {\r
98     /* If the user defined a callback function in r_bsp_config.h then it will be called here. */\r
99 #if defined(NMI_ISR_CALLBACK)\r
100     NMI_ISR_CALLBACK();\r
101 \r
102     /* Clear NMI flag. */\r
103     ICU.NMICLR.BIT.NMICLR = 1;\r
104 #else\r
105     brk();\r
106 #endif\r
107 }\r
108 \r
109 /***********************************************************************************************************************\r
110 * Function name: undefined_interrupt_source_isr\r
111 * Description  : All undefined interrupt vectors point to this function.\r
112 *                Set a breakpoint in this function to determine which source is creating unwanted interrupts.\r
113 * Arguments    : none\r
114 * Return Value : none\r
115 ***********************************************************************************************************************/\r
116 #pragma interrupt (undefined_interrupt_source_isr)\r
117 void undefined_interrupt_source_isr(void)\r
118 {\r
119     /* If the user defined a callback function in r_bsp_config.h then it will be called here. */\r
120 #if defined(UNDEFINED_INT_ISR_CALLBACK)\r
121     UNDEFINED_INT_ISR_CALLBACK();\r
122 #else\r
123     brk();\r
124 #endif\r
125 }\r
126 \r
127 /***********************************************************************************************************************\r
128 * Function name: bus_error_isr\r
129 * Description  : By default, this demo code enables the Bus Error Interrupt. This interrupt will fire if the user tries\r
130 *                to access code or data from one of the reserved areas in the memory map, including the areas covered\r
131 *                by disabled chip selects. A nop() statement is included here as a convenient place to set a breakpoint\r
132 *                during debugging and development, and further handling should be added by the user for their\r
133 *                application.\r
134 * Arguments    : none\r
135 * Return value : none\r
136 ***********************************************************************************************************************/\r
137 #pragma interrupt (bus_error_isr(vect=VECT(BSC,BUSERR)))\r
138 void bus_error_isr (void)\r
139 {\r
140     /* Clear the bus error */\r
141     BSC.BERCLR.BIT.STSCLR = 1;\r
142 \r
143     /*\r
144         To find the address that was accessed when the bus error occurred, read the register BSC.BERSR2.WORD.  The upper\r
145         13 bits of this register contain the upper 13-bits of the offending address (in 512K byte units)\r
146     */\r
147 \r
148     /* If the user defined a callback function in r_bsp_config.h then it will be called here. */\r
149 #if defined(BUS_ERROR_ISR_CALLBACK)\r
150     BUS_ERROR_ISR_CALLBACK();\r
151 #else\r
152     nop();\r
153 #endif\r
154 }\r
155 \r
156 void Dummy( void )\r
157 {\r
158         brk();\r
159 }\r
160 \r
161 /***********************************************************************************************************************\r
162 * The following array fills in the endian and option function select registers, and the fixed vector table\r
163 * bytes.\r
164 ***********************************************************************************************************************/\r
165 #pragma section C FIXEDVECT\r
166 \r
167 void (*const Fixed_Vectors[])(void) = {\r
168 //;0xffffffd0  Exception(Supervisor Instruction)\r
169         excep_supervisor_inst_isr,\r
170 //;0xffffffd4  Reserved\r
171     Dummy,\r
172 //;0xffffffd8  Reserved\r
173     Dummy,\r
174 //;0xffffffdc  Exception(Undefined Instruction)\r
175     undefined_interrupt_source_isr,\r
176 //;0xffffffe0  Reserved\r
177     Dummy,\r
178 //;0xffffffe4  Reserved\r
179     Dummy,\r
180 //;0xffffffe8  Reserved\r
181     Dummy,\r
182 //;0xffffffec  Reserved\r
183     Dummy,\r
184 //;0xfffffff0  Reserved\r
185     Dummy,\r
186 //;0xfffffff4  Reserved\r
187     Dummy,\r
188 //;0xfffffff8  NMI\r
189     non_maskable_isr,\r
190 //;0xfffffffc  RESET\r
191 //;<<VECTOR DATA START (POWER ON RESET)>>\r
192 //;Power On Reset PC\r
193 PowerON_Reset_PC\r
194 //;<<VECTOR DATA END (POWER ON RESET)>>\r
195 };\r
196 \r
197 #pragma address _MDEreg=0xffffff80 // MDE register (Single Chip Mode)\r
198 #ifdef __BIG\r
199         const unsigned long _MDEreg = 0xfffffff8; // big\r
200 #else\r
201         const unsigned long _MDEreg = 0xffffffff; // little\r
202 #endif\r
203 \r
204 \r
205 \r
206 \r