Skip to content

Commit

Permalink
Disable IRQs around sdcard reads.
Browse files Browse the repository at this point in the history
Once the code switches to using DMA, this can be removed.
  • Loading branch information
dhylands committed Jul 6, 2014
1 parent 5fa5ca4 commit 90ba80d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion stmhal/sdcard.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 90ba80d

Please sign in to comment.