51 lines
1.2 KiB
C
51 lines
1.2 KiB
C
#ifndef __XC_SOFTWARE_CRC_H__
|
|
#define __XC_SOFTWARE_CRC_H__
|
|
#include "rf_config.h"
|
|
#include <stdint.h>
|
|
#if (XINCX_RF_COMPATIBILITY_MODE == 1)
|
|
#define PANCHIP_MODE
|
|
#elif (XINCX_RF_COMPATIBILITY_MODE == 2)
|
|
#define BEKEN_MODE
|
|
#elif (XINCX_RF_COMPATIBILITY_MODE ==3)
|
|
#define TELINK_MODE
|
|
#else
|
|
#define HUNTERSUN_MODE
|
|
#endif
|
|
|
|
#define PACKET_NORMAL 0
|
|
#define PACKET_ENHANCED 1
|
|
|
|
#define SUPPLEMENTARY_DATA 0x50
|
|
#ifdef TELINK_MODE
|
|
#define SURPLUS_UNIT 1
|
|
#define NUMBER 0x1
|
|
#endif
|
|
|
|
#ifdef BEKEN_MODE
|
|
#define SURPLUS_UNIT 1
|
|
#define NUMBER 0x1
|
|
#endif
|
|
|
|
#ifdef PANCHIP_MODE
|
|
#define SURPLUS_UNIT 2
|
|
#define NUMBER 0x3
|
|
#endif
|
|
|
|
#ifndef SURPLUS_UNIT
|
|
#define SURPLUS_UNIT 1
|
|
#endif
|
|
|
|
#define DATA_NUM (64) // 32
|
|
|
|
extern uint8_t rf_whiten_buff[DATA_NUM];
|
|
|
|
uint16_t crc16_ccitt_false(uint8_t *crc_data, uint8_t data_len, uint16_t crc_seed, uint8_t packet_mode);
|
|
uint8_t crc8_rohc(const uint8_t *data, uint8_t length, uint16_t crc_seed, uint8_t packet_mode);
|
|
uint16_t bit_negation(uint16_t data, uint8_t data_bit);
|
|
uint8_t byte_bigandsmallend(uint8_t data);
|
|
void buff_bigandsmallend(uint8_t *buff, uint8_t buff_len);
|
|
void whiten_shift(uint8_t *shifter);
|
|
uint8_t whiten_data(uint8_t *whiten_data_in, uint8_t data_in_len, uint8_t shifer_init);
|
|
|
|
#endif //__XC_SOFTWARE_CRC_H__
|