Seems to boot

This commit is contained in:
androda 2022-04-14 06:44:19 -06:00
parent 4d3ee87c56
commit d593c0817c

View File

@ -180,8 +180,9 @@ SdFs SD;
// Turn on the output only for BSY // Turn on the output only for BSY
#define SCSI_BSY_ACTIVE() { gpio_mode(BSY, GPIO_OUTPUT_PP); SCSI_OUT(vBSY, active) } #define SCSI_BSY_ACTIVE() { gpio_mode(BSY, GPIO_OUTPUT_PP); SCSI_OUT(vBSY, active) }
#define SCSI_TARGET_ACTIVE() { gpio_mode(REQ, GPIO_OUTPUT_PP); gpio_mode(MSG, GPIO_OUTPUT_PP); gpio_mode(CD, GPIO_OUTPUT_PP); gpio_mode(IO, GPIO_OUTPUT_PP); gpio_mode(BSY, GPIO_OUTPUT_PP); TRANSCEIVER_IO_SET(vTR_TARGET,TR_OUTPUT);}
// BSY,REQ,MSG,CD,IO Turn off output, BSY is the last input // BSY,REQ,MSG,CD,IO Turn off output, BSY is the last input
#define SCSI_TARGET_INACTIVE() { gpio_mode(REQ, GPIO_INPUT_FLOATING); gpio_mode(MSG, GPIO_INPUT_FLOATING); gpio_mode(CD, GPIO_INPUT_FLOATING); gpio_mode(IO, GPIO_INPUT_FLOATING); gpio_mode(BSY, GPIO_INPUT_FLOATING); TRANSCEIVER_IO_SET(vTR_TARGET,TR_INPUT); } #define SCSI_TARGET_INACTIVE() { pinMode(REQ, INPUT); pinMode(MSG, INPUT); pinMode(CD, INPUT); pinMode(IO, INPUT); pinMode(BSY, INPUT); TRANSCEIVER_IO_SET(vTR_TARGET,TR_INPUT); }
#define DB_MODE_OUT 1 // push-pull mode #define DB_MODE_OUT 1 // push-pull mode
#define DB_MODE_IN 4 // floating inputs #define DB_MODE_IN 4 // floating inputs
@ -209,7 +210,7 @@ SdFs SD;
// Put DB and DP in output mode // Put DB and DP in output mode
#define SCSI_DB_OUTPUT() { PBREG->CRL=(PBREG->CRL &0xfffffff0)|DB_MODE_OUT; PBREG->CRH = 0x11111111*DB_MODE_OUT; } #define SCSI_DB_OUTPUT() { PBREG->CRL=(PBREG->CRL &0xfffffff0)|DB_MODE_OUT; PBREG->CRH = 0x11111111*DB_MODE_OUT; }
// Put DB and DP in input mode // Put DB and DP in input mode
#define SCSI_DB_INPUT() { PBREG->CRL=(PBREG->CRL &0xfffffff0)|DB_MODE_IN ; PBREG->CRH = 0x11111111*DB_MODE_IN; if (DB_MODE_IN == 8) PBREG->BSRR = 0xFF01;} #define SCSI_DB_INPUT() { PBREG->CRL=(PBREG->CRL &0xfffffff0)|DB_MODE_IN ; PBREG->CRH = 0x11111111*DB_MODE_IN; }
// HDDiamge file // HDDiamge file
#define HDIMG_ID_POS 2 // Position to embed ID number #define HDIMG_ID_POS 2 // Position to embed ID number
@ -445,9 +446,9 @@ void setup()
#if XCVR == 1 #if XCVR == 1
// Transceiver Pin Initialization // Transceiver Pin Initialization
gpio_mode(TR_TARGET, GPIO_OUTPUT_PP); pinMode(TR_TARGET, OUTPUT);
gpio_mode(TR_INITIATOR, GPIO_OUTPUT_PP); pinMode(TR_INITIATOR, OUTPUT);
gpio_mode(TR_DBP, GPIO_OUTPUT_PP); pinMode(TR_DBP, OUTPUT);
TRANSCEIVER_IO_SET(vTR_INITIATOR,TR_INPUT); TRANSCEIVER_IO_SET(vTR_INITIATOR,TR_INPUT);
#endif #endif
@ -465,18 +466,18 @@ void setup()
TRANSCEIVER_IO_SET(vTR_DBP,TR_INPUT); TRANSCEIVER_IO_SET(vTR_DBP,TR_INPUT);
// Initiator port // Initiator port
gpio_mode(ATN, GPIO_INPUT_FLOATING); pinMode(ATN, INPUT);
gpio_mode(BSY, GPIO_INPUT_FLOATING); pinMode(BSY, INPUT);
gpio_mode(ACK, GPIO_INPUT_FLOATING); pinMode(ACK, INPUT);
gpio_mode(RST, GPIO_INPUT_FLOATING); pinMode(RST, INPUT);
gpio_mode(SEL, GPIO_INPUT_FLOATING); pinMode(SEL, INPUT);
TRANSCEIVER_IO_SET(vTR_INITIATOR,TR_INPUT); TRANSCEIVER_IO_SET(vTR_INITIATOR,TR_INPUT);
// Target port // Target port
gpio_mode(MSG, GPIO_INPUT_FLOATING); pinMode(MSG, INPUT);
gpio_mode(CD, GPIO_INPUT_FLOATING); pinMode(CD, INPUT);
gpio_mode(REQ, GPIO_INPUT_FLOATING); pinMode(REQ, INPUT);
gpio_mode(IO, GPIO_INPUT_FLOATING); pinMode(IO, INPUT);
TRANSCEIVER_IO_SET(vTR_TARGET,TR_INPUT); TRANSCEIVER_IO_SET(vTR_TARGET,TR_INPUT);
#else #else
// Input port // Input port
@ -490,10 +491,10 @@ void setup()
gpio_mode(CD, GPIO_OUTPUT_OD); gpio_mode(CD, GPIO_OUTPUT_OD);
gpio_mode(REQ, GPIO_OUTPUT_OD); gpio_mode(REQ, GPIO_OUTPUT_OD);
gpio_mode(IO, GPIO_OUTPUT_OD); gpio_mode(IO, GPIO_OUTPUT_OD);
#endif
// Turn off the output port // Turn off the output port
SCSI_TARGET_INACTIVE() SCSI_TARGET_INACTIVE()
#endif
//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(RST, onBusReset, FALLING);
@ -1576,7 +1577,10 @@ void loop()
enableResetJmp(); enableResetJmp();
#if XCVR == 1 #if XCVR == 1
TRANSCEIVER_IO_SET(vTR_TARGET,TR_OUTPUT); // Reconfigure target pins to output mode, after resetting their values
GPIOB->regs->BSRR = 0x000000E8; // MSG, CD, REQ, IO
GPIOA->regs->BSRR = 0x00000200; // BSY
SCSI_TARGET_ACTIVE();
#endif #endif
// 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