forked from M-Labs/artiq
1
0
Fork 0

grabber: log all resolution changes

close #1120
This commit is contained in:
Robert Jördens 2018-08-07 16:13:21 +02:00
parent 99a15ca0c6
commit 6cd2432e30
1 changed files with 11 additions and 2 deletions

View File

@ -8,6 +8,7 @@ enum State {
} }
static mut GRABBER_STATE: [State; csr::GRABBER_LEN] = [State::Down; csr::GRABBER_LEN]; static mut GRABBER_STATE: [State; csr::GRABBER_LEN] = [State::Down; csr::GRABBER_LEN];
static mut GRABBER_RESOLUTION: [(u16, u16); csr::GRABBER_LEN] = [(0, 0); csr::GRABBER_LEN];
fn get_pll_reset(g: usize) -> bool { fn get_pll_reset(g: usize) -> bool {
unsafe { (csr::GRABBER[g].pll_reset_read)() != 0 } unsafe { (csr::GRABBER[g].pll_reset_read)() != 0 }
@ -92,11 +93,19 @@ pub fn tick() {
info!("grabber{} is down", g); info!("grabber{} is down", g);
} }
if unsafe { GRABBER_STATE[g] == State::WaitResolution } { if unsafe { GRABBER_STATE[g] == State::WaitResolution } {
let (last_x, last_y) = get_last_pixels(g); let last_xy = get_last_pixels(g);
unsafe { GRABBER_RESOLUTION[g] = last_xy; }
info!("grabber{} frame size: {}x{}", info!("grabber{} frame size: {}x{}",
g, last_x + 1, last_y + 1); g, last_xy.0 + 1, last_xy.1 + 1);
info!("grabber{} video clock: {}MHz", g, get_video_clock(g)); info!("grabber{} video clock: {}MHz", g, get_video_clock(g));
unsafe { GRABBER_STATE[g] = State::Up; } unsafe { GRABBER_STATE[g] = State::Up; }
} else {
let last_xy = get_last_pixels(g);
if unsafe { last_xy != GRABBER_RESOLUTION[g] } {
info!("grabber{} frame size: {}x{}",
g, last_xy.0 + 1, last_xy.1 + 1);
unsafe { GRABBER_RESOLUTION[g] = last_xy; }
}
} }
} else { } else {
if get_pll_reset(g) { if get_pll_reset(g) {