MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / w25q_check_process_done

Function w25q_check_process_done

bsp/hc32/tests/test_qspi.c:146–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144
145
146int32_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
175rt_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{

Callers 3

w25q_write_srFunction · 0.70
w25q_write_dataFunction · 0.70
w25q_erase_sectorFunction · 0.70

Calls 3

rt_qspi_send_then_recvFunction · 0.85
rt_kprintfFunction · 0.85
rt_thread_mdelayFunction · 0.85

Tested by

no test coverage detected