mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-22 17:12:55 +08:00
52 lines
2.1 KiB
C
52 lines
2.1 KiB
C
/******************************************************************************************************************************************
|
||
* <20>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>: SWM320_crc.c
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: SWM320<32><30>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD>CRCģ<43><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
* <20><><EFBFBD><EFBFBD>֧<EFBFBD><D6A7>: http://www.synwit.com.cn/e/tool/gbook/?bid=1
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
|
||
* <20>汾<EFBFBD><E6B1BE><EFBFBD><EFBFBD>: V1.1.0 2017<31><37>10<31><30>25<32><35>
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼:
|
||
*
|
||
*
|
||
*******************************************************************************************************************************************
|
||
* @attention
|
||
*
|
||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION
|
||
* REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, SYNWIT SHALL NOT BE HELD LIABLE
|
||
* FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT
|
||
* OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONN-
|
||
* -ECTION WITH THEIR PRODUCTS.
|
||
*
|
||
* COPYRIGHT 2012 Synwit Technology
|
||
*******************************************************************************************************************************************/
|
||
#include "SWM320.h"
|
||
#include "SWM320_crc.h"
|
||
|
||
|
||
/******************************************************************************************************************************************
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: CRC_Init()
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: CRC <20><>ʼ<EFBFBD><CABC>
|
||
* <20><> <20><>: CRC_TypeDef * CRCx ָ<><D6B8>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>CRC<52>ӿڣ<D3BF><DAA3><EFBFBD>Чֵ<D0A7><D6B5><EFBFBD><EFBFBD>CRC
|
||
* uint32_t mode <09><><EFBFBD><EFBFBD>ģʽ<C4A3><CABD><EFBFBD><EFBFBD>Чֵ<D0A7>У<EFBFBD>CRC32_IN32<33><32>CRC32_IN16<31><36>CRC32_IN8<4E><38>CRC16_IN16<31><36>CRC16_IN8
|
||
* uint32_t out_not <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>ȡ<EFBFBD><C8A1>
|
||
* uint32_t out_rev <09><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ת
|
||
* uint32_t ini_val CRC<52><43>ʼֵ
|
||
* <20><> <20><>: <20><>
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><>
|
||
******************************************************************************************************************************************/
|
||
void CRC_Init(CRC_TypeDef * CRCx, uint32_t mode, uint32_t out_not, uint32_t out_rev, uint32_t ini_val)
|
||
{
|
||
switch((uint32_t)CRCx)
|
||
{
|
||
case ((uint32_t)CRC):
|
||
SYS->CLKEN |= (0x01 << SYS_CLKEN_CRC_Pos);
|
||
break;
|
||
}
|
||
|
||
CRCx->CR = (1 << CRC_CR_EN_Pos) |
|
||
(mode << CRC_CR_CRC16_Pos) |
|
||
(out_not << CRC_CR_ONOT_Pos) |
|
||
(out_rev << CRC_CR_OREV_Pos);
|
||
|
||
CRCx->INIVAL = ini_val;
|
||
}
|