Commit graph

63 commits

Author SHA1 Message Date
Ivan Grokhotkov 1c7508885c components/nvs: fix build, use log library instead of printf 2016-09-23 09:00:28 +08:00
Ivan Grokhotkov 2a68f60874 components/nvs: add erase function
This change exposes functions to erase single key and to erase all keys from namespace.
TW6769, TW6839
2016-09-23 08:08:03 +08:00
Ivan Grokhotkov e87d80d478 components/nvs: fix formatting 2016-09-22 21:05:47 +08:00
Ivan Grokhotkov 076141aab9 components/nvs: batch writes when possible
Introduces new internal function, Page::alterEntryRangeState, which gathers changes to multiple elements of entry state table into a single write, provided that these changes fall into a single word. This allows changing state of up to 16 entries in a single write.
Also adds new function, writeEntryData, which writes the whole payload of SZ and BLOB type entries in one go, instead of splitting it into multiple 32-byte writes.
This reduces number of writes required for SZ and BLOB entries.
2016-09-22 21:05:17 +08:00
Ivan Grokhotkov 12a0786e2a components/nvs: maintain item hash list at page level 2016-09-21 18:02:52 +08:00
Ivan Grokhotkov f06ebeba86 components/nvs: avoid reading just-erased page 2016-09-21 18:02:52 +08:00
Ivan Grokhotkov 9ef827ae20 components/nvs: strlcpy is not available on Linux, replace with strncpy and terminate strings explicitly 2016-08-23 15:14:13 +08:00
Ivan Grokhotkov 7998b6ca2e components/nvs: handle more cases where sudden power off may happen
This commit fixes several issues with state handling in nvs::Page. It also adds extra consistency checks in nvs::PageManger initialization.
These changes were verified with a new long-running test ("test recovery from sudden poweroff"). This test works by repeatedly performing same pseudorandom sequence of calls to nvs_ APIs. Each time it repeats the sequence, it introduces a failure into one of flash operations (write or erase). So if one iteration of this test needs, say, 25000 flash operations, then this test will run 25000 iterations, each time introducing the failure point at different location.
2016-08-23 12:08:00 +08:00
Ivan Grokhotkov 7447d08605 components/nvs: clear handles list on init, fix returning *length in nvs_get_{str,blob} 2016-08-23 12:08:00 +08:00
Ivan Grokhotkov 35d50643bc components/nvs: fix infinite loop when loading namespaces 2016-08-23 12:08:00 +08:00
Ivan Grokhotkov f04c894123 components/nvs: add debugging facilities and runtime checks
Extra runtime sanity checks run when compiled for the host (i.e. with no ESP_PLATFORM define)
2016-08-23 12:08:00 +08:00
Ivan Grokhotkov 3ce433cfd1 components/nvs: make some methods const 2016-08-23 12:08:00 +08:00
Ivan Grokhotkov bd6ea4393c Initial public version 2016-08-17 23:08:22 +08:00