forked from M-Labs/artiq
1
0
Fork 0

firmware/liboard/sdram.rs: iterate read multiple times in read_delays to avoid false positives

This commit is contained in:
Florent Kermarrec 2018-02-21 14:15:35 +01:00
parent 86ceee570f
commit afc16a67b6
1 changed files with 12 additions and 10 deletions

View File

@ -177,17 +177,19 @@ mod ddr {
let delay = Cell::new(0); let delay = Cell::new(0);
let incr_delay_until = |expected| { let incr_delay_until = |expected| {
while delay.get() < DDRPHY_MAX_DELAY { while delay.get() < DDRPHY_MAX_DELAY {
sdram_phy::command_prd(DFII_COMMAND_CAS|DFII_COMMAND_CS|
DFII_COMMAND_RDDATA);
spin_cycles(15);
let mut working = true; let mut working = true;
for p in 0..DFII_NPHASES { for _ in 0..64 {
for &offset in [n, n + DQS_SIGNAL_COUNT].iter() { sdram_phy::command_prd(DFII_COMMAND_CAS|DFII_COMMAND_CS|
let addr = DFII_PIX_RDDATA_ADDR[p].offset(offset as isize); DFII_COMMAND_RDDATA);
let data = prs[DFII_PIX_DATA_SIZE * p + offset]; spin_cycles(15);
if ptr::read_volatile(addr) as u8 != data {
working = false; for p in 0..DFII_NPHASES {
for &offset in [n, n + DQS_SIGNAL_COUNT].iter() {
let addr = DFII_PIX_RDDATA_ADDR[p].offset(offset as isize);
let data = prs[DFII_PIX_DATA_SIZE * p + offset];
if ptr::read_volatile(addr) as u8 != data {
working = false;
}
} }
} }
} }