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