S32 SDK
crc_driver.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016, Freescale Semiconductor, Inc.
3  * Copyright 2016 NXP
4  * All rights reserved.
5  *
6  * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR
7  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
8  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
9  * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
10  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
11  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
12  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
13  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
14  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
15  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
16  * THE POSSIBILITY OF SUCH DAMAGE.
17  */
18 
19 #ifndef CRC_DRIVER_H
20 #define CRC_DRIVER_H
21 
24 #include "crc_hal.h"
25 #include "status.h"
26 
34 /*******************************************************************************
35  * Variables
36  ******************************************************************************/
38 extern CRC_Type * const g_crcBase[CRC_INSTANCE_COUNT];
39 
40 /*******************************************************************************
41  * Definitions
42  ******************************************************************************/
47 typedef struct
48 {
50  uint32_t seed;
51  uint32_t polynomial;
57 
58 /*******************************************************************************
59  * API
60  ******************************************************************************/
66 #if defined(__cplusplus)
67 extern "C" {
68 #endif
69 
80 status_t CRC_DRV_Init(uint32_t instance,
81  const crc_user_config_t * userConfigPtr);
82 
91 status_t CRC_DRV_Deinit(uint32_t instance);
92 
102 void CRC_DRV_WriteData(uint32_t instance,
103  const uint8_t * data,
104  uint32_t dataSize);
105 
114 uint32_t CRC_DRV_GetCrcResult(uint32_t instance);
115 
125 status_t CRC_DRV_Configure(uint32_t instance,
126  const crc_user_config_t * userConfigPtr);
127 
130 #if defined(__cplusplus)
131 }
132 #endif
133 
136 #endif /* CRC_DRIVER_H */
137 /*******************************************************************************
138  * EOF
139  ******************************************************************************/
status_t CRC_DRV_Init(uint32_t instance, const crc_user_config_t *userConfigPtr)
Initializes the CRC module.
Definition: crc_driver.c:63
status_t CRC_DRV_Configure(uint32_t instance, const crc_user_config_t *userConfigPtr)
Configures the CRC module from a user configuration structure.
Definition: crc_driver.c:143
uint32_t polynomial
Definition: crc_driver.h:51
crc_transpose_t
CRC type of transpose of read write data Implements : crc_transpose_t_Class.
Definition: crc_hal.h:42
crc_transpose_t readTranspose
Definition: crc_driver.h:54
CRC configuration structure. Implements : crc_user_config_t_Class.
Definition: crc_driver.h:47
crc_bit_width_t crcWidth
Definition: crc_driver.h:49
status_t
Status return codes. Common error codes will be a unified enumeration (C enum) that will contain all ...
Definition: status.h:31
bool complementChecksum
Definition: crc_driver.h:55
status_t CRC_DRV_Deinit(uint32_t instance)
Sets the default configuration.
Definition: crc_driver.c:86
crc_transpose_t writeTranspose
Definition: crc_driver.h:53
uint32_t CRC_DRV_GetCrcResult(uint32_t instance)
Returns the current result of the CRC calculation.
Definition: crc_driver.c:127
#define CRC_INSTANCE_COUNT
Definition: S32K144.h:2024
crc_bit_width_t
CRC bit width Implements : crc_bit_width_t_Class.
Definition: crc_hal.h:54
void CRC_DRV_WriteData(uint32_t instance, const uint8_t *data, uint32_t dataSize)
Appends a block of bytes to the current CRC calculation.
Definition: crc_driver.c:104
CRC_Type *const g_crcBase[CRC_INSTANCE_COUNT]
Table of base addresses for CRC instances.
Definition: crc_driver.c:50