Mistake on this page?
Report an issue in GitHub or email us
kv_config.h
1 /*
2  * Copyright (c) 2018 ARM Limited. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  * Licensed under the Apache License, Version 2.0 (the License); you may
5  * not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
12  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 #ifndef _KV_CONFIG
17 #define _KV_CONFIG
18 
19 #include "blockdevice/BlockDevice.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 #ifndef MBED_CONF_STORAGE_STORAGE
26 #define MBED_CONF_STORAGE_STORAGE USER_DEFINED
27 #endif
28 
29 #define _STORAGE_CONFIG_concat(dev) _storage_config_##dev()
30 #define _STORAGE_CONFIG(dev) _STORAGE_CONFIG_concat(dev)
31 
32 /**
33  * @brief This function initializes one of the configuration that exists in Mbed OS. To overwrite
34  * the default configuration, please overwrite this function.
35  *
36  * @returns 0 on success or negative value on failure.
37  */
38 int kv_init_storage_config();
39 
40 /**
41  * @brief A getter for filesystemstore folder path configuration
42  *
43  * @returns string with the file folder path or NULL if not set
44  */
45 const char *get_filesystemstore_folder_path();
46 
47 /**
48  * @brief Get the default TDBStore flash start address and size.
49  *
50  * @param[out] start_address Default TDBStore start address in flash.
51  * @param[out] size Default TDBStore size.
52  *
53  * @returns MBED_SUCCESS Success.
54  * MBED_ERROR_INITIALIZATION_FAILED Failed to initialize flash driver.
55  * MBED_ERROR_MEDIA_FULL Default TDBStore space overlaps with program memory.
56  */
57 int kv_get_default_flash_addresses(mbed::bd_addr_t *start_address, mbed::bd_size_t *size);
58 
59 /**
60  * @brief Get the TDBStore flash bounds from the configured start address and size.
61  *
62  * @param[inout] start_address Configured TDBStore start address in flash.
63  * @param[inout] size Configured TDBStore size. If 0, the size will be from the start address to the end of flash
64  *
65  * @returns MBED_SUCCESS Success.
66  * MBED_ERROR_INVALID_ARGUMENT One of the arguments is NULL or both the configured start address and size are 0.
67  * MBED_ERROR_INITIALIZATION_FAILED Failed to initialize flash driver.
68  * MBED_ERROR_INVALID_SIZE Configured size results in misaligned start/end address or end address past the end of flash.
69  * MBED_ERROR_MEDIA_FULL Configured start address/size results in bounds overlapping with program memory.
70  */
71 int kv_get_flash_bounds_from_config(mbed::bd_addr_t *start_address, mbed::bd_size_t *size);
72 
73 #ifdef __cplusplus
74 } // closing brace for extern "C"
75 #endif
76 #endif
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.