The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
Dependents: hello SerialTestv11 SerialTestv12 Sierpinski ... more
mbed 2
This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.
TARGET_NRF51822/TOOLCHAIN_GCC_ARM/crc16.h@172:65be27845400, 2019-02-20 (annotated)
- Committer:
- AnnaBridge
- Date:
- Wed Feb 20 20:53:29 2019 +0000
- Revision:
- 172:65be27845400
- Parent:
- 171:3a7713b1edbc
mbed library release version 165
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 104:b9ad9a133dc7 | 1 | /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. |
Kojto | 104:b9ad9a133dc7 | 2 | * |
Kojto | 104:b9ad9a133dc7 | 3 | * The information contained herein is property of Nordic Semiconductor ASA. |
Kojto | 104:b9ad9a133dc7 | 4 | * Terms and conditions of usage are described in detail in NORDIC |
Kojto | 104:b9ad9a133dc7 | 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. |
Kojto | 104:b9ad9a133dc7 | 6 | * |
Kojto | 104:b9ad9a133dc7 | 7 | * Licensees are granted free, non-transferable use of the information. NO |
Kojto | 104:b9ad9a133dc7 | 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from |
Kojto | 104:b9ad9a133dc7 | 9 | * the file. |
Kojto | 104:b9ad9a133dc7 | 10 | * |
Kojto | 104:b9ad9a133dc7 | 11 | */ |
Kojto | 104:b9ad9a133dc7 | 12 | |
Kojto | 104:b9ad9a133dc7 | 13 | /** @file |
Kojto | 104:b9ad9a133dc7 | 14 | * |
Kojto | 104:b9ad9a133dc7 | 15 | * @defgroup crc_compute CRC compute |
Kojto | 104:b9ad9a133dc7 | 16 | * @{ |
Kojto | 104:b9ad9a133dc7 | 17 | * @ingroup hci_transport |
Kojto | 104:b9ad9a133dc7 | 18 | * |
Kojto | 104:b9ad9a133dc7 | 19 | * @brief This module implements the CRC-16 calculation in the blocks. |
Kojto | 104:b9ad9a133dc7 | 20 | */ |
Kojto | 104:b9ad9a133dc7 | 21 | |
Kojto | 104:b9ad9a133dc7 | 22 | #ifndef CRC16_H__ |
Kojto | 104:b9ad9a133dc7 | 23 | #define CRC16_H__ |
Kojto | 104:b9ad9a133dc7 | 24 | |
Kojto | 104:b9ad9a133dc7 | 25 | #include <stdint.h> |
Kojto | 104:b9ad9a133dc7 | 26 | |
Kojto | 104:b9ad9a133dc7 | 27 | #ifdef __cplusplus |
Kojto | 104:b9ad9a133dc7 | 28 | extern "C" { |
Kojto | 104:b9ad9a133dc7 | 29 | #endif |
Kojto | 104:b9ad9a133dc7 | 30 | |
Kojto | 104:b9ad9a133dc7 | 31 | /**@brief Function for calculating CRC-16 in blocks. |
Kojto | 104:b9ad9a133dc7 | 32 | * |
Kojto | 104:b9ad9a133dc7 | 33 | * Feed each consecutive data block into this function, along with the current value of p_crc as |
Kojto | 104:b9ad9a133dc7 | 34 | * returned by the previous call of this function. The first call of this function should pass NULL |
Kojto | 104:b9ad9a133dc7 | 35 | * as the initial value of the crc in p_crc. |
Kojto | 104:b9ad9a133dc7 | 36 | * |
Kojto | 104:b9ad9a133dc7 | 37 | * @param[in] p_data The input data block for computation. |
Kojto | 104:b9ad9a133dc7 | 38 | * @param[in] size The size of the input data block in bytes. |
Kojto | 104:b9ad9a133dc7 | 39 | * @param[in] p_crc The previous calculated CRC-16 value or NULL if first call. |
Kojto | 104:b9ad9a133dc7 | 40 | * |
Kojto | 104:b9ad9a133dc7 | 41 | * @return The updated CRC-16 value, based on the input supplied. |
Kojto | 104:b9ad9a133dc7 | 42 | */ |
Kojto | 104:b9ad9a133dc7 | 43 | uint16_t crc16_compute(const uint8_t * p_data, uint32_t size, const uint16_t * p_crc); |
Kojto | 104:b9ad9a133dc7 | 44 | |
Kojto | 104:b9ad9a133dc7 | 45 | #ifdef __cplusplus |
Kojto | 104:b9ad9a133dc7 | 46 | } |
Kojto | 104:b9ad9a133dc7 | 47 | #endif |
Kojto | 104:b9ad9a133dc7 | 48 | |
Kojto | 104:b9ad9a133dc7 | 49 | #endif // CRC16_H__ |
Kojto | 104:b9ad9a133dc7 | 50 | |
Kojto | 104:b9ad9a133dc7 | 51 | /** @} */ |