PDL for FM4  Version1.2
Peripheral Driverl Library for FM4
Crc Functions (CRC)

Data Structures

struct  stc_crc_config
 Crc configuration. More...
 

Typedefs

typedef enum en_crc_mode en_crc_mode_t
 Crc mode. More...
 
typedef struct stc_crc_config stc_crc_config_t
 Crc configuration. More...
 

Enumerations

enum  en_crc_mode {
  Crc16 = 0,
  Crc32 = 1
}
 Crc mode. More...
 

Functions

en_result_t Crc_Init (stc_crc_config_t *pstcConfig)
 Initialisation of a CRC module. More...
 
void Crc_DeInit (void)
 De-Initialisation of a CRC module. More...
 
void Crc_Push8 (uint8_t u8DataToPush)
 Push 8-bit integer data to a CRC module with if no DMA is used. More...
 
void Crc_Push16 (uint16_t u16DataToPush)
 Push 16-bit integer data to a CRC module with if no DMA is used. More...
 
void Crc_Push32 (uint32_t u32DataToPush)
 Push 32-bit integer data to a CRC module with if no DMA is used. More...
 
uint32_t Crc_ReadResult (void)
 Read CRC result register. More...
 

Detailed Description

Provided functions of CRC module:

Initialize the CRC with Crc_Init(). After this there are to ways to calculate the check result:

The result can be read by calling Crc_ReadResult().

Be careful with the endian.

Typedef Documentation

typedef enum en_crc_mode en_crc_mode_t

Crc mode.

To select between CRC16 and CRC32

Crc configuration.

Enumeration Type Documentation

Crc mode.

To select between CRC16 and CRC32

Enumerator
Crc16 

CCITT CRC16 standard.

Crc32 

IEEE-802.3 CRC32 Ethernet standard.

Definition at line 106 of file crc.h.

Function Documentation

void Crc_DeInit ( void  )

De-Initialisation of a CRC module.

Definition at line 198 of file crc.c.

en_result_t Crc_Init ( stc_crc_config_t *  pstcConfig)

Initialisation of a CRC module.

Parameters
[in]pstcConfigCRC module configuration
Return values
OkInitializiation of CRC module successfully done.
ErrorInvalidParameterpstcConfig == NULL, parameter out of range

Definition at line 101 of file crc.c.

References stc_crc_config::bDataLittleEndian, stc_crc_config::bDataLsbFirst, stc_crc_config::bFinalXor, stc_crc_config::bResultLittleEndian, stc_crc_config::bResultLsbFirst, Crc16, Crc32, stc_crc_config::enMode, ErrorInvalidParameter, FALSE, Ok, TRUE, and stc_crc_config::u32CrcInitValue.

void Crc_Push16 ( uint16_t  u16DataToPush)

Push 16-bit integer data to a CRC module with if no DMA is used.

Note
Be careful with the endianess. Byte swapping might have to be performed before pushing 16-bit data.
Parameters
[in]u16DataToPush16-Bit data to be pushed to CRC

Definition at line 230 of file crc.c.

void Crc_Push32 ( uint32_t  u32DataToPush)

Push 32-bit integer data to a CRC module with if no DMA is used.

Parameters
[in]u32DataToPush32-Bit data to be pushed to CRC

Definition at line 244 of file crc.c.

void Crc_Push8 ( uint8_t  u8DataToPush)

Push 8-bit integer data to a CRC module with if no DMA is used.

Parameters
[in]u8DataToPush8-Bit data to be pushed to CRC

Definition at line 213 of file crc.c.

uint32_t Crc_ReadResult ( void  )

Read CRC result register.

Note
This function returns a 32-bit value regardless of a valid pointer to the CRC instance anyhow.
Return values
valueof CRC result

Definition at line 261 of file crc.c.