hpw421初始版本
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#ifndef __FUNC_H
|
||||
#define __FUNC_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//位变量按字节对齐
|
||||
#define SWAP(a, b, type) {type temp = a; a = b; b = temp;}
|
||||
#define bytealign(bits) ((bits + 7) & 0xF8)
|
||||
|
||||
typedef union {uint32_t value; uint8_t data[4];}WORD_T;
|
||||
typedef union {float value; uint8_t data[4];}FLOAT_T;
|
||||
|
||||
|
||||
/****************************** 校验相关操作 ******************************/
|
||||
extern void f_addcrc(uint8_t *data, uint16_t length);
|
||||
extern uint8_t f_checkcrc(const uint8_t *data, uint16_t length);
|
||||
/****************************** 内存相关操作 ******************************/
|
||||
extern void f_memcpy(uint8_t *dest, const uint8_t *src, uint16_t size);
|
||||
extern void f_memset(uint8_t *data, uint8_t val, uint16_t size);
|
||||
extern uint8_t f_memcmp(const uint8_t *data1, const uint8_t *data2, uint16_t size);
|
||||
/***************************** 字符串相关操作 *****************************/
|
||||
extern uint8_t f_chrcmp(const uint8_t *data, uint8_t val, uint16_t size);
|
||||
extern uint8_t f_strcmp(const uint8_t *str1, const uint8_t *str2);
|
||||
extern uint8_t f_strstr(const uint8_t *str1, const uint8_t *str2);
|
||||
extern int8_t f_strchr(const uint8_t *str, uint8_t ch);
|
||||
|
||||
/******************************* 计算相关操作 *******************************/
|
||||
extern float f_delta(const float aa, const float bb);
|
||||
extern uint32_t f_abs(const uint32_t val1, const uint32_t val2);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user