aboutsummaryrefslogtreecommitdiff
path: root/spiflash_n25q128.h
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2016-09-16 08:14:28 -0400
committerRob Austein <sra@hactrn.net>2016-09-16 08:14:28 -0400
commit01b59c41b8f4c38d6e2205a8ebc08dabf701640f (patch)
treeb1e681bd69a56b0896678ee198a35e8951244526 /spiflash_n25q128.h
parent4b5afd660093ea6e95b86539f453ba4410ffc656 (diff)
Revised ks_flash. Compiles, not yet tested.
Diffstat (limited to 'spiflash_n25q128.h')
-rw-r--r--spiflash_n25q128.h6
1 files changed, 5 insertions, 1 deletions
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 */