forked from M-Labs/artiq
1
0
Fork 0

firmware: wait for serwb to be ready before proceeding further

This commit is contained in:
Sebastien Bourdeauducq 2017-09-06 11:07:07 +08:00
parent 33f053cff8
commit 2b2b345eb9
4 changed files with 26 additions and 0 deletions

View File

@ -25,6 +25,8 @@ pub mod spi;
#[cfg(has_si5324)]
pub mod si5324;
#[cfg(has_serwb_phy)]
pub mod serwb;
#[cfg(has_ad9516)]
#[allow(dead_code)]
mod ad9516_reg;

View File

@ -0,0 +1,18 @@
use csr;
pub fn wait_init() {
info!("waiting for AMC/RTM serwb bridge to be ready...");
unsafe {
while csr::serwb_phy::control_ready_read() != 0 {}
}
info!("done.");
// Try reading the identifier register on the other side of the bridge.
let rtm_identifier = unsafe {
csr::rtm_identifier::identifier_read()
};
if rtm_identifier != 0x5352544d {
error!("incorrect RTM identifier: 0x{:08x}", rtm_identifier);
// proceed anyway
}
}

View File

@ -63,6 +63,9 @@ fn startup() {
info!("software version {}", include_str!(concat!(env!("OUT_DIR"), "/git-describe")));
info!("gateware version {}", board::ident(&mut [0; 64]));
#[cfg(has_serwb_phy)]
board::serwb::wait_init();
let t = board::clock::get_ms();
info!("press 'e' to erase startup and idle kernels...");
while board::clock::get_ms() < t + 1000 {

View File

@ -195,6 +195,9 @@ fn startup() {
info!("software version {}", include_str!(concat!(env!("OUT_DIR"), "/git-describe")));
info!("gateware version {}", board::ident(&mut [0; 64]));
#[cfg(has_serwb_phy)]
board::serwb::wait_init();
#[cfg(has_ad9516)]
board::ad9516::init().expect("cannot initialize AD9516");
#[cfg(has_hmc830_7043)]