mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
40 lines
1.3 KiB
C
40 lines
1.3 KiB
C
#ifndef __SWM320_CRC_H__
|
||
#define __SWM320_CRC_H__
|
||
|
||
|
||
#define CRC32_IN32 0 //CRC32<33>㷨<EFBFBD><E3B7A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>32λ
|
||
#define CRC32_IN16 2 //CRC32<33>㷨<EFBFBD><E3B7A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>16λ
|
||
#define CRC32_IN8 4 //CRC32<33>㷨<EFBFBD><E3B7A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 8λ
|
||
#define CRC16_IN16 3 //CRC16<31>㷨<EFBFBD><E3B7A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>16λ
|
||
#define CRC16_IN8 5 //CRC16<31>㷨<EFBFBD><E3B7A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 8λ
|
||
|
||
|
||
void CRC_Init(CRC_TypeDef * CRCx, uint32_t mode, uint32_t out_not, uint32_t out_rev, uint32_t ini_val);
|
||
|
||
|
||
/******************************************************************************************************************************************
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: CRC_Write()
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: CRCд<43><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
* <20><> <20><>: uint32_t data Ҫд<D2AA><D0B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
* <20><> <20><>: <20><>
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><>
|
||
******************************************************************************************************************************************/
|
||
static __INLINE void CRC_Write(uint32_t data)
|
||
{
|
||
CRC->DATAIN = data;
|
||
}
|
||
|
||
/******************************************************************************************************************************************
|
||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: CRC_Result()
|
||
* <20><><EFBFBD><EFBFBD>˵<EFBFBD><CBB5>: <09><>ȡCRC<52><43><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
* <20><> <20><>: <20><>
|
||
* <20><> <20><>: uint32_t CRC <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
* ע<><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><>
|
||
******************************************************************************************************************************************/
|
||
static __INLINE uint32_t CRC_Result(void)
|
||
{
|
||
return CRC->RESULT;
|
||
}
|
||
|
||
#endif //__SWM320_CRC_H__
|