2 * Copyright © 2015 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 #define AO_CRC_16_CCITT 0x1021
23 #define AO_CRC_16_CDMA2000 0xc867
24 #define AO_CRC_16_DECT 0x0589
25 #define AO_CRC_16_T10_DIF 0x8bb7
26 #define AO_CRC_16_DNP 0x3d65
27 #define AO_CRC_16_ANSI 0x8005
28 #define AO_CRC_16_DEFAULT AO_CRC_16_ANSI
30 #define AO_CRC_32_ANSI 0x04c11db7
31 #define AO_CRC_32_C 0x1edc6f41
33 #define AO_CRC_32_DEFAULT AO_CRC_32_ANSI
35 static inline uint16_t
36 ao_crc_in_32_out_16(uint32_t v) {
39 return (uint16_t) (v ^ (v >> 16));
42 static inline uint16_t
43 ao_crc_in_16_out_16(uint16_t v) {
45 return stm_crc.dr.u16;
48 static inline uint16_t
49 ao_crc_in_8_out_16(uint8_t v) {
51 return stm_crc.dr.u16;
60 #endif /* _AO_CRC_H_ */