ZuluSCSI_presets.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #include "ZuluSCSI_presets.h"
  2. #include "ZuluSCSI_disk.h"
  3. #include "ZuluSCSI_log.h"
  4. #include "ZuluSCSI_config.h"
  5. #include <strings.h>
  6. // Helper function for case-insensitive string compare
  7. static bool strequals(const char *a, const char *b)
  8. {
  9. return strcasecmp(a, b) == 0;
  10. }
  11. preset_config_t getSystemPreset(const char *presetName)
  12. {
  13. // Default configuration
  14. preset_config_t cfg = {};
  15. cfg.quirks = S2S_CFG_QUIRKS_NONE;
  16. cfg.deviceTypeModifier = 0;
  17. cfg.sectorsPerTrack = 63;
  18. cfg.headsPerCylinder = 255;
  19. cfg.prefetchBytes = PREFETCH_BUFFER_SIZE;
  20. cfg.selectionDelay = 255;
  21. cfg.maxSyncSpeed = 10;
  22. cfg.enableUnitAttention = false;
  23. cfg.enableSCSI2 = true;
  24. cfg.enableSelLatch = false;
  25. cfg.mapLunsToIDs = false;
  26. cfg.enableParity = true;
  27. cfg.initPreDelay = 0;
  28. // System-specific defaults
  29. if (strequals(presetName, ""))
  30. {
  31. // Preset name is empty, use default configuration
  32. }
  33. else if (strequals(presetName, "Mac"))
  34. {
  35. cfg.presetName = "Mac";
  36. cfg.quirks = S2S_CFG_QUIRKS_APPLE;
  37. }
  38. else if (strequals(presetName, "MacPlus"))
  39. {
  40. cfg.presetName = "MacPlus";
  41. cfg.quirks = S2S_CFG_QUIRKS_APPLE;
  42. cfg.enableSelLatch = true;
  43. cfg.enableSCSI2 = false;
  44. cfg.selectionDelay = 0;
  45. }
  46. else if (strequals(presetName, "MPC3000"))
  47. {
  48. cfg.initPreDelay = 600;
  49. }
  50. else
  51. {
  52. logmsg("Unknown preset name ", presetName, ", using default settings");
  53. }
  54. return cfg;
  55. }