2020-2021 Sunseeker Telemetry and Lighting System
crc.c
Go to the documentation of this file.
1 //*****************************************************************************
2 //
3 // crc.c - Driver for the crc Module.
4 //
5 //*****************************************************************************
6 
7 //*****************************************************************************
8 //
11 //
12 //*****************************************************************************
13 
14 #include "inc/hw_memmap.h"
15 
16 #ifdef __MSP430_HAS_CRC__
17 #include "crc.h"
18 
19 #include <assert.h>
20 
21 void CRC_setSeed (uint16_t baseAddress,
22  uint16_t seed)
23 {
24  HWREG16(baseAddress + OFS_CRCINIRES) = seed;
25 }
26 
27 void CRC_set16BitData (uint16_t baseAddress,
28  uint16_t dataIn)
29 {
30  HWREG16(baseAddress + OFS_CRCDI) = dataIn;
31 }
32 
33 void CRC_set8BitData (uint16_t baseAddress,
34  uint8_t dataIn)
35 {
36  HWREG8(baseAddress + OFS_CRCDI_L) = dataIn;
37 }
38 
39 void CRC_set16BitDataReversed (uint16_t baseAddress,
40  uint16_t dataIn)
41 {
42  HWREG16(baseAddress + OFS_CRCDIRB) = dataIn;
43 }
44 
45 void CRC_set8BitDataReversed (uint16_t baseAddress,
46  uint8_t dataIn)
47 {
48  HWREG8(baseAddress + OFS_CRCDIRB_L) = dataIn;
49 }
50 
51 uint16_t CRC_getData (uint16_t baseAddress)
52 {
53  return ( HWREG16(baseAddress + OFS_CRCDI) );
54 }
55 
56 uint16_t CRC_getResult (uint16_t baseAddress)
57 {
58  return ( HWREG16(baseAddress + OFS_CRCINIRES) );
59 }
60 
61 uint16_t CRC_getResultBitsReversed (uint16_t baseAddress)
62 {
63  return ( HWREG16(baseAddress + OFS_CRCRESR) );
64 }
65 
66 #endif
67 //*****************************************************************************
68 //
71 //
72 //*****************************************************************************
#define HWREG8(x)
Definition: hw_memmap.h:41
#define HWREG16(x)
Definition: hw_memmap.h:39