mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 16:25:16 +03:00
[Horus] Massstorage again OK
This commit is contained in:
parent
ac86ebc229
commit
c307e1987c
1 changed files with 7 additions and 29 deletions
|
@ -175,23 +175,10 @@ int8_t STORAGE_Read (uint8_t lun,
|
|||
uint32_t blk_addr,
|
||||
uint16_t blk_len)
|
||||
{
|
||||
|
||||
for (int retry=0; retry<3; retry++) {
|
||||
if (SD_ReadMultiBlocks(buf, blk_addr, BLOCKSIZE, blk_len) != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
SDTransferState State;
|
||||
|
||||
SD_Error Status = SD_WaitReadOperation(); // Check if the Transfer is finished
|
||||
|
||||
while((State = SD_GetStatus()) == SD_TRANSFER_BUSY); // BUSY, OK (DONE), ERROR (FAIL)
|
||||
|
||||
if ((State == SD_TRANSFER_OK) && (Status == SD_OK)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
if (disk_read(0, buf, blk_addr, blk_len) == RES_OK)
|
||||
return 0;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
/**
|
||||
* @brief Write data to the medium
|
||||
|
@ -207,19 +194,10 @@ int8_t STORAGE_Write (uint8_t lun,
|
|||
uint32_t blk_addr,
|
||||
uint16_t blk_len)
|
||||
{
|
||||
if (SD_WriteMultiBlocks(buf, blk_addr, BLOCKSIZE, blk_len) != 0)
|
||||
if (disk_write(0, buf, blk_addr, blk_len) == RES_OK)
|
||||
return 0;
|
||||
else
|
||||
return -1;
|
||||
|
||||
SDTransferState State;
|
||||
|
||||
SD_Error Status = SD_WaitWriteOperation(); // Check if the Transfer is finished
|
||||
|
||||
while((State = SD_GetStatus()) == SD_TRANSFER_BUSY); // BUSY, OK (DONE), ERROR (FAIL)
|
||||
|
||||
if ((State == SD_TRANSFER_ERROR) || (Status != SD_OK))
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue