[Horus] Massstorage working now
Still a problem on Windows which doesn't want to format the SD card. Also it seems I am not able to rename the card. It reminds me some issue we already had on Taranis.
This commit is contained in:
@@ -259,12 +259,12 @@ DRESULT disk_ioctl (
|
||||
|
||||
switch (ctrl) {
|
||||
case GET_SECTOR_COUNT : /* Get number of sectors on the disk (DWORD) */
|
||||
*(DWORD*)buff = SDCardInfo.CardCapacity / BLOCK_SIZE;
|
||||
*(DWORD*)buff = SDCardInfo.CardCapacity / SDCardInfo.CardBlockSize;
|
||||
res = RES_OK;
|
||||
break;
|
||||
|
||||
case GET_SECTOR_SIZE : /* Get R/W sector size (WORD) */
|
||||
*(WORD*)buff = BLOCK_SIZE;
|
||||
*(WORD*)buff = SDCardInfo.CardBlockSize;
|
||||
res = RES_OK;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -131,17 +131,8 @@ int8_t STORAGE_GetCapacity (uint8_t lun, uint32_t *block_num, uint32_t *block_si
|
||||
if (!SD_CARD_PRESENT())
|
||||
return -1;
|
||||
|
||||
*block_size = BLOCKSIZE;
|
||||
|
||||
static DWORD sector_count = 0;
|
||||
if (sector_count == 0) {
|
||||
if (disk_ioctl(0, GET_SECTOR_COUNT, §or_count) != RES_OK) {
|
||||
sector_count = 0;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
*block_num = sector_count; // sector_count;
|
||||
*block_size = SDCardInfo.CardBlockSize;
|
||||
*block_num = (SDCardInfo.CardCapacity / SDCardInfo.CardBlockSize) - 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user