Skip to content

Commit

Permalink
Deal with the bigger flash we have on rad1o
Browse files Browse the repository at this point in the history
  • Loading branch information
Sec42 committed Jul 29, 2015
1 parent 62799d4 commit abab6b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
21 changes: 9 additions & 12 deletions firmware/common/w25q80bv.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,10 @@ void w25q80bv_setup(void)
SSP_MASTER,
SSP_SLAVE_OUT_ENABLE);

device_id = 0;
while(device_id != W25Q80BV_DEVICE_ID_RES)
{
do {
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)
Expand Down Expand Up @@ -163,11 +162,10 @@ void w25q80bv_chip_erase(void)
{
uint8_t device_id;

device_id = 0;
while(device_id != W25Q80BV_DEVICE_ID_RES)
{
do {
device_id = w25q80bv_get_device_id();
}
} while(device_id != W25Q80BV_DEVICE_ID_RES &&
device_id != W25Q16DV_DEVICE_ID_RES);

w25q80bv_write_enable();
w25q80bv_wait_while_busy();
Expand Down Expand Up @@ -208,11 +206,10 @@ void w25q80bv_program(uint32_t addr, uint32_t len, const uint8_t* data)
uint16_t first_block_len;
uint8_t device_id;

device_id = 0;
while(device_id != W25Q80BV_DEVICE_ID_RES)
{
do {
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 */
if ((len > W25Q80BV_NUM_BYTES) || (addr > W25Q80BV_NUM_BYTES)
Expand Down
1 change: 1 addition & 0 deletions firmware/common/w25q80bv.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@


#define W25Q80BV_DEVICE_ID_RES 0x13 /* Expected device_id for W25Q80BV */
#define W25Q16DV_DEVICE_ID_RES 0x14 /* Expected device_id for W25Q16DV */

typedef union
{
Expand Down

0 comments on commit abab6b1

Please sign in to comment.