Deal with the bigger flash we have on rad1o

This commit is contained in:
Stefan `Sec` Zehl
2015-07-30 00:06:55 +02:00
parent 62799d4158
commit abab6b154a
2 changed files with 10 additions and 12 deletions

View File

@ -85,11 +85,10 @@ void w25q80bv_setup(void)
SSP_MASTER, SSP_MASTER,
SSP_SLAVE_OUT_ENABLE); SSP_SLAVE_OUT_ENABLE);
device_id = 0; do {
while(device_id != W25Q80BV_DEVICE_ID_RES)
{
device_id = w25q80bv_get_device_id(); device_id = w25q80bv_get_device_id();
} } while(device_id != W25Q80BV_DEVICE_ID_RES &&
device_id != W25Q16DV_DEVICE_ID_RES);
} }
uint8_t w25q80bv_get_status(void) uint8_t w25q80bv_get_status(void)
@ -163,11 +162,10 @@ void w25q80bv_chip_erase(void)
{ {
uint8_t device_id; uint8_t device_id;
device_id = 0; do {
while(device_id != W25Q80BV_DEVICE_ID_RES)
{
device_id = w25q80bv_get_device_id(); device_id = w25q80bv_get_device_id();
} } while(device_id != W25Q80BV_DEVICE_ID_RES &&
device_id != W25Q16DV_DEVICE_ID_RES);
w25q80bv_write_enable(); w25q80bv_write_enable();
w25q80bv_wait_while_busy(); w25q80bv_wait_while_busy();
@ -208,11 +206,10 @@ void w25q80bv_program(uint32_t addr, uint32_t len, const uint8_t* data)
uint16_t first_block_len; uint16_t first_block_len;
uint8_t device_id; uint8_t device_id;
device_id = 0; do {
while(device_id != W25Q80BV_DEVICE_ID_RES)
{
device_id = w25q80bv_get_device_id(); device_id = w25q80bv_get_device_id();
} } while(device_id != W25Q80BV_DEVICE_ID_RES &&
device_id != W25Q16DV_DEVICE_ID_RES);
/* do nothing if we would overflow the flash */ /* do nothing if we would overflow the flash */
if ((len > W25Q80BV_NUM_BYTES) || (addr > W25Q80BV_NUM_BYTES) if ((len > W25Q80BV_NUM_BYTES) || (addr > W25Q80BV_NUM_BYTES)

View File

@ -38,6 +38,7 @@
#define W25Q80BV_DEVICE_ID_RES 0x13 /* Expected device_id for W25Q80BV */ #define W25Q80BV_DEVICE_ID_RES 0x13 /* Expected device_id for W25Q80BV */
#define W25Q16DV_DEVICE_ID_RES 0x14 /* Expected device_id for W25Q16DV */
typedef union typedef union
{ {