|
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) |
|
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 Features:
- 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.
#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) |
Disables output inversion
#define XMC_FCE_INVSEL_SET (1U) |
#define XMC_FCE_REFIN_RESET (0U) |
Disables input reflection
#define XMC_FCE_REFIN_SET (1U) |
#define XMC_FCE_REFOUT_RESET (0U) |
Disables output reflection
#define XMC_FCE_REFOUT_SET (1U) |
Enables output reflection
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
|
XMC_FCE_STATUS_t XMC_FCE_CalculateCRC16 |
( |
const XMC_FCE_t *const |
engine, |
|
|
const uint16_t * |
data, |
|
|
uint32_t |
length, |
|
|
uint16_t * |
result |
|
) |
| |
- Parameters
-
engine | Constant pointer to XMC_FCE_t, pointing to the FCE base address |
data | Pointer to the data buffer |
length | Length of data buffer |
result | Pointer 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
-
engine | Constant pointer to XMC_FCE_t, pointing to the FCE base address |
data | Pointer to the data buffer |
length | Total number of bytes of data buffer |
result | Pointer 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
-
engine | Constant pointer to XMC_FCE_t, pointing to the FCE base address |
data | Pointer to the data buffer |
length | Total number of bytes of data buffer |
result | Pointer 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.
- Parameters
-
- 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
-
- 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
-
engine | Constant pointer to XMC_FCE_t, pointing to the FCE base address |
algo | A 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
-
- 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
-
- 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
-
- 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
-
engine | Constant pointer to XMC_FCE_t, pointing to the FCE base address |
algo | A 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
-
- 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
-
- 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
-
- 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
-
engine | Constant pointer to XMC_FCE_t, pointing to the FCE base address |
result | Pointer to CRC result |
- Returns
- None
- Description:
- Read the final CRC value from RES register
- Parameters
-
- 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.
- Parameters
-
engine | Constant 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
-
engine | Constant pointer to XMC_FCE_t, pointing to the FCE base address |
seedvalue | Initial 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
-
inbuffer | Pointer to input data buffer |
outbuffer | Pointer to the output data buffer |
length | Length 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
-
inbuffer | Pointer to input data buffer |
outbuffer | Pointer to the output data buffer |
length | Length 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
-
- 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
-
- 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
-
- 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.
- Parameters
-
- 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
-
engine | Constant pointer to XMC_FCE_t, pointing to the FCE base address |
checkvalue | Checksum 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
-
engine | Constant pointer to XMC_FCE_t, pointing to the FCE base address |
checklength | Checksum 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.