ZuluSCSI_config.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /**
  2. * ZuluSCSI™ - Copyright (c) 2022 Rabbit Hole Computing™
  3. * Portions copyright (c) 2023 joshua stein <jcs@jcs.org>
  4. *
  5. * ZuluSCSI™ firmware is licensed under the GPL version 3 or any later version.
  6. *
  7. * https://www.gnu.org/licenses/gpl-3.0.html
  8. * ----
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation, either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program.  If not, see <https://www.gnu.org/licenses/>.
  21. **/
  22. // Compile-time configuration parameters.
  23. // Other settings can be set by ini file at runtime.
  24. #pragma once
  25. #include <ZuluSCSI_platform_config.h>
  26. // Use variables for version number
  27. #define FW_VER_NUM "24.12.03"
  28. #define FW_VER_SUFFIX "release"
  29. #define DEF_STRINGFY(DEF) STRINGFY(DEF)
  30. #define STRINGFY(STR) #STR
  31. #define FIRMWARE_NAME_PREFIX DEF_STRINGFY(BUILD_ENV)
  32. #define ZULU_FW_VERSION FW_VER_NUM "-" FW_VER_SUFFIX
  33. #define INQUIRY_NAME PLATFORM_NAME " v" ZULU_FW_VERSION
  34. #define TOOLBOX_API 0
  35. // Configuration and log file paths
  36. #define CONFIGFILE "zuluscsi.ini"
  37. #define LOGFILE "zululog.txt"
  38. #define CRASHFILE "zuluerr.txt"
  39. #define FIRMWARE_PREFIX "ZuluSCSI-FW"
  40. // Prefix for command file to create new image (case-insensitive)
  41. #define CREATEFILE "create"
  42. // Log buffer size in bytes, must be a power of 2
  43. #ifndef LOGBUFSIZE
  44. #define LOGBUFSIZE 16384
  45. #endif
  46. #define LOG_SAVE_INTERVAL_MS 1000
  47. // Watchdog timeout
  48. // Watchdog will first issue a bus reset and if that does not help, crashdump.
  49. #define WATCHDOG_BUS_RESET_TIMEOUT 15000
  50. #define WATCHDOG_CRASH_TIMEOUT 30000
  51. // HDD image file format
  52. #define HDIMG_ID_POS 2 // Position to embed ID number
  53. #define HDIMG_LUN_POS 3 // Position to embed LUN numbers
  54. #define HDIMG_BLK_POS 5 // Position to embed block size numbers
  55. #define MAX_FILE_PATH 64 // Maximum file name length
  56. // Image definition options
  57. #define IMAGE_INDEX_MAX 9 // Maximum number of 'IMG0' style statements parsed
  58. // SCSI config
  59. #define NUM_SCSIID 8 // Maximum number of supported SCSI-IDs (The minimum is 0)
  60. #define NUM_SCSILUN 1 // Maximum number of LUNs supported (Currently has to be 1)
  61. #define READ_PARITY_CHECK 0 // Perform read parity check (unverified)
  62. // SCSI raw fallback configuration when no image files are detected
  63. // Presents the whole SD card as an SCSI drive
  64. #define RAW_FALLBACK_ENABLE 1
  65. #define RAW_FALLBACK_SCSI_ID 1
  66. #define RAW_FALLBACK_BLOCKSIZE 512
  67. // Default SCSI drive information (can be overridden in INI file)
  68. // Selected based on device type (fixed, removable, optical, floppy, mag-optical, tape)
  69. // Each entry has {vendor, product, version, serial}
  70. // If serial number is left empty, SD card serial number is used.
  71. #define DRIVEINFO_FIXED {"ZULUSCSI", "HARDDRIVE", PLATFORM_REVISION, ""}
  72. #define DRIVEINFO_REMOVABLE {"ZULUSCSI", "REMOVABLE", PLATFORM_REVISION, ""}
  73. #define DRIVEINFO_OPTICAL {"ZULUSCSI", "CDROM", PLATFORM_REVISION, ""}
  74. #define DRIVEINFO_FLOPPY {"ZULUSCSI", "FLOPPY", PLATFORM_REVISION, ""}
  75. #define DRIVEINFO_MAGOPT {"ZULUSCSI", "MO_DRIVE", PLATFORM_REVISION, ""}
  76. #define DRIVEINFO_NETWORK {"Dayna", "SCSI/Link", "2.0f", ""}
  77. #define DRIVEINFO_TAPE {"ZULUSCSI", "TAPE", PLATFORM_REVISION, ""}
  78. // Default block size
  79. #define DEFAULT_BLOCKSIZE 512
  80. // Default optical drive blocksize
  81. #define DEFAULT_BLOCKSIZE_OPTICAL 2048
  82. // Default SCSI drive information when Apple quirks are enabled
  83. #define APPLE_DRIVEINFO_FIXED {"CDC", "ZuluSCSI HDD", PLATFORM_REVISION, "1.0"}
  84. #define APPLE_DRIVEINFO_REMOVABLE {"IOMEGA", "BETA230", PLATFORM_REVISION, "2.02"}
  85. #define APPLE_DRIVEINFO_OPTICAL {"MATSHITA", "CD-ROM CR-8004", PLATFORM_REVISION, "1.1f"}
  86. #define APPLE_DRIVEINFO_FLOPPY {"IOMEGA", "Io20S *F", "PP33", ""}
  87. #define APPLE_DRIVEINFO_MAGOPT {"MOST", "RMD-5200", PLATFORM_REVISION, "1.0"}
  88. #define APPLE_DRIVEINFO_NETWORK {"Dayna", "SCSI/Link", "2.0f", ""}
  89. #define APPLE_DRIVEINFO_TAPE {"ZULUSCSI", "APPLE_TAPE", PLATFORM_REVISION, ""}
  90. // Default Iomega ZIP drive information
  91. #define IOMEGA_DRIVEINFO_ZIP100 {"IOMEGA", "ZIP 100", "D.13", ""}
  92. #define IOMEGA_DRIVEINFO_ZIP250 {"IOMEGA", "ZIP 250", "42.S", ""}
  93. #define IOMEGA_DRIVEINFO_JAZ {"iomega", "jaz", "", ""}
  94. // Default delay for SCSI phases.
  95. // Can be adjusted in ini file
  96. #define DEFAULT_SCSI_DELAY_US 10
  97. #define DEFAULT_REQ_TYPE_SETUP_NS 500
  98. // Use prefetch buffer in read requests
  99. #ifndef PREFETCH_BUFFER_SIZE
  100. #define PREFETCH_BUFFER_SIZE 8192
  101. #endif
  102. // Masks for buttons
  103. #define EJECT_BTN_MASK (1|2)
  104. #define USER_BTN_MASK (4)
  105. // Zip disk media sizes
  106. #define ZIP100_DISK_SIZE 100663296 // bytes
  107. #define ZIP250_DISK_SIZE 250640384 // bytes
  108. // Settings for rebooting
  109. #define REBOOT_INTO_MASS_STORAGE_MAGIC_NUM 0x5eeded
  110. // Reclocking return status
  111. typedef enum
  112. {
  113. ZULUSCSI_RECLOCK_SUCCESS,
  114. ZULUSCSI_RECLOCK_CUSTOM,
  115. ZULUSCSI_RECLOCK_NOT_SUPPORTED,
  116. ZULUSCSI_RECLOCK_FAILED
  117. } zuluscsi_reclock_status_t;
  118. typedef enum
  119. {
  120. SPEED_GRADE_DEFAULT,
  121. SPEED_GRADE_MAX,
  122. SPEED_GRADE_CUSTOM,
  123. SPEED_GRADE_A,
  124. SPEED_GRADE_B,
  125. SPEED_GRADE_C,
  126. SPEED_GRADE_AUDIO,
  127. } zuluscsi_speed_grade_t;