/Zephyr-Core-2.7.6/subsys/fs/fcb/ |
D | fcb_priv.h | 28 * Magic, the fcb->f_magic, prior to being written to flash, is xored with 29 * binary inversion of fcb->f_erase_value to avoid it matching a 4 consecutive 34 * @param fcb pointer to initialized fcb structure 38 static inline uint32_t fcb_flash_magic(const struct fcb *fcb) in fcb_flash_magic() argument 40 const uint8_t ev = fcb->f_erase_value; in fcb_flash_magic() 42 return (fcb->f_magic ^ ~MK32(ev)); in fcb_flash_magic() 52 int fcb_put_len(const struct fcb *fcb, uint8_t *buf, uint16_t len); 53 int fcb_get_len(const struct fcb *fcb, uint8_t *buf, uint16_t *len); 55 static inline int fcb_len_in_flash(struct fcb *fcb, uint16_t len) in fcb_len_in_flash() argument 57 if (fcb->f_align <= 1U) { in fcb_len_in_flash() [all …]
|
D | fcb.c | 11 #include <fs/fcb.h> 19 fcb_get_align(const struct fcb *fcb) in fcb_get_align() argument 23 if (fcb->fap == NULL) { in fcb_get_align() 27 align = flash_area_align(fcb->fap); in fcb_get_align() 32 int fcb_flash_read(const struct fcb *fcb, const struct flash_sector *sector, in fcb_flash_read() argument 41 if (fcb->fap == NULL) { in fcb_flash_read() 45 rc = flash_area_read(fcb->fap, sector->fs_off + off, dst, len); in fcb_flash_read() 54 int fcb_flash_write(const struct fcb *fcb, const struct flash_sector *sector, in fcb_flash_write() argument 63 if (fcb->fap == NULL) { in fcb_flash_write() 67 rc = flash_area_write(fcb->fap, sector->fs_off + off, src, len); in fcb_flash_write() [all …]
|
D | fcb_append.c | 11 #include <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 = sizeof(struct fcb_disk_area); in fcb_append_to_scratch() [all …]
|
D | fcb_rotate.c | 8 #include <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 = sizeof(struct fcb_disk_area); in fcb_rotate() 39 fcb->f_active_id++; in fcb_rotate() [all …]
|
D | fcb_getnext.c | 10 #include <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 …]
|
D | fcb_elem_info.c | 10 #include <fs/fcb.h> 18 fcb_elem_crc8(struct fcb *fcb, struct fcb_entry *loc, uint8_t *c8p) in fcb_elem_crc8() argument 32 rc = fcb_flash_read(fcb, loc->fe_sector, loc->fe_elem_off, tmp_str, 2); in fcb_elem_crc8() 37 cnt = fcb_get_len(fcb, tmp_str, &len); in fcb_elem_crc8() 41 loc->fe_data_off = loc->fe_elem_off + fcb_len_in_flash(fcb, cnt); in fcb_elem_crc8() 55 rc = fcb_flash_read(fcb, loc->fe_sector, off, tmp_str, blk_sz); in fcb_elem_crc8() 66 int fcb_elem_info(struct fcb *fcb, struct fcb_entry *loc) in fcb_elem_info() argument 73 rc = fcb_elem_crc8(fcb, loc, &crc8); in fcb_elem_info() 77 off = loc->fe_data_off + fcb_len_in_flash(fcb, loc->fe_data_len); in fcb_elem_info() 79 rc = fcb_flash_read(fcb, loc->fe_sector, off, &fl_crc8, sizeof(fl_crc8)); in fcb_elem_info()
|
D | fcb_walk.c | 8 #include <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()
|
/Zephyr-Core-2.7.6/include/fs/ |
D | fcb.h | 25 * @defgroup fcb Flash Circular Buffer (FCB) 33 * @ingroup fcb 40 * @brief FCB entry info structure. This data structure describes the element 45 * Entry location is pointer to area (within fcb->f_sectors), and offset 58 uint16_t fe_data_len; /**< Size of data area in fcb entry*/ 63 * the fcb flash_area start offset. 65 * @param entry fcb entry structure 70 * @brief Structure for transferring complete information about FCB entry 74 struct fcb_entry loc; /**< FCB entry info */ 80 * @brief FCB instance structure [all …]
|
/Zephyr-Core-2.7.6/tests/subsys/fs/fcb/src/ |
D | fcb_test_init.c | 13 struct fcb *fcb; in test_fcb_init() local 15 fcb = &test_fcb; in test_fcb_init() 16 (void)memset(fcb, 0, sizeof(*fcb)); in test_fcb_init() 17 fcb->f_erase_value = fcb_test_erase_value; in test_fcb_init() 19 rc = fcb_init(TEST_FCB_FLASH_AREA_ID, fcb); in test_fcb_init() 22 fcb->f_sectors = test_fcb_sector; in test_fcb_init() 24 rc = fcb_init(TEST_FCB_FLASH_AREA_ID, fcb); in test_fcb_init() 27 fcb->f_sector_cnt = 2U; in test_fcb_init() 28 fcb->f_magic = 0x12345678; in test_fcb_init() 29 rc = fcb_init(TEST_FCB_FLASH_AREA_ID, fcb); in test_fcb_init() [all …]
|
D | fcb_test_reset.c | 12 struct fcb *fcb; in test_fcb_reset() local 19 fcb = &test_fcb; in test_fcb_reset() 22 rc = fcb_walk(fcb, 0, fcb_test_data_walk_cb, &var_cnt); in test_fcb_reset() 27 rc = fcb_append(fcb, 32, &loc); in test_fcb_reset() 34 rc = fcb_walk(fcb, 0, fcb_test_data_walk_cb, &var_cnt); in test_fcb_reset() 42 rc = flash_area_write(fcb->fap, FCB_ENTRY_FA_DATA_OFF(loc), test_data, in test_fcb_reset() 46 rc = fcb_append_finish(fcb, &loc); in test_fcb_reset() 53 rc = fcb_walk(fcb, 0, fcb_test_data_walk_cb, &var_cnt); in test_fcb_reset() 61 (void)memset(fcb, 0, sizeof(*fcb)); in test_fcb_reset() 62 fcb->f_sector_cnt = 2U; in test_fcb_reset() [all …]
|
D | fcb_test_rotate.c | 12 struct fcb *fcb; in test_fcb_rotate() local 23 fcb = &test_fcb; in test_fcb_rotate() 25 old_id = fcb->f_active_id; in test_fcb_rotate() 26 rc = fcb_rotate(fcb); in test_fcb_rotate() 28 zassert_true(fcb->f_active_id == old_id + 1, in test_fcb_rotate() 35 rc = fcb_append(fcb, sizeof(test_data), &loc); in test_fcb_rotate() 48 rc = flash_area_write(fcb->fap, FCB_ENTRY_FA_DATA_OFF(loc), in test_fcb_rotate() 52 rc = fcb_append_finish(fcb, &loc); in test_fcb_rotate() 58 old_id = fcb->f_active_id; in test_fcb_rotate() 59 rc = fcb_rotate(fcb); in test_fcb_rotate() [all …]
|
D | fcb_test_append_too_big.c | 12 struct fcb *fcb; in test_fcb_append_too_big() local 17 fcb = &test_fcb; in test_fcb_append_too_big() 23 len = fcb->f_active.fe_sector->fs_size; in test_fcb_append_too_big() 25 rc = fcb_append(fcb, len, &elem_loc); in test_fcb_append_too_big() 30 rc = fcb_append(fcb, len, &elem_loc); in test_fcb_append_too_big() 35 rc = fcb_append(fcb, len, &elem_loc); in test_fcb_append_too_big() 39 len = fcb->f_active.fe_sector->fs_size - in test_fcb_append_too_big() 41 rc = fcb_append(fcb, len, &elem_loc); in test_fcb_append_too_big() 44 rc = fcb_append_finish(fcb, &elem_loc); in test_fcb_append_too_big() 47 rc = fcb_elem_info(fcb, &elem_loc); in test_fcb_append_too_big()
|
D | fcb_test_multiple_scratch.c | 12 struct fcb *fcb; in test_fcb_multi_scratch() local 23 fcb = &test_fcb; in test_fcb_multi_scratch() 24 fcb->f_scratch_cnt = 1U; in test_fcb_multi_scratch() 32 rc = fcb_append(fcb, sizeof(test_data), &loc); in test_fcb_multi_scratch() 39 rc = flash_area_write(fcb->fap, FCB_ENTRY_FA_DATA_OFF(loc), in test_fcb_multi_scratch() 43 rc = fcb_append_finish(fcb, &loc); in test_fcb_multi_scratch() 56 rc = fcb_append_to_scratch(fcb); in test_fcb_multi_scratch() 60 rc = fcb_append(fcb, sizeof(test_data), &loc); in test_fcb_multi_scratch() 67 rc = flash_area_write(fcb->fap, FCB_ENTRY_FA_DATA_OFF(loc), in test_fcb_multi_scratch() 71 rc = fcb_append_finish(fcb, &loc); in test_fcb_multi_scratch() [all …]
|
D | fcb_test_last_of_n.c | 13 struct fcb *fcb; in test_fcb_last_of_n() local 20 fcb = &test_fcb; in test_fcb_last_of_n() 21 fcb->f_scratch_cnt = 1U; in test_fcb_last_of_n() 24 rc = fcb_offset_last_n(fcb, 1, &loc); in test_fcb_last_of_n() 31 rc = fcb_append(fcb, sizeof(test_data), &loc); in test_fcb_last_of_n() 36 rc = flash_area_write(fcb->fap, FCB_ENTRY_FA_DATA_OFF(loc), in test_fcb_last_of_n() 40 rc = fcb_append_finish(fcb, &loc); in test_fcb_last_of_n() 47 rc = fcb_offset_last_n(fcb, 1, &loc); in test_fcb_last_of_n() 55 rc = fcb_offset_last_n(fcb, 3, &loc); in test_fcb_last_of_n() 63 rc = fcb_offset_last_n(fcb, 5, &loc); in test_fcb_last_of_n() [all …]
|
D | fcb_test_append.c | 13 struct fcb *fcb; in test_fcb_append() local 20 fcb = &test_fcb; in test_fcb_append() 26 rc = fcb_append(fcb, i, &loc); in test_fcb_append() 28 rc = flash_area_write(fcb->fap, FCB_ENTRY_FA_DATA_OFF(loc), in test_fcb_append() 31 rc = fcb_append_finish(fcb, &loc); in test_fcb_append() 36 rc = fcb_walk(fcb, 0, fcb_test_data_walk_cb, &var_cnt); in test_fcb_append()
|
D | fcb_test_append_fill.c | 12 struct fcb *fcb; in test_fcb_append_fill() local 27 fcb = &test_fcb; in test_fcb_append_fill() 34 rc = fcb_append(fcb, sizeof(test_data), &loc); in test_fcb_append_fill() 47 rc = flash_area_write(fcb->fap, FCB_ENTRY_FA_DATA_OFF(loc), in test_fcb_append_fill() 51 rc = fcb_append_finish(fcb, &loc); in test_fcb_append_fill() 60 rc = fcb_walk(fcb, NULL, fcb_test_cnt_elems_cb, &aa_together); in test_fcb_append_fill() 68 rc = fcb_walk(fcb, &test_fcb_sector[0], fcb_test_cnt_elems_cb, in test_fcb_append_fill() 71 rc = fcb_walk(fcb, &test_fcb_sector[1], fcb_test_cnt_elems_cb, in test_fcb_append_fill()
|
D | fcb_test_empty_walk.c | 13 struct fcb *fcb; in test_fcb_empty_walk() local 15 fcb = &test_fcb; in test_fcb_empty_walk() 17 rc = fcb_walk(fcb, 0, fcb_test_empty_walk_cb, NULL); in test_fcb_empty_walk()
|
D | main.c | 16 struct fcb test_fcb; 19 /* Sectors for FCB are defined far from application code 107 struct fcb *fcb; in fcb_tc_pretest() local 111 fcb = &test_fcb; in fcb_tc_pretest() 112 (void)memset(fcb, 0, sizeof(*fcb)); in fcb_tc_pretest() 113 fcb->f_erase_value = fcb_test_erase_value; in fcb_tc_pretest() 114 fcb->f_sector_cnt = sectors; in fcb_tc_pretest() 115 fcb->f_sectors = test_fcb_sector; /* XXX */ in fcb_tc_pretest() 118 rc = fcb_init(TEST_FCB_FLASH_AREA_ID, fcb); in fcb_tc_pretest()
|
D | fcb_test_len.c | 17 struct fcb fcb = { .f_erase_value = fcb_test_erase_value }; in test_fcb_len() local 20 rc = fcb_put_len(&fcb, buf, len); in test_fcb_len() 23 rc2 = fcb_get_len(&fcb, buf, &len2); in test_fcb_len()
|
/Zephyr-Core-2.7.6/tests/subsys/settings/fcb/src/ |
D | settings_test_save_one_fcb.c | 29 zassert_true(rc == 0, "can't register FCB as configuration source"); in test_config_save_one_fcb() 33 "can't register FCB as configuration destination"); in test_config_save_one_fcb() 37 zassert_true(rc == 0, "fcb write error"); in test_config_save_one_fcb() 40 zassert_true(rc == 0, "fcb one item write error"); in test_config_save_one_fcb() 43 zassert_true(rc == 0, "fcb read error"); in test_config_save_one_fcb() 47 zassert_true(rc == 0, "fcb one item write error"); in test_config_save_one_fcb() 50 zassert_true(rc == 0, "fcb read error"); in test_config_save_one_fcb()
|
D | settings_test_save_1_fcb.c | 23 zassert_true(rc == 0, "can't register FCB as configuration source"); in test_config_save_1_fcb() 29 "can't register FCB as configuration destination"); in test_config_save_1_fcb() 33 zassert_true(rc == 0, "fcb write error"); in test_config_save_1_fcb() 38 zassert_true(rc == 0, "fcb redout error"); in test_config_save_1_fcb() 43 zassert_true(rc == 0, "fcb write error"); in test_config_save_1_fcb()
|
D | settings_test_delete_fcb.c | 22 zassert_true(rc == 0, "can't register FCB as configuration source"); in test_config_delete_fcb() 28 "can't register FCB as configuration destination"); in test_config_delete_fcb() 32 zassert_true(rc == 0, "fcb write error"); in test_config_delete_fcb() 37 zassert_true(rc == 0, "fcb redout error"); in test_config_delete_fcb() 44 zassert_true(rc == 0, "fcb redout error"); in test_config_delete_fcb()
|
D | settings_test_save_unaligned.c | 23 zassert_true(rc == 0, "can't register FCB as configuration source"); in test_config_save_fcb_unaligned() 34 "can't register FCB as configuration destination"); in test_config_save_fcb_unaligned() 38 zassert_true(rc == 0, "fcb write error"); in test_config_save_fcb_unaligned() 43 zassert_true(rc == 0, "fcb redout error"); in test_config_save_fcb_unaligned() 48 zassert_true(rc == 0, "fcb write error"); in test_config_save_fcb_unaligned()
|
D | settings_test_save_2_fcb.c | 31 zassert_true(rc == 0, "can't register FCB as configuration source"); in test_config_save_2_fcb() 35 "can't register FCB as configuration destination"); in test_config_save_2_fcb() 42 zassert_true(rc == 0, "fcb write error"); in test_config_save_2_fcb() 47 zassert_true(rc == 0, "fcb read error"); in test_config_save_2_fcb() 64 zassert_true(rc == 0, "fcb write error"); in test_config_save_2_fcb() 70 zassert_true(rc == 0, "fcb read error"); in test_config_save_2_fcb()
|
/Zephyr-Core-2.7.6/subsys/settings/ |
D | Kconfig | 39 default SETTINGS_FCB if FCB 47 bool "FCB" 48 depends on FCB 50 Use FCB as a settings storage back-end. 82 Number of areas to allocate in the settings FCB. A smaller number is 86 hex "FCB magic for the settings subsystem"
|