Home
last modified time | relevance | path

Searched full:fcb (Results 1 – 25 of 98) sorted by relevance

1234

/Zephyr-latest/subsys/fs/fcb/
Dfcb_append.c11 #include <zephyr/fs/fcb.h>
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()
[all …]
Dfcb_rotate.c8 #include <zephyr/fs/fcb.h>
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()
[all …]
Dfcb_getnext.c10 #include <zephyr/fs/fcb.h>
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
[all …]
Dfcb_priv.h13 #include <zephyr/fs/fcb.h>
32 * Magic, the fcb->f_magic, prior to being written to flash, is xored with
33 * binary inversion of fcb->f_erase_value to avoid it matching a 4 consecutive
38 * @param fcb pointer to initialized fcb structure
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);
[all …]
Dfcb_walk.c8 #include <zephyr/fs/fcb.h>
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()
DKconfig10 config FCB config
18 if FCB
21 bool "Allow FCB instances to have a fixed endmarker"
23 This allows the FCB instances to disable CRC checks in
Dfcb.c17 #include <zephyr/fs/fcb.h>
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()
[all …]
Dfcb_elem_info.c10 #include <zephyr/fs/fcb.h>
20 fcb_elem_crc8(struct fcb *_fcb, struct fcb_entry *loc, uint8_t *c8p) in fcb_elem_crc8()
70 /* Given the offset in flash sector, calculate the FCB entry data offset and size, and set
74 fcb_elem_endmarker_fixed(struct fcb *_fcb, struct fcb_entry *loc, uint8_t *em) in fcb_elem_endmarker_fixed()
102 /* Given the offset in flash sector, calculate the FCB entry data offset and size, and calculate
106 fcb_elem_endmarker(struct fcb *_fcb, struct fcb_entry *loc, uint8_t *em) in fcb_elem_endmarker()
117 /* Given the offset in flash sector, calculate the FCB entry data offset and size, and verify that
118 * the FCB entry endmarker is correct.
120 int fcb_elem_info(struct fcb *_fcb, struct fcb_entry *loc) in fcb_elem_info()
/Zephyr-latest/tests/subsys/fs/fcb/src/
Dfcb_test_append_too_big.c12 struct fcb *fcb; in ZTEST() local
19 fcb = &test_fcb; in ZTEST()
22 * An entry in the FCB has the following structure: in ZTEST()
29 * (M / fcb->f_align) * fcb->f_align, where / is integer in ZTEST()
33 * O = fcb_len_in_flash(fcb, FCB_CRC_SZ) in ZTEST()
34 * + fcb_len_in_flash(fcb, max_length_field_len) in ZTEST()
35 * + fcb_len_in_flash(fcb, sizeof(struct fcb_disk_area)) 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()
[all …]
Dfcb_test_init.c13 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 …]
Dfcb_test_reset.c12 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 …]
Dfcb_test_rotate.c12 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 …]
Dfcb_test_multiple_scratch.c12 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 …]
Dfcb_test_last_of_n.c13 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 …]
Dfcb_test_empty_walk.c13 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()
Dfcb_test_append_fill.c12 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()
Dfcb_test_len.c17 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()
/Zephyr-latest/include/zephyr/fs/
Dfcb.h26 * @defgroup fcb Flash Circular Buffer (FCB)
36 * @ingroup fcb
43 * @brief FCB entry info structure. This data structure describes the element
48 * Entry location is pointer to area (within fcb->f_sectors), and offset
61 uint16_t fe_data_len; /**< Size of data area in fcb entry*/
66 * the fcb flash_area start offset.
68 * @param entry fcb entry structure
73 * @brief Structure for transferring complete information about FCB entry
77 struct fcb_entry loc; /**< FCB entry info */
88 * @brief FCB instance structure
[all …]
/Zephyr-latest/tests/subsys/fs/fcb/
Dtestcase.yaml2 filesystem.fcb:
13 filesystem.fcb.no_erase:
17 filesystem.fcb.native_sim.no_erase:
20 filesystem.fcb.fixed_endmarker:
32 filesystem.fcb.native_sim.fcb_0x00:
35 filesystem.fcb.qemu_x86.fcb_0x00:
/Zephyr-latest/tests/subsys/settings/functional/fcb/
Dtestcase.yaml2 settings.functional.fcb:
13 - fcb
14 settings.functional.fcb.chosen:
24 - fcb
/Zephyr-latest/tests/subsys/settings/fcb/src/
Dsettings_test_save_one_fcb.c31 zassert_true(rc == 0, "can't register FCB as configuration source"); in ZTEST()
36 "can't register FCB as configuration destination"); in ZTEST()
40 zassert_true(rc == 0, "fcb write error"); in ZTEST()
43 zassert_true(rc == 0, "fcb one item write error"); in ZTEST()
46 zassert_true(rc == 0, "fcb read error"); in ZTEST()
50 zassert_true(rc == 0, "fcb one item write error"); in ZTEST()
53 zassert_true(rc == 0, "fcb read error"); in ZTEST()
Dsettings_test_save_1_fcb.c27 zassert_true(rc == 0, "can't register FCB as configuration source"); in ZTEST()
33 "can't register FCB as configuration destination"); in ZTEST()
37 zassert_true(rc == 0, "fcb write error"); in ZTEST()
42 zassert_true(rc == 0, "fcb redout error"); in ZTEST()
47 zassert_true(rc == 0, "fcb write error"); in ZTEST()
Dsettings_test_delete_fcb.c25 zassert_true(rc == 0, "can't register FCB as configuration source"); in ZTEST()
31 "can't register FCB as configuration destination"); in ZTEST()
35 zassert_true(rc == 0, "fcb write error"); in ZTEST()
40 zassert_true(rc == 0, "fcb redout error"); in ZTEST()
47 zassert_true(rc == 0, "fcb redout error"); in ZTEST()
Dsettings_test_save_unaligned.c26 zassert_true(rc == 0, "can't register FCB as configuration source"); in ZTEST()
37 "can't register FCB as configuration destination"); in ZTEST()
41 zassert_true(rc == 0, "fcb write error"); in ZTEST()
46 zassert_true(rc == 0, "fcb redout error"); in ZTEST()
51 zassert_true(rc == 0, "fcb write error"); in ZTEST()
Dsettings_test_save_3_fcb.c33 zassert_true(rc == 0, "can't register FCB as configuration source"); in ZTEST()
37 "can't register FCB as configuration destination"); in ZTEST()
43 zassert_true(rc == 0, "fcb write error"); in ZTEST()
48 zassert_true(rc == 0, "fcb read error"); in ZTEST()

1234