crc32.h
Go to the documentation of this file.
1 /* --COPYRIGHT--,BSD
2  * Copyright (c) 2017, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  * --/COPYRIGHT--*/
32 #ifndef _CRC_32_H
33 
34 //*****************************************************************************
35 //
38 //
39 //*****************************************************************************
40 
41 #include <stdint.h>
42 
43 #define CRC16_MODE 0x00
44 #define CRC32_MODE 0x01
45 
46 //*****************************************************************************
47 //
61 //
62 //*****************************************************************************
63 extern void CRC32_setSeed(uint32_t seed, uint_fast8_t crcType);
64 
65 //*****************************************************************************
66 //
81 //
82 //*****************************************************************************
83 extern void CRC32_set8BitData(uint8_t dataIn, uint_fast8_t crcType);
84 
85 //*****************************************************************************
86 //
101 //
102 //*****************************************************************************
103 extern void CRC32_set16BitData(uint16_t dataIn, uint_fast8_t crcType);
104 
105 //*****************************************************************************
106 //
118 //
119 //*****************************************************************************
120 extern void CRC32_set32BitData(uint32_t dataIn);
121 
122 //*****************************************************************************
123 //
139 //
140 //*****************************************************************************
141 extern void CRC32_set8BitDataReversed(uint8_t dataIn, uint_fast8_t crcType);
142 
143 //*****************************************************************************
144 //
160 //
161 //*****************************************************************************
162 extern void CRC32_set16BitDataReversed(uint16_t dataIn, uint_fast8_t crcType);
163 
164 //*****************************************************************************
165 //
178 //
179 //*****************************************************************************
180 extern void CRC32_set32BitDataReversed(uint32_t dataIn);
181 
182 //*****************************************************************************
183 //
192 //
193 //*****************************************************************************
194 extern uint32_t CRC32_getResult(uint_fast8_t crcType);
195 
196 //*****************************************************************************
197 //
207 //
208 //*****************************************************************************
209 extern uint32_t CRC32_getResultReversed(uint_fast8_t crcType);
210 
211 /* Defines for future devices that might have multiple instances */
212 #define CRC32_setSeedMultipleInstance(a,b,c) CRC32_setSeed(b,c)
213 #define CRC32_set8BitDataMultipleInstance(a,b,c) CRC32_set8BitData(b,c)
214 #define CRC32_set16BitDataMultipleInstance(a,b,c) CRC32_set16BitData(b,c)
215 #define CRC32_set32BitDataMultipleInstance(a,b) CRC32_set32BitData(b)
216 #define CRC32_set8BitDataReversedMultipleInstance(a,b,c) CRC32_set8BitDataReversed(b,c)
217 #define CRC32_set16BitDataReversedMultipleInstance(a,b,c) CRC32_set16BitDataReversed(b,c)
218 #define CRC32_set32BitDataReversedMultipleInstance(a,b) CRC32_set32BitDataReversed(b)
219 #define CRC32_getResultMultipleInstance(a,b) CRC32_getResult()
220 #define CRC32_getResultReversedMultipleInstance(a,b) CRC32_getResultReversed(b)
221 
222 //*****************************************************************************
223 //
224 // Close the Doxygen group.
226 //
227 //*****************************************************************************
228 
229 
230 #endif
void CRC32_set8BitDataReversed(uint8_t dataIn, uint_fast8_t crcType)
Definition: crc32.c:80
void CRC32_set16BitDataReversed(uint16_t dataIn, uint_fast8_t crcType)
Definition: crc32.c:90
void CRC32_set32BitDataReversed(uint32_t dataIn)
Definition: crc32.c:100
void CRC32_set32BitData(uint32_t dataIn)
Definition: crc32.c:70
void CRC32_setSeed(uint32_t seed, uint_fast8_t crcType)
Definition: crc32.c:37
void CRC32_set16BitData(uint16_t dataIn, uint_fast8_t crcType)
Definition: crc32.c:60
void CRC32_set8BitData(uint8_t dataIn, uint_fast8_t crcType)
Definition: crc32.c:50
uint32_t CRC32_getResultReversed(uint_fast8_t crcType)
Definition: crc32.c:127
uint32_t CRC32_getResult(uint_fast8_t crcType)
Definition: crc32.c:111

Copyright 2019, Texas Instruments Incorporated