Alex Perez преди 2 години
родител
ревизия
0766b07397

+ 1 - 1
lib/ZuluSCSI_platform_BS2/ZuluSCSI_platform.cpp

@@ -238,7 +238,7 @@ void mbed_error_hook(const mbed_error_ctx * error_context)
 /*****************************************/
 
 // This function is called for every log message.
-voidplatform_log(const char *s)
+void platform_log(const char *s)
 {
     if (g_uart_initialized)
     {

+ 15 - 15
lib/ZuluSCSI_platform_BS2/rp2040_sdio.cpp

@@ -134,7 +134,7 @@ uint64_t sdio_crc16_4bit_checksum(uint32_t *data, uint32_t num_words)
 
 static void sdio_send_command(uint8_t command, uint32_t arg, uint8_t response_bits)
 {
-    // dbg("SDIO Command: ", (int)command, " arg ", arg);
+    dbgmsg("SDIO Command: ", (int)command, " arg ", arg);
 
     // Format the arguments in the way expected by the PIO code.
     uint32_t word0 =
@@ -183,7 +183,7 @@ sdio_status_t rp2040_sdio_command_R1(uint8_t command, uint32_t arg, uint32_t *re
         {
             if (command != 8) // Don't log for missing SD card
             {
-                dbg("Timeout waiting for response in rp2040_sdio_command_R1(", (int)command, "), ",
+                dbgmsg("Timeout waiting for response in rp2040_sdio_command_R1(", (int)command, "), ",
                     "PIO PC: ", (int)pio_sm_get_pc(SDIO_PIO, SDIO_CMD_SM) - (int)g_sdio.pio_cmd_clk_offset,
                     " RXF: ", (int)pio_sm_get_rx_fifo_level(SDIO_PIO, SDIO_CMD_SM),
                     " TXF: ", (int)pio_sm_get_tx_fifo_level(SDIO_PIO, SDIO_CMD_SM));
@@ -201,7 +201,7 @@ sdio_status_t rp2040_sdio_command_R1(uint8_t command, uint32_t arg, uint32_t *re
         // Read out response packet
         uint32_t resp0 = pio_sm_get(SDIO_PIO, SDIO_CMD_SM);
         uint32_t resp1 = pio_sm_get(SDIO_PIO, SDIO_CMD_SM);
-        // dbg("SDIO R1 response: ", resp0, " ", resp1);
+        dbgmsg("SDIO R1 response: ", resp0, " ", resp1);
 
         // Calculate response checksum
         uint8_t crc = 0;
@@ -214,14 +214,14 @@ sdio_status_t rp2040_sdio_command_R1(uint8_t command, uint32_t arg, uint32_t *re
         uint8_t actual_crc = ((resp1 >> 0) & 0xFE);
         if (crc != actual_crc)
         {
-            dbg("rp2040_sdio_command_R1(", (int)command, "): CRC error, calculated ", crc, " packet has ", actual_crc);
+            dbgmsg("rp2040_sdio_command_R1(", (int)command, "): CRC error, calculated ", crc, " packet has ", actual_crc);
             return SDIO_ERR_RESPONSE_CRC;
         }
 
         uint8_t response_cmd = ((resp0 >> 24) & 0xFF);
         if (response_cmd != command && command != 41)
         {
-            dbg("rp2040_sdio_command_R1(", (int)command, "): received reply for ", (int)response_cmd);
+            dbgmsg("rp2040_sdio_command_R1(", (int)command, "): received reply for ", (int)response_cmd);
             return SDIO_ERR_RESPONSE_CODE;
         }
 
@@ -255,7 +255,7 @@ sdio_status_t rp2040_sdio_command_R2(uint8_t command, uint32_t arg, uint8_t resp
     {
         if ((uint32_t)(millis() - start) > 2)
         {
-            dbg("Timeout waiting for response in rp2040_sdio_command_R2(", (int)command, "), ",
+            dbgmsg("Timeout waiting for response in rp2040_sdio_command_R2(", (int)command, "), ",
                   "PIO PC: ", (int)pio_sm_get_pc(SDIO_PIO, SDIO_CMD_SM) - (int)g_sdio.pio_cmd_clk_offset,
                   " RXF: ", (int)pio_sm_get_rx_fifo_level(SDIO_PIO, SDIO_CMD_SM),
                   " TXF: ", (int)pio_sm_get_tx_fifo_level(SDIO_PIO, SDIO_CMD_SM));
@@ -298,14 +298,14 @@ sdio_status_t rp2040_sdio_command_R2(uint8_t command, uint32_t arg, uint8_t resp
     uint8_t actual_crc = response[15] & 0xFE;
     if (crc != actual_crc)
     {
-        dbg("rp2040_sdio_command_R2(", (int)command, "): CRC error, calculated ", crc, " packet has ", actual_crc);
+        dbgmsg("rp2040_sdio_command_R2(", (int)command, "): CRC error, calculated ", crc, " packet has ", actual_crc);
         return SDIO_ERR_RESPONSE_CRC;
     }
 
     uint8_t response_cmd = ((response_buf[0] >> 24) & 0xFF);
     if (response_cmd != 0x3F)
     {
-        dbg("rp2040_sdio_command_R2(", (int)command, "): Expected reply code 0x3F");
+        dbgmsg("rp2040_sdio_command_R2(", (int)command, "): Expected reply code 0x3F");
         return SDIO_ERR_RESPONSE_CODE;
     }
 
@@ -323,7 +323,7 @@ sdio_status_t rp2040_sdio_command_R3(uint8_t command, uint32_t arg, uint32_t *re
     {
         if ((uint32_t)(millis() - start) > 2)
         {
-            dbg("Timeout waiting for response in rp2040_sdio_command_R3(", (int)command, "), ",
+            dbgmsg("Timeout waiting for response in rp2040_sdio_command_R3(", (int)command, "), ",
                   "PIO PC: ", (int)pio_sm_get_pc(SDIO_PIO, SDIO_CMD_SM) - (int)g_sdio.pio_cmd_clk_offset,
                   " RXF: ", (int)pio_sm_get_rx_fifo_level(SDIO_PIO, SDIO_CMD_SM),
                   " TXF: ", (int)pio_sm_get_tx_fifo_level(SDIO_PIO, SDIO_CMD_SM));
@@ -339,7 +339,7 @@ sdio_status_t rp2040_sdio_command_R3(uint8_t command, uint32_t arg, uint32_t *re
     uint32_t resp0 = pio_sm_get(SDIO_PIO, SDIO_CMD_SM);
     uint32_t resp1 = pio_sm_get(SDIO_PIO, SDIO_CMD_SM);
     *response = ((resp0 & 0xFFFFFF) << 8) | ((resp1 >> 8) & 0xFF);
-    // dbg("SDIO R3 response: ", resp0, " ", resp1);
+    dbgmsg("SDIO R3 response: ", resp0, " ", resp1);
 
     return SDIO_OK;
 }
@@ -482,7 +482,7 @@ sdio_status_t rp2040_sdio_rx_poll(uint32_t *bytes_complete)
     }
     else if ((uint32_t)(millis() - g_sdio.transfer_start_time) > 1000)
     {
-        dbg("rp2040_sdio_rx_poll() timeout, "
+        dbgmsg("rp2040_sdio_rx_poll() timeout, "
             "PIO PC: ", (int)pio_sm_get_pc(SDIO_PIO, SDIO_DATA_SM) - (int)g_sdio.pio_data_rx_offset,
             " RXF: ", (int)pio_sm_get_rx_fifo_level(SDIO_PIO, SDIO_DATA_SM),
             " TXF: ", (int)pio_sm_get_tx_fifo_level(SDIO_PIO, SDIO_DATA_SM),
@@ -604,17 +604,17 @@ sdio_status_t check_sdio_write_response(uint32_t card_response)
     }
     else if (wr_status == 5)
     {
-        log("SDIO card reports write CRC error, status ", card_response);
+        logmsg("SDIO card reports write CRC error, status ", card_response);
         return SDIO_ERR_WRITE_CRC;    
     }
     else if (wr_status == 6)
     {
-        log("SDIO card reports write failure, status ", card_response);
+        logmsg("SDIO card reports write failure, status ", card_response);
         return SDIO_ERR_WRITE_FAIL;    
     }
     else
     {
-        log("SDIO card reports unknown write status ", card_response);
+        logmsg("SDIO card reports unknown write status ", card_response);
         return SDIO_ERR_WRITE_FAIL;    
     }
 }
@@ -704,7 +704,7 @@ sdio_status_t rp2040_sdio_tx_poll(uint32_t *bytes_complete)
     }
     else if ((uint32_t)(millis() - g_sdio.transfer_start_time) > 1000)
     {
-        dbg("rp2040_sdio_tx_poll() timeout, "
+        dbgmsg("rp2040_sdio_tx_poll() timeout, "
             "PIO PC: ", (int)pio_sm_get_pc(SDIO_PIO, SDIO_DATA_SM) - (int)g_sdio.pio_data_tx_offset,
             " RXF: ", (int)pio_sm_get_rx_fifo_level(SDIO_PIO, SDIO_DATA_SM),
             " TXF: ", (int)pio_sm_get_tx_fifo_level(SDIO_PIO, SDIO_DATA_SM),

+ 1 - 1
lib/ZuluSCSI_platform_BS2/scsiPhy.cpp

@@ -112,7 +112,7 @@ static void scsi_rst_assert_interrupt()
 
     if (rst1 && rst2)
     {
-        dbg("BUS RESET");
+        //dbg("BUS RESET");
         scsiDev.resetFlag = 1;
     }
 }

+ 1 - 1
lib/ZuluSCSI_platform_BS2/scsi_accel_rp2040.cpp

@@ -686,7 +686,7 @@ void scsi_accel_rp2040_finishRead(const uint8_t *data, uint32_t count, int *pari
     // Check if any parity errors have been detected during the transfer so far
     if (parityError != NULL && (SCSI_DMA_PIO->irq & 1))
     {
-        dbg("scsi_accel_rp2040_finishRead(", bytearray(data, count), ") detected parity error");
+        dbgmsg("scsi_accel_rp2040_finishRead(", bytearray(data, count), ") detected parity error");
         *parityError = true;
     }
 }

+ 21 - 21
lib/ZuluSCSI_platform_BS2/sd_card_sdio.cpp

@@ -23,7 +23,7 @@ static uint32_t g_sdio_sector_count;
 static bool logSDError(int line)
 {
     g_sdio_error_line = line;
-    log("SDIO SD card error on line ", line, ", error code ", (int)g_sdio_error);
+    logmsg("SDIO SD card error on line ", line, ", error code ", (int)g_sdio_error);
     return false;
 }
 
@@ -54,7 +54,7 @@ static sd_callback_t get_stream_callback(const uint8_t *buf, uint32_t count, con
         }
         else
         {
-            dbglog("SD card ", accesstype, "(", (int)sector,
+            dbgmsg("SD card ", accesstype, "(", (int)sector,
                   ") slow transfer, buffer", (uint32_t)buf, " vs. ", (uint32_t)(m_stream_buffer + m_stream_count));
             return NULL;
         }
@@ -87,7 +87,7 @@ bool SdioCard::begin(SdioConfig sdioConfig)
 
     if (reply != 0x1AA || status != SDIO_OK)
     {
-        // dbg("SDIO not responding to CMD8 SEND_IF_COND, status ", (int)status, " reply ", reply);
+        dbgmsg("SDIO not responding to CMD8 SEND_IF_COND, status ", (int)status, " reply ", reply);
         return false;
     }
 
@@ -103,7 +103,7 @@ bool SdioCard::begin(SdioConfig sdioConfig)
 
         if ((uint32_t)(millis() - start) > 1000)
         {
-            log("SDIO card initialization timeout");
+            logmsg("SDIO card initialization timeout");
             return false;
         }
     } while (!(g_sdio_ocr & (1 << 31)));
@@ -111,21 +111,21 @@ bool SdioCard::begin(SdioConfig sdioConfig)
     // Get CID
     if (!checkReturnOk(rp2040_sdio_command_R2(CMD2, 0, (uint8_t*)&g_sdio_cid)))
     {
-        dbg("SDIO failed to read CID");
+        dbgmsg("SDIO failed to read CID");
         return false;
     }
 
     // Get relative card address
     if (!checkReturnOk(rp2040_sdio_command_R1(CMD3, 0, &g_sdio_rca)))
     {
-        dbg("SDIO failed to get RCA");
+        dbgmsg("SDIO failed to get RCA");
         return false;
     }
 
     // Get CSD
     if (!checkReturnOk(rp2040_sdio_command_R2(CMD9, g_sdio_rca, (uint8_t*)&g_sdio_csd)))
     {
-        dbg("SDIO failed to read CSD");
+        dbgmsg("SDIO failed to read CSD");
         return false;
     }
 
@@ -134,7 +134,7 @@ bool SdioCard::begin(SdioConfig sdioConfig)
     // Select card
     if (!checkReturnOk(rp2040_sdio_command_R1(CMD7, g_sdio_rca, &reply)))
     {
-        dbg("SDIO failed to select card");
+        dbgmsg("SDIO failed to select card");
         return false;
     }
 
@@ -142,7 +142,7 @@ bool SdioCard::begin(SdioConfig sdioConfig)
     if (!checkReturnOk(rp2040_sdio_command_R1(CMD55, g_sdio_rca, &reply)) ||
         !checkReturnOk(rp2040_sdio_command_R1(ACMD6, 2, &reply)))
     {
-        dbg("SDIO failed to set bus width");
+        dbgmsg("SDIO failed to set bus width");
         return false;
     }
 
@@ -210,7 +210,7 @@ bool SdioCard::readStart(uint32_t sector)
 
 bool SdioCard::readStop()
 {
-    log("SdioCard::readStop() called but not implemented!");
+    logmsg("SdioCard::readStop() called but not implemented!");
     return false;
 }
 
@@ -252,7 +252,7 @@ bool SdioCard::stopTransmission(bool blocking)
         }
         if (isBusy())
         {
-            log("SdioCard::stopTransmission() timeout");
+            logmsg("SdioCard::stopTransmission() timeout");
             return false;
         }
         else
@@ -277,35 +277,35 @@ uint8_t SdioCard::type() const
 
 bool SdioCard::writeData(const uint8_t* src)
 {
-    log("SdioCard::writeData() called but not implemented!");
+    logmsg("SdioCard::writeData() called but not implemented!");
     return false;
 }
 
 bool SdioCard::writeStart(uint32_t sector)
 {
-    log("SdioCard::writeStart() called but not implemented!");
+    logmsg("SdioCard::writeStart() called but not implemented!");
     return false;
 }
 
 bool SdioCard::writeStop()
 {
-    log("SdioCard::writeStop() called but not implemented!");
+    logmsg("SdioCard::writeStop() called but not implemented!");
     return false;
 }
 
 bool SdioCard::erase(uint32_t firstSector, uint32_t lastSector)
 {
-    log("SdioCard::erase() not implemented");
+    logmsg("SdioCard::erase() not implemented");
     return false;
 }
 
 bool SdioCard::cardCMD6(uint32_t arg, uint8_t* status) {
-    log("SdioCard::cardCMD6() not implemented");
+    logmsg("SdioCard::cardCMD6() not implemented");
     return false;
 }
 
 bool SdioCard::readSCR(scr_t* scr) {
-    log("SdioCard::readSCR() not implemented");
+    logmsg("SdioCard::readSCR() not implemented");
     return false;
 }
 
@@ -343,7 +343,7 @@ bool SdioCard::writeSector(uint32_t sector, const uint8_t* src)
 
     if (g_sdio_error != SDIO_OK)
     {
-        log("SdioCard::writeSector(", sector, ") failed: ", (int)g_sdio_error);
+        logmsg("SdioCard::writeSector(", sector, ") failed: ", (int)g_sdio_error);
     }
 
     return g_sdio_error == SDIO_OK;
@@ -388,7 +388,7 @@ bool SdioCard::writeSectors(uint32_t sector, const uint8_t* src, size_t n)
 
     if (g_sdio_error != SDIO_OK)
     {
-        log("SdioCard::writeSectors(", sector, ",...,", (int)n, ") failed: ", (int)g_sdio_error);
+        logmsg("SdioCard::writeSectors(", sector, ",...,", (int)n, ") failed: ", (int)g_sdio_error);
         stopTransmission(true);
         return false;
     }
@@ -429,7 +429,7 @@ bool SdioCard::readSector(uint32_t sector, uint8_t* dst)
 
     if (g_sdio_error != SDIO_OK)
     {
-        log("SdioCard::readSector(", sector, ") failed: ", (int)g_sdio_error);
+        logmsg("SdioCard::readSector(", sector, ") failed: ", (int)g_sdio_error);
     }
 
     if (dst != real_dst)
@@ -477,7 +477,7 @@ bool SdioCard::readSectors(uint32_t sector, uint8_t* dst, size_t n)
 
     if (g_sdio_error != SDIO_OK)
     {
-        log("SdioCard::readSectors(", sector, ",...,", (int)n, ") failed: ", (int)g_sdio_error);
+        logmsg("SdioCard::readSectors(", sector, ",...,", (int)n, ") failed: ", (int)g_sdio_error);
         stopTransmission(true);
         return false;
     }