11bd4fe43Sopenharmony_ci/** 21bd4fe43Sopenharmony_ci * @file hi_crc.h 31bd4fe43Sopenharmony_ci * 41bd4fe43Sopenharmony_ci * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 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_crc CRC Verification 201bd4fe43Sopenharmony_ci * @ingroup system 211bd4fe43Sopenharmony_ci */ 221bd4fe43Sopenharmony_ci 231bd4fe43Sopenharmony_ci#ifndef __HI_CRC_H__ 241bd4fe43Sopenharmony_ci#define __HI_CRC_H__ 251bd4fe43Sopenharmony_ci#include <hi_types_base.h> 261bd4fe43Sopenharmony_ci 271bd4fe43Sopenharmony_ci/** 281bd4fe43Sopenharmony_ci* @ingroup iot_crc 291bd4fe43Sopenharmony_ci* @brief Generates a 16-bit CRC value.CNcomment:生成16位CRC校验值。CNend 301bd4fe43Sopenharmony_ci* 311bd4fe43Sopenharmony_ci* @par 描述: 321bd4fe43Sopenharmony_ci* Generates a 16-bit CRC value.CNcomment:生成16位CRC校验值。CNend 331bd4fe43Sopenharmony_ci* 341bd4fe43Sopenharmony_ci* @attention None 351bd4fe43Sopenharmony_ci* @param crc_start [IN] type #hi_u16,The CRC initial value.CNcomment:CRC初始值。CNend 361bd4fe43Sopenharmony_ci* @param buf [IN] type #const hi_u8*,Pointer to the buffer to be verified. 371bd4fe43Sopenharmony_ciCNcomment:被校验Buffer指针。CNend 381bd4fe43Sopenharmony_ci* @param len [IN] type #hi_u32,Length of the buffer to be verified (unit: Byte). 391bd4fe43Sopenharmony_ciCNcomment:被校验Buffer长度(单位:byte)。CNend 401bd4fe43Sopenharmony_ci* @param crc_result [OUT]type #hi_u16*,CRC calculation result.CNcomment:CRC计算结果。CNend 411bd4fe43Sopenharmony_ci* 421bd4fe43Sopenharmony_ci* @retval #0 Success. 431bd4fe43Sopenharmony_ci* @retval #Other Failure. 441bd4fe43Sopenharmony_ci* 451bd4fe43Sopenharmony_ci* @par 依赖: 461bd4fe43Sopenharmony_ci* @li hi_crc.h:Describes CRC APIs.CNcomment:文件包含CRC校验接口。CNend 471bd4fe43Sopenharmony_ci* @see None 481bd4fe43Sopenharmony_ci*/ 491bd4fe43Sopenharmony_cihi_u32 hi_crc16(hi_u16 crc_start, const hi_u8 *buf, hi_u32 len, hi_u16 *crc_result); 501bd4fe43Sopenharmony_ci 511bd4fe43Sopenharmony_ci/** 521bd4fe43Sopenharmony_ci* @ingroup iot_crc 531bd4fe43Sopenharmony_ci* @brief Generates a 32-bit CRC value.CNcomment:生成32位CRC校验值。CNend 541bd4fe43Sopenharmony_ci* 551bd4fe43Sopenharmony_ci* @par 描述: 561bd4fe43Sopenharmony_ci* Generates a 32-bit CRC value.CNcomment:生成32位CRC校验值。CNend 571bd4fe43Sopenharmony_ci* 581bd4fe43Sopenharmony_ci* @attention None 591bd4fe43Sopenharmony_ci* @param crc_start [IN] type #hi_u32,The CRC initial value.CNcomment:CRC初始值。CNend 601bd4fe43Sopenharmony_ci* @param buf [IN] type #const hi_u8*,Pointer to the buffer to be verified. 611bd4fe43Sopenharmony_ciCNcomment:被校验Buffer指针。CNend 621bd4fe43Sopenharmony_ci* @param len [IN] type #hi_u32,Length of the buffer to be verified (unit: Byte). 631bd4fe43Sopenharmony_ciCNcomment:被校验Buffer长度(单位:byte)。CNend 641bd4fe43Sopenharmony_ci* @param crc_result [OUT]type #hi_u32*,CRC calculation result.CNcomment:CRC计算结果。CNend 651bd4fe43Sopenharmony_ci* 661bd4fe43Sopenharmony_ci* @retval #0 Success. 671bd4fe43Sopenharmony_ci* @retval #Other Failure. 681bd4fe43Sopenharmony_ci* 691bd4fe43Sopenharmony_ci* @par 依赖: 701bd4fe43Sopenharmony_ci* @li hi_crc.h:Describes CRC APIs.CNcomment:文件包含CRC校验接口。CNend 711bd4fe43Sopenharmony_ci* @see None 721bd4fe43Sopenharmony_ci*/ 731bd4fe43Sopenharmony_cihi_u32 hi_crc32(hi_u32 crc_start, const hi_u8 *buf, hi_u32 len, hi_u32 *crc_result); 741bd4fe43Sopenharmony_ci 751bd4fe43Sopenharmony_ci#endif 761bd4fe43Sopenharmony_ci 77