Merge pull request #5431 from 86Box/tc1995
Trantor SCSI changes of the day (April 2nd, 2025)
This commit is contained in:
@@ -467,9 +467,10 @@ typedef struct scsi_bus_t {
|
||||
int msgout_pos;
|
||||
int is_msgout;
|
||||
int state;
|
||||
int dma_on_pio_enabled;
|
||||
|
||||
uint32_t bus_phase;
|
||||
uint32_t total_len;
|
||||
uint32_t data_repeat;
|
||||
|
||||
double period;
|
||||
double speed;
|
||||
|
||||
@@ -30,7 +30,7 @@ typedef struct t128_t {
|
||||
uint8_t status;
|
||||
uint8_t buffer[512];
|
||||
uint8_t ext_ram[0x80];
|
||||
uint8_t block_count;
|
||||
uint32_t block_count;
|
||||
|
||||
int block_loaded;
|
||||
int pos, host_pos;
|
||||
@@ -39,6 +39,7 @@ typedef struct t128_t {
|
||||
|
||||
int bios_enabled;
|
||||
uint8_t pos_regs[8];
|
||||
int type;
|
||||
|
||||
pc_timer_t timer;
|
||||
} t128_t;
|
||||
|
||||
@@ -130,12 +130,12 @@ t128_read(uint32_t addr, void *priv)
|
||||
(t128->host_pos < MIN(512, dev->buffer_length))) {
|
||||
ret = t128->buffer[t128->host_pos++];
|
||||
|
||||
t128_log("T128 Read transfer: pos=%i, addr=%x.\n",
|
||||
t128->host_pos, addr & 0x1ff);
|
||||
t128_log("T128 Read transfer: pos=%i, addr=%x, enabled timer=%d.\n",
|
||||
t128->host_pos, addr & 0x1ff, timer_is_enabled(&t128->timer));
|
||||
|
||||
if (t128->host_pos == MIN(512, dev->buffer_length)) {
|
||||
t128_log("T128 Transfer busy read, status=%02x, period=%lf, enabled=%d.\n",
|
||||
t128->status, scsi_bus->period, timer_is_enabled(&t128->timer));
|
||||
t128_log("T128 Transfer busy read, status=%02x, period=%lf, enabled=%d, block=%d.\n",
|
||||
t128->status, scsi_bus->period, timer_is_enabled(&t128->timer), scsi_bus->data_pos);
|
||||
|
||||
t128->status &= ~0x04;
|
||||
if (!t128->block_loaded) {
|
||||
@@ -192,10 +192,6 @@ t128_dma_send_ext(void *priv, void *ext_priv)
|
||||
t128_log("T128 DMA OUT, len=%d.\n", dev->buffer_length);
|
||||
memset(t128->buffer, 0, MIN(512, dev->buffer_length));
|
||||
t128->host_pos = 0;
|
||||
t128->block_count = dev->buffer_length >> 9;
|
||||
|
||||
if (dev->buffer_length < 512)
|
||||
t128->block_count = 1;
|
||||
|
||||
t128->block_loaded = 1;
|
||||
t128->status |= 0x04;
|
||||
@@ -215,10 +211,6 @@ t128_dma_initiator_receive_ext(void *priv, void *ext_priv)
|
||||
t128_log("T128 DMA IN, len=%d.\n", dev->buffer_length);
|
||||
memset(t128->buffer, 0, MIN(512, dev->buffer_length));
|
||||
t128->host_pos = MIN(512, dev->buffer_length);
|
||||
t128->block_count = dev->buffer_length >> 9;
|
||||
|
||||
if (dev->buffer_length < 512)
|
||||
t128->block_count = 1;
|
||||
|
||||
t128->block_loaded = 1;
|
||||
t128->status &= ~0x04;
|
||||
@@ -295,9 +287,9 @@ t128_callback(void *priv)
|
||||
t128->status &= ~0x02;
|
||||
t128->pos = 0;
|
||||
t128->host_pos = 0;
|
||||
t128->block_count = (t128->block_count - 1) & 0xff;
|
||||
scsi_bus->data_repeat = 0;
|
||||
t128_log("T128 Remaining blocks to be written=%d\n", t128->block_count);
|
||||
if (!t128->block_count) {
|
||||
if (scsi_bus->data_pos >= dev->buffer_length) {
|
||||
t128->block_loaded = 0;
|
||||
ncr->tcr |= TCR_LAST_BYTE_SENT;
|
||||
ncr->isr |= STATUS_END_OF_DMA;
|
||||
@@ -344,11 +336,11 @@ t128_callback(void *priv)
|
||||
t128->status &= ~0x02;
|
||||
t128->pos = 0;
|
||||
t128->host_pos = 0;
|
||||
t128->block_count = (t128->block_count - 1) & 0xff;
|
||||
t128_log("T128 Remaining blocks to be read=%d\n", t128->block_count);
|
||||
if (!t128->block_count) {
|
||||
t128->block_loaded = 0;
|
||||
scsi_bus->data_repeat = 0;
|
||||
t128_log("T128 blocks read=%d, total len=%d\n", scsi_bus->data_pos, dev->buffer_length);
|
||||
if (scsi_bus->data_pos >= dev->buffer_length) {
|
||||
scsi_bus->bus_out |= BUS_REQ;
|
||||
t128->block_loaded = 0;
|
||||
timer_on_auto(&t128->timer, 10.0);
|
||||
t128_log("IO End of read transfer\n");
|
||||
}
|
||||
@@ -472,6 +464,7 @@ t128_init(const device_t *info)
|
||||
|
||||
ncr->bus = scsi_get_bus();
|
||||
scsi_bus = &ncr->scsibus;
|
||||
t128->type = info->local;
|
||||
|
||||
if (info->flags & DEVICE_MCA) {
|
||||
rom_init(&t128->bios_rom, T128_ROM,
|
||||
|
||||
@@ -792,7 +792,14 @@ pas16_in(uint16_t port, void *priv)
|
||||
if ((scsi_bus->tx_mode == PIO_TX_BUS) && !(ret & 0x80))
|
||||
ret |= 0x80;
|
||||
|
||||
pas16_log("5C01 read ret=%02x, status=%02x, txmode=%x.\n", ret, pas16->scsi->status & 0x06, scsi_bus->tx_mode);
|
||||
if (ret & 0x80) {
|
||||
if (scsi_bus->data_repeat < MIN(511, scsi_bus->total_len))
|
||||
scsi_bus->data_repeat++;
|
||||
} else {
|
||||
if (scsi_bus->data_repeat == MIN(511, scsi_bus->total_len))
|
||||
ret = 0x00;
|
||||
}
|
||||
pas16_log("%04X:%08X: Port %04x read ret=%02x, status=%02x, txmode=%x, repeat=%d.\n", CS, cpu_state.pc, port + pas16->base, ret, pas16->scsi->status & 0x06, scsi_bus->tx_mode, scsi_bus->data_repeat);
|
||||
}
|
||||
break;
|
||||
case 0x5c03:
|
||||
|
||||
Reference in New Issue
Block a user