project for nrf51822 qfab
Dependencies: eddystone_URL mbed
Fork of eddystone_URL by
nRF51822/nordic/nrf-sdk/app_common/crc16.h@5:267bdacf5508, 2017-11-23 (annotated)
- Committer:
- tridung141196
- Date:
- Thu Nov 23 15:38:48 2017 +0000
- Revision:
- 5:267bdacf5508
- Parent:
- 0:76dfa9657d9d
ibeacon
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jksoft | 0:76dfa9657d9d | 1 | /* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved. |
jksoft | 0:76dfa9657d9d | 2 | * |
jksoft | 0:76dfa9657d9d | 3 | * The information contained herein is property of Nordic Semiconductor ASA. |
jksoft | 0:76dfa9657d9d | 4 | * Terms and conditions of usage are described in detail in NORDIC |
jksoft | 0:76dfa9657d9d | 5 | * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. |
jksoft | 0:76dfa9657d9d | 6 | * |
jksoft | 0:76dfa9657d9d | 7 | * Licensees are granted free, non-transferable use of the information. NO |
jksoft | 0:76dfa9657d9d | 8 | * WARRANTY of ANY KIND is provided. This heading must NOT be removed from |
jksoft | 0:76dfa9657d9d | 9 | * the file. |
jksoft | 0:76dfa9657d9d | 10 | * |
jksoft | 0:76dfa9657d9d | 11 | */ |
jksoft | 0:76dfa9657d9d | 12 | |
jksoft | 0:76dfa9657d9d | 13 | /** @file |
jksoft | 0:76dfa9657d9d | 14 | * |
jksoft | 0:76dfa9657d9d | 15 | * @defgroup crc_compute CRC compute |
jksoft | 0:76dfa9657d9d | 16 | * @{ |
jksoft | 0:76dfa9657d9d | 17 | * @ingroup hci_transport |
jksoft | 0:76dfa9657d9d | 18 | * |
jksoft | 0:76dfa9657d9d | 19 | * @brief This module implements the CRC-16 calculation in the blocks. |
jksoft | 0:76dfa9657d9d | 20 | */ |
jksoft | 0:76dfa9657d9d | 21 | |
jksoft | 0:76dfa9657d9d | 22 | #ifndef CRC16_H__ |
jksoft | 0:76dfa9657d9d | 23 | #define CRC16_H__ |
jksoft | 0:76dfa9657d9d | 24 | |
jksoft | 0:76dfa9657d9d | 25 | #include <stdint.h> |
jksoft | 0:76dfa9657d9d | 26 | |
jksoft | 0:76dfa9657d9d | 27 | #ifdef __cplusplus |
jksoft | 0:76dfa9657d9d | 28 | extern "C" { |
jksoft | 0:76dfa9657d9d | 29 | #endif |
jksoft | 0:76dfa9657d9d | 30 | |
jksoft | 0:76dfa9657d9d | 31 | /**@brief Function for calculating CRC-16 in blocks. |
jksoft | 0:76dfa9657d9d | 32 | * |
jksoft | 0:76dfa9657d9d | 33 | * Feed each consecutive data block into this function, along with the current value of p_crc as |
jksoft | 0:76dfa9657d9d | 34 | * returned by the previous call of this function. The first call of this function should pass NULL |
jksoft | 0:76dfa9657d9d | 35 | * as the initial value of the crc in p_crc. |
jksoft | 0:76dfa9657d9d | 36 | * |
jksoft | 0:76dfa9657d9d | 37 | * @param[in] p_data The input data block for computation. |
jksoft | 0:76dfa9657d9d | 38 | * @param[in] size The size of the input data block in bytes. |
jksoft | 0:76dfa9657d9d | 39 | * @param[in] p_crc The previous calculated CRC-16 value or NULL if first call. |
jksoft | 0:76dfa9657d9d | 40 | * |
jksoft | 0:76dfa9657d9d | 41 | * @return The updated CRC-16 value, based on the input supplied. |
jksoft | 0:76dfa9657d9d | 42 | */ |
jksoft | 0:76dfa9657d9d | 43 | uint16_t crc16_compute(const uint8_t * p_data, uint32_t size, const uint16_t * p_crc); |
jksoft | 0:76dfa9657d9d | 44 | |
jksoft | 0:76dfa9657d9d | 45 | #ifdef __cplusplus |
jksoft | 0:76dfa9657d9d | 46 | } |
jksoft | 0:76dfa9657d9d | 47 | #endif |
jksoft | 0:76dfa9657d9d | 48 | |
jksoft | 0:76dfa9657d9d | 49 | |
jksoft | 0:76dfa9657d9d | 50 | #endif // CRC16_H__ |
jksoft | 0:76dfa9657d9d | 51 | |
jksoft | 0:76dfa9657d9d | 52 | /** @} */ |