Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
sst25vfxxxx.h File Reference

Driver for the SST25Vxxxx flash chips. More...

#include "mcu_periph/spi.h"
+ Include dependency graph for sst25vfxxxx.h:
+ This graph shows which files directly or indirectly include this file:

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...
 

Detailed Description

Driver for the SST25Vxxxx flash chips.

Definition in file sst25vfxxxx.h.


Data Structure Documentation

struct SST25VFxxxx

Definition at line 63 of file sst25vfxxxx.h.

+ Collaboration diagram for SST25VFxxxx:
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.

Macro Definition Documentation

#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().

Enumeration Type Documentation

Enumerator
SST25VFXXXX_UNINIT 

The chip isn't initialized.

SST25VFXXXX_IDLE 

The chip is idle and can be used.

SST25VFXXXX_READ_ID 

The chip is busy with getting the chip ID.

SST25VFXXXX_WRITE_EN 

The chip is busy enabeling writing to blocks.

SST25VFXXXX_CHIP_ERASE 

The chip is busy erasing itself.

SST25VFXXXX_WRITE_BYTES 

The chip is busy writing bytes.

SST25VFXXXX_READ_BYTES 

The chip is busy reading bytes.

Definition at line 52 of file sst25vfxxxx.h.

Function Documentation

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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void sst25vfxxxx_read_id ( struct SST25VFxxxx sst)
void sst25vfxxxx_write ( struct SST25VFxxxx sst,
uint8_t transfer_buffer,
uint8_t  transfer_length 
)