33 #define SST25VFXXXX_READ 0x03
34 #define SST25VFXXXX_HGIH_SPEAD_READ 0x0B
35 #define SST25VFXXXX_ERASE_4K 0x20
36 #define SST25VFXXXX_ERASE_32K 0x52
37 #define SST25VFXXXX_ERASE_64K 0xD8
38 #define SST25VFXXXX_ERASE_CHIP 0x60
39 #define SST25VFXXXX_BYTE_PROG 0x02
40 #define SST25VFXXXX_AAI_PROG 0xAD
41 #define SST25VFXXXX_RDSR 0x05
42 #define SST25VFXXXX_EWSR 0x50
43 #define SST25VFXXXX_WRSR 0x01
44 #define SST25VFXXXX_WREN 0x06
45 #define SST25VFXXXX_WRDI 0x04
46 #define SST25VFXXXX_RDID 0x90
47 #define SST25VFXXXX_JEDEC_ID 0x9F
48 #define SST25VFXXXX_EBSY 0x70
49 #define SST25VFXXXX_DBSY 0x80
void sst25vfxxxx_read_id(struct SST25VFxxxx *sst)
Read the chip identifier.
uint8_t output_buf[16]
The output buffer for the SPI transaction.
void sst25vfxxxx_block_write_en(struct SST25VFxxxx *sst)
Enable block writing.
SPI transaction structure.
The chip is busy with getting the chip ID.
void(* SPICallback)(struct spi_transaction *trans)
SPI Callback function.
void sst25vfxxxx_chip_erase(struct SST25VFxxxx *sst)
Full chip erase.
struct spi_periph * spi_p
The SPI peripheral for the connection.
struct spi_transaction spi_t
The SPI transaction used for the writing and reading of registers.
Architecture independent SPI (Serial Peripheral Interface) API.
SPI peripheral structure.
uint8_t transfer_idx
The transfer idx is used for counting input/output bytes.
The chip is busy reading bytes.
uint8_t * transfer_buf
The transfer buffer.
The chip is busy enabeling writing to blocks.
uint8_t status_idx
The counter of substatuses.
enum SST25VFxxxxStatus status
The status of the SST25VFxxxx flash chip.
The chip is busy writing bytes.
The chip isn't initialized.
void sst25vfxxxx_after_cb(struct SST25VFxxxx *sst)
Callback of the SPI after going one level higher for gathering the sst pointer.
The chip is idle and can be used.
void sst25vfxxxx_init(struct SST25VFxxxx *sst, struct spi_periph *spi_p, const uint8_t slave_idx, SPICallback spi_cb)
Initializing the sst25vfxxxx chip.
The chip is busy erasing itself.
void sst25vfxxxx_write(struct SST25VFxxxx *sst, uint8_t *transfer_buffer, uint8_t transfer_length)
Write bytes.
uint32_t flash_addr
The flash address to write at.
uint8_t input_buf[16]
The input buffer for the SPI transaction.
uint8_t slave_idx
slave id: SPI_SLAVE0 to SPI_SLAVE4
uint8_t transfer_length
The transfer buffer length.
void sst25vfxxxx_read(struct SST25VFxxxx *sst, uint8_t *transfer_buffer, uint8_t transfer_length)
Read bytes Need 5 more extra bytes because of SPI overhead.