| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 | // Interface to SCSI physical interface.// This file is derived from scsiPhy.h in SCSI2SD-V6.#pragma once#include <stdint.h>#include <stdbool.h>#ifdef __cplusplusextern "C" {#endif// Read SCSI status signalsbool scsiStatusATN();bool scsiStatusBSY();bool scsiStatusSEL();// Parity not yet implemented#define scsiParityError() 0// Get SCSI selection status.// This is latched by interrupt when BSY is deasserted while SEL is asserted.// Lowest 3 bits are the selected target id.// Highest bits are status information.#define SCSI_STS_SELECTION_SUCCEEDED 0x40#define SCSI_STS_SELECTION_ATN 0x80extern volatile uint8_t g_scsi_sts_selection;#define SCSI_STS_SELECTED (&g_scsi_sts_selection)extern volatile uint8_t g_scsi_ctrl_bsy;#define SCSI_CTRL_BSY (&g_scsi_ctrl_bsy)// Called when SCSI RST signal has been asserted, should release bus.void scsiPhyReset(void);// Change MSG / CD / IO signal states and wait for necessary transition time.// Phase argument is one of SCSI_PHASE enum values.void scsiEnterPhase(int phase);// Change state and return nanosecond delay to waituint32_t scsiEnterPhaseImmediate(int phase);// Release all signalsvoid scsiEnterBusFree(void);// Blocking data transfervoid scsiWrite(const uint8_t* data, uint32_t count);void scsiRead(uint8_t* data, uint32_t count, int* parityError);void scsiWriteByte(uint8_t value);uint8_t scsiReadByte(void);// Non-blocking data transfer.// Depending on platform support the start() function may block.// The start function can be called multiple times, it may internally// either combine transfers or block until previous transfer completes.void scsiStartWrite(const uint8_t* data, uint32_t count);void scsiFinishWrite();// Query whether the data at pointer has already been read, i.e. buffer can be reused.// If data is NULL, checks if all writes have completed.bool scsiIsWriteFinished(const uint8_t *data);#define s2s_getScsiRateKBs() 0#ifdef __cplusplus}#endif
 |