/* * protocol.h * * Created on: 2025Äê7ÔÂ17ÈÕ * Author: 86189 */ #ifndef PROTOCOL_H_ #define PROTOCOL_H_ #include #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; // include analog + usb channel 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_ */