summaryrefslogtreecommitdiffstatshomepage
path: root/stmhal/sdcard.c
diff options
context:
space:
mode:
authorDave Hylands <dhylands@gmail.com>2014-07-06 09:49:20 -0700
committerDave Hylands <dhylands@gmail.com>2014-07-06 09:51:22 -0700
commit90ba80dc363ffc07b9bbd7156ff44c8e01c69869 (patch)
tree24955f7d08331d81a104036487392483aec11ec2 /stmhal/sdcard.c
parent5fa5ca40e67c3c4bfce116a70c3a88b52b718928 (diff)
downloadmicropython-90ba80dc363ffc07b9bbd7156ff44c8e01c69869.tar.gz
micropython-90ba80dc363ffc07b9bbd7156ff44c8e01c69869.zip
Disable IRQs around sdcard reads.
Once the code switches to using DMA, this can be removed.
Diffstat (limited to 'stmhal/sdcard.c')
-rw-r--r--stmhal/sdcard.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/stmhal/sdcard.c b/stmhal/sdcard.c
index 204dbe3b46..104c195b84 100644
--- a/stmhal/sdcard.c
+++ b/stmhal/sdcard.c
@@ -144,7 +144,13 @@ bool sdcard_read_blocks(uint8_t *dest, uint32_t block_num, uint32_t num_blocks)
return false;
}
- if (HAL_SD_ReadBlocks(&sd_handle, (uint32_t*)dest, block_num * SDCARD_BLOCK_SIZE, SDCARD_BLOCK_SIZE, num_blocks) != SD_OK) {
+ HAL_SD_ErrorTypedef err;
+
+ __disable_irq();
+ err = HAL_SD_ReadBlocks(&sd_handle, (uint32_t*)dest, block_num * SDCARD_BLOCK_SIZE, SDCARD_BLOCK_SIZE, num_blocks);
+ __enable_irq();
+
+ if (err != SD_OK) {
return false;
}