| 469 | } |
| 470 | |
| 471 | void w25q_write_read_data(struct rt_qspi_device *device, uint32_t u32Addr) |
| 472 | { |
| 473 | uint32_t u32Cnt; |
| 474 | |
| 475 | for (u32Cnt = 0; u32Cnt < W25Q_QSPI_DATA_BUF_LEN; u32Cnt++) |
| 476 | { |
| 477 | u8WrBuf[u32Cnt] = u32Cnt & 0xFFUL; |
| 478 | u8RdBuf[u32Cnt] = 0U; |
| 479 | } |
| 480 | if (LL_OK != w25q_erase_sector(device, u32Addr, W25Q_QSPI_DATA_BUF_LEN)) |
| 481 | { |
| 482 | rt_kprintf("qspi erase sector failed!\n"); |
| 483 | } |
| 484 | if (LL_OK != w25q_write_data(device, u32Addr, u8WrBuf, W25Q_QSPI_DATA_BUF_LEN)) |
| 485 | { |
| 486 | rt_kprintf("qspi write data failed!\n"); |
| 487 | } |
| 488 | if (LL_OK != w25q_read_data(device, u32Addr, u8RdBuf, W25Q_QSPI_DATA_BUF_LEN)) |
| 489 | { |
| 490 | rt_kprintf("qspi read data failed!\n"); |
| 491 | } |
| 492 | if (rt_memcmp(u8WrBuf, u8RdBuf, W25Q_QSPI_DATA_BUF_LEN) == 0) |
| 493 | { |
| 494 | rt_kprintf("qspi write and read test ok: addr=0x%06X\n", u32Addr); |
| 495 | } |
| 496 | else |
| 497 | { |
| 498 | rt_kprintf("qspi write and read failed!\n"); |
| 499 | } |
| 500 | } |
| 501 | |
| 502 | static void qspi_thread_entry(void *parameter) |
| 503 | { |
no test coverage detected