aboutsummaryrefslogtreecommitdiff
path: root/stmhal/sdcard.c
diff options
context:
space:
mode:
authorDamien George2015-06-10 14:25:54 +0100
committerDamien George2015-12-22 21:00:20 +0000
commit401af50dc081faa421e7caef18fde2beb15632e4 (patch)
tree3af529bf86743dddf182c632849edf2a9ecf5f6a /stmhal/sdcard.c
parentabd0fcfc86c413d7de58f0c927ca6f598ee12950 (diff)
stmhal: Add pyb.irq_stats() to get statistics about IRQ calls.
Adds a lot of code, makes IRQs a bit less efficient, but is very useful for debugging. Usage: pyb.irq_stats() returns a memory view that can be read and written, eg: list(pyb.irq_stats()) pyb.irq_stats()[0] pyb.irq_stats()[0] = 0 The patch provides general IRQ_ENTER() and IRQ_EXIT() macros that can be modified to provide further IRQ statistics if desired.
Diffstat (limited to 'stmhal/sdcard.c')
-rw-r--r--stmhal/sdcard.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/stmhal/sdcard.c b/stmhal/sdcard.c
index 2adbaf146..ae1852519 100644
--- a/stmhal/sdcard.c
+++ b/stmhal/sdcard.c
@@ -196,7 +196,9 @@ uint64_t sdcard_get_capacity_in_bytes(void) {
}
void SDIO_IRQHandler(void) {
+ IRQ_ENTER(SDIO_IRQn);
HAL_SD_IRQHandler(&sd_handle);
+ IRQ_EXIT(SDIO_IRQn);
}
mp_uint_t sdcard_read_blocks(uint8_t *dest, uint32_t block_num, uint32_t num_blocks) {