ucrc16.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016 Freie Universität Berlin
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
29 #ifndef CHECKSUM_UCRC16_H
30 #define CHECKSUM_UCRC16_H
31 
32 #include <stdint.h>
33 #include <stdlib.h>
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
43 #define UCRC16_CCITT_POLY_BE (0x1021)
44 #define UCRC16_CCITT_POLY_LE (0x8408)
59 uint16_t ucrc16_calc_be(const uint8_t *buf, size_t len, uint16_t poly,
60  uint16_t seed);
61 
74 uint16_t ucrc16_calc_le(const uint8_t *buf, size_t len, uint16_t poly,
75  uint16_t seed);
76 
77 #ifdef __cplusplus
78 }
79 #endif
80 
81 #endif /* CHECKSUM_UCRC16_H */
82 
ucrc16_calc_le
uint16_t ucrc16_calc_le(const uint8_t *buf, size_t len, uint16_t poly, uint16_t seed)
Calculate CRC16 (little-endian version)