Przeglądaj źródła

Get all targets to compile

Everything is compiling, but the DaynaPORT target may have broken.
Morio 2 lat temu
rodzic
commit
f881751e82

+ 1 - 5
.gitignore

@@ -1,6 +1,2 @@
 .pio
-.vscode/.browse.c_cpp.db*
-.vscode/c_cpp_properties.json
-.vscode/launch.json
-.vscode/ipch
-.vscode/extensions.json
+.vscode/

+ 6 - 2
lib/SCSI2SD/src/firmware/scsi.c

@@ -30,7 +30,9 @@
 #include "bsp.h"
 #include "cdrom.h"
 //#include "debug.h"
+#ifdef ZULUSCSI_NETWORK
 #include "network.h"
+#endif // ZULUSCSI_NETWORK
 #include "tape.h"
 #include "mo.h"
 #include "vendor.h"
@@ -522,8 +524,10 @@ static void process_Command()
 	// write commands. Will fall-through to generic disk handling.
 	else if (((cfg->deviceType == S2S_CFG_OPTICAL) && scsiCDRomCommand()) ||
 		((cfg->deviceType == S2S_CFG_SEQUENTIAL) && scsiTapeCommand()) ||
-		((cfg->deviceType == S2S_CFG_MO) && scsiMOCommand()) ||
-		((cfg->deviceType == S2S_CFG_NETWORK && scsiNetworkCommand())))
+#ifdef ZULUSCSI_NETWORK
+		((cfg->deviceType == S2S_CFG_NETWORK && scsiNetworkCommand())) ||
+#endif // ZULUSCSI_NETWORK
+		((cfg->deviceType == S2S_CFG_MO) && scsiMOCommand()))
 	{
 		// Already handled.
 	}

+ 27 - 15
lib/ZuluSCSI_platform_RP2040/ZuluSCSI_platform.cpp

@@ -26,6 +26,7 @@
 #include <scsi.h>
 #include <assert.h>
 #include <hardware/gpio.h>
+#include <hardware/pio.h>
 #include <hardware/uart.h>
 #include <hardware/pll.h>
 #include <hardware/clocks.h>
@@ -38,16 +39,24 @@
 
 #ifdef __MBED__
 #  include <platform/mbed_error.h>
-#  include <multicore.h>
+#endif // __MBED__
+
+#ifndef DISABLE_USB
 #  include <USB/PluggableUSBSerial.h>
-#  include "audio.h"
+#endif // DISABLE_USB
+
+#ifndef ZULUSCSI_NETWORK
+#  include <multicore.h>
 #else
 #  include <pico/multicore.h> 
 extern "C" {
 #  include <pico/cyw43_arch.h>
 } 
-#endif // __MBED__
+#endif // ZULUSCSI_NETWORK
 
+#ifdef ENABLE_AUDIO_OUTPUT
+#  include "audio.h"
+#endif // ENABLE_AUDIO_OUTPUT
 
 extern "C" {
 
@@ -120,6 +129,9 @@ void platform_init()
     // Make sure second core is stopped
     multicore_reset_core1();
 
+    pio_clear_instruction_memory(pio0);
+    pio_clear_instruction_memory(pio1);
+    
     /* First configure the pins that affect external buffer directions.
      * RP2040 defaults to pulldowns, while these pins have external pull-ups.
      */
@@ -449,7 +461,7 @@ void mbed_error_hook(const mbed_error_ctx * error_context)
 // also starts calling this after 2 seconds.
 // This ensures that log messages get passed even if code hangs,
 // but does not unnecessarily delay normal execution.
-#ifdef __MBED__
+#ifndef DISABLE_USB
 static void usb_log_poll()
 {
     static uint32_t logpos = 0;
@@ -472,7 +484,7 @@ static void usb_log_poll()
         logpos -= available - actual;
     }
 }
-#endif // __MBED__
+#endif // DISABLE_USB
 
 // Use ADC to implement supply voltage monitoring for the +3.0V rail.
 // This works by sampling the temperature sensor channel, which has
@@ -546,13 +558,13 @@ static void watchdog_callback(unsigned alarm_num)
 {
     g_watchdog_timeout -= 1000;
 
-#ifdef __MBED__
+#ifndef DISABLE_USB
     if (g_watchdog_timeout < WATCHDOG_CRASH_TIMEOUT - 1000)
     {
         // Been stuck for at least a second, start dumping USB log
         usb_log_poll();
     }
-#endif  // __MBED__
+#endif  // DISABLE_USB
 
     if (g_watchdog_timeout <= WATCHDOG_CRASH_TIMEOUT - WATCHDOG_BUS_RESET_TIMEOUT)
     {
@@ -599,9 +611,9 @@ static void watchdog_callback(unsigned alarm_num)
                 p += 4;
             }
 
-#ifdef __MBED__
+#ifndef DISABLE_USB
             usb_log_poll();
-#endif // __MBED__
+#endif // DISABLE_USB
 
             platform_emergency_log_save();
 
@@ -643,18 +655,18 @@ void platform_reset_watchdog()
 
     // USB log is polled here also to make sure any log messages in fault states
     // get passed to USB.
-#ifdef __MBED__
+#ifndef DISABLE_USB
     usb_log_poll();
-#endif // __MBED__
+#endif // DISABLE_USB
 }
 
 // Poll function that is called every few milliseconds.
 // Can be left empty or used for platform-specific processing.
 void platform_poll()
 {
-#ifdef __MBED__
+#ifndef DISABLE_USB
     usb_log_poll();
-#endif
+#endif // DISABLE_USB
 
     adc_poll();
     
@@ -715,14 +727,14 @@ bool platform_rewrite_flash_page(uint32_t offset, uint8_t buffer[PLATFORM_FLASH_
         }
     }
 
-#ifdef __MBED__
+#ifndef DISABLE_USB
     if (NVIC_GetEnableIRQ(USBCTRL_IRQn))
     {
         logmsg("Disabling USB during firmware flashing");
         NVIC_DisableIRQ(USBCTRL_IRQn);
         usb_hw->main_ctrl = 0;
     }
-#endif // __MBED__
+#endif // DISABLE_USB
 
     dbgmsg("Writing flash at offset ", offset, " data ", bytearray(buffer, 4));
     assert(offset % PLATFORM_FLASH_PAGE_SIZE == 0);

+ 9 - 1
lib/ZuluSCSI_platform_RP2040/ZuluSCSI_platform.h

@@ -48,9 +48,17 @@ extern "C" {
 extern const char *g_platform_name;
 
 #ifdef ZULUSCSI_PICO
-# define PLATFORM_NAME "ZuluSCSI Pico"
+# ifdef ZULUSCSI_DAYNAPORT
+#   define PLATFORM_NAME "ZuluSCSI Pico DaynaPORT"
+# else
+#   define PLATFORM_NAME "ZuluSCSI Pico"
+# endif
 # define PLATFORM_REVISION "2.0"
 # define PLATFORM_HAS_INITIATOR_MODE 1
+# define DISABLE_SWO
+# ifdef ZULUSCSI_NETWORK
+#   define DISABLE_USB
+# endif
 #elif defined(ZULUSCSI_BS2)
 # define PLATFORM_NAME "ZuluSCSI BS2"
 # define PLATFORM_REVISION "1.0"

+ 3 - 0
lib/ZuluSCSI_platform_RP2040/ZuluSCSI_platform_network.cpp

@@ -18,6 +18,8 @@
 #include "ZuluSCSI_log.h"
 #include "ZuluSCSI_config.h"
 #include <scsi.h>
+
+#ifdef ZULUSCSI_NETWORK
 #include <network.h>
 
 extern "C" {
@@ -312,3 +314,4 @@ void cyw43_cb_tcpip_set_link_up(cyw43_t *self, int itf)
 }
 
 }
+#endif // ZULUSCSI_NETWORK

+ 10 - 6
lib/ZuluSCSI_platform_RP2040/scsi_accel_target.cpp

@@ -38,12 +38,16 @@
 #include <hardware/irq.h>
 #include <hardware/structs/iobank0.h>
 #include <hardware/sync.h>
+
+#ifdef ENABLE_AUDIO_OUTPUT
 #include <audio.h>
-#ifdef __MBED__
-#include <multicore.h>
-#else
+#endif // ENABLE_AUDIO_OUTPUT
+
+#ifdef ZULUSCSI_NETWORK
 #include <pico/multicore.h>
-#endif
+#else
+#include <multicore.h>
+#endif // ZULUSCSI_NETWORK
 
 #ifdef ZULUSCSI_PICO
 #include "scsi_accel_target_Pico.pio.h"
@@ -51,7 +55,7 @@
 #include "scsi_accel_target_BS2.pio.h"
 #else
 #include "scsi_accel_target_RP2040.pio.h"
-#endif
+#endif // ZULUSCSI_PICO
 
 // SCSI bus write acceleration uses up to 3 PIO state machines:
 // SM0: Convert data bytes to lookup addresses to add parity
@@ -67,7 +71,7 @@
 #  define SCSI_PARITY_SM 0
 #  define SCSI_DATA_SM 1
 #  define SCSI_SYNC_SM 2
-#endif
+#endif // ZULUSCSI_NETWORK
 
 
 // SCSI bus write acceleration uses 3 or 4 DMA channels (data flow A->B->C->D):

+ 1 - 1
platformio.ini

@@ -149,7 +149,7 @@ build_flags =
     -DNO_USB=1
     -DZULUSCSI_PICO
     -DZULUSCSI_NETWORK
-    -DDISABLE_SWO
+    -DZULUSCSI_DAYNAPORT
 
 
 ; Variant of RP2040 platform, based on Raspberry Pico board and a carrier PCB

+ 8 - 5
src/ZuluSCSI.cpp

@@ -449,13 +449,13 @@ bool findHDDImages()
           logmsg("-- Ignoring ", fullname, ", SCSI ID ", id, " is already in use!");
           continue;
         }
-
+#ifdef ZULUSCSI_NETWORK
         if (is_ne && !platform_network_supported())
         {
           logmsg("-- Ignoring ", fullname, ", networking is not supported on this hardware");
           continue;
         }
-
+#endif // ZULUSCSI_NETWORK
         // Type mapping based on filename.
         // If type is FIXED, the type can still be overridden in .ini file.
         S2S_CFG_TYPE type = S2S_CFG_FIXED;
@@ -627,18 +627,18 @@ static void reinitSCSI()
   scsiDiskInit();
   scsiInit();
 
+#ifdef ZULUSCSI_NETWORK
   if (scsiDiskCheckAnyNetworkDevicesConfigured())
   {
     platform_network_init(scsiDev.boardCfg.wifiMACAddress);
     platform_network_wifi_join(scsiDev.boardCfg.wifiSSID, scsiDev.boardCfg.wifiPassword);
   }
+#endif // ZULUSCSI_NETWORK
   
 }
 
 extern "C" void zuluscsi_setup(void)
 {
-  pio_clear_instruction_memory(pio0);
-  pio_clear_instruction_memory(pio1);
   platform_init();
   platform_late_init();
 
@@ -722,8 +722,11 @@ extern "C" void zuluscsi_main_loop(void)
   platform_reset_watchdog();
   platform_poll();
   diskEjectButtonUpdate(true);
+
+#ifdef ZULUSCSI_NETWORK
   platform_network_poll();
-  
+#endif // ZULUSCSI_NETWORK
+
 #ifdef PLATFORM_HAS_INITIATOR_MODE
   if (platform_is_initiator_mode_enabled())
   {

+ 2 - 0
src/ZuluSCSI_log.cpp

@@ -24,6 +24,8 @@
 #include "ZuluSCSI_log.h"
 #include "ZuluSCSI_config.h"
 #include "ZuluSCSI_platform.h"
+#include <stdio.h>
+#include <stdarg.h>
 
 const char *g_log_firmwareversion = ZULU_FW_VERSION " " __DATE__ " " __TIME__;
 bool g_log_debug = true;