Merge pull request #565 from gsomlo/gls-cosmetic-spi-fat

post-FatFs cleanup
This commit is contained in:
enjoy-digital 2020-06-16 21:49:15 +02:00 committed by GitHub
commit aa0cd21378
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 19 deletions

View File

@ -415,7 +415,7 @@ static unsigned int check_image_in_flash(unsigned int base_address)
} }
#if defined(MAIN_RAM_BASE) && defined(FLASH_BOOT_ADDRESS) #if defined(MAIN_RAM_BASE) && defined(FLASH_BOOT_ADDRESS)
static int copy_image_from_flash_to_ram(unsigned int flash_address, unsigned int ram_address) static int copy_image_from_flash_to_ram(unsigned int flash_address, unsigned long ram_address)
{ {
uint32_t length; uint32_t length;
uint32_t offset; uint32_t offset;
@ -474,7 +474,7 @@ void flashboot(void)
#if defined(CSR_SPISDCARD_BASE) || defined(CSR_SDCORE_BASE) #if defined(CSR_SPISDCARD_BASE) || defined(CSR_SDCORE_BASE)
static int copy_file_from_sdcard_to_ram(const char * filename, unsigned int ram_address) static int copy_file_from_sdcard_to_ram(const char * filename, unsigned long ram_address)
{ {
FRESULT fr; FRESULT fr;
FATFS fs; FATFS fs;

View File

@ -719,22 +719,17 @@ int sdcard_test(unsigned int blocks)
/* SDCard FatFs disk functions */ /* SDCard FatFs disk functions */
/*-----------------------------------------------------------------------*/ /*-----------------------------------------------------------------------*/
static DSTATUS spisdcardstatus = STA_NOINIT; static DSTATUS sdcardstatus = STA_NOINIT;
DSTATUS disk_status(uint8_t drv) { DSTATUS disk_status(uint8_t drv) {
if (drv) return STA_NOINIT; if (drv) return STA_NOINIT;
return spisdcardstatus; return sdcardstatus;
} }
DSTATUS disk_initialize(uint8_t drv) { DSTATUS disk_initialize(uint8_t drv) {
uint8_t r; if (drv) return STA_NOINIT;
sdcardstatus = sdcard_init() ? 0 : STA_NOINIT;
if (drv) return RES_NOTRDY; return sdcardstatus;
r = sdcard_init();
spisdcardstatus = r ? 0 : STA_NOINIT;
return spisdcardstatus;
} }
DRESULT disk_read(uint8_t drv, uint8_t *buf, uint32_t sector, uint32_t count) { DRESULT disk_read(uint8_t drv, uint8_t *buf, uint32_t sector, uint32_t count) {

View File

@ -276,14 +276,9 @@ DSTATUS disk_status(uint8_t drv) {
} }
DSTATUS disk_initialize(uint8_t drv) { DSTATUS disk_initialize(uint8_t drv) {
uint8_t r; if (drv) return STA_NOINIT;
spisdcardstatus = spisdcard_init() ? 0 : STA_NOINIT;
if (drv) return RES_NOTRDY;
r = spisdcard_init();
spisdcard_deselect(); spisdcard_deselect();
spisdcardstatus = r ? 0 : STA_NOINIT;
return spisdcardstatus; return spisdcardstatus;
} }