• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * @file hks_file_api.h
3  *
4  * Copyright (c) 2020 Huawei Device Co., Ltd.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 /**
19  * @defgroup iot_hks
20  * @ingroup hks
21  */
22 
23 #ifndef _HKS_FILE_API_H
24 #define _HKS_FILE_API_H
25 
26 #include <stdint.h>
27 #include "hks_types.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 struct hks_flash_operation_callbacks {
34     /**
35      * @ingroup  iot_hks
36      * @brief Read data from flash. CNcomment:从flash读取数据。CNend
37      *
38      * @par 描述:
39      *           Read data from flash. CNcomment:从flash读取数据。CNend
40      *
41      * @attention None
42      * @param  buf    [OUT] type #uint8_t *,The buffer used to store the content readed from flash.
43        CNcomment:用于存储从闪存读取的内容的缓冲区。CNend
44      * @param  len    [IN] type #uint32_t,The size count in buffer trying to read from flash.
45        CNcomment:尝试从闪存读取的缓冲区中的大小计数。CNend
46      * @retval #0       Success.
47      * @retval # < 0    Failure.
48      * @par 依赖:
49      *            @li hks_file_api.h:describes hks_types SDK interfaces.CNcomment:描述hks_types SDK的接口。CNend
50      * @see read_flash
51      */
52     int32_t (*read_flash)(uint8_t *buf, uint32_t len);
53 
54     /**
55      * @ingroup  iot_hks
56      * @brief Write data into flash. CNcomment:将数据写入闪存。CNend
57      *
58      * @par 描述:
59      *           Write data into flash. CNcomment:将数据写入闪存。CNend
60      *
61      * @attention None
62      * @param  buf    [IN] type #uint8_t *,The content which you want write into the file.
63        CNcomment:要写入文件的内容。CNend
64      * @param  len    [IN] type #uint32_t,The size of the content.CNcomment:要写入的内容大小。CNend
65      * @retval #0       Success.
66      * @retval # < 0    Failure.
67      * @par 依赖:
68      *            @li hks_file_api.h:describes hks_types SDK interfaces.CNcomment:描述hks_types SDK的接口。CNend
69      * @see read_flash
70      */
71     int32_t (*write_flash)(const uint8_t *buf, uint32_t len);
72 };
73 
74 /**
75 * @ingroup  iot_hks
76 * @brief register flash operation callbacks. CNcomment:注册flash操作回调函数。CNend
77 *
78 * @par 描述:
79 *           register flash operation callbacks. CNcomment:注册flash操作回调函数。CNend
80 *
81 * @attention None
82 * @param  callbacks    [IN] type #struct hks_flash_operation_callbacks *,Registered callback function.
83   CNcomment:注册的回调函数。CNend
84 * @retval #0       Success.
85 * @retval #Other   Failure.
86 * @par 依赖:
87 *            @li hks_file_api.h:describes hks_types SDK interfaces.CNcomment:描述hks_types SDK的接口。CNend
88 * @see hks_register_flash_operation_callbacks
89 */
90 HKS_DLL_API_PUBLIC int32_t hks_register_flash_operation_callbacks(struct hks_flash_operation_callbacks *callbacks);
91 
92 #ifdef __cplusplus
93 }
94 #endif
95 
96 #endif /* _HKS_FILE_API_H */
97