XMC Peripheral Library for XMC4000 Family: FCE

XMC Peripheral Library for XMC4000 Family

XMC Peripheral Library for XMC4000 Family  2.1.16

Data Structures

struct  XMC_FCE_CONFIG_t
 
struct  XMC_FCE_t
 

Macros

#define XMC_FCE_CRC16   FCE_KE2
 
#define XMC_FCE_CRC32_0   FCE_KE0
 
#define XMC_FCE_CRC32_1   FCE_KE1
 
#define XMC_FCE_CRC8   FCE_KE3
 
#define XMC_FCE_INVSEL_RESET   (0U)
 
#define XMC_FCE_INVSEL_SET   (1U)
 
#define XMC_FCE_REFIN_RESET   (0U)
 
#define XMC_FCE_REFIN_SET   (1U)
 
#define XMC_FCE_REFOUT_RESET   (0U)
 
#define XMC_FCE_REFOUT_SET   (1U)
 

Typedefs

typedef FCE_KE_TypeDef XMC_FCE_Kernel_t
 

Enumerations

Functions

XMC_FCE_STATUS_t XMC_FCE_CalculateCRC16 (const XMC_FCE_t *const engine, const uint16_t *data, uint32_t length, uint16_t *result)
 
XMC_FCE_STATUS_t XMC_FCE_CalculateCRC32 (const XMC_FCE_t *const engine, const uint32_t *data, uint32_t length, uint32_t *result)
 
XMC_FCE_STATUS_t XMC_FCE_CalculateCRC8 (const XMC_FCE_t *const engine, const uint8_t *data, uint32_t length, uint8_t *result)
 
void XMC_FCE_ClearEvent (const XMC_FCE_t *const engine, XMC_FCE_STS_FLAG_t event)
 
void XMC_FCE_Disable (void)
 
void XMC_FCE_DisableCRCAlgorithm (const XMC_FCE_t *const engine, uint32_t algo)
 
void XMC_FCE_DisableEvent (const XMC_FCE_t *const engine, uint32_t event)
 
void XMC_FCE_DisableOperation (const XMC_FCE_t *const engine, uint32_t operation)
 
void XMC_FCE_Enable (void)
 
void XMC_FCE_EnableCRCAlgorithm (const XMC_FCE_t *const engine, uint32_t algo)
 
void XMC_FCE_EnableEvent (const XMC_FCE_t *const engine, uint32_t event)
 
void XMC_FCE_EnableOperation (const XMC_FCE_t *const engine, uint32_t operation)
 
bool XMC_FCE_Get_DisableStatus (void)
 
void XMC_FCE_GetCRCResult (const XMC_FCE_t *const engine, uint32_t *result)
 
bool XMC_FCE_GetEventStatus (const XMC_FCE_t *const engine, XMC_FCE_STS_FLAG_t event)
 
XMC_FCE_STATUS_t XMC_FCE_Init (const XMC_FCE_t *const engine)
 
void XMC_FCE_InitializeSeedValue (const XMC_FCE_t *const engine, uint32_t seedvalue)
 
void XMC_FCE_LittleEndian16bit (uint8_t *inbuffer, uint16_t *outbuffer, uint16_t length)
 
void XMC_FCE_LittleEndian32bit (uint8_t *inbuffer, uint32_t *outbuffer, uint16_t length)
 
uint32_t XMC_FCE_ReadModuleNumber (void)
 
uint32_t XMC_FCE_ReadModuleRev (void)
 
uint32_t XMC_FCE_ReadModuleType (void)
 
void XMC_FCE_TriggerMismatch (const XMC_FCE_t *const engine, XMC_FCE_CTR_TEST_t test)
 
void XMC_FCE_UpdateCRCCheck (const XMC_FCE_t *const engine, const uint32_t checkvalue)
 
void XMC_FCE_UpdateLength (const XMC_FCE_t *const engine, const uint32_t checklength)
 

Detailed Description

The FCE provides a parallel implementation of Cyclic Redundancy Code (CRC) algorithms. The current FCE version for the XMC4000 microcontroller family implements the IEEE 802.3 ethernet CRC32, the CCITT CRC16 and the SAE J1850 CRC8 polynomials. The primary target of FCE is to be used as an hardware acceleration engine for software applications or operating systems services using CRC signatures.

fce_overview.png
FCE Features:
fce_polynomials.png
  • CRC kernel 0 and 1: IEEE 802.3 CRC32 ethernet polynomial: 0x04C11DB71
  • CRC kernel 2: CCITT CRC16 polynomial: 0x1021
  • CRC kernel 3: SAE J1850 CRC8 polynomial: 0x1D
  • Configuration Registers enable to control the CRC operation and perform automatic checksum checks at the end of a message.
  • Extended register interface to control reliability of FCE execution in safety applications.
  • Error notification scheme via dedicated interrupt node for:
    a)Transient error detection: Error interrupt generation (maskable) with local status register (cleared by software)
    b)Checksum failure: Error interrupt generation (maskable) with local status register (cleared by software)

FCE provides one interrupt line to the interrupt system. Each CRC engine has its own set of flag registers.

Macro Definition Documentation

#define XMC_FCE_CRC16   FCE_KE2

Kernel 2

#define XMC_FCE_CRC32_0   FCE_KE0

Kernel 0

#define XMC_FCE_CRC32_1   FCE_KE1

Kernel 1

#define XMC_FCE_CRC8   FCE_KE3

Kernel 3

#define XMC_FCE_INVSEL_RESET   (0U)

Disables output inversion

#define XMC_FCE_INVSEL_SET   (1U)

Enables output inversion

#define XMC_FCE_REFIN_RESET   (0U)

Disables input reflection

#define XMC_FCE_REFIN_SET   (1U)

Enables input reflection

#define XMC_FCE_REFOUT_RESET   (0U)

Disables output reflection

#define XMC_FCE_REFOUT_SET   (1U)

Enables output reflection

Typedef Documentation

typedef FCE_KE_TypeDef XMC_FCE_Kernel_t

FCE kernel

Enumeration Type Documentation

FCE algorithm configuration

Enumerator
XMC_FCE_CFG_CONFIG_REFIN 

Enables input byte reflection

XMC_FCE_CFG_CONFIG_REFOUT 

Enables Final CRC reflection

XMC_FCE_CFG_CONFIG_XSEL 

Enables output inversion

FCE interrupt configuration

Enumerator
XMC_FCE_CFG_CONFIG_CMI 

Enables CRC Mismatch interrupt

XMC_FCE_CFG_CONFIG_CEI 

Enables Configuration error interrupt

XMC_FCE_CFG_CONFIG_LEI 

Enables Length error interrupt

XMC_FCE_CFG_CONFIG_BEI 

Enables Bus error interrupt

FCE operation configuration

Enumerator
XMC_FCE_CFG_CONFIG_CCE 

Enables CRC check

XMC_FCE_CFG_CONFIG_ALR 

Enables Automatic length reload

FCE control configuration

Enumerator
XMC_FCE_CTR_MISMATCH_CRC 

Forces CRC mismatch

XMC_FCE_CTR_MISMATCH_CFG 

Forces CFG Register mismatch

XMC_FCE_CTR_MISMATCH_CHECK 

Forces CRC Check Register mismatch

FCE status enumeration

Enumerator
XMC_FCE_STATUS_OK 

Returns OK on success

XMC_FCE_STATUS_BUSY 

Returns BUSY when API is busy with a previous request

XMC_FCE_STATUS_ERROR 

Returns ERROR when API cannot fulfil request

FCE status flag configuration

Enumerator
XMC_FCE_STS_MISMATCH_CRC 

CRC Mismatch flag

XMC_FCE_STS_CONFIG_ERROR 

Configuration Error flag

XMC_FCE_STS_LENGTH_ERROR 

Length Error flag

XMC_FCE_STS_BUS_ERROR 

Bus Error flag

Function Documentation

XMC_FCE_STATUS_t XMC_FCE_CalculateCRC16 ( const XMC_FCE_t *const  engine,
const uint16_t *  data,
uint32_t  length,
uint16_t *  result 
)
Parameters
engineConstant pointer to XMC_FCE_t, pointing to the FCE base address
dataPointer to the data buffer
lengthLength of data buffer
resultPointer to computed CRC result
Returns
XMC_FCE_STATUS_ERROR on error
XMC_FCE_STATUS_SUCCESS otherwise.
Description:
Calculate and update the RC16 checksum in the result pointer
Note:
A write to Internal Register (IRm m = 2) triggers the CRC kernel to update the message checksum according to the IR and current CRC register contents. Only 32-bit or 16-bit write transactions are permitted. Any other bus write transaction will lead to a bus error. Only the lower 16-bit of the write transactions will be used. XMC_FCE_GetCRCResult() should be called after XMC_FCE_CalculateCRC16() to get final CRC value.
XMC_FCE_STATUS_t XMC_FCE_CalculateCRC32 ( const XMC_FCE_t *const  engine,
const uint32_t *  data,
uint32_t  length,
uint32_t *  result 
)
Parameters
engineConstant pointer to XMC_FCE_t, pointing to the FCE base address
dataPointer to the data buffer
lengthTotal number of bytes of data buffer
resultPointer to computed CRC result
Returns
XMC_FCE_STATUS_ERROR on error
XMC_FCE_STATUS_SUCCESS otherwise.
Description
Calculate and update the calculated CRC32 checksum in the result pointer
Note:
A write to Internal Register (IRm, m = 0-1) triggers the CRC kernel to update the message checksum according to the IR and current CRC register contents. Only 32-bit write transactions are permitted. Any other bus write transaction will lead to a bus error. XMC_FCE_GetCRCResult() should be called after XMC_FCE_CalculateCRC32() to get final CRC value.
XMC_FCE_STATUS_t XMC_FCE_CalculateCRC8 ( const XMC_FCE_t *const  engine,
const uint8_t *  data,
uint32_t  length,
uint8_t *  result 
)
Parameters
engineConstant pointer to XMC_FCE_t, pointing to the FCE base address
dataPointer to the data buffer
lengthTotal number of bytes of data buffer
resultPointer to computed CRC result
Returns
XMC_FCE_STATUS_ERROR on error
XMC_FCE_STATUS_SUCCESS otherwise.
Description:
Calculate and updates the CRC8 checksum in the result pointer
Note:
A write to IRm (m = 3) triggers the CRC kernel to update the message checksum according to the IR and current CRC register contents. Any write transaction is allowed to this IRm register. Only the lower 8-bit of the write transactions will be used. XMC_FCE_GetCRCResult() should be called after invoking XMC_FCE_CalculateCRC8() to get final CRC value.
void XMC_FCE_ClearEvent ( const XMC_FCE_t *const  engine,
XMC_FCE_STS_FLAG_t  event 
)
Parameters
engineConstant pointer to XMC_FCE_t, pointing to the FCE base address
eventEvent of type XMC_FCE_STS_FLAG_t
Returns
None
Description:
Clear an FCE event
The function clears requested FCE events by setting the bit-fields of the STS register.
void XMC_FCE_Disable ( void  )
Parameters
None
Returns
None
Description:
Disable the FCE module
The function asserts the FCE peripheral reset and sets the DISR bit in the CLC register.
Note:
All pending transactions running on the bus slave interface must be completed before entering the disabled state.
void XMC_FCE_DisableCRCAlgorithm ( const XMC_FCE_t *const  engine,
uint32_t  algo 
)
Parameters
engineConstant pointer to XMC_FCE_t, pointing to the FCE base address
algoA valid algorithm of type XMC_FCE_CONFIG_ALGO_t or a valid combination of logically OR'd algorithms
Returns
None
Description:
Disable CRC algorithm(s)
Note:
Options for disabling CRC algorithm:
REFIN: Input byte wise reflection
REFOUT: Output bit wise reflection
XSEL: Value to be XORed with final CRC
void XMC_FCE_DisableEvent ( const XMC_FCE_t *const  engine,
uint32_t  event 
)
Parameters
engineConstant pointer to XMC_FCE_t, pointing to the FCE base address
eventOR'd values of XMC_FCE_CONFIG_INTERRUPT_t enumeration values
Returns
None
Description:
Disable FCE event(s)
The function clears the CFG register to disable FCE event(s).
void XMC_FCE_DisableOperation ( const XMC_FCE_t *const  engine,
uint32_t  operation 
)
Parameters
engineConstant pointer to XMC_FCE_t, pointing to the FCE base address
operationFCE operation of type XMC_FCE_CONFIG_OPERATION_t
Returns
None
Description:
Disable CRC operations
The function disables FRC operations by writing to the CFG register.
Note:
CRC comparison check (at the end of message) can be disabled using the CCE bit-field. Automatic reload of LENGTH field (at the end of message) can be disabled using the ALR bit field.
void XMC_FCE_Enable ( void  )
Parameters
None
Returns
None
Description:
Enable the FCE module
The function de-asserts the peripheral reset and clears the DISR bit CLC register.
void XMC_FCE_EnableCRCAlgorithm ( const XMC_FCE_t *const  engine,
uint32_t  algo 
)
Parameters
engineConstant pointer to XMC_FCE_t, pointing to the FCE base address
algoA valid algorithm of type XMC_FCE_CONFIG_ALGO_t or a valid combination of logically OR'd algorithms
Returns
None
Description:
Enables CRC algorithm(s)
Note:
Options for enabling CRC algorithm:
REFIN: Input byte wise reflection
REFOUT: Output bit wise reflection
XSEL: Value to be XORed with final CRC
void XMC_FCE_EnableEvent ( const XMC_FCE_t *const  engine,
uint32_t  event 
)
Parameters
engineConstant pointer to XMC_FCE_t, pointing to the FCE base address
eventOR'd values of XMC_FCE_CONFIG_INTERRUPT_t enumeration values
Returns
None
Description:
Enable FCE event(s)
The function sets the CFG register to enable FCE event(s).
void XMC_FCE_EnableOperation ( const XMC_FCE_t *const  engine,
uint32_t  operation 
)
Parameters
engineConstant pointer to XMC_FCE_t, pointing to the FCE base address
operationFCE operation of type XMC_FCE_CONFIG_OPERATION_t
Returns
None
Description:
Enable CRC operations
The function enables FRC operations by writing to the CFG register.
Note:
CRC comparison check (at the end of message) can be enabled using the CCE bit-field. Automatic reload of LENGTH field (at the end of message) can be enabled using the ALR bit field.
bool XMC_FCE_Get_DisableStatus ( void  )
Parameters
None
Returns
bool Disable status
Description:
Return the disable status
The function reads the FCE module disable status (DISS) bit. It returns "true" if set, "false" otherwise.
void XMC_FCE_GetCRCResult ( const XMC_FCE_t *const  engine,
uint32_t *  result 
)
Parameters
engineConstant pointer to XMC_FCE_t, pointing to the FCE base address
resultPointer to CRC result
Returns
None
Description:
Read the final CRC value from RES register
bool XMC_FCE_GetEventStatus ( const XMC_FCE_t *const  engine,
XMC_FCE_STS_FLAG_t  event 
)
Parameters
engineConstant pointer to XMC_FCE_t, pointing to the FCE base address
eventEvent of type XMC_FCE_STS_FLAG_t
Returns
bool
Description:
Return the event status of FCE event
The function returns the status of a single requested FCE event by reading the appropriate bit-fields of the STS register.
XMC_FCE_STATUS_t XMC_FCE_Init ( const XMC_FCE_t *const  engine)
Parameters
engineConstant pointer to XMC_FCE_t, pointing to the FCE base address
Returns
XMC_FCE_STATUS_t
Description:
Initialize the FCE engine
The function sets to the CFG and CRC registers with the FCE configuration and seeds values. The function always returns XMC_FCE_STATUS_SUCCESS.
Note:
The software must first ensure that the CRC kernel is properly configured with the initial CRC value (seed value).
void XMC_FCE_InitializeSeedValue ( const XMC_FCE_t *const  engine,
uint32_t  seedvalue 
)
Parameters
engineConstant pointer to XMC_FCE_t, pointing to the FCE base address
seedvalueInitial CRC value
Returns
None
Description:
Initialize FCE seed value
The function sets the initial CRC (seed) value in the CRC register.
void XMC_FCE_LittleEndian16bit ( uint8_t *  inbuffer,
uint16_t *  outbuffer,
uint16_t  length 
)
Parameters
inbufferPointer to input data buffer
outbufferPointer to the output data buffer
lengthLength of the input buffer
Returns
None
Description:
Convert input data buffer's endianness from big endian to little endian
The function stores the converted data in output data buffer.
Note:
This function should be invoked before using XMC_FCE_CalculateCRC16() to compute the CRC value.
void XMC_FCE_LittleEndian32bit ( uint8_t *  inbuffer,
uint32_t *  outbuffer,
uint16_t  length 
)
Parameters
inbufferPointer to input data buffer
outbufferPointer to the output data buffer
lengthLength of the input buffer
Returns
None
Description:
Convert input data buffer's endianness from big endian to little endian
The function stores the converted data in output data buffer.
Note:
This function should be invoked before using XMC_FCE_CalculateCRC32() to compute the CRC value.
uint32_t XMC_FCE_ReadModuleNumber ( void  )
Parameters
None
Returns
uint32_t Module number
Description:
Read FCE module number
The return value for FCE module is currently 0x00CA.
uint32_t XMC_FCE_ReadModuleRev ( void  )
Parameters
None
Returns
uint32_t Module revision number
Description:
Read FCE module revision number
The value of a module revision starts with 0x01 (first revision). The current revision number is 0x01.
uint32_t XMC_FCE_ReadModuleType ( void  )
Parameters
None
Returns
uint32_t Module type
Description:
Read the FCE module type
The return value is currently 0xC0. It defines the module as a 32-bit module.
void XMC_FCE_TriggerMismatch ( const XMC_FCE_t *const  engine,
XMC_FCE_CTR_TEST_t  test 
)
Parameters
engineConstant pointer to XMC_FCE_t, pointing to the FCE base address
testvalues of type XMC_FCE_CTR_TEST_t
Returns
None
Description:
Trigger the CTR register to generate a CRC mismatch/register mismatch/check register mismatch interrupt
void XMC_FCE_UpdateCRCCheck ( const XMC_FCE_t *const  engine,
const uint32_t  checkvalue 
)
Parameters
engineConstant pointer to XMC_FCE_t, pointing to the FCE base address
checkvalueChecksum value
Returns
None
Description:
Updates CRC check value
When the CFG.CCE bit field is set, every time the IR register is written, the LENGTH register is decremented by one until it reaches zero. The hardware monitors the transition of the LENGTH register from 1 to 0 to detect the end of the message and proceed with the comparison of the result register (RES) value with the CHECK register value.
void XMC_FCE_UpdateLength ( const XMC_FCE_t *const  engine,
const uint32_t  checklength 
)
Parameters
engineConstant pointer to XMC_FCE_t, pointing to the FCE base address
checklengthChecksum length
Returns
None
Description:
Updates CRC length specified in the input parameter
When the ALR bit field is set to 1, every write to the IR register decrements the value of the LENGTH bit field. The LENGTH field shall be reloaded with its configuration value at the end of the cycle where LENGTH reaches 0.
Generated on Mon Aug 7 2017 11:33:57 for XMC Peripheral Library for XMC4000 Family by   doxygen 1.8.11