1 /* 2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef _LINUX_CRC32_H 16 #define _LINUX_CRC32_H 17 18 #include "los_typedef.h" 19 20 #ifdef __cplusplus 21 extern "C" { 22 #endif /* __cplusplus */ 23 24 /* import definition only, do not directly call it */ 25 extern unsigned int Crc32Part(unsigned int crc32val, const char *src, size_t len); 26 27 /** 28 * @ingroup crc32 29 * @brief Accumulate the value of crc32. 30 * 31 * @par Description: 32 * This API is used to accumulate the value of crc32. 33 * 34 * @attention 35 * <ul> 36 * <li>please make sure the parameter s is valid, the parameter len is the length of parameter s, 37 * s is not NULL, otherwise the system maybe crash!</li> 38 * </ul> 39 * 40 * @param val [IN/OUT] Type #unsigned int the seed of crc32 calculation. 41 * @param s [IN] Type #unsigned char the data needs to crc32 calculate.. 42 * @param len [IN] Type #int the length of the data needs to crc32 calculate.. 43 * 44 * @retval unsigned int return the crc value. 45 * @par Dependency: 46 * <ul><li>Crc32.h: the header file that contains the API declaration.</li></ul> 47 * @see None. 48 * @since Huawei LiteOS V100R001C00 49 */ 50 #define crc32(val, s, len) Crc32Part(val, (const char *)s, len) 51 52 #ifdef __cplusplus 53 } 54 #endif /* __cplusplus */ 55 56 #endif 57