scsiPhy.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Interface to SCSI physical interface.
  2. // This file is derived from scsiPhy.h in SCSI2SD-V6.
  3. #pragma once
  4. #include <stdint.h>
  5. #include <stdbool.h>
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. // Read SCSI status signals
  10. bool scsiStatusATN();
  11. bool scsiStatusBSY();
  12. bool scsiStatusSEL();
  13. // Parity not yet implemented
  14. #define scsiParityError() 0
  15. // Get SCSI selection status.
  16. // This is latched by interrupt when BSY is deasserted while SEL is asserted.
  17. // Lowest 3 bits are the selected target id.
  18. // Highest bits are status information.
  19. #define SCSI_STS_SELECTION_SUCCEEDED 0x40
  20. #define SCSI_STS_SELECTION_ATN 0x80
  21. extern volatile uint8_t g_scsi_sts_selection;
  22. #define SCSI_STS_SELECTED (&g_scsi_sts_selection)
  23. extern volatile uint8_t g_scsi_ctrl_bsy;
  24. #define SCSI_CTRL_BSY (&g_scsi_ctrl_bsy)
  25. // Called when SCSI RST signal has been asserted, should release bus.
  26. void scsiPhyReset(void);
  27. // Change MSG / CD / IO signal states and wait for necessary transition time.
  28. // Phase argument is one of SCSI_PHASE enum values.
  29. void scsiEnterPhase(int phase);
  30. // Change state and return nanosecond delay to wait
  31. uint32_t scsiEnterPhaseImmediate(int phase);
  32. // Release all signals
  33. void scsiEnterBusFree(void);
  34. //void scsiSetDataCount(uint32_t count);
  35. //int scsiFifoReady(void);
  36. void scsiWrite(const uint8_t* data, uint32_t count);
  37. void scsiRead(uint8_t* data, uint32_t count, int* parityError);
  38. void scsiWriteByte(uint8_t value);
  39. uint8_t scsiReadByte(void);
  40. #define s2s_getScsiRateKBs() 0
  41. #ifdef __cplusplus
  42. }
  43. #endif