my_headfile.h
4.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#ifndef _MY_HEAD_FILE_H_
#define _MY_HEAD_FILE_H_
#include "string.h"
#include "gen_linklist.h"
#include "gen_queue.h"
//#include "base_config.h"
//获取cnt个连续的bit1
#define CNT_2_BIT(cnt) ( (1<<(cnt))-1)
#define ABS(a,b) (a)>=(b)?((a)-(b)):((b)-(a))
#define HBYTEL_COMB_INT(byte) (((byte)[0]<<24)+ ((byte)[1]<<16)+ ((byte)[2]<<8)+ ((byte)[3]<<0) )
//#define LBYTEH_COMB_INT (((byte)[3]<<24)+ ((byte)[2]<<16)+ ((byte)[1]<<8)+ ((byte)[0]<<0) )
#define HBYTEL_COMB_SHORT(byte) (((byte)[0]<<8)+ ((byte)[1]<<0) )
typedef union{
unsigned int u32b;
unsigned char u8b[4];
}u32_8_union;
typedef union{
unsigned short u16b;
unsigned char u8b[2];
}u16_8_union;
//crc
unsigned short crc16(const unsigned char *ptr,unsigned short len);
//变量和常量比对 0-相等
unsigned char memcmp_constant(const unsigned char *var,unsigned char cst,unsigned char len);
#define name2str(name) (#name) //变量名转换成字符串
//__FUNCTION__ 函数名转换成字符串
//将字符转换成16进制数
unsigned char char_conver_hex(char s);
//typedef struct kp_ele_STR{
// unsigned char status;
// unsigned char id_sn[4];
// unsigned char index;
//
// #if (MON_KP_VOTE)
// unsigned short rxkp_cnt; //收到键盘数据包的个数,
// unsigned short ackkp_cnt; //基站应答键盘的次数, 语音状态不应答!
// unsigned short cfmed_cnt;
// unsigned short rpt_cnt;
// #endif
//}kp_ele_str;
//#define LIST_MGNT_CNT 100
//void mon__rx_kp(const unsigned char *rxkp);
//void mon__ack_kp(const unsigned char *sn);
//extern unsigned char check_down_permit(void);
//extern void set_tx_beacon7(void);
//---------------------- debug -----------------------------------------
typedef enum {
DBGIO_NUMB0=0,
DBGIO_NUMB1,
DBGIO_NUMB2,
DBGIO_NUMB3,
}dbgIO_nmb_enum;
typedef enum {
DBGIO_STAT_OFF=0,
DBGIO_STAT_ON,
DBGIO_STAT_TRIG,
}dbgIO_stat_enum;
typedef struct {
unsigned char b0:1;
unsigned char b1:1;
unsigned char b2:1;
unsigned char b3:1;
unsigned char b4:1;
unsigned char b5:1;
unsigned char b6:1;
unsigned char b7:1;
unsigned char b8:1;
unsigned char b9:1;
unsigned char b10:1;
unsigned char b11:1;
unsigned char b12:1;
unsigned char b13:1;
unsigned char b14:1;
unsigned char b15:1;
unsigned char b16:1;
unsigned char b17:1;
unsigned char b18:1;
unsigned char b19:1;
unsigned char b20:1;
unsigned char b21:1;
unsigned char b22:1;
unsigned char b23:1;
unsigned char b24:1;
unsigned char b25:1;
unsigned char b26:1;
unsigned char b27:1;
unsigned char b28:1;
unsigned char b29:1;
unsigned char b30:1;
//unsigned char b31:1;
}BIT32;
extern unsigned int PRINT_DBG_CTRL;
#define PRINT_DBG_WARN (((BIT32*)&PRINT_DBG_CTRL) -> b0)
#define PRINT_DBG_ERROR (((BIT32*)&PRINT_DBG_CTRL) -> b1)
#define PRINT_DBG_SYSTEM (((BIT32*)&PRINT_DBG_CTRL) -> b2)
#define PRINT_DBG_PLAT_INIT (((BIT32*)&PRINT_DBG_CTRL) -> b3)
#define PRINT_DBG_MULTI (((BIT32*)&PRINT_DBG_CTRL) -> b4)
#define PRINT_DBG_HDTEST (((BIT32*)&PRINT_DBG_CTRL) -> b5)
//keypad
#define PRINT_DBG_KP (((BIT32*)&PRINT_DBG_CTRL) -> b8)
#define PRINT_DBG_KP_ONLINE (((BIT32*)&PRINT_DBG_CTRL) -> b9)
#define PRINT_DBG_58GRX (((BIT32*)&PRINT_DBG_CTRL) -> b10)
#define PRINT_DBG_58GTX (((BIT32*)&PRINT_DBG_CTRL) -> b11)
#define PRINT_DBG_24GRX (((BIT32*)&PRINT_DBG_CTRL) -> b10)
#define PRINT_DBG_24GTX (((BIT32*)&PRINT_DBG_CTRL) -> b11)
#define PRINT_DBG_ONLINE (((BIT32*)&PRINT_DBG_CTRL) -> b12)
//pc/sdk
#define PRINT_DBG_PC (((BIT32*)&PRINT_DBG_CTRL) -> b16)
#define PRINT_DBG_VOTE_RPT (((BIT32*)&PRINT_DBG_CTRL) -> b17)
//#define PRINT_MON_VOTE (((BIT32*)&PRINT_DBG_CTRL) -> b18) //monitor vote info
//func
#define PRINT_DBG_NFC (((BIT32*)&PRINT_DBG_CTRL) -> b24)
#define PRINT_DBG_JOINNET (((BIT32*)&PRINT_DBG_CTRL) -> b25)
#define PRINT_DBG_BLKLIST (((BIT32*)&PRINT_DBG_CTRL) -> b26) //blacklist
#define PRINT_DBG_LGPKT (((BIT32*)&PRINT_DBG_CTRL) -> b26) //longpkt
//-----------------------------------------------------------
extern void rx_rtt_process(void);
struct debug_STR{
void(*init)(void);
void (*ctrl_io)(dbgIO_nmb_enum , dbgIO_stat_enum );
int (*printf)(unsigned char modual, const char * sFormat, ...);
void (*print_buf)(unsigned char md,const char * sFormat,const unsigned char *buf,unsigned char len);
void(*process_input)(void);
void (*printf_warn)(const char * sFormat, ...);
void (*printf_error)(const char * sFormat, ...);
};
extern struct debug_STR my_debug;
#endif