Explorar o código

Update code to work with SdFat 2.2.0

Petteri Aimonen %!s(int64=2) %!d(string=hai) anos
pai
achega
d3b3c4b4d5

+ 11 - 1
lib/ZuluSCSI_platform_GD32F205/sd_card_sdio.cpp

@@ -118,7 +118,7 @@ uint32_t SdioCard::sectorCount()
 {
     csd_t csd;
     sd_csd_get((uint8_t*)&csd);
-    return sdCardCapacity(&csd);
+    return csd.capacity();
 }
 
 uint32_t SdioCard::status()
@@ -199,6 +199,16 @@ bool SdioCard::erase(uint32_t firstSector, uint32_t lastSector)
     return checkReturnOk(sd_erase(firstSector * 512, lastSector * 512));
 }
 
+bool SdioCard::cardCMD6(uint32_t arg, uint8_t* status) {
+    azlog("SdioCard::cardCMD6() not implemented");
+    return false;
+}
+
+bool SdioCard::readSCR(scr_t* scr) {
+    azlog("SdioCard::readSCR() not implemented");
+    return false;
+}
+
 /* Writing and reading, with progress callback */
 
 static sd_callback_t m_stream_callback;

+ 12 - 2
lib/ZuluSCSI_platform_RP2040/sd_card_sdio.cpp

@@ -216,7 +216,7 @@ bool SdioCard::readStop()
 
 uint32_t SdioCard::sectorCount()
 {
-    return sdCardCapacity(&g_sdio_csd);
+    return g_sdio_csd.capacity();
 }
 
 uint32_t SdioCard::status()
@@ -295,8 +295,18 @@ bool SdioCard::writeStop()
 
 bool SdioCard::erase(uint32_t firstSector, uint32_t lastSector)
 {
+    azlog("SdioCard::erase() not implemented");
+    return false;
+}
+
+bool SdioCard::cardCMD6(uint32_t arg, uint8_t* status) {
+    azlog("SdioCard::cardCMD6() not implemented");
+    return false;
+}
+
+bool SdioCard::readSCR(scr_t* scr) {
+    azlog("SdioCard::readSCR() not implemented");
     return false;
-    // return checkReturnOk(sd_erase(firstSector * 512, lastSector * 512));
 }
 
 /* Writing and reading, with progress callback */

+ 2 - 2
platformio.ini

@@ -16,7 +16,7 @@ build_flags =
     -DSCSI2SD_BUFFER_SIZE=4096
     -DUSE_ARDUINO=1
 lib_deps =
-    SdFat=https://github.com/greiman/SdFat#2.1.2
+    SdFat=https://github.com/greiman/SdFat#2.2.0
     minIni
     ZuluSCSI_platform_template
     SCSI2SD
@@ -71,7 +71,7 @@ extra_scripts = src/build_bootloader.py
 board_build.ldscript = lib/ZuluSCSI_platform_RP2040/rp2040.ld
 ldscript_bootloader = lib/ZuluSCSI_platform_RP2040/rp2040_btldr.ld
 lib_deps =
-    SdFat=https://github.com/greiman/SdFat#2.1.2
+    SdFat=https://github.com/greiman/SdFat#2.2.0
     minIni
     ZuluSCSI_platform_RP2040
     SCSI2SD

+ 2 - 7
src/ZuluSCSI.cpp

@@ -142,13 +142,8 @@ void print_sd_info()
     
     char sdname[6] = {sd_cid.pnm[0], sd_cid.pnm[1], sd_cid.pnm[2], sd_cid.pnm[3], sd_cid.pnm[4], 0};
     azlog("SD Name: ", sdname);
-    
-    char sdyear[5] = "2000";
-    sdyear[2] += sd_cid.mdt_year_high;
-    sdyear[3] += sd_cid.mdt_year_low;
-    azlog("SD Date: ", (int)sd_cid.mdt_month, "/", sdyear);
-    
-    azlog("SD Serial: ", sd_cid.psn);
+    azlog("SD Date: ", (int)sd_cid.mdtMonth(), "/", sd_cid.mdtYear());
+    azlog("SD Serial: ", sd_cid.psn());
   }
 }
 

+ 1 - 1
src/ZuluSCSI_disk.cpp

@@ -657,7 +657,7 @@ static void setDefaultDriveInfo(int target_idx)
         uint32_t sd_sn = 0;
         if (SD.card()->readCID(&sd_cid))
         {
-            sd_sn = sd_cid.psn;
+            sd_sn = sd_cid.psn();
         }
 
         memset(img.serial, 0, sizeof(img.serial));