URL
https://opencores.org/ocsvn/xulalx25soc/xulalx25soc/trunk
Subversion Repositories xulalx25soc
Compare Revisions
- This comparison shows the changes necessary to convert path
/xulalx25soc/trunk
- from Rev 103 to Rev 104
- ↔ Reverse comparison
Rev 103 → Rev 104
/sw/flashdrvr.cpp
133,9 → 133,10
// command immediately. As soon as the write completes the read will |
// begin sending commands back. This allows us to recover the lost |
// time between the interrupt and the next command being received. |
if ((!HIGH_SPEED)||(!verify_write)) { |
flwait(); |
} if (verify_write) { |
flwait(); |
// if ((!HIGH_SPEED)||(!verify_write)) { } |
if (verify_write) { |
// printf("Attempting to verify page\n"); |
// NOW VERIFY THE PAGE |
m_fpga->readi(addr, len, buf); |
for(unsigned i=0; i<len; i++) { |
177,7 → 178,7
for(unsigned i=0; i<ln; i++) { |
if ((sbuf[i]&dp[i]) != dp[i]) { |
printf("\nNEED-ERASE @0x%08x ... %08x != %08x (Goal)\n", |
i+base-addr, sbuf[i], dp[i]); |
i+base, sbuf[i], dp[i]); |
need_erase = true; |
newv = i+base; |
break; |
194,21 → 195,26
continue; // This sector already matches |
|
// Just erase anyway |
if ((need_erase)&&(!erase_sector(s, verify))) { |
printf("SECTOR ERASE FAILED!\n"); |
return false; |
} else if (!need_erase) |
if (!need_erase) |
printf("NO ERASE NEEDED\n"); |
else { |
printf("ERASING SECTOR %08x\n", s); |
newv = (s<addr) ? addr : s; |
printf("ERASING SECTOR: %08x\n", s); |
if (!erase_sector(s, verify)) { |
printf("SECTOR ERASE FAILED!\n"); |
return false; |
} newv = (s<addr) ? addr : s; |
} |
for(unsigned p=newv; (p<s+SECTORSZ)&&(p<addr+len); p=PAGEOF(p+PGLEN)) |
if (!write_page(p, (p+PGLEN<addr+len) |
?((PAGEOF(p)!=PAGEOF(p+PGLEN-1))?(PAGEOF(p+PGLEN-1)-p):PGLEN) |
:(addr+len-p), &data[p-addr]), verify) { |
for(unsigned p=newv; (p<s+SECTORSZ)&&(p<addr+len); p=PAGEOF(p+PGLEN)) { |
unsigned start = p, len = addr+len-start; |
|
// BUT! if we cross page boundaries, we need to clip |
// our results to the page boundary |
if (PAGEOF(start+len-1)!=PAGEOF(start)) |
len = PAGEOF(start+PGLEN)-start; |
if (!write_page(start, len, &data[p-addr], verify)) { |
printf("WRITE-PAGE FAILED!\n"); |
return false; |
} |
} |
} |
|