MSP430 DriverLib for MSP430FR5xx_6xx Devices  2.21.00.08
 All Data Structures Functions Variables Modules Pages
crc32.h
1 //*****************************************************************************
2 //
3 // crc32.h - Driver for the CRC32 Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_CRC32_H__
8 #define __MSP430WARE_CRC32_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_CRC32__
13 
14 //*****************************************************************************
15 //
16 // If building with a C++ compiler, make all of the definitions in this header
17 // have a C binding.
18 //
19 //*****************************************************************************
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 
25 //*****************************************************************************
26 //
27 // The following are values that can be passed to the crcMode parameter for
28 // functions: CRC32_setSeed(), CRC32_getResult(), CRC32_getResultReversed(),
29 // CRC32_set8BitDataReversed(), CRC32_set16BitDataReversed(),
30 // CRC32_set8BitData(), and CRC32_set16BitData().
31 //
32 //*****************************************************************************
33 #define CRC32_MODE (0x01)
34 #define CRC16_MODE (0x00)
35 
36 //*****************************************************************************
37 //
38 // Prototypes for the APIs.
39 //
40 //*****************************************************************************
41 
42 //*****************************************************************************
43 //
44 //! \brief Sets the seed for the CRC32.
45 //!
46 //! This function sets the seed for the CRC32 to begin generating a signature
47 //! with the given seed and all passed data. Using this function resets the
48 //! CRC32 signature.
49 //!
50 //! \param seed is the seed for the CRC32 to start generating a signature from.
51 //! \n Modified bits are \b CRC32INIRESL0 of \b CRC32INIRESL0 register.
52 //! \param crcMode selects the mode of operation for the CRC32
53 //! Valid values are:
54 //! - \b CRC32_MODE - 32 Bit Mode
55 //! - \b CRC16_MODE - 16 Bit Mode
56 //!
57 //! \return None
58 //
59 //*****************************************************************************
60 extern void CRC32_setSeed(uint32_t seed,
61  uint8_t crcMode);
62 
63 //*****************************************************************************
64 //
65 //! \brief Sets the 8 bit data to add into the CRC32 module to generate a new
66 //! signature.
67 //!
68 //! This function sets the given data into the CRC32 module to generate the new
69 //! signature from the current signature and new data. Bit 0 is treated as the
70 //! LSB.
71 //!
72 //! \param dataIn is the data to be added, through the CRC32 module, to the
73 //! signature.
74 //! \param crcMode selects the mode of operation for the CRC32
75 //! Valid values are:
76 //! - \b CRC32_MODE - 32 Bit Mode
77 //! - \b CRC16_MODE - 16 Bit Mode
78 //!
79 //! \return None
80 //
81 //*****************************************************************************
82 extern void CRC32_set8BitData(uint8_t dataIn,
83  uint8_t crcMode);
84 
85 //*****************************************************************************
86 //
87 //! \brief Sets the 16 bit data to add into the CRC32 module to generate a new
88 //! signature.
89 //!
90 //! This function sets the given data into the CRC32 module to generate the new
91 //! signature from the current signature and new data. Bit 0 is treated as the
92 //! LSB.
93 //!
94 //! \param dataIn is the data to be added, through the CRC32 module, to the
95 //! signature.
96 //! \param crcMode selects the mode of operation for the CRC32
97 //! Valid values are:
98 //! - \b CRC32_MODE - 32 Bit Mode
99 //! - \b CRC16_MODE - 16 Bit Mode
100 //!
101 //! \return None
102 //
103 //*****************************************************************************
104 extern void CRC32_set16BitData(uint16_t dataIn,
105  uint8_t crcMode);
106 
107 //*****************************************************************************
108 //
109 //! \brief Sets the 32 bit data to add into the CRC32 module to generate a new
110 //! signature.
111 //!
112 //! This function sets the given data into the CRC32 module to generate the new
113 //! signature from the current signature and new data. Bit 0 is treated as the
114 //! LSB.
115 //!
116 //! \param dataIn is the data to be added, through the CRC32 module, to the
117 //! signature.
118 //!
119 //! \return None
120 //
121 //*****************************************************************************
122 extern void CRC32_set32BitData(uint32_t dataIn);
123 
124 //*****************************************************************************
125 //
126 //! \brief Translates the data by reversing the bits in each 8 bit data and
127 //! then sets this data to add into the CRC32 module to generate a new
128 //! signature.
129 //!
130 //! This function first reverses the bits in each byte of the data and then
131 //! generates the new signature from the current signature and new translated
132 //! data. Bit 0 is treated as the MSB.
133 //!
134 //! \param dataIn is the data to be added, through the CRC32 module, to the
135 //! signature.
136 //! \param crcMode selects the mode of operation for the CRC32
137 //! Valid values are:
138 //! - \b CRC32_MODE - 32 Bit Mode
139 //! - \b CRC16_MODE - 16 Bit Mode
140 //!
141 //! \return None
142 //
143 //*****************************************************************************
144 extern void CRC32_set8BitDataReversed(uint8_t dataIn,
145  uint8_t crcMode);
146 
147 //*****************************************************************************
148 //
149 //! \brief Translates the data by reversing the bits in each 16 bit data and
150 //! then sets this data to add into the CRC32 module to generate a new
151 //! signature.
152 //!
153 //! This function first reverses the bits in each byte of the data and then
154 //! generates the new signature from the current signature and new translated
155 //! data. Bit 0 is treated as the MSB.
156 //!
157 //! \param dataIn is the data to be added, through the CRC32 module, to the
158 //! signature.
159 //! \param crcMode selects the mode of operation for the CRC32
160 //! Valid values are:
161 //! - \b CRC32_MODE - 32 Bit Mode
162 //! - \b CRC16_MODE - 16 Bit Mode
163 //!
164 //! \return None
165 //
166 //*****************************************************************************
167 extern void CRC32_set16BitDataReversed(uint16_t dataIn,
168  uint8_t crcMode);
169 
170 //*****************************************************************************
171 //
172 //! \brief Translates the data by reversing the bits in each 32 bit data and
173 //! then sets this data to add into the CRC32 module to generate a new
174 //! signature.
175 //!
176 //! This function first reverses the bits in each byte of the data and then
177 //! generates the new signature from the current signature and new translated
178 //! data. Bit 0 is treated as the MSB.
179 //!
180 //! \param dataIn is the data to be added, through the CRC32 module, to the
181 //! signature.
182 //!
183 //! \return None
184 //
185 //*****************************************************************************
186 extern void CRC32_set32BitDataReversed(uint32_t dataIn);
187 
188 //*****************************************************************************
189 //
190 //! \brief Returns the value of the signature result.
191 //!
192 //! This function returns the value of the signature result generated by the
193 //! CRC32. Bit 0 is treated as LSB.
194 //!
195 //! \param crcMode selects the mode of operation for the CRC32
196 //! Valid values are:
197 //! - \b CRC32_MODE - 32 Bit Mode
198 //! - \b CRC16_MODE - 16 Bit Mode
199 //!
200 //! \return The signature result
201 //
202 //*****************************************************************************
203 extern uint32_t CRC32_getResult(uint8_t crcMode);
204 
205 //*****************************************************************************
206 //
207 //! \brief Returns the bit-wise reversed format of the 32 bit signature result.
208 //!
209 //! This function returns the bit-wise reversed format of the signature result.
210 //! Bit 0 is treated as MSB.
211 //!
212 //! \param crcMode selects the mode of operation for the CRC32
213 //! Valid values are:
214 //! - \b CRC32_MODE - 32 Bit Mode
215 //! - \b CRC16_MODE - 16 Bit Mode
216 //!
217 //! \return The bit-wise reversed format of the signature result
218 //
219 //*****************************************************************************
220 extern uint32_t CRC32_getResultReversed(uint8_t crcMode);
221 
222 //*****************************************************************************
223 //
224 // Mark the end of the C bindings section for C++ compilers.
225 //
226 //*****************************************************************************
227 #ifdef __cplusplus
228 }
229 #endif
230 
231 #endif
232 #endif // __MSP430WARE_CRC32_H__
void CRC32_set32BitDataReversed(uint32_t dataIn)
Translates the data by reversing the bits in each 32 bit data and then sets this data to add into the...
Definition: crc32.c:83
void CRC32_set8BitData(uint8_t dataIn, uint8_t crcMode)
Sets the 8 bit data to add into the CRC32 module to generate a new signature.
Definition: crc32.c:34
void CRC32_set32BitData(uint32_t dataIn)
Sets the 32 bit data to add into the CRC32 module to generate a new signature.
Definition: crc32.c:55
void CRC32_setSeed(uint32_t seed, uint8_t crcMode)
Sets the seed for the CRC32.
Definition: crc32.c:21
uint32_t CRC32_getResult(uint8_t crcMode)
Returns the value of the signature result.
Definition: crc32.c:90
void CRC32_set8BitDataReversed(uint8_t dataIn, uint8_t crcMode)
Translates the data by reversing the bits in each 8 bit data and then sets this data to add into the ...
Definition: crc32.c:63
void CRC32_set16BitDataReversed(uint16_t dataIn, uint8_t crcMode)
Translates the data by reversing the bits in each 16 bit data and then sets this data to add into the...
Definition: crc32.c:73
uint32_t CRC32_getResultReversed(uint8_t crcMode)
Returns the bit-wise reversed format of the 32 bit signature result.
Definition: crc32.c:105
void CRC32_set16BitData(uint16_t dataIn, uint8_t crcMode)
Sets the 16 bit data to add into the CRC32 module to generate a new signature.
Definition: crc32.c:44

Copyright 2015, Texas Instruments Incorporated