1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #13335 from bergzand/pr/mtd_spi_nor/wait_in_debug

mtd_spi_nor: Add chip wait timings to debug output
This commit is contained in:
Kaspar Schleiser 2020-02-25 13:33:00 +01:00 committed by GitHub
commit ab333f3fb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -272,6 +272,9 @@ static inline void wait_for_write_complete(const mtd_spi_nor_t *dev, uint32_t us
{
unsigned i = 0, j = 0;
uint32_t div = 2;
#if ENABLE_DEBUG && defined(MODULE_XTIMER)
uint32_t diff = xtimer_now_usec();
#endif
do {
uint8_t status;
mtd_spi_cmd_read(dev, dev->opcode->rdsr, &status, sizeof(status));
@ -304,7 +307,12 @@ static inline void wait_for_write_complete(const mtd_spi_nor_t *dev, uint32_t us
thread_yield();
#endif
} while (1);
DEBUG("wait loop %u times, yield %u times\n", i, j);
DEBUG("wait loop %u times, yield %u times", i, j);
#if ENABLE_DEBUG && defined(MODULE_XTIMER)
diff = xtimer_now_usec() - diff;
DEBUG(", total wait %"PRIu32"us", diff);
#endif
DEBUG("\n");
}
static int mtd_spi_nor_init(mtd_dev_t *mtd)