|
@@ -46,8 +46,7 @@
|
|
#define DEBUG 1 // 0:No debug information output
|
|
#define DEBUG 1 // 0:No debug information output
|
|
// 1: Debug information output to USB Serial
|
|
// 1: Debug information output to USB Serial
|
|
// 2: Debug information output to LOG.txt (slow)
|
|
// 2: Debug information output to LOG.txt (slow)
|
|
-#define XCVR 1 // 0 for standard mode
|
|
|
|
- // 1 for transceiver hardware
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
#ifndef MCU_STM32F401CC
|
|
#ifndef MCU_STM32F401CC
|
|
@@ -59,11 +58,7 @@
|
|
#define VDS "2022-09-20"
|
|
#define VDS "2022-09-20"
|
|
|
|
|
|
// Log File
|
|
// Log File
|
|
-#if XCVR == 1
|
|
|
|
#define VERSION "1.1-" VDS "-XCVR-" MCV
|
|
#define VERSION "1.1-" VDS "-XCVR-" MCV
|
|
-#else
|
|
|
|
-#define VERSION "1.1-" VDS "-" MCV
|
|
|
|
-#endif
|
|
|
|
#define LOG_FILENAME "LOG.txt"
|
|
#define LOG_FILENAME "LOG.txt"
|
|
|
|
|
|
#include "blacksasi.h"
|
|
#include "blacksasi.h"
|
|
@@ -139,7 +134,7 @@ inline byte readIO(void)
|
|
{
|
|
{
|
|
// Port input data register
|
|
// Port input data register
|
|
uint32_t ret = GPIOD->regs->IDR;
|
|
uint32_t ret = GPIOD->regs->IDR;
|
|
- byte bret = (byte)~(((ret >> 8) & 0b11110111) | ((ret & 0x00000004) << 1));
|
|
|
|
|
|
+ byte bret = (byte)~(((ret >> 8) & 0b11111111));
|
|
#if READ_PARITY_CHECK
|
|
#if READ_PARITY_CHECK
|
|
if((db_bsrr[bret]^ret)&1) // TODO fix parity calculation
|
|
if((db_bsrr[bret]^ret)&1) // TODO fix parity calculation
|
|
m_sts |= 0x01; // parity error
|
|
m_sts |= 0x01; // parity error
|
|
@@ -299,7 +294,6 @@ void setup()
|
|
db_bsrr[i] = genBSRR(i);
|
|
db_bsrr[i] = genBSRR(i);
|
|
}
|
|
}
|
|
gpioInit();
|
|
gpioInit();
|
|
- digitalWrite( BOARD_TRANS_OE ,0);
|
|
|
|
// Default all SCSI command handlers to onUnimplemented
|
|
// Default all SCSI command handlers to onUnimplemented
|
|
for(unsigned i = 0; i < MAX_SCSI_COMMAND; i++)
|
|
for(unsigned i = 0; i < MAX_SCSI_COMMAND; i++)
|
|
{
|
|
{
|
|
@@ -372,81 +366,38 @@ void setup()
|
|
#endif
|
|
#endif
|
|
delay(3000);
|
|
delay(3000);
|
|
|
|
|
|
- // PIN initialization
|
|
|
|
- pinMode(BOARD_LED1_PIN, OUTPUT);
|
|
|
|
- pinMode(BOARD_LED2_PIN, OUTPUT);
|
|
|
|
-
|
|
|
|
- // Image Set Select Init
|
|
|
|
- pinMode(IMAGE_SELECT1, INPUT_PULLUP);
|
|
|
|
- pinMode(IMAGE_SELECT2, INPUT_PULLUP);
|
|
|
|
- pinMode(IMAGE_SELECT1, INPUT);
|
|
|
|
- pinMode(IMAGE_SELECT2, INPUT);
|
|
|
|
- int image_file_set = ((digitalRead(IMAGE_SELECT1) == LOW) ? 1 : 0) | ((digitalRead(IMAGE_SELECT2) == LOW) ? 2 : 0);
|
|
|
|
|
|
+
|
|
|
|
+ int image_file_set = ((digitalRead(BOARD_SWITCH1_PIN) == LOW) ) | ((digitalRead(BOARD_SWITCH2_PIN) == LOW) ) << 1 | ((digitalRead(BOARD_SWITCH3_PIN) == LOW) ) << 2 | ((digitalRead(BOARD_SWITCH4_PIN) == LOW) ) << 3;
|
|
|
|
|
|
-#if XCVR == 1
|
|
|
|
|
|
+
|
|
// Transceiver Pin Initialization
|
|
// Transceiver Pin Initialization
|
|
- pinMode(TR_TARGET, OUTPUT);
|
|
|
|
- pinMode(TR_INITIATOR, OUTPUT);
|
|
|
|
- pinMode(TR_DBP, OUTPUT);
|
|
|
|
|
|
+ pinMode(BOARD_SCSI_TAD, OUTPUT);
|
|
|
|
+ pinMode(BOARD_SCSI_IND, OUTPUT);
|
|
|
|
+ pinMode(BOARD_SCSI_DTD, OUTPUT);
|
|
|
|
|
|
- TRANSCEIVER_IO_SET(vTR_INITIATOR,TR_INPUT);
|
|
|
|
- TRANSCEIVER_IO_SET(vTR_TARGET,TR_INPUT);
|
|
|
|
-#else
|
|
|
|
- // set up OTYPER for open drain on SCSI pins of PA and PB
|
|
|
|
- // PA 0-7, 11-14
|
|
|
|
- uint32_t oTypeA_And = 0x000078FF;
|
|
|
|
- // PA 8, 9, 10, 15
|
|
|
|
- uint32_t oTypeA_Or = 0x00008700;
|
|
|
|
-#ifndef MCU_STM32F401CC
|
|
|
|
- GPIOA->regs->OTYPER = (GPIOA->regs->OTYPER & oTypeA_And) | oTypeA_Or;
|
|
|
|
-#endif
|
|
|
|
|
|
+ TRANSCEIVER_IO_SET(vIND,TR_INPUT);
|
|
|
|
+ TRANSCEIVER_IO_SET(vTAD,TR_INPUT);
|
|
|
|
|
|
- // PB 1, 11 are not used
|
|
|
|
- uint32_t oTypeB_And = 0x00000802;
|
|
|
|
- // PB 0, 2-10, 12-15 are used for SCSI, set open drain
|
|
|
|
- uint32_t oTypeB_Or = 0x0000F7FD;
|
|
|
|
-#ifndef MCU_STM32F401CC
|
|
|
|
- GPIOB->regs->OTYPER = (GPIOB->regs->OTYPER & oTypeB_And) | oTypeB_Or;
|
|
|
|
-#endif
|
|
|
|
-#endif
|
|
|
|
|
|
|
|
SCSI_DB_INPUT()
|
|
SCSI_DB_INPUT()
|
|
|
|
|
|
-#if XCVR == 1
|
|
|
|
- TRANSCEIVER_IO_SET(vTR_DBP,TR_INPUT);
|
|
|
|
|
|
+ TRANSCEIVER_IO_SET(vDTD,DB_INPUT);
|
|
|
|
|
|
// Initiator port
|
|
// Initiator port
|
|
- pinMode(ATN, INPUT);
|
|
|
|
- pinMode(BSY, INPUT);
|
|
|
|
- pinMode(ACK, INPUT);
|
|
|
|
- pinMode(RST, INPUT);
|
|
|
|
- pinMode(SEL, INPUT);
|
|
|
|
- TRANSCEIVER_IO_SET(vTR_INITIATOR,TR_INPUT);
|
|
|
|
|
|
+ pinMode(BOARD_SCSI_ATN, INPUT);
|
|
|
|
+ pinMode(BOARD_SCSI_BSY, INPUT);
|
|
|
|
+ pinMode(BOARD_SCSI_ACK, INPUT);
|
|
|
|
+ pinMode(BOARD_SCSI_RST, INPUT);
|
|
|
|
+ pinMode(BOARD_SCSI_SEL, INPUT);
|
|
|
|
+ TRANSCEIVER_IO_SET(vIND,TR_INPUT);
|
|
|
|
|
|
// Target port
|
|
// Target port
|
|
- pinMode(MSG, INPUT);
|
|
|
|
- pinMode(CD, INPUT);
|
|
|
|
- pinMode(REQ, INPUT);
|
|
|
|
- pinMode(IO, INPUT);
|
|
|
|
- TRANSCEIVER_IO_SET(vTR_TARGET,TR_INPUT);
|
|
|
|
|
|
+ pinMode(BOARD_SCSI_MSG, INPUT);
|
|
|
|
+ pinMode(BOARD_SCSI_CD, INPUT);
|
|
|
|
+ pinMode(BOARD_SCSI_REQ, INPUT);
|
|
|
|
+ pinMode(BOARD_SCSI_IO, INPUT);
|
|
|
|
+ TRANSCEIVER_IO_SET(vTAD,TR_INPUT);
|
|
|
|
|
|
-#else
|
|
|
|
-
|
|
|
|
- // Input port
|
|
|
|
- pinMode(ATN, INPUT_PULLUP);
|
|
|
|
- pinMode(BSY, INPUT_PULLUP);
|
|
|
|
- pinMode(ACK, INPUT_PULLUP);
|
|
|
|
- pinMode(RST, INPUT_PULLUP);
|
|
|
|
- pinMode(SEL, INPUT_PULLUP);
|
|
|
|
-
|
|
|
|
- // Output port
|
|
|
|
- pinMode(MSG, OUTPUT_OPEN_DRAIN);
|
|
|
|
- pinMode(CD, OUTPUT_OPEN_DRAIN);
|
|
|
|
- pinMode(REQ, OUTPUT_OPEN_DRAIN);
|
|
|
|
- pinMode(IO, OUTPUT_OPEN_DRAIN);
|
|
|
|
-
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
// Turn off the output port
|
|
// Turn off the output port
|
|
SCSI_TARGET_INACTIVE()
|
|
SCSI_TARGET_INACTIVE()
|
|
|
|
|
|
@@ -517,7 +468,7 @@ void setup()
|
|
finalizeFileLog();
|
|
finalizeFileLog();
|
|
LED1_OFF();
|
|
LED1_OFF();
|
|
//Occurs when the RST pin state changes from HIGH to LOW
|
|
//Occurs when the RST pin state changes from HIGH to LOW
|
|
- attachInterrupt(RST, onBusReset, FALLING);
|
|
|
|
|
|
+ attachInterrupt(BOARD_SCSI_RST, onBusReset, FALLING);
|
|
}
|
|
}
|
|
|
|
|
|
void findDriveImages(FsFile root) {
|
|
void findDriveImages(FsFile root) {
|
|
@@ -738,9 +689,9 @@ void longjmpFromInterrupt(jmp_buf jmpb, int retval) {
|
|
*/
|
|
*/
|
|
void onBusReset(void)
|
|
void onBusReset(void)
|
|
{
|
|
{
|
|
- if(isHigh(digitalRead(RST))) {
|
|
|
|
|
|
+ if(isHigh(digitalRead(BOARD_SCSI_RST))) {
|
|
delayMicroseconds(20);
|
|
delayMicroseconds(20);
|
|
- if(isHigh(digitalRead(RST))) {
|
|
|
|
|
|
+ if(isHigh(digitalRead(BOARD_SCSI_RST))) {
|
|
// BUS FREE is done in the main process
|
|
// BUS FREE is done in the main process
|
|
// gpio_mode(MSG, GPIO_OUTPUT_OD);
|
|
// gpio_mode(MSG, GPIO_OUTPUT_OD);
|
|
// gpio_mode(CD, GPIO_OUTPUT_OD);
|
|
// gpio_mode(CD, GPIO_OUTPUT_OD);
|
|
@@ -794,9 +745,7 @@ inline void writeHandshake(byte d)
|
|
{
|
|
{
|
|
// This has a 400ns bus settle delay built in. Not optimal for multi-byte transfers.
|
|
// This has a 400ns bus settle delay built in. Not optimal for multi-byte transfers.
|
|
GPIOB->regs->BSRR = db_bsrr[d]; // setup DB,DBP (160ns)
|
|
GPIOB->regs->BSRR = db_bsrr[d]; // setup DB,DBP (160ns)
|
|
-#if XCVR == 1
|
|
|
|
- TRANSCEIVER_IO_SET(vTR_DBP,TR_OUTPUT)
|
|
|
|
-#endif
|
|
|
|
|
|
+ TRANSCEIVER_IO_SET(vDTD,DB_OUTPUT)
|
|
SCSI_DB_OUTPUT() // (180ns)
|
|
SCSI_DB_OUTPUT() // (180ns)
|
|
// ACK.Fall to DB output delay 100ns(MAX) (DTC-510B)
|
|
// ACK.Fall to DB output delay 100ns(MAX) (DTC-510B)
|
|
SCSI_OUT(vREQ,inactive) // setup wait (30ns)
|
|
SCSI_OUT(vREQ,inactive) // setup wait (30ns)
|
|
@@ -811,9 +760,7 @@ inline void writeHandshake(byte d)
|
|
|
|
|
|
// REQ.Raise to DB hold time 0ns
|
|
// REQ.Raise to DB hold time 0ns
|
|
SCSI_DB_INPUT() // (150ns)
|
|
SCSI_DB_INPUT() // (150ns)
|
|
-#if XCVR == 1
|
|
|
|
- TRANSCEIVER_IO_SET(vTR_DBP,TR_INPUT)
|
|
|
|
-#endif
|
|
|
|
|
|
+ TRANSCEIVER_IO_SET(vDTD,DB_INPUT)
|
|
while( SCSI_IN(vACK));
|
|
while( SCSI_IN(vACK));
|
|
}
|
|
}
|
|
|
|
|
|
@@ -828,9 +775,7 @@ inline void writeHandshake(byte d)
|
|
* Alignment matters. For the 3 instruction wait loops,it looks like crossing
|
|
* Alignment matters. For the 3 instruction wait loops,it looks like crossing
|
|
* an 8 byte prefetch buffer can add 2 cycles of wait every branch taken.
|
|
* an 8 byte prefetch buffer can add 2 cycles of wait every branch taken.
|
|
*/
|
|
*/
|
|
-#if XCVR == 0
|
|
|
|
-void writeDataLoop(uint32_t blocksize, const byte* srcptr) __attribute__ ((aligned(8)));
|
|
|
|
-#endif
|
|
|
|
|
|
+
|
|
void writeDataLoop(uint32_t blocksize, const byte* srcptr) {
|
|
void writeDataLoop(uint32_t blocksize, const byte* srcptr) {
|
|
#define REQ_ON() (PBREG->BSRR = req_rst_bit);
|
|
#define REQ_ON() (PBREG->BSRR = req_rst_bit);
|
|
#define FETCH_BSRR_DB() (bsrr_val = bsrr_tbl[*srcptr++])
|
|
#define FETCH_BSRR_DB() (bsrr_val = bsrr_tbl[*srcptr++])
|
|
@@ -855,24 +800,14 @@ void writeDataLoop(uint32_t blocksize, const byte* srcptr) {
|
|
WAIT_ACK_ACTIVE();
|
|
WAIT_ACK_ACTIVE();
|
|
REQ_OFF_DB_SET(bsrr_val);
|
|
REQ_OFF_DB_SET(bsrr_val);
|
|
// Align the starts of the do/while and WAIT loops to an 8 byte prefetch.
|
|
// Align the starts of the do/while and WAIT loops to an 8 byte prefetch.
|
|
-#if XCVR == 0
|
|
|
|
- asm("nop.w;nop");
|
|
|
|
-#endif
|
|
|
|
|
|
+
|
|
do{
|
|
do{
|
|
WAIT_ACK_INACTIVE();
|
|
WAIT_ACK_INACTIVE();
|
|
REQ_ON();
|
|
REQ_ON();
|
|
// 4 cycles of work
|
|
// 4 cycles of work
|
|
FETCH_BSRR_DB();
|
|
FETCH_BSRR_DB();
|
|
- // Extra 1 cycle delay while keeping the loop within an 8 byte prefetch.
|
|
|
|
-#if XCVR == 0
|
|
|
|
- asm("nop");
|
|
|
|
-#endif
|
|
|
|
WAIT_ACK_ACTIVE();
|
|
WAIT_ACK_ACTIVE();
|
|
REQ_OFF_DB_SET(bsrr_val);
|
|
REQ_OFF_DB_SET(bsrr_val);
|
|
- // Extra 1 cycle delay, plus 4 cycles for the branch taken with prefetch.
|
|
|
|
-#if XCVR == 0
|
|
|
|
- asm("nop");
|
|
|
|
-#endif
|
|
|
|
}while(srcptr < endptr);
|
|
}while(srcptr < endptr);
|
|
WAIT_ACK_INACTIVE();
|
|
WAIT_ACK_INACTIVE();
|
|
// Finish the last bus cycle, byte is already on DB.
|
|
// Finish the last bus cycle, byte is already on DB.
|
|
@@ -892,15 +827,11 @@ void writeDataPhase(int len, const byte* p)
|
|
LOG(" DI ");
|
|
LOG(" DI ");
|
|
SCSI_PHASE_CHANGE(SCSI_PHASE_DATAIN);
|
|
SCSI_PHASE_CHANGE(SCSI_PHASE_DATAIN);
|
|
// Bus settle delay 400ns. Following code was measured at 800ns before REQ asserted. STM32F103.
|
|
// Bus settle delay 400ns. Following code was measured at 800ns before REQ asserted. STM32F103.
|
|
-#if XCVR == 1
|
|
|
|
- TRANSCEIVER_IO_SET(vTR_DBP,TR_OUTPUT)
|
|
|
|
-#endif
|
|
|
|
|
|
+ TRANSCEIVER_IO_SET(vDTD,TR_OUTPUT)
|
|
SCSI_DB_OUTPUT()
|
|
SCSI_DB_OUTPUT()
|
|
writeDataLoop(len, p);
|
|
writeDataLoop(len, p);
|
|
SCSI_DB_INPUT()
|
|
SCSI_DB_INPUT()
|
|
-#if XCVR == 1
|
|
|
|
- TRANSCEIVER_IO_SET(vTR_DBP,TR_INPUT)
|
|
|
|
-#endif
|
|
|
|
|
|
+ TRANSCEIVER_IO_SET(vDTD,DB_INPUT)
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -915,9 +846,7 @@ void writeDataPhaseSD(SCSI_DEVICE *dev, uint32_t adds, uint32_t len)
|
|
uint64_t pos = (uint64_t)adds * dev->m_rawblocksize;
|
|
uint64_t pos = (uint64_t)adds * dev->m_rawblocksize;
|
|
dev->m_file->seekSet(pos);
|
|
dev->m_file->seekSet(pos);
|
|
|
|
|
|
-#if XCVR == 1
|
|
|
|
- TRANSCEIVER_IO_SET(vTR_DBP,TR_OUTPUT)
|
|
|
|
-#endif
|
|
|
|
|
|
+ TRANSCEIVER_IO_SET(vDTD,DB_OUTPUT)
|
|
SCSI_DB_OUTPUT()
|
|
SCSI_DB_OUTPUT()
|
|
|
|
|
|
for(uint32_t i = 0; i < len; i++) {
|
|
for(uint32_t i = 0; i < len; i++) {
|
|
@@ -929,9 +858,7 @@ void writeDataPhaseSD(SCSI_DEVICE *dev, uint32_t adds, uint32_t len)
|
|
writeDataLoop(dev->m_blocksize, &m_buf[dev->m_sector_offset]);
|
|
writeDataLoop(dev->m_blocksize, &m_buf[dev->m_sector_offset]);
|
|
}
|
|
}
|
|
SCSI_DB_INPUT()
|
|
SCSI_DB_INPUT()
|
|
-#if XCVR == 1
|
|
|
|
- TRANSCEIVER_IO_SET(vTR_DBP,TR_INPUT)
|
|
|
|
-#endif
|
|
|
|
|
|
+ TRANSCEIVER_IO_SET(vDTD,DB_INPUT)
|
|
}
|
|
}
|
|
|
|
|
|
#pragma GCC push_options
|
|
#pragma GCC push_options
|
|
@@ -1047,20 +974,18 @@ void MsgIn2(int msg)
|
|
*/
|
|
*/
|
|
void loop()
|
|
void loop()
|
|
{
|
|
{
|
|
-#if XCVR == 1
|
|
|
|
// Reset all DB and Target pins, switch transceivers to input
|
|
// Reset all DB and Target pins, switch transceivers to input
|
|
// Precaution against bugs or jumps which don't clean up properly
|
|
// Precaution against bugs or jumps which don't clean up properly
|
|
SCSI_DB_INPUT();
|
|
SCSI_DB_INPUT();
|
|
- TRANSCEIVER_IO_SET(vTR_DBP,TR_INPUT)
|
|
|
|
|
|
+ TRANSCEIVER_IO_SET(vDTD,DB_INPUT)
|
|
SCSI_TARGET_INACTIVE();
|
|
SCSI_TARGET_INACTIVE();
|
|
- TRANSCEIVER_IO_SET(vTR_TARGET,TR_INPUT)
|
|
|
|
-
|
|
|
|
|
|
|
|
// Reset target state bits (BSY, MSG, CD, REQ, IO)
|
|
// Reset target state bits (BSY, MSG, CD, REQ, IO)
|
|
- GPIOB->regs->BSRR = 0x000000E8; // MSG, CD, REQ, IO
|
|
|
|
- GPIOA->regs->BSRR = 0x00000200; // BSY
|
|
|
|
- TRANSCEIVER_IO_SET(vTR_INITIATOR,TR_INPUT)
|
|
|
|
-#endif
|
|
|
|
|
|
+
|
|
|
|
+ GPIOE->regs->BSRR = 0x00000074; // MSG, CD, REQ, IO
|
|
|
|
+ GPIOB->regs->BSRR = 0x00000040; // BOARD_SCSI_BSY
|
|
|
|
+ TRANSCEIVER_IO_SET(vTAD,TR_INPUT)
|
|
|
|
+ TRANSCEIVER_IO_SET(vIND,TR_INPUT)
|
|
LED3_ON();
|
|
LED3_ON();
|
|
|
|
|
|
//int msg = 0;
|
|
//int msg = 0;
|
|
@@ -1088,17 +1013,15 @@ void loop()
|
|
}
|
|
}
|
|
// We've been selected
|
|
// We've been selected
|
|
|
|
|
|
-#if XCVR == 1
|
|
|
|
- TRANSCEIVER_IO_SET(vTR_TARGET,TR_OUTPUT);
|
|
|
|
- TRANSCEIVER_IO_SET(vTR_INITIATOR,TR_OUTPUT);
|
|
|
|
-#endif
|
|
|
|
|
|
+ TRANSCEIVER_IO_SET(vTAD,TR_OUTPUT);
|
|
|
|
+ TRANSCEIVER_IO_SET(vIND,TR_OUTPUT);
|
|
SCSI_TARGET_ACTIVE() // (BSY), REQ, MSG, CD, IO output turned on
|
|
SCSI_TARGET_ACTIVE() // (BSY), REQ, MSG, CD, IO output turned on
|
|
|
|
|
|
// Set BSY to-when selected
|
|
// Set BSY to-when selected
|
|
SCSI_BSY_ACTIVE(); // Turn only BSY output ON, ACTIVE
|
|
SCSI_BSY_ACTIVE(); // Turn only BSY output ON, ACTIVE
|
|
|
|
|
|
// Wait until SEL becomes inactive
|
|
// Wait until SEL becomes inactive
|
|
- while(isHigh(digitalRead(SEL))) {}
|
|
|
|
|
|
+ while(isHigh(digitalRead(BOARD_SCSI_SEL))) {}
|
|
|
|
|
|
// Ask for a TARGET-ID to respond
|
|
// Ask for a TARGET-ID to respond
|
|
m_id = 31 - __builtin_clz(scsiid);
|
|
m_id = 31 - __builtin_clz(scsiid);
|
|
@@ -1111,7 +1034,7 @@ void loop()
|
|
enableResetJmp();
|
|
enableResetJmp();
|
|
|
|
|
|
// In SCSI-2 this is mandatory, but in SCSI-1 it's optional
|
|
// In SCSI-2 this is mandatory, but in SCSI-1 it's optional
|
|
- if(isHigh(digitalRead(ATN))) {
|
|
|
|
|
|
+ if(isHigh(digitalRead(BOARD_SCSI_ATN))) {
|
|
SCSI_PHASE_CHANGE(SCSI_PHASE_MESSAGEOUT);
|
|
SCSI_PHASE_CHANGE(SCSI_PHASE_MESSAGEOUT);
|
|
// Bus settle delay 400ns. Following code was measured at 350ns before REQ asserted. Added another 50ns. STM32F103.
|
|
// Bus settle delay 400ns. Following code was measured at 350ns before REQ asserted. Added another 50ns. STM32F103.
|
|
SCSI_PHASE_CHANGE(SCSI_PHASE_MESSAGEOUT);// 28ns delay STM32F103
|
|
SCSI_PHASE_CHANGE(SCSI_PHASE_MESSAGEOUT);// 28ns delay STM32F103
|
|
@@ -1120,7 +1043,7 @@ void loop()
|
|
int syncperiod = 50;
|
|
int syncperiod = 50;
|
|
int syncoffset = 0;
|
|
int syncoffset = 0;
|
|
int msc = 0;
|
|
int msc = 0;
|
|
- while(isHigh(digitalRead(ATN)) && msc < 255) {
|
|
|
|
|
|
+ while(isHigh(digitalRead(BOARD_SCSI_ATN)) && msc < 255) {
|
|
m_msb[msc++] = readHandshake();
|
|
m_msb[msc++] = readHandshake();
|
|
}
|
|
}
|
|
for(int i = 0; i < msc; i++) {
|
|
for(int i = 0; i < msc; i++) {
|
|
@@ -1287,16 +1210,14 @@ BusFree:
|
|
//SCSI_OUT(vIO ,inactive) // gpio_write(IO, low);
|
|
//SCSI_OUT(vIO ,inactive) // gpio_write(IO, low);
|
|
//SCSI_OUT(vBSY,inactive)
|
|
//SCSI_OUT(vBSY,inactive)
|
|
SCSI_TARGET_INACTIVE() // Turn off BSY, REQ, MSG, CD, IO output
|
|
SCSI_TARGET_INACTIVE() // Turn off BSY, REQ, MSG, CD, IO output
|
|
-#if XCVR == 1
|
|
|
|
- TRANSCEIVER_IO_SET(vTR_TARGET,TR_INPUT);
|
|
|
|
- TRANSCEIVER_IO_SET(vTR_INITIATOR,TR_INPUT);
|
|
|
|
|
|
+ TRANSCEIVER_IO_SET(vTAD,TR_INPUT);
|
|
|
|
+ TRANSCEIVER_IO_SET(vIND,TR_INPUT);
|
|
// Something in code linked after this function is performing better with a +4 alignment.
|
|
// Something in code linked after this function is performing better with a +4 alignment.
|
|
// Adding this nop is causing the next function (_GLOBAL__sub_I_SD) to have an address with a last digit of 0x4.
|
|
// Adding this nop is causing the next function (_GLOBAL__sub_I_SD) to have an address with a last digit of 0x4.
|
|
// Last digit of 0xc also works.
|
|
// Last digit of 0xc also works.
|
|
// This affects both with and without XCVR, currently without XCVR doesn't need any padding.
|
|
// This affects both with and without XCVR, currently without XCVR doesn't need any padding.
|
|
// Until the culprit can be tracked down and fixed, it may be necessary to do manual adjustment.
|
|
// Until the culprit can be tracked down and fixed, it may be necessary to do manual adjustment.
|
|
asm("nop.w");
|
|
asm("nop.w");
|
|
-#endif
|
|
|
|
}
|
|
}
|
|
|
|
|
|
static byte onUnimplemented(SCSI_DEVICE *dev, const byte *cdb)
|
|
static byte onUnimplemented(SCSI_DEVICE *dev, const byte *cdb)
|