MAX32680 Peripheral Driver API
Peripheral Driver API for the MAX32680
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Modules
crc.h
1
6/******************************************************************************
7 *
8 * Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
9 * Analog Devices, Inc.),
10 * Copyright (C) 2023-2024 Analog Devices, Inc.
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 *
24 ******************************************************************************/
25
26#ifndef LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32680_CRC_H_
27#define LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32680_CRC_H_
28
29/***** Includes *****/
30#include "crc_regs.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
42/***** CRC Definitions *****/
47typedef struct _mxc_crc_req_t {
48 uint32_t *dataBuffer;
49 uint32_t dataLen;
50 uint32_t resultCRC;
52
57typedef enum { CRC_LSB_FIRST, CRC_MSB_FIRST } mxc_crc_bitorder_t;
58
59/***** Function Prototypes *****/
60
61/* ************************************************************************* */
62/* Global Control/Configuration functions */
63/* ************************************************************************* */
64
71int MXC_CRC_Init(void);
72
79
86void MXC_CRC_Handler(int ch, int error);
87
94
101
108
115
121void MXC_CRC_SetPoly(uint32_t poly);
122
128uint32_t MXC_CRC_GetPoly(void);
129
135uint32_t MXC_CRC_GetResult(void);
136
137/*******************************/
138/* High Level Functions */
139/*******************************/
140
151
163
164#ifdef __cplusplus
165}
166#endif
169#endif // LIBRARIES_PERIPHDRIVERS_INCLUDE_MAX32680_CRC_H_
Registers, Bit Masks and Bit Positions for the CRC Peripheral Module.
uint32_t * dataBuffer
Pointer to the data.
Definition: crc.h:48
uint32_t resultCRC
Calculated CRC value.
Definition: crc.h:50
uint32_t dataLen
Length of the data.
Definition: crc.h:49
mxc_crc_bitorder_t MXC_CRC_GetDirection(void)
Set the bit-order of CRC calculation.
uint32_t MXC_CRC_GetResult(void)
Get the result of a CRC calculation.
int MXC_CRC_Shutdown(void)
Disable and reset portions of the CRC.
void MXC_CRC_SetDirection(mxc_crc_bitorder_t bitOrder)
Set the bit-order of CRC calculation.
mxc_crc_bitorder_t
CRC data bit order.
Definition: crc.h:57
int MXC_CRC_Init(void)
Enable portions of the CRC.
int MXC_CRC_ComputeAsync(mxc_crc_req_t *req)
Perform a CRC computation using DMA.
void MXC_CRC_SwapDataOut(mxc_crc_bitorder_t bitOrder)
Byte Swap CRC Data output.
void MXC_CRC_SwapDataIn(mxc_crc_bitorder_t bitOrder)
Byte Swap CRC Data Input.
uint32_t MXC_CRC_GetPoly(void)
Get the polynomial for CRC calculation.
void MXC_CRC_Handler(int ch, int error)
This function should be called from the CRC ISR Handler when using Async functions.
int MXC_CRC_Compute(mxc_crc_req_t *req)
Perform a CRC computation.
void MXC_CRC_SetPoly(uint32_t poly)
Set the Polynomial for CRC calculation.
Structure used to set up CRC request.
Definition: crc.h:47