Kaynağa Gözat

Fix compile errors

Moved a pair of static functions above the functions that called them.
Freed up more SRAM for the DaynaPORT build from the prefetch buffer.

Added the device type number for Zip100 drives to the sample
`zuluscsi.ini`.
Morio 1 yıl önce
ebeveyn
işleme
525d71d688
4 değiştirilmiş dosya ile 43 ekleme ve 40 silme
  1. 1 1
      platformio.ini
  2. 1 0
      src/ZuluSCSI_cdrom.cpp
  3. 38 37
      src/ZuluSCSI_disk.cpp
  4. 3 2
      zuluscsi.ini

+ 1 - 1
platformio.ini

@@ -211,7 +211,7 @@ build_flags =
     -DROMDRIVE_OFFSET=${env:ZuluSCSI_Pico_DaynaPORT.program_flash_allocation}
 ; These take a large portion of the SRAM and can be adjusted
     -DLOGBUFSIZE=8192
-    -DPREFETCH_BUFFER_SIZE=5632
+    -DPREFETCH_BUFFER_SIZE=5376
     -DSCSI2SD_BUFFER_SIZE=57344
 ; This controls the depth of NETWORK_PACKET_MAX_SIZE (1520 bytes)
 ; For example a queue size of 10 would be 10 x 1520 = 15200 bytes

+ 1 - 0
src/ZuluSCSI_cdrom.cpp

@@ -1888,6 +1888,7 @@ extern "C" int scsiCDRomCommand()
     int commandHandled = 1;
 
     uint8_t command = scsiDev.cdb[0];
+    // Start/stop command
     if (command == 0x1B)
     {
 #if ENABLE_AUDIO_OUTPUT

+ 38 - 37
src/ZuluSCSI_disk.cpp

@@ -552,7 +552,7 @@ static void scsiDiskSetConfig(int target_idx)
 
 // Compares the prefix of both files and the scsi ID
 // cd3-name.iso and CD3-otherfile.bin matches, zp3.img or cd4-name.iso would not
-bool compare_prefix(const char* name, const char* compare)
+static bool compare_prefix(const char* name, const char* compare)
 {
     if (strlen(name) >= 3 && strlen(compare) >= 3)
     {
@@ -565,6 +565,43 @@ bool compare_prefix(const char* name, const char* compare)
     return false;
 }
 
+/***********************/
+/* Start/stop commands */
+/***********************/
+static void doCloseTray(image_config_t &img)
+{
+    if (img.ejected)
+    {
+        uint8_t target = img.scsiId & 7;
+        dbgmsg("------ Device close tray on ID ", (int)target);
+        img.ejected = false;
+
+        if (scsiDev.boardCfg.flags & S2S_CFG_ENABLE_UNIT_ATTENTION)
+        {
+            dbgmsg("------ Posting UNIT ATTENTION after medium change");
+            scsiDev.targets[target].unitAttention = NOT_READY_TO_READY_TRANSITION_MEDIUM_MAY_HAVE_CHANGED;
+        }
+    }
+}
+
+ 
+// Eject and switch image
+static void doPerformEject(image_config_t &img)
+{
+    uint8_t target = img.scsiId & 7;
+    if (!img.ejected)
+    {
+        dbgmsg("------ Device open tray on ID ", (int)target);
+        img.ejected = true;
+        switchNextImage(img); // Switch media for next time
+    }
+    else
+    {
+        doCloseTray(img);
+    }
+}
+
+
 // Finds filename with the lowest lexical order _after_ the given filename in
 // the given folder. If there is no file after the given one, or if there is
 // no current file, this will return the lowest filename encountered.
@@ -1373,42 +1410,6 @@ static void doSeek(uint32_t lba)
 }
 
 
-/***********************/
-/* Start/stop commands */
-/***********************/
-static void doCloseTray(image_config_t &img)
-{
-    if (img.ejected)
-    {
-        uint8_t target = img.scsiId & 7;
-        dbgmsg("------ Device close tray on ID ", (int)target);
-        img.ejected = false;
-
-        if (scsiDev.boardCfg.flags & S2S_CFG_ENABLE_UNIT_ATTENTION)
-        {
-            dbgmsg("------ Posting UNIT ATTENTION after medium change");
-            scsiDev.targets[target].unitAttention = NOT_READY_TO_READY_TRANSITION_MEDIUM_MAY_HAVE_CHANGED;
-        }
-    }
-}
-
- 
-// Eject and switch image
-static void doPerformEject(image_config_t &img)
-{
-    uint8_t target = img.scsiId & 7;
-    if (!img.ejected)
-    {
-        dbgmsg("------ Device open tray on ID ", (int)target);
-        img.ejected = true;
-        switchNextImage(img); // Switch media for next time
-    }
-    else
-    {
-        doCloseTray(img);
-    }
-}
-
 /********************************************/
 /* Transfer state for read / write commands */
 /********************************************/

+ 3 - 2
zuluscsi.ini

@@ -47,7 +47,8 @@
 #Product = "FIREBALL1"
 #Version = "1.0"
 #Serial = "0123456789ABCDEF"
-#Type = 0     # 0: Fixed, 1: Removable, 2: Optical, 3: Floppy, 4: Mag-optical, 5: Tape, 6: Network
+#Type = 0     # 0: Fixed, 1: Removable, 2: Optical, 3: Floppy, 4: Mag-optical, 
+              # 5: Tape,  6: Network,   7: Zip100
 #VendorExtensions = 0 # Bit flags for specific extensions per device type
 #  CDROM - 1: Plextor's d8h vendor command
 #TypeModifier = 0  # Affects only INQUIRY response
@@ -75,7 +76,7 @@
 #Product = "CD-ROM Drive"
 #Type = 2
 
-# If IMG0..IMG9 are specified, they are cycled after each CD eject command.
+# If IMG0..IMG9 are specified, they are cycled after each eject command.
 #IMG0 = FirstCD.iso
 #IMG1 = SecondCD.bin