Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of nRF51822 by
nordic/nrf-sdk/app_common/crc16.h@45:3c4df37ed83e, 2014-07-16 (annotated)
- Committer:
- Rohit Grover
- Date:
- Wed Jul 16 10:53:07 2014 +0100
- Revision:
- 45:3c4df37ed83e
- Parent:
- 37:c29c330d942c
add cplusplus guards for the cases where C files include the headers
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 | */ |
Rohit Grover |
45:3c4df37ed83e | 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 | */ |
Rohit Grover |
45:3c4df37ed83e | 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 | |
Rohit Grover |
45:3c4df37ed83e | 27 | #ifdef __cplusplus |
Rohit Grover |
45:3c4df37ed83e | 28 | extern "C" { |
Rohit Grover |
45:3c4df37ed83e | 29 | #endif |
Rohit Grover |
45:3c4df37ed83e | 30 | |
bogdanm | 0:eff01767de02 | 31 | /**@brief Function for calculating CRC-16 in blocks. |
bogdanm | 0:eff01767de02 | 32 | * |
Rohit Grover |
45:3c4df37ed83e | 33 | * Feed each consecutive data block into this function, along with the current value of p_crc as |
Rohit Grover |
45:3c4df37ed83e | 34 | * returned by the previous call of this function. The first call of this function should pass NULL |
bogdanm | 0:eff01767de02 | 35 | * as the initial value of the crc in p_crc. |
bogdanm | 0:eff01767de02 | 36 | * |
bogdanm | 0:eff01767de02 | 37 | * @param[in] p_data The input data block for computation. |
bogdanm | 0:eff01767de02 | 38 | * @param[in] size The size of the input data block in bytes. |
Rohit Grover |
45:3c4df37ed83e | 39 | * @param[in] p_crc The previous calculated CRC-16 value or NULL if first call. |
bogdanm | 0:eff01767de02 | 40 | * |
bogdanm | 0:eff01767de02 | 41 | * @return The updated CRC-16 value, based on the input supplied. |
bogdanm | 0:eff01767de02 | 42 | */ |
bogdanm | 0:eff01767de02 | 43 | uint16_t crc16_compute(const uint8_t * p_data, uint32_t size, const uint16_t * p_crc); |
bogdanm | 0:eff01767de02 | 44 | |
Rohit Grover |
45:3c4df37ed83e | 45 | #ifdef __cplusplus |
Rohit Grover |
45:3c4df37ed83e | 46 | } |
Rohit Grover |
45:3c4df37ed83e | 47 | #endif |
Rohit Grover |
45:3c4df37ed83e | 48 | |
Rohit Grover |
45:3c4df37ed83e | 49 | |
bogdanm | 0:eff01767de02 | 50 | #endif // CRC16_H__ |
Rohit Grover |
45:3c4df37ed83e | 51 | |
bogdanm | 0:eff01767de02 | 52 | /** @} */ |