X-Git-Url: https://hackdaworld.org/gitweb/?p=my-code%2Farm.git;a=blobdiff_plain;f=betty%2Fpffs.h;h=5849fa7576b8de07c972c50ee96ac95fcfede1af;hp=6ddfbde44772b87fd7253a419fe4257570f5cbd5;hb=6a1c483e9c2da2e1affde2a7f3b40ff1c3b09a5f;hpb=7f516b2153b747636e0b379882457ef3ea0ed23f diff --git a/betty/pffs.h b/betty/pffs.h index 6ddfbde..5849fa7 100644 --- a/betty/pffs.h +++ b/betty/pffs.h @@ -66,10 +66,9 @@ typedef struct s_pffs { /* flash specs */ - u32 base_addr; - u32 *sec_addr; - u8 sec_num_data[2]; // first/last sector used for data - u8 sec_num_index[2]; // 2 sectors used as an index + u32 base_addr; // base flash access address + u32 *sec_addr; // pointer to sector addresses + u8 sec_num; // number of sectors /* flash write, read and sector erase function pointers */ int (*fw)(u32 addr,u16 *buf,int len); @@ -78,7 +77,6 @@ typedef struct s_pffs { /* pffs internal variables */ u8 state; - u8 index_sec; // current index sector u8 data_tmp_sec; // current temp data sector } t_pffs; @@ -91,13 +89,21 @@ typedef struct s_pffs_fd { char file[PFFS_MAX_FILENAME_SIZE+PFFS_MAX_FILENAME_SIZE]; // the file u8 fn_size; // file name size u8 mode; // mode, eg: write, read - t_pffs *pffs; // the pffs main struct + t_pffs *pffs; // pointer to the pffs main struct } t_pffs_fd; +typedef struct s_pffs_sector_header { + u32 wear_level; // program / erase cycles +} + +typedef struct s_pffs_file_header { + u32 file_len; // length of files in ? + u32 file_cont; // continued file addr + u8 file_name_len; // lenght of the filename in words +} + /* function prototypes (only the ones applications should use!) */ -int pffs_flash_register(t_pffs *pffs,u32 base_addr,u32 *sec_addr, - u8 sec_num_data_min,u8 sec_num_data_max, - u8 sec_num_index0,u8 sec_num_index1, +int pffs_flash_register(t_pffs *pffs,u32 base_addr,u32 *sec_addr,u8 sec_num, int (*fw)(u32 addr,u16 *buf,int len), int (*fr)(u32 addr,u16 *buf,int len), int (*fe)(u32 addr));