4 #include "hw/scsi/scsi.h"
9 typedef void (*ESPDMAMemoryReadWriteFunc
)(void *opaque
, uint8_t *buf
, int len
);
13 #define ESP_CMDBUF_SZ 32
15 typedef struct ESPState ESPState
;
18 uint8_t rregs
[ESP_REGS
];
19 uint8_t wregs
[ESP_REGS
];
24 uint32_t ti_rptr
, ti_wptr
;
26 uint32_t deferred_status
;
27 bool deferred_complete
;
29 uint8_t ti_buf
[TI_BUFSZ
];
31 SCSIDevice
*current_dev
;
32 SCSIRequest
*current_req
;
33 uint8_t cmdbuf
[ESP_CMDBUF_SZ
];
37 /* The amount of data left in the current DMA transfer. */
39 /* The size of the current DMA transfer. Zero if no transfer is in
47 ESPDMAMemoryReadWriteFunc dma_memory_read
;
48 ESPDMAMemoryReadWriteFunc dma_memory_write
;
50 void (*dma_cb
)(ESPState
*s
);
53 #define TYPE_ESP "esp"
54 #define ESP_STATE(obj) OBJECT_CHECK(SysBusESPState, (obj), TYPE_ESP)
58 SysBusDevice parent_obj
;
71 #define ESP_WBUSID 0x4
75 #define ESP_WSYNTP 0x6
76 #define ESP_RFLAGS 0x7
93 #define CMD_FLUSH 0x01
94 #define CMD_RESET 0x02
95 #define CMD_BUSRESET 0x03
98 #define CMD_MSGACC 0x12
100 #define CMD_SATN 0x1a
101 #define CMD_RSTATN 0x1b
103 #define CMD_SELATN 0x42
104 #define CMD_SELATNS 0x43
105 #define CMD_ENSEL 0x44
106 #define CMD_DISSEL 0x45
114 #define STAT_PIO_MASK 0x06
119 #define STAT_INT 0x80
121 #define BUSID_DID 0x07
126 #define INTR_RST 0x80
131 #define CFG1_RESREPT 0x40
133 #define TCHI_FAS100A 0x4
134 #define TCHI_AM53C974 0x12
136 void esp_dma_enable(ESPState
*s
, int irq
, int level
);
137 void esp_request_cancelled(SCSIRequest
*req
);
138 void esp_command_complete(SCSIRequest
*req
, uint32_t status
, size_t resid
);
139 void esp_transfer_data(SCSIRequest
*req
, uint32_t len
);
140 void esp_hard_reset(ESPState
*s
);
141 uint64_t esp_reg_read(ESPState
*s
, uint32_t saddr
);
142 void esp_reg_write(ESPState
*s
, uint32_t saddr
, uint64_t val
);
143 extern const VMStateDescription vmstate_esp
;