From ab3bd67412c2783df0b92fd6987c181e6c06d7fd Mon Sep 17 00:00:00 2001 From: whitequark Date: Sat, 1 Oct 2016 07:56:34 +0000 Subject: [PATCH] Rust: style (NFC). --- artiq/runtime.rs/src/clock.rs | 22 +++++++++++----------- artiq/runtime.rs/src/kernel.rs | 8 ++++---- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/artiq/runtime.rs/src/clock.rs b/artiq/runtime.rs/src/clock.rs index 5644f472c..b9a0584b3 100644 --- a/artiq/runtime.rs/src/clock.rs +++ b/artiq/runtime.rs/src/clock.rs @@ -1,30 +1,30 @@ -use board::csr::timer0; +use board::csr; const INIT: u64 = ::core::i64::MAX as u64; const FREQ: u64 = ::board::csr::CONFIG_CLOCK_FREQUENCY as u64; pub fn init() { unsafe { - timer0::en_write(0); - timer0::load_write(INIT); - timer0::reload_write(INIT); - timer0::en_write(1); + csr::timer0::en_write(0); + csr::timer0::load_write(INIT); + csr::timer0::reload_write(INIT); + csr::timer0::en_write(1); } } pub fn get_ms() -> u64 { unsafe { - timer0::update_value_write(1); - (INIT - timer0::value_read()) / (FREQ / 1_000) + csr::timer0::update_value_write(1); + (INIT - csr::timer0::value_read()) / (FREQ / 1_000) } } pub fn spin_us(interval: u64) { unsafe { - timer0::update_value_write(1); - let threshold = timer0::value_read() - interval * (FREQ / 1_000_000); - while timer0::value_read() > threshold { - timer0::update_value_write(1) + csr::timer0::update_value_write(1); + let threshold = csr::timer0::value_read() - interval * (FREQ / 1_000_000); + while csr::timer0::value_read() > threshold { + csr::timer0::update_value_write(1) } } } diff --git a/artiq/runtime.rs/src/kernel.rs b/artiq/runtime.rs/src/kernel.rs index 06f9c4822..4967ec597 100644 --- a/artiq/runtime.rs/src/kernel.rs +++ b/artiq/runtime.rs/src/kernel.rs @@ -1,5 +1,5 @@ use core::ptr; -use board::csr::kernel_cpu; +use board::csr; use mailbox; const KERNELCPU_EXEC_ADDRESS: usize = 0x42000000; @@ -8,7 +8,7 @@ const KERNELCPU_LAST_ADDRESS: usize = (0x4fffffff - 1024*1024); const KSUPPORT_HEADER_SIZE: usize = 0x80; pub unsafe fn start() { - if kernel_cpu::reset_read() == 0 { + if csr::kernel_cpu::reset_read() == 0 { panic!("attempted to start kernel CPU when it is already running") } @@ -24,11 +24,11 @@ pub unsafe fn start() { (KERNELCPU_EXEC_ADDRESS - KSUPPORT_HEADER_SIZE) as *mut u8, ksupport_end - ksupport_start); - kernel_cpu::reset_write(0); + csr::kernel_cpu::reset_write(0); } pub fn stop() { - unsafe { kernel_cpu::reset_write(1) } + unsafe { csr::kernel_cpu::reset_write(1) } mailbox::acknowledge(); }