fs/fcb: Enable FCB to work with non-0xff erase value flash
The FCB has been strongly tied to 0xff erased flash devices and this commit adds support for other erase values. Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This commit is contained in:
parent
53fd687344
commit
4832fe43e0
5 changed files with 84 additions and 24 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017 Nordic Semiconductor ASA
|
||||
* Copyright (c) 2017-2020 Nordic Semiconductor ASA
|
||||
* Copyright (c) 2015 Runtime Inc
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
|
@ -86,9 +86,12 @@ struct fcb_entry_ctx {
|
|||
struct fcb {
|
||||
/* Caller of fcb_init fills this in */
|
||||
uint32_t f_magic;
|
||||
/**< Magic value. It is placed in the beginning of FCB flash sector.
|
||||
* FCB uses this when determining whether sector contains valid data
|
||||
* or not.
|
||||
/**< Magic value, should not be 0xFFFFFFFF.
|
||||
* It is xored with inversion of f_erase_value and placed in
|
||||
* the beginning of FCB flash sector. FCB uses this when determining
|
||||
* whether sector contains valid data or not.
|
||||
* Giving it value of 0xFFFFFFFF means leaving bytes of the filed
|
||||
* in "erased" state.
|
||||
*/
|
||||
|
||||
uint8_t f_version; /**< Current version number of the data */
|
||||
|
@ -121,6 +124,11 @@ struct fcb {
|
|||
/**< Flash area used by the fcb instance, , internal state.
|
||||
* This can be transfer to FCB user
|
||||
*/
|
||||
|
||||
uint8_t f_erase_value;
|
||||
/**< The value flash takes when it is erased. This is read from
|
||||
* flash parameters and initialized upon call to fcb_init.
|
||||
*/
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue