mirror of
https://github.com/enjoy-digital/litex.git
synced 2025-01-04 09:52:26 -05:00
software/liblitesata/sata_read: handle errors.
This commit is contained in:
parent
2bb46b305b
commit
1fca7b9a91
1 changed files with 12 additions and 4 deletions
|
@ -26,11 +26,19 @@ int sata_init(void) {
|
||||||
void sata_read(uint32_t block, uint32_t count, uint8_t* buf)
|
void sata_read(uint32_t block, uint32_t count, uint8_t* buf)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
|
/* Read blocks */
|
||||||
for (i=0; i<count; i++) {
|
for (i=0; i<count; i++) {
|
||||||
sata_block2mem_base_write(((uint32_t) buf) + i*512);
|
uint8_t done = 0;
|
||||||
|
while (done == 0) {
|
||||||
|
sata_block2mem_base_write((uint64_t) buf);
|
||||||
sata_block2mem_sector_write(block + i);
|
sata_block2mem_sector_write(block + i);
|
||||||
sata_block2mem_start_write(1);
|
sata_block2mem_start_write(1);
|
||||||
while ((sata_block2mem_done_read() & 0x1) == 0);
|
while ((sata_block2mem_done_read() & 0x1) == 0);
|
||||||
|
done = ((sata_block2mem_error_read() & 0x1) == 0);
|
||||||
|
busy_wait_us(10);
|
||||||
|
}
|
||||||
|
buf += 512;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef CONFIG_CPU_HAS_DMA_BUS
|
#ifndef CONFIG_CPU_HAS_DMA_BUS
|
||||||
|
|
Loading…
Reference in a new issue