Jelajahi Sumber

Merge pull request #125 from BlueSCSI/eric/updates

Smattering of updates
Eric Helgeson 1 tahun lalu
induk
melakukan
a23708a1cc

+ 13 - 5
lib/BlueSCSI_platform_RP2040/BlueSCSI_platform.cpp

@@ -567,10 +567,14 @@ static void watchdog_callback(unsigned alarm_num)
             log("scsiDev.phase: ", (int)scsiDev.phase);
             scsi_accel_log_state();
 
-            uint32_t *p = (uint32_t*)__get_PSP();
+#ifdef __MBED__
+            uint32_t *p =  (uint32_t*)__get_PSP();
+#else
+            uint32_t *p =  (uint32_t*)__get_MSP();
+#endif
             for (int i = 0; i < 8; i++)
             {
-                if (p == &__StackTop) break; // End of stack
+            if (p == &__StackTop) break; // End of stack
 
                 log("STACK ", (uint32_t)p, ":    ", p[0], " ", p[1], " ", p[2], " ", p[3]);
                 p += 4;
@@ -583,14 +587,18 @@ static void watchdog_callback(unsigned alarm_num)
         if (g_watchdog_timeout <= 0)
         {
             log("--------------");
-            log("WATCHDOG TIMEOUT!");
+            log("WATCHDOG TIMEOUT, already attempted bus reset, rebooting");
             log("Platform: ", g_platform_name);
             log("FW Version: ", g_log_firmwareversion);
             log("GPIO states: out ", sio_hw->gpio_out, " oe ", sio_hw->gpio_oe, " in ", sio_hw->gpio_in);
             log("scsiDev.cdb: ", bytearray(scsiDev.cdb, 12));
             log("scsiDev.phase: ", (int)scsiDev.phase);
 
-            uint32_t *p = (uint32_t*)__get_PSP();
+#ifdef __MBED__
+            uint32_t *p =  (uint32_t*)__get_PSP();
+#else
+            uint32_t *p =  (uint32_t*)__get_MSP();
+#endif
             for (int i = 0; i < 8; i++)
             {
                 if (p == &__StackTop) break; // End of stack
@@ -607,7 +615,7 @@ static void watchdog_callback(unsigned alarm_num)
         }
     }
 
-    hardware_alarm_set_target(3, delayed_by_ms(get_absolute_time(), 1000));
+    hardware_alarm_set_target(alarm_num, delayed_by_ms(get_absolute_time(), 1000));
 }
 
 // This function can be used to periodically reset watchdog timer for crash handling.

+ 1 - 0
lib/SCSI2SD/src/firmware/scsi.c

@@ -559,6 +559,7 @@ static void process_Command()
 			{
 				scsiDev.target->sense.code = ILLEGAL_REQUEST;
 				scsiDev.target->sense.asc = LOGICAL_UNIT_NOT_SUPPORTED;
+				transfer.lba = 0;
 			}
 			memset(scsiDev.data, 0, 256); // Max possible alloc length
 			scsiDev.data[0] = 0xF0;

+ 15 - 0
lib/SCSI2SD/src/firmware/vendor.c

@@ -80,6 +80,21 @@ int scsiVendorCommand()
 		scsiDev.phase = DATA_OUT;
 		scsiDev.postDataOutHook = doWriteBuffer;
 	}
+	else if (command == 0xE0 &&
+		scsiDev.target->cfg->quirks == S2S_CFG_QUIRKS_XEBEC)
+	{
+	  // RAM Diagnostic
+	  // XEBEC S1410 controller
+	  // http://bitsavers.informatik.uni-stuttgart.de/pdf/xebec/104524C_S1410Man_Aug83.pdf
+	  // Stub, return success
+	}
+	else if (command == 0xE4 &&
+		scsiDev.target->cfg->quirks == S2S_CFG_QUIRKS_XEBEC)
+	{
+	  // Drive Diagnostic
+	  // XEBEC S1410 controller
+	  // Stub, return success
+	}
 	else
 	{
 		commandHandled = 0;

+ 1 - 1
platformio.ini

@@ -13,7 +13,7 @@ default_envs = BlueSCSI_Pico
 ; BlueSCSI RP2040 hardware platform, based on the Raspberry Pi foundation RP2040 microcontroller
 [env:BlueSCSI_Pico]
 platform = https://github.com/maxgerhardt/platform-raspberrypi.git
-platform_packages = platformio/toolchain-gccarmnoneeabi@1.100301.220327
+platform_packages = platformio/toolchain-gccarmnoneeabi@1.120301.0
     framework-arduinopico@https://github.com/BlueSCSI/arduino-pico-internal.git#e139b9c7816602597f473b3231032cca5d71a48a
 framework = arduino
 board = rpipicow

+ 2 - 0
src/BlueSCSI_log_trace.cpp

@@ -82,6 +82,8 @@ static const char *getCommandName(uint8_t cmd)
         case 0xA8: return "Read12";
         case 0xC0: return "OMTI-5204 DefineFlexibleDiskFormat";
         case 0xC2: return "OMTI-5204 AssignDiskParameters";
+        case 0xE0: return "Xebec RAM Diagnostic";
+        case 0xE4: return "Xebec Drive Diagnostic";
         case BLUESCSI_TOOLBOX_COUNT_FILES: return "BLUESCSI_TOOLBOX_COUNT_FILES";
         case BLUESCSI_TOOLBOX_LIST_FILES: return "BLUESCSI_TOOLBOX_LIST_FILES";
         case BLUESCSI_TOOLBOX_GET_FILE: return "BLUESCSI_TOOLBOX_GET_FILE";