MAX32675 Peripheral Driver API
Peripheral Driver API for the MAX32675
crc.h
1 
6 /* ****************************************************************************
7  * Copyright (C) 2018 Maxim Integrated Products, Inc., All Rights Reserved.
8  *
9  * Permission is hereby granted, free of charge, to any person obtaining a
10  * copy of this software and associated documentation files (the "Software"),
11  * to deal in the Software without restriction, including without limitation
12  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13  * and/or sell copies of the Software, and to permit persons to whom the
14  * Software is furnished to do so, subject to the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be included
17  * in all copies or substantial portions of the Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
22  * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
23  * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  *
27  * Except as contained in this notice, the name of Maxim Integrated
28  * Products, Inc. shall not be used except as stated in the Maxim Integrated
29  * Products, Inc. Branding Policy.
30  *
31  * The mere transfer of this software does not imply any licenses
32  * of trade secrets, proprietary technology, copyrights, patents,
33  * trademarks, maskwork rights, or any other form of intellectual
34  * property whatsoever. Maxim Integrated Products, Inc. retains all
35  * ownership rights.
36  *
37  *************************************************************************** */
38 
39 #ifndef _CRC_H_
40 #define _CRC_H_
41 
42 /***** Includes *****/
43 #include "crc_regs.h"
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
55 /***** CRC Definitions *****/
60 typedef struct _mxc_crc_req_t {
61  uint32_t* dataBuffer;
62  uint32_t dataLen;
63  uint32_t resultCRC;
64 } mxc_crc_req_t;
65 
70 typedef enum {
71  CRC_LSB_FIRST,
72  CRC_MSB_FIRST
74 
75 /***** Function Prototypes *****/
76 
77 /* ************************************************************************* */
78 /* Global Control/Configuration functions */
79 /* ************************************************************************* */
80 
87 int MXC_CRC_Init (void);
88 
94 int MXC_CRC_Shutdown (void);
95 
102 void MXC_CRC_Handler (int ch, int error);
103 
110 
117 
123 void MXC_CRC_SwapDataIn (mxc_crc_bitorder_t bitOrder);
124 
131 
137 void MXC_CRC_SetPoly (uint32_t poly);
138 
144 uint32_t MXC_CRC_GetPoly (void);
145 
151 uint32_t MXC_CRC_GetResult (void);
152 
153 /*******************************/
154 /* High Level Functions */
155 /*******************************/
156 
166 int MXC_CRC_Compute (mxc_crc_req_t* req);
167 
178 int MXC_CRC_ComputeAsync (mxc_crc_req_t* req);
179 
180 #ifdef __cplusplus
181 }
182 #endif
183 
185 #endif /* _CRC_H_ */
MXC_CRC_Init
int MXC_CRC_Init(void)
Enable portions of the CRC.
_mxc_crc_req_t::dataLen
uint32_t dataLen
Length of the data.
Definition: crc.h:62
MXC_CRC_SetPoly
void MXC_CRC_SetPoly(uint32_t poly)
Set the Polynomial for CRC calculation.
MXC_CRC_ComputeAsync
int MXC_CRC_ComputeAsync(mxc_crc_req_t *req)
Perform a CRC computation using DMA.
MXC_CRC_GetPoly
uint32_t MXC_CRC_GetPoly(void)
Get the polynomial for CRC calculation.
_mxc_crc_req_t::resultCRC
uint32_t resultCRC
Calculated CRC value.
Definition: crc.h:63
MXC_CRC_GetDirection
mxc_crc_bitorder_t MXC_CRC_GetDirection(void)
Set the bit-order of CRC calculation.
MXC_CRC_SwapDataOut
void MXC_CRC_SwapDataOut(mxc_crc_bitorder_t bitOrder)
Byte Swap CRC Data output.
MXC_CRC_SetDirection
void MXC_CRC_SetDirection(mxc_crc_bitorder_t bitOrder)
Set the bit-order of CRC calculation.
MXC_CRC_Shutdown
int MXC_CRC_Shutdown(void)
Disable and reset portions of the CRC.
MXC_CRC_SwapDataIn
void MXC_CRC_SwapDataIn(mxc_crc_bitorder_t bitOrder)
Byte Swap CRC Data Input.
MXC_CRC_GetResult
uint32_t MXC_CRC_GetResult(void)
Get the result of a CRC calculation.
_mxc_crc_req_t
Structure used to set up CRC request.
Definition: crc.h:60
MXC_CRC_Compute
int MXC_CRC_Compute(mxc_crc_req_t *req)
Perform a CRC computation.
_mxc_crc_req_t::dataBuffer
uint32_t * dataBuffer
Pointer to the data.
Definition: crc.h:61
mxc_crc_bitorder_t
mxc_crc_bitorder_t
CRC data bit order.
Definition: crc.h:70
MXC_CRC_Handler
void MXC_CRC_Handler(int ch, int error)
This function should be called from the CRC ISR Handler when using Async functions.