51 #ifndef ti_dl_dl_crc__include 52 #define ti_dl_dl_crc__include 57 #include <ti/devices/msp/msp.h> 60 #ifdef __MSPM0_HAS_CRC__ 66 #if (CRC_SYS_CRC32_ENABLE == 1) 70 #define DEVICE_HAS_CRC_32_BIT_POLYNOMIAL 78 #ifdef DEVICE_HAS_CRC_32_BIT_POLYNOMIAL 81 DL_CRC_32_POLYNOMIAL = CRC_CRCCTRL_POLYSIZE_CRC32
98 CRC_CRCCTRL_INPUT_ENDIANNESS_LITTLE_ENDIAN,
123 crc->GPRCM.PWREN = (CRC_PWREN_KEY_UNLOCK_W | CRC_PWREN_ENABLE_ENABLE);
138 crc->GPRCM.PWREN = (CRC_PWREN_KEY_UNLOCK_W | CRC_PWREN_ENABLE_DISABLE);
161 (crc->GPRCM.PWREN & CRC_PWREN_ENABLE_MASK) == CRC_PWREN_ENABLE_ENABLE);
172 (CRC_RSTCTL_KEY_UNLOCK_W | CRC_RSTCTL_RESETSTKYCLR_CLR |
173 CRC_RSTCTL_RESETASSERT_ASSERT);
187 return ((crc->GPRCM.STAT & CRC_STAT_RESETSTKY_MASK) ==
188 CRC_STAT_RESETSTKY_RESET);
203 __STATIC_INLINE
void DL_CRC_init(CRC_Regs *crc, DL_CRC_POLYNOMIAL poly,
204 DL_CRC_BIT bitOrd, DL_CRC_INPUT_ENDIANESS inEndianness,
205 DL_CRC_OUTPUT_BYTESWAP outByteSwap)
207 crc->CRCCTRL = ((uint32_t) poly | (uint32_t) bitOrd |
208 (uint32_t) inEndianness | (uint32_t) outByteSwap);
225 volatile uintptr_t addr;
226 volatile uint16_t *pRef;
228 addr = (uintptr_t)((
volatile uintptr_t *) &crc->CRCSEED);
229 pRef = (
volatile uint16_t *) addr;
261 volatile uint8_t *pRef = (
volatile uint8_t *) &crc->CRCIN;
275 volatile uintptr_t addr;
276 volatile uint16_t *pRef;
278 addr = (uintptr_t)((
volatile uintptr_t *) &crc->CRCIN);
279 pRef = (
volatile uint16_t *) addr;
309 return ((uint16_t) crc->CRCOUT);
321 return (crc->CRCOUT);
338 CRC_Regs *crc, uint32_t seed,
const uint32_t *ptr, uint32_t size);
356 CRC_Regs *crc, uint32_t seed, uint32_t *ptrStart,
const uint32_t *ptrEnd);
372 CRC_Regs *crc, uint16_t seed,
const uint16_t *ptr, uint16_t size);
390 CRC_Regs *crc, uint16_t seed, uint16_t *ptrStart,
const uint16_t *ptrEnd);
404 return ((uintptr_t) &crc->CRCIN);
__STATIC_INLINE void DL_CRC_disablePower(CRC_Regs *crc)
Disables the Peripheral Write Enable (PWREN) register for the CRC.
Definition: dl_crc.h:136
__STATIC_INLINE void DL_CRC_feedData32(CRC_Regs *crc, uint32_t dataIn)
Feeds 32-bit data into the CRC calculation.
Definition: dl_crc.h:295
__STATIC_INLINE uint16_t DL_CRC_getResult16(const CRC_Regs *crc)
Returns the result from the 16-bit polynomial calculation.
Definition: dl_crc.h:307
__STATIC_INLINE void DL_CRC_setSeed16(CRC_Regs *crc, uint16_t seed)
Initializes the seed for a 16-bit polynomial CRC calculation.
Definition: dl_crc.h:223
DL_CRC_BIT
Definition: dl_crc.h:86
uint32_t DL_CRC_calculateMemoryRange32(CRC_Regs *crc, uint32_t seed, uint32_t *ptrStart, const uint32_t *ptrEnd)
Calculates the CRC over a memory range.
__STATIC_INLINE void DL_CRC_feedData16(CRC_Regs *crc, uint16_t dataIn)
Feeds 16-bit data into the CRC calculation.
Definition: dl_crc.h:273
__STATIC_INLINE void DL_CRC_feedData8(CRC_Regs *crc, uint8_t dataIn)
Feeds 8-bit data into the CRC calculation.
Definition: dl_crc.h:259
__STATIC_INLINE void DL_CRC_setSeed32(CRC_Regs *crc, uint32_t seed)
Initializes the seed for a 32-bit polynomial CRC calculation.
Definition: dl_crc.h:246
__STATIC_INLINE uint32_t DL_CRC_getResult32(const CRC_Regs *crc)
Returns the result from the 32-bit polynomial calculation.
Definition: dl_crc.h:319
__STATIC_INLINE void DL_CRC_reset(CRC_Regs *crc)
Resets crc peripheral.
Definition: dl_crc.h:169
DL_CRC_OUTPUT_BYTESWAP
Definition: dl_crc.h:105
__STATIC_INLINE uintptr_t DL_CRC_getCRCINAddr(const CRC_Regs *crc)
Returns the address of the CRC input data register.
Definition: dl_crc.h:402
__STATIC_INLINE void DL_CRC_init(CRC_Regs *crc, DL_CRC_POLYNOMIAL poly, DL_CRC_BIT bitOrd, DL_CRC_INPUT_ENDIANESS inEndianness, DL_CRC_OUTPUT_BYTESWAP outByteSwap)
Initializes CRC.
Definition: dl_crc.h:203
DL_CRC_POLYNOMIAL
Definition: dl_crc.h:74
uint16_t DL_CRC_calculateBlock16(CRC_Regs *crc, uint16_t seed, const uint16_t *ptr, uint16_t size)
Calculates the CRC over a range of 16-bit values.
uint16_t DL_CRC_calculateMemoryRange16(CRC_Regs *crc, uint16_t seed, uint16_t *ptrStart, const uint16_t *ptrEnd)
Calculates the CRC over a memory range.
__STATIC_INLINE void DL_CRC_enablePower(CRC_Regs *crc)
Enables the Peripheral Write Enable (PWREN) register for the CRC.
Definition: dl_crc.h:121
DL_CRC_INPUT_ENDIANESS
Definition: dl_crc.h:94
uint32_t DL_CRC_calculateBlock32(CRC_Regs *crc, uint32_t seed, const uint32_t *ptr, uint32_t size)
Calculates the CRC over a range of 32-bit values.
__STATIC_INLINE bool DL_CRC_isPowerEnabled(const CRC_Regs *crc)
Returns if the Peripheral Write Enable (PWREN) register for the CRC is enabled.
Definition: dl_crc.h:158
__STATIC_INLINE bool DL_CRC_isReset(const CRC_Regs *crc)
Returns if crc module has been reset.
Definition: dl_crc.h:185