| 144 | |
| 145 | |
| 146 | int32_t w25q_check_process_done(struct rt_qspi_device *device, uint32_t u32Timeout) |
| 147 | { |
| 148 | __IO uint32_t u32Count = 0U; |
| 149 | int32_t i32Ret = LL_ERR_TIMEOUT; |
| 150 | rt_uint8_t rxBuf[5] = {0}; |
| 151 | rt_uint8_t txBuf[5] = {0}; |
| 152 | |
| 153 | txBuf[0] = W25Q_RD_STATUS_REG1; |
| 154 | while (u32Count < u32Timeout) |
| 155 | { |
| 156 | if (1 != rt_qspi_send_then_recv(device, txBuf, 1, rxBuf, 1)) |
| 157 | { |
| 158 | rt_kprintf("qspi get SR failed!\n"); |
| 159 | } |
| 160 | else |
| 161 | { |
| 162 | if (W25Q_FLAG_BUSY != (rxBuf[0] & W25Q_FLAG_BUSY)) |
| 163 | { |
| 164 | i32Ret = LL_OK; |
| 165 | break; |
| 166 | } |
| 167 | } |
| 168 | rt_thread_mdelay(1); |
| 169 | u32Count++; |
| 170 | } |
| 171 | |
| 172 | return i32Ret; |
| 173 | } |
| 174 | |
| 175 | rt_err_t bsp_qspi_send_then_recv(struct rt_qspi_device *device, const void *send_buf, rt_size_t send_length, void *recv_buf, rt_size_t recv_length) |
| 176 | { |
no test coverage detected