This repository has been archived by the owner on Jan 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uart_p.h
126 lines (88 loc) · 3.19 KB
/
uart_p.h
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
// $Id: uart_p.h,v 1.5 2004-05-12 14:47:15 peter Exp $
struct que{
u8 busy; //ìåñòî çàíÿòî.
//0 - ñâîáîäíî
//1 - çàíÿòî
//2 íå ïåðåäàíî (íåîáõîäèìî ïîäòâåðæäåíèå)
//3 ïåðåäàíî (æäåì ïîäòâåðæäåíèÿ)
//4 íå ïåðåäàíî (ïîäòâåðæäåíèÿ íå ïîòðåáóåòñÿ)
u8 numeric; //ïîðÿäêîâûé íîìåð ïàêåòà
u8 type; //òèï ïàêåòà
u8 time_wait; //âðåìÿ îæèäàíèÿ ïîäòâåðæäåíèÿ
u8 len;
};
u16 hold_packet(void);
u16 make_packet(void);
void fill_date_packet(u8 type_packet, u16 num_packet);
#define FREEPLACE 0 //ñâîáîäíûé ïàêåò
#define PACKBUSY 1 //çàíÿòûé ïîä îáðàáîòêó
#define NOTSENDED 2 //íåîòïðàâëåííûé ïàêåò
#define WAIT_ACK 3 //îæèäàþùèé ïîäòâåðæäåíèÿ
#define PACKREC 4 //ïðèíÿòûé ïàêåò
#define RECEIVED 5 //ïðèíÿòûé è îáðàáîòàííûé ïàêåò
#define CRCPACKET 2 //ñìåùåíèå (ñ êîíöà) ïîëîæåíèÿ â ïàêåòå CRC
#define LENPACKET 3 //ñìåùåíèå (ñ êîíöà) ïîëîæåíèÿ â ïàêåòå äëèíû ïàêåòà
#define TYPEPACKET 4 //ñìåùåíèå (ñ êîíöà) ïîëîæåíèÿ â ïàêåòå òèïà ïàêåòà
#define NUMPACKET 5 //ñìåùåíèå (ñ êîíöà) ïîëîæåíèÿ â ïàêåòå íîìåðà ïàêåòà
#define ESCAPE 0x7D
#define EOFPACKET 0x7E //êîä ïðèçíàêà êîíöà êàäðà
// äëèíà ïàêåòîâ ðàçëè÷íûõ òèïîâ
#define SIZE_N_LOADER 64
#define DATA0PACKET 5
#define DATA1PACKET 5
#define DATA2PACKET 5
#define DATA3PACKET 24 //ñìåùåíèå (ñ êîíöà) ïîëîæåíèÿ â ïàêåòå ðàçìåùåíèÿ äàííûõ
#define DATA4PACKET 5
#define DATA5PACKET (SIZE_STAT*2+6)
#define DATA6PACKET (SIZE_STAT1*2+6)
#define DATA7PACKET (32+6)
#define DATA8PACKET 5
#define DATA9PACKET 5
#define DATAxAPACKET (2+4*NUM_MULTICHANNEL+6)
#define DATAxBPACKET 5
#define DATAxCPACKET 5
#define DATAxDPACKET 5
#define DATAxEPACKET 5
#define DATAxFPACKET 5
#define DATA10PACKET 5
#define DATA11PACKET 5
#define DATA12PACKET 5
#define DATA13PACKET 5
#define DATA14PACKET 5
#define DATA15PACKET 5
#define DATA16PACKET 5
#define DATA17PACKET 5
#define DATA18PACKET 5
#define DATA19PACKET (2+6)
#define DATA1APACKET (6*2+4+6)
#define DATA1BPACKET (2+SIZE_N_LOADER+6)
#define ADDRESS_PACK1B (2+SIZE_N_LOADER+6)
#define ADDRESS_PACK1B_DATA (SIZE_N_LOADER+6)
#define DATA1CPACKET (2+6)
#define ADDRESS_PACK1C (2+6)
#define DATA1DPACKET 5
#define DATA1EPACKET 5
#define DATA1FPACKET 5
#define DATA20PACKET (2+6)
#define ADDRESS_PACK20 (2+6)
#define DATA21PACKET (2+SIZE_N_LOADER+6)
#define ADDRESS_PACK21 (2+SIZE_N_LOADER+6)
#define ADDRESS_PACK21_DATA (SIZE_N_LOADER+6)
#define DATA22PACKET 5
#define DATA23PACKET 5
#define DATA24PACKET 5
#define DATA25PACKET (2+SIZE_N_LOADER+6)
#define ADDRESS_PACK25 (2+SIZE_N_LOADER+6)
#define ADDRESS_PACK25_DATA (SIZE_N_LOADER+6)
#define DATA26PACKET 5
#define DATA27PACKET (4+6)
#ifdef STEND
#if DATAxAPACKET>=MAXPACKETLEN
error size of fifo packets MAXPACKETLEN
#endif
#endif
//ñòàòèñòèêà
#define STAT_FIFO_RCV_LEN 8 /* size of fifo STAT buffer */
#define STAT1_FIFO_RCV_LEN 8 /* size of fifo STAT buffer */
#define SIZE_STAT 9
#define SIZE_STAT1 10