![]() |
Synergy Software Package User's Manual
|
The CRC HAL module provides a high-level API to calculate 8, 16 and 32-bit CRC values on a block of data in memory or a stream of data over a Serial Communication Interface (SCI) channel using industry standard polynomials.
The following hardware features are, or are not, supported by SSP for the CRC.
Legend:
| Symbol | Meaning |
|---|---|
| ✓ | Available (Tested) |
| ⌧ | Not Available (Not tested/not functional or both) |
| N/A | Not supported by MCU |
| MCU Group | 8-bit Data Size | 32-bit Data Size | CRC Calculation Switching | Module Stop Function | CRC Snoop |
|---|---|---|---|---|---|
| S124 | ✓ | ✓ | ✓ | ✓ | ✓ |
| S128 | ✓ | ✓ | ✓ | ✓ | ✓ |
| S1JA | ✓ | ✓ | ✓ | ✓ | ✓ |
| S3A1 | ✓ | ✓ | ✓ | ✓ | ✓ |
| S3A3 | ✓ | ✓ | ✓ | ✓ | ✓ |
| S3A6 | ✓ | ✓ | ✓ | ✓ | ✓ |
| S3A7 | ✓ | ✓ | ✓ | ✓ | ✓ |
| S5D3 | ✓ | ✓ | ✓ | ✓ | ✓ |
| S5D5 | ✓ | ✓ | ✓ | ✓ | ✓ |
| S5D9 | ✓ | ✓ | ✓ | ✓ | ✓ |
| S7G2 | ✓ | ✓ | ✓ | ✓ | ✓ |
The CRC HAL module defines APIs for opening, closing, enabling and calculating. A complete list of the available APIs, an example API call and a short description of each can be found in the following table. A table of status return values follows the API summary table.
CRC HAL Module API Summary
| Function Name | Example API Call and Description |
|---|---|
| open | g_crc.p_api->open(g_crc.p_ctrl, g_crc.p_cfg);Open the CRC driver module. |
| close | g_crc.p_api->close(g_crc.p_ctrl);Close the CRC module driver. |
| crcResultGet | g_crc.p_api->crcResultGet(g_crc.p_ctrl, &result);Return the current calculated value. |
| snoopEnable | g_crc.p_api->snoopEnable(g_crc.p_ctrl, seed);Enable snooping. |
| snoopDisable | g_crc.p_api->snoopDisable(g_crc.p_ctrl);Disable snooping. |
| snoopCfg | g_crc.p_api->snoopCfg(g_crc.p_ctrl, g_crc.p_cfg);Configure the snoop channel and direction. |
| calculate | g_crc.p_api->calculate(g_crc.p_ctrl, &input_buffer, num_bytes, crc_seed, &crc_result);Perform a CRC calculation on a block of data. |
| versionGet | g_crc.p_api->versionGet(&version);Retrieve the API version with the version pointer. |
Status Return Values
| Name | Description |
|---|---|
| SSP_SUCCESS | Configuration was successful. |
| SSP_ERR_ASSERTION | Assertion error. |
| SSP_ERR_INVALID_ARGUMENT | Invalid argument error. |
| SSP_ERR_NOT_OPEN | The driver is not opened. |
| SSP_ERR_IN_USE | If driver is already open. |
When the CRC HAL module is used to calculate the CRC value for a block of data in memory, the crc_api_t::calculate API can be used to take the input buffer pointer, length and the CRC seed value as input and outputs the calculated CRC value.
When the CRC HAL module is used to calculate the CRC on a stream of data being transmitted or received over a serial communication Interface (SCI) channel (snoop mode), then first the module should be configured to be in snoop mode by calling the crc_api_t::snoopCfg followed by the crc_api_t::snoopEnable APIs. After the requested number of data is transmitted or received on the SCI channel, the calculated CRC value can be polled from the module using crc_api_t::crcResultGet API.
General CRC HAL Operational Notes
CRC HAL Snoop Mode Operational Notes
This section describes how to include the CRC HAL Module in an application using the SSP configurator.
To add the CRC Driver to an application, simply add it to a thread using the stacks selection sequence given in the following table. (The default name for the CRC Driver is g_crc0. This name can be changed in the associated Properties window.)
CRC HAL Module Selection Sequence
| Resource | ISDE Tab | Stacks Selection Sequence |
|---|---|---|
| r_crc0 CRC Driver on r_crc | Threads | New Stack> Driver> Monitoring> CRC Driver on r_crc |
When the CRC Driver on r_crc is added to the thread stack as shown in the following figure, the configurator automatically adds any needed lower‑level modules. Any modules needing additional configuration information have the box text highlighted in Red. Modules with a Gray band are individual modules that stand alone. Modules with a Blue band are shared or common; they need only be added once and can be used by multiple stacks. Modules with a Pink band can require the selection of lower-level modules; these are either optional or recommended. (This is indicated in the block with the inclusion of this text.) If the addition of lower-level modules is required, the module description include Add in the text. Clicking on any Pink banded modules brings up the New icon and displays possible choices.
The CRC HAL Module must be configured by the user for the desired operation. The available configuration settings and defaults for all the user-accessible properties are given in the properties tab within the SSP configurator and are shown in the following tables for easy reference. Only properties that can be changed without causing conflicts are available for modification. Other properties are locked and not available for changes and are identified with a lock icon for the locked property in the Properties window in the ISDE. This approach simplifies the configuration process and makes it much less error-prone than previous manual approaches to configuration. The available configuration settings and defaults for all the user-accessible properties are given in the Properties tab within the SSP Configurator and are shown in the following tables for easy reference.
Configuration Settings for the CRC HAL Module on r_crc
| ISDE Property | Value | Description |
|---|---|---|
| Parameter Checking | BSP, Enabled, Disabled Default: BSP | Enable or disable the parameter error checking. |
| Name | g-crc0 | Module name. |
| CRC Polynomial | CRC-8, CRC-16, CRC-CCITT, CRC-32, CRC-32C Default: CRC-32C | Specify the polynomial to use for calculation. |
| Bit Order | LSB, MSB Default: MSB | Specify the bit order of the calculation. |
| FIFO Mode | Enable, Disable Default : Disable | Enable this property when using SCI_UART with FIFO mode during CRC snoop operation. |
The CRC HAL module is clocked via the Peripheral Clock A (PCLKA.)
The CRC HAL module does not support any APIs for setting the frequency at which it operates.
The CRC HAL module does not have any configurable pins.
There are two main types of CRC implementations- normal mode and snoop mode. The typical steps for each mode are shown below.
The typical steps in using the CRC HAL module in an application are:
These common steps are illustrated in a typical operational flow diagram in the following figure:
The typical steps in using the CRC HAL module for computing in Snoop mode are:
These common steps are illustrated in a typical operational flow diagram in the following figure: