Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ns_crc.h Source File

ns_crc.h

00001 /*
00002  * Copyright (c) 2015-2018, Arm Limited and affiliates.
00003  * SPDX-License-Identifier: Apache-2.0
00004  *
00005  * Licensed under the Apache License, Version 2.0 (the "License");
00006  * you may not use this file except in compliance with the License.
00007  * You may obtain a copy of the License at
00008  *
00009  *     http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 #ifndef _NS_CRC_H_
00018 #define _NS_CRC_H_
00019 #ifdef __cplusplus
00020 extern "C" {
00021 #endif
00022 
00023 #include <stdint.h>
00024 
00025 
00026 /// @todo documentation
00027 
00028 /** same as crc16_ibm */
00029 uint16_t crc16_ansi(uint8_t *message, int nBytes);
00030 uint16_t crc16_ccitt(uint8_t *message, int nBytes);
00031 
00032 /**
00033  *  @param data         data which crc will be calculate
00034  *  @param data_length  Lenght of data pointer
00035  *  @param polynomial   Polynomial which will be used to calculate CRC, POLYNOMIAL_CRC15_CCIT, POLYNOMIAL_CRC15_ANSI
00036  *  @return Calculated 16bit CRC value
00037  */
00038 uint16_t crc16_calc(uint8_t *data, uint16_t data_length, uint16_t polynomial);
00039 
00040 #ifdef __cplusplus
00041 }
00042 #endif
00043 #endif /* _NS_CRC_H_ */