Norman James | 6a58a27 | 2015-10-07 14:34:16 -0500 | [diff] [blame] | 1 | #ifndef __LIBFFS_H
|
| 2 | #define __LIBFFS_H
|
| 3 |
|
| 4 | #include <libflash/libflash.h>
|
| 5 | #include <libflash/ffs.h>
|
| 6 |
|
| 7 | /* FFS handle, opaque */
|
| 8 | struct ffs_handle;
|
| 9 |
|
| 10 | /* Error codes:
|
| 11 | *
|
| 12 | * < 0 = flash controller errors
|
| 13 | * 0 = success
|
| 14 | * > 0 = libffs / libflash errors
|
| 15 | */
|
| 16 | #define FFS_ERR_BAD_MAGIC 100
|
| 17 | #define FFS_ERR_BAD_VERSION 101
|
| 18 | #define FFS_ERR_BAD_CKSUM 102
|
| 19 | #define FFS_ERR_PART_NOT_FOUND 103
|
| 20 |
|
| 21 | int ffs_open_flash(struct flash_chip *chip, uint32_t offset,
|
| 22 | uint32_t max_size, struct ffs_handle **ffs);
|
| 23 |
|
| 24 | /* TODO
|
| 25 | int ffs_open_image(void *image, uint32_t size, struct ffs_handle **ffs);
|
| 26 | */
|
| 27 |
|
| 28 | void ffs_close(struct ffs_handle *ffs);
|
| 29 |
|
| 30 | int ffs_lookup_part(struct ffs_handle *ffs, const char *name,
|
| 31 | uint32_t *part_idx);
|
| 32 |
|
| 33 | int ffs_part_info(struct ffs_handle *ffs, uint32_t part_idx,
|
| 34 | char **name, uint32_t *start,
|
| 35 | uint32_t *total_size, uint32_t *act_size);
|
| 36 |
|
| 37 | int ffs_update_act_size(struct ffs_handle *ffs, uint32_t part_idx,
|
| 38 | uint32_t act_size);
|
| 39 |
|
| 40 |
|
| 41 | #endif /* __LIBFFS_H */
|