Changeset 574 for trunk/modules/sdmmc
- Timestamp:
- Nov 17, 2013, 3:47:26 PM (11 years ago)
- Location:
- trunk/modules/sdmmc/caba/source
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/sdmmc/caba/source/include/sdmmc.h
r557 r574 59 59 int spi_bitcount; 60 60 int spi_clk; 61 int spi_mosi_previous; // sampled MOSI value 61 62 62 63 uint8_t command; -
trunk/modules/sdmmc/caba/source/src/sdmmc.cpp
r557 r574 60 60 spi_fsm = S_IDLE; 61 61 spi_clk = p_spi_clk; 62 spi_mosi_previous = p_spi_mosi; 62 63 return; 63 64 } … … 67 68 if (p_spi_clk.read() == 1 && spi_clk == 0) { 68 69 // rising edge 69 command = (command << 1) | p_spi_mosi;70 command = (command << 1) | spi_mosi_previous; 70 71 spi_bitcount = 6; 71 72 spi_fsm = S_RECEIVE_CMD; … … 75 76 if (p_spi_clk.read() == 1 && spi_clk == 0) { 76 77 // rising edge 77 command = (command << 1) | p_spi_mosi;78 command = (command << 1) | spi_mosi_previous; 78 79 if (spi_bitcount == 0) { 79 80 if ((command & 0x80) == 0) { … … 93 94 if (p_spi_clk.read() == 1 && spi_clk == 0) { 94 95 // rising edge 95 args = (args << 1) | p_spi_mosi;96 args = (args << 1) | spi_mosi_previous; 96 97 spi_bitcount = 30; 97 98 spi_fsm = S_RECEIVE_ARGS; … … 101 102 if (p_spi_clk.read() == 1 && spi_clk == 0) { 102 103 // rising edge 103 args = (args << 1) | p_spi_mosi;104 args = (args << 1) | spi_mosi_previous; 104 105 if (spi_bitcount == 0) { 105 106 spi_bitcount = 7; … … 113 114 if (p_spi_clk.read() == 1 && spi_clk == 0) { 114 115 // rising edge 115 cmdcrc = (cmdcrc << 1) | p_spi_mosi;116 cmdcrc = (cmdcrc << 1) | spi_mosi_previous; 116 117 if (spi_bitcount == 0) { 117 118 handle_sdmmc_cmd(command, args); … … 154 155 // rising edge 155 156 uint8_t s_data; 156 s_data = (m_databuf[0] << 1) | p_spi_mosi;157 s_data = (m_databuf[0] << 1) | spi_mosi_previous; 157 158 m_databuf[0] = s_data; 158 159 if (spi_bitcount == 0) { … … 178 179 if (p_spi_clk.read() == 1 && spi_clk == 0) { 179 180 // rising edge 180 m_databuf[m_data_idx] = (m_databuf[m_data_idx] << 1) | p_spi_mosi;181 m_databuf[m_data_idx] = (m_databuf[m_data_idx] << 1) | spi_mosi_previous; 181 182 if (spi_bitcount == 0) { 182 183 m_data_idx++; … … 215 216 } 216 217 spi_clk = p_spi_clk.read(); 218 spi_mosi_previous = p_spi_mosi; 217 219 } // end GenMealy() 218 220
Note: See TracChangeset
for help on using the changeset viewer.