1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
use volatile_register::WO;
use crate::peripheral::CBP;
#[repr(C)]
pub struct RegisterBlock {
pub iciallu: WO<u32>,
reserved0: u32,
pub icimvau: WO<u32>,
pub dcimvac: WO<u32>,
pub dcisw: WO<u32>,
pub dccmvau: WO<u32>,
pub dccmvac: WO<u32>,
pub dccsw: WO<u32>,
pub dccimvac: WO<u32>,
pub dccisw: WO<u32>,
pub bpiall: WO<u32>,
}
const CBP_SW_WAY_POS: u32 = 30;
const CBP_SW_WAY_MASK: u32 = 0x3 << CBP_SW_WAY_POS;
const CBP_SW_SET_POS: u32 = 5;
const CBP_SW_SET_MASK: u32 = 0x1FF << CBP_SW_SET_POS;
impl CBP {
#[inline]
pub fn iciallu(&mut self) {
unsafe {
self.iciallu.write(0);
}
}
#[inline]
pub fn icimvau(&mut self, mva: u32) {
unsafe {
self.icimvau.write(mva);
}
}
#[inline]
pub fn dcimvac(&mut self, mva: u32) {
unsafe {
self.dcimvac.write(mva);
}
}
#[inline]
pub fn dcisw(&mut self, set: u16, way: u16) {
unsafe {
self.dcisw.write(
((u32::from(way) & (CBP_SW_WAY_MASK >> CBP_SW_WAY_POS)) << CBP_SW_WAY_POS)
| ((u32::from(set) & (CBP_SW_SET_MASK >> CBP_SW_SET_POS)) << CBP_SW_SET_POS),
);
}
}
#[inline]
pub fn dccmvau(&mut self, mva: u32) {
unsafe {
self.dccmvau.write(mva);
}
}
#[inline]
pub fn dccmvac(&mut self, mva: u32) {
unsafe {
self.dccmvac.write(mva);
}
}
#[inline]
pub fn dccsw(&mut self, set: u16, way: u16) {
unsafe {
self.dccsw.write(
((u32::from(way) & (CBP_SW_WAY_MASK >> CBP_SW_WAY_POS)) << CBP_SW_WAY_POS)
| ((u32::from(set) & (CBP_SW_SET_MASK >> CBP_SW_SET_POS)) << CBP_SW_SET_POS),
);
}
}
#[inline]
pub fn dccimvac(&mut self, mva: u32) {
unsafe {
self.dccimvac.write(mva);
}
}
#[inline]
pub fn dccisw(&mut self, set: u16, way: u16) {
unsafe {
self.dccisw.write(
((u32::from(way) & (CBP_SW_WAY_MASK >> CBP_SW_WAY_POS)) << CBP_SW_WAY_POS)
| ((u32::from(set) & (CBP_SW_SET_MASK >> CBP_SW_SET_POS)) << CBP_SW_SET_POS),
);
}
}
#[inline]
pub fn bpiall(&mut self) {
unsafe {
self.bpiall.write(0);
}
}
}