![]() |
S32 SDK
|
Cyclic Redundancy Check Hardware Abstraction Layer.
This section describes the programming interface of the CRC HAL.
Enumerations | |
enum | crc_transpose_t { CRC_TRANSPOSE_NONE = 0x00U, CRC_TRANSPOSE_BITS = 0x01U, CRC_TRANSPOSE_BITS_AND_BYTES = 0x02U, CRC_TRANSPOSE_BYTES = 0x03U } |
CRC type of transpose of read write data Implements : crc_transpose_t_Class. More... | |
enum | crc_bit_width_t { CRC_BITS_16 = 0U, CRC_BITS_32 = 1U } |
CRC bit width Implements : crc_bit_width_t_Class. More... | |
CRC HAL API | |
void | CRC_HAL_Init (CRC_Type *const base) |
Initializes the CRC module. More... | |
uint32_t | CRC_HAL_GetCrc32 (CRC_Type *const base, uint32_t data, bool newSeed, uint32_t seed) |
Appends 32-bit data to the current CRC calculation and returns new result. More... | |
uint32_t | CRC_HAL_GetCrc16 (CRC_Type *const base, uint16_t data, bool newSeed, uint32_t seed) |
Appends 16-bit data to the current CRC calculation and returns new result. More... | |
uint32_t | CRC_HAL_GetCrc8 (CRC_Type *const base, uint8_t data, bool newSeed, uint32_t seed) |
Appends 8-bit data to the current CRC calculation and returns new result. More... | |
uint32_t | CRC_HAL_GetCrcResult (const CRC_Type *const base) |
Returns the current result of the CRC calculation. More... | |
static uint32_t | CRC_HAL_GetDataReg (const CRC_Type *const base) |
Gets the current CRC result. More... | |
static void | CRC_HAL_SetDataReg (CRC_Type *const base, uint32_t value) |
Sets the 32 bits of CRC data register. More... | |
static uint16_t | CRC_HAL_GetDataHReg (const CRC_Type *const base) |
Gets the upper 16 bits of the current CRC result. More... | |
static void | CRC_HAL_SetDataHReg (CRC_Type *const base, uint16_t value) |
Sets the upper 16 bits of CRC data register. More... | |
static uint16_t | CRC_HAL_GetDataLReg (const CRC_Type *const base) |
Gets the lower 16 bits of the current CRC result. More... | |
static void | CRC_HAL_SetDataLReg (CRC_Type *const base, uint16_t value) |
Sets the lower 16 bits of CRC data register. More... | |
static void | CRC_HAL_SetDataHUReg (CRC_Type *const base, uint8_t value) |
Sets the High Upper Byte - HU. More... | |
static void | CRC_HAL_SetDataHLReg (CRC_Type *const base, uint8_t value) |
Sets the High Lower Byte - HL. More... | |
static void | CRC_HAL_SetDataLUReg (CRC_Type *const base, uint8_t value) |
Sets the Low Upper Byte - LU. More... | |
static void | CRC_HAL_SetDataLLReg (CRC_Type *const base, uint8_t value) |
Sets the Low Lower Byte - LL. More... | |
static uint32_t | CRC_HAL_GetPolyReg (const CRC_Type *const base) |
Gets the polynomial register value. More... | |
static void | CRC_HAL_SetPolyReg (CRC_Type *const base, uint32_t value) |
Sets the polynomial register. More... | |
static uint16_t | CRC_HAL_GetPolyHReg (const CRC_Type *const base) |
Gets the upper 16 bits of polynomial register. More... | |
static void | CRC_HAL_SetPolyHReg (CRC_Type *const base, uint16_t value) |
Sets the upper 16 bits of polynomial register. More... | |
static uint16_t | CRC_HAL_GetPolyLReg (const CRC_Type *const base) |
Gets the lower 16 bits of polynomial register. More... | |
static void | CRC_HAL_SetPolyLReg (CRC_Type *const base, uint16_t value) |
Sets the lower 16 bits of polynomial register. More... | |
static bool | CRC_HAL_GetSeedOrDataMode (const CRC_Type *const base) |
Gets the CRC_DATA register mode. More... | |
static void | CRC_HAL_SetSeedOrDataMode (CRC_Type *const base, bool enable) |
Sets the CRC_DATA register mode. More... | |
static bool | CRC_HAL_GetFXorMode (const CRC_Type *const base) |
Gets complement read of CRC data register. More... | |
static void | CRC_HAL_SetFXorMode (CRC_Type *const base, bool enable) |
Sets complement read of CRC data register. More... | |
static crc_bit_width_t | CRC_HAL_GetProtocolWidth (const CRC_Type *const base) |
Gets the CRC protocol width. More... | |
static void | CRC_HAL_SetProtocolWidth (CRC_Type *const base, crc_bit_width_t width) |
Sets the CRC protocol width. More... | |
static crc_transpose_t | CRC_HAL_GetWriteTranspose (const CRC_Type *const base) |
Gets the CRC transpose type for writes. More... | |
static void | CRC_HAL_SetWriteTranspose (CRC_Type *const base, crc_transpose_t transp) |
Sets the CRC transpose type for writes. More... | |
static crc_transpose_t | CRC_HAL_GetReadTranspose (const CRC_Type *const base) |
Gets the CRC transpose type for reads. More... | |
static void | CRC_HAL_SetReadTranspose (CRC_Type *const base, crc_transpose_t transp) |
Sets the CRC transpose type for reads. More... | |
enum crc_bit_width_t |
enum crc_transpose_t |
uint32_t CRC_HAL_GetCrc16 | ( | CRC_Type *const | base, |
uint16_t | data, | ||
bool | newSeed, | ||
uint32_t | seed | ||
) |
Appends 16-bit data to the current CRC calculation and returns new result.
This function appends 16-bit data to the current CRC calculation and returns new result. If the newSeed is true, seed set and result are calculated from the seed new value (new CRC calculation)
[in] | base | The CRC peripheral base address |
[in] | data | Input data for CRC calculation |
[in] | newSeed | Sets new CRC calculation
|
[in] | seed | New seed if newSeed is true, else ignored |
uint32_t CRC_HAL_GetCrc32 | ( | CRC_Type *const | base, |
uint32_t | data, | ||
bool | newSeed, | ||
uint32_t | seed | ||
) |
Appends 32-bit data to the current CRC calculation and returns new result.
This function appends 32-bit data to the current CRC calculation and returns new result. If the newSeed is true, seed set and result are calculated from the seed new value (new CRC calculation)
[in] | base | The CRC peripheral base address |
[in] | data | Input data for CRC calculation |
[in] | newSeed | Sets new CRC calculation
|
[in] | seed | New seed if newSeed is true, else ignored |
uint32_t CRC_HAL_GetCrc8 | ( | CRC_Type *const | base, |
uint8_t | data, | ||
bool | newSeed, | ||
uint32_t | seed | ||
) |
Appends 8-bit data to the current CRC calculation and returns new result.
This function appends 8-bit data to the current CRC calculation and returns new result. If the newSeed is true, seed set and result are calculated from the seed new value (new CRC calculation)
[in] | base | The CRC peripheral base address |
[in] | data | Input data for CRC calculation |
[in] | newSeed | Sets new CRC calculation
|
[in] | seed | New seed if newSeed is true, else ignored |
uint32_t CRC_HAL_GetCrcResult | ( | const CRC_Type *const | base | ) |
|
inlinestatic |
Gets the upper 16 bits of the current CRC result.
This function gets the upper 16 bits of the current CRC result from the data register
[in] | base | The CRC peripheral base address |
|
inlinestatic |
Gets the lower 16 bits of the current CRC result.
This function gets the lower 16 bits of the current CRC result from the data register
[in] | base | The CRC peripheral base address |
|
inlinestatic |
|
inlinestatic |
Gets complement read of CRC data register.
This function gets complement read of CRC data register. Some CRC protocols require the final checksum to be XORed with 0xFFFFFFFF or 0xFFFF. Complement mode enables "on the fly" complementing of read data
[in] | base | The CRC peripheral base address |
|
inlinestatic |
Gets the upper 16 bits of polynomial register.
This function gets the upper 16 bits of polynomial register. Note that this upper part of the register is not used in 16-bit CRC mode
[in] | base | The CRC peripheral base address |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Gets the CRC protocol width.
This function gets the CRC protocol width
[in] | base | The CRC peripheral base address |
|
inlinestatic |
|
inlinestatic |
Gets the CRC_DATA register mode.
This function gets the CRC_DATA register mode
[in] | base | The CRC peripheral base address |
|
inlinestatic |
void CRC_HAL_Init | ( | CRC_Type *const | base | ) |
Initializes the CRC module.
This function initializes the module to default configuration (Initial checksum: 0U, Default polynomial: 0x1021U, Type of read transpose: CRC_TRANSPOSE_NONE, Type of write transpose: CRC_TRANSPOSE_NONE, No complement of checksum read, 32-bit CRC)
[in] | base | The CRC peripheral base address |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Sets complement read of CRC data register.
This function sets complement read of CRC data register. Some CRC protocols require the final checksum to be XORed with 0xFFFFFFFF or 0xFFFF. Complement mode enables "on the fly" complementing of read data
[in] | base | The CRC peripheral base address |
[in] | enable | Enable or disable complementing of read data Implements : CRC_HAL_SetFXorMode_Activity |
|
inlinestatic |
Sets the upper 16 bits of polynomial register.
This function sets the upper 16 bits of polynomial register. Note that this upper part of the register is ignored in 16-bit CRC mode
[in] | base | The CRC peripheral base address |
[in] | value | Polynomial value Implements : CRC_HAL_SetPolyHReg_Activity |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Sets the CRC protocol width.
This function sets the CRC protocol width
[in] | base | The CRC peripheral base address |
[in] | width | The CRC protocol width
|
|
inlinestatic |
|
inlinestatic |
Sets the CRC_DATA register mode.
This function sets the CRC_DATA register mode
[in] | base | The CRC peripheral base address |
[in] | enable | Enable CRC data register to use for seed value -true: use CRC data register for seed values. -false: use CRC data register for data values. Implements : CRC_HAL_SetSeedOrDataMode_Activity |
|
inlinestatic |