BlueSCSI_initiator.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Main state machine for SCSI initiator mode
  2. #pragma once
  3. #include <stdint.h>
  4. #include <stdlib.h>
  5. void scsiInitiatorInit();
  6. void scsiInitiatorMainLoop();
  7. // Select target and execute SCSI command
  8. int scsiInitiatorRunCommand(int target_id,
  9. const uint8_t *command, size_t cmdLen,
  10. uint8_t *bufIn, size_t bufInLen,
  11. const uint8_t *bufOut, size_t bufOutLen,
  12. bool returnDataPhase = false);
  13. // Execute READ CAPACITY command
  14. bool scsiInitiatorReadCapacity(int target_id, uint32_t *sectorcount, uint32_t *sectorsize);
  15. // Execute REQUEST SENSE command to get more information about error status
  16. bool scsiRequestSense(int target_id, uint8_t *sense_key);
  17. // Execute UNIT START STOP command to load/unload media
  18. bool scsiStartStopUnit(int target_id, bool start);
  19. // Execute INQUIRY command
  20. bool scsiInquiry(int target_id, uint8_t inquiry_data[36]);
  21. // Execute TEST UNIT READY command and handle unit attention state
  22. bool scsiTestUnitReady(int target_id);
  23. // Read a block of data from SCSI device and write to file on SD card
  24. class FsFile;
  25. bool scsiInitiatorReadDataToFile(int target_id, uint32_t start_sector, uint32_t sectorcount, uint32_t sectorsize,
  26. FsFile &file);