MAX32655 Peripheral Driver API
Peripheral Driver API for the MAX32655
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;
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 
104 int MXC_CRC_Handler (int ch, int error);
105 
111 void MXC_CRC_SetDirection (mxc_crc_bitorder_t bitOrder);
112 
118 mxc_crc_bitorder_t MXC_CRC_GetDirection (void);
119 
125 void MXC_CRC_SwapDataIn (mxc_crc_bitorder_t bitOrder);
126 
132 void MXC_CRC_SwapDataOut (mxc_crc_bitorder_t bitOrder);
133 
139 void MXC_CRC_SetPoly (uint32_t poly);
140 
146 uint32_t MXC_CRC_GetPoly (void);
147 
153 uint32_t MXC_CRC_GetResult (void);
154 
155 /*******************************/
156 /* High Level Functions */
157 /*******************************/
158 
168 int MXC_CRC_Compute (mxc_crc_req_t* req);
169 
181 
182 #ifdef __cplusplus
183 }
184 #endif
185 
187 #endif /* _CRC_H_ */
uint32_t dataLen
Length of the data.
Definition: crc.h:62
Structure used to set up CRC request.
Definition: crc.h:60
uint32_t MXC_CRC_GetPoly(void)
Get the polynomial for CRC calculation.
uint32_t MXC_CRC_GetResult(void)
Get the result of a CRC calculation.
uint32_t resultCRC
Calculated CRC value.
Definition: crc.h:63
void MXC_CRC_SetDirection(mxc_crc_bitorder_t bitOrder)
Set the bit-order of CRC calculation.
void MXC_CRC_SwapDataIn(mxc_crc_bitorder_t bitOrder)
Byte Swap CRC Data Input.
int MXC_CRC_Shutdown(void)
Disable and reset portions of the CRC.
mxc_crc_bitorder_t MXC_CRC_GetDirection(void)
Set the bit-order of CRC calculation.
int MXC_CRC_Compute(mxc_crc_req_t *req)
Perform a CRC computation.
int MXC_CRC_Init(void)
Enable portions of the CRC.
void MXC_CRC_SwapDataOut(mxc_crc_bitorder_t bitOrder)
Byte Swap CRC Data output.
int MXC_CRC_Handler(int ch, int error)
This function should be called from the CRC ISR Handler when using Async functions.
uint32_t * dataBuffer
Pointer to the data.
Definition: crc.h:61
mxc_crc_bitorder_t
CRC data bit order.
Definition: crc.h:70
int MXC_CRC_ComputeAsync(mxc_crc_req_t *req)
Perform a CRC computation using DMA.
void MXC_CRC_SetPoly(uint32_t poly)
Set the Polynomial for CRC calculation.