2 * Copyright (c) 2014, Texas Instruments Incorporated
\r
3 * All rights reserved.
\r
5 * Redistribution and use in source and binary forms, with or without
\r
6 * modification, are permitted provided that the following conditions
\r
9 * * Redistributions of source code must retain the above copyright
\r
10 * notice, this list of conditions and the following disclaimer.
\r
12 * * Redistributions in binary form must reproduce the above copyright
\r
13 * notice, this list of conditions and the following disclaimer in the
\r
14 * documentation and/or other materials provided with the distribution.
\r
16 * * Neither the name of Texas Instruments Incorporated nor the names of
\r
17 * its contributors may be used to endorse or promote products derived
\r
18 * from this software without specific prior written permission.
\r
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
\r
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
\r
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
\r
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
\r
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
\r
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
\r
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
\r
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
\r
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
\r
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
\r
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
32 //*****************************************************************************
\r
34 // crc.h - Driver for the CRC Module.
\r
36 //*****************************************************************************
\r
38 #ifndef __MSP430WARE_CRC_H__
\r
39 #define __MSP430WARE_CRC_H__
\r
41 #include "inc/hw_memmap.h"
\r
43 #ifdef __MSP430_HAS_CRC__
\r
45 //*****************************************************************************
\r
47 // If building with a C++ compiler, make all of the definitions in this header
\r
48 // have a C binding.
\r
50 //*****************************************************************************
\r
56 //*****************************************************************************
\r
58 // Prototypes for the APIs.
\r
60 //*****************************************************************************
\r
62 //*****************************************************************************
\r
64 //! \brief Sets the seed for the CRC.
\r
66 //! This function sets the seed for the CRC to begin generating a signature
\r
67 //! with the given seed and all passed data. Using this function resets the CRC
\r
70 //! \param baseAddress is the base address of the CRC module.
\r
71 //! \param seed is the seed for the CRC to start generating a signature from.
\r
72 //! \n Modified bits are \b CRCINIRES of \b CRCINIRES register.
\r
76 //*****************************************************************************
\r
77 extern void CRC_setSeed(uint16_t baseAddress,
\r
80 //*****************************************************************************
\r
82 //! \brief Sets the 16 bit data to add into the CRC module to generate a new
\r
85 //! This function sets the given data into the CRC module to generate the new
\r
86 //! signature from the current signature and new data.
\r
88 //! \param baseAddress is the base address of the CRC module.
\r
89 //! \param dataIn is the data to be added, through the CRC module, to the
\r
91 //! \n Modified bits are \b CRCDI of \b CRCDI register.
\r
95 //*****************************************************************************
\r
96 extern void CRC_set16BitData(uint16_t baseAddress,
\r
99 //*****************************************************************************
\r
101 //! \brief Sets the 8 bit data to add into the CRC module to generate a new
\r
104 //! This function sets the given data into the CRC module to generate the new
\r
105 //! signature from the current signature and new data.
\r
107 //! \param baseAddress is the base address of the CRC module.
\r
108 //! \param dataIn is the data to be added, through the CRC module, to the
\r
110 //! \n Modified bits are \b CRCDI of \b CRCDI register.
\r
114 //*****************************************************************************
\r
115 extern void CRC_set8BitData(uint16_t baseAddress,
\r
118 //*****************************************************************************
\r
120 //! \brief Translates the 16 bit data by reversing the bits in each byte and
\r
121 //! then sets this data to add into the CRC module to generate a new signature.
\r
123 //! This function first reverses the bits in each byte of the data and then
\r
124 //! generates the new signature from the current signature and new translated
\r
127 //! \param baseAddress is the base address of the CRC module.
\r
128 //! \param dataIn is the data to be added, through the CRC module, to the
\r
130 //! \n Modified bits are \b CRCDIRB of \b CRCDIRB register.
\r
134 //*****************************************************************************
\r
135 extern void CRC_set16BitDataReversed(uint16_t baseAddress,
\r
138 //*****************************************************************************
\r
140 //! \brief Translates the 8 bit data by reversing the bits in each byte and
\r
141 //! then sets this data to add into the CRC module to generate a new signature.
\r
143 //! This function first reverses the bits in each byte of the data and then
\r
144 //! generates the new signature from the current signature and new translated
\r
147 //! \param baseAddress is the base address of the CRC module.
\r
148 //! \param dataIn is the data to be added, through the CRC module, to the
\r
150 //! \n Modified bits are \b CRCDIRB of \b CRCDIRB register.
\r
154 //*****************************************************************************
\r
155 extern void CRC_set8BitDataReversed(uint16_t baseAddress,
\r
158 //*****************************************************************************
\r
160 //! \brief Returns the value currently in the Data register.
\r
162 //! This function returns the value currently in the data register. If set in
\r
163 //! byte bits reversed format, then the translated data would be returned.
\r
165 //! \param baseAddress is the base address of the CRC module.
\r
167 //! \return The value currently in the data register
\r
169 //*****************************************************************************
\r
170 extern uint16_t CRC_getData(uint16_t baseAddress);
\r
172 //*****************************************************************************
\r
174 //! \brief Returns the value pf the Signature Result.
\r
176 //! This function returns the value of the signature result generated by the
\r
179 //! \param baseAddress is the base address of the CRC module.
\r
181 //! \return The value currently in the data register
\r
183 //*****************************************************************************
\r
184 extern uint16_t CRC_getResult(uint16_t baseAddress);
\r
186 //*****************************************************************************
\r
188 //! \brief Returns the bit-wise reversed format of the Signature Result.
\r
190 //! This function returns the bit-wise reversed format of the Signature Result.
\r
192 //! \param baseAddress is the base address of the CRC module.
\r
194 //! \return The bit-wise reversed format of the Signature Result
\r
196 //*****************************************************************************
\r
197 extern uint16_t CRC_getResultBitsReversed(uint16_t baseAddress);
\r
199 //*****************************************************************************
\r
201 // Mark the end of the C bindings section for C++ compilers.
\r
203 //*****************************************************************************
\r
209 #endif // __MSP430WARE_CRC_H__
\r