/*
* -------------------------------------------
- * MSP432 DriverLib - v01_04_00_18
+ * MSP432 DriverLib - v3_10_00_09
* -------------------------------------------
*
* --COPYRIGHT--,BSD,BSD
- * Copyright (c) 2015, Texas Instruments Incorporated
+ * Copyright (c) 2014, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "crc32.h"
#include <msp.h>
#include <debug.h>
+#include <hw_memmap.h>
void CRC32_setSeed(uint32_t seed, uint_fast8_t crcType)
{
ASSERT((CRC16_MODE == crcType) || (CRC32_MODE == crcType));
if (CRC16_MODE == crcType)
- CRC32->rCRC16INIRES = seed;
+ CRC32->INIRES16 = seed;
else
{
- CRC32->rCRC32INIRES_HI = ((seed & 0xFFFF0000) >> 16);
- CRC32->rCRC32INIRES_LO = (seed & 0xFFFF);
+ CRC32->INIRES32_HI = ((seed & 0xFFFF0000) >> 16);
+ CRC32->INIRES32_LO = (seed & 0xFFFF);
}
}
ASSERT((CRC16_MODE == crcType) || (CRC32_MODE == crcType));
if (CRC16_MODE == crcType)
- HWREG8(CRC32_BASE + OFS_CRC16DI) = dataIn;
+ HWREG8(&(CRC32->DI16)) = dataIn;
else
- HWREG8(CRC32_BASE + OFS_CRC32DI) = dataIn;
+ HWREG8(&(CRC32->DI32)) = dataIn;
}
void CRC32_set16BitData(uint16_t dataIn, uint_fast8_t crcType)
ASSERT((CRC16_MODE == crcType) || (CRC32_MODE == crcType));
if (CRC16_MODE == crcType)
- CRC32->rCRC16DI = dataIn;
+ CRC32->DI16 = dataIn;
else
- CRC32->rCRC32DI = dataIn;
+ CRC32->DI32 = dataIn;
}
void CRC32_set32BitData(uint32_t dataIn)
{
- //CRC32->rCRC32DI = dataIn & 0xFFFF;
- //CRC32->rCRC32DI = (uint16_t) ((dataIn & 0xFFFF0000) >> 16);
+ //CRC32->DI32 = dataIn & 0xFFFF;
+ //CRC32->DI32 = (uint16_t) ((dataIn & 0xFFFF0000) >> 16);
- HWREG16(CRC32_BASE + OFS_CRC32DI) = dataIn & 0xFFFF;
- HWREG16(CRC32_BASE + OFS_CRC32DI) = (uint16_t)(
+ HWREG16(&(CRC32->DI32)) = dataIn & 0xFFFF;
+ HWREG16(&(CRC32->DI32)) = (uint16_t)(
(dataIn & 0xFFFF0000) >> 16);
}
ASSERT((CRC16_MODE == crcType) || (CRC32_MODE == crcType));
if (CRC16_MODE == crcType)
- HWREG8(CRC32_BASE + OFS_CRC16DIRB) = dataIn;
+ HWREG8(&(CRC32->DIRB16)) = dataIn;
else
- HWREG8(CRC32_BASE + OFS_CRC32DIRB) = dataIn;
+ HWREG8(&(CRC32->DIRB32)) = dataIn;
}
void CRC32_set16BitDataReversed(uint16_t dataIn, uint_fast8_t crcType)
ASSERT((CRC16_MODE == crcType) || (CRC32_MODE == crcType));
if (CRC16_MODE == crcType)
- CRC32->rCRC16DIRB = dataIn;
+ CRC32->DIRB16 = dataIn;
else
- CRC32->rCRC32DIRB = dataIn;
+ CRC32->DIRB32 = dataIn;
}
void CRC32_set32BitDataReversed(uint32_t dataIn)
{
- HWREG16(CRC32_BASE + OFS_CRC32DIRB) = dataIn & 0xFFFF;
- HWREG16(CRC32_BASE + OFS_CRC32DIRB) = (uint16_t)(
+ //CRC32->DIRB32 = dataIn & 0xFFFF;
+ //CRC32->DIRB32 = (uint16_t) ((dataIn & 0xFFFF0000) >> 16);
+
+ HWREG16(&(CRC32->DIRB32)) = dataIn & 0xFFFF;
+ HWREG16(&(CRC32->DIRB32)) = (uint16_t)(
(dataIn & 0xFFFF0000) >> 16);
- //CRC32->rCRC32DIRB = dataIn & 0xFFFF;
- //CRC32->rCRC32DIRB = (uint16_t) ((dataIn & 0xFFFF0000) >> 16);
+
}
uint32_t CRC32_getResult(uint_fast8_t crcType)
ASSERT((CRC16_MODE == crcType) || (CRC32_MODE == crcType));
if (CRC16_MODE == crcType)
- return CRC32->rCRC16INIRES;
+ return CRC32->INIRES16;
else
{
- result = CRC32->rCRC32INIRES_HI;
+ result = CRC32->INIRES32_HI;
result = (result << 16);
- result |= CRC32->rCRC32INIRES_LO;
+ result |= CRC32->INIRES32_LO;
return (result);
}
}
ASSERT((CRC16_MODE == crcType) || (CRC32_MODE == crcType));
if (CRC16_MODE == crcType)
- return CRC32->rCRC16RESR;
+ return CRC32->RESR16;
else
{
- result = CRC32->rCRC32RESR_HI;
+ result = CRC32->RESR32_HI;
result = (result << 16);
- result |= CRC32->rCRC32RESR_LO;
+ result |= CRC32->RESR32_LO;
return (result);
}
}