SDIO driver: Fix minor issues in SDIO driver

This commit is contained in:
Mario Hüttel 2020-06-15 21:31:49 +02:00
parent ecd8d2537d
commit 3705cc09d1

View File

@ -238,6 +238,8 @@ static int sdio_check_status_register_cmd13(uint16_t rca, uint32_t *status)
uint32_t response;
int res;
*status = 0UL;
do {
sdio_send_cmd(13, (rca<<16)&0xFFFF0000, SHORT_ANS);
if (!(res = sdio_get_response(13, SHORT_ANS, &response))) {
@ -465,10 +467,14 @@ static int sdio_send_select_card_cmd7(uint16_t rca) {
} while(--timeout > 0);
/* Check, if card in in TRANS state */
if (sdio_check_status_register_cmd13(rca, &(status.value)))
if (sdio_check_status_register_cmd13(rca, &status.value)) {
res = -1;
goto ret_val;
}
if (status.statusstruct.CURRENT_STATE != CURRENT_STATE_TRAN)
res = -2;
ret_val:
return res;
}
@ -705,9 +711,10 @@ DRESULT sdio_disk_write(const BYTE *buff, DWORD sector, UINT count)
while (count) {
do {
sdio_check_status_register_cmd13(card_info.rca, &status.value);
ret = sdio_check_status_register_cmd13(card_info.rca, &status.value);
} while (status.statusstruct.CURRENT_STATE == CURRENT_STATE_PRG ||
status.statusstruct.CURRENT_STATE == CURRENT_STATE_RCV);
status.statusstruct.CURRENT_STATE == CURRENT_STATE_RCV ||
!ret);
if (status.statusstruct.CURRENT_STATE == CURRENT_STATE_STBY) {
if (sdio_send_select_card_cmd7(card_info.rca))