1 /* 2 * Copyright (c) 2014 Wind River Systems, Inc. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 /** 8 * @file 9 * @brief ARCv2 auxiliary registers definitions 10 * 11 * 12 * Definitions for auxiliary registers. 13 */ 14 15 #ifndef ZEPHYR_INCLUDE_ARCH_ARC_V2_AUX_REGS_H_ 16 #define ZEPHYR_INCLUDE_ARCH_ARC_V2_AUX_REGS_H_ 17 18 #define _ARC_V2_LP_START 0x002 19 #define _ARC_V2_LP_END 0x003 20 #define _ARC_V2_IDENTITY 0x004 21 #define _ARC_V2_SEC_STAT 0x09 22 #define _ARC_V2_STATUS32 0x00a 23 #define _ARC_V2_STATUS32_P0 0x00b 24 #define _ARC_V2_USER_SP 0x00d 25 #define _ARC_V2_AUX_IRQ_CTRL 0x00e 26 #define _ARC_V2_IC_IVIC 0x010 27 #define _ARC_V2_IC_CTRL 0x011 28 #define _ARC_V2_IC_LIL 0x013 29 #define _ARC_V2_IC_IVIL 0x019 30 #define _ARC_V2_IC_DATA 0x01d 31 #define _ARC_V2_TMR0_COUNT 0x021 32 #define _ARC_V2_TMR0_CONTROL 0x022 33 #define _ARC_V2_TMR0_LIMIT 0x023 34 #define _ARC_V2_IRQ_VECT_BASE 0x025 35 #define _ARC_V2_IRQ_VECT_BASE_S 0x26 36 #define _ARC_V2_KERNEL_SP 0x38 37 #define _ARC_V2_SEC_U_SP 0x39 38 #define _ARC_V2_SEC_K_SP 0x3a 39 #define _ARC_V2_AUX_IRQ_ACT 0x043 40 #define _ARC_V2_DC_IVDC 0x047 41 #define _ARC_V2_DC_CTRL 0x048 42 #define _ARC_V2_DC_LDL 0x049 43 #define _ARC_V2_DC_IVDL 0x04a 44 #define _ARC_V2_DC_FLSH 0x04b 45 #define _ARC_V2_DC_FLDL 0x04c 46 #define _ARC_V2_EA_BUILD 0x065 47 #define _ARC_V2_VECBASE_AC_BUILD 0x068 48 #define _ARC_V2_FP_BUILD 0x06b 49 #define _ARC_V2_DPFP_BUILD 0x06c 50 #define _ARC_V2_MPU_BUILD 0x06d 51 #define _ARC_V2_RF_BUILD 0x06e 52 #define _ARC_V2_MMU_BUILD 0x06f 53 #define _ARC_V2_VECBASE_BUILD 0x071 54 #define _ARC_V2_D_CACHE_BUILD 0x072 55 #define _ARC_V2_DCCM_BUILD 0x074 56 #define _ARC_V2_TIMER_BUILD 0x075 57 #define _ARC_V2_AP_BUILD 0x076 58 #define _ARC_V2_I_CACHE_BUILD 0x077 59 #define _ARC_V2_ICCM_BUILD 0x078 60 #define _ARC_V2_MULTIPLY_BUILD 0x07b 61 #define _ARC_V2_SWAP_BUILD 0x07c 62 #define _ARC_V2_NORM_BUILD 0x07d 63 #define _ARC_V2_MINMAX_BUILD 0x07e 64 #define _ARC_V2_BARREL_BUILD 0x07f 65 #define _ARC_V2_ISA_CONFIG 0x0c1 66 #define _ARC_V2_SEP_BUILD 0x0c7 67 #define _ARC_V2_IRQ_BUILD 0x0f3 68 #define _ARC_V2_PCT_BUILD 0x0f5 69 #define _ARC_V2_CC_BUILD 0x0f6 70 #define _ARC_V2_TMR1_COUNT 0x100 71 #define _ARC_V2_TMR1_CONTROL 0x101 72 #define _ARC_V2_TMR1_LIMIT 0x102 73 #define _ARC_V2_S_TMR0_COUNT 0x106 74 #define _ARC_V2_S_TMR0_CONTROL 0x107 75 #define _ARC_V2_S_TMR0_LIMIT 0x108 76 #define _ARC_V2_S_TMR1_COUNT 0x109 77 #define _ARC_V2_S_TMR1_CONTROL 0x10a 78 #define _ARC_V2_S_TMR1_LIMIT 0x10b 79 #define _ARC_V2_IRQ_PRIO_PEND 0x200 80 #define _ARC_V2_AUX_IRQ_HINT 0x201 81 #define _ARC_V2_IRQ_PRIORITY 0x206 82 #define _ARC_V2_USTACK_TOP 0x260 83 #define _ARC_V2_USTACK_BASE 0x261 84 #define _ARC_V2_S_USTACK_TOP 0x262 85 #define _ARC_V2_S_USTACK_BASE 0x263 86 #define _ARC_V2_KSTACK_TOP 0x264 87 #define _ARC_V2_KSTACK_BASE 0x265 88 #define _ARC_V2_S_KSTACK_TOP 0x266 89 #define _ARC_V2_S_KSTACK_BASE 0x267 90 #define _ARC_V2_NSC_TABLE_TOP 0x268 91 #define _ARC_V2_NSC_TABLE_BASE 0x269 92 #define _ARC_V2_JLI_BASE 0x290 93 #define _ARC_V2_LDI_BASE 0x291 94 #define _ARC_V2_EI_BASE 0x292 95 #define _ARC_V2_ERET 0x400 96 #define _ARC_V2_ERSTATUS 0x402 97 #define _ARC_V2_ECR 0x403 98 #define _ARC_V2_EFA 0x404 99 #define _ARC_V2_ERSEC_STAT 0x406 100 #define _ARC_V2_ICAUSE 0x40a 101 #define _ARC_V2_IRQ_SELECT 0x40b 102 #define _ARC_V2_IRQ_ENABLE 0x40c 103 #define _ARC_V2_IRQ_TRIGGER 0x40d 104 #define _ARC_V2_IRQ_STATUS 0x40f 105 #define _ARC_V2_IRQ_PULSE_CANCEL 0x415 106 #define _ARC_V2_IRQ_PENDING 0x416 107 #define _ARC_V2_FPU_CTRL 0x300 108 #define _ARC_V2_FPU_STATUS 0x301 109 #define _ARC_V2_FPU_DPFP1L 0x302 110 #define _ARC_V2_FPU_DPFP1H 0x303 111 #define _ARC_V2_FPU_DPFP2L 0x304 112 #define _ARC_V2_FPU_DPFP2H 0x305 113 #define _ARC_V2_MPU_EN 0x409 114 #define _ARC_V2_MPU_RDB0 0x422 115 #define _ARC_V2_MPU_RDP0 0x423 116 #define _ARC_V2_MPU_INDEX 0x448 117 #define _ARC_V2_MPU_RSTART 0x449 118 #define _ARC_V2_MPU_REND 0x44A 119 #define _ARC_V2_MPU_RPER 0x44B 120 #define _ARC_V2_MPU_PROBE 0x44C 121 122 /* STATUS32/STATUS32_P0 bits */ 123 #define _ARC_V2_STATUS32_H (1 << 0) 124 #define Z_ARC_V2_STATUS32_E(x) ((x) << 1) 125 #define _ARC_V2_STATUS32_AE_BIT 5 126 #define _ARC_V2_STATUS32_AE (1 << _ARC_V2_STATUS32_AE_BIT) 127 #define _ARC_V2_STATUS32_DE (1 << 6) 128 #define _ARC_V2_STATUS32_U_BIT 7 129 #define _ARC_V2_STATUS32_U (1 << _ARC_V2_STATUS32_U_BIT) 130 #define _ARC_V2_STATUS32_V (1 << 8) 131 #define _ARC_V2_STATUS32_C (1 << 9) 132 #define _ARC_V2_STATUS32_N (1 << 10) 133 #define _ARC_V2_STATUS32_Z (1 << 11) 134 #define _ARC_V2_STATUS32_L (1 << 12) 135 #define _ARC_V2_STATUS32_DZ_BIT 13 136 #define _ARC_V2_STATUS32_DZ (1 << _ARC_V2_STATUS32_DZ_BIT) 137 #define _ARC_V2_STATUS32_SC_BIT 14 138 #define _ARC_V2_STATUS32_SC (1 << _ARC_V2_STATUS32_SC_BIT) 139 #define _ARC_V2_STATUS32_ES (1 << 15) 140 #define _ARC_V2_STATUS32_RB(x) ((x) << 16) 141 #define _ARC_V2_STATUS32_AD_BIT 19 142 #define _ARC_V2_STATUS32_AD (1 << _ARC_V2_STATUS32_AD_BIT) 143 #define _ARC_V2_STATUS32_US_BIT 20 144 #define _ARC_V2_STATUS32_US (1 << _ARC_V2_STATUS32_US_BIT) 145 #define _ARC_V2_STATUS32_S_BIT 21 146 #define _ARC_V2_STATUS32_S (1 << _ARC_V2_STATUS32_US_BIT) 147 #define _ARC_V2_STATUS32_IE (1 << 31) 148 149 /* SEC_STAT bits */ 150 #define _ARC_V2_SEC_STAT_SSC_BIT 0 151 #define _ARC_V2_SEC_STAT_SSC (1 << _ARC_V2_SEC_STAT_SSC_BIT) 152 #define _ARC_V2_SEC_STAT_NSRT_BIT 1 153 #define _ARC_V2_SEC_STAT_NSRT (1 << _ARC_V2_SEC_STAT_NSRT_BIT) 154 #define _ARC_V2_SEC_STAT_NSRU_BIT 2 155 #define _ARC_V2_SEC_STAT_NSRU (1 << _ARC_V2_SEC_STAT_NSRU_BIT) 156 #define _ARC_V2_SEC_STAT_IRM_BIT 3 157 #define _ARC_V2_SEC_STAT_IRM (1 << _ARC_V2_SEC_STAT_IRM_BIT) 158 #define _ARC_V2_SEC_STAT_SUE_BIT 4 159 #define _ARC_V2_SEC_STAT_SUE (1 << _ARC_V2_SEC_STAT_SUE_BIT) 160 #define _ARC_V2_SEC_STAT_NIC_BIT 5 161 #define _ARC_V2_SEC_STAT_NIC (1 << _ARC_V2_SEC_STAT_NIC_BIT) 162 163 /* interrupt related bits */ 164 #define _ARC_V2_IRQ_PRIORITY_SECURE 0x100 165 166 /* exception cause register masks */ 167 #define Z_ARC_V2_ECR_VECTOR(X) ((X & 0xff0000) >> 16) 168 #define Z_ARC_V2_ECR_CODE(X) ((X & 0xff00) >> 8) 169 #define Z_ARC_V2_ECR_PARAMETER(X) (X & 0xff) 170 171 #ifndef _ASMLANGUAGE 172 173 #include <zephyr/types.h> 174 #if defined(__CCAC__) 175 176 #define z_arc_v2_aux_reg_read(reg) _lr((volatile uint32_t)reg) 177 #define z_arc_v2_aux_reg_write(reg, val) \ 178 _sr((unsigned int)val, (volatile uint32_t)reg) 179 180 #else /* ! __CCAC__ */ 181 182 #define z_arc_v2_aux_reg_read(reg) __builtin_arc_lr((volatile uint32_t)reg) 183 #define z_arc_v2_aux_reg_write(reg, val) \ 184 __builtin_arc_sr((unsigned int)val, (volatile uint32_t)reg) 185 186 #endif /* __CCAC__ */ 187 #endif /* _ASMLANGUAGE */ 188 189 #define z_arc_v2_core_id() \ 190 ({ \ 191 unsigned int __ret; \ 192 __asm__ __volatile__("lr %0, [%1]\n" \ 193 "xbfu %0, %0, 0xe8\n" \ 194 : "=r"(__ret) \ 195 : "i"(_ARC_V2_IDENTITY)); \ 196 __ret; \ 197 }) 198 199 #endif /* ZEPHYR_INCLUDE_ARCH_ARC_V2_AUX_REGS_H_ */ 200