Skip to content

Commit 90ba80d

Browse files
committed
Disable IRQs around sdcard reads.
Once the code switches to using DMA, this can be removed.
1 parent 5fa5ca4 commit 90ba80d

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

stmhal/sdcard.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,13 @@ bool sdcard_read_blocks(uint8_t *dest, uint32_t block_num, uint32_t num_blocks)
144144
return false;
145145
}
146146

147-
if (HAL_SD_ReadBlocks(&sd_handle, (uint32_t*)dest, block_num * SDCARD_BLOCK_SIZE, SDCARD_BLOCK_SIZE, num_blocks) != SD_OK) {
147+
HAL_SD_ErrorTypedef err;
148+
149+
__disable_irq();
150+
err = HAL_SD_ReadBlocks(&sd_handle, (uint32_t*)dest, block_num * SDCARD_BLOCK_SIZE, SDCARD_BLOCK_SIZE, num_blocks);
151+
__enable_irq();
152+
153+
if (err != SD_OK) {
148154
return false;
149155
}
150156

0 commit comments

Comments
 (0)