1 /** 2 * @file hi_crc.h 3 * 4 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 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_crc CRC Verification 20 * @ingroup system 21 */ 22 23 #ifndef __HI_CRC_H__ 24 #define __HI_CRC_H__ 25 #include <hi_types_base.h> 26 27 /** 28 * @ingroup iot_crc 29 * @brief Generates a 16-bit CRC value.CNcomment:生成16位CRC校验值。CNend 30 * 31 * @par 描述: 32 * Generates a 16-bit CRC value.CNcomment:生成16位CRC校验值。CNend 33 * 34 * @attention None 35 * @param crc_start [IN] type #hi_u16,The CRC initial value.CNcomment:CRC初始值。CNend 36 * @param buf [IN] type #const hi_u8*,Pointer to the buffer to be verified. 37 CNcomment:被校验Buffer指针。CNend 38 * @param len [IN] type #hi_u32,Length of the buffer to be verified (unit: Byte). 39 CNcomment:被校验Buffer长度(单位:byte)。CNend 40 * @param crc_result [OUT]type #hi_u16*,CRC calculation result.CNcomment:CRC计算结果。CNend 41 * 42 * @retval #0 Success. 43 * @retval #Other Failure. 44 * 45 * @par 依赖: 46 * @li hi_crc.h:Describes CRC APIs.CNcomment:文件包含CRC校验接口。CNend 47 * @see None 48 */ 49 hi_u32 hi_crc16(hi_u16 crc_start, const hi_u8 *buf, hi_u32 len, hi_u16 *crc_result); 50 51 /** 52 * @ingroup iot_crc 53 * @brief Generates a 32-bit CRC value.CNcomment:生成32位CRC校验值。CNend 54 * 55 * @par 描述: 56 * Generates a 32-bit CRC value.CNcomment:生成32位CRC校验值。CNend 57 * 58 * @attention None 59 * @param crc_start [IN] type #hi_u32,The CRC initial value.CNcomment:CRC初始值。CNend 60 * @param buf [IN] type #const hi_u8*,Pointer to the buffer to be verified. 61 CNcomment:被校验Buffer指针。CNend 62 * @param len [IN] type #hi_u32,Length of the buffer to be verified (unit: Byte). 63 CNcomment:被校验Buffer长度(单位:byte)。CNend 64 * @param crc_result [OUT]type #hi_u32*,CRC calculation result.CNcomment:CRC计算结果。CNend 65 * 66 * @retval #0 Success. 67 * @retval #Other Failure. 68 * 69 * @par 依赖: 70 * @li hi_crc.h:Describes CRC APIs.CNcomment:文件包含CRC校验接口。CNend 71 * @see None 72 */ 73 hi_u32 hi_crc32(hi_u32 crc_start, const hi_u8 *buf, hi_u32 len, hi_u32 *crc_result); 74 75 #endif 76 77