/Zephyr-latest/subsys/fs/fcb/ |
D | fcb_append.c | 15 fcb_new_sector(struct fcb *fcb, int cnt) in fcb_new_sector() argument 23 cur = fcb->f_active.fe_sector; in fcb_new_sector() 25 cur = fcb_getnext_sector(fcb, cur); in fcb_new_sector() 29 if (cur == fcb->f_oldest) { in fcb_new_sector() 40 fcb_append_to_scratch(struct fcb *fcb) in fcb_append_to_scratch() argument 45 sector = fcb_new_sector(fcb, 0); in fcb_append_to_scratch() 49 rc = fcb_sector_hdr_init(fcb, sector, fcb->f_active_id + 1); in fcb_append_to_scratch() 53 fcb->f_active.fe_sector = sector; in fcb_append_to_scratch() 54 fcb->f_active.fe_elem_off = fcb_len_in_flash(fcb, sizeof(struct fcb_disk_area)); in fcb_append_to_scratch() 55 fcb->f_active_id++; in fcb_append_to_scratch() [all …]
|
D | fcb_rotate.c | 12 fcb_rotate(struct fcb *fcb) in fcb_rotate() argument 17 rc = k_mutex_lock(&fcb->f_mtx, K_FOREVER); in fcb_rotate() 22 rc = fcb_erase_sector(fcb, fcb->f_oldest); in fcb_rotate() 27 if (fcb->f_oldest == fcb->f_active.fe_sector) { in fcb_rotate() 32 sector = fcb_getnext_sector(fcb, fcb->f_oldest); in fcb_rotate() 33 rc = fcb_sector_hdr_init(fcb, sector, fcb->f_active_id + 1); in fcb_rotate() 37 fcb->f_active.fe_sector = sector; in fcb_rotate() 38 fcb->f_active.fe_elem_off = fcb_len_in_flash(fcb, sizeof(struct fcb_disk_area)); in fcb_rotate() 39 fcb->f_active_id++; in fcb_rotate() 41 fcb->f_oldest = fcb_getnext_sector(fcb, fcb->f_oldest); in fcb_rotate() [all …]
|
D | fcb_getnext.c | 14 fcb_getnext_in_sector(struct fcb *fcb, struct fcb_entry *loc) in fcb_getnext_in_sector() argument 18 rc = fcb_elem_info(fcb, loc); in fcb_getnext_in_sector() 22 fcb_len_in_flash(fcb, loc->fe_data_len) + in fcb_getnext_in_sector() 23 fcb_len_in_flash(fcb, FCB_CRC_SZ); in fcb_getnext_in_sector() 24 rc = fcb_elem_info(fcb, loc); in fcb_getnext_in_sector() 34 fcb_getnext_sector(struct fcb *fcb, struct flash_sector *sector) in fcb_getnext_sector() argument 37 if (sector >= &fcb->f_sectors[fcb->f_sector_cnt]) { in fcb_getnext_sector() 38 sector = &fcb->f_sectors[0]; in fcb_getnext_sector() 44 fcb_getnext_nolock(struct fcb *fcb, struct fcb_entry *loc) in fcb_getnext_nolock() argument 52 loc->fe_sector = fcb->f_oldest; in fcb_getnext_nolock() [all …]
|
D | fcb_priv.h | 42 static inline uint32_t fcb_flash_magic(const struct fcb *fcbp) in fcb_flash_magic() 56 int fcb_put_len(const struct fcb *fcbp, uint8_t *buf, uint16_t len); 57 int fcb_get_len(const struct fcb *fcbp, uint8_t *buf, uint16_t *len); 59 static inline int fcb_len_in_flash(struct fcb *fcbp, uint16_t len) in fcb_len_in_flash() 67 const struct flash_area *fcb_open_flash(const struct fcb *fcbp); 68 uint8_t fcb_get_align(const struct fcb *fcbp); 69 int fcb_erase_sector(const struct fcb *fcbp, const struct flash_sector *sector); 71 int fcb_getnext_in_sector(struct fcb *fcbp, struct fcb_entry *loc); 72 struct flash_sector *fcb_getnext_sector(struct fcb *fcbp, struct flash_sector *sector); 73 int fcb_getnext_nolock(struct fcb *fcbp, struct fcb_entry *loc); [all …]
|
D | fcb_walk.c | 16 fcb_walk(struct fcb *fcb, struct flash_sector *sector, fcb_walk_cb cb, in fcb_walk() argument 25 rc = k_mutex_lock(&fcb->f_mtx, K_FOREVER); in fcb_walk() 29 while ((rc = fcb_getnext_nolock(fcb, &entry_ctx.loc)) != in fcb_walk() 31 k_mutex_unlock(&fcb->f_mtx); in fcb_walk() 36 entry_ctx.fap = fcb->fap; in fcb_walk() 42 rc = k_mutex_lock(&fcb->f_mtx, K_FOREVER); in fcb_walk() 47 k_mutex_unlock(&fcb->f_mtx); in fcb_walk()
|
D | fcb.c | 19 uint8_t fcb_get_align(const struct fcb *fcbp) in fcb_get_align() 32 int fcb_flash_read(const struct fcb *fcbp, const struct flash_sector *sector, off_t off, in fcb_flash_read() 54 int fcb_flash_write(const struct fcb *fcbp, const struct flash_sector *sector, off_t off, in fcb_flash_write() 76 int fcb_erase_sector(const struct fcb *fcbp, const struct flash_sector *sector) in fcb_erase_sector() 92 int fcb_init(int f_area_id, struct fcb *fcbp) in fcb_init() 174 int fcb_free_sector_cnt(struct fcb *fcbp) in fcb_free_sector_cnt() 189 int fcb_is_empty(struct fcb *fcbp) in fcb_is_empty() 216 int fcb_put_len(const struct fcb *fcbp, uint8_t *buf, uint16_t len) in fcb_put_len() 230 int fcb_get_len(const struct fcb *fcbp, uint8_t *buf, uint16_t *len) in fcb_get_len() 255 int fcb_sector_hdr_init(struct fcb *fcbp, struct flash_sector *sector, uint16_t id) in fcb_sector_hdr_init() [all …]
|
D | fcb_elem_info.c | 20 fcb_elem_crc8(struct fcb *_fcb, struct fcb_entry *loc, uint8_t *c8p) in fcb_elem_crc8() 74 fcb_elem_endmarker_fixed(struct fcb *_fcb, struct fcb_entry *loc, uint8_t *em) in fcb_elem_endmarker_fixed() 106 fcb_elem_endmarker(struct fcb *_fcb, struct fcb_entry *loc, uint8_t *em) in fcb_elem_endmarker() 120 int fcb_elem_info(struct fcb *_fcb, struct fcb_entry *loc) in fcb_elem_info()
|
D | CMakeLists.txt | 5 fcb.c
|
/Zephyr-latest/tests/subsys/fs/fcb/src/ |
D | fcb_test_append_too_big.c | 12 struct fcb *fcb; in ZTEST() local 19 fcb = &test_fcb; in ZTEST() 38 + fcb_len_in_flash(fcb, sizeof(struct fcb_disk_area)) in ZTEST() 39 + fcb_len_in_flash(fcb, FCB_CRC_SZ) in ZTEST() 40 + fcb_len_in_flash(fcb, max_length_field_len) in ZTEST() 41 , fcb->f_active.fe_sector->fs_size); in ZTEST() 44 rc = fcb_append(fcb, len, &elem_loc); in ZTEST() 49 rc = fcb_append(fcb, len, &elem_loc); in ZTEST() 53 len -= fcb_len_in_flash(fcb, sizeof(struct fcb_disk_area)); in ZTEST() 54 rc = fcb_append(fcb, len, &elem_loc); in ZTEST() [all …]
|
D | fcb_test_reset.c | 12 struct fcb *fcb; in ZTEST() local 19 fcb = &test_fcb; in ZTEST() 22 rc = fcb_walk(fcb, 0, fcb_test_data_walk_cb, &var_cnt); in ZTEST() 27 rc = fcb_append(fcb, 32, &loc); in ZTEST() 34 rc = fcb_walk(fcb, 0, fcb_test_data_walk_cb, &var_cnt); in ZTEST() 42 rc = flash_area_write(fcb->fap, FCB_ENTRY_FA_DATA_OFF(loc), test_data, in ZTEST() 46 rc = fcb_append_finish(fcb, &loc); in ZTEST() 53 rc = fcb_walk(fcb, 0, fcb_test_data_walk_cb, &var_cnt); in ZTEST() 61 (void)memset(fcb, 0, sizeof(*fcb)); in ZTEST() 62 fcb->f_sector_cnt = 2U; in ZTEST() [all …]
|
D | fcb_test_init.c | 13 struct fcb *fcb; in ZTEST() local 15 fcb = &test_fcb; in ZTEST() 16 (void)memset(fcb, 0, sizeof(*fcb)); in ZTEST() 17 fcb->f_erase_value = fcb_test_erase_value; in ZTEST() 19 rc = fcb_init(TEST_FCB_FLASH_AREA_ID, fcb); in ZTEST() 22 fcb->f_sectors = test_fcb_sector; in ZTEST() 24 rc = fcb_init(TEST_FCB_FLASH_AREA_ID, fcb); in ZTEST() 27 fcb->f_sector_cnt = 2U; in ZTEST() 28 fcb->f_magic = 0x12345678; in ZTEST() 29 rc = fcb_init(TEST_FCB_FLASH_AREA_ID, fcb); in ZTEST() [all …]
|
D | fcb_test_rotate.c | 12 struct fcb *fcb; in ZTEST() local 23 fcb = &test_fcb; in ZTEST() 25 old_id = fcb->f_active_id; in ZTEST() 26 rc = fcb_rotate(fcb); in ZTEST() 28 zassert_true(fcb->f_active_id == old_id + 1, in ZTEST() 35 rc = fcb_append(fcb, sizeof(test_data), &loc); in ZTEST() 48 rc = flash_area_write(fcb->fap, FCB_ENTRY_FA_DATA_OFF(loc), in ZTEST() 52 rc = fcb_append_finish(fcb, &loc); in ZTEST() 58 old_id = fcb->f_active_id; in ZTEST() 59 rc = fcb_rotate(fcb); in ZTEST() [all …]
|
D | fcb_test_multiple_scratch.c | 12 struct fcb *fcb; in ZTEST() local 23 fcb = &test_fcb; in ZTEST() 24 fcb->f_scratch_cnt = 1U; in ZTEST() 32 rc = fcb_append(fcb, sizeof(test_data), &loc); in ZTEST() 39 rc = flash_area_write(fcb->fap, FCB_ENTRY_FA_DATA_OFF(loc), in ZTEST() 43 rc = fcb_append_finish(fcb, &loc); in ZTEST() 56 rc = fcb_append_to_scratch(fcb); in ZTEST() 60 rc = fcb_append(fcb, sizeof(test_data), &loc); in ZTEST() 67 rc = flash_area_write(fcb->fap, FCB_ENTRY_FA_DATA_OFF(loc), in ZTEST() 71 rc = fcb_append_finish(fcb, &loc); in ZTEST() [all …]
|
D | fcb_test_last_of_n.c | 13 struct fcb *fcb; in ZTEST() local 20 fcb = &test_fcb; in ZTEST() 21 fcb->f_scratch_cnt = 1U; in ZTEST() 24 rc = fcb_offset_last_n(fcb, 1, &loc); in ZTEST() 31 rc = fcb_append(fcb, sizeof(test_data), &loc); in ZTEST() 36 rc = flash_area_write(fcb->fap, FCB_ENTRY_FA_DATA_OFF(loc), in ZTEST() 40 rc = fcb_append_finish(fcb, &loc); in ZTEST() 47 rc = fcb_offset_last_n(fcb, 1, &loc); in ZTEST() 55 rc = fcb_offset_last_n(fcb, 3, &loc); in ZTEST() 63 rc = fcb_offset_last_n(fcb, 5, &loc); in ZTEST() [all …]
|
D | fcb_test_append_fill.c | 12 struct fcb *fcb; in ZTEST() local 27 fcb = &test_fcb; in ZTEST() 34 rc = fcb_append(fcb, sizeof(test_data), &loc); in ZTEST() 47 rc = flash_area_write(fcb->fap, FCB_ENTRY_FA_DATA_OFF(loc), in ZTEST() 51 rc = fcb_append_finish(fcb, &loc); in ZTEST() 60 rc = fcb_walk(fcb, NULL, fcb_test_cnt_elems_cb, &aa_together); in ZTEST() 68 rc = fcb_walk(fcb, &test_fcb_sector[0], fcb_test_cnt_elems_cb, in ZTEST() 71 rc = fcb_walk(fcb, &test_fcb_sector[1], fcb_test_cnt_elems_cb, in ZTEST()
|
D | fcb_test_empty_walk.c | 13 struct fcb *fcb; in ZTEST() local 15 fcb = &test_fcb; in ZTEST() 17 rc = fcb_walk(fcb, 0, fcb_test_empty_walk_cb, NULL); in ZTEST()
|
D | fcb_test_len.c | 17 struct fcb fcb = { .f_erase_value = fcb_test_erase_value }; in ZTEST() local 22 rc = fcb_put_len(&fcb, buf, len); in ZTEST() 25 rc2 = fcb_get_len(&fcb, buf, &len2); in ZTEST()
|
D | fcb_test.h | 26 extern struct fcb test_fcb; 28 extern struct fcb test_fcb_crc_disabled;
|
D | main.c | 16 struct fcb test_fcb = {0}; 18 struct fcb test_fcb_crc_disabled = { .f_flags = FCB_FLAGS_CRC_DISABLED }; 115 void fcb_tc_pretest(int sectors, struct fcb *_fcb) in fcb_tc_pretest()
|
/Zephyr-latest/include/zephyr/fs/ |
D | fcb.h | 94 struct fcb { struct 165 int fcb_init(int f_area_id, struct fcb *fcbp); 182 int fcb_append(struct fcb *fcbp, uint16_t len, struct fcb_entry *loc); 192 int fcb_append_finish(struct fcb *fcbp, struct fcb_entry *append_loc); 226 int fcb_walk(struct fcb *fcbp, struct flash_sector *sector, fcb_walk_cb cb, void *cb_arg); 244 int fcb_getnext(struct fcb *fcbp, struct fcb_entry *loc); 254 int fcb_rotate(struct fcb *fcbp); 266 int fcb_append_to_scratch(struct fcb *fcbp); 275 int fcb_free_sector_cnt(struct fcb *fcbp); 284 int fcb_is_empty(struct fcb *fcbp); [all …]
|
/Zephyr-latest/doc/services/storage/ |
D | index.rst | 13 fcb/fcb.rst
|
/Zephyr-latest/subsys/settings/include/settings/ |
D | settings_fcb.h | 20 struct fcb cf_fcb;
|
/Zephyr-latest/tests/subsys/settings/fcb/src/ |
D | CMakeLists.txt | 9 ${ZEPHYR_BASE}/tests/subsys/settings/fcb/src
|
/Zephyr-latest/tests/subsys/settings/functional/fcb/ |
D | settings_test_fcb.c | 23 rc = fcb_getnext((struct fcb *)storage, &loc); in ZTEST()
|
/Zephyr-latest/tests/subsys/fs/fcb/ |
D | CMakeLists.txt | 12 target_include_directories(app PRIVATE ${ZEPHYR_BASE}/subsys/fs/fcb)
|