use new misoc identifier

This commit is contained in:
Sebastien Bourdeauducq 2018-02-13 20:38:48 +08:00
parent ab5f397fea
commit df177bfd5b
2 changed files with 8 additions and 6 deletions

View File

@ -1,13 +1,15 @@
use core::{ptr, cmp, str};
use core::{cmp, str};
use csr;
pub fn read(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])
}
}

View File

@ -15,7 +15,7 @@ requirements:
- python >=3.5.3,<3.6
- setuptools 33.1.1
- migen 0.7 py35_2+git40721b2
- misoc 0.9 py35_2+git8435d832
- misoc 0.9 py35_3+git684b519a
- jesd204b 0.4
- microscope
- binutils-or1k-linux >=2.27