11bd4fe43Sopenharmony_ci/** 21bd4fe43Sopenharmony_ci * @file hks_file_api.h 31bd4fe43Sopenharmony_ci * 41bd4fe43Sopenharmony_ci * Copyright (c) 2020 Huawei Device Co., Ltd. 51bd4fe43Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 61bd4fe43Sopenharmony_ci * you may not use this file except in compliance with the License. 71bd4fe43Sopenharmony_ci * You may obtain a copy of the License at 81bd4fe43Sopenharmony_ci * 91bd4fe43Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 101bd4fe43Sopenharmony_ci * 111bd4fe43Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 121bd4fe43Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 131bd4fe43Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 141bd4fe43Sopenharmony_ci * See the License for the specific language governing permissions and 151bd4fe43Sopenharmony_ci * limitations under the License. 161bd4fe43Sopenharmony_ci */ 171bd4fe43Sopenharmony_ci 181bd4fe43Sopenharmony_ci/** 191bd4fe43Sopenharmony_ci * @defgroup iot_hks 201bd4fe43Sopenharmony_ci * @ingroup hks 211bd4fe43Sopenharmony_ci */ 221bd4fe43Sopenharmony_ci 231bd4fe43Sopenharmony_ci#ifndef _HKS_FILE_API_H 241bd4fe43Sopenharmony_ci#define _HKS_FILE_API_H 251bd4fe43Sopenharmony_ci 261bd4fe43Sopenharmony_ci#include <stdint.h> 271bd4fe43Sopenharmony_ci#include "hks_types.h" 281bd4fe43Sopenharmony_ci 291bd4fe43Sopenharmony_ci#ifdef __cplusplus 301bd4fe43Sopenharmony_ciextern "C" { 311bd4fe43Sopenharmony_ci#endif 321bd4fe43Sopenharmony_ci 331bd4fe43Sopenharmony_cistruct hks_flash_operation_callbacks { 341bd4fe43Sopenharmony_ci /** 351bd4fe43Sopenharmony_ci * @ingroup iot_hks 361bd4fe43Sopenharmony_ci * @brief Read data from flash. CNcomment:从flash读取数据。CNend 371bd4fe43Sopenharmony_ci * 381bd4fe43Sopenharmony_ci * @par 描述: 391bd4fe43Sopenharmony_ci * Read data from flash. CNcomment:从flash读取数据。CNend 401bd4fe43Sopenharmony_ci * 411bd4fe43Sopenharmony_ci * @attention None 421bd4fe43Sopenharmony_ci * @param buf [OUT] type #uint8_t *,The buffer used to store the content readed from flash. 431bd4fe43Sopenharmony_ci CNcomment:用于存储从闪存读取的内容的缓冲区。CNend 441bd4fe43Sopenharmony_ci * @param len [IN] type #uint32_t,The size count in buffer trying to read from flash. 451bd4fe43Sopenharmony_ci CNcomment:尝试从闪存读取的缓冲区中的大小计数。CNend 461bd4fe43Sopenharmony_ci * @retval #0 Success. 471bd4fe43Sopenharmony_ci * @retval # < 0 Failure. 481bd4fe43Sopenharmony_ci * @par 依赖: 491bd4fe43Sopenharmony_ci * @li hks_file_api.h:describes hks_types SDK interfaces.CNcomment:描述hks_types SDK的接口。CNend 501bd4fe43Sopenharmony_ci * @see read_flash 511bd4fe43Sopenharmony_ci */ 521bd4fe43Sopenharmony_ci int32_t (*read_flash)(uint8_t *buf, uint32_t len); 531bd4fe43Sopenharmony_ci 541bd4fe43Sopenharmony_ci /** 551bd4fe43Sopenharmony_ci * @ingroup iot_hks 561bd4fe43Sopenharmony_ci * @brief Write data into flash. CNcomment:将数据写入闪存。CNend 571bd4fe43Sopenharmony_ci * 581bd4fe43Sopenharmony_ci * @par 描述: 591bd4fe43Sopenharmony_ci * Write data into flash. CNcomment:将数据写入闪存。CNend 601bd4fe43Sopenharmony_ci * 611bd4fe43Sopenharmony_ci * @attention None 621bd4fe43Sopenharmony_ci * @param buf [IN] type #uint8_t *,The content which you want write into the file. 631bd4fe43Sopenharmony_ci CNcomment:要写入文件的内容。CNend 641bd4fe43Sopenharmony_ci * @param len [IN] type #uint32_t,The size of the content.CNcomment:要写入的内容大小。CNend 651bd4fe43Sopenharmony_ci * @retval #0 Success. 661bd4fe43Sopenharmony_ci * @retval # < 0 Failure. 671bd4fe43Sopenharmony_ci * @par 依赖: 681bd4fe43Sopenharmony_ci * @li hks_file_api.h:describes hks_types SDK interfaces.CNcomment:描述hks_types SDK的接口。CNend 691bd4fe43Sopenharmony_ci * @see read_flash 701bd4fe43Sopenharmony_ci */ 711bd4fe43Sopenharmony_ci int32_t (*write_flash)(const uint8_t *buf, uint32_t len); 721bd4fe43Sopenharmony_ci}; 731bd4fe43Sopenharmony_ci 741bd4fe43Sopenharmony_ci/** 751bd4fe43Sopenharmony_ci* @ingroup iot_hks 761bd4fe43Sopenharmony_ci* @brief register flash operation callbacks. CNcomment:注册flash操作回调函数。CNend 771bd4fe43Sopenharmony_ci* 781bd4fe43Sopenharmony_ci* @par 描述: 791bd4fe43Sopenharmony_ci* register flash operation callbacks. CNcomment:注册flash操作回调函数。CNend 801bd4fe43Sopenharmony_ci* 811bd4fe43Sopenharmony_ci* @attention None 821bd4fe43Sopenharmony_ci* @param callbacks [IN] type #struct hks_flash_operation_callbacks *,Registered callback function. 831bd4fe43Sopenharmony_ci CNcomment:注册的回调函数。CNend 841bd4fe43Sopenharmony_ci* @retval #0 Success. 851bd4fe43Sopenharmony_ci* @retval #Other Failure. 861bd4fe43Sopenharmony_ci* @par 依赖: 871bd4fe43Sopenharmony_ci* @li hks_file_api.h:describes hks_types SDK interfaces.CNcomment:描述hks_types SDK的接口。CNend 881bd4fe43Sopenharmony_ci* @see hks_register_flash_operation_callbacks 891bd4fe43Sopenharmony_ci*/ 901bd4fe43Sopenharmony_ciHKS_DLL_API_PUBLIC int32_t hks_register_flash_operation_callbacks(struct hks_flash_operation_callbacks *callbacks); 911bd4fe43Sopenharmony_ci 921bd4fe43Sopenharmony_ci#ifdef __cplusplus 931bd4fe43Sopenharmony_ci} 941bd4fe43Sopenharmony_ci#endif 951bd4fe43Sopenharmony_ci 961bd4fe43Sopenharmony_ci#endif /* _HKS_FILE_API_H */ 97