MSP430 DriverLib for MSP430FR2xx_4xx Devices  2.10.00.09
 All Data Structures Functions Variables Modules Pages
crc.h
1 //*****************************************************************************
2 //
3 // crc.h - Driver for the CRC Module.
4 //
5 //*****************************************************************************
6 
7 #ifndef __MSP430WARE_CRC_H__
8 #define __MSP430WARE_CRC_H__
9 
10 #include "inc/hw_memmap.h"
11 
12 #ifdef __MSP430_HAS_CRC__
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 // Prototypes for the APIs.
28 //
29 //*****************************************************************************
30 
31 //*****************************************************************************
32 //
33 //! \brief Sets the seed for the CRC.
34 //!
35 //! This function sets the seed for the CRC to begin generating a signature
36 //! with the given seed and all passed data. Using this function resets the CRC
37 //! signature.
38 //!
39 //! \param baseAddress is the base address of the CRC module.
40 //! \param seed is the seed for the CRC to start generating a signature from.
41 //! \n Modified bits are \b CRCINIRES of \b CRCINIRES register.
42 //!
43 //! \return None
44 //
45 //*****************************************************************************
46 extern void CRC_setSeed(uint16_t baseAddress,
47  uint16_t seed);
48 
49 //*****************************************************************************
50 //
51 //! \brief Sets the 16 bit data to add into the CRC module to generate a new
52 //! signature.
53 //!
54 //! This function sets the given data into the CRC module to generate the new
55 //! signature from the current signature and new data.
56 //!
57 //! \param baseAddress is the base address of the CRC module.
58 //! \param dataIn is the data to be added, through the CRC module, to the
59 //! signature.
60 //! \n Modified bits are \b CRCDI of \b CRCDI register.
61 //!
62 //! \return None
63 //
64 //*****************************************************************************
65 extern void CRC_set16BitData(uint16_t baseAddress,
66  uint16_t dataIn);
67 
68 //*****************************************************************************
69 //
70 //! \brief Sets the 8 bit data to add into the CRC module to generate a new
71 //! signature.
72 //!
73 //! This function sets the given data into the CRC module to generate the new
74 //! signature from the current signature and new data.
75 //!
76 //! \param baseAddress is the base address of the CRC module.
77 //! \param dataIn is the data to be added, through the CRC module, to the
78 //! signature.
79 //! \n Modified bits are \b CRCDI of \b CRCDI register.
80 //!
81 //! \return None
82 //
83 //*****************************************************************************
84 extern void CRC_set8BitData(uint16_t baseAddress,
85  uint8_t dataIn);
86 
87 //*****************************************************************************
88 //
89 //! \brief Translates the 16 bit data by reversing the bits in each byte and
90 //! then sets this data to add into the CRC module to generate a new signature.
91 //!
92 //! This function first reverses the bits in each byte of the data and then
93 //! generates the new signature from the current signature and new translated
94 //! data.
95 //!
96 //! \param baseAddress is the base address of the CRC module.
97 //! \param dataIn is the data to be added, through the CRC module, to the
98 //! signature.
99 //! \n Modified bits are \b CRCDIRB of \b CRCDIRB register.
100 //!
101 //! \return None
102 //
103 //*****************************************************************************
104 extern void CRC_set16BitDataReversed(uint16_t baseAddress,
105  uint16_t dataIn);
106 
107 //*****************************************************************************
108 //
109 //! \brief Translates the 8 bit data by reversing the bits in each byte and
110 //! then sets this data to add into the CRC module to generate a new signature.
111 //!
112 //! This function first reverses the bits in each byte of the data and then
113 //! generates the new signature from the current signature and new translated
114 //! data.
115 //!
116 //! \param baseAddress is the base address of the CRC module.
117 //! \param dataIn is the data to be added, through the CRC module, to the
118 //! signature.
119 //! \n Modified bits are \b CRCDIRB of \b CRCDIRB register.
120 //!
121 //! \return None
122 //
123 //*****************************************************************************
124 extern void CRC_set8BitDataReversed(uint16_t baseAddress,
125  uint8_t dataIn);
126 
127 //*****************************************************************************
128 //
129 //! \brief Returns the value currently in the Data register.
130 //!
131 //! This function returns the value currently in the data register. If set in
132 //! byte bits reversed format, then the translated data would be returned.
133 //!
134 //! \param baseAddress is the base address of the CRC module.
135 //!
136 //! \return The value currently in the data register
137 //
138 //*****************************************************************************
139 extern uint16_t CRC_getData(uint16_t baseAddress);
140 
141 //*****************************************************************************
142 //
143 //! \brief Returns the value pf the Signature Result.
144 //!
145 //! This function returns the value of the signature result generated by the
146 //! CRC.
147 //!
148 //! \param baseAddress is the base address of the CRC module.
149 //!
150 //! \return The value currently in the data register
151 //
152 //*****************************************************************************
153 extern uint16_t CRC_getResult(uint16_t baseAddress);
154 
155 //*****************************************************************************
156 //
157 //! \brief Returns the bit-wise reversed format of the Signature Result.
158 //!
159 //! This function returns the bit-wise reversed format of the Signature Result.
160 //!
161 //! \param baseAddress is the base address of the CRC module.
162 //!
163 //! \return The bit-wise reversed format of the Signature Result
164 //
165 //*****************************************************************************
166 extern uint16_t CRC_getResultBitsReversed(uint16_t baseAddress);
167 
168 //*****************************************************************************
169 //
170 // Mark the end of the C bindings section for C++ compilers.
171 //
172 //*****************************************************************************
173 #ifdef __cplusplus
174 }
175 #endif
176 
177 #endif
178 #endif // __MSP430WARE_CRC_H__
void CRC_set8BitData(uint16_t baseAddress, uint8_t dataIn)
Sets the 8 bit data to add into the CRC module to generate a new signature.
Definition: crc.c:33
uint16_t CRC_getResult(uint16_t baseAddress)
Returns the value pf the Signature Result.
Definition: crc.c:56
void CRC_set16BitDataReversed(uint16_t baseAddress, uint16_t dataIn)
Translates the 16 bit data by reversing the bits in each byte and then sets this data to add into the...
Definition: crc.c:39
void CRC_set16BitData(uint16_t baseAddress, uint16_t dataIn)
Sets the 16 bit data to add into the CRC module to generate a new signature.
Definition: crc.c:27
void CRC_set8BitDataReversed(uint16_t baseAddress, uint8_t dataIn)
Translates the 8 bit data by reversing the bits in each byte and then sets this data to add into the ...
Definition: crc.c:45
void CRC_setSeed(uint16_t baseAddress, uint16_t seed)
Sets the seed for the CRC.
Definition: crc.c:21
uint16_t CRC_getData(uint16_t baseAddress)
Returns the value currently in the Data register.
Definition: crc.c:51
uint16_t CRC_getResultBitsReversed(uint16_t baseAddress)
Returns the bit-wise reversed format of the Signature Result.
Definition: crc.c:61

Copyright 2015, Texas Instruments Incorporated