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 ******************************************************************************/
32 /*****************************************************************************/
35 * @file xreg_cortexr5.h
37 * This header file contains definitions for using inline assembler code. It is
38 * written specifically for the GNU, IAR, ARMCC compiler.
40 * All of the ARM Cortex R5 GPRs, SPRs, and Debug Registers are defined along
41 * with the positions of the bits within the registers.
44 * MODIFICATION HISTORY:
46 * Ver Who Date Changes
47 * ----- -------- -------- -----------------------------------------------
48 * 5.00 pkp 02/10/14 Initial version
51 ******************************************************************************/
52 #ifndef XREG_CORTEXR5_H /* prevent circular inclusions */
53 #define XREG_CORTEXR5_H /* by using protection macros */
57 #endif /* __cplusplus */
70 #define XREG_GPR10 r10
71 #define XREG_GPR11 r11
72 #define XREG_GPR12 r12
73 #define XREG_GPR13 r13
74 #define XREG_GPR14 r14
75 #define XREG_GPR15 r15
76 #define XREG_CPSR cpsr
78 /* Coprocessor number defines */
96 /* Coprocessor control register defines */
107 #define XREG_CR10 cr10
108 #define XREG_CR11 cr11
109 #define XREG_CR12 cr12
110 #define XREG_CR13 cr13
111 #define XREG_CR14 cr14
112 #define XREG_CR15 cr15
114 /* Current Processor Status Register (CPSR) Bits */
115 #define XREG_CPSR_THUMB_MODE 0x20U
116 #define XREG_CPSR_MODE_BITS 0x1FU
117 #define XREG_CPSR_SYSTEM_MODE 0x1FU
118 #define XREG_CPSR_UNDEFINED_MODE 0x1BU
119 #define XREG_CPSR_DATA_ABORT_MODE 0x17U
120 #define XREG_CPSR_SVC_MODE 0x13U
121 #define XREG_CPSR_IRQ_MODE 0x12U
122 #define XREG_CPSR_FIQ_MODE 0x11U
123 #define XREG_CPSR_USER_MODE 0x10U
125 #define XREG_CPSR_IRQ_ENABLE 0x80U
126 #define XREG_CPSR_FIQ_ENABLE 0x40U
128 #define XREG_CPSR_N_BIT 0x80000000U
129 #define XREG_CPSR_Z_BIT 0x40000000U
130 #define XREG_CPSR_C_BIT 0x20000000U
131 #define XREG_CPSR_V_BIT 0x10000000U
133 /*MPU region definitions*/
134 #define REGION_32B 0x00000004U
135 #define REGION_64B 0x00000005U
136 #define REGION_128B 0x00000006U
137 #define REGION_256B 0x00000007U
138 #define REGION_512B 0x00000008U
139 #define REGION_1K 0x00000009U
140 #define REGION_2K 0x0000000AU
141 #define REGION_4K 0x0000000BU
142 #define REGION_8K 0x0000000CU
143 #define REGION_16K 0x0000000DU
144 #define REGION_32K 0x0000000EU
145 #define REGION_64K 0x0000000FU
146 #define REGION_128K 0x00000010U
147 #define REGION_256K 0x00000011U
148 #define REGION_512K 0x00000012U
149 #define REGION_1M 0x00000013U
150 #define REGION_2M 0x00000014U
151 #define REGION_4M 0x00000015U
152 #define REGION_8M 0x00000016U
153 #define REGION_16M 0x00000017U
154 #define REGION_32M 0x00000018U
155 #define REGION_64M 0x00000019U
156 #define REGION_128M 0x0000001AU
157 #define REGION_256M 0x0000001BU
158 #define REGION_512M 0x0000001CU
159 #define REGION_1G 0x0000001DU
160 #define REGION_2G 0x0000001EU
161 #define REGION_4G 0x0000001FU
163 #define REGION_EN 0x00000001U
167 #define SHAREABLE 0x00000004U /*shareable */
168 #define STRONG_ORDERD_SHARED 0x00000000U /*strongly ordered, always shareable*/
170 #define DEVICE_SHARED 0x00000001U /*device, shareable*/
171 #define DEVICE_NONSHARED 0x00000010U /*device, non shareable*/
173 #define NORM_NSHARED_WT_NWA 0x00000002U /*Outer and Inner write-through, no write-allocate non-shareable*/
174 #define NORM_SHARED_WT_NWA 0x00000006U /*Outer and Inner write-through, no write-allocate shareable*/
176 #define NORM_NSHARED_WB_NWA 0x00000003U /*Outer and Inner write-back, no write-allocate non shareable*/
177 #define NORM_SHARED_WB_NWA 0x00000007U /*Outer and Inner write-back, no write-allocate shareable*/
179 #define NORM_NSHARED_NCACHE 0x00000008U /*Outer and Inner Non cacheable non shareable*/
180 #define NORM_SHARED_NCACHE 0x0000000CU /*Outer and Inner Non cacheable shareable*/
182 #define NORM_NSHARED_WB_WA 0x0000000BU /*Outer and Inner write-back non shared*/
183 #define NORM_SHARED_WB_WA 0x0000000FU /*Outer and Inner write-back shared*/
185 /* inner and outer cache policies can be combined for different combinations */
187 #define NORM_IN_POLICY_NCACHE 0x00000020U /*inner non cacheable*/
188 #define NORM_IN_POLICY_WB_WA 0x00000021U /*inner write back write allocate*/
189 #define NORM_IN_POLICY_WT_NWA 0x00000022U /*inner write through no write allocate*/
190 #define NORM_IN_POLICY_WB_NWA 0x00000023U /*inner write back no write allocate*/
192 #define NORM_OUT_POLICY_NCACHE 0x00000020U /*outer non cacheable*/
193 #define NORM_OUT_POLICY_WB_WA 0x00000028U /*outer write back write allocate*/
194 #define NORM_OUT_POLICY_WT_NWA 0x00000030U /*outer write through no write allocate*/
195 #define NORM_OUT_POLICY_WB_NWA 0x00000038U /*outer write back no write allocate*/
197 #define NO_ACCESS (0x00000000U<<8U) /*No access*/
198 #define PRIV_RW_USER_NA (0x00000001U<<8U) /*Privileged access only*/
199 #define PRIV_RW_USER_RO (0x00000002U<<8U) /*Writes in User mode generate permission faults*/
200 #define PRIV_RW_USER_RW (0x00000003U<<8U) /*Full Access*/
201 #define PRIV_RO_USER_NA (0x00000005U<<8U) /*Privileged eead only*/
202 #define PRIV_RO_USER_RO (0x00000006U<<8U) /*Privileged/User read-only*/
204 #define EXECUTE_NEVER (0x00000001U<<12U) /* Bit 12*/
209 /* C0 Register defines */
210 #define XREG_CP15_MAIN_ID "p15, 0, %0, c0, c0, 0"
211 #define XREG_CP15_CACHE_TYPE "p15, 0, %0, c0, c0, 1"
212 #define XREG_CP15_TCM_TYPE "p15, 0, %0, c0, c0, 2"
213 #define XREG_CP15_TLB_TYPE "p15, 0, %0, c0, c0, 3"
214 #define XREG_CP15_MPU_TYPE "p15, 0, %0, c0, c0, 4"
215 #define XREG_CP15_MULTI_PROC_AFFINITY "p15, 0, %0, c0, c0, 5"
217 #define XREG_CP15_PROC_FEATURE_0 "p15, 0, %0, c0, c1, 0"
218 #define XREG_CP15_PROC_FEATURE_1 "p15, 0, %0, c0, c1, 1"
219 #define XREG_CP15_DEBUG_FEATURE_0 "p15, 0, %0, c0, c1, 2"
220 #define XREG_CP15_MEMORY_FEATURE_0 "p15, 0, %0, c0, c1, 4"
221 #define XREG_CP15_MEMORY_FEATURE_1 "p15, 0, %0, c0, c1, 5"
222 #define XREG_CP15_MEMORY_FEATURE_2 "p15, 0, %0, c0, c1, 6"
223 #define XREG_CP15_MEMORY_FEATURE_3 "p15, 0, %0, c0, c1, 7"
225 #define XREG_CP15_INST_FEATURE_0 "p15, 0, %0, c0, c2, 0"
226 #define XREG_CP15_INST_FEATURE_1 "p15, 0, %0, c0, c2, 1"
227 #define XREG_CP15_INST_FEATURE_2 "p15, 0, %0, c0, c2, 2"
228 #define XREG_CP15_INST_FEATURE_3 "p15, 0, %0, c0, c2, 3"
229 #define XREG_CP15_INST_FEATURE_4 "p15, 0, %0, c0, c2, 4"
230 #define XREG_CP15_INST_FEATURE_5 "p15, 0, %0, c0, c2, 5"
232 #define XREG_CP15_CACHE_SIZE_ID "p15, 1, %0, c0, c0, 0"
233 #define XREG_CP15_CACHE_LEVEL_ID "p15, 1, %0, c0, c0, 1"
234 #define XREG_CP15_AUXILARY_ID "p15, 1, %0, c0, c0, 7"
236 #define XREG_CP15_CACHE_SIZE_SEL "p15, 2, %0, c0, c0, 0"
238 /* C1 Register Defines */
239 #define XREG_CP15_SYS_CONTROL "p15, 0, %0, c1, c0, 0"
240 #define XREG_CP15_AUX_CONTROL "p15, 0, %0, c1, c0, 1"
241 #define XREG_CP15_CP_ACCESS_CONTROL "p15, 0, %0, c1, c0, 2"
244 /* XREG_CP15_CONTROL bit defines */
245 #define XREG_CP15_CONTROL_TE_BIT 0x40000000U
246 #define XREG_CP15_CONTROL_AFE_BIT 0x20000000U
247 #define XREG_CP15_CONTROL_TRE_BIT 0x10000000U
248 #define XREG_CP15_CONTROL_NMFI_BIT 0x08000000U
249 #define XREG_CP15_CONTROL_EE_BIT 0x02000000U
250 #define XREG_CP15_CONTROL_HA_BIT 0x00020000U
251 #define XREG_CP15_CONTROL_RR_BIT 0x00004000U
252 #define XREG_CP15_CONTROL_V_BIT 0x00002000U
253 #define XREG_CP15_CONTROL_I_BIT 0x00001000U
254 #define XREG_CP15_CONTROL_Z_BIT 0x00000800U
255 #define XREG_CP15_CONTROL_SW_BIT 0x00000400U
256 #define XREG_CP15_CONTROL_B_BIT 0x00000080U
257 #define XREG_CP15_CONTROL_C_BIT 0x00000004U
258 #define XREG_CP15_CONTROL_A_BIT 0x00000002U
259 #define XREG_CP15_CONTROL_M_BIT 0x00000001U
260 /* C2 Register Defines */
263 /* C3 Register Defines */
266 /* C4 Register Defines */
269 /* C5 Register Defines */
270 #define XREG_CP15_DATA_FAULT_STATUS "p15, 0, %0, c5, c0, 0"
271 #define XREG_CP15_INST_FAULT_STATUS "p15, 0, %0, c5, c0, 1"
273 #define XREG_CP15_AUX_DATA_FAULT_STATUS "p15, 0, %0, c5, c1, 0"
274 #define XREG_CP15_AUX_INST_FAULT_STATUS "p15, 0, %0, c5, c1, 1"
276 /* C6 Register Defines */
277 #define XREG_CP15_DATA_FAULT_ADDRESS "p15, 0, %0, c6, c0, 0"
278 #define XREG_CP15_INST_FAULT_ADDRESS "p15, 0, %0, c6, c0, 2"
280 #define XREG_CP15_MPU_REG_BASEADDR "p15, 0, %0, c6, c1, 0"
281 #define XREG_CP15_MPU_REG_SIZE_EN "p15, 0, %0, c6, c1, 2"
282 #define XREG_CP15_MPU_REG_ACCESS_CTRL "p15, 0, %0, c6, c1, 4"
284 #define XREG_CP15_MPU_MEMORY_REG_NUMBER "p15, 0, %0, c6, c2, 0"
286 /* C7 Register Defines */
287 #define XREG_CP15_NOP "p15, 0, %0, c7, c0, 4"
289 #define XREG_CP15_INVAL_IC_POU "p15, 0, %0, c7, c5, 0"
290 #define XREG_CP15_INVAL_IC_LINE_MVA_POU "p15, 0, %0, c7, c5, 1"
292 /* The CP15 register access below has been deprecated in favor of the new
293 * isb instruction in Cortex R5.
295 #define XREG_CP15_INST_SYNC_BARRIER "p15, 0, %0, c7, c5, 4"
296 #define XREG_CP15_INVAL_BRANCH_ARRAY "p15, 0, %0, c7, c5, 6"
297 #define XREG_CP15_INVAL_BRANCH_ARRAY_LINE "p15, 0, %0, c7, c5, 7"
299 #define XREG_CP15_INVAL_DC_LINE_MVA_POC "p15, 0, %0, c7, c6, 1"
300 #define XREG_CP15_INVAL_DC_LINE_SW "p15, 0, %0, c7, c6, 2"
303 #define XREG_CP15_CLEAN_DC_LINE_MVA_POC "p15, 0, %0, c7, c10, 1"
304 #define XREG_CP15_CLEAN_DC_LINE_SW "p15, 0, %0, c7, c10, 2"
306 #define XREG_CP15_INVAL_DC_ALL "p15, 0, %0, c15, c5, 0"
307 /* The next two CP15 register accesses below have been deprecated in favor
308 * of the new dsb and dmb instructions in Cortex R5.
310 #define XREG_CP15_DATA_SYNC_BARRIER "p15, 0, %0, c7, c10, 4"
311 #define XREG_CP15_DATA_MEMORY_BARRIER "p15, 0, %0, c7, c10, 5"
313 #define XREG_CP15_CLEAN_DC_LINE_MVA_POU "p15, 0, %0, c7, c11, 1"
315 #define XREG_CP15_NOP2 "p15, 0, %0, c7, c13, 1"
317 #define XREG_CP15_CLEAN_INVAL_DC_LINE_MVA_POC "p15, 0, %0, c7, c14, 1"
318 #define XREG_CP15_CLEAN_INVAL_DC_LINE_SW "p15, 0, %0, c7, c14, 2"
320 /* C8 Register Defines */
324 /* C9 Register Defines */
326 #define XREG_CP15_ATCM_REG_SIZE_ADDR "p15, 0, %0, c9, c1, 1"
327 #define XREG_CP15_BTCM_REG_SIZE_ADDR "p15, 0, %0, c9, c1, 0"
328 #define XREG_CP15_TCM_SELECTION "p15, 0, %0, c9, c2, 0"
330 #define XREG_CP15_PERF_MONITOR_CTRL "p15, 0, %0, c9, c12, 0"
331 #define XREG_CP15_COUNT_ENABLE_SET "p15, 0, %0, c9, c12, 1"
332 #define XREG_CP15_COUNT_ENABLE_CLR "p15, 0, %0, c9, c12, 2"
333 #define XREG_CP15_V_FLAG_STATUS "p15, 0, %0, c9, c12, 3"
334 #define XREG_CP15_SW_INC "p15, 0, %0, c9, c12, 4"
335 #define XREG_CP15_EVENT_CNTR_SEL "p15, 0, %0, c9, c12, 5"
337 #define XREG_CP15_PERF_CYCLE_COUNTER "p15, 0, %0, c9, c13, 0"
338 #define XREG_CP15_EVENT_TYPE_SEL "p15, 0, %0, c9, c13, 1"
339 #define XREG_CP15_PERF_MONITOR_COUNT "p15, 0, %0, c9, c13, 2"
341 #define XREG_CP15_USER_ENABLE "p15, 0, %0, c9, c14, 0"
342 #define XREG_CP15_INTR_ENABLE_SET "p15, 0, %0, c9, c14, 1"
343 #define XREG_CP15_INTR_ENABLE_CLR "p15, 0, %0, c9, c14, 2"
345 /* C10 Register Defines */
348 /* C11 Register Defines */
351 /* C12 Register Defines */
354 /* C13 Register Defines */
355 #define XREG_CP15_CONTEXT_ID "p15, 0, %0, c13, c0, 1"
356 #define USER_RW_THREAD_PID "p15, 0, %0, c13, c0, 2"
357 #define USER_RO_THREAD_PID "p15, 0, %0, c13, c0, 3"
358 #define USER_PRIV_THREAD_PID "p15, 0, %0, c13, c0, 4"
360 /* C14 Register Defines */
363 /* C15 Register Defines */
364 #define XREG_CP15_SEC_AUX_CTRL "p15, 0, %0, c15, c0, 0"
369 /* MPE register definitions */
370 #define XREG_FPSID c0
371 #define XREG_FPSCR c1
372 #define XREG_MVFR1 c6
373 #define XREG_MVFR0 c7
374 #define XREG_FPEXC c8
375 #define XREG_FPINST c9
376 #define XREG_FPINST2 c10
379 #define XREG_FPSID_IMPLEMENTER_BIT (24U)
380 #define XREG_FPSID_IMPLEMENTER_MASK (0x000000FFU << FPSID_IMPLEMENTER_BIT)
381 #define XREG_FPSID_SOFTWARE (0X00000001U << 23U)
382 #define XREG_FPSID_ARCH_BIT (16U)
383 #define XREG_FPSID_ARCH_MASK (0x0000000FU << FPSID_ARCH_BIT)
384 #define XREG_FPSID_PART_BIT (8U)
385 #define XREG_FPSID_PART_MASK (0x000000FFU << FPSID_PART_BIT)
386 #define XREG_FPSID_VARIANT_BIT (4U)
387 #define XREG_FPSID_VARIANT_MASK (0x0000000FU << FPSID_VARIANT_BIT)
388 #define XREG_FPSID_REV_BIT (0U)
389 #define XREG_FPSID_REV_MASK (0x0000000FU << FPSID_REV_BIT)
392 #define XREG_FPSCR_N_BIT (0X00000001U << 31U)
393 #define XREG_FPSCR_Z_BIT (0X00000001U << 30U)
394 #define XREG_FPSCR_C_BIT (0X00000001U << 29U)
395 #define XREG_FPSCR_V_BIT (0X00000001U << 28U)
396 #define XREG_FPSCR_QC (0X00000001U << 27U)
397 #define XREG_FPSCR_AHP (0X00000001U << 26U)
398 #define XREG_FPSCR_DEFAULT_NAN (0X00000001U << 25U)
399 #define XREG_FPSCR_FLUSHTOZERO (0X00000001U << 24U)
400 #define XREG_FPSCR_ROUND_NEAREST (0X00000000U << 22U)
401 #define XREG_FPSCR_ROUND_PLUSINF (0X00000001U << 22U)
402 #define XREG_FPSCR_ROUND_MINUSINF (0X00000002U << 22U)
403 #define XREG_FPSCR_ROUND_TOZERO (0X00000003U << 22U)
404 #define XREG_FPSCR_RMODE_BIT (22U)
405 #define XREG_FPSCR_RMODE_MASK (0X00000003U << FPSCR_RMODE_BIT)
406 #define XREG_FPSCR_STRIDE_BIT (20U)
407 #define XREG_FPSCR_STRIDE_MASK (0X00000003U << FPSCR_STRIDE_BIT)
408 #define XREG_FPSCR_LENGTH_BIT (16U)
409 #define XREG_FPSCR_LENGTH_MASK (0X00000007U << FPSCR_LENGTH_BIT)
410 #define XREG_FPSCR_IDC (0X00000001U << 7U)
411 #define XREG_FPSCR_IXC (0X00000001U << 4U)
412 #define XREG_FPSCR_UFC (0X00000001U << 3U)
413 #define XREG_FPSCR_OFC (0X00000001U << 2U)
414 #define XREG_FPSCR_DZC (0X00000001U << 1U)
415 #define XREG_FPSCR_IOC (0X00000001U << 0U)
418 #define XREG_MVFR0_RMODE_BIT (28U)
419 #define XREG_MVFR0_RMODE_MASK (0x0000000FU << XREG_MVFR0_RMODE_BIT)
420 #define XREG_MVFR0_SHORT_VEC_BIT (24U)
421 #define XREG_MVFR0_SHORT_VEC_MASK (0x0000000FU << XREG_MVFR0_SHORT_VEC_BIT)
422 #define XREG_MVFR0_SQRT_BIT (20U)
423 #define XREG_MVFR0_SQRT_MASK (0x0000000FU << XREG_MVFR0_SQRT_BIT)
424 #define XREG_MVFR0_DIVIDE_BIT (16U)
425 #define XREG_MVFR0_DIVIDE_MASK (0x0000000FU << XREG_MVFR0_DIVIDE_BIT)
426 #define XREG_MVFR0_EXEC_TRAP_BIT (12U)
427 #define XREG_MVFR0_EXEC_TRAP_MASK (0x0000000FU << XREG_MVFR0_EXEC_TRAP_BIT)
428 #define XREG_MVFR0_DP_BIT (8U)
429 #define XREG_MVFR0_DP_MASK (0x0000000FU << XREG_MVFR0_DP_BIT)
430 #define XREG_MVFR0_SP_BIT (4U)
431 #define XREG_MVFR0_SP_MASK (0x0000000FU << XREG_MVFR0_SP_BIT)
432 #define XREG_MVFR0_A_SIMD_BIT (0U)
433 #define XREG_MVFR0_A_SIMD_MASK (0x0000000FU << MVFR0_A_SIMD_BIT)
436 #define XREG_FPEXC_EX (0X00000001U << 31U)
437 #define XREG_FPEXC_EN (0X00000001U << 30U)
438 #define XREG_FPEXC_DEX (0X00000001U << 29U)
443 #endif /* __cplusplus */
445 #endif /* XREG_CORTEXR5_H */