ZuluSCSI_config.h 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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 "25.01.26"
  28. #define FW_VER_SUFFIX "devel"
  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. // How often to check for SD card presence
  48. #define SDCARD_POLL_INTERVAL 5000
  49. // Watchdog timeout
  50. // Watchdog will first issue a bus reset and if that does not help, crashdump.
  51. #define WATCHDOG_BUS_RESET_TIMEOUT 15000
  52. #define WATCHDOG_CRASH_TIMEOUT 30000
  53. // HDD image file format
  54. #define HDIMG_ID_POS 2 // Position to embed ID number
  55. #define HDIMG_LUN_POS 3 // Position to embed LUN numbers
  56. #define HDIMG_BLK_POS 5 // Position to embed block size numbers
  57. #define MAX_FILE_PATH 64 // Maximum file name length
  58. // Image definition options
  59. #define IMAGE_INDEX_MAX 9 // Maximum number of 'IMG0' style statements parsed
  60. // SCSI config
  61. #define NUM_SCSIID 8 // Maximum number of supported SCSI-IDs (The minimum is 0)
  62. #define NUM_SCSILUN 1 // Maximum number of LUNs supported (Currently has to be 1)
  63. #define READ_PARITY_CHECK 0 // Perform read parity check (unverified)
  64. // SCSI raw fallback configuration when no image files are detected
  65. // Presents the whole SD card as an SCSI drive
  66. #define RAW_FALLBACK_ENABLE 1
  67. #define RAW_FALLBACK_SCSI_ID 1
  68. #define RAW_FALLBACK_BLOCKSIZE 512
  69. // Default SCSI drive information (can be overridden in INI file)
  70. // Selected based on device type (fixed, removable, optical, floppy, mag-optical, tape)
  71. // Each entry has {vendor, product, version, serial}
  72. // If serial number is left empty, SD card serial number is used.
  73. #define DRIVEINFO_FIXED {"ZULUSCSI", "HARDDRIVE", PLATFORM_REVISION, ""}
  74. #define DRIVEINFO_REMOVABLE {"ZULUSCSI", "REMOVABLE", PLATFORM_REVISION, ""}
  75. #define DRIVEINFO_OPTICAL {"ZULUSCSI", "CDROM", PLATFORM_REVISION, ""}
  76. #define DRIVEINFO_FLOPPY {"ZULUSCSI", "FLOPPY", PLATFORM_REVISION, ""}
  77. #define DRIVEINFO_MAGOPT {"ZULUSCSI", "MO_DRIVE", PLATFORM_REVISION, ""}
  78. #define DRIVEINFO_NETWORK {"Dayna", "SCSI/Link", "2.0f", ""}
  79. #define DRIVEINFO_TAPE {"ZULUSCSI", "TAPE", PLATFORM_REVISION, ""}
  80. // Default block size
  81. #define DEFAULT_BLOCKSIZE 512
  82. // Default optical drive blocksize
  83. #define DEFAULT_BLOCKSIZE_OPTICAL 2048
  84. // Default SCSI drive information when Apple quirks are enabled
  85. #define APPLE_DRIVEINFO_FIXED {"CDC", "ZuluSCSI HDD", PLATFORM_REVISION, "1.0"}
  86. #define APPLE_DRIVEINFO_REMOVABLE {"IOMEGA", "BETA230", PLATFORM_REVISION, "2.02"}
  87. #define APPLE_DRIVEINFO_OPTICAL {"MATSHITA", "CD-ROM CR-8004", PLATFORM_REVISION, "1.1f"}
  88. #define APPLE_DRIVEINFO_FLOPPY {"IOMEGA", "Io20S *F", "PP33", ""}
  89. #define APPLE_DRIVEINFO_MAGOPT {"MOST", "RMD-5200", PLATFORM_REVISION, "1.0"}
  90. #define APPLE_DRIVEINFO_NETWORK {"Dayna", "SCSI/Link", "2.0f", ""}
  91. #define APPLE_DRIVEINFO_TAPE {"ZULUSCSI", "APPLE_TAPE", PLATFORM_REVISION, ""}
  92. // Default Iomega ZIP drive information
  93. #define IOMEGA_DRIVEINFO_ZIP100 {"IOMEGA", "ZIP 100", "D.13", ""}
  94. #define IOMEGA_DRIVEINFO_ZIP250 {"IOMEGA", "ZIP 250", "42.S", ""}
  95. #define IOMEGA_DRIVEINFO_JAZ {"iomega", "jaz", "", ""}
  96. // Default delay for SCSI phases.
  97. // Can be adjusted in ini file
  98. #define DEFAULT_SCSI_DELAY_US 10
  99. #define DEFAULT_REQ_TYPE_SETUP_NS 500
  100. // Use prefetch buffer in read requests
  101. #ifndef PREFETCH_BUFFER_SIZE
  102. #define PREFETCH_BUFFER_SIZE 8192
  103. #endif
  104. // Masks for buttons
  105. #define EJECT_BTN_MASK (1|2)
  106. #define USER_BTN_MASK (4)
  107. // Zip disk media sizes
  108. #define ZIP100_DISK_SIZE 100663296 // bytes
  109. #define ZIP250_DISK_SIZE 250640384 // bytes
  110. // Settings for rebooting
  111. #define REBOOT_INTO_MASS_STORAGE_MAGIC_NUM 0x5eeded
  112. // Reclocking return status
  113. typedef enum
  114. {
  115. ZULUSCSI_RECLOCK_SUCCESS,
  116. ZULUSCSI_RECLOCK_CUSTOM,
  117. ZULUSCSI_RECLOCK_NOT_SUPPORTED,
  118. ZULUSCSI_RECLOCK_FAILED
  119. } zuluscsi_reclock_status_t;
  120. typedef enum
  121. {
  122. SPEED_GRADE_DEFAULT,
  123. SPEED_GRADE_MAX,
  124. SPEED_GRADE_CUSTOM,
  125. SPEED_GRADE_A,
  126. SPEED_GRADE_B,
  127. SPEED_GRADE_C,
  128. SPEED_GRADE_AUDIO,
  129. } zuluscsi_speed_grade_t;