mirror of https://github.com/ARMmbed/mbed-os.git
Error handling for CMD9
parent
cdbbea6c52
commit
21e6f47aa4
|
@ -344,6 +344,11 @@ int SDBlockDevice::init()
|
||||||
}
|
}
|
||||||
debug_if(SD_DBG, "init card = %d\n", _is_initialized);
|
debug_if(SD_DBG, "init card = %d\n", _is_initialized);
|
||||||
_sectors = _sd_sectors();
|
_sectors = _sd_sectors();
|
||||||
|
// CMD9 failed
|
||||||
|
if (0 == _sectors) {
|
||||||
|
_lock.unlock();
|
||||||
|
return BD_ERROR_DEVICE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
// Set block length to 512 (CMD16)
|
// Set block length to 512 (CMD16)
|
||||||
if (_cmd(CMD16_SET_BLOCKLEN, _block_size) != 0) {
|
if (_cmd(CMD16_SET_BLOCKLEN, _block_size) != 0) {
|
||||||
|
@ -358,12 +363,10 @@ int SDBlockDevice::init()
|
||||||
_lock.unlock();
|
_lock.unlock();
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
_lock.unlock();
|
_lock.unlock();
|
||||||
return BD_ERROR_OK;
|
return BD_ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int SDBlockDevice::deinit()
|
int SDBlockDevice::deinit()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue