MT2523 API Reference  LinkIt SDK v4
nvdm.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2017 MediaTek Inc. All rights reserved.
4  *
5  * This software/firmware and related documentation ("MediaTek Software") are
6  * protected under relevant copyright laws. The information contained herein
7  * is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
8  * Without the prior written permission of MediaTek and/or its licensors,
9  * any reproduction, modification, use or disclosure of MediaTek Software,
10  * and information contained herein, in whole or in part, shall be strictly prohibited.
11  * You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
12  * if you have agreed to and been bound by the applicable license agreement with
13  * MediaTek ("License Agreement") and been granted explicit permission to do so within
14  * the License Agreement ("Permitted User"). If you are not a Permitted User,
15  * please cease any access or use of MediaTek Software immediately.
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
18  * ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
19  * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
21  * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
22  * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
23  * SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
24  * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
25  * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
26  * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
27  * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
28  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
29  * CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
30  * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
31  * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
32  * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
33  */
34 
35 #ifndef __NVDM_H__
36 #define __NVDM_H__
37 
38 #ifdef MTK_NVDM_ENABLE
39 
141 #include <stdint.h>
142 
143 #ifdef __cplusplus
144 extern "C" {
145 #endif
146 
152 typedef enum {
156 
158 typedef enum {
165 } nvdm_status_t;
166 
180 
199 nvdm_status_t nvdm_write_data_item(const char *group_name,
200  const char *data_item_name,
202  const uint8_t *buffer,
203  uint32_t size);
204 
221 nvdm_status_t nvdm_read_data_item(const char *group_name,
222  const char *data_item_name,
223  uint8_t *buffer,
224  uint32_t *size);
225 
226 /*
227  * @brief This function deletes a single data item stored in the NVDM region.
228  * @param[in] group_name is the group name of the data item, such as "Bluetooth".
229  * @param[in] data_item_name is the name of the data item, such as "address" of the "Bluetooth".
230  * @return
231  * #NVDM_STATUS_OK, if the operation completed successfully. \n
232  * #NVDM_STATUS_ERROR, if an unknown error occurred. \n
233  * #NVDM_STATUS_INVALID_PARAMETER, if the parameter is invalid. \n
234  * #NVDM_STATUS_ITEM_NOT_FOUND, if the data item is not found. \n
235  */
236 nvdm_status_t nvdm_delete_data_item(const char *group_name, const char *data_item_name);
237 
238 /*
239  * @brief This function is used to delete all data items in the group.
240  * @param[in] group_name is the group name of the data item, such as "Bluetooth".
241  * @return
242  * #NVDM_STATUS_OK, if the operation completed successfully. \n
243  * #NVDM_STATUS_ERROR, if an unknown error occurred. \n
244  * #NVDM_STATUS_INVALID_PARAMETER, if the parameter is invalid. \n
245  * #NVDM_STATUS_ITEM_NOT_FOUND, if the data item group is not found. \n
246  */
247 nvdm_status_t nvdm_delete_group(const char *group_name);
248 
249 /*
250  * @brief This function is used to delete all data items stored in the NVDM region.
251  * @return
252  * #NVDM_STATUS_OK, if the operation completed successfully. \n
253  * #NVDM_STATUS_ERROR, if an unknown error occurred. \n
254  * #NVDM_STATUS_ITEM_NOT_FOUND, if the data item group is not found. \n
255  * @note
256  * It's dangerous to call this API, as this will remove everything in NVDM region.
257  */
258 nvdm_status_t nvdm_delete_all(void);
259 
260 /*
261  * @brief This function marks the start of the query.
262  * User should call this API before #nvdm_query_next_group_name() and
263  * #nvdm_query_next_data_item_name() to query the naming information of data items.
264  * @return
265  * #NVDM_STATUS_OK, if the operation completed successfully. \n
266  * #NVDM_STATUS_ERROR, if an unknown error occurred. \n
267  */
268 nvdm_status_t nvdm_query_begin(void);
269 
270 /*
271  * @brief This function marks the end of the query.
272  * User should call this API after #nvdm_query_next_group_name() and
273  * #nvdm_query_next_data_item_name() to query the naming information of data items.
274  * @return
275  * #NVDM_STATUS_OK, if the operation completed successfully. \n
276  * #NVDM_STATUS_ERROR, if an unknown error occurred. \n
277  */
278 nvdm_status_t nvdm_query_end(void);
279 
292 nvdm_status_t nvdm_query_next_group_name(char *group_name);
293 
307 nvdm_status_t nvdm_query_next_data_item_name(char *data_item_name);
308 
309 #ifdef __cplusplus
310 }
311 #endif
312 
317 #endif
318 
319 #endif /* __NVDM_H__ */
320 
An unknown error occurred.
Definition: nvdm.h:163
The operation was successful.
Definition: nvdm.h:164
No space is available in the flash.
Definition: nvdm.h:161
The user parameter is invalid.
Definition: nvdm.h:159
nvdm_status_t nvdm_read_data_item(const char *group_name, const char *data_item_name, uint8_t *buffer, uint32_t *size)
This function is used to read the data item from flash.
The NVDM found a checksum error when reading the data item.
Definition: nvdm.h:162
nvdm_status_t nvdm_init(void)
This function initializes the NVDM module to enable the NVDM services.
The data item wasn&#39;t found by the NVDM.
Definition: nvdm.h:160
nvdm_status_t nvdm_write_data_item(const char *group_name, const char *data_item_name, nvdm_data_item_type_t type, const uint8_t *buffer, uint32_t size)
This function is used to write or update a data item to flash.
Defines the display type with string.
Definition: nvdm.h:154
nvdm_status_t nvdm_query_next_group_name(char *group_name)
This function is used to enumerate all available group names.
Defines the display type with raw data.
Definition: nvdm.h:153
nvdm_data_item_type_t
This enum defines the display type of a data item.
Definition: nvdm.h:152
nvdm_status_t
This enum defines return type of NVDM APIs.
Definition: nvdm.h:158
nvdm_status_t nvdm_query_next_data_item_name(char *data_item_name)
This function is used to enumerate all available data item names from the group returned by nvdm_quer...