liblitesdcard/[spi]sdcard: avoid redundant (re-)initialization
This commit is contained in:
parent
aa0cd21378
commit
9ad45a6932
|
@ -728,6 +728,7 @@ DSTATUS disk_status(uint8_t drv) {
|
||||||
|
|
||||||
DSTATUS disk_initialize(uint8_t drv) {
|
DSTATUS disk_initialize(uint8_t drv) {
|
||||||
if (drv) return STA_NOINIT;
|
if (drv) return STA_NOINIT;
|
||||||
|
if (sdcardstatus)
|
||||||
sdcardstatus = sdcard_init() ? 0 : STA_NOINIT;
|
sdcardstatus = sdcard_init() ? 0 : STA_NOINIT;
|
||||||
return sdcardstatus;
|
return sdcardstatus;
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,8 +277,10 @@ DSTATUS disk_status(uint8_t drv) {
|
||||||
|
|
||||||
DSTATUS disk_initialize(uint8_t drv) {
|
DSTATUS disk_initialize(uint8_t drv) {
|
||||||
if (drv) return STA_NOINIT;
|
if (drv) return STA_NOINIT;
|
||||||
|
if (spisdcardstatus) {
|
||||||
spisdcardstatus = spisdcard_init() ? 0 : STA_NOINIT;
|
spisdcardstatus = spisdcard_init() ? 0 : STA_NOINIT;
|
||||||
spisdcard_deselect();
|
spisdcard_deselect();
|
||||||
|
}
|
||||||
return spisdcardstatus;
|
return spisdcardstatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue