Skip to content

Removed mutable borrow in readonly generic timer methods #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sh text eol=lf
8 changes: 4 additions & 4 deletions cortex-ar/src/generic_timer/el0.rs
Original file line number Diff line number Diff line change
@@ -30,11 +30,11 @@ impl super::GenericTimer for El0PhysicalTimer {
register::Cntfrq::read().0
}

fn counter(&mut self) -> u64 {
fn counter(&self) -> u64 {
register::CntPct::read().0
}

fn counter_compare(&mut self) -> u64 {
fn counter_compare(&self) -> u64 {
register::CntpCval::read().0
}

@@ -94,11 +94,11 @@ impl super::GenericTimer for El0VirtualTimer {
register::Cntfrq::read().0
}

fn counter(&mut self) -> u64 {
fn counter(&self) -> u64 {
register::CntVct::read().0
}

fn counter_compare(&mut self) -> u64 {
fn counter_compare(&self) -> u64 {
register::CntvCval::read().0
}

8 changes: 4 additions & 4 deletions cortex-ar/src/generic_timer/el1.rs
Original file line number Diff line number Diff line change
@@ -38,11 +38,11 @@ impl GenericTimer for El1PhysicalTimer {
self.0.frequency_hz()
}

fn counter(&mut self) -> u64 {
fn counter(&self) -> u64 {
self.0.counter()
}

fn counter_compare(&mut self) -> u64 {
fn counter_compare(&self) -> u64 {
self.0.counter_compare()
}

@@ -138,11 +138,11 @@ impl GenericTimer for El1VirtualTimer {
self.0.frequency_hz()
}

fn counter(&mut self) -> u64 {
fn counter(&self) -> u64 {
self.0.counter()
}

fn counter_compare(&mut self) -> u64 {
fn counter_compare(&self) -> u64 {
self.0.counter_compare()
}

12 changes: 6 additions & 6 deletions cortex-ar/src/generic_timer/el2.rs
Original file line number Diff line number Diff line change
@@ -34,11 +34,11 @@ impl GenericTimer for El2PhysicalTimer {
self.0.frequency_hz()
}

fn counter(&mut self) -> u64 {
fn counter(&self) -> u64 {
self.0.counter()
}

fn counter_compare(&mut self) -> u64 {
fn counter_compare(&self) -> u64 {
self.0.counter_compare()
}

@@ -105,11 +105,11 @@ impl GenericTimer for El2VirtualTimer {
self.0.frequency_hz()
}

fn counter(&mut self) -> u64 {
fn counter(&self) -> u64 {
self.0.counter()
}

fn counter_compare(&mut self) -> u64 {
fn counter_compare(&self) -> u64 {
self.0.counter_compare()
}

@@ -166,11 +166,11 @@ impl super::GenericTimer for El2HypPhysicalTimer {
register::Cntfrq::read().0
}

fn counter(&mut self) -> u64 {
fn counter(&self) -> u64 {
register::CntPct::read().0
}

fn counter_compare(&mut self) -> u64 {
fn counter_compare(&self) -> u64 {
register::CnthpCval::read().0
}

4 changes: 2 additions & 2 deletions cortex-ar/src/generic_timer/mod.rs
Original file line number Diff line number Diff line change
@@ -28,10 +28,10 @@ pub trait GenericTimer {
///
/// Note that speculative reads are allowed and reads may occur out of
/// order. Add ISB and DSB fences before/after this call as required.
fn counter(&mut self) -> u64;
fn counter(&self) -> u64;

/// Get the counter compare value.
fn counter_compare(&mut self) -> u64;
fn counter_compare(&self) -> u64;

/// Set the counter compare value.
///