wrpll: improve debug output

This commit is contained in:
Sebastien Bourdeauducq 2019-12-09 17:23:09 +08:00
parent f633c62e8d
commit 0d4eccc1a5
1 changed files with 13 additions and 9 deletions

View File

@ -272,6 +272,14 @@ fn get_helper_frequency() -> u32 {
unsafe { csr::wrpll::helper_frequency_counter_read() } unsafe { csr::wrpll::helper_frequency_counter_read() }
} }
fn get_ddmtd_main_tag() -> u16 {
unsafe {
csr::wrpll::ddmtd_main_arm_write(1);
while csr::wrpll::ddmtd_main_arm_read() != 0 {}
csr::wrpll::ddmtd_main_tag_read()
}
}
pub fn init() { pub fn init() {
info!("initializing..."); info!("initializing...");
@ -286,23 +294,19 @@ pub fn init() {
.expect("cannot initialize main Si549"); .expect("cannot initialize main Si549");
si549::program(i2c::Dcxo::Helper, h_hsdiv, h_lsdiv, h_fbdiv) si549::program(i2c::Dcxo::Helper, h_hsdiv, h_lsdiv, h_fbdiv)
.expect("cannot initialize helper Si549"); .expect("cannot initialize helper Si549");
// Si549 Settling Time for Large Frequency Change. // Si549 Settling Time for Large Frequency Change.
// Datasheet said 10ms but it lied. // Datasheet said 10ms but it lied.
clock::spin_us(50_000); clock::spin_us(50_000);
unsafe { csr::wrpll::helper_reset_write(0); } unsafe { csr::wrpll::helper_reset_write(0); }
clock::spin_us(1); clock::spin_us(1);
info!("helper clock frequency: {}MHz", get_helper_frequency()/10000); info!("helper clock frequency: {}MHz", get_helper_frequency()/10000);
let mut tags = [0; 10];
info!("DDMTD test:"); for i in 0..tags.len() {
for _ in 0..20 { tags[i] = get_ddmtd_main_tag();
unsafe {
csr::wrpll::ddmtd_main_arm_write(1);
while csr::wrpll::ddmtd_main_arm_read() != 0 {}
info!("{}", csr::wrpll::ddmtd_main_tag_read());
}
} }
info!("DDMTD main tags: {:?}", tags);
} }
pub fn select_recovered_clock(rc: bool) { pub fn select_recovered_clock(rc: bool) {