config.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef __BLACKSASI_CONFIG_H__
  2. #define __BLACKSASI_CONFIG_H__
  3. #include <SdFat.h>
  4. #include "sdios.h"
  5. #include "blacksasi.h"
  6. typedef enum
  7. {
  8. S2S_CFG_QUIRKS_NONE = 0,
  9. S2S_CFG_QUIRKS_APPLE = 1,
  10. S2S_CFG_QUIRKS_OMTI = 2,
  11. S2S_CFG_QUIRKS_XEBEC = 4,
  12. S2S_CFG_QUIRKS_VMS = 8,
  13. S2S_CFG_QUIRKS_X68000 = 16,
  14. } S2S_CFG_QUIRKS;
  15. struct SCSI_INQUIRY_DATA
  16. {
  17. union
  18. {
  19. struct {
  20. // bitfields are in REVERSE order for ARM
  21. // byte 0
  22. byte peripheral_device_type:5;
  23. byte peripheral_qualifier:3;
  24. // byte 1
  25. byte reserved_byte2:7;
  26. byte rmb:1;
  27. // byte 2
  28. byte ansi_version:3;
  29. byte always_zero_byte3:5;
  30. // byte 3
  31. byte response_format:4;
  32. byte reserved_byte4:2;
  33. byte tiop:1;
  34. byte always_zero_byte4:1;
  35. // byte 4
  36. byte additional_length;
  37. // byte 5-6
  38. byte reserved_byte5;
  39. byte reserved_byte6;
  40. // byte 7
  41. byte sync:1;
  42. byte always_zero_byte7_more:4;
  43. byte always_zero_byte7:3;
  44. // byte 8-15
  45. char vendor[8];
  46. // byte 16-31
  47. char product[16];
  48. // byte 32-35
  49. char revision[4];
  50. // byte 36
  51. byte release;
  52. // 37-46
  53. char revision_date[10];
  54. };
  55. // raw bytes
  56. byte raw[64];
  57. };
  58. };
  59. // HDD image
  60. typedef __attribute__((aligned(4))) struct _SCSI_DEVICE
  61. {
  62. FsFile *m_file; // File object
  63. uint64_t m_fileSize; // File size
  64. uint16_t m_blocksize; // SCSI BLOCK size
  65. uint16_t m_rawblocksize; // OPTICAL raw sector size
  66. uint8_t m_type; // SCSI device type
  67. uint32_t m_blockcount; // blockcount
  68. bool m_raw; // Raw disk
  69. SCSI_INQUIRY_DATA *inquiry_block; // SCSI information
  70. uint8_t m_senseKey; // Sense key
  71. uint16_t m_additional_sense_code; // ASC/ASCQ
  72. bool m_mode2; // MODE2 CDROM
  73. uint8_t m_sector_offset; // optical sector offset for missing sync header
  74. uint16_t m_quirks;
  75. } SCSI_DEVICE;
  76. uint32 readSCSIDeviceConfig(SCSI_DEVICE *dev);
  77. uint32 readHWVersion();
  78. #endif // __BLACKSASI_CONFIG_H__