├── .cyignore ├── EULA ├── LICENSE ├── README.md ├── RELEASE.md ├── docs ├── api_reference_manual.html └── html │ ├── bc_s.png │ ├── bdwn.png │ ├── closed.png │ ├── doc.png │ ├── doxygen.svg │ ├── doxygen_style.css │ ├── dynsections.js │ ├── folderclosed.png │ ├── folderopen.png │ ├── group__group__kvstore.html │ ├── group__group__kvstore.js │ ├── index.html │ ├── jquery.js │ ├── logo.png │ ├── menu.js │ ├── menudata.js │ ├── modules.html │ ├── modules.js │ ├── nav_f.png │ ├── nav_g.png │ ├── nav_h.png │ ├── navtree.css │ ├── navtree.js │ ├── navtreedata.js │ ├── navtreeindex0.js │ ├── open.png │ ├── resize.js │ ├── search │ ├── all_0.html │ ├── all_0.js │ ├── all_1.html │ ├── all_1.js │ ├── close.svg │ ├── functions_0.html │ ├── functions_0.js │ ├── groups_0.html │ ├── groups_0.js │ ├── mag_sel.svg │ ├── nomatches.html │ ├── pages_0.html │ ├── pages_0.js │ ├── search.css │ ├── search.js │ ├── search_l.png │ ├── search_m.png │ ├── search_r.png │ ├── searchdata.js │ ├── typedefs_0.html │ └── typedefs_0.js │ ├── splitbar.png │ ├── sync_off.png │ ├── sync_on.png │ ├── tab_a.png │ ├── tab_b.png │ ├── tab_h.png │ ├── tab_s.png │ └── tabs.css ├── include └── mtb_kvstore.h ├── props.json └── source └── mtb_kvstore.c /.cyignore: -------------------------------------------------------------------------------- 1 | docs 2 | -------------------------------------------------------------------------------- /EULA: -------------------------------------------------------------------------------- 1 | CYPRESS (AN INFINEON COMPANY) END USER LICENSE AGREEMENT 2 | 3 | PLEASE READ THIS END USER LICENSE AGREEMENT ("Agreement") CAREFULLY BEFORE 4 | DOWNLOADING, INSTALLING, COPYING, OR USING THIS SOFTWARE AND ACCOMPANYING 5 | DOCUMENTATION. BY DOWNLOADING, INSTALLING, COPYING OR USING THE SOFTWARE, 6 | YOU ARE AGREEING TO BE BOUND BY THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL 7 | OF THE TERMS OF THIS AGREEMENT, PROMPTLY RETURN AND DO NOT USE THE SOFTWARE. 8 | IF YOU HAVE PURCHASED THIS LICENSE TO THE SOFTWARE, YOUR RIGHT TO RETURN THE 9 | SOFTWARE EXPIRES 30 DAYS AFTER YOUR PURCHASE AND APPLIES ONLY TO THE ORIGINAL 10 | PURCHASER. 11 | 12 | 1. Definitions. 13 | 14 | "Software" means this software and any accompanying documentation, 15 | including any upgrades, updates, bug fixes or modified versions provided 16 | to you by Cypress. 17 | 18 | "Source Code" means software in human-readable form. 19 | 20 | "Binary Code" means the software in binary code form such as object code or 21 | an executable. 22 | 23 | "Development Tools" means software that is intended to be installed on a 24 | personal computer and used to create programming code for Firmware, 25 | Drivers, or Host Applications. Examples of Development Tools are 26 | Cypress's PSoC Creator software, Cypress's AIROC SDKs, and Cypress's 27 | ModusToolbox software. 28 | 29 | "Firmware" means software that executes on a Cypress hardware product. 30 | 31 | "Driver" means software that enables the use of a Cypress hardware product 32 | on a particular host operating system such as GNU/Linux, Windows, MacOS, 33 | Android, and iOS. 34 | 35 | "Host Application" means software that executes on a device other than a 36 | Cypress hardware product in order to program, control, or communicate 37 | with a Cypress hardware product. 38 | 39 | "inf File" means a hardware setup information file (.inf file) created by 40 | the Software to allow a Microsoft Windows operating system to install 41 | the driver for a Cypress hardware product. 42 | 43 | 2. License. Subject to the terms and conditions of this Agreement, Cypress 44 | Semiconductor Corporation ("Cypress") and its suppliers grant to you a 45 | non-exclusive, non-transferable license under their copyright rights: 46 | 47 | a. to use the Development Tools in object code form solely for the purpose 48 | of creating Firmware, Drivers, Host Applications, and inf Files for 49 | Cypress hardware products; and 50 | 51 | b. (i) if provided in Source Code form, to copy, modify, and compile the 52 | Firmware Source Code to create Firmware for execution on a Cypress 53 | hardware product, and 54 | (ii) to distribute Firmware in binary code form only, only when 55 | installed onto a Cypress hardware product; and 56 | 57 | c. (i) if provided in Source Code form, to copy, modify, and compile the 58 | Driver Source Code to create one or more Drivers to enable the use 59 | of a Cypress hardware product on a particular host operating 60 | system, and 61 | (ii) to distribute the Driver, in binary code form only, only when 62 | installed on a device that includes the Cypress hardware product 63 | that the Driver is intended to enable; and 64 | 65 | d. (i) if provided in Source Code form, to copy, modify, and compile the 66 | Host Application Source Code to create one or more Host 67 | Applications to program, control, or communicate with a Cypress 68 | hardware product, and 69 | (ii) to distribute Host Applications, in binary code form only, only 70 | when installed on a device that includes a Cypress hardware product 71 | that the Host Application is intended to program, control, or 72 | communicate with; and 73 | 74 | e. to freely distribute any inf File. 75 | 76 | Any distribution of Software permitted under this Agreement must be made 77 | pursuant to your standard end user license agreement used for your proprietary 78 | (closed source) software products, such end user license agreement to include, 79 | at a minimum, provisions limiting your licensors' liability and prohibiting 80 | reverse engineering of the Software, consistent with such provisions in this 81 | Agreement. 82 | 83 | 3. Free and Open Source Software. Portions of the Software may be licensed 84 | under free and/or open source licenses such as the GNU General Public License 85 | or other licenses from third parties ("Third Party Software"). Third Party 86 | Software is subject to the applicable license agreement and not this 87 | Agreement. If you are entitled to receive the source code from Cypress for 88 | any Third Party Software included with the Software, either the source code 89 | will be included with the Software or you may obtain the source code at no 90 | charge from 91 | . 92 | The applicable license terms will accompany each source code package. To 93 | review the license terms applicable to any Third Party Software for which 94 | Cypress is not required to provide you with source code, please see the 95 | Software's installation directory on your computer. 96 | 97 | 4. Proprietary Rights; Ownership. The Software, including all intellectual 98 | property rights therein, is and will remain the sole and exclusive property of 99 | Cypress or its suppliers. Cypress retains ownership of the Source Code and 100 | any compiled version thereof. Subject to Cypress' ownership of the underlying 101 | Software (including Source Code), you retain ownership of any modifications 102 | you make to the Source Code. You agree not to remove any Cypress copyright or 103 | other notices from the Source Code and any modifications thereof. You agree 104 | to keep the Source Code confidential. Any reproduction, modification, 105 | translation, compilation, or representation of the Source Code except as 106 | permitted in Section 2 ("License") is prohibited without the express written 107 | permission of Cypress. Except as otherwise expressly provided in this 108 | Agreement, you may not: 109 | (i) modify, adapt, or create derivative works based upon the Software; 110 | (ii) copy the Software; 111 | (iii) except and only to the extent explicitly permitted by applicable 112 | law despite this limitation, decompile, translate, reverse engineer, 113 | disassemble or otherwise reduce the Software to human-readable form; 114 | or 115 | (iv) use the Software or any sample code other than for the Purpose. 116 | You hereby covenant that you will not assert any claim that the Software, or 117 | derivative works thereof created by or for Cypress, infringe any intellectual 118 | property right owned or controlled by you 119 | 120 | 5. No Support. Cypress may, but is not required to, provide technical support 121 | for the Software. 122 | 123 | 6. Term and Termination. This Agreement is effective until terminated, and 124 | either party may terminate this Agreement at any time with or without cause. 125 | This Agreement and your license rights under this Agreement will terminate 126 | immediately without notice from Cypress if you fail to comply with any 127 | provision of this Agreement. Upon termination, you must destroy all copies of 128 | Software in your possession or control. The following paragraphs shall 129 | survive any termination of this Agreement: "Free and Open Source Software," 130 | "Proprietary Rights; Ownership," "Compliance With Law," "Disclaimer," 131 | "Limitation of Liability," and "General." 132 | 133 | 7. Compliance With Law. Each party agrees to comply with all applicable laws, 134 | rules and regulations in connection with its activities under this Agreement. 135 | Without limiting the foregoing, the Software may be subject to export control 136 | laws and regulations of the United States and other countries. You agree to 137 | comply strictly with all such laws and regulations and acknowledge that you 138 | have the responsibility to obtain licenses to export, re-export, or import the 139 | Software. 140 | 141 | 8. Disclaimer. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS 142 | MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THE 143 | SOFTWARE, INCLUDING, BUT NOT LIMITED TO, INFRINGEMENT AND THE IMPLIED 144 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Cypress 145 | reserves the right to make changes to the Software without notice. Cypress 146 | does not assume any liability arising out of the application or use of 147 | Software or any product or circuit described in the Software. It is the 148 | responsibility of the user of the Software to properly design, program, and 149 | test the functionality and safety of any application made of the Software and 150 | any resulting product. Cypress does not authorize its Software or products 151 | for use in any products where a malfunction or failure of the Software or 152 | Cypress product may reasonably be expected to result in significant property 153 | damage, injury or death ("High Risk Product"). If you include any Software or 154 | Cypress product in a High Risk Product, you assume all risk of such use and 155 | agree to indemnify Cypress and its suppliers against all liability. No 156 | computing device can be absolutely secure. Therefore, despite security 157 | measures implemented in Cypress hardware or software products, Cypress does 158 | not assume any liability arising out of any security breach, such as 159 | unauthorized access to or use of a Cypress product. 160 | 161 | 9. Limitation of Liability. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE 162 | LAW, IN NO EVENT WILL CYPRESS OR ITS SUPPLIERS, RESELLERS, OR DISTRIBUTORS BE 163 | LIABLE FOR ANY LOST REVENUE, PROFIT, OR DATA, OR FOR SPECIAL, INDIRECT, 164 | CONSEQUENTIAL, INCIDENTAL, OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS 165 | OF THE THEORY OF LIABILITY, ARISING OUT OF OR RELATED TO THE USE OF OR 166 | INABILITY TO USE THE SOFTWARE EVEN IF CYPRESS OR ITS SUPPLIERS, RESELLERS, OR 167 | DISTRIBUTORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO 168 | EVENT SHALL CYPRESS' OR ITS SUPPLIERS', RESELLERS', OR DISTRIBUTORS' TOTAL 169 | LIABILITY TO YOU, WHETHER IN CONTRACT, TORT (INCLUDING NEGLIGENCE), OR 170 | OTHERWISE, EXCEED THE GREATER OF US$500 OR THE PRICE PAID BY YOU FOR THE 171 | SOFTWARE. THE FOREGOING LIMITATIONS SHALL APPLY EVEN IF THE ABOVE-STATED 172 | WARRANTY FAILS OF ITS ESSENTIAL PURPOSE. BECAUSE SOME STATES OR JURISDICTIONS 173 | DO NOT ALLOW LIMITATION OR EXCLUSION OF CONSEQUENTIAL OR INCIDENTAL DAMAGES, 174 | ALL OR PORTIONS OF THE ABOVE LIMITATION MAY NOT APPLY TO YOU. 175 | 176 | 10. Restricted Rights. The Software is commercial computer software as that 177 | term is described in 48 C.F.R. 252.227-7014(a)(1). If the Software is being 178 | acquired by or on behalf of the U.S. Government or by a U.S. Government prime 179 | contractor or subcontractor (at any tier), then the Government's rights in 180 | Software shall be only those set forth in this Agreement. 181 | 182 | 11. Personal Information. You agree that information you provide through your 183 | registration on Cypress IoT Community Forum or other Cypress websites, 184 | including contact information or other personal information, may be collected 185 | and used by Cypress consistent with its Data Privacy Policy 186 | (https://www.infineon.com/cms/en/about-infineon/privacy-policy/), as updated 187 | or revised from time to time, and may be provided to its third party sales 188 | representatives, distributors and other entities conducting sales activities 189 | for Cypress for sales-related and other business purposes. 190 | 191 | 12. General. This Agreement will bind and inure to the benefit of each 192 | party's successors and assigns, provided that you may not assign or transfer 193 | this Agreement, in whole or in part, without Cypress' written consent. This 194 | Agreement shall be governed by and construed in accordance with the laws of 195 | the State of California, United States of America, as if performed wholly 196 | within the state and without giving effect to the principles of conflict of 197 | law. The parties consent to personal and exclusive jurisdiction of and venue 198 | in, the state and federal courts within Santa Clara County, California; 199 | provided however, that nothing in this Agreement will limit Cypress' right to 200 | bring legal action in any venue in order to protect or enforce its 201 | intellectual property rights. No failure of either party to exercise or 202 | enforce any of its rights under this Agreement will act as a waiver of such 203 | rights. If any portion of this Agreement is found to be void or 204 | unenforceable, the remaining provisions of this Agreement shall remain in full 205 | force and effect. This Agreement is the complete and exclusive agreement 206 | between the parties with respect to the subject matter hereof, superseding and 207 | replacing any and all prior agreements, communications, and understandings 208 | (both written and oral) regarding such subject matter. Any notice to Cypress 209 | will be deemed effective when actually received and must be sent to Cypress 210 | Semiconductor Corporation, ATTN: Chief Legal Officer, 198 Champion Court, San 211 | Jose, CA 95134 USA. 212 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, and 10 | distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by the copyright 13 | owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all other entities 16 | that control, are controlled by, or are under common control with that entity. 17 | For the purposes of this definition, "control" means (i) the power, direct or 18 | indirect, to cause the direction or management of such entity, whether by 19 | contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the 20 | outstanding shares, or (iii) beneficial ownership of such entity. 21 | 22 | "You" (or "Your") shall mean an individual or Legal Entity exercising 23 | permissions granted by this License. 24 | 25 | "Source" form shall mean the preferred form for making modifications, including 26 | but not limited to software source code, documentation source, and configuration 27 | files. 28 | 29 | "Object" form shall mean any form resulting from mechanical transformation or 30 | translation of a Source form, including but not limited to compiled object code, 31 | generated documentation, and conversions to other media types. 32 | 33 | "Work" shall mean the work of authorship, whether in Source or Object form, made 34 | available under the License, as indicated by a copyright notice that is included 35 | in or attached to the work (an example is provided in the Appendix below). 36 | 37 | "Derivative Works" shall mean any work, whether in Source or Object form, that 38 | is based on (or derived from) the Work and for which the editorial revisions, 39 | annotations, elaborations, or other modifications represent, as a whole, an 40 | original work of authorship. For the purposes of this License, Derivative Works 41 | shall not include works that remain separable from, or merely link (or bind by 42 | name) to the interfaces of, the Work and Derivative Works thereof. 43 | 44 | "Contribution" shall mean any work of authorship, including the original version 45 | of the Work and any modifications or additions to that Work or Derivative Works 46 | thereof, that is intentionally submitted to Licensor for inclusion in the Work 47 | by the copyright owner or by an individual or Legal Entity authorized to submit 48 | on behalf of the copyright owner. For the purposes of this definition, 49 | "submitted" means any form of electronic, verbal, or written communication sent 50 | to the Licensor or its representatives, including but not limited to 51 | communication on electronic mailing lists, source code control systems, and 52 | issue tracking systems that are managed by, or on behalf of, the Licensor for 53 | the purpose of discussing and improving the Work, but excluding communication 54 | that is conspicuously marked or otherwise designated in writing by the copyright 55 | owner as "Not a Contribution." 56 | 57 | "Contributor" shall mean Licensor and any individual or Legal Entity on behalf 58 | of whom a Contribution has been received by Licensor and subsequently 59 | incorporated within the Work. 60 | 61 | 2. Grant of Copyright License. 62 | 63 | Subject to the terms and conditions of this License, each Contributor hereby 64 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 65 | irrevocable copyright license to reproduce, prepare Derivative Works of, 66 | publicly display, publicly perform, sublicense, and distribute the Work and such 67 | Derivative Works in Source or Object form. 68 | 69 | 3. Grant of Patent License. 70 | 71 | Subject to the terms and conditions of this License, each Contributor hereby 72 | grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, 73 | irrevocable (except as stated in this section) patent license to make, have 74 | made, use, offer to sell, sell, import, and otherwise transfer the Work, where 75 | such license applies only to those patent claims licensable by such Contributor 76 | that are necessarily infringed by their Contribution(s) alone or by combination 77 | of their Contribution(s) with the Work to which such Contribution(s) was 78 | submitted. If You institute patent litigation against any entity (including a 79 | cross-claim or counterclaim in a lawsuit) alleging that the Work or a 80 | Contribution incorporated within the Work constitutes direct or contributory 81 | patent infringement, then any patent licenses granted to You under this License 82 | for that Work shall terminate as of the date such litigation is filed. 83 | 84 | 4. Redistribution. 85 | 86 | You may reproduce and distribute copies of the Work or Derivative Works thereof 87 | in any medium, with or without modifications, and in Source or Object form, 88 | provided that You meet the following conditions: 89 | 90 | You must give any other recipients of the Work or Derivative Works a copy of 91 | this License; and 92 | You must cause any modified files to carry prominent notices stating that You 93 | changed the files; and 94 | You must retain, in the Source form of any Derivative Works that You distribute, 95 | all copyright, patent, trademark, and attribution notices from the Source form 96 | of the Work, excluding those notices that do not pertain to any part of the 97 | Derivative Works; and 98 | If the Work includes a "NOTICE" text file as part of its distribution, then any 99 | Derivative Works that You distribute must include a readable copy of the 100 | attribution notices contained within such NOTICE file, excluding those notices 101 | that do not pertain to any part of the Derivative Works, in at least one of the 102 | following places: within a NOTICE text file distributed as part of the 103 | Derivative Works; within the Source form or documentation, if provided along 104 | with the Derivative Works; or, within a display generated by the Derivative 105 | Works, if and wherever such third-party notices normally appear. The contents of 106 | the NOTICE file are for informational purposes only and do not modify the 107 | License. You may add Your own attribution notices within Derivative Works that 108 | You distribute, alongside or as an addendum to the NOTICE text from the Work, 109 | provided that such additional attribution notices cannot be construed as 110 | modifying the License. 111 | You may add Your own copyright statement to Your modifications and may provide 112 | additional or different license terms and conditions for use, reproduction, or 113 | distribution of Your modifications, or for any such Derivative Works as a whole, 114 | provided Your use, reproduction, and distribution of the Work otherwise complies 115 | with the conditions stated in this License. 116 | 117 | 5. Submission of Contributions. 118 | 119 | Unless You explicitly state otherwise, any Contribution intentionally submitted 120 | for inclusion in the Work by You to the Licensor shall be under the terms and 121 | conditions of this License, without any additional terms or conditions. 122 | Notwithstanding the above, nothing herein shall supersede or modify the terms of 123 | any separate license agreement you may have executed with Licensor regarding 124 | such Contributions. 125 | 126 | 6. Trademarks. 127 | 128 | This License does not grant permission to use the trade names, trademarks, 129 | service marks, or product names of the Licensor, except as required for 130 | reasonable and customary use in describing the origin of the Work and 131 | reproducing the content of the NOTICE file. 132 | 133 | 7. Disclaimer of Warranty. 134 | 135 | Unless required by applicable law or agreed to in writing, Licensor provides the 136 | Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, 137 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, 138 | including, without limitation, any warranties or conditions of TITLE, 139 | NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are 140 | solely responsible for determining the appropriateness of using or 141 | redistributing the Work and assume any risks associated with Your exercise of 142 | permissions under this License. 143 | 144 | 8. Limitation of Liability. 145 | 146 | In no event and under no legal theory, whether in tort (including negligence), 147 | contract, or otherwise, unless required by applicable law (such as deliberate 148 | and grossly negligent acts) or agreed to in writing, shall any Contributor be 149 | liable to You for damages, including any direct, indirect, special, incidental, 150 | or consequential damages of any character arising as a result of this License or 151 | out of the use or inability to use the Work (including but not limited to 152 | damages for loss of goodwill, work stoppage, computer failure or malfunction, or 153 | any and all other commercial damages or losses), even if such Contributor has 154 | been advised of the possibility of such damages. 155 | 156 | 9. Accepting Warranty or Additional Liability. 157 | 158 | While redistributing the Work or Derivative Works thereof, You may choose to 159 | offer, and charge a fee for, acceptance of support, warranty, indemnity, or 160 | other liability obligations and/or rights consistent with this License. However, 161 | in accepting such obligations, You may act only on Your own behalf and on Your 162 | sole responsibility, not on behalf of any other Contributor, and only if You 163 | agree to indemnify, defend, and hold each Contributor harmless for any liability 164 | incurred by, or claims asserted against, such Contributor by reason of your 165 | accepting any such warranty or additional liability. 166 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Key Value Storage Library 2 | 3 | ## Overview 4 | This library provides a convenient way to store information as key-value pairs in non-volatile storage. 5 | 6 | ## Features 7 | * Supports any storage which can be modeled as a block device, including internal flash or external flash 8 | (e.g. via QSPI). 9 | * Allows partitioning storage by instantiating multiple instances of the library. 10 | * Designed to be resilient to power failures. 11 | * Designed to promote even wear of the storage. 12 | 13 | ## Storage 14 | The utility operates on the assumption that the underlying storage is a block device which may not 15 | have the same program and erase sizes. The application is required to initialize and create the block 16 | storage interface(`mtb_block_storage_t`). 17 | 18 | ## Keys and Values 19 | ### Keys 20 | Keys are ASCII strings (Null terminated). The maximum key length is defined by `MTB_KVSTORE_MAX_KEY_SIZE`. 21 | This can be overridden by the application by adding `DEFINES+=MTB_KVSTORE_MAX_KEY_SIZE=` with the 22 | desired value to application Makefile. 23 | 24 | ### Values 25 | Values are arbitrary length binary data. By default it is assumed that each value (plus the header info of 26 | ~20 bytes) is less than the `mtb_block_storage_t` `erase_size`. If this is not true, a define 27 | `MTB_KVSTORE_MAX_VALUE_SIZE` must be defined with the actual max value size. 28 | NOTE: This define is not currently used, but will be in a future update. Setting it now will help ensure 29 | the application works properly with newer versions of the kv-store library. 30 | 31 | ## RTOS Integration 32 | In an RTOS environment, the library can be made thread safe by adding the `RTOS_AWARE` component 33 | (COMPONENTS+=RTOS_AWARE) or by defining the `CY_RTOS_AWARE` macro (DEFINES+=CY_RTOS_AWARE). This 34 | causes all API to be protected by a mutex to serialize access to underlying storage device. The 35 | kvstore library must be initialized after the RTOS kernel has started for the mutex to be initialized 36 | safely. The default timeout for the mutex is defined by `MTB_KVSTORE_MUTEX_TIMEOUT_MS` and can be 37 | overridden by specifying `DEFINES+=MTB_KVSTORE_MUTEX_TIMEOUT_MS=` with the application Makefile. 38 | 39 | When determining a suitable timeout, consider that the execution time for KVStore modifying operations 40 | is impacted by several factors: 41 | * The size of the key and value being written 42 | * If garbage collection is required (see "Garbage collection" section for details) to complete a 43 | modification, this operation must erase half of the storage which was provided for kv-store to use. 44 | This is a potentially lengthy operation. The `mtb_kvstore_ensure_capacity` function can be used to 45 | trigger garbage collection, if necessary, in less timing sensitive contexts. 46 | * All operations are impacted by the write performance of the underlying storage device. For more 47 | details, see the datasheet of the selected MCU (for internal flash) or the external memory device. 48 | 49 | ## Design details 50 | ### Sequential log of records 51 | The key-value pairs are stored sequentially as records. Each operation appends a new record to the next 52 | available program block. If multiple records exist for the same key, the record at the highest address takes 53 | precedence over those that came before it. In an update operation, a new record with the key and updated value 54 | is appended, overriding the previous value. In a delete operation, a new record with the key and a "deleted" 55 | flag is appended. 56 | 57 | ### Memory Layout 58 | The address space provided by the application is divided into two areas. At any given time, one area is 59 | designated as active and the other as swap. All key/value pair records are stored in the active area. 60 | Each time garbage collection is performed, the active and swap area designations are reversed. 61 | The first record in the active area is an area header used to identify the current active area during 62 | initialization. This means that one half of the provided storage space is available for key value storage. 63 | ``` 64 | active area swap area 65 | +-----------------------------+ +-----------------------------+ 66 | | area header record | | | 67 | +-----------------------------+ | | 68 | | key value record 1 | | | 69 | +-----------------------------+ | | 70 | | key value record 2 | | | 71 | | | | | 72 | +-----------------------------+ | | 73 | | key value record 3 | | | 74 | +-----------------------------+ | | 75 | | free space | | | 76 | | | | | 77 | +-----------------------------+ +-----------------------------+ 78 | ``` 79 | 80 | ### Record 81 | Each record contains a record header (`_mtb_kvstore_record_header_t`) that contains metadata including 82 | key/value sizes and a CRC. This is followed by the key and value data. The record is padded to the program 83 | size. 84 | 85 | ``` 86 | +---------------------+-------------------------+--------------------------------+---------------+ 87 | | Record Header | Key | Data | prog size pad | 88 | +---------------------+-------------------------+--------------------------------+---------------+ 89 | ``` 90 | 91 | ### RAM table 92 | A table that contains a hash for every key and the corresponding offset of the latest record for that key 93 | in storage is maintained in RAM. This table is built from storage during initialization and is updated on 94 | every subsequent operation. The key is verified by matching the key in the record in the storage. If it does 95 | not match the next entry with the same hash in the RAM table is checked. This allows for the possibility that 96 | multiple distinct keys may hash to the same value. 97 | 98 | ### Garbage collection 99 | The garbage collection operation copies all of the non-obsolete records (i.e. all of those listed in 100 | the RAM table) into the swap area. The swap area is then marked as the new active area by programming 101 | the area header at the start. The former active area is erased and becomes the new swap area. Garbage 102 | collection is performed in the following scenarios: 103 | * The active area does not have sufficient space remaining to perform a requested modification (add, 104 | update, delete) and the active area contains obsolete records. 105 | * A corrupted record is encountered during initialization. This may happen if a power failure 106 | occurs while the a record is being appended during a modifying operation. The garbage collection 107 | operation will copy all non-obsolete records preceding the corrupted record. 108 | * The `mtb_kvstore_ensure_capacity` function is called and the active area does not contain the 109 | requested amount of space available for immediate usage. 110 | 111 | **NOTE:** 112 | Due to the garbage collection operation, write and delete operations may consume significantly more time than 113 | typical when the active area becomes full. Hence, they must not be called from timing critical code. 114 | 115 | ## Dependencies 116 | * [abstraction-rtos](https://github.com/infineon/abstraction-rtos) library if the `CY_RTOS_AWARE` 117 | macro is defined in the Makefile 118 | * [block-storage](https://github.com/infineon/block-storage) library 119 | 120 | ## More information 121 | * [API Reference Guide](https://infineon.github.io/kv-store/html/modules.html) 122 | * [Cypress Semiconductor, an Infineon Technologies Company](http://www.cypress.com) 123 | * [Infineon GitHub](https://github.com/infineon) 124 | * [ModusToolbox™](https://www.cypress.com/products/modustoolbox-software-environment) 125 | 126 | --- 127 | © Cypress Semiconductor Corporation (an Infineon company) or an affiliate of Cypress Semiconductor Corporation, 2021. 128 | -------------------------------------------------------------------------------- /RELEASE.md: -------------------------------------------------------------------------------- 1 | # Key Value Storage Library Release Notes 2 | The key value storage library provides an API enabling use of non-volatile storage to store data in key-value pairs. 3 | 4 | ### What's Included? 5 | APIs for storing key-value pairs of data in non-volatile storage. 6 | 7 | ### What Changed? 8 | #### v2.0.0 9 | * Replace the kv-store specific block device interface with the standard mtb-block-storage interface 10 | * Add ability to override the default `malloc` and `free` functions for custom dynamic memory allocation 11 | #### v1.1.1 12 | * Fixed NULL dereference in mtb_kvstore_read function when checking if key exists in storage by passing NULL into both _data_ and _size_ parameters 13 | #### v1.1.0 14 | * Added new function: mtb_kvstore_ensure_capacity 15 | * Added new cy_rslt_t return type: MTB_KVSTORE_BUFFER_TOO_SMALL 16 | * New partial read funtion: can read _size_ number of bytes starting from _offset bytes_ into the value 17 | * Read functions set unused read buffer space to 0's 18 | * New key exists and value size functions 19 | #### v1.0.1 20 | * Fixed issue with RTOS_AWARE component not being handled in one case 21 | * Minor documentation updates 22 | #### v1.0.0 23 | * Initial release 24 | 25 | ### Supported Software and Tools 26 | This version of the Key Value Storage Library was validated for compatibility with the following Software and Tools: 27 | 28 | | Software and Tools | Version | 29 | | :--- | :----: | 30 | | ModusToolbox™ Software Environment | 2.4.0 | 31 | | GCC Compiler | 10.3.1 | 32 | | IAR Compiler | 9.40.2 | 33 | | ARM Compiler | 6.11 | 34 | 35 | Minimum required ModusToolbox™ Software Environment: v2.0 36 | 37 | ### More information 38 | Use the following links for more information, as needed: 39 | * [API Reference Guide](https://infineon.github.io/kv-store/html/modules.html) 40 | * [Cypress Semiconductor, an Infineon Technologies Company](http://www.cypress.com) 41 | * [Infineon GitHub](https://github.com/infineon) 42 | * [ModusToolbox™](https://www.cypress.com/products/modustoolbox-software-environment) 43 | 44 | --- 45 | © Cypress Semiconductor Corporation (an Infineon company) or an affiliate of Cypress Semiconductor Corporation, 2021-2023. 46 | -------------------------------------------------------------------------------- /docs/api_reference_manual.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Redirect to API Reference Manual main page after 0 seconds 5 | 8 | 9 | 10 | 11 |

12 | If the automatic redirection is failing, click the following link to open API Reference Manual. 13 |

14 | 15 | -------------------------------------------------------------------------------- /docs/html/bc_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/kv-store/4d683fc825313bcbf0fa158b2da6bf842420c5e2/docs/html/bc_s.png -------------------------------------------------------------------------------- /docs/html/bdwn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/kv-store/4d683fc825313bcbf0fa158b2da6bf842420c5e2/docs/html/bdwn.png -------------------------------------------------------------------------------- /docs/html/closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/kv-store/4d683fc825313bcbf0fa158b2da6bf842420c5e2/docs/html/closed.png -------------------------------------------------------------------------------- /docs/html/doc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/kv-store/4d683fc825313bcbf0fa158b2da6bf842420c5e2/docs/html/doc.png -------------------------------------------------------------------------------- /docs/html/doxygen.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /docs/html/dynsections.js: -------------------------------------------------------------------------------- 1 | /* 2 | @licstart The following is the entire license notice for the JavaScript code in this file. 3 | 4 | The MIT License (MIT) 5 | 6 | Copyright (C) 1997-2020 by Dimitri van Heesch 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 9 | and associated documentation files (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, publish, distribute, 11 | sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all copies or 15 | substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 18 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 20 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | @licend The above is the entire license notice for the JavaScript code in this file 24 | */ 25 | function toggleVisibility(linkObj) 26 | { 27 | var base = $(linkObj).attr('id'); 28 | var summary = $('#'+base+'-summary'); 29 | var content = $('#'+base+'-content'); 30 | var trigger = $('#'+base+'-trigger'); 31 | var src=$(trigger).attr('src'); 32 | if (content.is(':visible')===true) { 33 | content.hide(); 34 | summary.show(); 35 | $(linkObj).addClass('closed').removeClass('opened'); 36 | $(trigger).attr('src',src.substring(0,src.length-8)+'closed.png'); 37 | } else { 38 | content.show(); 39 | summary.hide(); 40 | $(linkObj).removeClass('closed').addClass('opened'); 41 | $(trigger).attr('src',src.substring(0,src.length-10)+'open.png'); 42 | } 43 | return false; 44 | } 45 | 46 | function updateStripes() 47 | { 48 | $('table.directory tr'). 49 | removeClass('even').filter(':visible:even').addClass('even'); 50 | } 51 | 52 | function toggleLevel(level) 53 | { 54 | $('table.directory tr').each(function() { 55 | var l = this.id.split('_').length-1; 56 | var i = $('#img'+this.id.substring(3)); 57 | var a = $('#arr'+this.id.substring(3)); 58 | if (l 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | (kv-store) 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 |
25 | 26 | 27 | 28 | 29 | 32 | 33 | 34 |
30 |
(kv-store)
31 |
35 |
36 | 37 | 38 | 43 | 44 | 45 | 53 | 54 |
55 |
56 | 61 |
63 |
64 |
65 | 70 |
71 | 72 |
76 |
77 | 78 | 79 |
80 | 83 |
84 | 85 |
86 |
Key Value Storage Library
87 |
88 |
89 |

90 |

91 | Overview

92 |

This library provides a convenient way to store information as key-value pairs in non-volatile storage.

93 |

94 | Features

95 |
    96 |
  • Supports any storage which can be modeled as a block device, including internal flash or external flash (e.g. via QSPI).
  • 97 |
  • Allows partitioning storage by instantiating multiple instances of the library.
  • 98 |
  • Designed to be resilient to power failures.
  • 99 |
  • Designed to promote even wear of the storage.
  • 100 |
101 |

102 | Storage

103 |

The utility operates on the assumption that the underlying storage is a block device which may not have the same program and erase sizes. The application is required to initialize and create the block storage interface(mtb_block_storage_t).

104 |

105 | Keys and Values

106 |

107 | Keys

108 |

Keys are ASCII strings (Null terminated). The maximum key length is defined by MTB_KVSTORE_MAX_KEY_SIZE. This can be overridden by the application by adding DEFINES+=MTB_KVSTORE_MAX_KEY_SIZE=<value> with the desired value to application Makefile.

109 |

110 | Values

111 |

Values are arbitrary length binary data. By default it is assumed that each value (plus the header info of ~20 bytes) is less than the mtb_block_storage_t erase_size. If this is not true, a define MTB_KVSTORE_MAX_VALUE_SIZE must be defined with the actual max value size. NOTE: This define is not currently used, but will be in a future update. Setting it now will help ensure the application works properly with newer versions of the kv-store library.

112 |

113 | RTOS Integration

114 |

In an RTOS environment, the library can be made thread safe by adding the RTOS_AWARE component (COMPONENTS+=RTOS_AWARE) or by defining the CY_RTOS_AWARE macro (DEFINES+=CY_RTOS_AWARE). This causes all API to be protected by a mutex to serialize access to underlying storage device. The kvstore library must be initialized after the RTOS kernel has started for the mutex to be initialized safely. The default timeout for the mutex is defined by MTB_KVSTORE_MUTEX_TIMEOUT_MS and can be overridden by specifying DEFINES+=MTB_KVSTORE_MUTEX_TIMEOUT_MS=<value> with the application Makefile.

115 |

When determining a suitable timeout, consider that the execution time for KVStore modifying operations is impacted by several factors:

    116 |
  • The size of the key and value being written
  • 117 |
  • If garbage collection is required (see "Garbage collection" section for details) to complete a modification, this operation must erase half of the storage which was provided for kv-store to use. This is a potentially lengthy operation. The mtb_kvstore_ensure_capacity function can be used to trigger garbage collection, if necessary, in less timing sensitive contexts.
  • 118 |
  • All operations are impacted by the write performance of the underlying storage device. For more details, see the datasheet of the selected MCU (for internal flash) or the external memory device.
  • 119 |
120 |

121 | Design details

122 |

123 | Sequential log of records

124 |

The key-value pairs are stored sequentially as records. Each operation appends a new record to the next available program block. If multiple records exist for the same key, the record at the highest address takes precedence over those that came before it. In an update operation, a new record with the key and updated value is appended, overriding the previous value. In a delete operation, a new record with the key and a "deleted" flag is appended.

125 |

126 | Memory Layout

127 |

The address space provided by the application is divided into two areas. At any given time, one area is designated as active and the other as swap. All key/value pair records are stored in the active area. Each time garbage collection is performed, the active and swap area designations are reversed. The first record in the active area is an area header used to identify the current active area during initialization. This means that one half of the provided storage space is available for key value storage.

active area swap area
128 |
+-----------------------------+ +-----------------------------+
129 |
| area header record | | |
130 |
+-----------------------------+ | |
131 |
| key value record 1 | | |
132 |
+-----------------------------+ | |
133 |
| key value record 2 | | |
134 |
| | | |
135 |
+-----------------------------+ | |
136 |
| key value record 3 | | |
137 |
+-----------------------------+ | |
138 |
| free space | | |
139 |
| | | |
140 |
+-----------------------------+ +-----------------------------+
141 |

142 | Record

143 |

Each record contains a record header (_mtb_kvstore_record_header_t) that contains metadata including key/value sizes and a CRC. This is followed by the key and value data. The record is padded to the program size.

144 |
+---------------------+-------------------------+--------------------------------+---------------+
145 |
| Record Header | Key | Data | prog size pad |
146 |
+---------------------+-------------------------+--------------------------------+---------------+
147 |

148 | RAM table

149 |

A table that contains a hash for every key and the corresponding offset of the latest record for that key in storage is maintained in RAM. This table is built from storage during initialization and is updated on every subsequent operation. The key is verified by matching the key in the record in the storage. If it does not match the next entry with the same hash in the RAM table is checked. This allows for the possibility that multiple distinct keys may hash to the same value.

150 |

151 | Garbage collection

152 |

The garbage collection operation copies all of the non-obsolete records (i.e. all of those listed in the RAM table) into the swap area. The swap area is then marked as the new active area by programming the area header at the start. The former active area is erased and becomes the new swap area. Garbage collection is performed in the following scenarios:

    153 |
  • The active area does not have sufficient space remaining to perform a requested modification (add, update, delete) and the active area contains obsolete records.
  • 154 |
  • A corrupted record is encountered during initialization. This may happen if a power failure occurs while the a record is being appended during a modifying operation. The garbage collection operation will copy all non-obsolete records preceding the corrupted record.
  • 155 |
  • The mtb_kvstore_ensure_capacity function is called and the active area does not contain the requested amount of space available for immediate usage.
  • 156 |
157 |

NOTE: Due to the garbage collection operation, write and delete operations may consume significantly more time than typical when the active area becomes full. Hence, they must not be called from timing critical code.

158 |

159 | Dependencies

160 | 164 |

165 | More information

166 | 172 |
173 |

© Cypress Semiconductor Corporation (an Infineon company) or an affiliate of Cypress Semiconductor Corporation, 2021.

174 |
175 |
176 |
177 | 187 | 188 | 189 | -------------------------------------------------------------------------------- /docs/html/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/kv-store/4d683fc825313bcbf0fa158b2da6bf842420c5e2/docs/html/logo.png -------------------------------------------------------------------------------- /docs/html/menu.js: -------------------------------------------------------------------------------- 1 | /* 2 | @licstart The following is the entire license notice for the JavaScript code in this file. 3 | 4 | The MIT License (MIT) 5 | 6 | Copyright (C) 1997-2020 by Dimitri van Heesch 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 9 | and associated documentation files (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, publish, distribute, 11 | sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all copies or 15 | substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 18 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 20 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | @licend The above is the entire license notice for the JavaScript code in this file 24 | */ 25 | function initMenu(relPath,searchEnabled,serverSide,searchPage,search) { 26 | function makeTree(data,relPath) { 27 | var result=''; 28 | if ('children' in data) { 29 | result+=''; 36 | } 37 | return result; 38 | } 39 | var searchBox; 40 | if (searchEnabled) { 41 | if (serverSide) { 42 | searchBox='
'+ 43 | '
'+ 44 | '
'+ 47 | ''+ 50 | '
'+ 51 | '
'+ 52 | '
'+ 53 | '
'; 54 | } else { 55 | searchBox='
'+ 56 | ''+ 57 | ''+ 60 | ''+ 64 | ''+ 65 | ''+ 67 | '' 69 | '' 70 | '
'; 71 | } 72 | } 73 | 74 | $('#main-nav').before('
'+ 75 | ''+ 78 | ''+ 79 | '
'); 80 | $('#main-nav').append(makeTree(menudata,relPath)); 81 | $('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu'); 82 | if (searchBox) { 83 | $('#main-menu').append('
  • '); 84 | } 85 | var $mainMenuState = $('#main-menu-state'); 86 | var prevWidth = 0; 87 | if ($mainMenuState.length) { 88 | function initResizableIfExists() { 89 | if (typeof initResizable==='function') initResizable(); 90 | } 91 | // animate mobile menu 92 | $mainMenuState.change(function(e) { 93 | var $menu = $('#main-menu'); 94 | var options = { duration: 250, step: initResizableIfExists }; 95 | if (this.checked) { 96 | options['complete'] = function() { $menu.css('display', 'block') }; 97 | $menu.hide().slideDown(options); 98 | } else { 99 | options['complete'] = function() { $menu.css('display', 'none') }; 100 | $menu.show().slideUp(options); 101 | } 102 | }); 103 | // set default menu visibility 104 | function resetState() { 105 | var $menu = $('#main-menu'); 106 | var $mainMenuState = $('#main-menu-state'); 107 | var newWidth = $(window).outerWidth(); 108 | if (newWidth!=prevWidth) { 109 | if ($(window).outerWidth()<768) { 110 | $mainMenuState.prop('checked',false); $menu.hide(); 111 | $('#searchBoxPos1').html(searchBox); 112 | $('#searchBoxPos2').hide(); 113 | } else { 114 | $menu.show(); 115 | $('#searchBoxPos1').empty(); 116 | $('#searchBoxPos2').html(searchBox); 117 | $('#searchBoxPos2').show(); 118 | } 119 | prevWidth = newWidth; 120 | } 121 | } 122 | $(window).ready(function() { resetState(); initResizableIfExists(); }); 123 | $(window).resize(resetState); 124 | } 125 | $('#main-menu').smartmenus(); 126 | } 127 | /* @license-end */ 128 | -------------------------------------------------------------------------------- /docs/html/menudata.js: -------------------------------------------------------------------------------- 1 | /* 2 | @licstart The following is the entire license notice for the JavaScript code in this file. 3 | 4 | The MIT License (MIT) 5 | 6 | Copyright (C) 1997-2020 by Dimitri van Heesch 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 9 | and associated documentation files (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, publish, distribute, 11 | sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all copies or 15 | substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 18 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 20 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | @licend The above is the entire license notice for the JavaScript code in this file 24 | */ 25 | var menudata={children:[ 26 | {text:"Home",url:"index.html"}, 27 | {text:"API Reference",url:"modules.html"}]} 28 | -------------------------------------------------------------------------------- /docs/html/modules.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | (kv-store) 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
    24 |
    25 | 26 | 27 | 28 | 29 | 32 | 33 | 34 |
    30 |
    (kv-store)
    31 |
    35 |
    36 | 37 | 38 | 43 | 44 | 45 | 53 | 54 |
    55 |
    56 | 61 |
    63 |
    64 |
    65 | 70 |
    71 | 72 |
    76 |
    77 | 78 | 79 |
    80 | 83 |
    84 | 85 |
    86 |
    API Reference
    87 |
    88 |
    89 |
    The following provides a list of API documentation
    90 | 91 | 92 |
     Key Value Storage LibraryThis library provides a convenient way to store information as key-value pairs in non-volatile storage
    93 |
    94 |
    95 |
    96 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /docs/html/modules.js: -------------------------------------------------------------------------------- 1 | var modules = 2 | [ 3 | [ "Key Value Storage Library", "group__group__kvstore.html", "group__group__kvstore" ] 4 | ]; -------------------------------------------------------------------------------- /docs/html/nav_f.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/kv-store/4d683fc825313bcbf0fa158b2da6bf842420c5e2/docs/html/nav_f.png -------------------------------------------------------------------------------- /docs/html/nav_g.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/kv-store/4d683fc825313bcbf0fa158b2da6bf842420c5e2/docs/html/nav_g.png -------------------------------------------------------------------------------- /docs/html/nav_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/kv-store/4d683fc825313bcbf0fa158b2da6bf842420c5e2/docs/html/nav_h.png -------------------------------------------------------------------------------- /docs/html/navtree.css: -------------------------------------------------------------------------------- 1 | #nav-tree .children_ul { 2 | margin:0; 3 | padding:4px; 4 | } 5 | 6 | #nav-tree ul { 7 | list-style:none outside none; 8 | margin:0px; 9 | padding:0px; 10 | } 11 | 12 | #nav-tree li { 13 | white-space:nowrap; 14 | margin:0px; 15 | padding:0px; 16 | } 17 | 18 | #nav-tree .plus { 19 | margin:0px; 20 | } 21 | 22 | #nav-tree .selected { 23 | background-image: url('tab_a.png'); 24 | background-repeat:repeat-x; 25 | color: #fff; 26 | text-shadow: 0px 1px 1px rgba(0, 0, 0, 1.0); 27 | } 28 | 29 | #nav-tree img { 30 | margin:0px; 31 | padding:0px; 32 | border:0px; 33 | vertical-align: middle; 34 | } 35 | 36 | #nav-tree a { 37 | text-decoration:none; 38 | padding:0px; 39 | margin:0px; 40 | outline:none; 41 | } 42 | 43 | #nav-tree .label { 44 | margin:0px; 45 | padding:0px; 46 | font: 12px 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; 47 | } 48 | 49 | #nav-tree .label a { 50 | padding:2px; 51 | } 52 | 53 | #nav-tree .selected a { 54 | text-decoration:none; 55 | color:#fff; 56 | } 57 | 58 | #nav-tree .children_ul { 59 | margin:0px; 60 | padding:0px; 61 | } 62 | 63 | #nav-tree .item { 64 | margin:0px; 65 | padding:0px; 66 | } 67 | 68 | #nav-tree { 69 | padding: 0px 0px; 70 | background-color: #FAFAFF; 71 | font-size:14px; 72 | overflow:auto; 73 | } 74 | 75 | #doc-content { 76 | overflow:auto; 77 | display:block; 78 | padding:0px; 79 | margin:0px; 80 | -webkit-overflow-scrolling : touch; /* iOS 5+ */ 81 | } 82 | 83 | #side-nav { 84 | padding:0 6px 0 0; 85 | margin: 0px; 86 | display:block; 87 | position: absolute; 88 | left: 0px; 89 | width: 250px; 90 | overflow : hidden; 91 | } 92 | 93 | .ui-resizable .ui-resizable-handle { 94 | display:block; 95 | } 96 | 97 | .ui-resizable-e { 98 | background-image:url("splitbar.png"); 99 | background-size:100%; 100 | background-repeat:repeat-y; 101 | background-attachment: scroll; 102 | cursor:ew-resize; 103 | height:100%; 104 | right:0; 105 | top:0; 106 | width:6px; 107 | } 108 | 109 | .ui-resizable-handle { 110 | display:none; 111 | font-size:0.1px; 112 | position:absolute; 113 | z-index:1; 114 | } 115 | 116 | #nav-tree-contents { 117 | margin: 6px 0px 0px 0px; 118 | } 119 | 120 | #nav-tree { 121 | background-image:url('nav_h.png'); 122 | background-repeat:repeat-x; 123 | background-color: #F9FAFC; 124 | -webkit-overflow-scrolling : touch; /* iOS 5+ */ 125 | } 126 | 127 | #nav-sync { 128 | position:absolute; 129 | top:5px; 130 | right:24px; 131 | z-index:0; 132 | } 133 | 134 | #nav-sync img { 135 | opacity:0.3; 136 | } 137 | 138 | #nav-sync img:hover { 139 | opacity:0.9; 140 | } 141 | 142 | @media print 143 | { 144 | #nav-tree { display: none; } 145 | div.ui-resizable-handle { display: none; position: relative; } 146 | } 147 | 148 | -------------------------------------------------------------------------------- /docs/html/navtree.js: -------------------------------------------------------------------------------- 1 | /* 2 | @licstart The following is the entire license notice for the JavaScript code in this file. 3 | 4 | The MIT License (MIT) 5 | 6 | Copyright (C) 1997-2020 by Dimitri van Heesch 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 9 | and associated documentation files (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, publish, distribute, 11 | sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all copies or 15 | substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 18 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 20 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | @licend The above is the entire license notice for the JavaScript code in this file 24 | */ 25 | var navTreeSubIndices = new Array(); 26 | var arrowDown = '▼'; 27 | var arrowRight = '►'; 28 | 29 | function getData(varName) 30 | { 31 | var i = varName.lastIndexOf('/'); 32 | var n = i>=0 ? varName.substring(i+1) : varName; 33 | return eval(n.replace(/\-/g,'_')); 34 | } 35 | 36 | function stripPath(uri) 37 | { 38 | return uri.substring(uri.lastIndexOf('/')+1); 39 | } 40 | 41 | function stripPath2(uri) 42 | { 43 | var i = uri.lastIndexOf('/'); 44 | var s = uri.substring(i+1); 45 | var m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/); 46 | return m ? uri.substring(i-6) : s; 47 | } 48 | 49 | function hashValue() 50 | { 51 | return $(location).attr('hash').substring(1).replace(/[^\w\-]/g,''); 52 | } 53 | 54 | function hashUrl() 55 | { 56 | return '#'+hashValue(); 57 | } 58 | 59 | function pathName() 60 | { 61 | return $(location).attr('pathname').replace(/[^-A-Za-z0-9+&@#/%?=~_|!:,.;\(\)]/g, ''); 62 | } 63 | 64 | function localStorageSupported() 65 | { 66 | try { 67 | return 'localStorage' in window && window['localStorage'] !== null && window.localStorage.getItem; 68 | } 69 | catch(e) { 70 | return false; 71 | } 72 | } 73 | 74 | function storeLink(link) 75 | { 76 | if (!$("#nav-sync").hasClass('sync') && localStorageSupported()) { 77 | window.localStorage.setItem('navpath',link); 78 | } 79 | } 80 | 81 | function deleteLink() 82 | { 83 | if (localStorageSupported()) { 84 | window.localStorage.setItem('navpath',''); 85 | } 86 | } 87 | 88 | function cachedLink() 89 | { 90 | if (localStorageSupported()) { 91 | return window.localStorage.getItem('navpath'); 92 | } else { 93 | return ''; 94 | } 95 | } 96 | 97 | function getScript(scriptName,func,show) 98 | { 99 | var head = document.getElementsByTagName("head")[0]; 100 | var script = document.createElement('script'); 101 | script.id = scriptName; 102 | script.type = 'text/javascript'; 103 | script.onload = func; 104 | script.src = scriptName+'.js'; 105 | head.appendChild(script); 106 | } 107 | 108 | function createIndent(o,domNode,node,level) 109 | { 110 | var level=-1; 111 | var n = node; 112 | while (n.parentNode) { level++; n=n.parentNode; } 113 | if (node.childrenData) { 114 | var imgNode = document.createElement("span"); 115 | imgNode.className = 'arrow'; 116 | imgNode.style.paddingLeft=(16*level).toString()+'px'; 117 | imgNode.innerHTML=arrowRight; 118 | node.plus_img = imgNode; 119 | node.expandToggle = document.createElement("a"); 120 | node.expandToggle.href = "javascript:void(0)"; 121 | node.expandToggle.onclick = function() { 122 | if (node.expanded) { 123 | $(node.getChildrenUL()).slideUp("fast"); 124 | node.plus_img.innerHTML=arrowRight; 125 | node.expanded = false; 126 | } else { 127 | expandNode(o, node, false, false); 128 | } 129 | } 130 | node.expandToggle.appendChild(imgNode); 131 | domNode.appendChild(node.expandToggle); 132 | } else { 133 | var span = document.createElement("span"); 134 | span.className = 'arrow'; 135 | span.style.width = 16*(level+1)+'px'; 136 | span.innerHTML = ' '; 137 | domNode.appendChild(span); 138 | } 139 | } 140 | 141 | var animationInProgress = false; 142 | 143 | function gotoAnchor(anchor,aname,updateLocation) 144 | { 145 | var pos, docContent = $('#doc-content'); 146 | var ancParent = $(anchor.parent()); 147 | if (ancParent.hasClass('memItemLeft') || 148 | ancParent.hasClass('memtitle') || 149 | ancParent.hasClass('fieldname') || 150 | ancParent.hasClass('fieldtype') || 151 | ancParent.is(':header')) 152 | { 153 | pos = ancParent.position().top; 154 | } else if (anchor.position()) { 155 | pos = anchor.position().top; 156 | } 157 | if (pos) { 158 | var dist = Math.abs(Math.min( 159 | pos-docContent.offset().top, 160 | docContent[0].scrollHeight- 161 | docContent.height()-docContent.scrollTop())); 162 | animationInProgress=true; 163 | docContent.animate({ 164 | scrollTop: pos + docContent.scrollTop() - docContent.offset().top 165 | },Math.max(50,Math.min(500,dist)),function(){ 166 | if (updateLocation) window.location.href=aname; 167 | animationInProgress=false; 168 | }); 169 | } 170 | } 171 | 172 | function newNode(o, po, text, link, childrenData, lastNode) 173 | { 174 | var node = new Object(); 175 | node.children = Array(); 176 | node.childrenData = childrenData; 177 | node.depth = po.depth + 1; 178 | node.relpath = po.relpath; 179 | node.isLast = lastNode; 180 | 181 | node.li = document.createElement("li"); 182 | po.getChildrenUL().appendChild(node.li); 183 | node.parentNode = po; 184 | 185 | node.itemDiv = document.createElement("div"); 186 | node.itemDiv.className = "item"; 187 | 188 | node.labelSpan = document.createElement("span"); 189 | node.labelSpan.className = "label"; 190 | 191 | createIndent(o,node.itemDiv,node,0); 192 | node.itemDiv.appendChild(node.labelSpan); 193 | node.li.appendChild(node.itemDiv); 194 | 195 | var a = document.createElement("a"); 196 | node.labelSpan.appendChild(a); 197 | node.label = document.createTextNode(text); 198 | node.expanded = false; 199 | a.appendChild(node.label); 200 | if (link) { 201 | var url; 202 | if (link.substring(0,1)=='^') { 203 | url = link.substring(1); 204 | link = url; 205 | } else { 206 | url = node.relpath+link; 207 | } 208 | a.className = stripPath(link.replace('#',':')); 209 | if (link.indexOf('#')!=-1) { 210 | var aname = '#'+link.split('#')[1]; 211 | var srcPage = stripPath(pathName()); 212 | var targetPage = stripPath(link.split('#')[0]); 213 | a.href = srcPage!=targetPage ? url : "javascript:void(0)"; 214 | a.onclick = function(){ 215 | storeLink(link); 216 | if (!$(a).parent().parent().hasClass('selected')) 217 | { 218 | $('.item').removeClass('selected'); 219 | $('.item').removeAttr('id'); 220 | $(a).parent().parent().addClass('selected'); 221 | $(a).parent().parent().attr('id','selected'); 222 | } 223 | var anchor = $(aname); 224 | gotoAnchor(anchor,aname,true); 225 | }; 226 | } else { 227 | a.href = url; 228 | a.onclick = function() { storeLink(link); } 229 | } 230 | } else { 231 | if (childrenData != null) 232 | { 233 | a.className = "nolink"; 234 | a.href = "javascript:void(0)"; 235 | a.onclick = node.expandToggle.onclick; 236 | } 237 | } 238 | 239 | node.childrenUL = null; 240 | node.getChildrenUL = function() { 241 | if (!node.childrenUL) { 242 | node.childrenUL = document.createElement("ul"); 243 | node.childrenUL.className = "children_ul"; 244 | node.childrenUL.style.display = "none"; 245 | node.li.appendChild(node.childrenUL); 246 | } 247 | return node.childrenUL; 248 | }; 249 | 250 | return node; 251 | } 252 | 253 | function showRoot() 254 | { 255 | var headerHeight = $("#top").height(); 256 | var footerHeight = $("#nav-path").height(); 257 | var windowHeight = $(window).height() - headerHeight - footerHeight; 258 | (function (){ // retry until we can scroll to the selected item 259 | try { 260 | var navtree=$('#nav-tree'); 261 | navtree.scrollTo('#selected',100,{offset:-windowHeight/2}); 262 | } catch (err) { 263 | setTimeout(arguments.callee, 0); 264 | } 265 | })(); 266 | } 267 | 268 | function expandNode(o, node, imm, showRoot) 269 | { 270 | if (node.childrenData && !node.expanded) { 271 | if (typeof(node.childrenData)==='string') { 272 | var varName = node.childrenData; 273 | getScript(node.relpath+varName,function(){ 274 | node.childrenData = getData(varName); 275 | expandNode(o, node, imm, showRoot); 276 | }, showRoot); 277 | } else { 278 | if (!node.childrenVisited) { 279 | getNode(o, node); 280 | } 281 | $(node.getChildrenUL()).slideDown("fast"); 282 | node.plus_img.innerHTML = arrowDown; 283 | node.expanded = true; 284 | } 285 | } 286 | } 287 | 288 | function glowEffect(n,duration) 289 | { 290 | n.addClass('glow').delay(duration).queue(function(next){ 291 | $(this).removeClass('glow');next(); 292 | }); 293 | } 294 | 295 | function highlightAnchor() 296 | { 297 | var aname = hashUrl(); 298 | var anchor = $(aname); 299 | if (anchor.parent().attr('class')=='memItemLeft'){ 300 | var rows = $('.memberdecls tr[class$="'+hashValue()+'"]'); 301 | glowEffect(rows.children(),300); // member without details 302 | } else if (anchor.parent().attr('class')=='fieldname'){ 303 | glowEffect(anchor.parent().parent(),1000); // enum value 304 | } else if (anchor.parent().attr('class')=='fieldtype'){ 305 | glowEffect(anchor.parent().parent(),1000); // struct field 306 | } else if (anchor.parent().is(":header")) { 307 | glowEffect(anchor.parent(),1000); // section header 308 | } else { 309 | glowEffect(anchor.next(),1000); // normal member 310 | } 311 | } 312 | 313 | function selectAndHighlight(hash,n) 314 | { 315 | var a; 316 | if (hash) { 317 | var link=stripPath(pathName())+':'+hash.substring(1); 318 | a=$('.item a[class$="'+link+'"]'); 319 | } 320 | if (a && a.length) { 321 | a.parent().parent().addClass('selected'); 322 | a.parent().parent().attr('id','selected'); 323 | highlightAnchor(); 324 | } else if (n) { 325 | $(n.itemDiv).addClass('selected'); 326 | $(n.itemDiv).attr('id','selected'); 327 | } 328 | var topOffset=5; 329 | if (typeof page_layout!=='undefined' && page_layout==1) { 330 | topOffset+=$('#top').outerHeight(); 331 | } 332 | if ($('#nav-tree-contents .item:first').hasClass('selected')) { 333 | topOffset+=25; 334 | } 335 | $('#nav-sync').css('top',topOffset+'px'); 336 | showRoot(); 337 | } 338 | 339 | function showNode(o, node, index, hash) 340 | { 341 | if (node && node.childrenData) { 342 | if (typeof(node.childrenData)==='string') { 343 | var varName = node.childrenData; 344 | getScript(node.relpath+varName,function(){ 345 | node.childrenData = getData(varName); 346 | showNode(o,node,index,hash); 347 | },true); 348 | } else { 349 | if (!node.childrenVisited) { 350 | getNode(o, node); 351 | } 352 | $(node.getChildrenUL()).css({'display':'block'}); 353 | node.plus_img.innerHTML = arrowDown; 354 | node.expanded = true; 355 | var n = node.children[o.breadcrumbs[index]]; 356 | if (index+11) hash = '#'+parts[1].replace(/[^\w\-]/g,''); 428 | else hash=''; 429 | } 430 | if (hash.match(/^#l\d+$/)) { 431 | var anchor=$('a[name='+hash.substring(1)+']'); 432 | glowEffect(anchor.parent(),1000); // line number 433 | hash=''; // strip line number anchors 434 | } 435 | var url=root+hash; 436 | var i=-1; 437 | while (NAVTREEINDEX[i+1]<=url) i++; 438 | if (i==-1) { i=0; root=NAVTREE[0][1]; } // fallback: show index 439 | if (navTreeSubIndices[i]) { 440 | gotoNode(o,i,root,hash,relpath) 441 | } else { 442 | getScript(relpath+'navtreeindex'+i,function(){ 443 | navTreeSubIndices[i] = eval('NAVTREEINDEX'+i); 444 | if (navTreeSubIndices[i]) { 445 | gotoNode(o,i,root,hash,relpath); 446 | } 447 | },true); 448 | } 449 | } 450 | 451 | function showSyncOff(n,relpath) 452 | { 453 | n.html(''); 454 | } 455 | 456 | function showSyncOn(n,relpath) 457 | { 458 | n.html(''); 459 | } 460 | 461 | function toggleSyncButton(relpath) 462 | { 463 | var navSync = $('#nav-sync'); 464 | if (navSync.hasClass('sync')) { 465 | navSync.removeClass('sync'); 466 | showSyncOff(navSync,relpath); 467 | storeLink(stripPath2(pathName())+hashUrl()); 468 | } else { 469 | navSync.addClass('sync'); 470 | showSyncOn(navSync,relpath); 471 | deleteLink(); 472 | } 473 | } 474 | 475 | var loadTriggered = false; 476 | var readyTriggered = false; 477 | var loadObject,loadToRoot,loadUrl,loadRelPath; 478 | 479 | $(window).on('load',function(){ 480 | if (readyTriggered) { // ready first 481 | navTo(loadObject,loadToRoot,loadUrl,loadRelPath); 482 | showRoot(); 483 | } 484 | loadTriggered=true; 485 | }); 486 | 487 | function initNavTree(toroot,relpath) 488 | { 489 | var o = new Object(); 490 | o.toroot = toroot; 491 | o.node = new Object(); 492 | o.node.li = document.getElementById("nav-tree-contents"); 493 | o.node.childrenData = NAVTREE; 494 | o.node.children = new Array(); 495 | o.node.childrenUL = document.createElement("ul"); 496 | o.node.getChildrenUL = function() { return o.node.childrenUL; }; 497 | o.node.li.appendChild(o.node.childrenUL); 498 | o.node.depth = 0; 499 | o.node.relpath = relpath; 500 | o.node.expanded = false; 501 | o.node.isLast = true; 502 | o.node.plus_img = document.createElement("span"); 503 | o.node.plus_img.className = 'arrow'; 504 | o.node.plus_img.innerHTML = arrowRight; 505 | 506 | if (localStorageSupported()) { 507 | var navSync = $('#nav-sync'); 508 | if (cachedLink()) { 509 | showSyncOff(navSync,relpath); 510 | navSync.removeClass('sync'); 511 | } else { 512 | showSyncOn(navSync,relpath); 513 | } 514 | navSync.click(function(){ toggleSyncButton(relpath); }); 515 | } 516 | 517 | if (loadTriggered) { // load before ready 518 | navTo(o,toroot,hashUrl(),relpath); 519 | showRoot(); 520 | } else { // ready before load 521 | loadObject = o; 522 | loadToRoot = toroot; 523 | loadUrl = hashUrl(); 524 | loadRelPath = relpath; 525 | readyTriggered=true; 526 | } 527 | 528 | $(window).bind('hashchange', function(){ 529 | if (window.location.hash && window.location.hash.length>1){ 530 | var a; 531 | if ($(location).attr('hash')){ 532 | var clslink=stripPath(pathName())+':'+hashValue(); 533 | a=$('.item a[class$="'+clslink.replace(/=desktop_vp) { 95 | if (!collapsed) { 96 | collapseExpand(); 97 | } 98 | } else if (width>desktop_vp && collapsedWidth0) { 113 | restoreWidth(0); 114 | collapsed=true; 115 | } 116 | else { 117 | var width = readCookie('width'); 118 | if (width>200 && width<$(window).width()) { restoreWidth(width); } else { restoreWidth(200); } 119 | collapsed=false; 120 | } 121 | } 122 | 123 | header = $("#top"); 124 | sidenav = $("#side-nav"); 125 | content = $("#doc-content"); 126 | navtree = $("#nav-tree"); 127 | footer = $("#nav-path"); 128 | $(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(); } }); 129 | $(sidenav).resizable({ minWidth: 0 }); 130 | $(window).resize(function() { resizeHeight(); }); 131 | var device = navigator.userAgent.toLowerCase(); 132 | var touch_device = device.match(/(iphone|ipod|ipad|android)/); 133 | if (touch_device) { /* wider split bar for touch only devices */ 134 | $(sidenav).css({ paddingRight:'20px' }); 135 | $('.ui-resizable-e').css({ width:'20px' }); 136 | $('#nav-sync').css({ right:'34px' }); 137 | barWidth=20; 138 | } 139 | var width = readCookie('width'); 140 | if (width) { restoreWidth(width); } else { resizeWidth(); } 141 | resizeHeight(); 142 | var url = location.href; 143 | var i=url.indexOf("#"); 144 | if (i>=0) window.location.hash=url.substr(i); 145 | var _preventDefault = function(evt) { evt.preventDefault(); }; 146 | $("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault); 147 | $(".ui-resizable-handle").dblclick(collapseExpand); 148 | $(window).on('load',resizeHeight); 149 | } 150 | /* @license-end */ 151 | -------------------------------------------------------------------------------- /docs/html/search/all_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
    12 |
    Loading...
    13 |
    14 | 19 |
    Searching...
    20 |
    No Matches
    21 | 35 |
    36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['key_20value_20storage_20library_0',['Key Value Storage Library',['../group__group__kvstore.html',1,'(Global Namespace)'],['../index.html',1,'(Global Namespace)']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/search/all_1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
    12 |
    Loading...
    13 |
    14 | 19 |
    Searching...
    20 |
    No Matches
    21 | 35 |
    36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/all_1.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['mtb_5fkvstore_5falignment_5ferror_0',['MTB_KVSTORE_ALIGNMENT_ERROR',['../group__group__kvstore.html#ga4513227045ee358f8f2622c8cf0a3485',1,'mtb_kvstore.h']]], 4 | ['mtb_5fkvstore_5fallocate_5fmemory_5ft_1',['mtb_kvstore_allocate_memory_t',['../group__group__kvstore.html#gaf4640989209ce778da48555edeb7f531',1,'mtb_kvstore.h']]], 5 | ['mtb_5fkvstore_5fbad_5fparam_5ferror_2',['MTB_KVSTORE_BAD_PARAM_ERROR',['../group__group__kvstore.html#gaf080d74c7e7cd0b04649ce6617831e74',1,'mtb_kvstore.h']]], 6 | ['mtb_5fkvstore_5fbd_5ferase_3',['mtb_kvstore_bd_erase',['../group__group__kvstore.html#ga8eee071bb3809130b77fb7c8f69e7a67',1,'mtb_kvstore.h']]], 7 | ['mtb_5fkvstore_5fbd_5ferase_5fsize_4',['mtb_kvstore_bd_erase_size',['../group__group__kvstore.html#ga9dcd451cefcdae7d7063aa2e173b948b',1,'mtb_kvstore.h']]], 8 | ['mtb_5fkvstore_5fbd_5fprogram_5',['mtb_kvstore_bd_program',['../group__group__kvstore.html#gaa832bac0e2f7b15478abb73ae8631b8d',1,'mtb_kvstore.h']]], 9 | ['mtb_5fkvstore_5fbd_5fprogram_5fsize_6',['mtb_kvstore_bd_program_size',['../group__group__kvstore.html#ga33782352587721d63e4ca26f35558d90',1,'mtb_kvstore.h']]], 10 | ['mtb_5fkvstore_5fbd_5fread_7',['mtb_kvstore_bd_read',['../group__group__kvstore.html#gacccba62e614b1ebb309dc312b7b67e3a',1,'mtb_kvstore.h']]], 11 | ['mtb_5fkvstore_5fbd_5fread_5fsize_8',['mtb_kvstore_bd_read_size',['../group__group__kvstore.html#ga4d03d5b99d6254298f9eaefb0978170f',1,'mtb_kvstore.h']]], 12 | ['mtb_5fkvstore_5fbuffer_5ftoo_5fsmall_9',['MTB_KVSTORE_BUFFER_TOO_SMALL',['../group__group__kvstore.html#ga3b7ec8bfe496de11d5961eddf55eb8a8',1,'mtb_kvstore.h']]], 13 | ['mtb_5fkvstore_5fdeinit_10',['mtb_kvstore_deinit',['../group__group__kvstore.html#ga4388f0dd869ef9dbe2da0d2920cca290',1,'mtb_kvstore_deinit(mtb_kvstore_t *obj): mtb_kvstore.c'],['../group__group__kvstore.html#ga4388f0dd869ef9dbe2da0d2920cca290',1,'mtb_kvstore_deinit(mtb_kvstore_t *obj): mtb_kvstore.c']]], 14 | ['mtb_5fkvstore_5fdelete_11',['mtb_kvstore_delete',['../group__group__kvstore.html#gafb22467328e29fd0b881eae93679a0f9',1,'mtb_kvstore_delete(mtb_kvstore_t *obj, const char *key): mtb_kvstore.c'],['../group__group__kvstore.html#gafb22467328e29fd0b881eae93679a0f9',1,'mtb_kvstore_delete(mtb_kvstore_t *obj, const char *key): mtb_kvstore.c']]], 15 | ['mtb_5fkvstore_5fensure_5fcapacity_12',['mtb_kvstore_ensure_capacity',['../group__group__kvstore.html#gad0c50e719da0063d48d9d6224d22c756',1,'mtb_kvstore_ensure_capacity(mtb_kvstore_t *obj, uint32_t size): mtb_kvstore.c'],['../group__group__kvstore.html#gad0c50e719da0063d48d9d6224d22c756',1,'mtb_kvstore_ensure_capacity(mtb_kvstore_t *obj, uint32_t size): mtb_kvstore.c']]], 16 | ['mtb_5fkvstore_5fensure_5fmax_13',['MTB_KVSTORE_ENSURE_MAX',['../group__group__kvstore.html#gab15b7f2a1cea77f4621f72c8082ae352',1,'mtb_kvstore.h']]], 17 | ['mtb_5fkvstore_5ferased_5fdata_5ferror_14',['MTB_KVSTORE_ERASED_DATA_ERROR',['../group__group__kvstore.html#ga531cd29dc9167444df1474d15a9e263f',1,'mtb_kvstore.h']]], 18 | ['mtb_5fkvstore_5ffree_5fmemory_5ft_15',['mtb_kvstore_free_memory_t',['../group__group__kvstore.html#gacc6ed573c4d9f8c441bd4605d26ddd81',1,'mtb_kvstore.h']]], 19 | ['mtb_5fkvstore_5finit_16',['mtb_kvstore_init',['../group__group__kvstore.html#ga5fa9ddeac64024562e60999088f638b7',1,'mtb_kvstore_init(mtb_kvstore_t *obj, uint32_t start_addr, uint32_t length, const mtb_block_storage_t *bsd, mtb_kvstore_allocate_memory_t alloc_memory, mtb_kvstore_free_memory_t free_memory): mtb_kvstore.c'],['../group__group__kvstore.html#ga5fa9ddeac64024562e60999088f638b7',1,'mtb_kvstore_init(mtb_kvstore_t *obj, uint32_t start_addr, uint32_t length, const mtb_block_storage_t *bsd, mtb_kvstore_allocate_memory_t alloc_memory, mtb_kvstore_free_memory_t free_memory): mtb_kvstore.c']]], 20 | ['mtb_5fkvstore_5finvalid_5fdata_5ferror_17',['MTB_KVSTORE_INVALID_DATA_ERROR',['../group__group__kvstore.html#ga231945421777b158f99b21e5bc2ffde0',1,'mtb_kvstore.h']]], 21 | ['mtb_5fkvstore_5fitem_5fnot_5ffound_5ferror_18',['MTB_KVSTORE_ITEM_NOT_FOUND_ERROR',['../group__group__kvstore.html#ga0b1535ec72da31cca2681a2990d69d60',1,'mtb_kvstore.h']]], 22 | ['mtb_5fkvstore_5fkey_5fexists_19',['mtb_kvstore_key_exists',['../group__group__kvstore.html#ga16b0bc2c58f9a4259d295746df43c8ad',1,'mtb_kvstore_key_exists(mtb_kvstore_t *obj, const char *key): mtb_kvstore.c'],['../group__group__kvstore.html#ga16b0bc2c58f9a4259d295746df43c8ad',1,'mtb_kvstore_key_exists(mtb_kvstore_t *obj, const char *key): mtb_kvstore.c']]], 23 | ['mtb_5fkvstore_5fmax_5fkey_5fsize_20',['MTB_KVSTORE_MAX_KEY_SIZE',['../group__group__kvstore.html#ga23dc5337825e5abb56afd1938b41e997',1,'mtb_kvstore.h']]], 24 | ['mtb_5fkvstore_5fmem_5falloc_5ferror_21',['MTB_KVSTORE_MEM_ALLOC_ERROR',['../group__group__kvstore.html#gaa4476b5e7db68726ae74b0153690fbfc',1,'mtb_kvstore.h']]], 25 | ['mtb_5fkvstore_5fread_22',['mtb_kvstore_read',['../group__group__kvstore.html#gad2327026f8f741835d012aa0a1f60f14',1,'mtb_kvstore_read(mtb_kvstore_t *obj, const char *key, uint8_t *data, uint32_t *size): mtb_kvstore.c'],['../group__group__kvstore.html#gad2327026f8f741835d012aa0a1f60f14',1,'mtb_kvstore_read(mtb_kvstore_t *obj, const char *key, uint8_t *data, uint32_t *size): mtb_kvstore.c']]], 26 | ['mtb_5fkvstore_5fread_5fpartial_23',['mtb_kvstore_read_partial',['../group__group__kvstore.html#gadd5125b0adf2ef5a4afc39851aeaa288',1,'mtb_kvstore_read_partial(mtb_kvstore_t *obj, const char *key, uint8_t *data, uint32_t *size, const uint32_t offset_bytes): mtb_kvstore.c'],['../group__group__kvstore.html#gadd5125b0adf2ef5a4afc39851aeaa288',1,'mtb_kvstore_read_partial(mtb_kvstore_t *obj, const char *key, uint8_t *data, uint32_t *size, const uint32_t offset_bytes): mtb_kvstore.c']]], 27 | ['mtb_5fkvstore_5fremaining_5fsize_24',['mtb_kvstore_remaining_size',['../group__group__kvstore.html#ga51591921642d49be5e5c8a9814bebd39',1,'mtb_kvstore_remaining_size(mtb_kvstore_t *obj): mtb_kvstore.c'],['../group__group__kvstore.html#ga51591921642d49be5e5c8a9814bebd39',1,'mtb_kvstore_remaining_size(mtb_kvstore_t *obj): mtb_kvstore.c']]], 28 | ['mtb_5fkvstore_5freset_25',['mtb_kvstore_reset',['../group__group__kvstore.html#ga5dc849717a6e3c8b7803fe2224cc6df1',1,'mtb_kvstore_reset(mtb_kvstore_t *obj): mtb_kvstore.c'],['../group__group__kvstore.html#ga5dc849717a6e3c8b7803fe2224cc6df1',1,'mtb_kvstore_reset(mtb_kvstore_t *obj): mtb_kvstore.c']]], 29 | ['mtb_5fkvstore_5fsize_26',['mtb_kvstore_size',['../group__group__kvstore.html#ga543e217c6dad81778e1fc9926e28f23f',1,'mtb_kvstore_size(mtb_kvstore_t *obj): mtb_kvstore.c'],['../group__group__kvstore.html#ga543e217c6dad81778e1fc9926e28f23f',1,'mtb_kvstore_size(mtb_kvstore_t *obj): mtb_kvstore.c']]], 30 | ['mtb_5fkvstore_5fstorage_5ffull_5ferror_27',['MTB_KVSTORE_STORAGE_FULL_ERROR',['../group__group__kvstore.html#gaf746e26fd8da70e4169614b530371a65',1,'mtb_kvstore.h']]], 31 | ['mtb_5fkvstore_5fvalue_5fsize_28',['mtb_kvstore_value_size',['../group__group__kvstore.html#gafd3c856a28b4a326f6e2982f0d18b6dc',1,'mtb_kvstore_value_size(mtb_kvstore_t *obj, const char *key, uint32_t *size): mtb_kvstore.c'],['../group__group__kvstore.html#gafd3c856a28b4a326f6e2982f0d18b6dc',1,'mtb_kvstore_value_size(mtb_kvstore_t *obj, const char *key, uint32_t *size): mtb_kvstore.c']]], 32 | ['mtb_5fkvstore_5fwrite_29',['mtb_kvstore_write',['../group__group__kvstore.html#ga209eef7f4603173449de48d3d4775835',1,'mtb_kvstore_write(mtb_kvstore_t *obj, const char *key, const uint8_t *data, uint32_t size): mtb_kvstore.c'],['../group__group__kvstore.html#ga209eef7f4603173449de48d3d4775835',1,'mtb_kvstore_write(mtb_kvstore_t *obj, const char *key, const uint8_t *data, uint32_t size): mtb_kvstore.c']]] 33 | ]; 34 | -------------------------------------------------------------------------------- /docs/html/search/close.svg: -------------------------------------------------------------------------------- 1 | 2 | 13 | 15 | 16 | 18 | image/svg+xml 19 | 21 | 22 | 23 | 24 | 25 | 27 | 31 | 32 | -------------------------------------------------------------------------------- /docs/html/search/functions_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
    12 |
    Loading...
    13 |
    14 | 19 |
    Searching...
    20 |
    No Matches
    21 | 35 |
    36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/functions_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['mtb_5fkvstore_5fdeinit_0',['mtb_kvstore_deinit',['../group__group__kvstore.html#ga4388f0dd869ef9dbe2da0d2920cca290',1,'mtb_kvstore_deinit(mtb_kvstore_t *obj): mtb_kvstore.c'],['../group__group__kvstore.html#ga4388f0dd869ef9dbe2da0d2920cca290',1,'mtb_kvstore_deinit(mtb_kvstore_t *obj): mtb_kvstore.c']]], 4 | ['mtb_5fkvstore_5fdelete_1',['mtb_kvstore_delete',['../group__group__kvstore.html#gafb22467328e29fd0b881eae93679a0f9',1,'mtb_kvstore_delete(mtb_kvstore_t *obj, const char *key): mtb_kvstore.c'],['../group__group__kvstore.html#gafb22467328e29fd0b881eae93679a0f9',1,'mtb_kvstore_delete(mtb_kvstore_t *obj, const char *key): mtb_kvstore.c']]], 5 | ['mtb_5fkvstore_5fensure_5fcapacity_2',['mtb_kvstore_ensure_capacity',['../group__group__kvstore.html#gad0c50e719da0063d48d9d6224d22c756',1,'mtb_kvstore_ensure_capacity(mtb_kvstore_t *obj, uint32_t size): mtb_kvstore.c'],['../group__group__kvstore.html#gad0c50e719da0063d48d9d6224d22c756',1,'mtb_kvstore_ensure_capacity(mtb_kvstore_t *obj, uint32_t size): mtb_kvstore.c']]], 6 | ['mtb_5fkvstore_5finit_3',['mtb_kvstore_init',['../group__group__kvstore.html#ga5fa9ddeac64024562e60999088f638b7',1,'mtb_kvstore_init(mtb_kvstore_t *obj, uint32_t start_addr, uint32_t length, const mtb_block_storage_t *bsd, mtb_kvstore_allocate_memory_t alloc_memory, mtb_kvstore_free_memory_t free_memory): mtb_kvstore.c'],['../group__group__kvstore.html#ga5fa9ddeac64024562e60999088f638b7',1,'mtb_kvstore_init(mtb_kvstore_t *obj, uint32_t start_addr, uint32_t length, const mtb_block_storage_t *bsd, mtb_kvstore_allocate_memory_t alloc_memory, mtb_kvstore_free_memory_t free_memory): mtb_kvstore.c']]], 7 | ['mtb_5fkvstore_5fkey_5fexists_4',['mtb_kvstore_key_exists',['../group__group__kvstore.html#ga16b0bc2c58f9a4259d295746df43c8ad',1,'mtb_kvstore_key_exists(mtb_kvstore_t *obj, const char *key): mtb_kvstore.c'],['../group__group__kvstore.html#ga16b0bc2c58f9a4259d295746df43c8ad',1,'mtb_kvstore_key_exists(mtb_kvstore_t *obj, const char *key): mtb_kvstore.c']]], 8 | ['mtb_5fkvstore_5fread_5',['mtb_kvstore_read',['../group__group__kvstore.html#gad2327026f8f741835d012aa0a1f60f14',1,'mtb_kvstore_read(mtb_kvstore_t *obj, const char *key, uint8_t *data, uint32_t *size): mtb_kvstore.c'],['../group__group__kvstore.html#gad2327026f8f741835d012aa0a1f60f14',1,'mtb_kvstore_read(mtb_kvstore_t *obj, const char *key, uint8_t *data, uint32_t *size): mtb_kvstore.c']]], 9 | ['mtb_5fkvstore_5fread_5fpartial_6',['mtb_kvstore_read_partial',['../group__group__kvstore.html#gadd5125b0adf2ef5a4afc39851aeaa288',1,'mtb_kvstore_read_partial(mtb_kvstore_t *obj, const char *key, uint8_t *data, uint32_t *size, const uint32_t offset_bytes): mtb_kvstore.c'],['../group__group__kvstore.html#gadd5125b0adf2ef5a4afc39851aeaa288',1,'mtb_kvstore_read_partial(mtb_kvstore_t *obj, const char *key, uint8_t *data, uint32_t *size, const uint32_t offset_bytes): mtb_kvstore.c']]], 10 | ['mtb_5fkvstore_5fremaining_5fsize_7',['mtb_kvstore_remaining_size',['../group__group__kvstore.html#ga51591921642d49be5e5c8a9814bebd39',1,'mtb_kvstore_remaining_size(mtb_kvstore_t *obj): mtb_kvstore.c'],['../group__group__kvstore.html#ga51591921642d49be5e5c8a9814bebd39',1,'mtb_kvstore_remaining_size(mtb_kvstore_t *obj): mtb_kvstore.c']]], 11 | ['mtb_5fkvstore_5freset_8',['mtb_kvstore_reset',['../group__group__kvstore.html#ga5dc849717a6e3c8b7803fe2224cc6df1',1,'mtb_kvstore_reset(mtb_kvstore_t *obj): mtb_kvstore.c'],['../group__group__kvstore.html#ga5dc849717a6e3c8b7803fe2224cc6df1',1,'mtb_kvstore_reset(mtb_kvstore_t *obj): mtb_kvstore.c']]], 12 | ['mtb_5fkvstore_5fsize_9',['mtb_kvstore_size',['../group__group__kvstore.html#ga543e217c6dad81778e1fc9926e28f23f',1,'mtb_kvstore_size(mtb_kvstore_t *obj): mtb_kvstore.c'],['../group__group__kvstore.html#ga543e217c6dad81778e1fc9926e28f23f',1,'mtb_kvstore_size(mtb_kvstore_t *obj): mtb_kvstore.c']]], 13 | ['mtb_5fkvstore_5fvalue_5fsize_10',['mtb_kvstore_value_size',['../group__group__kvstore.html#gafd3c856a28b4a326f6e2982f0d18b6dc',1,'mtb_kvstore_value_size(mtb_kvstore_t *obj, const char *key, uint32_t *size): mtb_kvstore.c'],['../group__group__kvstore.html#gafd3c856a28b4a326f6e2982f0d18b6dc',1,'mtb_kvstore_value_size(mtb_kvstore_t *obj, const char *key, uint32_t *size): mtb_kvstore.c']]], 14 | ['mtb_5fkvstore_5fwrite_11',['mtb_kvstore_write',['../group__group__kvstore.html#ga209eef7f4603173449de48d3d4775835',1,'mtb_kvstore_write(mtb_kvstore_t *obj, const char *key, const uint8_t *data, uint32_t size): mtb_kvstore.c'],['../group__group__kvstore.html#ga209eef7f4603173449de48d3d4775835',1,'mtb_kvstore_write(mtb_kvstore_t *obj, const char *key, const uint8_t *data, uint32_t size): mtb_kvstore.c']]] 15 | ]; 16 | -------------------------------------------------------------------------------- /docs/html/search/groups_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
    12 |
    Loading...
    13 |
    14 | 19 |
    Searching...
    20 |
    No Matches
    21 | 35 |
    36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/groups_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['key_20value_20storage_20library_0',['Key Value Storage Library',['../group__group__kvstore.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/search/mag_sel.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 22 | 24 | image/svg+xml 25 | 27 | 28 | 29 | 30 | 31 | 33 | 57 | 63 | 69 | 74 | 75 | -------------------------------------------------------------------------------- /docs/html/search/nomatches.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
    10 |
    No Matches
    11 |
    12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/html/search/pages_0.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
    12 |
    Loading...
    13 |
    14 | 19 |
    Searching...
    20 |
    No Matches
    21 | 35 |
    36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/pages_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['key_20value_20storage_20library_0',['Key Value Storage Library',['../index.html',1,'']]] 4 | ]; 5 | -------------------------------------------------------------------------------- /docs/html/search/search.css: -------------------------------------------------------------------------------- 1 | /*---------------- Search Box */ 2 | 3 | #MSearchBox { 4 | white-space : nowrap; 5 | background: white; 6 | border-radius: 0.65em; 7 | box-shadow: inset 0.5px 0.5px 3px 0px #555; 8 | z-index: 102; 9 | } 10 | 11 | #MSearchBox .left { 12 | display: inline-block; 13 | vertical-align: middle; 14 | height: 1.4em; 15 | } 16 | 17 | #MSearchSelect { 18 | display: inline-block; 19 | vertical-align: middle; 20 | height: 19px; 21 | padding: 0 0 0 0.3em; 22 | margin: 0; 23 | } 24 | 25 | #MSearchField { 26 | display: inline-block; 27 | vertical-align: middle; 28 | width: 7.5em; 29 | height: 19px; 30 | margin: 0 0.15em; 31 | padding: 0; 32 | line-height: 1em; 33 | border:none; 34 | color: #909090; 35 | outline: none; 36 | font-family: Arial, Verdana, sans-serif; 37 | -webkit-border-radius: 0px; 38 | border-radius: 0px; 39 | background: none; 40 | } 41 | 42 | @media(hover: none) { 43 | /* to avoid zooming on iOS */ 44 | #MSearchField { 45 | font-size: 16px; 46 | } 47 | } 48 | 49 | #MSearchBox .right { 50 | display: inline-block; 51 | vertical-align: middle; 52 | width: 1.4em; 53 | height: 1.4em; 54 | } 55 | 56 | #MSearchClose { 57 | display: none; 58 | font-size: inherit; 59 | background : none; 60 | border: none; 61 | margin: 0; 62 | padding: 0; 63 | outline: none; 64 | 65 | } 66 | 67 | #MSearchCloseImg { 68 | height: 1.4em; 69 | padding: 0.3em; 70 | margin: 0; 71 | } 72 | 73 | .MSearchBoxActive #MSearchField { 74 | color: #000000; 75 | } 76 | 77 | #main-menu > li:last-child { 78 | /* This
  • object is the parent of the search bar */ 79 | display: flex; 80 | justify-content: center; 81 | align-items: center; 82 | height: 36px; 83 | margin-right: 1em; 84 | } 85 | 86 | /*---------------- Search filter selection */ 87 | 88 | #MSearchSelectWindow { 89 | display: none; 90 | position: absolute; 91 | left: 0; top: 0; 92 | border: 1px solid #90A5CE; 93 | background-color: #F9FAFC; 94 | z-index: 10001; 95 | padding-top: 4px; 96 | padding-bottom: 4px; 97 | -moz-border-radius: 4px; 98 | -webkit-border-top-left-radius: 4px; 99 | -webkit-border-top-right-radius: 4px; 100 | -webkit-border-bottom-left-radius: 4px; 101 | -webkit-border-bottom-right-radius: 4px; 102 | -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.15); 103 | } 104 | 105 | .SelectItem { 106 | font: 8pt Arial, Verdana, sans-serif; 107 | padding-left: 2px; 108 | padding-right: 12px; 109 | border: 0px; 110 | } 111 | 112 | span.SelectionMark { 113 | margin-right: 4px; 114 | font-family: monospace; 115 | outline-style: none; 116 | text-decoration: none; 117 | } 118 | 119 | a.SelectItem { 120 | display: block; 121 | outline-style: none; 122 | color: #000000; 123 | text-decoration: none; 124 | padding-left: 6px; 125 | padding-right: 12px; 126 | } 127 | 128 | a.SelectItem:focus, 129 | a.SelectItem:active { 130 | color: #000000; 131 | outline-style: none; 132 | text-decoration: none; 133 | } 134 | 135 | a.SelectItem:hover { 136 | color: #FFFFFF; 137 | background-color: #3D578C; 138 | outline-style: none; 139 | text-decoration: none; 140 | cursor: pointer; 141 | display: block; 142 | } 143 | 144 | /*---------------- Search results window */ 145 | 146 | iframe#MSearchResults { 147 | /*width: 60ex;*/ 148 | height: 15em; 149 | } 150 | 151 | #MSearchResultsWindow { 152 | display: none; 153 | position: absolute; 154 | left: 0; top: 0; 155 | border: 1px solid #000; 156 | background-color: #EEF1F7; 157 | z-index:10000; 158 | } 159 | 160 | /* ----------------------------------- */ 161 | 162 | 163 | #SRIndex { 164 | clear:both; 165 | padding-bottom: 15px; 166 | } 167 | 168 | .SREntry { 169 | font-size: 10pt; 170 | padding-left: 1ex; 171 | } 172 | 173 | .SRPage .SREntry { 174 | font-size: 8pt; 175 | padding: 1px 5px; 176 | } 177 | 178 | body.SRPage { 179 | margin: 5px 2px; 180 | } 181 | 182 | .SRChildren { 183 | padding-left: 3ex; padding-bottom: .5em 184 | } 185 | 186 | .SRPage .SRChildren { 187 | display: none; 188 | } 189 | 190 | .SRSymbol { 191 | font-weight: bold; 192 | color: #425E97; 193 | font-family: Arial, Verdana, sans-serif; 194 | text-decoration: none; 195 | outline: none; 196 | } 197 | 198 | a.SRScope { 199 | display: block; 200 | color: #425E97; 201 | font-family: Arial, Verdana, sans-serif; 202 | text-decoration: none; 203 | outline: none; 204 | } 205 | 206 | a.SRSymbol:focus, a.SRSymbol:active, 207 | a.SRScope:focus, a.SRScope:active { 208 | text-decoration: underline; 209 | } 210 | 211 | span.SRScope { 212 | padding-left: 4px; 213 | font-family: Arial, Verdana, sans-serif; 214 | } 215 | 216 | .SRPage .SRStatus { 217 | padding: 2px 5px; 218 | font-size: 8pt; 219 | font-style: italic; 220 | font-family: Arial, Verdana, sans-serif; 221 | } 222 | 223 | .SRResult { 224 | display: none; 225 | } 226 | 227 | div.searchresults { 228 | margin-left: 10px; 229 | margin-right: 10px; 230 | } 231 | 232 | /*---------------- External search page results */ 233 | 234 | .searchresult { 235 | background-color: #F0F3F8; 236 | } 237 | 238 | .pages b { 239 | color: white; 240 | padding: 5px 5px 3px 5px; 241 | background-image: url("../tab_a.png"); 242 | background-repeat: repeat-x; 243 | text-shadow: 0 1px 1px #000000; 244 | } 245 | 246 | .pages { 247 | line-height: 17px; 248 | margin-left: 4px; 249 | text-decoration: none; 250 | } 251 | 252 | .hl { 253 | font-weight: bold; 254 | } 255 | 256 | #searchresults { 257 | margin-bottom: 20px; 258 | } 259 | 260 | .searchpages { 261 | margin-top: 10px; 262 | } 263 | 264 | -------------------------------------------------------------------------------- /docs/html/search/search.js: -------------------------------------------------------------------------------- 1 | /* 2 | @licstart The following is the entire license notice for the JavaScript code in this file. 3 | 4 | The MIT License (MIT) 5 | 6 | Copyright (C) 1997-2020 by Dimitri van Heesch 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 9 | and associated documentation files (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, publish, distribute, 11 | sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in all copies or 15 | substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 18 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 20 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | 23 | @licend The above is the entire license notice for the JavaScript code in this file 24 | */ 25 | function convertToId(search) 26 | { 27 | var result = ''; 28 | for (i=0;i do a search 270 | { 271 | this.Search(); 272 | } 273 | } 274 | 275 | this.OnSearchSelectKey = function(evt) 276 | { 277 | var e = (evt) ? evt : window.event; // for IE 278 | if (e.keyCode==40 && this.searchIndex0) // Up 284 | { 285 | this.searchIndex--; 286 | this.OnSelectItem(this.searchIndex); 287 | } 288 | else if (e.keyCode==13 || e.keyCode==27) 289 | { 290 | this.OnSelectItem(this.searchIndex); 291 | this.CloseSelectionWindow(); 292 | this.DOMSearchField().focus(); 293 | } 294 | return false; 295 | } 296 | 297 | // --------- Actions 298 | 299 | // Closes the results window. 300 | this.CloseResultsWindow = function() 301 | { 302 | this.DOMPopupSearchResultsWindow().style.display = 'none'; 303 | this.DOMSearchClose().style.display = 'none'; 304 | this.Activate(false); 305 | } 306 | 307 | this.CloseSelectionWindow = function() 308 | { 309 | this.DOMSearchSelectWindow().style.display = 'none'; 310 | } 311 | 312 | // Performs a search. 313 | this.Search = function() 314 | { 315 | this.keyTimeout = 0; 316 | 317 | // strip leading whitespace 318 | var searchValue = this.DOMSearchField().value.replace(/^ +/, ""); 319 | 320 | var code = searchValue.toLowerCase().charCodeAt(0); 321 | var idxChar = searchValue.substr(0, 1).toLowerCase(); 322 | if ( 0xD800 <= code && code <= 0xDBFF && searchValue > 1) // surrogate pair 323 | { 324 | idxChar = searchValue.substr(0, 2); 325 | } 326 | 327 | var resultsPage; 328 | var resultsPageWithSearch; 329 | var hasResultsPage; 330 | 331 | var idx = indexSectionsWithContent[this.searchIndex].indexOf(idxChar); 332 | if (idx!=-1) 333 | { 334 | var hexCode=idx.toString(16); 335 | resultsPage = this.resultsPath + '/' + indexSectionNames[this.searchIndex] + '_' + hexCode + this.extension; 336 | resultsPageWithSearch = resultsPage+'?'+escape(searchValue); 337 | hasResultsPage = true; 338 | } 339 | else // nothing available for this search term 340 | { 341 | resultsPage = this.resultsPath + '/nomatches' + this.extension; 342 | resultsPageWithSearch = resultsPage; 343 | hasResultsPage = false; 344 | } 345 | 346 | window.frames.MSearchResults.location = resultsPageWithSearch; 347 | var domPopupSearchResultsWindow = this.DOMPopupSearchResultsWindow(); 348 | 349 | if (domPopupSearchResultsWindow.style.display!='block') 350 | { 351 | var domSearchBox = this.DOMSearchBox(); 352 | this.DOMSearchClose().style.display = 'inline-block'; 353 | var domPopupSearchResults = this.DOMPopupSearchResults(); 354 | var left = getXPos(domSearchBox) + 150; // domSearchBox.offsetWidth; 355 | var top = getYPos(domSearchBox) + 20; // domSearchBox.offsetHeight + 1; 356 | domPopupSearchResultsWindow.style.display = 'block'; 357 | left -= domPopupSearchResults.offsetWidth; 358 | var maxWidth = document.body.clientWidth; 359 | var width = 400; 360 | if (left<10) left=10; 361 | if (width+left+8>maxWidth) width=maxWidth-left-8; 362 | domPopupSearchResultsWindow.style.top = top + 'px'; 363 | domPopupSearchResultsWindow.style.left = left + 'px'; 364 | domPopupSearchResultsWindow.style.width = width + 'px'; 365 | } 366 | 367 | this.lastSearchValue = searchValue; 368 | this.lastResultsPage = resultsPage; 369 | } 370 | 371 | // -------- Activation Functions 372 | 373 | // Activates or deactivates the search panel, resetting things to 374 | // their default values if necessary. 375 | this.Activate = function(isActive) 376 | { 377 | if (isActive || // open it 378 | this.DOMPopupSearchResultsWindow().style.display == 'block' 379 | ) 380 | { 381 | this.DOMSearchBox().className = 'MSearchBoxActive'; 382 | 383 | var searchField = this.DOMSearchField(); 384 | 385 | if (searchField.value == this.searchLabel) // clear "Search" term upon entry 386 | { 387 | searchField.value = ''; 388 | this.searchActive = true; 389 | } 390 | } 391 | else if (!isActive) // directly remove the panel 392 | { 393 | this.DOMSearchBox().className = 'MSearchBoxInactive'; 394 | this.DOMSearchField().value = this.searchLabel; 395 | this.searchActive = false; 396 | this.lastSearchValue = '' 397 | this.lastResultsPage = ''; 398 | } 399 | } 400 | } 401 | 402 | // ----------------------------------------------------------------------- 403 | 404 | // The class that handles everything on the search results page. 405 | function SearchResults(name) 406 | { 407 | // The number of matches from the last run of . 408 | this.lastMatchCount = 0; 409 | this.lastKey = 0; 410 | this.repeatOn = false; 411 | 412 | // Toggles the visibility of the passed element ID. 413 | this.FindChildElement = function(id) 414 | { 415 | var parentElement = document.getElementById(id); 416 | var element = parentElement.firstChild; 417 | 418 | while (element && element!=parentElement) 419 | { 420 | if (element.nodeName.toLowerCase() == 'div' && element.className == 'SRChildren') 421 | { 422 | return element; 423 | } 424 | 425 | if (element.nodeName.toLowerCase() == 'div' && element.hasChildNodes()) 426 | { 427 | element = element.firstChild; 428 | } 429 | else if (element.nextSibling) 430 | { 431 | element = element.nextSibling; 432 | } 433 | else 434 | { 435 | do 436 | { 437 | element = element.parentNode; 438 | } 439 | while (element && element!=parentElement && !element.nextSibling); 440 | 441 | if (element && element!=parentElement) 442 | { 443 | element = element.nextSibling; 444 | } 445 | } 446 | } 447 | } 448 | 449 | this.Toggle = function(id) 450 | { 451 | var element = this.FindChildElement(id); 452 | if (element) 453 | { 454 | if (element.style.display == 'block') 455 | { 456 | element.style.display = 'none'; 457 | } 458 | else 459 | { 460 | element.style.display = 'block'; 461 | } 462 | } 463 | } 464 | 465 | // Searches for the passed string. If there is no parameter, 466 | // it takes it from the URL query. 467 | // 468 | // Always returns true, since other documents may try to call it 469 | // and that may or may not be possible. 470 | this.Search = function(search) 471 | { 472 | if (!search) // get search word from URL 473 | { 474 | search = window.location.search; 475 | search = search.substring(1); // Remove the leading '?' 476 | search = unescape(search); 477 | } 478 | 479 | search = search.replace(/^ +/, ""); // strip leading spaces 480 | search = search.replace(/ +$/, ""); // strip trailing spaces 481 | search = search.toLowerCase(); 482 | search = convertToId(search); 483 | 484 | var resultRows = document.getElementsByTagName("div"); 485 | var matches = 0; 486 | 487 | var i = 0; 488 | while (i < resultRows.length) 489 | { 490 | var row = resultRows.item(i); 491 | if (row.className == "SRResult") 492 | { 493 | var rowMatchName = row.id.toLowerCase(); 494 | rowMatchName = rowMatchName.replace(/^sr\d*_/, ''); // strip 'sr123_' 495 | 496 | if (search.length<=rowMatchName.length && 497 | rowMatchName.substr(0, search.length)==search) 498 | { 499 | row.style.display = 'block'; 500 | matches++; 501 | } 502 | else 503 | { 504 | row.style.display = 'none'; 505 | } 506 | } 507 | i++; 508 | } 509 | document.getElementById("Searching").style.display='none'; 510 | if (matches == 0) // no results 511 | { 512 | document.getElementById("NoMatches").style.display='block'; 513 | } 514 | else // at least one result 515 | { 516 | document.getElementById("NoMatches").style.display='none'; 517 | } 518 | this.lastMatchCount = matches; 519 | return true; 520 | } 521 | 522 | // return the first item with index index or higher that is visible 523 | this.NavNext = function(index) 524 | { 525 | var focusItem; 526 | while (1) 527 | { 528 | var focusName = 'Item'+index; 529 | focusItem = document.getElementById(focusName); 530 | if (focusItem && focusItem.parentNode.parentNode.style.display=='block') 531 | { 532 | break; 533 | } 534 | else if (!focusItem) // last element 535 | { 536 | break; 537 | } 538 | focusItem=null; 539 | index++; 540 | } 541 | return focusItem; 542 | } 543 | 544 | this.NavPrev = function(index) 545 | { 546 | var focusItem; 547 | while (1) 548 | { 549 | var focusName = 'Item'+index; 550 | focusItem = document.getElementById(focusName); 551 | if (focusItem && focusItem.parentNode.parentNode.style.display=='block') 552 | { 553 | break; 554 | } 555 | else if (!focusItem) // last element 556 | { 557 | break; 558 | } 559 | focusItem=null; 560 | index--; 561 | } 562 | return focusItem; 563 | } 564 | 565 | this.ProcessKeys = function(e) 566 | { 567 | if (e.type == "keydown") 568 | { 569 | this.repeatOn = false; 570 | this.lastKey = e.keyCode; 571 | } 572 | else if (e.type == "keypress") 573 | { 574 | if (!this.repeatOn) 575 | { 576 | if (this.lastKey) this.repeatOn = true; 577 | return false; // ignore first keypress after keydown 578 | } 579 | } 580 | else if (e.type == "keyup") 581 | { 582 | this.lastKey = 0; 583 | this.repeatOn = false; 584 | } 585 | return this.lastKey!=0; 586 | } 587 | 588 | this.Nav = function(evt,itemIndex) 589 | { 590 | var e = (evt) ? evt : window.event; // for IE 591 | if (e.keyCode==13) return true; 592 | if (!this.ProcessKeys(e)) return false; 593 | 594 | if (this.lastKey==38) // Up 595 | { 596 | var newIndex = itemIndex-1; 597 | var focusItem = this.NavPrev(newIndex); 598 | if (focusItem) 599 | { 600 | var child = this.FindChildElement(focusItem.parentNode.parentNode.id); 601 | if (child && child.style.display == 'block') // children visible 602 | { 603 | var n=0; 604 | var tmpElem; 605 | while (1) // search for last child 606 | { 607 | tmpElem = document.getElementById('Item'+newIndex+'_c'+n); 608 | if (tmpElem) 609 | { 610 | focusItem = tmpElem; 611 | } 612 | else // found it! 613 | { 614 | break; 615 | } 616 | n++; 617 | } 618 | } 619 | } 620 | if (focusItem) 621 | { 622 | focusItem.focus(); 623 | } 624 | else // return focus to search field 625 | { 626 | parent.document.getElementById("MSearchField").focus(); 627 | } 628 | } 629 | else if (this.lastKey==40) // Down 630 | { 631 | var newIndex = itemIndex+1; 632 | var focusItem; 633 | var item = document.getElementById('Item'+itemIndex); 634 | var elem = this.FindChildElement(item.parentNode.parentNode.id); 635 | if (elem && elem.style.display == 'block') // children visible 636 | { 637 | focusItem = document.getElementById('Item'+itemIndex+'_c0'); 638 | } 639 | if (!focusItem) focusItem = this.NavNext(newIndex); 640 | if (focusItem) focusItem.focus(); 641 | } 642 | else if (this.lastKey==39) // Right 643 | { 644 | var item = document.getElementById('Item'+itemIndex); 645 | var elem = this.FindChildElement(item.parentNode.parentNode.id); 646 | if (elem) elem.style.display = 'block'; 647 | } 648 | else if (this.lastKey==37) // Left 649 | { 650 | var item = document.getElementById('Item'+itemIndex); 651 | var elem = this.FindChildElement(item.parentNode.parentNode.id); 652 | if (elem) elem.style.display = 'none'; 653 | } 654 | else if (this.lastKey==27) // Escape 655 | { 656 | parent.searchBox.CloseResultsWindow(); 657 | parent.document.getElementById("MSearchField").focus(); 658 | } 659 | else if (this.lastKey==13) // Enter 660 | { 661 | return true; 662 | } 663 | return false; 664 | } 665 | 666 | this.NavChild = function(evt,itemIndex,childIndex) 667 | { 668 | var e = (evt) ? evt : window.event; // for IE 669 | if (e.keyCode==13) return true; 670 | if (!this.ProcessKeys(e)) return false; 671 | 672 | if (this.lastKey==38) // Up 673 | { 674 | if (childIndex>0) 675 | { 676 | var newIndex = childIndex-1; 677 | document.getElementById('Item'+itemIndex+'_c'+newIndex).focus(); 678 | } 679 | else // already at first child, jump to parent 680 | { 681 | document.getElementById('Item'+itemIndex).focus(); 682 | } 683 | } 684 | else if (this.lastKey==40) // Down 685 | { 686 | var newIndex = childIndex+1; 687 | var elem = document.getElementById('Item'+itemIndex+'_c'+newIndex); 688 | if (!elem) // last child, jump to parent next parent 689 | { 690 | elem = this.NavNext(itemIndex+1); 691 | } 692 | if (elem) 693 | { 694 | elem.focus(); 695 | } 696 | } 697 | else if (this.lastKey==27) // Escape 698 | { 699 | parent.searchBox.CloseResultsWindow(); 700 | parent.document.getElementById("MSearchField").focus(); 701 | } 702 | else if (this.lastKey==13) // Enter 703 | { 704 | return true; 705 | } 706 | return false; 707 | } 708 | } 709 | 710 | function setKeyActions(elem,action) 711 | { 712 | elem.setAttribute('onkeydown',action); 713 | elem.setAttribute('onkeypress',action); 714 | elem.setAttribute('onkeyup',action); 715 | } 716 | 717 | function setClassAttr(elem,attr) 718 | { 719 | elem.setAttribute('class',attr); 720 | elem.setAttribute('className',attr); 721 | } 722 | 723 | function createResults() 724 | { 725 | var results = document.getElementById("SRResults"); 726 | for (var e=0; e 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
    12 |
    Loading...
    13 |
    14 | 19 |
    Searching...
    20 |
    No Matches
    21 | 35 |
    36 | 37 | 38 | -------------------------------------------------------------------------------- /docs/html/search/typedefs_0.js: -------------------------------------------------------------------------------- 1 | var searchData= 2 | [ 3 | ['mtb_5fkvstore_5fallocate_5fmemory_5ft_0',['mtb_kvstore_allocate_memory_t',['../group__group__kvstore.html#gaf4640989209ce778da48555edeb7f531',1,'mtb_kvstore.h']]], 4 | ['mtb_5fkvstore_5fbd_5ferase_1',['mtb_kvstore_bd_erase',['../group__group__kvstore.html#ga8eee071bb3809130b77fb7c8f69e7a67',1,'mtb_kvstore.h']]], 5 | ['mtb_5fkvstore_5fbd_5ferase_5fsize_2',['mtb_kvstore_bd_erase_size',['../group__group__kvstore.html#ga9dcd451cefcdae7d7063aa2e173b948b',1,'mtb_kvstore.h']]], 6 | ['mtb_5fkvstore_5fbd_5fprogram_3',['mtb_kvstore_bd_program',['../group__group__kvstore.html#gaa832bac0e2f7b15478abb73ae8631b8d',1,'mtb_kvstore.h']]], 7 | ['mtb_5fkvstore_5fbd_5fprogram_5fsize_4',['mtb_kvstore_bd_program_size',['../group__group__kvstore.html#ga33782352587721d63e4ca26f35558d90',1,'mtb_kvstore.h']]], 8 | ['mtb_5fkvstore_5fbd_5fread_5',['mtb_kvstore_bd_read',['../group__group__kvstore.html#gacccba62e614b1ebb309dc312b7b67e3a',1,'mtb_kvstore.h']]], 9 | ['mtb_5fkvstore_5fbd_5fread_5fsize_6',['mtb_kvstore_bd_read_size',['../group__group__kvstore.html#ga4d03d5b99d6254298f9eaefb0978170f',1,'mtb_kvstore.h']]], 10 | ['mtb_5fkvstore_5ffree_5fmemory_5ft_7',['mtb_kvstore_free_memory_t',['../group__group__kvstore.html#gacc6ed573c4d9f8c441bd4605d26ddd81',1,'mtb_kvstore.h']]] 11 | ]; 12 | -------------------------------------------------------------------------------- /docs/html/splitbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/kv-store/4d683fc825313bcbf0fa158b2da6bf842420c5e2/docs/html/splitbar.png -------------------------------------------------------------------------------- /docs/html/sync_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/kv-store/4d683fc825313bcbf0fa158b2da6bf842420c5e2/docs/html/sync_off.png -------------------------------------------------------------------------------- /docs/html/sync_on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/kv-store/4d683fc825313bcbf0fa158b2da6bf842420c5e2/docs/html/sync_on.png -------------------------------------------------------------------------------- /docs/html/tab_a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/kv-store/4d683fc825313bcbf0fa158b2da6bf842420c5e2/docs/html/tab_a.png -------------------------------------------------------------------------------- /docs/html/tab_b.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/kv-store/4d683fc825313bcbf0fa158b2da6bf842420c5e2/docs/html/tab_b.png -------------------------------------------------------------------------------- /docs/html/tab_h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/kv-store/4d683fc825313bcbf0fa158b2da6bf842420c5e2/docs/html/tab_h.png -------------------------------------------------------------------------------- /docs/html/tab_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Infineon/kv-store/4d683fc825313bcbf0fa158b2da6bf842420c5e2/docs/html/tab_s.png -------------------------------------------------------------------------------- /docs/html/tabs.css: -------------------------------------------------------------------------------- 1 | .sm{position:relative;z-index:9999}.sm,.sm ul,.sm li{display:block;list-style:none;margin:0;padding:0;line-height:normal;direction:ltr;text-align:left;-webkit-tap-highlight-color:rgba(0,0,0,0)}.sm-rtl,.sm-rtl ul,.sm-rtl li{direction:rtl;text-align:right}.sm>li>h1,.sm>li>h2,.sm>li>h3,.sm>li>h4,.sm>li>h5,.sm>li>h6{margin:0;padding:0}.sm ul{display:none}.sm li,.sm a{position:relative}.sm a{display:block}.sm a.disabled{cursor:not-allowed}.sm:after{content:"\00a0";display:block;height:0;font:0/0 serif;clear:both;visibility:hidden;overflow:hidden}.sm,.sm *,.sm *:before,.sm *:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.main-menu-btn{position:relative;display:inline-block;width:36px;height:36px;text-indent:36px;margin-left:8px;white-space:nowrap;overflow:hidden;cursor:pointer;-webkit-tap-highlight-color:rgba(0,0,0,0)}.main-menu-btn-icon,.main-menu-btn-icon:before,.main-menu-btn-icon:after{position:absolute;top:50%;left:2px;height:2px;width:24px;background:#666;-webkit-transition:all .25s;transition:all .25s}.main-menu-btn-icon:before{content:'';top:-7px;left:0}.main-menu-btn-icon:after{content:'';top:7px;left:0}#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon{height:0}#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon:before{top:0;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}#main-menu-state:checked ~ .main-menu-btn .main-menu-btn-icon:after{top:0;-webkit-transform:rotate(45deg);transform:rotate(45deg)}#main-menu-state{position:absolute;width:1px;height:1px;margin:-1px;border:0;padding:0;overflow:hidden;clip:rect(1px,1px,1px,1px)}#main-menu-state:not(:checked) ~ #main-menu{display:none}#main-menu-state:checked ~ #main-menu{display:block}@media(min-width:768px){.main-menu-btn{position:absolute;top:-99999px}#main-menu-state:not(:checked) ~ #main-menu{display:block}}.sm-dox{background-image:url("tab_b.png")}.sm-dox a,.sm-dox a:focus,.sm-dox a:hover,.sm-dox a:active{padding:0 12px;padding-right:43px;font-family:"Lucida Grande","Geneva","Helvetica",Arial,sans-serif;font-size:13px;font-weight:bold;line-height:36px;text-decoration:none;text-shadow:0 1px 1px rgba(255,255,255,0.9);color:#283a5d;outline:0}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox a.current{color:#d23600}.sm-dox a.disabled{color:#bbb}.sm-dox a span.sub-arrow{position:absolute;top:50%;margin-top:-14px;left:auto;right:3px;width:28px;height:28px;overflow:hidden;font:bold 12px/28px monospace !important;text-align:center;text-shadow:none;background:rgba(255,255,255,0.5);-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox a span.sub-arrow:before{display:block;content:'+'}.sm-dox a.highlighted span.sub-arrow:before{display:block;content:'-'}.sm-dox>li:first-child>a,.sm-dox>li:first-child>:not(ul) a{-moz-border-radius:5px 5px 0 0;-webkit-border-radius:5px;border-radius:5px 5px 0 0}.sm-dox>li:last-child>a,.sm-dox>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul{-moz-border-radius:0 0 5px 5px;-webkit-border-radius:0;border-radius:0 0 5px 5px}.sm-dox>li:last-child>a.highlighted,.sm-dox>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>a.highlighted,.sm-dox>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>ul>li:last-child>*:not(ul) a.highlighted{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox ul{background:rgba(162,162,162,0.1)}.sm-dox ul a,.sm-dox ul a:focus,.sm-dox ul a:hover,.sm-dox ul a:active{font-size:12px;border-left:8px solid transparent;line-height:36px;text-shadow:none;background-color:white;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox ul ul a,.sm-dox ul ul a:hover,.sm-dox ul ul a:focus,.sm-dox ul ul a:active{border-left:16px solid transparent}.sm-dox ul ul ul a,.sm-dox ul ul ul a:hover,.sm-dox ul ul ul a:focus,.sm-dox ul ul ul a:active{border-left:24px solid transparent}.sm-dox ul ul ul ul a,.sm-dox ul ul ul ul a:hover,.sm-dox ul ul ul ul a:focus,.sm-dox ul ul ul ul a:active{border-left:32px solid transparent}.sm-dox ul ul ul ul ul a,.sm-dox ul ul ul ul ul a:hover,.sm-dox ul ul ul ul ul a:focus,.sm-dox ul ul ul ul ul a:active{border-left:40px solid transparent}@media(min-width:768px){.sm-dox ul{position:absolute;width:12em}.sm-dox li{float:left}.sm-dox.sm-rtl li{float:right}.sm-dox ul li,.sm-dox.sm-rtl ul li,.sm-dox.sm-vertical li{float:none}.sm-dox a{white-space:nowrap}.sm-dox ul a,.sm-dox.sm-vertical a{white-space:normal}.sm-dox .sm-nowrap>li>a,.sm-dox .sm-nowrap>li>:not(ul) a{white-space:nowrap}.sm-dox{padding:0 10px;background-image:url("tab_b.png");line-height:36px}.sm-dox a span.sub-arrow{top:50%;margin-top:-2px;right:12px;width:0;height:0;border-width:4px;border-style:solid dashed dashed dashed;border-color:#283a5d transparent transparent transparent;background:transparent;-moz-border-radius:0;-webkit-border-radius:0;border-radius:0}.sm-dox a,.sm-dox a:focus,.sm-dox a:active,.sm-dox a:hover,.sm-dox a.highlighted{padding:0 12px;background-image:url("tab_s.png");background-repeat:no-repeat;background-position:right;-moz-border-radius:0 !important;-webkit-border-radius:0;border-radius:0 !important}.sm-dox a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox a:hover span.sub-arrow{border-color:white transparent transparent transparent}.sm-dox a.has-submenu{padding-right:24px}.sm-dox li{border-top:0}.sm-dox>li>ul:before,.sm-dox>li>ul:after{content:'';position:absolute;top:-18px;left:30px;width:0;height:0;overflow:hidden;border-width:9px;border-style:dashed dashed solid dashed;border-color:transparent transparent #bbb transparent}.sm-dox>li>ul:after{top:-16px;left:31px;border-width:8px;border-color:transparent transparent #fff transparent}.sm-dox ul{border:1px solid #bbb;padding:5px 0;background:#fff;-moz-border-radius:5px !important;-webkit-border-radius:5px;border-radius:5px !important;-moz-box-shadow:0 5px 9px rgba(0,0,0,0.2);-webkit-box-shadow:0 5px 9px rgba(0,0,0,0.2);box-shadow:0 5px 9px rgba(0,0,0,0.2)}.sm-dox ul a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-color:transparent transparent transparent #555;border-style:dashed dashed dashed solid}.sm-dox ul a,.sm-dox ul a:hover,.sm-dox ul a:focus,.sm-dox ul a:active,.sm-dox ul a.highlighted{color:#555;background-image:none;border:0 !important;color:#555;background-image:none}.sm-dox ul a:hover{background-image:url("tab_a.png");background-repeat:repeat-x;color:white;text-shadow:0 1px 1px black}.sm-dox ul a:hover span.sub-arrow{border-color:transparent transparent transparent white}.sm-dox span.scroll-up,.sm-dox span.scroll-down{position:absolute;display:none;visibility:hidden;overflow:hidden;background:#fff;height:36px}.sm-dox span.scroll-up:hover,.sm-dox span.scroll-down:hover{background:#eee}.sm-dox span.scroll-up:hover span.scroll-up-arrow,.sm-dox span.scroll-up:hover span.scroll-down-arrow{border-color:transparent transparent #d23600 transparent}.sm-dox span.scroll-down:hover span.scroll-down-arrow{border-color:#d23600 transparent transparent transparent}.sm-dox span.scroll-up-arrow,.sm-dox span.scroll-down-arrow{position:absolute;top:0;left:50%;margin-left:-6px;width:0;height:0;overflow:hidden;border-width:6px;border-style:dashed dashed solid dashed;border-color:transparent transparent #555 transparent}.sm-dox span.scroll-down-arrow{top:8px;border-style:solid dashed dashed dashed;border-color:#555 transparent transparent transparent}.sm-dox.sm-rtl a.has-submenu{padding-right:12px;padding-left:24px}.sm-dox.sm-rtl a span.sub-arrow{right:auto;left:12px}.sm-dox.sm-rtl.sm-vertical a.has-submenu{padding:10px 20px}.sm-dox.sm-rtl.sm-vertical a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-rtl>li>ul:before{left:auto;right:30px}.sm-dox.sm-rtl>li>ul:after{left:auto;right:31px}.sm-dox.sm-rtl ul a.has-submenu{padding:10px 20px !important}.sm-dox.sm-rtl ul a span.sub-arrow{right:auto;left:8px;border-style:dashed solid dashed dashed;border-color:transparent #555 transparent transparent}.sm-dox.sm-vertical{padding:10px 0;-moz-border-radius:5px;-webkit-border-radius:5px;border-radius:5px}.sm-dox.sm-vertical a{padding:10px 20px}.sm-dox.sm-vertical a:hover,.sm-dox.sm-vertical a:focus,.sm-dox.sm-vertical a:active,.sm-dox.sm-vertical a.highlighted{background:#fff}.sm-dox.sm-vertical a.disabled{background-image:url("tab_b.png")}.sm-dox.sm-vertical a span.sub-arrow{right:8px;top:50%;margin-top:-5px;border-width:5px;border-style:dashed dashed dashed solid;border-color:transparent transparent transparent #555}.sm-dox.sm-vertical>li>ul:before,.sm-dox.sm-vertical>li>ul:after{display:none}.sm-dox.sm-vertical ul a{padding:10px 20px}.sm-dox.sm-vertical ul a:hover,.sm-dox.sm-vertical ul a:focus,.sm-dox.sm-vertical ul a:active,.sm-dox.sm-vertical ul a.highlighted{background:#eee}.sm-dox.sm-vertical ul a.disabled{background:#fff}} -------------------------------------------------------------------------------- /include/mtb_kvstore.h: -------------------------------------------------------------------------------- 1 | /***********************************************************************************************//** 2 | * \file mtb_kvstore.h 3 | * 4 | * \brief 5 | * Utility library for storing key value pairs in memory. 6 | * 7 | *************************************************************************************************** 8 | * \copyright 9 | * Copyright 2018-2022 Cypress Semiconductor Corporation (an Infineon company) or 10 | * an affiliate of Cypress Semiconductor Corporation 11 | * 12 | * SPDX-License-Identifier: Apache-2.0 13 | * 14 | * Licensed under the Apache License, Version 2.0 (the "License"); 15 | * you may not use this file except in compliance with the License. 16 | * You may obtain a copy of the License at 17 | * 18 | * http://www.apache.org/licenses/LICENSE-2.0 19 | * 20 | * Unless required by applicable law or agreed to in writing, software 21 | * distributed under the License is distributed on an "AS IS" BASIS, 22 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 23 | * See the License for the specific language governing permissions and 24 | * limitations under the License. 25 | **************************************************************************************************/ 26 | #pragma once 27 | 28 | #include 29 | #include 30 | #include "cy_result.h" 31 | #include "mtb_block_storage.h" 32 | 33 | #if defined(CY_RTOS_AWARE) || defined(COMPONENT_RTOS_AWARE) 34 | #include "cyabs_rtos.h" 35 | #endif 36 | 37 | #if defined(__cplusplus) 38 | extern "C" { 39 | #endif 40 | 41 | /** 42 | * \addtogroup group_kvstore Key Value Storage Library 43 | * \{ 44 | * This library provides a convenient way to store information as key-value pairs in non-volatile 45 | * storage. 46 | * 47 | * \section section_kvstore_getting_started Getting Started 48 | * This section provides steps for getting started with this library by using the block 49 | * storage interface.[block-storage] (https://github.com/infineon/block-storage) 50 | * 51 | * -# Include the kv-store library header in the application. 52 | * \snippet kvstore_snip.c snippet_mtb_kvstore_include 53 | * 54 | * -# Initialize the underlying storage. This could be done using either the HAL NVM 55 | * or Serial Memory depending on the storage 56 | * - Example initialization for hal API 3.0 nvm driver 57 | * \snippet kvstore_snip.c snippet_mtb_kvstore_init_hal_nvm 58 | * - Example initialization for serial memory driver 59 | * \snippet kvstore_snip.c snippet_mtb_kvstore_init_ser_mem 60 | * - Example initialization for hal API 2.0 nvm driver 61 | * \snippet kvstore_snip.c snippet_mtb_kvstore_init_classic_hal_nvm 62 | * 63 | * -# Create the block storage interface using the HAL NVM or the serial memory.If neither the 64 | * HAL NVM nor serial memory driver is being used to communicate with the 65 | * storage device, the application must provide a custom implementation of the block device 66 | * interface. 67 | * - Example implementation using block storage HAL 3.0 NVM interface 68 | * \snippet kvstore_snip.c snippet_mtb_kvstore_bsd_create_hal_nvm 69 | * - Example implementation using block storage serial-memory interface 70 | * \snippet kvstore_snip.c snippet_mtb_kvstore_bsd_create_ser_mem 71 | * - Example implementation using block storage HAL Classic NVM interface 72 | * \snippet kvstore_snip.c snippet_mtb_kvstore_bsd_create_classic_hal_nvm 73 | * 74 | * -# Initialize the kv-store library. 75 | * - Set the start address and length. 76 | * - If using the hal-nvm driver, for this example the address space 77 | * provided starts 16 pages from the end of the nvm. Note that if 78 | * the device does not have a working flash (i.e. using main 79 | * flash) care must be taken to ensure that the space allocated below is 80 | * not used by anything else (for eg. Application image). 81 | * \snippet kvstore_snip.c snippet_mtb_kvstore_addr_len_hal_nvm 82 | * - If using the serial-memory library, for this example we define the space 83 | * provided to the kv-store library to be the size of 2 sectors. 84 | * \snippet kvstore_snip.c snippet_mtb_kvstore_addr_len_ser_mem 85 | * - Call \ref mtb_kvstore_init by passing the start address, length, block device 86 | * and the optional memory allocate and free function pointers 87 | * \snippet kvstore_snip.c snippet_mtb_kvstore_init 88 | * 89 | * -# The library should now be ready to perform operations. 90 | * - Write operation. 91 | * \snippet kvstore_snip.c snippet_mtb_kvstore_write 92 | * - Read operation. 93 | * \snippet kvstore_snip.c snippet_mtb_kvstore_read 94 | * - Delete operation. 95 | * \snippet kvstore_snip.c snippet_mtb_kvstore_delete 96 | */ 97 | 98 | #if !defined(MTB_KVSTORE_MAX_KEY_SIZE) 99 | /** Maximum key size permitted. */ 100 | #define MTB_KVSTORE_MAX_KEY_SIZE (64U) 101 | #endif 102 | 103 | #if (defined(CY_RTOS_AWARE) || defined(COMPONENT_RTOS_AWARE)) && \ 104 | !defined(MTB_KVSTORE_MUTEX_TIMEOUT_MS) 105 | /** Timeout in ms for mutex timeout when using an RTOS. */ 106 | #define MTB_KVSTORE_MUTEX_TIMEOUT_MS (50U) 107 | #endif 108 | 109 | /** When passed as an argument to \ref mtb_kvstore_ensure_capacity, 110 | * indicates that cleanup tasks should always be performed regardless 111 | * of the amount of space which is currently free, to ensure the maximum 112 | * possible amount of free space is available 113 | */ 114 | #define MTB_KVSTORE_ENSURE_MAX (0xFFFFFFFFu) 115 | 116 | /** An invalid parameter value is passed in. */ 117 | #define MTB_KVSTORE_BAD_PARAM_ERROR \ 118 | CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_MIDDLEWARE_KVSTORE, 0) 119 | /** The storage area passed in is not aligned to erase sector boundary. See 120 | * notes in \ref mtb_kvstore_init for more information on constraints. 121 | */ 122 | #define MTB_KVSTORE_ALIGNMENT_ERROR \ 123 | CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_MIDDLEWARE_KVSTORE, 1) 124 | /** Memory allocation failed. There is not enough space available on the heap. */ 125 | #define MTB_KVSTORE_MEM_ALLOC_ERROR \ 126 | CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_MIDDLEWARE_KVSTORE, 2) 127 | /** Invalid data was detected. The record may be corrupted. */ 128 | #define MTB_KVSTORE_INVALID_DATA_ERROR \ 129 | CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_MIDDLEWARE_KVSTORE, 3) 130 | /** Erased data was detected. The record may be corrupted */ 131 | #define MTB_KVSTORE_ERASED_DATA_ERROR \ 132 | CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_MIDDLEWARE_KVSTORE, 4) 133 | /** Item was not found in the storage. */ 134 | #define MTB_KVSTORE_ITEM_NOT_FOUND_ERROR \ 135 | CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_MIDDLEWARE_KVSTORE, 5) 136 | /** The storage is full. */ 137 | #define MTB_KVSTORE_STORAGE_FULL_ERROR \ 138 | CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_MIDDLEWARE_KVSTORE, 6) 139 | /** Buffer provided is too small for value found. */ 140 | #define MTB_KVSTORE_BUFFER_TOO_SMALL \ 141 | CY_RSLT_CREATE(CY_RSLT_TYPE_ERROR, CY_RSLT_MODULE_MIDDLEWARE_KVSTORE, 7) 142 | 143 | /** Function prototype for reading data from the block device. 144 | * 145 | * @param[in] context Context object that is passed into \ref mtb_kvstore_init 146 | * @param[in] addr Address to read the data from the block device. This address 147 | * is passed in as start_addr + offset. 148 | * @param[in] length Length of the data that needs to be read. 149 | * @param[out] buf Buffer to read the data. 150 | * @return Result of the read operation. 151 | */ 152 | typedef cy_rslt_t (* mtb_kvstore_bd_read)(void* context, uint32_t addr, uint32_t length, 153 | uint8_t* buf); 154 | 155 | /** Function prototype for writing data to the block device. 156 | * 157 | * @param[in] context Context object that is passed into \ref mtb_kvstore_init 158 | * @param[in] addr Address to program the data into the block device. This address 159 | * is passed in as start_addr + offset. 160 | * @param[in] length Length of the data that needs to be written 161 | * @param[out] buf Data that needs to be written 162 | * @return Result of the program operation. 163 | */ 164 | typedef cy_rslt_t (* mtb_kvstore_bd_program)(void* context, uint32_t addr, uint32_t length, 165 | const uint8_t* buf); 166 | 167 | /** Function prototype for read from the block device. 168 | * 169 | * @param[in] context Context object that is passed into \ref mtb_kvstore_init 170 | * @param[in] addr Address to read the data from the device. This address 171 | * is passed in as start_addr + offset. 172 | * @param[in] length Length of the data that needs to be erased. 173 | * @return Result of the erase operation. 174 | */ 175 | typedef cy_rslt_t (* mtb_kvstore_bd_erase)(void* context, uint32_t addr, uint32_t length); 176 | 177 | /** Function prototype to get the read size of the block device for a specific address. 178 | * 179 | * @param[in] context Context object that is passed into \ref mtb_kvstore_init 180 | * @param[in] addr Address for which the read size is queried. This address 181 | * is passed in as start_addr + offset. 182 | * @return Read size of the memory device. 183 | */ 184 | typedef uint32_t (* mtb_kvstore_bd_read_size)(void* context, uint32_t addr); 185 | 186 | /** Function prototype to get the program size of the block device for a specific address 187 | * 188 | * @param[in] context Context object that is passed into \ref mtb_kvstore_init 189 | * @param[in] addr Address for which the program size is queried. This address 190 | * is passed in as start_addr + offset. 191 | * @return Program size of the memory device. 192 | */ 193 | typedef uint32_t (* mtb_kvstore_bd_program_size)(void* context, uint32_t addr); 194 | 195 | /** Function prototype to get the erase size of the block device for a specific address 196 | * 197 | * @param[in] context Context object that is passed into \ref mtb_kvstore_init 198 | * @param[in] addr Address for which the erase size is queried. This address is passed in a 199 | * start_addr + offset. 200 | * @return Erase size of the memory device. 201 | */ 202 | typedef uint32_t (* mtb_kvstore_bd_erase_size)(void* context, uint32_t addr); 203 | 204 | /** Function prototype for allocating memory to be used for kv-store internal operations. 205 | * 206 | * @param[in] size Size in bytes of the memory to be allocated 207 | * @return Pointer to the allocated memory in case the memory allocation is success or 208 | * NULL in case of failure. 209 | */ 210 | typedef void* (* mtb_kvstore_allocate_memory_t)(size_t size); 211 | 212 | /** Function prototype for freeing memory 213 | * 214 | * @param[in] ptr Pointer to the memory block to be freed 215 | * @return None. 216 | */ 217 | typedef void (* mtb_kvstore_free_memory_t)(void* ptr); 218 | 219 | /** \cond INTERNAL */ 220 | 221 | /** Ram table entry structure */ 222 | typedef struct 223 | { 224 | uint16_t hash; 225 | uint32_t offset; 226 | } mtb_kvstore_ram_table_entry_t; 227 | 228 | /** KV store context */ 229 | typedef struct 230 | { 231 | uint32_t start_addr; 232 | uint32_t length; 233 | const mtb_block_storage_t* bd; 234 | 235 | mtb_kvstore_ram_table_entry_t* ram_table; 236 | uint32_t num_entries; 237 | uint32_t max_entries; 238 | 239 | uint8_t* transaction_buffer; 240 | size_t transaction_buffer_size; 241 | char key_buffer[MTB_KVSTORE_MAX_KEY_SIZE]; 242 | 243 | uint32_t active_area_addr; 244 | uint32_t gc_area_addr; 245 | uint32_t free_space_offset; 246 | uint16_t active_area_version; 247 | 248 | uint32_t consumed_size; 249 | mtb_kvstore_allocate_memory_t alloc_memory; 250 | mtb_kvstore_free_memory_t free_memory; 251 | 252 | #if defined(CY_RTOS_AWARE) || defined(COMPONENT_RTOS_AWARE) 253 | cy_mutex_t mtb_kvstore_mutex; 254 | #endif 255 | } mtb_kvstore_t; 256 | 257 | /** \endcond */ 258 | 259 | /** Initialize an instance of the kv-store library 260 | * 261 | * @param[out] obj Pointer to a kv-store object. The caller must allocate the memory 262 | * for this object but the init function will initialize its contents. 263 | * @param[in] start_addr Start address for the memory. All addresses when performing memory 264 | * operations will be offset from this address. See notes for constraints. 265 | * @param[in] length Total space available in bytes. See notes for constraints. 266 | * @param[in] bsd Block storage device interface for the underlying memory to be used. 267 | * @param[in] alloc_memory Optional parameter that could be used to allocate the requested memory 268 | * size. Application could set up this function pointer if they desire to 269 | * allocate the memory from specific memory region. If not null, KV Store 270 | * uses the specified function for allocating the memory needed for 271 | * internal operations. When specified as NULL, KV Store uses the malloc 272 | * function to allocate the memory 273 | * @param[in] free_memory Optional parameter that could be used to free the memory block 274 | * allocated using the 'alloc_memory' function.If not null, KV Store 275 | * uses the specified function for freeing the memory. When specified 276 | * as NULL, KV Store uses the free function to free the memory 277 | * 278 | * Address space considerations 279 | * \note The start_addr and start_addr + length must be aligned to the erase sector boundary. 280 | * \note An even number of erase sectors must be provided as storage. (2 * N * erase sector size) 281 | * where N is the number of sectors. 282 | * \note The implementation assumes that the value of the storage in the erased state is either 0x00 283 | * or 0xFF. 284 | * \note The space provided to the library provided must have the uniform characteristics (erase, 285 | * program and read size). A space spanning regions with different characteristics in a 286 | * hybrid sector device is not supported and if provided may lead to undefined behavior. 287 | * \note If the application desires to use specific memory region for KV Store internal operation, 288 | * it should set up both the alloc_memory and free_memory functions. 289 | * 290 | * RTOS considerations 291 | * \note In a RTOS environment the library must be initialized after the RTOS kernel has started. 292 | * 293 | * @return Result of the initialization operation. 294 | */ 295 | cy_rslt_t mtb_kvstore_init(mtb_kvstore_t* obj, uint32_t start_addr, uint32_t length, 296 | const mtb_block_storage_t* bsd, 297 | mtb_kvstore_allocate_memory_t alloc_memory, 298 | mtb_kvstore_free_memory_t free_memory); 299 | 300 | /** Store a key value pair 301 | * 302 | * @param[in] obj Pointer to a kv-store object 303 | * @param[in] key Lookup key for the data. 304 | * @param[in] data Pointer to the start of the data to be stored. 305 | * @param[in] size Total size of the data in bytes. 306 | * 307 | * @return Result of the write operation. 308 | */ 309 | cy_rslt_t mtb_kvstore_write(mtb_kvstore_t* obj, const char* key, const uint8_t* data, 310 | uint32_t size); 311 | 312 | /** Read data associated with a key 313 | * 314 | * @param[in] obj Pointer to a kv-store object 315 | * @param[in] key Lookup key for the data. 316 | * @param[out] data Pointer to the start of the buffer for the data to be read into. 317 | * @param[in,out] size [in] Total size of the data in bytes. [out] Actual size of the data in 318 | * storage. If a data buffer is provided then the size cannot be NULL or 0. 319 | * 320 | * \note It is valid to set both `data` and `size` to NULL to check if the key exists in 321 | * the storage. 322 | * 323 | * @return Result of the read operation. 324 | */ 325 | cy_rslt_t mtb_kvstore_read(mtb_kvstore_t* obj, const char* key, uint8_t* data, 326 | uint32_t* size); 327 | 328 | /** Read data associated with a key. If buffer is too small, will partially read and fill buffer. 329 | * No corruption checking is performed. 330 | * 331 | * @param[in] obj Pointer to a kv-store object 332 | * @param[in] key Lookup key for the data. 333 | * @param[out] data Pointer to the start of the buffer for the data to be read into. 334 | * @param[in,out] size [in] Total size of the data in bytes. [out] Number of bytes read into 335 | * buffer. If a data buffer is provided then the size cannot be NULL 336 | * or 0. 337 | * @param[in] offset_bytes Number of bytes to skip at the start the value read into data 338 | * 339 | * @return Result of the read operation. 340 | */ 341 | cy_rslt_t mtb_kvstore_read_partial(mtb_kvstore_t* obj, const char* key, uint8_t* data, 342 | uint32_t* size, const uint32_t offset_bytes); 343 | 344 | /** Check if a key is stored in memory 345 | * 346 | * @param[in] obj Pointer to a kv-store object 347 | * @param[in] key Lookup key 348 | * 349 | * @return Result of the key_exists operation 350 | */ 351 | cy_rslt_t mtb_kvstore_key_exists(mtb_kvstore_t* obj, const char* key); 352 | 353 | /** Get the size in bytes of data in memory corresponding to a given key. 354 | * 355 | * @param[in] obj Pointer to a kv-store object 356 | * @param[in] key Lookup key for the data 357 | * @param[out] size Size of data in bytes 358 | * 359 | * @return Result of the value size operation 360 | */ 361 | cy_rslt_t mtb_kvstore_value_size(mtb_kvstore_t* obj, const char* key, uint32_t* size); 362 | 363 | /** Delete a key value pair 364 | * 365 | * \note This function will return CY_RSLT_SUCCESS if the key cannot be found in the storage. 366 | * 367 | * @param[in] obj Pointer to a kv-store object. 368 | * @param[in] key Lookup key to delete key value pair. 369 | * 370 | * @return Result of the delete operation. 371 | */ 372 | cy_rslt_t mtb_kvstore_delete(mtb_kvstore_t* obj, const char* key); 373 | 374 | /** Query the size consumed in the kv-store storage. 375 | * 376 | * @param[in] obj Pointer to a kv-store object. 377 | 378 | * @return Size of storage consumed in bytes. 379 | */ 380 | uint32_t mtb_kvstore_size(mtb_kvstore_t* obj); 381 | 382 | /** Query the free space available in the kv-store storage. 383 | * 384 | * @param[in] obj Pointer to a kv-store object 385 | * 386 | * @return Size of storage free in bytes. 387 | */ 388 | uint32_t mtb_kvstore_remaining_size(mtb_kvstore_t* obj); 389 | 390 | /** Tries to make the specified amount of space available 391 | * for immediate use. If necessary, internal cleanup operations 392 | * will be executed to make additional space available, so this 393 | * is a potentially long-running operation. 394 | * 395 | * @param[in] obj Pointer to a kv-store object 396 | * @param[in] size Amount of space to ensure is available, in bytes. 397 | * To always perform cleanup operations regardless 398 | * of the amount of space currently free, 399 | * use \ref MTB_KVSTORE_ENSURE_MAX. 400 | * 401 | * @return Result of the operation. If `size` is not \ref MTB_KVSTORE_ENSURE_MAX 402 | * and it is not possible to make the requested amount of space 403 | * available, returns \ref MTB_KVSTORE_STORAGE_FULL_ERROR. 404 | */ 405 | cy_rslt_t mtb_kvstore_ensure_capacity(mtb_kvstore_t* obj, uint32_t size); 406 | 407 | /** Reset kv-store storage. 408 | * 409 | * This function erases all the data in the storage. 410 | * 411 | * @param[in] obj Pointer to a kv-store object 412 | * 413 | * @return Result of the reset operation 414 | */ 415 | cy_rslt_t mtb_kvstore_reset(mtb_kvstore_t* obj); 416 | 417 | /** Delete kv-store instance. 418 | * 419 | * This function frees any program memory allocated by the library. 420 | * 421 | * @param[in] obj Pointer to a kv-store object 422 | */ 423 | void mtb_kvstore_deinit(mtb_kvstore_t* obj); 424 | 425 | #if defined(__cplusplus) 426 | } 427 | #endif 428 | 429 | /** \} group_kvstore */ 430 | -------------------------------------------------------------------------------- /props.json: -------------------------------------------------------------------------------- 1 | { 2 | "core": { 3 | "id": "02fb0082-fc6b-5fc3-9907-1c6e5ce7af2c", 4 | "name": "kv-store", 5 | "version": "2.0.0.342" 6 | } 7 | } --------------------------------------------------------------------------------