summaryrefslogtreecommitdiff
path: root/controller/fw/src/spi_flash.h
diff options
context:
space:
mode:
authorjaseg <git-bigdata-wsl-arch@jaseg.de>2020-02-27 16:02:41 +0100
committerjaseg <git-bigdata-wsl-arch@jaseg.de>2020-02-27 16:02:41 +0100
commitf6061fe574166b7d23b208f047e8789081877c57 (patch)
tree78ce2e5e6dc28736c66d4412ef3f2dc46036e3ab /controller/fw/src/spi_flash.h
parent43ff9fdac05c0ceb696685f683bba077bd2c8da2 (diff)
downloadmaster-thesis-f6061fe574166b7d23b208f047e8789081877c57.tar.gz
master-thesis-f6061fe574166b7d23b208f047e8789081877c57.tar.bz2
master-thesis-f6061fe574166b7d23b208f047e8789081877c57.zip
Add missing files
Diffstat (limited to 'controller/fw/src/spi_flash.h')
-rw-r--r--controller/fw/src/spi_flash.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/controller/fw/src/spi_flash.h b/controller/fw/src/spi_flash.h
new file mode 100644
index 0000000..e647c6a
--- /dev/null
+++ b/controller/fw/src/spi_flash.h
@@ -0,0 +1,31 @@
+#ifndef __SPI_FLASH_H__
+#define __SPI_FLASH_H__
+
+#include <stdbool.h>
+#include <unistd.h>
+
+struct spi_mem_id {
+ size_t size;
+ uint8_t mfg_id;
+ uint8_t type;
+};
+
+struct spi_flash_if {
+ struct spi_mem_id id;
+ uint32_t spi_base;
+ size_t page_size;
+ void (*cs)(bool val);
+};
+
+void spif_init(struct spi_flash_if *spif, size_t page_size, uint32_t spi_base, void (*cs)(bool val));
+
+void spif_write(struct spi_flash_if *spif, size_t addr, size_t len, const char* data);
+void spif_read(struct spi_flash_if *spif, size_t addr, size_t len, char* data);
+
+void spif_clear_mem(struct spi_flash_if *spif);
+void spif_clear_sector(struct spi_flash_if *spif, size_t addr);
+
+void spif_deep_power_down(struct spi_flash_if *spif);
+void spif_wakeup(struct spi_flash_if *spif);
+
+#endif /* __SPI_FLASH_H__ */