aboutsummaryrefslogtreecommitdiff
path: root/src/peripheral/cbp.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/peripheral/cbp.rs')
-rw-r--r--src/peripheral/cbp.rs24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/peripheral/cbp.rs b/src/peripheral/cbp.rs
index 292ba04..590cb7b 100644
--- a/src/peripheral/cbp.rs
+++ b/src/peripheral/cbp.rs
@@ -2,6 +2,8 @@
use volatile_register::WO;
+use peripheral::CBP;
+
/// Register block
#[repr(C)]
pub struct RegisterBlock {
@@ -33,10 +35,10 @@ 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 RegisterBlock {
+impl CBP {
/// I-cache invalidate all to PoU
#[inline]
- pub fn iciallu(&self) {
+ pub fn iciallu(&mut self) {
unsafe {
self.iciallu.write(0);
}
@@ -44,7 +46,7 @@ impl RegisterBlock {
/// I-cache invalidate by MVA to PoU
#[inline]
- pub fn icimvau(&self, mva: u32) {
+ pub fn icimvau(&mut self, mva: u32) {
unsafe {
self.icimvau.write(mva);
}
@@ -52,7 +54,7 @@ impl RegisterBlock {
/// D-cache invalidate by MVA to PoC
#[inline]
- pub fn dcimvac(&self, mva: u32) {
+ pub fn dcimvac(&mut self, mva: u32) {
unsafe {
self.dcimvac.write(mva);
}
@@ -62,7 +64,7 @@ impl RegisterBlock {
///
/// `set` is masked to be between 0 and 3, and `way` between 0 and 511.
#[inline]
- pub fn dcisw(&self, set: u16, way: u16) {
+ pub fn dcisw(&mut self, set: u16, way: u16) {
// The ARMv7-M Architecture Reference Manual, as of Revision E.b, says these set/way
// operations have a register data format which depends on the implementation's
// associativity and number of sets. Specifically the 'way' and 'set' fields have
@@ -82,7 +84,7 @@ impl RegisterBlock {
/// D-cache clean by MVA to PoU
#[inline]
- pub fn dccmvau(&self, mva: u32) {
+ pub fn dccmvau(&mut self, mva: u32) {
unsafe {
self.dccmvau.write(mva);
}
@@ -90,7 +92,7 @@ impl RegisterBlock {
/// D-cache clean by MVA to PoC
#[inline]
- pub fn dccmvac(&self, mva: u32) {
+ pub fn dccmvac(&mut self, mva: u32) {
unsafe {
self.dccmvac.write(mva);
}
@@ -100,7 +102,7 @@ impl RegisterBlock {
///
/// `set` is masked to be between 0 and 3, and `way` between 0 and 511.
#[inline]
- pub fn dccsw(&self, set: u16, way: u16) {
+ pub fn dccsw(&mut self, set: u16, way: u16) {
// See comment for dcisw() about the format here
unsafe {
self.dccsw.write(
@@ -112,7 +114,7 @@ impl RegisterBlock {
/// D-cache clean and invalidate by MVA to PoC
#[inline]
- pub fn dccimvac(&self, mva: u32) {
+ pub fn dccimvac(&mut self, mva: u32) {
unsafe {
self.dccimvac.write(mva);
}
@@ -122,7 +124,7 @@ impl RegisterBlock {
///
/// `set` is masked to be between 0 and 3, and `way` between 0 and 511.
#[inline]
- pub fn dccisw(&self, set: u16, way: u16) {
+ pub fn dccisw(&mut self, set: u16, way: u16) {
// See comment for dcisw() about the format here
unsafe {
self.dccisw.write(
@@ -134,7 +136,7 @@ impl RegisterBlock {
/// Branch predictor invalidate all
#[inline]
- pub fn bpiall(&self) {
+ pub fn bpiall(&mut self) {
unsafe {
self.bpiall.write(0);
}