test_spiffs.h File Reference
#include "spiffs.h"
Include dependency graph for test_spiffs.h:

Go to the source code of this file.

Classes

struct  tfile_conf
 
struct  tfile
 

Macros

#define FS   &__fs
 
#define CHECK(r)   if (!(r)) return -1;
 
#define CHECK_RES(r)   if (r < 0) return -1;
 
#define FS_PURE_DATA_PAGES(fs)   (SPIFFS_CFG_PHYS_SZ(fs) / SPIFFS_CFG_LOG_PAGE_SZ(fs)- (fs)->block_count * SPIFFS_OBJ_LOOKUP_PAGES(fs))
 
#define FS_PURE_DATA_SIZE(fs)   FS_PURE_DATA_PAGES(fs) * SPIFFS_DATA_PAGE_SIZE(fs)
 

Enumerations

enum  tfile_size { EMPTY, SMALL, MEDIUM, LARGE }
 
enum  tfile_type { UNTAMPERED, APPENDED, MODIFIED, REWRITTEN }
 
enum  tfile_life { SHORT = 3, NORMAL = 15, LONG = 100 }
 

Functions

void fs_reset ()
 
void fs_reset_specific (u32_t addr_offset, u32_t phys_addr, u32_t phys_size, u32_t phys_sector_size, u32_t log_block_size, u32_t log_page_size)
 
s32_t fs_mount_specific (u32_t phys_addr, u32_t phys_size, u32_t phys_sector_size, u32_t log_block_size, u32_t log_page_size)
 
void fs_mount_dump (char *fname, u32_t addr_offset, u32_t phys_addr, u32_t phys_size, u32_t phys_sector_size, u32_t log_block_size, u32_t log_page_size)
 
void fs_store_dump (char *fname)
 
void fs_load_dump (char *fname)
 
void fs_set_addr_offset (u32_t offset)
 
int read_and_verify (char *name)
 
int read_and_verify_fd (spiffs_file fd, char *name)
 
void dump_page (spiffs *fs, spiffs_page_ix p)
 
void hexdump (u32_t addr, u32_t len)
 
char * make_test_fname (const char *name)
 
void clear_test_path ()
 
void area_write (u32_t addr, u8_t *buf, u32_t size)
 
void area_set (u32_t addr, u8_t d, u32_t size)
 
void area_read (u32_t addr, u8_t *buf, u32_t size)
 
void dump_erase_counts (spiffs *fs)
 
void dump_flash_access_stats ()
 
void set_flash_ops_log (int enable)
 
void clear_flash_ops_log ()
 
u32_t get_flash_ops_log_read_bytes ()
 
u32_t get_flash_ops_log_write_bytes ()
 
void invoke_error_after_read_bytes (u32_t b, char once_only)
 
void invoke_error_after_write_bytes (u32_t b, char once_only)
 
void fs_set_validate_flashing (int i)
 
int get_error_count ()
 
int count_taken_fds (spiffs *fs)
 
void memrand (u8_t *b, int len)
 
int test_create_file (char *name)
 
int test_create_and_write_file (char *name, int size, int chunk_size)
 
u32_t get_spiffs_file_crc_by_fd (spiffs_file fd)
 
u32_t get_spiffs_file_crc (char *name)
 
void _setup ()
 
void _setup_test_only ()
 
void _teardown ()
 
u32_t tfile_get_size (tfile_size s)
 
int run_file_config (int cfg_count, tfile_conf *cfgs, int max_runs, int max_concurrent_files, int dbg)
 
void test_lock (spiffs *fs)
 
void test_unlock (spiffs *fs)
 

Variables

spiffs __fs
 

Macro Definition Documentation

◆ CHECK

#define CHECK (   r)    if (!(r)) return -1;

◆ CHECK_RES

#define CHECK_RES (   r)    if (r < 0) return -1;

◆ FS

#define FS   &__fs

◆ FS_PURE_DATA_PAGES

#define FS_PURE_DATA_PAGES (   fs)    (SPIFFS_CFG_PHYS_SZ(fs) / SPIFFS_CFG_LOG_PAGE_SZ(fs)- (fs)->block_count * SPIFFS_OBJ_LOOKUP_PAGES(fs))

◆ FS_PURE_DATA_SIZE

#define FS_PURE_DATA_SIZE (   fs)    FS_PURE_DATA_PAGES(fs) * SPIFFS_DATA_PAGE_SIZE(fs)

Enumeration Type Documentation

◆ tfile_life

enum tfile_life
Enumerator
SHORT 
NORMAL 
LONG 

◆ tfile_size

enum tfile_size
Enumerator
EMPTY 
SMALL 
MEDIUM 
LARGE 

◆ tfile_type

enum tfile_type
Enumerator
UNTAMPERED 
APPENDED 
MODIFIED 
REWRITTEN 

Function Documentation

◆ _setup()

void _setup ( )

◆ _setup_test_only()

void _setup_test_only ( )

◆ _teardown()

void _teardown ( )

◆ area_read()

void area_read ( u32_t  addr,
u8_t buf,
u32_t  size 
)

◆ area_set()

void area_set ( u32_t  addr,
u8_t  d,
u32_t  size 
)

◆ area_write()

void area_write ( u32_t  addr,
u8_t buf,
u32_t  size 
)

◆ clear_flash_ops_log()

void clear_flash_ops_log ( )

◆ clear_test_path()

void clear_test_path ( )

◆ count_taken_fds()

int count_taken_fds ( spiffs fs)

◆ dump_erase_counts()

void dump_erase_counts ( spiffs fs)

◆ dump_flash_access_stats()

void dump_flash_access_stats ( )

◆ dump_page()

void dump_page ( spiffs fs,
spiffs_page_ix  p 
)

◆ fs_load_dump()

void fs_load_dump ( char *  fname)

◆ fs_mount_dump()

void fs_mount_dump ( char *  fname,
u32_t  addr_offset,
u32_t  phys_addr,
u32_t  phys_size,
u32_t  phys_sector_size,
u32_t  log_block_size,
u32_t  log_page_size 
)

◆ fs_mount_specific()

s32_t fs_mount_specific ( u32_t  phys_addr,
u32_t  phys_size,
u32_t  phys_sector_size,
u32_t  log_block_size,
u32_t  log_page_size 
)

◆ fs_reset()

void fs_reset ( )

◆ fs_reset_specific()

void fs_reset_specific ( u32_t  addr_offset,
u32_t  phys_addr,
u32_t  phys_size,
u32_t  phys_sector_size,
u32_t  log_block_size,
u32_t  log_page_size 
)

◆ fs_set_addr_offset()

void fs_set_addr_offset ( u32_t  offset)

◆ fs_set_validate_flashing()

void fs_set_validate_flashing ( int  i)

◆ fs_store_dump()

void fs_store_dump ( char *  fname)

◆ get_error_count()

int get_error_count ( )

◆ get_flash_ops_log_read_bytes()

u32_t get_flash_ops_log_read_bytes ( )

◆ get_flash_ops_log_write_bytes()

u32_t get_flash_ops_log_write_bytes ( )

◆ get_spiffs_file_crc()

u32_t get_spiffs_file_crc ( char *  name)

◆ get_spiffs_file_crc_by_fd()

u32_t get_spiffs_file_crc_by_fd ( spiffs_file  fd)

◆ hexdump()

void hexdump ( u32_t  addr,
u32_t  len 
)

◆ invoke_error_after_read_bytes()

void invoke_error_after_read_bytes ( u32_t  b,
char  once_only 
)

◆ invoke_error_after_write_bytes()

void invoke_error_after_write_bytes ( u32_t  b,
char  once_only 
)

◆ make_test_fname()

char* make_test_fname ( const char *  name)

◆ memrand()

void memrand ( u8_t b,
int  len 
)

◆ read_and_verify()

int read_and_verify ( char *  name)

◆ read_and_verify_fd()

int read_and_verify_fd ( spiffs_file  fd,
char *  name 
)

◆ run_file_config()

int run_file_config ( int  cfg_count,
tfile_conf cfgs,
int  max_runs,
int  max_concurrent_files,
int  dbg 
)

◆ set_flash_ops_log()

void set_flash_ops_log ( int  enable)

◆ test_create_and_write_file()

int test_create_and_write_file ( char *  name,
int  size,
int  chunk_size 
)

◆ test_create_file()

int test_create_file ( char *  name)

◆ test_lock()

void test_lock ( spiffs fs)

◆ test_unlock()

void test_unlock ( spiffs fs)

◆ tfile_get_size()

u32_t tfile_get_size ( tfile_size  s)

Variable Documentation

◆ __fs

spiffs __fs