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
//! DCCISW (*Clean and Invalidate Data or Unified cache line by Set/Way.*)
use arbitrary_int::u3;
use crate::register::{SysReg, SysRegWrite};
#[derive(Debug, Copy, Clone)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Dccisw(pub u32);
impl Dccisw {
/// Create DCCISW value for cache cleaning and invalidation by set and way.
///
/// ## Generics
///
/// - A: log2(ASSOCIATIVITY) rounded up to the next integer if necessary. For example, a 4-way
/// associative cache will have a value of 2 and a 8-way associative cache will have a value of
/// 3.
/// - N: log2(LINE LENGTH). For example, a 32-byte line length (4 words) will have a value of
/// 5.
#[inline]
pub const fn new<const A: usize, const N: usize>(way: u8, set: u16, level: u3) -> Self {
Self(super::dc_sw_ops::new::<A, N>(way, set, level))
}
/// Create DCCISW value for cache cleaning and invalidation by set and way.
/// Returns [None] on invalid input.
///
/// # Arguments
///
/// - a: log2(ASSOCIATIVITY) rounded up to the next integer if necessary. For example, a 4-way
/// associative cache will have a value of 2 and a 8-way associative cache will have a value of
/// 3.
/// - n: log2(LINE LENGTH). For example, a 32-byte line length (4 words) will have a value of
/// 5.
#[inline]
pub const fn new_with_offsets(a: usize, way: u8, n: usize, set: u16, level: u3) -> Self {
Self(super::dc_sw_ops::new_with_offsets(a, way, n, set, level))
}
}
impl SysReg for Dccisw {
const CP: u32 = 15;
const CRN: u32 = 7;
const OP1: u32 = 0;
const CRM: u32 = 14;
const OP2: u32 = 2;
}
impl crate::register::SysRegWrite for Dccisw {}
impl Dccisw {
#[inline]
/// Writes DCCISW (*Clean and Invalidate data or unified cache line by set/way.*)
///
/// # Safety
///
/// Ensure that this value is appropriate for this register
pub unsafe fn write(value: Self) {
unsafe {
<Self as SysRegWrite>::write_raw(value.0);
}
}
}