/*!
@defgroup pcrc Cyclic Redundancy Check (PCRC)
@brief The YTMicro SDK provides Peripheral Drivers for the Cyclic Redundancy Check (PCRC) module.

-# PCRC SDK driver supports:
    - Generate 16/32-bit PCRC code for error detection.
    - Provides a hardware fix polynomial, seed, and other parameters required to implement 16/32-bit PCRC standard.
    - Calculate 16/32-bit code for 32 bits of data at a time.
.
### Important note when use PCRC module: ###
- When generating PCRC-32 for the ITU-T V.42 standard the user needs to set
   SWAP_BYTEWISE together with INV and SWAP.
- When generating PCRC-16-CCITT(0x1021) standard the user needs to set SWAP_BITWISE bit.
.

# Basic Operations of PCRC
___________
1. To initialize the PCRC module, call PCRC_DRV_Init() function and pass
   the user configuration data structure to it.
    This is example code to configure the PCRC driver using PCRC_DRV_GetDefaultConfig() function:
~~~~~{.c}
    #define INST_PCRC (0U)

    /* Configuration structure pcrc_InitConfig */
    pcrc_user_config_t pcrc_InitConfig;

    /* Get default configuration for PCRC module: PCRC-16-CCITT (0x1021) standard */
    PCRC_DRV_GetDefaultConfig(&pcrc_InitConfig);

    /* Initializes the PCRC */
    PCRC_DRV_Init(INST_PCRC, &pcrc_InitConfig);
~~~~~
2. To configure and operate the PCRC module:
    Function PCRC_DRV_Configure() shall be used to write user configuration to PCRC
    hardware module before starting operation by calling PCRC_DRV_WriteData().
    Finally, using PCRC_DRV_GetCrcResult() function to get the result of PCRC calculation.
    This is example code to configure and get PCRC block for YTM32B1L:
~~~~~{.c}
    #define INST_PCRC (0U)

    uint8_t buffer[] = { 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30 };
    uint32_t result;

    /* Set the PCRC configuration: PCRC-16-CCITT (0x1021) standard */
    PCRC_DRV_Configure(INST_PCRC, &pcrc_InitConfig);
    /* Write data to the current PCRC calculation */
    PCRC_DRV_WriteData(INST_PCRC, buffer, 10U);
    /* Get result of PCRC calculation (0x3218U) */
    result = PCRC_DRV_GetCrcResult(INST_PCRC);

    /* De-init */
    PCRC_DRV_Deinit(INST_PCRC);
~~~~~
3. To get result of 32-bit data call PCRC_DRV_GetCrc32() function.
~~~~~{.c}
    #define INST_PCRC (0U)

    uint32_t seed = 0xFFFFU;
    uint32_t data = 0x12345678U;
    uint32_t result;

    /* Get result of 32-bit data (0x30EC) at PCRC-16-CCITT (0x1021) standard configuration mode */
    result = PCRC_DRV_GetCrc32(INST_PCRC, data, true, seed);
~~~~~
4. To get result of 16-bit data call PCRC_DRV_GetCrc16() function.
~~~~~{.c}
    #define INST_PCRC (0U)

    uint32_t seed = 0xFFFFU;
    uint16_t data = 0x1234U;
    uint32_t result;

    /* Get result of 16-bit data (0x0EC9) at PCRC-16-CCITT (0x1021) standard configuration mode */
    result = PCRC_DRV_GetCrc16(INST_PCRC, data, true, seed);
~~~~~
5. To get current configuration of the PCRC module, just call PCRC_DRV_GetConfig() function.
~~~~~{.c}
    #define INST_PCRC (0U)
    pcrc_user_config_t pcrc_InitConfig;

    /* Get current configuration of the PCRC module */
    PCRC_DRV_GetConfig(INST_PCRC, &pcrc_InitConfig);
~~~~~
6. To Get default configuration of the PCRC module, just call PCRC_DRV_GetDefaultConfig() function.
~~~~~{.c}
    #define INST_PCRC (0U)
    pcrc_user_config_t pcrc_InitConfig;

    /* Get default configuration of the PCRC module */
    PCRC_DRV_GetDefaultConfig(&pcrc_InitConfig);
~~~~~

## Integration guideline ##

### Compilation units ###

The following files need to be compiled in the project:
\verbatim
${SDK_PATH}\platform\drivers\src\pcrc\pcrc_driver.c
${SDK_PATH}\platform\drivers\src\pcrc\pcrc_hw_access.c
\endverbatim

### Include path ###

The following paths need to be added to the include path of the toolchain:
\verbatim
${SDK_PATH}\platform\drivers\inc\
\endverbatim

### Compile symbols ###

No special symbols are required for this component

### Dependencies ###

\ref clock_manager
*/
