2 **************************************************************************
3 * @file at32f435_437_crc.h
6 * @brief at32f435_437 crc header file
7 **************************************************************************
8 * Copyright notice & Disclaimer
10 * The software Board Support Package (BSP) that is made available to
11 * download from Artery official website is the copyrighted work of Artery.
12 * Artery authorizes customers to use, copy, and distribute the BSP
13 * software and its related documentation for the purpose of design and
14 * development in conjunction with Artery microcontrollers. Use of the
15 * software is governed by this copyright notice and the following disclaimer.
17 * THIS SOFTWARE IS PROVIDED ON "AS IS" BASIS WITHOUT WARRANTIES,
18 * GUARANTEES OR REPRESENTATIONS OF ANY KIND. ARTERY EXPRESSLY DISCLAIMS,
19 * TO THE FULLEST EXTENT PERMITTED BY LAW, ALL EXPRESS, IMPLIED OR
20 * STATUTORY OR OTHER WARRANTIES, GUARANTEES OR REPRESENTATIONS,
21 * INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
24 **************************************************************************
27 /* define to prevent recursive inclusion -------------------------------------*/
28 #ifndef __AT32F435_437_CRC_H
29 #define __AT32F435_437_CRC_H
36 /* includes ------------------------------------------------------------------*/
37 #include "at32f435_437.h"
39 /** @addtogroup AT32F435_437_periph_driver
47 /** @defgroup CRC_exported_types
52 * @brief crc reverse input data
56 CRC_REVERSE_INPUT_NO_AFFECTE
= 0x00, /*!< input data no reverse */
57 CRC_REVERSE_INPUT_BY_BYTE
= 0x01, /*!< input data reverse by byte */
58 CRC_REVERSE_INPUT_BY_HALFWORD
= 0x02, /*!< input data reverse by half word */
59 CRC_REVERSE_INPUT_BY_WORD
= 0x03 /*!< input data reverse by word */
60 } crc_reverse_input_type
;
63 * @brief crc reverse output data
67 CRC_REVERSE_OUTPUT_NO_AFFECTE
= 0x00, /*!< output data no reverse */
68 CRC_REVERSE_OUTPUT_DATA
= 0x01 /*!< output data reverse by word */
69 } crc_reverse_output_type
;
72 * @brief type define crc register all
77 * @brief crc dt register, offset:0x00
84 __IO
uint32_t dt
: 32; /* [31:0] */
89 * @brief crc cdt register, offset:0x04
96 __IO
uint32_t cdt
: 8 ; /* [7:0] */
97 __IO
uint32_t reserved1
: 24 ;/* [31:8] */
102 * @brief crc ctrl register, offset:0x08
109 __IO
uint32_t rst
: 1 ; /* [0] */
110 __IO
uint32_t reserved1
: 4 ; /* [4:1] */
111 __IO
uint32_t revid
: 2 ; /* [6:5] */
112 __IO
uint32_t revod
: 1 ; /* [7] */
113 __IO
uint32_t reserved2
: 24 ;/* [31:8] */
118 * @brief crm reserved1 register, offset:0x0C
120 __IO
uint32_t reserved1
;
123 * @brief crc idt register, offset:0x10
130 __IO
uint32_t idt
: 32; /* [31:0] */
140 #define CRC ((crc_type *) CRC_BASE)
142 /** @defgroup CRC_exported_functions
146 void crc_data_reset(void);
147 uint32_t crc_one_word_calculate(uint32_t data
);
148 uint32_t crc_block_calculate(uint32_t *pbuffer
, uint32_t length
);
149 uint32_t crc_data_get(void);
150 void crc_common_data_set(uint8_t cdt_value
);
151 uint8_t crc_common_data_get(void);
152 void crc_init_data_set(uint32_t value
);
153 void crc_reverse_input_data_set(crc_reverse_input_type value
);
154 void crc_reverse_output_data_set(crc_reverse_output_type value
);