satman: replaced ident with the one from runtime

This commit is contained in:
mwojcik 2021-07-23 14:14:07 +02:00
parent 415a3be8ce
commit b963bbbf77
1 changed files with 15 additions and 2 deletions

View File

@ -5,7 +5,7 @@
extern crate log;
use core::convert::TryFrom;
use board_misoc::{ident, i2c}; // <- port, use libboard_zynq
use board_misoc::{i2c}; // <- port, use libboard_zynq
use libboard_zynq::timer::GlobalTimer;
#[cfg(has_si5324)]
use libboard_artiq::si5324;
@ -14,6 +14,19 @@ use libboard_artiq::{pl::csr, drtio_routing, drtioaux, logger};
mod repeater;
fn identifier_read(buf: &mut [u8]) -> &str {
unsafe {
pl::csr::identifier::address_write(0);
let len = pl::csr::identifier::data_read();
let len = cmp::min(len, buf.len() as u8);
for i in 0..len {
pl::csr::identifier::address_write(1 + i);
buf[i as usize] = pl::csr::identifier::data_read();
}
str::from_utf8_unchecked(&buf[..len as usize])
}
}
fn drtiosat_reset(reset: bool) {
unsafe {
csr::drtiosat::reset_write(if reset { 1 } else { 0 });
@ -416,7 +429,7 @@ pub extern fn main() -> i32 {
info!("ARTIQ satellite manager starting...");
info!("software ident {}", csr::CONFIG_IDENTIFIER_STR);
info!("gateware ident {}", ident::read(&mut [0; 64]));
info!("gateware ident {}", identifier_read(&mut [0; 64]));
#[cfg(has_i2c)]
i2c::init().expect("I2C initialization failed"); // port