LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
IP: CRC register block and driver

Detailed Description

Data Structures

struct  IP_CRC_001_T
 CRC register block structure. More...
 

Macros

#define CRC_MODE_POLY_BITMASK   ((0x03)) /** CRC polynomial Bit mask */
 CRC MODE register description.
 
#define CRC_MODE_POLY_CCITT   (0x00) /** Select CRC-CCITT polynomial */
 
#define CRC_MODE_POLY_CRC16   (0x01) /** Select CRC-16 polynomial */
 
#define CRC_MODE_POLY_CRC32   (0x02) /** Select CRC-32 polynomial */
 
#define CRC_MODE_WRDATA_BITMASK   (0x03 << 2) /** CRC WR_Data Config Bit mask */
 
#define CRC_MODE_WRDATA_BIT_RVS   (1 << 2) /** Select Bit order reverse for WR_DATA (per byte) */
 
#define CRC_MODE_WRDATA_CMPL   (1 << 3) /** Select One's complement for WR_DATA */
 
#define CRC_MODE_SUM_BITMASK   (0x03 << 4) /** CRC Sum Config Bit mask */
 
#define CRC_MODE_SUM_BIT_RVS   (1 << 4) /** Select Bit order reverse for CRC_SUM */
 
#define CRC_MODE_SUM_CMPL   (1 << 5) /** Select One's complement for CRC_SUM */
 
#define MODE_CFG_CCITT   (0x00) /** Pre-defined mode word for default CCITT setup */
 
#define MODE_CFG_CRC16   (0x15) /** Pre-defined mode word for default CRC16 setup */
 
#define MODE_CFG_CRC32   (0x36) /** Pre-defined mode word for default CRC32 setup */
 
#define CRC_SEED_CCITT   (0x0000FFFF)/** Initial seed value for CCITT mode */
 
#define CRC_SEED_CRC16   (0x00000000)/** Initial seed value for CRC16 mode */
 
#define CRC_SEED_CRC32   (0xFFFFFFFF)/** Initial seed value for CRC32 mode */
 

Enumerations

enum  IP_CRC_001_POLY_T { CRC_POLY_CCITT = CRC_MODE_POLY_CCITT, CRC_POLY_CRC16 = CRC_MODE_POLY_CRC16, CRC_POLY_CRC32 = CRC_MODE_POLY_CRC32, CRC_POLY_LAST }
 

Functions

STATIC INLINE void IP_CRC_Init (IP_CRC_001_T *pCRC)
 Initializes the CRC Engine.
 
STATIC INLINE void IP_CRC_DeInit (IP_CRC_001_T *pCRC)
 De-initializes the CRC Engine.
 
STATIC INLINE void IP_CRC_SetPoly (IP_CRC_001_T *pCRC, IP_CRC_001_POLY_T poly, uint32_t flags)
 Select polynomial for CRC Engine.
 
void IP_CRC_UseDefaultConfig (IP_CRC_001_T *pCRC, IP_CRC_001_POLY_T poly)
 Sets up the CRC engine with defaults based on the polynomial to be used.
 
STATIC INLINE uint32_t IP_CRC_GetMode (IP_CRC_001_T *pCRC)
 Get mode register of CRC Engine.
 
STATIC INLINE void IP_CRC_SetMode (IP_CRC_001_T *pCRC, uint32_t mode)
 Set mode register of CRC Engine.
 
STATIC INLINE void IP_CRC_SetSeed (IP_CRC_001_T *pCRC, uint32_t Seed)
 Set Seed value.
 
STATIC INLINE uint32_t IP_CRC_GetSeed (IP_CRC_001_T *pCRC)
 Get Seed value.
 
STATIC INLINE void IP_CRC_Write8 (IP_CRC_001_T *pCRC, uint8_t data)
 Write 8-bit data to CRC WR Data register.
 
STATIC INLINE void IP_CRC_Write16 (IP_CRC_001_T *pCRC, uint16_t data)
 Write 16-bit data to CRC WR Data register.
 
STATIC INLINE void IP_CRC_Write32 (IP_CRC_001_T *pCRC, uint32_t data)
 Write 32-bit data to CRC WR Data register.
 
STATIC INLINE uint32_t IP_CRC_ReadSum (IP_CRC_001_T *pCRC)
 Read current calculated checksum from CRC Engine.
 
uint32_t IP_CRC_CRC8 (IP_CRC_001_T *pCRC, const uint8_t *data, uint32_t bytes)
 Convenience function for computing a standard CCITT checksum from an 8-bit data block.
 
uint32_t IP_CRC_CRC16 (IP_CRC_001_T *pCRC, const uint16_t *data, uint32_t hwords)
 Convenience function for computing a standard CRC16 checksum from 16-bit data block.
 
uint32_t IP_CRC_CRC32 (IP_CRC_001_T *pCRC, const uint32_t *data, uint32_t words)
 Convenience function for computing a standard CRC32 checksum from 32-bit data block.
 

Macro Definition Documentation

#define CRC_MODE_POLY_BITMASK   ((0x03)) /** CRC polynomial Bit mask */

CRC MODE register description.

Definition at line 65 of file crc_001.h.

#define CRC_MODE_POLY_CCITT   (0x00) /** Select CRC-CCITT polynomial */

Definition at line 66 of file crc_001.h.

#define CRC_MODE_POLY_CRC16   (0x01) /** Select CRC-16 polynomial */

Definition at line 67 of file crc_001.h.

#define CRC_MODE_POLY_CRC32   (0x02) /** Select CRC-32 polynomial */

Definition at line 68 of file crc_001.h.

#define CRC_MODE_SUM_BIT_RVS   (1 << 4) /** Select Bit order reverse for CRC_SUM */

Definition at line 73 of file crc_001.h.

#define CRC_MODE_SUM_BITMASK   (0x03 << 4) /** CRC Sum Config Bit mask */

Definition at line 72 of file crc_001.h.

#define CRC_MODE_SUM_CMPL   (1 << 5) /** Select One's complement for CRC_SUM */

Definition at line 74 of file crc_001.h.

#define CRC_MODE_WRDATA_BIT_RVS   (1 << 2) /** Select Bit order reverse for WR_DATA (per byte) */

Definition at line 70 of file crc_001.h.

#define CRC_MODE_WRDATA_BITMASK   (0x03 << 2) /** CRC WR_Data Config Bit mask */

Definition at line 69 of file crc_001.h.

#define CRC_MODE_WRDATA_CMPL   (1 << 3) /** Select One's complement for WR_DATA */

Definition at line 71 of file crc_001.h.

#define CRC_SEED_CCITT   (0x0000FFFF)/** Initial seed value for CCITT mode */

Definition at line 80 of file crc_001.h.

#define CRC_SEED_CRC16   (0x00000000)/** Initial seed value for CRC16 mode */

Definition at line 81 of file crc_001.h.

#define CRC_SEED_CRC32   (0xFFFFFFFF)/** Initial seed value for CRC32 mode */

Definition at line 82 of file crc_001.h.

#define MODE_CFG_CCITT   (0x00) /** Pre-defined mode word for default CCITT setup */

Definition at line 76 of file crc_001.h.

#define MODE_CFG_CRC16   (0x15) /** Pre-defined mode word for default CRC16 setup */

Definition at line 77 of file crc_001.h.

#define MODE_CFG_CRC32   (0x36) /** Pre-defined mode word for default CRC32 setup */

Definition at line 78 of file crc_001.h.

Enumeration Type Documentation

Enumerator:
CRC_POLY_CCITT 

CRC-CCIT polynomial

CRC_POLY_CRC16 

CRC-16 polynomial

CRC_POLY_CRC32 

CRC-32 polynomial

CRC_POLY_LAST 

Definition at line 87 of file crc_001.h.

Function Documentation

uint32_t IP_CRC_CRC16 ( IP_CRC_001_T pCRC,
const uint16_t *  data,
uint32_t  hwords 
)

Convenience function for computing a standard CRC16 checksum from 16-bit data block.

Parameters
pCRC: Pointer to selected CRC Engine register block structure
data: Pointer to the block of 16-bit data
hwords: The number of halfword entries pointed to by data
Returns
Computed checksum for the block

Definition at line 84 of file crc_001.c.

uint32_t IP_CRC_CRC32 ( IP_CRC_001_T pCRC,
const uint32_t data,
uint32_t  words 
)

Convenience function for computing a standard CRC32 checksum from 32-bit data block.

Parameters
pCRC: Pointer to selected CRC Engine register block structure
data: Pointer to the block of 32-bit data
words: The number of 32-bit entries pointed to by data
Returns
Computed checksum for the block

Definition at line 95 of file crc_001.c.

uint32_t IP_CRC_CRC8 ( IP_CRC_001_T pCRC,
const uint8_t *  data,
uint32_t  bytes 
)

Convenience function for computing a standard CCITT checksum from an 8-bit data block.

Parameters
pCRC: Pointer to selected CRC Engine register block structure
data: Pointer to the block of 8 bit data
bytes: The number of bytes pointed to by data
Returns
Computed checksum for the block

Definition at line 73 of file crc_001.c.

STATIC INLINE void IP_CRC_DeInit ( IP_CRC_001_T pCRC)

De-initializes the CRC Engine.

Parameters
pCRC: Pointer to selected CRC Engine register block structure
Returns
Nothing

Definition at line 106 of file crc_001.h.

STATIC INLINE uint32_t IP_CRC_GetMode ( IP_CRC_001_T pCRC)

Get mode register of CRC Engine.

Parameters
pCRC: Pointer to selected CRC Engine register block structure
Returns
Current CRC Mode register (Or-ed bits value of CRC_MODE_*)

Definition at line 136 of file crc_001.h.

STATIC INLINE uint32_t IP_CRC_GetSeed ( IP_CRC_001_T pCRC)

Get Seed value.

Parameters
pCRC: Pointer to selected CRC Engine register block structure
Returns
current seed value

Definition at line 168 of file crc_001.h.

STATIC INLINE void IP_CRC_Init ( IP_CRC_001_T pCRC)

Initializes the CRC Engine.

Parameters
pCRC: Pointer to selected CRC Engine register block structure
Returns
Nothing

Definition at line 99 of file crc_001.h.

STATIC INLINE uint32_t IP_CRC_ReadSum ( IP_CRC_001_T pCRC)

Read current calculated checksum from CRC Engine.

Parameters
pCRC: Pointer to selected CRC Engine register block structure
Returns
Check sum value

Definition at line 211 of file crc_001.h.

STATIC INLINE void IP_CRC_SetMode ( IP_CRC_001_T pCRC,
uint32_t  mode 
)

Set mode register of CRC Engine.

Parameters
pCRC: Pointer to selected CRC Engine register block structure
mode: mode value to be set in mode register
Returns
Nothing

Definition at line 147 of file crc_001.h.

STATIC INLINE void IP_CRC_SetPoly ( IP_CRC_001_T pCRC,
IP_CRC_001_POLY_T  poly,
uint32_t  flags 
)

Select polynomial for CRC Engine.

Parameters
pCRC: Pointer to selected CRC Engine register block structure
poly: CRC polynomial selection
flags: An Or'ed value of flags that setup the mode
Returns
Nothing
Note
Flags for setting up the mode word include CRC_MODE_WRDATA_BIT_RVS, CRC_MODE_WRDATA_CMPL, CRC_MODE_SUM_BIT_RVS, and CRC_MODE_SUM_CMPL.

Definition at line 117 of file crc_001.h.

STATIC INLINE void IP_CRC_SetSeed ( IP_CRC_001_T pCRC,
uint32_t  Seed 
)

Set Seed value.

Parameters
pCRC: Pointer to selected CRC Engine register block structure
Seed: selected seed value
Returns
Nothing

Definition at line 158 of file crc_001.h.

void IP_CRC_UseDefaultConfig ( IP_CRC_001_T pCRC,
IP_CRC_001_POLY_T  poly 
)

Sets up the CRC engine with defaults based on the polynomial to be used.

Parameters
pCRC: Pointer to selected CRC Engine register block structure
poly: The enumerated polynomial to be used
Returns
Nothing

Definition at line 51 of file crc_001.c.

STATIC INLINE void IP_CRC_Write16 ( IP_CRC_001_T pCRC,
uint16_t  data 
)

Write 16-bit data to CRC WR Data register.

Parameters
pCRC: Pointer to selected CRC Engine register block structure
data: data to be written
Returns
Nothing

Definition at line 190 of file crc_001.h.

STATIC INLINE void IP_CRC_Write32 ( IP_CRC_001_T pCRC,
uint32_t  data 
)

Write 32-bit data to CRC WR Data register.

Parameters
pCRC: Pointer to selected CRC Engine register block structure
data: data to be written
Returns
Nothing

Definition at line 201 of file crc_001.h.

STATIC INLINE void IP_CRC_Write8 ( IP_CRC_001_T pCRC,
uint8_t  data 
)

Write 8-bit data to CRC WR Data register.

Parameters
pCRC: Pointer to selected CRC Engine register block structure
data: data to be written
Returns
Nothing

Definition at line 179 of file crc_001.h.