Merge pull request #570 from gsomlo/gls-sdcard-lazy-init
liblitesdcard/[spi]sdcard: avoid redundant (re-)initialization
This commit is contained in:
commit
4cab38fa5b
|
@ -728,6 +728,7 @@ DSTATUS disk_status(uint8_t drv) {
|
|||
|
||||
DSTATUS disk_initialize(uint8_t drv) {
|
||||
if (drv) return STA_NOINIT;
|
||||
if (sdcardstatus)
|
||||
sdcardstatus = sdcard_init() ? 0 : STA_NOINIT;
|
||||
return sdcardstatus;
|
||||
}
|
||||
|
|
|
@ -277,8 +277,10 @@ DSTATUS disk_status(uint8_t drv) {
|
|||
|
||||
DSTATUS disk_initialize(uint8_t drv) {
|
||||
if (drv) return STA_NOINIT;
|
||||
if (spisdcardstatus) {
|
||||
spisdcardstatus = spisdcard_init() ? 0 : STA_NOINIT;
|
||||
spisdcard_deselect();
|
||||
}
|
||||
return spisdcardstatus;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue