lock SPI bus when erasing
This commit is contained in:
parent
a26bcf30f7
commit
bff587e32c
|
@ -47,9 +47,9 @@ Berlin, 2007
|
|||
* @brief MMC-/SD-Card library, Block erase
|
||||
*
|
||||
* @author Michael Baar <baar@inf.fu-berlin.de>
|
||||
* @version $Revision: 1.3 $
|
||||
* @version $Revision: 1.4 $
|
||||
*
|
||||
* $Id: sd_erase.c,v 1.3 2008/03/28 23:03:05 nvt-se Exp $
|
||||
* $Id: sd_erase.c,v 1.4 2008/05/27 13:01:27 nvt-se Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -69,9 +69,14 @@ sd_erase_blocks(uint32_t address, uint16_t numBlocks)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (!uart_lock(UART_MODE_SPI)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ret = _sd_send_cmd(SD_CMD_ERASE_WR_BLK_START_ADDR, SD_RESPONSE_SIZE_R1,
|
||||
&address, &r1);
|
||||
if (!ret | r1) {
|
||||
uart_unlock(UART_MODE_SPI);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -81,10 +86,12 @@ sd_erase_blocks(uint32_t address, uint16_t numBlocks)
|
|||
ret = _sd_send_cmd(SD_CMD_ERASE_WR_BLK_END_ADDR, SD_RESPONSE_SIZE_R1,
|
||||
&endAdr, &r1);
|
||||
if (!ret | r1) {
|
||||
uart_unlock(UART_MODE_SPI);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ret = _sd_send_cmd(SD_CMD_ERASE, SD_RESPONSE_SIZE_R1, NULL, &r1);
|
||||
uart_unlock(UART_MODE_SPI);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue