scsiHostPhy.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. // Host side SCSI physical interface.
  2. // Used in initiator to interface to an SCSI drive.
  3. #pragma once
  4. #include <stdint.h>
  5. #include <stdbool.h>
  6. // Request to stop activity and reset the bus
  7. extern volatile int g_scsiHostPhyReset;
  8. // Release bus and pulse RST signal, initialize PHY to host mode.
  9. void scsiHostPhyReset(void);
  10. // Select a device, id 0-7.
  11. // Returns true if the target answers to selection request.
  12. bool scsiHostPhySelect(int target_id, int initiator_id);
  13. // Read the current communication phase as signaled by the target
  14. // Matches SCSI_PHASE enumeration from scsi.h.
  15. int scsiHostPhyGetPhase();
  16. // Returns true if the device has asserted REQ signal, i.e. data waiting
  17. bool scsiHostRequestWaiting();
  18. // Blocking data transfer
  19. // These return the actual number of bytes transferred.
  20. uint32_t scsiHostWrite(const uint8_t *data, uint32_t count);
  21. uint32_t scsiHostRead(uint8_t *data, uint32_t count);
  22. // Release all bus signals
  23. void scsiHostPhyRelease();
  24. void setInitiatorModeParityCheck(bool checkParity);