16-bit Programmable Cyclic Redundancy Check generator using dsPIC MCUs
More...
|
file | crc.h |
| This is the generated driver header file for the CRC driver.
|
|
file | crc_types.h |
| This is the generated driver types header file for the CRC driver.
|
|
|
void | CRC_Initialize (void) |
| Initializes the CRC module. This function sets the polynomial and data width; data and seed shift; updates the polynomial and shifts the seed value. After the function is called, the CRC module is ready to calculate the CRC of a data buffer.
|
|
void | CRC_Deinitialize (void) |
| Deinitializes CRC to POR values.
|
|
void | CRC_SeedSet (uint32_t seed, enum CRC_SEED_METHOD seedMethod, enum CRC_SEED_DIRECTION seedDirection) |
| Sets the CRC seed with method and direction.
|
|
void | CRC_CalculateBufferStart (void *buffer, uint32_t sizeBytes) |
| CRC module calculation on a buffer in data space.
|
|
void | CRC_CalculateProgramStart (uint32_t startAddr, uint32_t sizeBytes) |
| Starts the CRC calculation on a buffer in program space.
|
|
void | CRC_EventCallbackRegister (void(*handler)(void)) |
| This function can be used to override default callback and to define custom callback for CRC Event event.
|
|
void | CRC_EventCallback (void) |
| This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using
CRC_EventCallbackRegister.
|
|
void | CRC_Tasks (void) |
| This function cycles through the CRC calculations.
This function will load the CRC module FIFO with the buffer data.
|
|
bool | CRC_CalculationIsDone (void) |
| Returns the CRC calculation complete status
|
|
uint32_t | CRC_CalculationResultGet (bool reverse, uint32_t xorValue) |
| Gets the CRC result if the calculation is done.
|
|
uint32_t | CRC_CalculationResultRawGet (void) |
| Gets the CRC raw result if the calculation is done.
|
|
uint32_t | CRC_CalculationResultReverseGet (void) |
| Gets the CRC reversed value of result if the calculation is done.
|
|
uint32_t | CRC_CalculationResultXORGet (uint32_t xorValue) |
| Gets the CRC XOR'd value of the result if the calculation is done.
|
|
|
const struct CRC_INTERFACE | CRC |
| Structure object of type CRC_INTERFACE with the custom name given by the user in the Melody Driver User interface. The default name e.g. CRC can be changed by the user in the CRC user interface. This allows defining a structure with application specific name using the 'Custom Name' field. Application specific name allows the API Portability.
|
|
◆ CRC_SEED_DIRECTION
Enumerator |
---|
CRC_SEED_DIRECTION_Msb | CRC seed in Big Endian
|
CRC_SEED_DIRECTION_Lsb | CRC seed in Little Endian
|
Definition at line 76 of file crc_types.h.
◆ CRC_SEED_METHOD
Enumerator |
---|
CRC_SEED_METHOD_DIRECT | CRC seed in direct method
|
CRC_SEED_METHOD_INDIRECT | CRC seed in indirect method
|
Definition at line 65 of file crc_types.h.
◆ CRC_STATE
Enumerator |
---|
CRC_STATE_CALCULATE | CRC calculation start
|
CRC_STATE_FLUSH | CRC calculation data flush
|
CRC_STATE_CLEANUP | CRC calculation reset
|
CRC_STATE_DONE | CRC calculation complete
|
Definition at line 48 of file crc_types.h.
◆ CRC_CalculateBufferStart()
void CRC_CalculateBufferStart |
( |
void * | buffer, |
|
|
uint32_t | sizeBytes ) |
- Precondition
- The CRC module needs to be initialized with the desired settings
- Parameters
-
[in] | buffer | - Address of the desired data in data space |
[in] | sizeBytes | - Size of the buffer
|
- Returns
- none
Definition at line 373 of file crc.c.
◆ CRC_CalculateProgramStart()
void CRC_CalculateProgramStart |
( |
uint32_t | startAddr, |
|
|
uint32_t | sizeBytes ) |
- Precondition
- The CRC module needs to be initialized with the desired settings.
- Parameters
-
[in] | startAddr | - Starting address of the program space, Each program instruction is 3 bytes, the caller should account for that in the size. |
[in] | sizeBytes | - Size of the buffer in multiple of 3
|
- Returns
- none
Definition at line 385 of file crc.c.
◆ CRC_CalculationIsDone()
bool CRC_CalculationIsDone |
( |
void | | ) |
|
◆ CRC_CalculationResultGet()
uint32_t CRC_CalculationResultGet |
( |
bool | reverse, |
|
|
uint32_t | xorValue ) |
- Precondition
- The CRC module needs to be initialized with the desired settings. CRC_CalculationIsDone must be called for the associated function to work.
- Parameters
-
[in] | reverse | - Reverses the CRC calculated value if true |
[in] | xorValue | - Set the value that will be XOR'd with the CRC result after reversed if desired |
- Returns
- Returns the CRC result for the module
Definition at line 467 of file crc.c.
◆ CRC_CalculationResultRawGet()
uint32_t CRC_CalculationResultRawGet |
( |
void | | ) |
|
- Precondition
- The CRC module needs to be initialized with the desired settings.
CRC_CalculationIsDone must be called for the associated function to work.
- Parameters
-
- Returns
- Returns the CRC result for the module
Definition at line 425 of file crc.c.
◆ CRC_CalculationResultReverseGet()
uint32_t CRC_CalculationResultReverseGet |
( |
void | | ) |
|
- Precondition
- The CRC module needs to be initialized with the desired settings.
CRC_CalculationIsDone must be called for the associated function to work.
- Parameters
-
- Returns
- Returns the CRC result for the module
Definition at line 447 of file crc.c.
◆ CRC_CalculationResultXORGet()
uint32_t CRC_CalculationResultXORGet |
( |
uint32_t | xorValue | ) |
|
- Precondition
- The CRC module needs to be initialized with the desired settings.
CRC_CalculationIsDone must be called for the associated function to work.
- Parameters
-
[in] | xorValue | - A value that will be XOR'd with the CRC result after reversed if desired |
- Returns
- Returns the CRC result for the module
Definition at line 456 of file crc.c.
◆ CRC_Deinitialize()
void CRC_Deinitialize |
( |
void | | ) |
|
- Parameters
-
- Returns
- none
Definition at line 121 of file crc.c.
◆ CRC_EventCallback()
void CRC_EventCallback |
( |
void | | ) |
|
◆ CRC_EventCallbackRegister()
void CRC_EventCallbackRegister |
( |
void(* | handler )(void) | ) |
|
- Parameters
-
[in] | handler | - Address of the callback function |
- Returns
- none
Definition at line 406 of file crc.c.
◆ CRC_Initialize()
void CRC_Initialize |
( |
void | | ) |
|
- Parameters
-
- Returns
- none
Definition at line 85 of file crc.c.
◆ CRC_SeedSet()
- Precondition
- The CRC module needs to be initialized with the desired settings. Please refer to the CRC initialization functions
- Parameters
-
[in] | seed | - Set the seed value of the CRC calculation |
[in] | seedmethod | - Set the seed method, direct or indirect |
[in] | seeddirection | - Set the seed MSB or LSB direction, ignored if the seed method is indirect |
- Returns
- none
Definition at line 322 of file crc.c.
◆ CRC_Tasks()
- Precondition
- The CRC module needs to be initialized with the desired settings.
Please refer to the CRC initialization functions. The caller needs to call the function to start the calculation.
- Parameters
-
- Returns
- none
Definition at line 487 of file crc.c.
◆ CRC
Definition at line 48 of file crc.c.