mediCAL's first BLE project
Fork of nRF51822 by
nordic/nrf-sdk/app_common/crc16.h@37:c29c330d942c, 2014-07-07 (annotated)
- Committer:
- Rohit Grover
- Date:
- Mon Jul 07 13:43:31 2014 +0100
- Revision:
- 37:c29c330d942c
- Parent:
- 0:eff01767de02
- Child:
- 45:3c4df37ed83e
changes required to upgrade to V7 of the soft-device
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 | |
bogdanm | 0:eff01767de02 | 27 | /**@brief Function for calculating CRC-16 in blocks. |
bogdanm | 0:eff01767de02 | 28 | * |
bogdanm | 0:eff01767de02 | 29 | * Feed each consecutive data block into this function, along with the current value of p_crc as |
bogdanm | 0:eff01767de02 | 30 | * returned by the previous call of this function. The first call of this function should pass NULL |
bogdanm | 0:eff01767de02 | 31 | * as the initial value of the crc in p_crc. |
bogdanm | 0:eff01767de02 | 32 | * |
bogdanm | 0:eff01767de02 | 33 | * @param[in] p_data The input data block for computation. |
bogdanm | 0:eff01767de02 | 34 | * @param[in] size The size of the input data block in bytes. |
bogdanm | 0:eff01767de02 | 35 | * @param[in] p_crc The previous calculated CRC-16 value or NULL if first call. |
bogdanm | 0:eff01767de02 | 36 | * |
bogdanm | 0:eff01767de02 | 37 | * @return The updated CRC-16 value, based on the input supplied. |
bogdanm | 0:eff01767de02 | 38 | */ |
bogdanm | 0:eff01767de02 | 39 | uint16_t crc16_compute(const uint8_t * p_data, uint32_t size, const uint16_t * p_crc); |
bogdanm | 0:eff01767de02 | 40 | |
bogdanm | 0:eff01767de02 | 41 | #endif // CRC16_H__ |
bogdanm | 0:eff01767de02 | 42 | |
bogdanm | 0:eff01767de02 | 43 | /** @} */ |