Selaa lähdekoodia

Add the ability to delay boot

Adds the ability to delay booting in milliseconds before and/or
after the first time SCSI interface is initialized.

These settings are InitPreDelay and InitPostDelay in the "zuluscsi.ini"
file.

This is to fix an issue with the RP2040 boards not working with an
MPC3000. Thus a preset has been added for the device name MPC3000 and
can be set by using the System="MPC3000" in the "zuluscsi.ini" file.
The InitPreDelay is set to 500 milliseconds for the preset.

It should be noted that the InitPreDelay delays the first blink
of the board turning on and InitPostDelay hold the LED on.
Morio 2 vuotta sitten
vanhempi
sitoutus
16e03587ff
5 muutettua tiedostoa jossa 30 lisäystä ja 3 poistoa
  1. 20 1
      src/ZuluSCSI.cpp
  2. 2 2
      src/ZuluSCSI_config.h
  3. 5 0
      src/ZuluSCSI_presets.cpp
  4. 1 0
      src/ZuluSCSI_presets.h
  5. 2 0
      zuluscsi.ini

+ 20 - 1
src/ZuluSCSI.cpp

@@ -50,6 +50,7 @@
 #include "ZuluSCSI_platform.h"
 #include "ZuluSCSI_log.h"
 #include "ZuluSCSI_log_trace.h"
+#include "ZuluSCSI_presets.h"
 #include "ZuluSCSI_disk.h"
 #include "ZuluSCSI_initiator.h"
 #include "ROMDrive.h"
@@ -681,8 +682,26 @@ extern "C" void zuluscsi_setup(void)
     }
 
     print_sd_info();
-  
+    
+    char presetName[32];
+    ini_gets("SCSI", "System", "", presetName, sizeof(presetName), CONFIGFILE);
+    preset_config_t defaults = getSystemPreset(presetName);
+    int boot_delay_ms = ini_getl("SCSI", "InitPreDelay", defaults.initPreDelay, CONFIGFILE);
+
+    if (boot_delay_ms > 0)
+    {
+    logmsg("Pre SCSI init boot delay in millis: ", boot_delay_ms);
+      delay(boot_delay_ms);
+    }
     reinitSCSI();
+
+    boot_delay_ms = ini_getl("SCSI", "InitPostDelay", 0, CONFIGFILE);
+    if (boot_delay_ms > 0)
+    {
+      logmsg("Post SCSI init boot delay in millis: ", boot_delay_ms);
+      delay(boot_delay_ms);
+    }
+
   }
 
   logmsg("Initialization complete!");

+ 2 - 2
src/ZuluSCSI_config.h

@@ -27,8 +27,8 @@
 #include <ZuluSCSI_platform.h>
 
 // Use variables for version number
-#define FW_VER_NUM      "23.05.25"
-#define FW_VER_SUFFIX   "release"
+#define FW_VER_NUM      "23.06.13"
+#define FW_VER_SUFFIX   "devel"
 #define ZULU_FW_VERSION FW_VER_NUM "-" FW_VER_SUFFIX
 
 // Configuration and log file paths

+ 5 - 0
src/ZuluSCSI_presets.cpp

@@ -27,6 +27,7 @@ preset_config_t getSystemPreset(const char *presetName)
     cfg.enableSelLatch = false;
     cfg.mapLunsToIDs = false;
     cfg.enableParity = true;
+    cfg.initPreDelay = 0;
 
     // System-specific defaults
     if (strequals(presetName, ""))
@@ -46,6 +47,10 @@ preset_config_t getSystemPreset(const char *presetName)
         cfg.enableSCSI2 = false;
         cfg.selectionDelay = 0;
     }
+    else if (strequals(presetName, "MPC3000"))
+    {
+        cfg.initPreDelay = 500;
+    }
     else
     {
         logmsg("Unknown preset name ", presetName, ", using default settings");

+ 1 - 0
src/ZuluSCSI_presets.h

@@ -21,6 +21,7 @@ struct preset_config_t {
     // Default settings that apply to all SCSI IDs
     int selectionDelay;
     int maxSyncSpeed;
+    int initPreDelay;
     bool enableUnitAttention;
     bool enableSCSI2;
     bool enableSelLatch;

+ 2 - 0
zuluscsi.ini

@@ -24,6 +24,8 @@
 #EnableParity = 1 # Enable parity checks on platforms that support it (RP2040)
 #MapLunsToIDs = 0 # For Philips P2000C simulate multiple LUNs
 #MaxSyncSpeed = 10 # Set to 5 or 10 to enable synchronous SCSI mode, 0 to disable
+#InitPreDelay = 0  # How many milliseconds to delay before the SCSI interface is initialized
+#InitPostDelay = 0 # How many milliseconds to delay after the SCSI interface is initialized
 
 # ROM settings
 #DisableROMDrive = 1 # Disable the ROM drive if it has been loaded to flash