Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
549 changes: 486 additions & 63 deletions Examples/MAX32655/CRC/main.c

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion Examples/MAX32655/CRC/project.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
###############################################################################
#
# Copyright (C) 2024 Analog Devices, Inc.
# Copyright (C) 2024-2025 Analog Devices, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -25,3 +25,5 @@
# **********************************************************

# Add your config here!


549 changes: 486 additions & 63 deletions Examples/MAX32670/CRC/main.c

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion Examples/MAX32670/CRC/project.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
###############################################################################
#
# Copyright (C) 2024 Analog Devices, Inc.
# Copyright (C) 2024-2025 Analog Devices, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,3 +29,5 @@
# **********************************************************

# Add your config here!


549 changes: 486 additions & 63 deletions Examples/MAX32675/CRC/main.c

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Examples/MAX32675/CRC/project.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
###############################################################################
#
# Copyright (C) 2024 Analog Devices, Inc.
# Copyright (C) 2024-2025 Analog Devices, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -25,3 +25,4 @@
# **********************************************************

# Add your config here!

560 changes: 487 additions & 73 deletions Examples/MAX78000/CRC/main.c

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions Examples/MAX78000/CRC/project.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
###############################################################################
#
# Copyright (C) 2024 Analog Devices, Inc.
# Copyright (C) 2024-2025 Analog Devices, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -22,13 +22,10 @@
# For instructions on how to use this system, see
# https://analogdevicesinc.github.io/msdk/USERGUIDE/#build-system

#MXC_OPTIMIZE_CFLAGS = -Og
# ^ For example, you can uncomment this line to
# optimize the project for debugging

# **********************************************************

# Add your config here!




551 changes: 487 additions & 64 deletions Examples/MAX78002/CRC/main.c

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Examples/MAX78002/CRC/project.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
###############################################################################
#
# Copyright (C) 2024 Analog Devices, Inc.
# Copyright (C) 2024-2025 Analog Devices, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,3 +32,4 @@




72 changes: 71 additions & 1 deletion Libraries/PeriphDrivers/Include/MAX32655/crc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
* Analog Devices, Inc.),
* Copyright (C) 2023-2024 Analog Devices, Inc.
* Copyright (C) 2023-2025 Analog Devices, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -56,6 +56,46 @@ typedef struct _mxc_crc_req_t {
*/
typedef enum { CRC_LSB_FIRST, CRC_MSB_FIRST } mxc_crc_bitorder_t;

/**
* @brief CRC data byte order
*
*/
typedef enum { CRC_LSBYTE_FIRST, CRC_MSBYTE_FIRST } mxc_crc_byteorder_t;

/**
* @brief CRC reflected
*
*/
typedef enum { CRC_REFLECTED, CRC_NOT_REFLECTED } mxc_crc_reflected_t;

/**
* @brief CRC request state DONE or NOT
*
*/
typedef enum { CRC_NOT_DONE, CRC_DONE } mxc_crc_req_state_t;

/**
* @brief Structure used to set up Full CRC request
*
*/
typedef struct _mxc_crc_full_req_t {
mxc_crc_reflected_t inputReflected; ///< Input reflected or not
mxc_crc_reflected_t resultReflected; ///< Result reflected or not
uint32_t polynominal; ///< The polynominal to calculate CRC
uint32_t initialValue; ///< The initial value to calculate CRC
uint32_t finalXorValue; ///< The final xor value to calculate CRC
uint8_t *dataBuffer; ///< Pointer to the data
uint32_t dataLen; ///< Length of the data

volatile mxc_crc_reflected_t manual_reflected_input_required;
volatile uint8_t dmaChannel;
volatile uint32_t nextPosDMA;
volatile mxc_crc_req_state_t req_state;

volatile uint32_t resultCRC; ///< Calculated CRC value
volatile int error;
} mxc_crc_full_req_t;

/***** Function Prototypes *****/

/* ************************************************************************* */
Expand Down Expand Up @@ -85,6 +125,14 @@ int MXC_CRC_Shutdown(void);
*/
void MXC_CRC_Handler(int ch, int error);

/**
* @brief This function should be called from the CRC ISR Handler
* when using Async functions for full request
* @param ch DMA channel
* @param error error
*/
void MXC_CRC_Full_Req_Handler(int ch, int error);

/**
* @brief Set the bit-order of CRC calculation
*
Expand Down Expand Up @@ -161,6 +209,28 @@ int MXC_CRC_Compute(mxc_crc_req_t *req);
*/
int MXC_CRC_ComputeAsync(mxc_crc_req_t *req);

/**
* @brief Perform a CRC calculation
* @note The result of the CRC calculation will be placed in the
* mxc_crc_full_req_t structure
*
* @param req Structure containing the CRC detailed parameters and data for calculation
*
* @return see \ref MXC_Error_Codes for a list of return codes.
*/
int MXC_CRC_Calculate(mxc_crc_full_req_t *req);

/**
* @brief Perform a CRC calculation
* @note The result of the CRC calculation will be placed in the
* mxc_crc_full_req_t structure
*
* @param req Structure containing the CRC detailed parameters and data for calculation
*
* @return see \ref MXC_Error_Codes for a list of return codes.
*/
int MXC_CRC_CalculateAsync(mxc_crc_full_req_t *req);

#ifdef __cplusplus
}
#endif
Expand Down
72 changes: 71 additions & 1 deletion Libraries/PeriphDrivers/Include/MAX32670/crc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
* Analog Devices, Inc.),
* Copyright (C) 2023-2024 Analog Devices, Inc.
* Copyright (C) 2023-2025 Analog Devices, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -56,6 +56,46 @@ typedef struct _mxc_crc_req_t {
*/
typedef enum { CRC_LSB_FIRST, CRC_MSB_FIRST } mxc_crc_bitorder_t;

/**
* @brief CRC data byte order
*
*/
typedef enum { CRC_LSBYTE_FIRST, CRC_MSBYTE_FIRST } mxc_crc_byteorder_t;

/**
* @brief CRC reflected
*
*/
typedef enum { CRC_REFLECTED, CRC_NOT_REFLECTED } mxc_crc_reflected_t;

/**
* @brief CRC request state DONE or NOT
*
*/
typedef enum { CRC_NOT_DONE, CRC_DONE } mxc_crc_req_state_t;

/**
* @brief Structure used to set up Full CRC request
*
*/
typedef struct _mxc_crc_full_req_t {
mxc_crc_reflected_t inputReflected; ///< Input reflected or not
mxc_crc_reflected_t resultReflected; ///< Result reflected or not
uint32_t polynominal; ///< The polynominal to calculate CRC
uint32_t initialValue; ///< The initial value to calculate CRC
uint32_t finalXorValue; ///< The final xor value to calculate CRC
uint8_t *dataBuffer; ///< Pointer to the data
uint32_t dataLen; ///< Length of the data

volatile mxc_crc_reflected_t manual_reflected_input_required;
volatile uint8_t dmaChannel;
volatile uint32_t nextPosDMA;
volatile mxc_crc_req_state_t req_state;

volatile uint32_t resultCRC; ///< Calculated CRC value
volatile int error;
} mxc_crc_full_req_t;

/***** Function Prototypes *****/

/* ************************************************************************* */
Expand Down Expand Up @@ -85,6 +125,14 @@ int MXC_CRC_Shutdown(void);
*/
void MXC_CRC_Handler(int ch, int error);

/**
* @brief This function should be called from the CRC ISR Handler
* when using Async functions for full request
* @param ch DMA channel
* @param error error
*/
void MXC_CRC_Full_Req_Handler(int ch, int error);

/**
* @brief Set the bit-order of CRC calculation
*
Expand Down Expand Up @@ -161,6 +209,28 @@ int MXC_CRC_Compute(mxc_crc_req_t *req);
*/
int MXC_CRC_ComputeAsync(mxc_crc_req_t *req);

/**
* @brief Perform a CRC calculation
* @note The result of the CRC calculation will be placed in the
* mxc_crc_full_req_t structure
*
* @param req Structure containing the CRC detailed parameters and data for calculation
*
* @return see \ref MXC_Error_Codes for a list of return codes.
*/
int MXC_CRC_Calculate(mxc_crc_full_req_t *req);

/**
* @brief Perform a CRC calculation
* @note The result of the CRC calculation will be placed in the
* mxc_crc_full_req_t structure
*
* @param req Structure containing the CRC detailed parameters and data for calculation
*
* @return see \ref MXC_Error_Codes for a list of return codes.
*/
int MXC_CRC_CalculateAsync(mxc_crc_full_req_t *req);

#ifdef __cplusplus
}
#endif
Expand Down
72 changes: 71 additions & 1 deletion Libraries/PeriphDrivers/Include/MAX32675/crc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
* Analog Devices, Inc.),
* Copyright (C) 2023-2024 Analog Devices, Inc.
* Copyright (C) 2023-2025 Analog Devices, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -56,6 +56,46 @@ typedef struct _mxc_crc_req_t {
*/
typedef enum { CRC_LSB_FIRST, CRC_MSB_FIRST } mxc_crc_bitorder_t;

/**
* @brief CRC data byte order
*
*/
typedef enum { CRC_LSBYTE_FIRST, CRC_MSBYTE_FIRST } mxc_crc_byteorder_t;

/**
* @brief CRC reflected
*
*/
typedef enum { CRC_REFLECTED, CRC_NOT_REFLECTED } mxc_crc_reflected_t;

/**
* @brief CRC request state DONE or NOT
*
*/
typedef enum { CRC_NOT_DONE, CRC_DONE } mxc_crc_req_state_t;

/**
* @brief Structure used to set up Full CRC request
*
*/
typedef struct _mxc_crc_full_req_t {
mxc_crc_reflected_t inputReflected; ///< Input reflected or not
mxc_crc_reflected_t resultReflected; ///< Result reflected or not
uint32_t polynominal; ///< The polynominal to calculate CRC
uint32_t initialValue; ///< The initial value to calculate CRC
uint32_t finalXorValue; ///< The final xor value to calculate CRC
uint8_t *dataBuffer; ///< Pointer to the data
uint32_t dataLen; ///< Length of the data

volatile mxc_crc_reflected_t manual_reflected_input_required;
volatile uint8_t dmaChannel;
volatile uint32_t nextPosDMA;
volatile mxc_crc_req_state_t req_state;

volatile uint32_t resultCRC; ///< Calculated CRC value
volatile int error;
} mxc_crc_full_req_t;

/***** Function Prototypes *****/

/* ************************************************************************* */
Expand Down Expand Up @@ -85,6 +125,14 @@ int MXC_CRC_Shutdown(void);
*/
void MXC_CRC_Handler(int ch, int error);

/**
* @brief This function should be called from the CRC ISR Handler
* when using Async functions for full request
* @param ch DMA channel
* @param error error
*/
void MXC_CRC_Full_Req_Handler(int ch, int error);

/**
* @brief Set the bit-order of CRC calculation
*
Expand Down Expand Up @@ -161,6 +209,28 @@ int MXC_CRC_Compute(mxc_crc_req_t *req);
*/
int MXC_CRC_ComputeAsync(mxc_crc_req_t *req);

/**
* @brief Perform a CRC calculation
* @note The result of the CRC calculation will be placed in the
* mxc_crc_full_req_t structure
*
* @param req Structure containing the CRC detailed parameters and data for calculation
*
* @return see \ref MXC_Error_Codes for a list of return codes.
*/
int MXC_CRC_Calculate(mxc_crc_full_req_t *req);

/**
* @brief Perform a CRC calculation
* @note The result of the CRC calculation will be placed in the
* mxc_crc_full_req_t structure
*
* @param req Structure containing the CRC detailed parameters and data for calculation
*
* @return see \ref MXC_Error_Codes for a list of return codes.
*/
int MXC_CRC_CalculateAsync(mxc_crc_full_req_t *req);

#ifdef __cplusplus
}
#endif
Expand Down
Loading
Loading