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
uint8_t slave_idx
slave id: SPI_SLAVE0 to SPI_SLAVE4
void(* SPICallback)(struct spi_transaction *trans)
SPI Callback function.
SPI peripheral structure.
SPI transaction structure.
Architecture independent SPI (Serial Peripheral Interface) API.
@ SST25VFXXXX_READ_ID
The chip is busy with getting the chip ID.
@ SST25VFXXXX_READ_BYTES
The chip is busy reading bytes.
@ SST25VFXXXX_WRITE_BYTES
The chip is busy writing bytes.
@ SST25VFXXXX_UNINIT
The chip isn't initialized.
@ SST25VFXXXX_CHIP_ERASE
The chip is busy erasing itself.
@ SST25VFXXXX_IDLE
The chip is idle and can be used.
@ SST25VFXXXX_WRITE_EN
The chip is busy enabeling writing to blocks.
uint8_t transfer_idx
The transfer idx is used for counting input/output bytes.
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.
void sst25vfxxxx_block_write_en(struct SST25VFxxxx *sst)
Enable block writing.
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_read(struct SST25VFxxxx *sst, uint8_t *transfer_buffer, uint8_t transfer_length)
Read bytes Need 5 more extra bytes because of SPI overhead.
struct spi_transaction spi_t
The SPI transaction used for the writing and reading of registers.
void sst25vfxxxx_init(struct SST25VFxxxx *sst, struct spi_periph *spi_p, const uint8_t slave_idx, SPICallback spi_cb)
Initializing the sst25vfxxxx chip.
uint8_t transfer_length
The transfer buffer length.
void sst25vfxxxx_chip_erase(struct SST25VFxxxx *sst)
Full chip erase.
uint8_t * transfer_buf
The transfer buffer.
uint8_t input_buf[16]
The input buffer for the SPI transaction.
uint8_t status_idx
The counter of substatuses.
void sst25vfxxxx_after_cb(struct SST25VFxxxx *sst)
Callback of the SPI after going one level higher for gathering the sst pointer.
enum SST25VFxxxxStatus status
The status of the SST25VFxxxx flash chip.
struct spi_periph * spi_p
The SPI peripheral for the connection.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.