demo: SPI Flash interface working
This commit is contained in:
parent
2964bda23c
commit
fcbdab4ab2
4 changed files with 95 additions and 60 deletions
|
|
@ -2,7 +2,7 @@
|
|||
#define __SPI_FLASH_H__
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
struct spi_mem_id {
|
||||
size_t size;
|
||||
|
|
@ -13,10 +13,18 @@ struct spi_mem_id {
|
|||
struct spi_flash_if {
|
||||
struct spi_mem_id id;
|
||||
uint32_t spi_base;
|
||||
size_t page_size;
|
||||
void (*cs)(bool val);
|
||||
};
|
||||
|
||||
int spif_init(struct spi_mem_id *mem_data);
|
||||
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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue