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
| /*
| * protocol.h
| *
| * Created on: 2025Äê7ÔÂ17ÈÕ
| * Author: 86189
| */
|
| #ifndef PROTOCOL_H_
| #define PROTOCOL_H_
|
| #include <string>
| #include "config.h"
|
| #define MSG_DATA_LEN (SPI_BUFFER_SIZE-16)
| #define MLEN(pmsg) ((pmsg)->dataLen+16)
|
| //match with NLP.
| enum MsgType{
| MSG_PARAM_CONFIG=0x11,
|
| // data ÀïÃæ0ÊÇ´¦ÀíÆ÷ID£¬1¿ØÖÆÀàÐÍ£¬2£¬3¿ØÖÆÊý¾Ý
| MSG_PARAM_CTRL=0x21,
|
| MSG_PARAM_COMPLETED=0x30, //²ÎÊýÅäÖÃÍê³É
|
| MSG_ACK_REQ =0x19, //Æô¶¯ÎÕÊÖÃüÁî
|
| MSG_GET_LEVEL=0xaa,
|
| MSG_CHANNEL_COPY_REQ=0x50,
|
| MSG_DSP_DEBUG =0xfe,
|
| MSG_DSP_STATUS_REPORT =0x65,
|
| MSG_DSP_STATUS_REQ =0x72,
| MSG_DSP_STATUS_RES,
| };
|
|
|
| class MSG{
| public:
| unsigned short magic;
| unsigned short dataLen;
| unsigned short totalPkts;
| unsigned short pktNo;
| unsigned char msgType;
| unsigned char checksum;
| unsigned char result;
| unsigned char subType;
| unsigned int msgID;
| char data[MSG_DATA_LEN];
|
| inline int Enc(MsgType msg_type, void* buffer, uint32_t len)
| {
| magic = 0x5aa5;
| msgType = msg_type;
| dataLen = len;
| if (buffer != 0 && len > 0) {
| memcpy(data, buffer, len);
| }
| return 0;
| }
| MSG& operator=(const MSG& m){
| if(this != &m) {
| memcpy(this, &m , MLEN(&m));
| }
| return *this;
| }
|
| };
|
| struct ParamCtrl {
| unsigned short mid; //Ä£¿éID
| unsigned short cmd;
| //short val[4];
| };
|
| typedef struct{
| short dual_dsp;
| short dsp_index;
| short local_rx_num;
| short local_tx_num;
| short dante_rx_num;
| short dante_tx_num;
|
| short external_clock;
| short scene_size ; //dsp reply
| short level_num;
| short modulelist;
| short hardware_type;
| }tag_device_config,*ptag_device_config;
|
| enum PRESET_STA{
| PRESET_NONE,
| PRESET_DONE,
| PRESET_NORMAL,
| PRESET_ERR,
| };
|
|
| enum DSPStatus{
| dsp_unknow,
| dsp_running_ok,
| dsp_no_clock,
| dsp_mem_err,
| dsp_halt,
| };
|
|
| #endif /* PROTOCOL_H_ */
|
|