SDIO driver: Fix minor issues in SDIO driver
This commit is contained in:
parent
ecd8d2537d
commit
3705cc09d1
@ -238,6 +238,8 @@ static int sdio_check_status_register_cmd13(uint16_t rca, uint32_t *status)
|
|||||||
uint32_t response;
|
uint32_t response;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
|
*status = 0UL;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
sdio_send_cmd(13, (rca<<16)&0xFFFF0000, SHORT_ANS);
|
sdio_send_cmd(13, (rca<<16)&0xFFFF0000, SHORT_ANS);
|
||||||
if (!(res = sdio_get_response(13, SHORT_ANS, &response))) {
|
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);
|
} while(--timeout > 0);
|
||||||
|
|
||||||
/* Check, if card in in TRANS state */
|
/* 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;
|
res = -1;
|
||||||
|
goto ret_val;
|
||||||
|
}
|
||||||
if (status.statusstruct.CURRENT_STATE != CURRENT_STATE_TRAN)
|
if (status.statusstruct.CURRENT_STATE != CURRENT_STATE_TRAN)
|
||||||
res = -2;
|
res = -2;
|
||||||
|
|
||||||
|
ret_val:
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -705,9 +711,10 @@ DRESULT sdio_disk_write(const BYTE *buff, DWORD sector, UINT count)
|
|||||||
|
|
||||||
while (count) {
|
while (count) {
|
||||||
do {
|
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 ||
|
} 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 (status.statusstruct.CURRENT_STATE == CURRENT_STATE_STBY) {
|
||||||
if (sdio_send_select_card_cmd7(card_info.rca))
|
if (sdio_send_select_card_cmd7(card_info.rca))
|
||||||
|
Loading…
Reference in New Issue
Block a user