From cb605cf014b35dc9d5a4f548ff38213eaa10ddfe Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 22 Feb 2018 11:17:23 +0800 Subject: [PATCH] use new misoc identifier --- artiq/firmware/libboard/lib.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/artiq/firmware/libboard/lib.rs b/artiq/firmware/libboard/lib.rs index d31c9e4e2..6c08c4464 100644 --- a/artiq/firmware/libboard/lib.rs +++ b/artiq/firmware/libboard/lib.rs @@ -5,7 +5,7 @@ extern crate byteorder; #[macro_use] extern crate log; -use core::{cmp, ptr, str}; +use core::{cmp, str}; include!(concat!(env!("BUILDINC_DIRECTORY"), "/generated/mem.rs")); include!(concat!(env!("BUILDINC_DIRECTORY"), "/generated/csr.rs")); @@ -45,11 +45,13 @@ pub use uart_console::Console; pub fn ident(buf: &mut [u8]) -> &str { unsafe { - let len = ptr::read_volatile(csr::IDENTIFIER_MEM_BASE); - let len = cmp::min(len as usize, buf.len()); + csr::identifier::address_write(0); + let len = csr::identifier::data_read(); + let len = cmp::min(len, buf.len() as u8); for i in 0..len { - buf[i] = ptr::read_volatile(csr::IDENTIFIER_MEM_BASE.offset(1 + i as isize)) as u8 + csr::identifier::address_write(1 + i); + buf[i as usize] = csr::identifier::data_read(); } - str::from_utf8_unchecked(&buf[..len]) + str::from_utf8_unchecked(&buf[..len as usize]) } }