Skip to content

Commit

Permalink
Merge pull request #243 from ZuluSCSI/boot-delay
Browse files Browse the repository at this point in the history
Add the ability to delay boot via InitPreDelay and InitPostDelay in zuluscsi.ini. Values are in milliseconds.
Add MPC3000 preset INI option, which sets InitPreDelay to 500ms. This is necessary when using ZuluSCSI RP2040 on an MPC3000, and is not necessary on ZuluSCSI V1.x hardware.
  • Loading branch information
aperezbios committed Jun 13, 2023
2 parents 8dd15da + b96f777 commit fc6d551
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 2 deletions.
21 changes: 20 additions & 1 deletion src/ZuluSCSI.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -646,8 +647,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!");
Expand Down
2 changes: 1 addition & 1 deletion src/ZuluSCSI_config.h
Expand Up @@ -27,7 +27,7 @@
#include <ZuluSCSI_platform.h>

// Use variables for version number
#define FW_VER_NUM "23.06.06"
#define FW_VER_NUM "23.06.13"
#define FW_VER_SUFFIX "devel"
#define ZULU_FW_VERSION FW_VER_NUM "-" FW_VER_SUFFIX

Expand Down
5 changes: 5 additions & 0 deletions src/ZuluSCSI_presets.cpp
Expand Up @@ -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, ""))
Expand All @@ -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");
Expand Down
1 change: 1 addition & 0 deletions src/ZuluSCSI_presets.h
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions zuluscsi.ini
Expand Up @@ -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
Expand Down

0 comments on commit fc6d551

Please sign in to comment.