![]() |
MCUXpresso SDK API Reference Manual
Rev. 0
NXP Semiconductors
|
The MCUXpresso SDK provides a peripheral driver for the Cyclic Redundancy Check (CRC) module of MCUXpresso SDK devices.
The cyclic redundancy check (CRC) module generates 16/32-bit CRC code for error detection. The CRC module also provides a programmable polynomial, seed, and other parameters required to implement a 16-bit or 32-bit CRC standard.
Data Structures | |
| struct | crc_config_t |
| CRC protocol configuration. More... | |
Macros | |
| #define | FSL_CRC_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
| CRC driver version 2.0.0. More... | |
Enumerations | |
| enum | crc_type_t { kCRC_Crc16 = CRC_CONTROL_CRCMOD(0), kCRC_Crc32 = CRC_CONTROL_CRCMOD(1) } |
| CRC type. More... | |
| enum | crc_endian_t { kCRC_MsbFirst = CRC_CONTROL_CRCINV(0), kCRC_LsbFirst = CRC_CONTROL_CRCINV(1) } |
| CRC INV selection. More... | |
Functions | |
| void | CRC_Init (CRC_Type *base) |
| Enables the CRC peripheral module. More... | |
| void | CRC_Deinit (CRC_Type *base) |
| Disables the CRC peripheral module. More... | |
| void | CRC_GetDefaultConfig (crc_config_t *config) |
| Provide default CRC protocol configuration. More... | |
| void | CRC_SetConfig (CRC_Type *base, const crc_config_t *config) |
| Configures the CRC peripheral module. More... | |
| static void | CRC_SetSeed (CRC_Type *base, uint32_t crcPreload) |
| Set the CRC seed value. More... | |
| void | CRC_WriteData (CRC_Type *base, const uint8_t *buffer, uint32_t len) |
| Set CRC type of transpose of write data. More... | |
| static uint32_t | CRC_GetResult (CRC_Type *base) |
| Reads the checksum from the CRC module. More... | |
| struct crc_config_t |
This structure holds the configuration for the CRC protocol.
Data Fields | |
| bool | crcEnable: 1 |
| Block Enable or Disable. More... | |
| crc_type_t | crcMode |
| Select CRC protocol. More... | |
| crc_endian_t | crcEndian |
| Select MSB or ILSB first data processing. More... | |
| bool crc_config_t::crcEnable |
| crc_type_t crc_config_t::crcMode |
| crc_endian_t crc_config_t::crcEndian |
| #define FSL_CRC_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) |
| enum crc_type_t |
| enum crc_endian_t |
| void CRC_Init | ( | CRC_Type * | base | ) |
This function enables the clock gate for the CRC peripheral.
| base | CRC peripheral address. |
| void CRC_Deinit | ( | CRC_Type * | base | ) |
This function disables the clock gate for the CRC peripheral.
| base | CRC peripheral address. |
| void CRC_GetDefaultConfig | ( | crc_config_t * | config | ) |
The purpose of this API is to initialize the configuration structure to default value for CRC_SetConfig to use. Provides the configuration of commonly used CRC protocols. The default configuration is:
This is an example:
| config | CRC protocol configuration structure. |
| void CRC_SetConfig | ( | CRC_Type * | base, |
| const crc_config_t * | config | ||
| ) |
This function configures the CRC module and starts a checksum computation by writing the seed.
| base | CRC peripheral address. |
| config | CRC module configuration structure. |
|
inlinestatic |
This function is help to write a 16/32 bit CRC seed value.
| base | CRC peripheral address. |
| crcPreload | The value of seed. |
| void CRC_WriteData | ( | CRC_Type * | base, |
| const uint8_t * | buffer, | ||
| uint32_t | len | ||
| ) |
This function writes data to CRC.
| base | CRC peripheral address. |
| buffer | data message to be checked. |
| len | length of buffer. |
|
inlinestatic |
Reads the CRC data register (either an intermediate or the final checksum).
| base | CRC peripheral address. |