Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/littlefs-project/littlefs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'emubd/lfs_emubd.h')
-rw-r--r--emubd/lfs_emubd.h51
1 files changed, 20 insertions, 31 deletions
diff --git a/emubd/lfs_emubd.h b/emubd/lfs_emubd.h
index 89ee4ce..838dbd2 100644
--- a/emubd/lfs_emubd.h
+++ b/emubd/lfs_emubd.h
@@ -7,9 +7,8 @@
#ifndef LFS_EMUBD_H
#define LFS_EMUBD_H
-#include "lfs_config.h"
+#include "lfs.h"
#include "lfs_util.h"
-#include "lfs_bd.h"
// Config options
@@ -30,60 +29,50 @@
#endif
-// Stats for debugging and optimization
-struct lfs_bd_stats {
- uint64_t read_count;
- uint64_t prog_count;
- uint64_t erase_count;
-};
-
// The emu bd state
typedef struct lfs_emubd {
char *path;
char *child;
- struct lfs_bd_info info;
- struct lfs_bd_stats stats;
+
+ struct {
+ uint64_t read_count;
+ uint64_t prog_count;
+ uint64_t erase_count;
+ } stats;
+
+ struct {
+ uint32_t read_size;
+ uint32_t prog_size;
+ uint32_t block_size;
+ uint32_t block_count;
+ } cfg;
} lfs_emubd_t;
// Create a block device using path for the directory to store blocks
-int lfs_emubd_create(lfs_emubd_t *emu, const char *path);
+int lfs_emubd_create(const struct lfs_config *cfg, const char *path);
// Clean up memory associated with emu block device
-void lfs_emubd_destroy(lfs_emubd_t *emu);
+void lfs_emubd_destroy(const struct lfs_config *cfg);
// Read a block
-int lfs_emubd_read(lfs_emubd_t *bd, lfs_block_t block,
+int lfs_emubd_read(const struct lfs_config *cfg, lfs_block_t block,
lfs_off_t off, lfs_size_t size, void *buffer);
// Program a block
//
// The block must have previously been erased.
-int lfs_emubd_prog(lfs_emubd_t *bd, lfs_block_t block,
+int lfs_emubd_prog(const struct lfs_config *cfg, lfs_block_t block,
lfs_off_t off, lfs_size_t size, const void *buffer);
// Erase a block
//
// A block must be erased before being programmed. The
// state of an erased block is undefined.
-int lfs_emubd_erase(lfs_emubd_t *bd, lfs_block_t block,
- lfs_off_t off, lfs_size_t size);
+int lfs_emubd_erase(const struct lfs_config *cfg, lfs_block_t block);
// Sync the block device
-int lfs_emubd_sync(lfs_emubd_t *bd);
-
-// Get a description of the block device
-//
-// Any unknown information may be left unmodified
-int lfs_emubd_info(lfs_emubd_t *bd, struct lfs_bd_info *info);
-
-// Get stats of operations on the block device
-//
-// Used for debugging and optimizations
-int lfs_emubd_stats(lfs_emubd_t *bd, struct lfs_bd_stats *stats);
-
-// Block device operations
-extern const struct lfs_bd_ops lfs_emubd_ops;
+int lfs_emubd_sync(const struct lfs_config *cfg);
#endif