diff --git a/src/BlueSCSI.cpp b/src/BlueSCSI.cpp index 2ba2740..7c1f221 100644 --- a/src/BlueSCSI.cpp +++ b/src/BlueSCSI.cpp @@ -50,9 +50,6 @@ // 1: Debug information output to USB Serial // 2: Debug information output to LOG.txt (slow) -#define READ_SPEED_OPTIMIZE 1 // Faster reads -#define WRITE_SPEED_OPTIMIZE 1 // Speeding up writes - // SCSI config #define NUM_SCSIID 7 // Maximum number of supported SCSI-IDs (The minimum is 0) #define NUM_SCSILUN 2 // Maximum number of LUNs supported (The minimum is 0) @@ -876,7 +873,6 @@ inline void writeHandshake(byte d) while( SCSI_IN(vACK)); } -#if READ_SPEED_OPTIMIZE #pragma GCC push_options #pragma GCC optimize ("-Os") /* @@ -938,7 +934,6 @@ void writeDataLoop(uint32_t blocksize, const byte* srcptr) WAIT_ACK_INACTIVE(); } #pragma GCC pop_options -#endif /* * Data in phase. @@ -948,16 +943,10 @@ void writeDataPhase(int len, const byte* p) { LOGN("DATAIN PHASE"); SCSI_PHASE_CHANGE(SCSI_PHASE_DATAIN); -#if READ_SPEED_OPTIMIZE // Bus settle delay 400ns. Following code was measured at 800ns before REQ asserted. STM32F103. SCSI_DB_OUTPUT() writeDataLoop(len, p); SCSI_DB_INPUT() -#else - for (int i = 0; i < len; i++) { - writeHandshake(p[i]); - } -#endif } /* @@ -980,13 +969,7 @@ void writeDataPhaseSD(uint32_t adds, uint32_t len) m_img->m_file.read(m_buf, m_img->m_blocksize); enableResetJmp(); -#if READ_SPEED_OPTIMIZE writeDataLoop(m_img->m_blocksize, m_buf); -#else - for(int j = 0; j < m_img->m_blocksize; j++) { - writeHandshake(m_buf[j]); - } -#endif } SCSI_DB_INPUT() #ifdef XCVR @@ -994,7 +977,6 @@ void writeDataPhaseSD(uint32_t adds, uint32_t len) #endif } -#if WRITE_SPEED_OPTIMIZE #pragma GCC push_options #pragma GCC optimize ("-Os") @@ -1036,7 +1018,6 @@ void readDataLoop(uint32_t blockSize, byte* dstptr) WAIT_ACK_INACTIVE(); } #pragma GCC pop_options -#endif /* * Data out phase. @@ -1047,12 +1028,7 @@ void readDataPhase(int len, byte* p) LOGN("DATAOUT PHASE"); SCSI_PHASE_CHANGE(SCSI_PHASE_DATAOUT); // Bus settle delay 400ns. The following code was measured at 450ns before REQ asserted. STM32F103. -#if WRITE_SPEED_OPTIMIZE readDataLoop(len, p); -#else - for(uint32_t i = 0; i < len; i++) - p[i] = readHandshake(); -#endif } /* @@ -1069,13 +1045,7 @@ void readDataPhaseSD(uint32_t adds, uint32_t len) m_img->m_file.seekSet(pos); for(uint32_t i = 0; i < len; i++) { m_resetJmp = true; -#if WRITE_SPEED_OPTIMIZE readDataLoop(m_img->m_blocksize, m_buf); -#else - for(int j = 0; j < m_img->m_blocksize; j++) { - m_buf[j] = readHandshake(); - } -#endif m_resetJmp = false; m_img->m_file.write(m_buf, m_img->m_blocksize); // If a reset happened while writing, break and let the flush happen before it is handled. @@ -1100,13 +1070,7 @@ void verifyDataPhaseSD(uint32_t adds, uint32_t len) uint64_t pos = (uint64_t)adds * m_img->m_blocksize; m_img->m_file.seekSet(pos); for(uint32_t i = 0; i < len; i++) { -#if WRITE_SPEED_OPTIMIZE readDataLoop(m_img->m_blocksize, m_buf); -#else - for(int j = 0; j < m_img->m_blocksize; j++) { - m_buf[j] = readHandshake(); - } -#endif // This has just gone through the transfer to make things work, a compare would go here. } }