Zephyr API Documentation
3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
cpu.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2018 Lexmark International, Inc.
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
#ifndef ZEPHYR_INCLUDE_ARCH_ARM_CORTEX_A_R_CPU_H_
8
#define ZEPHYR_INCLUDE_ARCH_ARM_CORTEX_A_R_CPU_H_
9
10
#if defined(CONFIG_ARM_MPU)
11
#include <
zephyr/arch/arm/cortex_a_r/mpu.h
>
12
#endif
13
14
/*
15
* SCTLR register bit assignments
16
*/
17
#define SCTLR_MPU_ENABLE (1 << 0)
18
19
#define MODE_USR 0x10
20
#define MODE_FIQ 0x11
21
#define MODE_IRQ 0x12
22
#define MODE_SVC 0x13
23
#define MODE_ABT 0x17
24
#define MODE_HYP 0x1a
25
#define MODE_UND 0x1b
26
#define MODE_SYS 0x1f
27
#define MODE_MASK 0x1f
28
29
#define E_BIT (1 << 9)
30
#define A_BIT (1 << 8)
31
#define I_BIT (1 << 7)
32
#define F_BIT (1 << 6)
33
#define T_BIT (1 << 5)
34
35
#define HIVECS (1 << 13)
36
37
#define CPACR_NA (0U)
38
#define CPACR_FA (3U)
39
40
#define CPACR_CP10(r) (r << 20)
41
#define CPACR_CP11(r) (r << 22)
42
43
#define FPEXC_EN (1 << 30)
44
45
#define DFSR_DOMAIN_SHIFT (4)
46
#define DFSR_DOMAIN_MASK (0xf)
47
#define DFSR_FAULT_4_MASK (1 << 10)
48
#define DFSR_WRITE_MASK (1 << 11)
49
#define DFSR_AXI_SLAVE_MASK (1 << 12)
50
51
/* Armv8-R AArch32 architecture profile */
52
#define VBAR_MASK (0xFFFFFFE0U)
53
#define SCTLR_M_BIT BIT(0)
54
#define SCTLR_A_BIT BIT(1)
55
#define SCTLR_C_BIT BIT(2)
56
#define SCTLR_I_BIT BIT(12)
57
58
/* Hyp System Control Register */
59
#define HSCTLR_RES1 (BIT(29) | BIT(28) | BIT(23) | \
60
BIT(22) | BIT(18) | BIT(16) | \
61
BIT(11) | BIT(4) | BIT(3))
62
63
/* Hyp Auxiliary Control Register */
64
#define HACTLR_CPUACTLR BIT(0)
65
#define HACTLR_CDBGDCI BIT(1)
66
#define HACTLR_FLASHIFREGIONR BIT(7)
67
#define HACTLR_PERIPHPREGIONR BIT(8)
68
#define HACTLR_QOSR_BIT BIT(9)
69
#define HACTLR_BUSTIMEOUTR_BIT BIT(10)
70
#define HACTLR_INTMONR_BIT BIT(12)
71
#define HACTLR_ERR_BIT BIT(13)
72
73
#define HACTLR_INIT (HACTLR_ERR_BIT | HACTLR_INTMONR_BIT | \
74
HACTLR_BUSTIMEOUTR_BIT | HACTLR_QOSR_BIT | \
75
HACTLR_PERIPHPREGIONR | HACTLR_FLASHIFREGIONR | \
76
HACTLR_CDBGDCI | HACTLR_CPUACTLR)
77
/* ARMv8 Timer */
78
#define CNTV_CTL_ENABLE_BIT BIT(0)
79
#define CNTV_CTL_IMASK_BIT BIT(1)
80
81
/* Interrupt Controller System Register Enable Register */
82
#define ICC_SRE_ELx_SRE_BIT BIT(0)
83
#define ICC_SRE_ELx_DFB_BIT BIT(1)
84
#define ICC_SRE_ELx_DIB_BIT BIT(2)
85
#define ICC_SRE_EL3_EN_BIT BIT(3)
86
87
/* MPIDR */
88
#define MPIDR_AFFLVL_MASK (0xff)
89
90
#define MPIDR_AFF0_SHIFT (0)
91
#define MPIDR_AFF1_SHIFT (8)
92
#define MPIDR_AFF2_SHIFT (16)
93
94
#define MPIDR_AFFLVL(mpidr, aff_level) \
95
(((mpidr) >> MPIDR_AFF##aff_level##_SHIFT) & MPIDR_AFFLVL_MASK)
96
97
#define GET_MPIDR() read_sysreg(mpidr)
98
#define MPIDR_TO_CORE(mpidr) MPIDR_AFFLVL(mpidr, 0)
99
100
/* ICC SGI macros */
101
#define SGIR_TGT_MASK (0xffff)
102
#define SGIR_AFF1_SHIFT (16)
103
#define SGIR_AFF2_SHIFT (32)
104
#define SGIR_AFF3_SHIFT (48)
105
#define SGIR_AFF_MASK (0xff)
106
#define SGIR_INTID_SHIFT (24)
107
#define SGIR_INTID_MASK (0xf)
108
#define SGIR_IRM_SHIFT (40)
109
#define SGIR_IRM_MASK (0x1)
110
#define SGIR_IRM_TO_AFF (0)
111
112
#define GICV3_SGIR_VALUE(_aff3, _aff2, _aff1, _intid, _irm, _tgt) \
113
((((uint64_t) (_aff3) & SGIR_AFF_MASK) << SGIR_AFF3_SHIFT) | \
114
(((uint64_t) (_irm) & SGIR_IRM_MASK) << SGIR_IRM_SHIFT) | \
115
(((uint64_t) (_aff2) & SGIR_AFF_MASK) << SGIR_AFF2_SHIFT) | \
116
(((_intid) & SGIR_INTID_MASK) << SGIR_INTID_SHIFT) | \
117
(((_aff1) & SGIR_AFF_MASK) << SGIR_AFF1_SHIFT) | \
118
((_tgt) & SGIR_TGT_MASK))
119
120
#endif
/* ZEPHYR_INCLUDE_ARCH_ARM_CORTEX_A_R_CPU_H_ */
mpu.h
zephyr
arch
arm
cortex_a_r
cpu.h
Generated on Fri Jul 26 2024 14:01:56 for Zephyr API Documentation by
1.9.6