移植与电子模块通信相关代码
This commit is contained in:
139
source/elec_det/base/define.h
Normal file
139
source/elec_det/base/define.h
Normal file
@@ -0,0 +1,139 @@
|
||||
#ifndef DEFINE_H_
|
||||
#define DEFINE_H_
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <rthw.h>
|
||||
#include <rtthread.h>
|
||||
#include "stm32f10x.h"
|
||||
#include "misc.h"
|
||||
#include "stm32f10x_adc.h"
|
||||
#include "stm32f10x_dma.h"
|
||||
#include "stm32f10x_gpio.h"
|
||||
#include "stm32f10x_usart.h"
|
||||
#include "stm32f10x_rcc.h"
|
||||
#include "stm32f10x_tim.h"
|
||||
#include "stm32f10x_dac.h"
|
||||
#include "stm32f10x_i2c.h"
|
||||
#define UNUSED(X) (void)X
|
||||
|
||||
#define SoftVersion 0x000D
|
||||
|
||||
|
||||
#if __IF_PORT_UART
|
||||
//是否使用通信缓存
|
||||
#define APP_COMM_USE_FIFO 0
|
||||
//命令通信接口
|
||||
#define APP_COMD_CAN 0
|
||||
#define APP_COMD_USART 1
|
||||
|
||||
#else
|
||||
|
||||
//是否使用通信缓存
|
||||
#define APP_COMM_USE_FIFO 1
|
||||
//命令通信接口
|
||||
#define APP_COMD_CAN 1
|
||||
#define APP_COMD_USART 1
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
typedef enum{
|
||||
FUN_E = ((uint8_t)0),//使能
|
||||
FUN_D = ((uint8_t)1) //失能
|
||||
}FUNState_e;
|
||||
|
||||
typedef union{
|
||||
uint32_t ul_data;
|
||||
uint16_t us_data;
|
||||
uint8_t uc_data;
|
||||
uint16_t us_buf[2];
|
||||
uint8_t uc_buf[4];
|
||||
}Seq_Buf_En;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define APP_BEG_ADDR 0x8004000
|
||||
#define APP_END_ADDR 0x8024000
|
||||
|
||||
//#define APP_TEST_BOARD_CFG 0x803E800
|
||||
#define MC_CODE_ADDR 0x803B000
|
||||
#define APP_TEST_PLAN_ADDR 0x803F000
|
||||
#define APP_TEST_BOOTFLAG_ADDR 0x803F800
|
||||
|
||||
#define FCM_END_ADDR 0x8040000
|
||||
#define FMC_PAGE_SIZE ((uint16_t)0x800U)
|
||||
|
||||
#define APP_TEST_PLANINFO_SIZE 2048
|
||||
|
||||
|
||||
|
||||
//系统事件定义
|
||||
#define U1_RX_FRAME_EVENT 0x01
|
||||
#define UART_MC_FRAME_EVENT 0x02
|
||||
#define CAN_MC_FRAME_EVENT 0x04
|
||||
#define TRANS_FRAME_EVENT 0x08
|
||||
|
||||
#define UART_TX_END_EVENT 1
|
||||
|
||||
#define EP1_CMD_FRAME_EVENT 1
|
||||
#define EPJ_CMD_FRAME_EVENT 1
|
||||
#define EP2_CMD_FRAME_EVENT 1
|
||||
|
||||
#define USART_APP_EXCE_EVENT 1
|
||||
#define EP_HEARTBEAD_EVENT 5
|
||||
|
||||
|
||||
/******************总线电压倍率*****/
|
||||
#define VH_Mutli 21
|
||||
#define VM_Mutli 21
|
||||
#define BOAED_SEQ_NUM_SIZE 20
|
||||
extern struct rt_event usart1_rx_event;
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
uint32_t bootflag; //更新标志
|
||||
uint16_t resistor_diff;//
|
||||
uint16_t hard_v;
|
||||
uint32_t mc_ICodeCrc32;
|
||||
uint8_t sqNum[BOAED_SEQ_NUM_SIZE];
|
||||
}BoardInfo_st;
|
||||
|
||||
typedef union{
|
||||
BoardInfo_st boardinfo;
|
||||
uint32_t ul_buf[32];
|
||||
}BoardInfo_un;
|
||||
|
||||
typedef struct {
|
||||
|
||||
uint8_t app_run_flag;
|
||||
uint8_t device_id;
|
||||
uint16_t chip_temp;
|
||||
uint16_t v2p5_adc;
|
||||
uint16_t v1p25_adc;
|
||||
uint16_t adc_shake;
|
||||
uint16_t bus_5p5v;
|
||||
uint16_t bus_26v;
|
||||
uint16_t hard_v;
|
||||
uint16_t soft_v;
|
||||
uint16_t resistor_diff;
|
||||
uint32_t plan_id;
|
||||
|
||||
}BoartCheck_st;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
extern BoartCheck_st board_st;
|
||||
extern BoardInfo_un boardinfo_un;
|
||||
|
||||
//检测小板初始化
|
||||
void Ye_BoardInit(void);
|
||||
/*
|
||||
测试小板上电自检
|
||||
*/
|
||||
void Ye_BoardCheck(void);
|
||||
//
|
||||
uint8_t UidCode_YM2JQ(uint8_t* pstJQUID, uint8_t* pstYMUID);
|
||||
uint32_t GetPasswordByUidCode(uint8_t* uidcode);
|
||||
#endif
|
63
source/elec_det/base/delay.c
Normal file
63
source/elec_det/base/delay.c
Normal file
@@ -0,0 +1,63 @@
|
||||
#include "base/delay.h"
|
||||
#include "stdbool.h"
|
||||
#include "rtthread.h"
|
||||
|
||||
|
||||
|
||||
//此函数已在别处实现
|
||||
//void delay_us(uint32_t nus)
|
||||
//{
|
||||
//}
|
||||
|
||||
void delay_ms(uint32_t nms)
|
||||
{
|
||||
while(nms > 0)
|
||||
{
|
||||
nms--;
|
||||
delay_us(1000); //普通方式延时,此时ucos无法启动调度.
|
||||
}
|
||||
|
||||
}
|
||||
void delay_nop(uint32_t nop)
|
||||
{
|
||||
while(nop > 0)
|
||||
{
|
||||
nop--;
|
||||
__NOP();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
41
source/elec_det/base/delay.h
Normal file
41
source/elec_det/base/delay.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef __DELAY_H_
|
||||
#define __DELAY_H_
|
||||
#include "base/define.h"
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
void Systick_init(uint32_t tick);
|
||||
void delay_ms(uint32_t nms);
|
||||
void delay_us(uint32_t nus);
|
||||
void delay_nop(uint32_t nop);
|
||||
#define delay_os_ms(ms) rt_thread_delay(ms)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
458
source/elec_det/base/utility.c
Normal file
458
source/elec_det/base/utility.c
Normal file
@@ -0,0 +1,458 @@
|
||||
|
||||
|
||||
#include "utility.h"
|
||||
float myatof(const char* str)
|
||||
{
|
||||
|
||||
uint32_t int_nu = 0;
|
||||
uint32_t flot_nu = 0;
|
||||
float val;
|
||||
float f_count = 1;
|
||||
while((*str != 0) && (*str != '.'))
|
||||
{
|
||||
if(*str > '9' && *str < '0')
|
||||
{
|
||||
str++;
|
||||
continue;
|
||||
}
|
||||
int_nu = int_nu*10+(*str - 48);
|
||||
str++;
|
||||
}
|
||||
|
||||
if(*str == 0)
|
||||
{
|
||||
val = int_nu;
|
||||
return val;
|
||||
}
|
||||
str++;
|
||||
while(*str != 0)
|
||||
{
|
||||
if(*str > '9' && *str < '0')
|
||||
{
|
||||
str++;
|
||||
continue;
|
||||
}
|
||||
flot_nu = flot_nu*10+(*str - 48);
|
||||
f_count *= 10;
|
||||
str++;
|
||||
}
|
||||
val = flot_nu;
|
||||
val = val / f_count + int_nu;
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
*@brief string to uint16_t
|
||||
*@param str:src string, base:
|
||||
*@return num:convert result
|
||||
*/
|
||||
uint16_t atoi16(const char* str,uint16_t base)
|
||||
{
|
||||
unsigned int num = 0;
|
||||
while (*str !=0)
|
||||
num = num * base + c2d(*str++);
|
||||
return num;
|
||||
}
|
||||
|
||||
/**
|
||||
*@brief string to uint32
|
||||
*@param str:src string, base:
|
||||
*@return num:convert result
|
||||
*/
|
||||
uint32_t atoi32(const char* str,uint16_t base)
|
||||
{
|
||||
uint32_t num = 0;
|
||||
while (*str !=0)
|
||||
num = num * base + c2d(*str++);
|
||||
return num;
|
||||
}
|
||||
|
||||
/**
|
||||
*@brief uint16 data to string
|
||||
*@param n:src num, str[5]:string buffer len:string size
|
||||
*@return void
|
||||
*/
|
||||
void itoa(uint16_t n,uint8_t str[5], uint8_t len)
|
||||
{
|
||||
|
||||
uint8_t i=len-1;
|
||||
|
||||
memset(str,0x20,len);
|
||||
do{
|
||||
str[i--]=n%10+'0';
|
||||
|
||||
}while((n/=10)>0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*@brief dec or hex string convert to uint32_t
|
||||
*@param str:src string, ret: the pointer of result
|
||||
*@return success = 1, fail = 0
|
||||
*/
|
||||
int validatoi(const char* str, int base,uint32_t* ret)
|
||||
{
|
||||
int c;
|
||||
const char* tstr = str;
|
||||
if(str == 0 || *str == '\0')
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
while(*tstr != '\0')
|
||||
{
|
||||
c = c2d(*tstr);
|
||||
if( (c >= 0) && (c < base))
|
||||
{
|
||||
tstr++;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
*ret = atoi32(str,base);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
*@brief new char to replace the old char
|
||||
*@param str:src string,oldchar:dst char,newchar:src char
|
||||
*@return void
|
||||
*/
|
||||
void replacetochar(char * str, char oldchar,char newchar)
|
||||
{
|
||||
int x;
|
||||
for (x = 0; str[x]; x++)
|
||||
if (str[x] == oldchar) str[x] = newchar;
|
||||
}
|
||||
|
||||
/**
|
||||
*@brief char to num
|
||||
*@param c:src char
|
||||
*@return convert result
|
||||
*/
|
||||
char c2d(const uint8_t c)
|
||||
{
|
||||
if (c >= '0' && c <= '9')
|
||||
return c - '0';
|
||||
if (c >= 'a' && c <= 'f')
|
||||
return 10 + c -'a';
|
||||
if (c >= 'A' && c <= 'F')
|
||||
return 10 + c -'A';
|
||||
|
||||
return (char)0;
|
||||
}
|
||||
/**
|
||||
*@brief num to char
|
||||
*@param c:src num
|
||||
*@return convert result
|
||||
*/
|
||||
char d2c(const uint8_t c)
|
||||
{
|
||||
if ( c <= 9)
|
||||
{
|
||||
return c + '0';
|
||||
}
|
||||
if (c >= 0x0a && c <= 0x0f)
|
||||
{
|
||||
return c + 'a' - 10;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
*@brief 2bytes swap
|
||||
*@param i:src num
|
||||
*@return convert result
|
||||
*/
|
||||
uint16_t swaps(uint16_t i)
|
||||
{
|
||||
uint16_t ret=0;
|
||||
ret = (i & 0xFF) << 8;
|
||||
ret |= ((i >> 8)& 0xFF);
|
||||
return ret;
|
||||
}
|
||||
/**
|
||||
*@brief 4 bytes swap, bytes order 4 3 2 1 convert to 1 2 3 4
|
||||
*@param i:src num
|
||||
*@return convert result
|
||||
*/
|
||||
uint32_t swapl(uint32_t l)
|
||||
{
|
||||
uint32_t ret=0;
|
||||
ret = (l & 0xFF) << 24;
|
||||
ret |= ((l >> 8) & 0xFF) << 16;
|
||||
ret |= ((l >> 16) & 0xFF) << 8;
|
||||
ret |= ((l >> 24) & 0xFF);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
*@brief get substring
|
||||
*@param src:src string s1: target begin s2: target end sub: result pointer
|
||||
*@return void
|
||||
*/
|
||||
void mid(const char* src, const char* s1, const char* s2, char* sub)
|
||||
{
|
||||
char* sub1;
|
||||
char* sub2;
|
||||
uint16_t n;
|
||||
|
||||
sub1=strstr(src,s1);
|
||||
sub1+=strlen(s1);
|
||||
sub2=strstr(sub1,s2);
|
||||
n=sub2-sub1;
|
||||
strncpy(sub,sub1,n);
|
||||
sub[n]=0;
|
||||
}
|
||||
/**
|
||||
*@brief bytes array conver to string
|
||||
*@param *data: ponit src bytes len: array length str: resuter string pointer
|
||||
*@return void
|
||||
*/
|
||||
|
||||
void bytes2hexString(const char* data, uint32_t len, char* str)
|
||||
{
|
||||
char c_temp;
|
||||
while(len > 0)
|
||||
{
|
||||
c_temp = ((*data) &0xF0) >> 4;
|
||||
if(c_temp < 10)
|
||||
{
|
||||
*str = c_temp + '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
*str = (c_temp - 10) + 'A';
|
||||
}
|
||||
|
||||
c_temp = ((*data) &0x0F);
|
||||
str++;
|
||||
if(c_temp < 10)
|
||||
{
|
||||
*str = c_temp + '0';
|
||||
}
|
||||
else
|
||||
{
|
||||
*str = (c_temp - 10)+ 'A';
|
||||
}
|
||||
str++;
|
||||
data++;
|
||||
len--;
|
||||
}
|
||||
*(str++) = '\0';
|
||||
|
||||
}
|
||||
/*
|
||||
Hex Datas to Bytes
|
||||
*/
|
||||
uint8_t HexStrings2Byte(char**strs,uint16_t size,uint8_t* buf,uint16_t buf_size)
|
||||
{
|
||||
char* str;
|
||||
uint8_t data = 0;
|
||||
uint16_t count = 0;
|
||||
while((size > 0) && (count < buf_size))
|
||||
{
|
||||
str = strs[count++];
|
||||
size--;
|
||||
data = 0;
|
||||
while(*str != '\0')
|
||||
{
|
||||
|
||||
if(*str == '0')
|
||||
{
|
||||
if((*(str+1) == 'X') || (*(str+1) == 'x'))
|
||||
{
|
||||
str+=2;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
data <<=4;
|
||||
data |=c2d(*str);
|
||||
str++;
|
||||
}
|
||||
*buf = data;
|
||||
buf++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Hex Datas to uint32_t
|
||||
*/
|
||||
uint32_t HexStrings2UInt(char*str)
|
||||
{
|
||||
|
||||
uint32_t data = 0;
|
||||
uint16_t count = 0;
|
||||
data = 0;
|
||||
while(*str != '\0' && count < 10)
|
||||
{
|
||||
|
||||
if(*str == '0')
|
||||
{
|
||||
if((*(str+1) == 'X') || (*(str+1) == 'x'))
|
||||
{
|
||||
str+=2;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
data <<=4;
|
||||
data |=c2d(*str);
|
||||
str++;
|
||||
count++;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
//冒泡排序16位数据
|
||||
void Bubble_Sort_u16(uint16_t* buf,uint32_t len)
|
||||
{
|
||||
uint32_t ul_temp1 = 0;
|
||||
uint32_t ul_temp2 = 0;
|
||||
uint16_t us_temp;
|
||||
if(len < 2)
|
||||
return;
|
||||
for(ul_temp2 = 0; ul_temp2 < len-1; ul_temp2++)
|
||||
{
|
||||
for(ul_temp1 = 0; ul_temp1 < len-1-ul_temp2; ul_temp1++)
|
||||
{
|
||||
if(buf[ul_temp1] > buf[ul_temp1+1])
|
||||
{
|
||||
us_temp = buf[ul_temp1];
|
||||
buf[ul_temp1] = buf[ul_temp1 + 1];
|
||||
buf[ul_temp1 + 1] = us_temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
//数据左移
|
||||
void BufMoveLeft(uint8_t* srcbuf,uint16_t offset,uint16_t data_len)
|
||||
{
|
||||
uint8_t index = 0;
|
||||
while(data_len > 0)
|
||||
{
|
||||
srcbuf[index] = srcbuf[index+offset];
|
||||
data_len--;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
//数据右移
|
||||
void BufMoveRight(uint8_t* srcbuf,uint16_t offset,uint16_t data_len)
|
||||
{
|
||||
while(data_len > 0)
|
||||
{
|
||||
data_len--;
|
||||
srcbuf[data_len+offset] = srcbuf[data_len] ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//@brief 计算数组的CRC8值
|
||||
//@param *srcbuf 数据源指针
|
||||
//@param len 数据源长度
|
||||
//@rtvl 返回计算结果
|
||||
uint8_t CheckXOR_8(uint8_t* srcbuf,uint16_t len)
|
||||
{
|
||||
uint8_t crc = 0x00;
|
||||
while(len--)
|
||||
{
|
||||
crc ^= *srcbuf++;
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
|
||||
|
||||
//@brief 计算数组异或校验值
|
||||
//@param *Ptr 数据源
|
||||
//@param num 计算长度
|
||||
//@rtvl 返回计算结果
|
||||
uint8_t CheckCRC_8(uint8_t* Ptr,uint16_t num)
|
||||
{
|
||||
uint8_t crc = 0;
|
||||
uint16_t j,i;
|
||||
|
||||
for (j = 0; j < num; j++)
|
||||
{
|
||||
crc ^= *(Ptr+j);
|
||||
for ( i = 0; i < 8; i++)
|
||||
{
|
||||
if ((crc & 0x01) != 0)
|
||||
{
|
||||
crc >>= 1;
|
||||
crc ^= 0x8c;
|
||||
}
|
||||
else
|
||||
{
|
||||
crc >>= 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
//@brief 计算CRC32
|
||||
//@param *srcbuf 数据源
|
||||
//@param len 计算长度
|
||||
//@rtvl 返回计算结果
|
||||
uint32_t Crc32Calu(uint32_t* buf, uint32_t len)
|
||||
{
|
||||
uint32_t temp,crc = 0xFFFFFFFF;
|
||||
|
||||
uint32_t i,j;
|
||||
i = 0;
|
||||
if(((uint32_t)buf %4) != 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
while(i<len)
|
||||
{
|
||||
temp = *buf;
|
||||
i += 4;
|
||||
buf ++;
|
||||
for(j=0; j<32; j++)
|
||||
{
|
||||
if( (crc ^ temp) & 0x80000000 )
|
||||
{
|
||||
crc = 0x04C11DB7 ^(crc<<1);
|
||||
}
|
||||
else
|
||||
{
|
||||
crc <<=1;
|
||||
}
|
||||
temp<<=1;
|
||||
}
|
||||
crc&=0xFFFFFFFF;
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
/*
|
||||
@brief 获取数组中的最大值和最小值
|
||||
@param *aus_buf 缓存数组
|
||||
@param us_size 数组长度
|
||||
@param *us_max 最大值
|
||||
@param *us_min 最小值
|
||||
*/
|
||||
|
||||
void GetMaxAndMinValue(uint16_t* aus_buf,uint16_t us_size,uint16_t* us_max,uint16_t* us_min)
|
||||
{
|
||||
*us_max = 0;
|
||||
*us_min = ~0;
|
||||
while(us_size > 0)
|
||||
{
|
||||
if(*us_max < *aus_buf)
|
||||
{
|
||||
*us_max = *aus_buf;
|
||||
}
|
||||
if(*us_min > *aus_buf)
|
||||
{
|
||||
*us_min = *aus_buf;
|
||||
}
|
||||
aus_buf++;
|
||||
us_size--;
|
||||
}
|
||||
}
|
60
source/elec_det/base/utility.h
Normal file
60
source/elec_det/base/utility.h
Normal file
@@ -0,0 +1,60 @@
|
||||
#ifndef _UTILITY_H
|
||||
#define _UTILITY_H
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "stm32f10x.h"
|
||||
|
||||
float myatof(const char* str);
|
||||
uint16_t atoi16(const char* str,uint16_t base); /* Convert a string to integer number */
|
||||
uint32_t atoi32(const char* str,uint16_t base); /* Convert a string to integer number */
|
||||
void itoa(uint16_t n,uint8_t* str, uint8_t len);
|
||||
int validatoi(const char* str, int base, uint32_t* ret); /* Verify character string and Convert it to (hexa-)decimal. */
|
||||
char c2d(uint8_t c);
|
||||
char d2c(uint8_t c);
|
||||
uint16_t swaps(uint16_t i);
|
||||
uint32_t swapl(uint32_t l);
|
||||
|
||||
void replacetochar(char * str, char oldchar, char newchar);
|
||||
|
||||
void mid(const char* src, const char* s1, const char* s2, char* sub);
|
||||
|
||||
void bytes2hexString(const char* data, uint32_t len, char* str);
|
||||
//冒泡排序16位数据
|
||||
void Bubble_Sort_u16(uint16_t* buf,uint32_t len);
|
||||
//数据左移
|
||||
void BufMoveLeft(uint8_t* srcbuf,uint16_t offset,uint16_t data_len);
|
||||
//数据右移
|
||||
void BufMoveRight(uint8_t* srcbuf,uint16_t offset,uint16_t data_len);
|
||||
/*
|
||||
Hex Datas to Bytes
|
||||
*/
|
||||
uint8_t HexStrings2Byte(char**strs,uint16_t size,uint8_t* buf,uint16_t buf_size);
|
||||
/*
|
||||
Hex Datas to uint32_t
|
||||
*/
|
||||
uint32_t HexStrings2UInt(char*str);
|
||||
//@brief 计算数组异或校验值
|
||||
//@param *srcbuf 数据源
|
||||
//@param len 计算长度
|
||||
//@rtvl 返回计算结果
|
||||
uint8_t CheckCRC_8(uint8_t* Ptr,uint16_t num);
|
||||
//@brief 计算CRC32
|
||||
//@param *srcbuf 数据源
|
||||
//@param len 计算长度
|
||||
//@rtvl 返回计算结果
|
||||
uint32_t Crc32Calu(uint32_t* buf, uint32_t len);
|
||||
/*
|
||||
@brief 获取数组中的最大值和最小值
|
||||
@param *aus_buf 缓存数组
|
||||
@param us_size 数组长度
|
||||
@param *us_max 最大值
|
||||
@param *us_min 最小值
|
||||
*/
|
||||
|
||||
void GetMaxAndMinValue(uint16_t* aus_buf,uint16_t us_size,uint16_t* us_max,uint16_t* us_min);
|
||||
//@brief 计算数组的CRC8值
|
||||
//@param *srcbuf 数据源指针
|
||||
//@param len 数据源长度
|
||||
//@rtvl 返回计算结果
|
||||
uint8_t CheckXOR_8(uint8_t* srcbuf,uint16_t len);
|
||||
#endif
|
Reference in New Issue
Block a user