Bar Logo 4kW dsPIC33C PSFB DC-DC DA (Part-No. )
 
Content
     
Loading...
Searching...
No Matches

16-bit Programmable Cyclic Redundancy Check generator using dsPIC MCUs More...

+ Collaboration diagram for CRC Driver:

Files

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.
 

Data Structures

struct  CRC_INTERFACE
 Structure containing the function pointers of CRC driver. More...
 

Enumerations

enum  CRC_STATE { CRC_STATE_CALCULATE , CRC_STATE_FLUSH , CRC_STATE_CLEANUP , CRC_STATE_DONE }
 Defines the CRC calculation states. More...
 
enum  CRC_SEED_METHOD { CRC_SEED_METHOD_DIRECT , CRC_SEED_METHOD_INDIRECT }
 Defines the CRC calculation seed method CRC_SeedSet. The direct method refers to the seed being placed before the shifters with the result being shifted through the polynomial. The indirect method refers to the seed being placed after the shifters with the result not being shifted through the polynomial. More...
 
enum  CRC_SEED_DIRECTION { CRC_SEED_DIRECTION_Msb , CRC_SEED_DIRECTION_Lsb }
 Defines the CRC calculation seed direction in direct method CRC_SeedSet. More...
 

Functions

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.
 

Variables

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.
 

Detailed Description

Enumeration Type Documentation

◆ 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

enum 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.

Function Documentation

◆ 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 )
Precondition
The CRC module needs to be initialized with the desired settings. CRC_CalculateBufferStart or CRC_CalculateProgramStart must be called for the associated function to work.
Parameters
none
Returns
true - the CRC calculation is complete and result is available in CRC_CalculationResultRawGet
false - the CRC calculation in progress

Definition at line 420 of file crc.c.

◆ 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.

+ Here is the call graph for this function:

◆ 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
none
Returns
Returns the CRC result for the module

Definition at line 425 of file crc.c.

+ Here is the caller graph for this function:

◆ 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
none
Returns
Returns the CRC result for the module

Definition at line 447 of file crc.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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.

+ Here is the call graph for this function:

◆ CRC_Deinitialize()

void CRC_Deinitialize ( void )
Parameters
none
Returns
none

Definition at line 121 of file crc.c.

◆ CRC_EventCallback()

void CRC_EventCallback ( void )
Parameters
none
Returns
none
+ Here is the caller graph for this function:

◆ 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.

+ Here is the caller graph for this function:

◆ CRC_Initialize()

void CRC_Initialize ( void )
Parameters
none
Returns
none

Definition at line 85 of file crc.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CRC_SeedSet()

void CRC_SeedSet ( uint32_t seed,
enum CRC_SEED_METHOD seedMethod,
enum CRC_SEED_DIRECTION seedDirection )
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()

void CRC_Tasks ( void )
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
none
Returns
none

Definition at line 487 of file crc.c.

Variable Documentation

◆ CRC

const struct CRC_INTERFACE CRC
extern

Definition at line 48 of file crc.c.