From b8580bd4e600793d1e3f817d22dd6580762176aa Mon Sep 17 00:00:00 2001 From: David Kuder Date: Sat, 11 Jun 2022 11:07:37 -0400 Subject: [PATCH] Verify Data Phase Verify stub --- src/scsibus.ino | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/src/scsibus.ino b/src/scsibus.ino index 7fec328..1cfc8b0 100755 --- a/src/scsibus.ino +++ b/src/scsibus.ino @@ -274,3 +274,41 @@ void readDataPhaseSD(uint32_t adds, uint32_t len) } m_sel->m_file.flush(); } + + +/* + * Data out phase. + * Verify SD card while reading len block. + */ +void verifyDataPhaseSD(uint32_t adds, uint32_t len) +{ +#if WRITE_SPEED_OPTIMIZE + uint32_t bigread = (MAX_BLOCKSIZE / m_sel->m_blocksize); +#endif + uint32_t i = 0; + + uint32_t pos = adds * m_sel->m_blocksize; + m_sel->m_file.seek(pos); + SET_MSG_INACTIVE(); + SET_CD_INACTIVE(); + SET_IO_INACTIVE(); + + while(i < len) { +#if WRITE_SPEED_OPTIMIZE + if((len-i) >= bigread) { + readHandshakeBlock(m_buf, MAX_BLOCKSIZE); + i += bigread; + } else { + readHandshakeBlock(m_buf, m_sel->m_blocksize * (len-i)); + i = len; + } +#else + for(unsigned int j = 0; j < m_sel->m_blocksize; j++) { + if(m_isBusReset) { + return; + } + m_buf[j] = readHandshake(); + } +#endif + } +}