From 01b59c41b8f4c38d6e2205a8ebc08dabf701640f Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Fri, 16 Sep 2016 08:14:28 -0400 Subject: Revised ks_flash. Compiles, not yet tested. --- spiflash_n25q128.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'spiflash_n25q128.h') diff --git a/spiflash_n25q128.h b/spiflash_n25q128.h index fefcb0d..d4c82d5 100644 --- a/spiflash_n25q128.h +++ b/spiflash_n25q128.h @@ -45,6 +45,7 @@ #define N25Q128_COMMAND_READ_STATUS 0x05 #define N25Q128_COMMAND_WRITE_ENABLE 0x06 #define N25Q128_COMMAND_ERASE_SECTOR 0xD8 +#define N25Q128_COMMAND_ERASE_SUBSECTOR 0x20 #define N25Q128_COMMAND_PAGE_PROGRAM 0x02 #define N25Q128_PAGE_SIZE 0x100 // 256 @@ -53,6 +54,9 @@ #define N25Q128_SECTOR_SIZE 0x10000 // 65536 #define N25Q128_NUM_SECTORS 0x100 // 256 +#define N25Q128_SUBSECTOR_SIZE 0x1000 // 4096 +#define N25Q128_NUM_SUBSECTORS 0x1000 // 4096 + #define N25Q128_SPI_TIMEOUT 1000 #define N25Q128_ID_MANUFACTURER 0x20 @@ -71,6 +75,6 @@ extern int n25q128_read_page(struct spiflash_ctx *ctx, uint32_t page_offset, uin extern int n25q128_write_page(struct spiflash_ctx *ctx, uint32_t page_offset, const uint8_t *page_buffer); extern int n25q128_erase_sector(struct spiflash_ctx *ctx, uint32_t sector_offset); -extern int n25q128_write_data(struct spiflash_ctx *ctx, uint32_t offset, const uint8_t *buf, const uint32_t len); +extern int n25q128_write_data(struct spiflash_ctx *ctx, uint32_t offset, const uint8_t *buf, const uint32_t len, const int auto_erase); extern int n25q128_read_data(struct spiflash_ctx *ctx, uint32_t offset, uint8_t *buf, const uint32_t len); #endif /* __STM32_SPIFLASH_N25Q128_H */ -- cgit v1.2.3