Paparazzi UAS
v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
|
Driver for the SST25Vxxxx flash chips. More...
#include "mcu_periph/spi.h"
Go to the source code of this file.
Data Structures | |
struct | SST25VFxxxx |
Macros | |
#define | SST25VFXXXX_READ 0x03 |
#define | SST25VFXXXX_HGIH_SPEAD_READ 0x0B |
#define | SST25VFXXXX_ERASE_4K 0x20 |
#define | SST25VFXXXX_ERASE_32K 0x52 |
#define | SST25VFXXXX_ERASE_64K 0xD8 |
#define | SST25VFXXXX_ERASE_CHIP 0x60 |
#define | SST25VFXXXX_BYTE_PROG 0x02 |
#define | SST25VFXXXX_AAI_PROG 0xAD |
#define | SST25VFXXXX_RDSR 0x05 |
#define | SST25VFXXXX_EWSR 0x50 |
#define | SST25VFXXXX_WRSR 0x01 |
#define | SST25VFXXXX_WREN 0x06 |
#define | SST25VFXXXX_WRDI 0x04 |
#define | SST25VFXXXX_RDID 0x90 |
#define | SST25VFXXXX_JEDEC_ID 0x9F |
#define | SST25VFXXXX_EBSY 0x70 |
#define | SST25VFXXXX_DBSY 0x80 |
Enumerations | |
enum | SST25VFxxxxStatus { SST25VFXXXX_UNINIT, SST25VFXXXX_IDLE, SST25VFXXXX_READ_ID, SST25VFXXXX_WRITE_EN, SST25VFXXXX_CHIP_ERASE, SST25VFXXXX_WRITE_BYTES, SST25VFXXXX_READ_BYTES } |
Functions | |
void | sst25vfxxxx_init (struct SST25VFxxxx *sst, struct spi_periph *spi_p, const uint8_t slave_idx, SPICallback spi_cb) |
Initializing the sst25vfxxxx chip. More... | |
void | sst25vfxxxx_after_cb (struct SST25VFxxxx *sst) |
Callback of the SPI after going one level higher for gathering the sst pointer. More... | |
void | sst25vfxxxx_read_id (struct SST25VFxxxx *sst) |
Read the chip identifier. More... | |
void | sst25vfxxxx_block_write_en (struct SST25VFxxxx *sst) |
Enable block writing. More... | |
void | sst25vfxxxx_chip_erase (struct SST25VFxxxx *sst) |
Full chip erase. More... | |
void | sst25vfxxxx_write (struct SST25VFxxxx *sst, uint8_t *transfer_buffer, uint8_t transfer_length) |
Write bytes. More... | |
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. More... | |
Driver for the SST25Vxxxx flash chips.
Definition in file sst25vfxxxx.h.
struct SST25VFxxxx |
Definition at line 63 of file sst25vfxxxx.h.
Data Fields | ||
---|---|---|
uint32_t | flash_addr | The flash address to write at. |
uint8_t | input_buf[16] | The input buffer for the SPI transaction. |
uint8_t | output_buf[16] | The output buffer for the SPI transaction. |
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. |
enum SST25VFxxxxStatus | status | The status of the SST25VFxxxx flash chip. |
uint8_t | status_idx | The counter of substatuses. |
uint8_t * | transfer_buf | The transfer buffer. |
uint8_t | transfer_idx | The transfer idx is used for counting input/output bytes. |
uint8_t | transfer_length | The transfer buffer length. |
#define SST25VFXXXX_AAI_PROG 0xAD |
Definition at line 40 of file sst25vfxxxx.h.
Referenced by sst25vfxxxx_after_cb().
#define SST25VFXXXX_BYTE_PROG 0x02 |
Definition at line 39 of file sst25vfxxxx.h.
Referenced by sst25vfxxxx_after_cb().
#define SST25VFXXXX_DBSY 0x80 |
Definition at line 49 of file sst25vfxxxx.h.
#define SST25VFXXXX_EBSY 0x70 |
Definition at line 48 of file sst25vfxxxx.h.
#define SST25VFXXXX_ERASE_32K 0x52 |
Definition at line 36 of file sst25vfxxxx.h.
#define SST25VFXXXX_ERASE_4K 0x20 |
Definition at line 35 of file sst25vfxxxx.h.
#define SST25VFXXXX_ERASE_64K 0xD8 |
Definition at line 37 of file sst25vfxxxx.h.
#define SST25VFXXXX_ERASE_CHIP 0x60 |
Definition at line 38 of file sst25vfxxxx.h.
Referenced by sst25vfxxxx_after_cb().
#define SST25VFXXXX_EWSR 0x50 |
Definition at line 42 of file sst25vfxxxx.h.
Referenced by sst25vfxxxx_block_write_en().
#define SST25VFXXXX_HGIH_SPEAD_READ 0x0B |
Definition at line 34 of file sst25vfxxxx.h.
Referenced by sst25vfxxxx_read().
#define SST25VFXXXX_JEDEC_ID 0x9F |
Definition at line 47 of file sst25vfxxxx.h.
#define SST25VFXXXX_RDID 0x90 |
Definition at line 46 of file sst25vfxxxx.h.
Referenced by sst25vfxxxx_read_id().
#define SST25VFXXXX_RDSR 0x05 |
Definition at line 41 of file sst25vfxxxx.h.
Referenced by sst25vfxxxx_after_cb().
#define SST25VFXXXX_READ 0x03 |
Definition at line 33 of file sst25vfxxxx.h.
#define SST25VFXXXX_WRDI 0x04 |
Definition at line 45 of file sst25vfxxxx.h.
Referenced by sst25vfxxxx_after_cb().
#define SST25VFXXXX_WREN 0x06 |
Definition at line 44 of file sst25vfxxxx.h.
Referenced by sst25vfxxxx_chip_erase(), and sst25vfxxxx_write().
#define SST25VFXXXX_WRSR 0x01 |
Definition at line 43 of file sst25vfxxxx.h.
Referenced by sst25vfxxxx_after_cb().
enum SST25VFxxxxStatus |
Definition at line 52 of file sst25vfxxxx.h.
void sst25vfxxxx_after_cb | ( | struct SST25VFxxxx * | sst | ) |
Callback of the SPI after going one level higher for gathering the sst pointer.
Definition at line 64 of file sst25vfxxxx.c.
References SST25VFxxxx::flash_addr, SST25VFxxxx::input_buf, spi_transaction::input_buf, spi_transaction::input_length, SST25VFxxxx::output_buf, spi_transaction::output_length, SST25VFxxxx::spi_p, spi_submit(), SST25VFxxxx::spi_t, SST25VFXXXX_AAI_PROG, SST25VFXXXX_BYTE_PROG, SST25VFXXXX_CHIP_ERASE, SST25VFXXXX_ERASE_CHIP, SST25VFXXXX_IDLE, SST25VFXXXX_RDSR, SST25VFXXXX_READ_BYTES, SST25VFXXXX_WRDI, SST25VFXXXX_WRITE_BYTES, SST25VFXXXX_WRITE_EN, SST25VFXXXX_WRSR, SST25VFxxxx::status, SST25VFxxxx::status_idx, SST25VFxxxx::transfer_buf, SST25VFxxxx::transfer_idx, and SST25VFxxxx::transfer_length.
Referenced by direct_memory_spi_cb().
void sst25vfxxxx_block_write_en | ( | struct SST25VFxxxx * | sst | ) |
Enable block writing.
Definition at line 240 of file sst25vfxxxx.c.
References spi_transaction::input_length, SST25VFxxxx::output_buf, spi_transaction::output_length, SST25VFxxxx::spi_p, spi_submit(), SST25VFxxxx::spi_t, SST25VFXXXX_EWSR, SST25VFXXXX_IDLE, SST25VFXXXX_WRITE_EN, SST25VFxxxx::status, and SST25VFxxxx::status_idx.
Referenced by sst25vfxxxx_init().
void sst25vfxxxx_chip_erase | ( | struct SST25VFxxxx * | sst | ) |
Full chip erase.
Definition at line 258 of file sst25vfxxxx.c.
References spi_transaction::input_length, SST25VFxxxx::output_buf, spi_transaction::output_length, SST25VFxxxx::spi_p, spi_submit(), SST25VFxxxx::spi_t, SST25VFXXXX_CHIP_ERASE, SST25VFXXXX_IDLE, SST25VFXXXX_WREN, SST25VFxxxx::status, and SST25VFxxxx::status_idx.
Referenced by direct_memory_logger_set().
void sst25vfxxxx_init | ( | struct SST25VFxxxx * | sst, |
struct spi_periph * | spi_p, | ||
const uint8_t | slave_idx, | ||
SPICallback | spi_cb | ||
) |
Initializing the sst25vfxxxx chip.
Definition at line 34 of file sst25vfxxxx.c.
References spi_transaction::after_cb, spi_transaction::bitorder, spi_transaction::cdiv, spi_transaction::cpha, spi_transaction::cpol, spi_transaction::dss, SST25VFxxxx::flash_addr, SST25VFxxxx::input_buf, spi_transaction::input_buf, spi_transaction::input_length, SST25VFxxxx::output_buf, spi_transaction::output_buf, spi_transaction::output_length, spi_transaction::select, spi_transaction::slave_idx, SST25VFxxxx::spi_p, SDCard::spi_p, SST25VFxxxx::spi_t, SPICphaEdge1, SPICpolIdleLow, SPIDiv32, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, SPITransDone, sst25vfxxxx_block_write_en(), SST25VFXXXX_IDLE, SST25VFxxxx::status, and spi_transaction::status.
Referenced by direct_memory_logger_init().
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.
Definition at line 300 of file sst25vfxxxx.c.
References SST25VFxxxx::flash_addr, spi_transaction::input_buf, spi_transaction::input_length, SST25VFxxxx::output_buf, spi_transaction::output_length, SST25VFxxxx::spi_p, spi_submit(), SST25VFxxxx::spi_t, SST25VFXXXX_HGIH_SPEAD_READ, SST25VFXXXX_IDLE, SST25VFXXXX_READ_BYTES, SST25VFxxxx::status, and SST25VFxxxx::status_idx.
Referenced by direct_memory_logger_periodic(), and direct_memory_logger_set().
void sst25vfxxxx_read_id | ( | struct SST25VFxxxx * | sst | ) |
Read the chip identifier.
Definition at line 220 of file sst25vfxxxx.c.
References spi_transaction::input_length, SST25VFxxxx::output_buf, spi_transaction::output_length, SST25VFxxxx::spi_p, spi_submit(), SST25VFxxxx::spi_t, SST25VFXXXX_IDLE, SST25VFXXXX_RDID, SST25VFXXXX_READ_ID, and SST25VFxxxx::status.
void sst25vfxxxx_write | ( | struct SST25VFxxxx * | sst, |
uint8_t * | transfer_buffer, | ||
uint8_t | transfer_length | ||
) |
Write bytes.
Definition at line 276 of file sst25vfxxxx.c.
References spi_transaction::input_length, SST25VFxxxx::output_buf, spi_transaction::output_length, SST25VFxxxx::spi_p, spi_submit(), SST25VFxxxx::spi_t, SST25VFXXXX_IDLE, SST25VFXXXX_WREN, SST25VFXXXX_WRITE_BYTES, SST25VFxxxx::status, SST25VFxxxx::status_idx, SST25VFxxxx::transfer_buf, SST25VFxxxx::transfer_idx, and SST25VFxxxx::transfer_length.
Referenced by direct_memory_logger_periodic(), and direct_memory_logger_set().