Explorar el Código

Disable the FMC fifo until we have code that can detect when it's empty.

Michael McMaster hace 4 años
padre
commit
bb45541e99

+ 3 - 1
lib/SCSI2SD/STM32CubeMX/2021/Src/fmc.c

@@ -49,7 +49,9 @@ void MX_FMC_Init(void)
   hsram1.Init.AsynchronousWait = FMC_ASYNCHRONOUS_WAIT_DISABLE;
   hsram1.Init.WriteBurst = FMC_WRITE_BURST_DISABLE;
   hsram1.Init.ContinuousClock = FMC_CONTINUOUS_CLOCK_SYNC_ONLY;
-  hsram1.Init.WriteFifo = FMC_WRITE_FIFO_ENABLE;
+  hsram1.Init.WriteFifo = FMC_WRITE_FIFO_DISABLE;
+  // WE MAY start writing another 512 bytes before this FIFO is empty!
+
   hsram1.Init.PageSize = FMC_PAGE_SIZE_NONE;
   /* Timing */
 

+ 1 - 1
lib/SCSI2SD/src/firmware/bsp_driver_sd.c

@@ -55,7 +55,7 @@ uint8_t BSP_SD_Init(void)
   }
   SD_state = HAL_SD_Init(&hsd);
 #ifdef BUS_4BITS
-  if (SD_state == MSD_OK)
+  if (SD_state == HAL_OK)
   {
     if (HAL_SD_ConfigWideBusOperation(&hsd, SDIO_BUS_WIDE_4B) != HAL_OK)
     {

+ 4 - 2
lib/SCSI2SD/src/firmware/config.c

@@ -36,11 +36,13 @@
 
 #include <string.h>
 
-static const uint16_t FIRMWARE_VERSION = 0x0646;
+static const uint16_t FIRMWARE_VERSION = 0x0647;
 
 // Optional static config
 extern uint8_t* __fixed_config;
 
+extern SD_HandleTypeDef hsd;
+
 #ifdef S2S_USB_HS
 #define configUsbDev hUsbDeviceHS
 #else
@@ -235,7 +237,7 @@ debugCommand()
     response[23] = scsiDev.msgCount;
     response[24] = scsiDev.cmdCount;
     response[25] = scsiDev.watchdogTick;
-    response[26] = blockDev.state;
+    response[26] = (hsd.State << 4) | blockDev.state;
     response[27] = scsiDev.lastSenseASC >> 8;
     response[28] = scsiDev.lastSenseASC;
     response[29] = *SCSI_STS_DBX & 0xff; // What we've read

+ 3 - 5
lib/SCSI2SD/src/firmware/scsiPhy.c

@@ -104,17 +104,15 @@ scsiSetDataCount(uint32_t count)
 int scsiFifoReady(void)
 {
 	__NOP();
-#ifdef STM32F4xx
-	__NOP();
-#endif
-	HAL_GPIO_ReadPin(GPIOE, FPGA_GPIO3_Pin);
+	uint8_t test1 = HAL_GPIO_ReadPin(GPIOE, FPGA_GPIO3_Pin);
 	__NOP();
 #ifdef STM32F4xx
 	__NOP();
 	__NOP();
 	__NOP();
 #endif
-	return HAL_GPIO_ReadPin(GPIOE, FPGA_GPIO3_Pin) != 0;
+	uint8_t test2 = HAL_GPIO_ReadPin(GPIOE, FPGA_GPIO3_Pin);
+	return test1 != 0 && test2 != 0;
 }
 
 uint8_t