S32 SDK

Detailed Description

This section describes the programming interface of the CRC driver.

Data Structures

struct  crc_user_config_t
 CRC configuration structure. Implements : crc_user_config_t_Class. More...
 

Macros

#define CRC_DEFAULT_WRITE_TRANSPOSE   CRC_TRANSPOSE_NONE
 
#define CRC_DEFAULT_SEED   (0xFFFFU)
 

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...
 

CRC DRIVER API

status_t CRC_DRV_Init (uint32_t instance, const crc_user_config_t *userConfigPtr)
 Initializes the CRC module. More...
 
status_t CRC_DRV_Deinit (uint32_t instance)
 Sets the default configuration. More...
 
uint32_t CRC_DRV_GetCrc32 (uint32_t instance, 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_DRV_GetCrc16 (uint32_t instance, 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_DRV_GetCrc8 (uint32_t instance, uint8_t data, bool newSeed, uint32_t seed)
 Appends 8-bit data to the current CRC calculation and returns new result. More...
 
void CRC_DRV_WriteData (uint32_t instance, const uint8_t *data, uint32_t dataSize)
 Appends a block of bytes to the current CRC calculation. More...
 
uint32_t CRC_DRV_GetCrcResult (uint32_t instance)
 Returns the current result of the CRC calculation. More...
 
status_t CRC_DRV_Configure (uint32_t instance, const crc_user_config_t *userConfigPtr)
 Configures the CRC module from a user configuration structure. More...
 
status_t CRC_DRV_GetConfig (uint32_t instance, crc_user_config_t *const userConfigPtr)
 Get configures of the CRC module currently. More...
 
status_t CRC_DRV_GetDefaultConfig (crc_user_config_t *const userConfigPtr)
 Get default configures the CRC module for configuration structure. More...
 

Macro Definition Documentation

#define CRC_DEFAULT_SEED   (0xFFFFU)

Definition at line 44 of file crc_driver.h.

#define CRC_DEFAULT_WRITE_TRANSPOSE   CRC_TRANSPOSE_NONE

Definition at line 42 of file crc_driver.h.

Enumeration Type Documentation

CRC type of transpose of read write data Implements : crc_transpose_t_Class.

Enumerator
CRC_TRANSPOSE_NONE 

No transpose

CRC_TRANSPOSE_BITS 

Transpose bits in bytes

CRC_TRANSPOSE_BITS_AND_BYTES 

Transpose bytes and bits in bytes

CRC_TRANSPOSE_BYTES 

Transpose bytes

Definition at line 50 of file crc_driver.h.

Function Documentation

status_t CRC_DRV_Configure ( uint32_t  instance,
const crc_user_config_t userConfigPtr 
)

Configures the CRC module from a user configuration structure.

This function configures the CRC module from a user configuration structure

Parameters
[in]instanceThe CRC instance number
[in]userConfigPtrPointer to structure of initialization
Returns
Execution status (success)

Definition at line 239 of file crc_driver.c.

status_t CRC_DRV_Deinit ( uint32_t  instance)

Sets the default configuration.

This function sets the default configuration

Parameters
[in]instanceThe CRC instance number
Returns
Execution status (success)

Definition at line 91 of file crc_driver.c.

status_t CRC_DRV_GetConfig ( uint32_t  instance,
crc_user_config_t *const  userConfigPtr 
)

Get configures of the CRC module currently.

This function Get configures of the CRC module currently

Parameters
[in]instanceThe CRC instance number
[in]userConfigPtrPointer to structure of initialization
Returns
Execution status (success)

Definition at line 271 of file crc_driver.c.

uint32_t CRC_DRV_GetCrc16 ( uint32_t  instance,
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)

Parameters
[in]instanceThe CRC instance number
[in]dataInput data for CRC calculation
[in]newSeedSets new CRC calculation
  • true: New seed set and used for new calculation.
  • false: Seed argument ignored, continues old calculation.
[in]seedNew seed if newSeed is true, else ignored
Returns
New CRC result

Definition at line 142 of file crc_driver.c.

uint32_t CRC_DRV_GetCrc32 ( uint32_t  instance,
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)

Parameters
[in]instanceThe CRC instance number
[in]dataInput data for CRC calculation
[in]newSeedSets new CRC calculation
  • true: New seed set and used for new calculation.
  • false: Seed argument ignored, continues old calculation.
[in]seedNew seed if newSeed is true, else ignored
Returns
New CRC result

Definition at line 111 of file crc_driver.c.

uint32_t CRC_DRV_GetCrc8 ( uint32_t  instance,
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)

Parameters
[in]instanceThe CRC instance number
[in]dataInput data for CRC calculation
[in]newSeedSets new CRC calculation
  • true: New seed set and used for new calculation.
  • false: Seed argument ignored, continues old calculation.
[in]seedNew seed if newSeed is true, else ignored
Returns
New CRC result

Definition at line 172 of file crc_driver.c.

uint32_t CRC_DRV_GetCrcResult ( uint32_t  instance)

Returns the current result of the CRC calculation.

This function returns the current result of the CRC calculation

Parameters
[in]instanceThe CRC instance number
Returns
Result of CRC calculation

Definition at line 223 of file crc_driver.c.

status_t CRC_DRV_GetDefaultConfig ( crc_user_config_t *const  userConfigPtr)

Get default configures the CRC module for configuration structure.

This function Get default configures the CRC module for user configuration structure

Parameters
[in]userConfigPtrPointer to structure of initialization
Returns
Execution status (success)

Definition at line 303 of file crc_driver.c.

status_t CRC_DRV_Init ( uint32_t  instance,
const crc_user_config_t userConfigPtr 
)

Initializes the CRC module.

This function initializes CRC driver based on user configuration input. The user must make sure that the clock is enabled

Parameters
[in]instanceThe CRC instance number
[in]userConfigPtrPointer to structure of initialization
Returns
Execution status (success)

Definition at line 68 of file crc_driver.c.

void CRC_DRV_WriteData ( uint32_t  instance,
const uint8_t *  data,
uint32_t  dataSize 
)

Appends a block of bytes to the current CRC calculation.

This function appends a block of bytes to the current CRC calculation

Parameters
[in]instanceThe CRC instance number
[in]dataData for current CRC calculation
[in]dataSizeLength of data to be calculated

Definition at line 200 of file crc_driver.c.