bullshit commit, sync for travel (to zn00H!) :)
[my-code/arm.git] / betty / pffs.h
index 6ddfbde..5849fa7 100644 (file)
 
 typedef struct s_pffs {
        /* flash specs */
 
 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);
 
        /* 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;
 
        /* pffs internal variables */
        u8 state;
-       u8 index_sec;                   // current index sector
        u8 data_tmp_sec;                // current temp data sector
 } t_pffs;
 
        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
        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;
 
 } 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!) */
 /* 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));
                         int (*fw)(u32 addr,u16 *buf,int len),
                         int (*fr)(u32 addr,u16 *buf,int len),
                         int (*fe)(u32 addr));