Lines Matching full:fcb

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()
55 fcb->f_active_id++; in fcb_append_to_scratch()
60 fcb_append(struct fcb *fcb, uint16_t len, struct fcb_entry *append_loc) in fcb_append() argument
68 cnt = fcb_put_len(fcb, tmp_str, len); in fcb_append()
72 cnt = fcb_len_in_flash(fcb, cnt); in fcb_append()
73 len = fcb_len_in_flash(fcb, len) + fcb_len_in_flash(fcb, FCB_CRC_SZ); in fcb_append()
77 rc = k_mutex_lock(&fcb->f_mtx, K_FOREVER); in fcb_append()
81 active = &fcb->f_active; in fcb_append()
83 sector = fcb_new_sector(fcb, fcb->f_scratch_cnt); in fcb_append()
89 rc = fcb_sector_hdr_init(fcb, sector, fcb->f_active_id + 1); in fcb_append()
93 fcb->f_active.fe_sector = sector; in fcb_append()
94 fcb->f_active.fe_elem_off = sizeof(struct fcb_disk_area); in fcb_append()
95 fcb->f_active_id++; in fcb_append()
98 rc = fcb_flash_write(fcb, active->fe_sector, active->fe_elem_off, tmp_str, cnt); in fcb_append()
109 k_mutex_unlock(&fcb->f_mtx); in fcb_append()
113 k_mutex_unlock(&fcb->f_mtx); in fcb_append()
118 fcb_append_finish(struct fcb *fcb, struct fcb_entry *loc) in fcb_append_finish() argument
121 uint8_t crc8[fcb->f_align]; in fcb_append_finish()
126 rc = fcb_elem_crc8(fcb, loc, &crc8[0]); in fcb_append_finish()
130 off = loc->fe_data_off + fcb_len_in_flash(fcb, loc->fe_data_len); in fcb_append_finish()
132 rc = fcb_flash_write(fcb, loc->fe_sector, off, crc8, fcb->f_align); in fcb_append_finish()