forked from M-Labs/artiq
1
0
Fork 0

serwb: debug print on error

This commit is contained in:
Sebastien Bourdeauducq 2018-01-04 22:23:59 +08:00
parent e1a75ac1c1
commit 161a414567
1 changed files with 26 additions and 19 deletions

View File

@ -1,11 +1,36 @@
use board::csr; use board::csr;
unsafe fn debug_print(rtm: bool) {
debug!("AMC serwb settings:");
debug!(" delay_min_found: {}", csr::serwb_phy_amc::control_delay_min_found_read());
debug!(" delay_min: {}", csr::serwb_phy_amc::control_delay_min_read());
debug!(" delay_max_found: {}", csr::serwb_phy_amc::control_delay_max_found_read());
debug!(" delay_max: {}", csr::serwb_phy_amc::control_delay_max_read());
debug!(" delay: {}", csr::serwb_phy_amc::control_delay_read());
debug!(" bitslip: {}", csr::serwb_phy_amc::control_bitslip_read());
debug!(" ready: {}", csr::serwb_phy_amc::control_ready_read());
debug!(" error: {}", csr::serwb_phy_amc::control_error_read());
if rtm {
debug!("RTM serwb settings:");
debug!(" delay_min_found: {}", csr::serwb_phy_rtm::control_delay_min_found_read());
debug!(" delay_min: {}", csr::serwb_phy_rtm::control_delay_min_read());
debug!(" delay_max_found: {}", csr::serwb_phy_rtm::control_delay_max_found_read());
debug!(" delay_max: {}", csr::serwb_phy_rtm::control_delay_max_read());
debug!(" delay: {}", csr::serwb_phy_rtm::control_delay_read());
debug!(" bitslip: {}", csr::serwb_phy_rtm::control_bitslip_read());
debug!(" ready: {}", csr::serwb_phy_rtm::control_ready_read());
debug!(" error: {}", csr::serwb_phy_rtm::control_error_read());
}
}
pub fn wait_init() { pub fn wait_init() {
info!("waiting for AMC/RTM serwb bridge to be ready..."); info!("waiting for AMC/RTM serwb bridge to be ready...");
unsafe { unsafe {
csr::serwb_phy_amc::control_reset_write(1); csr::serwb_phy_amc::control_reset_write(1);
while csr::serwb_phy_amc::control_ready_read() == 0 { while csr::serwb_phy_amc::control_ready_read() == 0 {
if csr::serwb_phy_amc::control_error_read() == 1 { if csr::serwb_phy_amc::control_error_read() == 1 {
debug_print(false);
warn!("AMC/RTM serwb bridge initialization failed, retrying."); warn!("AMC/RTM serwb bridge initialization failed, retrying.");
csr::serwb_phy_amc::control_reset_write(1); csr::serwb_phy_amc::control_reset_write(1);
} }
@ -23,24 +48,6 @@ pub fn wait_init() {
} }
unsafe { unsafe {
debug!("AMC serwb settings:"); debug_print(true);
debug!(" delay_min_found: {}", csr::serwb_phy_amc::control_delay_min_found_read());
debug!(" delay_min: {}", csr::serwb_phy_amc::control_delay_min_read());
debug!(" delay_max_found: {}", csr::serwb_phy_amc::control_delay_max_found_read());
debug!(" delay_max: {}", csr::serwb_phy_amc::control_delay_max_read());
debug!(" delay: {}", csr::serwb_phy_amc::control_delay_read());
debug!(" bitslip: {}", csr::serwb_phy_amc::control_bitslip_read());
debug!(" ready: {}", csr::serwb_phy_amc::control_ready_read());
debug!(" error: {}", csr::serwb_phy_amc::control_error_read());
debug!("RTM serwb settings:");
debug!(" delay_min_found: {}", csr::serwb_phy_rtm::control_delay_min_found_read());
debug!(" delay_min: {}", csr::serwb_phy_rtm::control_delay_min_read());
debug!(" delay_max_found: {}", csr::serwb_phy_rtm::control_delay_max_found_read());
debug!(" delay_max: {}", csr::serwb_phy_rtm::control_delay_max_read());
debug!(" delay: {}", csr::serwb_phy_rtm::control_delay_read());
debug!(" bitslip: {}", csr::serwb_phy_rtm::control_bitslip_read());
debug!(" ready: {}", csr::serwb_phy_rtm::control_ready_read());
debug!(" error: {}", csr::serwb_phy_rtm::control_error_read());
} }
} }