36 #if defined(GPCRC_PRESENT) && (GPCRC_COUNT > 0)
73 void GPCRC_Init(GPCRC_TypeDef * gpcrc,
const GPCRC_Init_TypeDef * init)
77 if (init->crcPoly == 0x04C11DB7)
79 polySelect = GPCRC_CTRL_POLYSEL_CRC32;
84 EFM_ASSERT((init->crcPoly & 0xFFFF0000) == 0);
85 polySelect = GPCRC_CTRL_POLYSEL_16;
88 gpcrc->CTRL = (((uint32_t)init->autoInit << _GPCRC_CTRL_AUTOINIT_SHIFT)
89 | ((uint32_t)init->reverseByteOrder << _GPCRC_CTRL_BYTEREVERSE_SHIFT)
90 | ((uint32_t)init->reverseBits << _GPCRC_CTRL_BITREVERSE_SHIFT)
91 | ((uint32_t)init->enableByteMode << _GPCRC_CTRL_BYTEMODE_SHIFT)
93 | ((uint32_t)init->enable << _GPCRC_CTRL_EN_SHIFT));
95 if (polySelect == GPCRC_CTRL_POLYSEL_16)
98 uint32_t revPoly = __RBIT(init->crcPoly) >> 16;
99 gpcrc->POLY = revPoly & _GPCRC_POLY_POLY_MASK;
103 gpcrc->INIT = init->initValue;
116 void GPCRC_Reset(GPCRC_TypeDef * gpcrc)
118 gpcrc->CTRL = _GPCRC_CTRL_RESETVALUE;
119 gpcrc->POLY = _GPCRC_POLY_RESETVALUE;
120 gpcrc->INIT = _GPCRC_INIT_RESETVALUE;
Emlib peripheral API "assert" implementation.
General Purpose Cyclic Redundancy Check (GPCRC) API.