|
@@ -30,12 +30,13 @@
|
|
|
#include <hardware/structs/iobank0.h>
|
|
#include <hardware/structs/iobank0.h>
|
|
|
#include <hardware/sync.h>
|
|
#include <hardware/sync.h>
|
|
|
|
|
|
|
|
-#ifdef ZULUSCSI_RP2040
|
|
|
|
|
|
|
+#ifdef PLATFORM_HAS_INITIATOR_MODE
|
|
|
|
|
+
|
|
|
|
|
+#ifdef ZULUSCSI_PICO
|
|
|
#include "scsi_accel_host_Pico.pio.h"
|
|
#include "scsi_accel_host_Pico.pio.h"
|
|
|
#else
|
|
#else
|
|
|
#include "scsi_accel_host_RP2040.pio.h"
|
|
#include "scsi_accel_host_RP2040.pio.h"
|
|
|
#endif
|
|
#endif
|
|
|
-#ifdef PLATFORM_HAS_INITIATOR_MODE
|
|
|
|
|
|
|
|
|
|
#define SCSI_PIO pio0
|
|
#define SCSI_PIO pio0
|
|
|
#define SCSI_SM 0
|
|
#define SCSI_SM 0
|
|
@@ -63,14 +64,16 @@ static void scsi_accel_host_config_gpio()
|
|
|
iobank0_hw->io[SCSI_IO_DB6].ctrl = GPIO_FUNC_SIO;
|
|
iobank0_hw->io[SCSI_IO_DB6].ctrl = GPIO_FUNC_SIO;
|
|
|
iobank0_hw->io[SCSI_IO_DB7].ctrl = GPIO_FUNC_SIO;
|
|
iobank0_hw->io[SCSI_IO_DB7].ctrl = GPIO_FUNC_SIO;
|
|
|
iobank0_hw->io[SCSI_IO_DBP].ctrl = GPIO_FUNC_SIO;
|
|
iobank0_hw->io[SCSI_IO_DBP].ctrl = GPIO_FUNC_SIO;
|
|
|
|
|
+ iobank0_hw->io[SCSI_IN_REQ].ctrl = GPIO_FUNC_SIO;
|
|
|
iobank0_hw->io[SCSI_OUT_ACK].ctrl = GPIO_FUNC_SIO;
|
|
iobank0_hw->io[SCSI_OUT_ACK].ctrl = GPIO_FUNC_SIO;
|
|
|
}
|
|
}
|
|
|
else if (g_scsi_host_state == SCSIHOST_READ)
|
|
else if (g_scsi_host_state == SCSIHOST_READ)
|
|
|
{
|
|
{
|
|
|
// Data bus and REQ as input, ACK pin as output
|
|
// Data bus and REQ as input, ACK pin as output
|
|
|
- pio_sm_set_pins(SCSI_PIO, SCSI_SM, 0x7FF);
|
|
|
|
|
- pio_sm_set_consecutive_pindirs(SCSI_PIO, SCSI_SM, 0, 10, false);
|
|
|
|
|
- pio_sm_set_consecutive_pindirs(SCSI_PIO, SCSI_SM, 10, 1, true);
|
|
|
|
|
|
|
+ pio_sm_set_pins(SCSI_PIO, SCSI_SM, SCSI_IO_DATA_MASK | 1 << SCSI_IN_REQ | 1 << SCSI_OUT_ACK);
|
|
|
|
|
+ pio_sm_set_consecutive_pindirs(SCSI_PIO, SCSI_SM, SCSI_IO_DB0, 9, false);
|
|
|
|
|
+ pio_sm_set_consecutive_pindirs(SCSI_PIO, SCSI_SM, SCSI_IN_REQ, 1, false);
|
|
|
|
|
+ pio_sm_set_consecutive_pindirs(SCSI_PIO, SCSI_SM, SCSI_OUT_ACK, 1, true);
|
|
|
|
|
|
|
|
iobank0_hw->io[SCSI_IO_DB0].ctrl = GPIO_FUNC_SIO;
|
|
iobank0_hw->io[SCSI_IO_DB0].ctrl = GPIO_FUNC_SIO;
|
|
|
iobank0_hw->io[SCSI_IO_DB1].ctrl = GPIO_FUNC_SIO;
|
|
iobank0_hw->io[SCSI_IO_DB1].ctrl = GPIO_FUNC_SIO;
|
|
@@ -81,6 +84,7 @@ static void scsi_accel_host_config_gpio()
|
|
|
iobank0_hw->io[SCSI_IO_DB6].ctrl = GPIO_FUNC_SIO;
|
|
iobank0_hw->io[SCSI_IO_DB6].ctrl = GPIO_FUNC_SIO;
|
|
|
iobank0_hw->io[SCSI_IO_DB7].ctrl = GPIO_FUNC_SIO;
|
|
iobank0_hw->io[SCSI_IO_DB7].ctrl = GPIO_FUNC_SIO;
|
|
|
iobank0_hw->io[SCSI_IO_DBP].ctrl = GPIO_FUNC_SIO;
|
|
iobank0_hw->io[SCSI_IO_DBP].ctrl = GPIO_FUNC_SIO;
|
|
|
|
|
+ iobank0_hw->io[SCSI_IN_REQ].ctrl = GPIO_FUNC_SIO;
|
|
|
iobank0_hw->io[SCSI_OUT_ACK].ctrl = GPIO_FUNC_PIO0;
|
|
iobank0_hw->io[SCSI_OUT_ACK].ctrl = GPIO_FUNC_PIO0;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -155,10 +159,8 @@ void scsi_accel_host_init()
|
|
|
g_scsi_host_state = SCSIHOST_IDLE;
|
|
g_scsi_host_state = SCSIHOST_IDLE;
|
|
|
scsi_accel_host_config_gpio();
|
|
scsi_accel_host_config_gpio();
|
|
|
|
|
|
|
|
-#ifndef ZULUSCSI_NETWORK
|
|
|
|
|
// Load PIO programs
|
|
// Load PIO programs
|
|
|
pio_clear_instruction_memory(SCSI_PIO);
|
|
pio_clear_instruction_memory(SCSI_PIO);
|
|
|
-#endif
|
|
|
|
|
|
|
|
|
|
// Asynchronous / synchronous SCSI read
|
|
// Asynchronous / synchronous SCSI read
|
|
|
g_scsi_host.pio_offset_async_read = pio_add_program(SCSI_PIO, &scsi_host_async_read_program);
|
|
g_scsi_host.pio_offset_async_read = pio_add_program(SCSI_PIO, &scsi_host_async_read_program);
|