CI13LC SDK API手册  2.1.1
本手册用于描述CI13LC SDK各个组件和驱动API
voice_module_uart_protocol.h
浏览该文件的文档.
1 
2 
3 #include <stdint.h>
4 #include <stdbool.h>
5 #include <string.h>
6 
7 
8 #include "ci_uart.h"
9 #include "command_info.h"
10 #include "sdk_default_config.h"
11 #include "system_msg_deal.h"
12 
13 
14 #ifndef _VOICE_MODULE_UART_PROTOCOL_
15 #define _VOICE_MODULE_UART_PROTOCOL_
16 
17 #if 1//(UART_PROTOCOL_VER == 2)
18 
19 #ifdef __cplusplus
20 extern "C"
21 {
22 #endif
23 
31 #define VMUP_PROTOCOL_VERSION 1
33 #define VMUP_PROTOCOL_SUBVERSION 0
35 #define VMUP_PROTOCOL_REVISION 0
37 
39 #define VMUP_MSG_DATA_MAX_SIZE (20)
40 
45 #pragma pack(1)
46 typedef struct
47 {
49  uint16_t header;
51  uint16_t data_length;
53  uint8_t msg_type;
55  uint8_t msg_cmd;
57  uint8_t msg_seq;
59  uint8_t msg_data[VMUP_MSG_DATA_MAX_SIZE];
60  /*uint16_t chksum; send add auto*/
61  /*uint8_t tail; send add auto*/
63 
64 
65 #pragma pack()
66 
67 /*header*/
69 #define VMUP_MSG_HEAD_LOW (0xA5)
70 #define VMUP_MSG_HEAD_HIGH (0xFC)
72 #define VMUP_MSG_HEAD ((VMUP_MSG_HEAD_HIGH<<8)|VMUP_MSG_HEAD_LOW)
74 
75 
76 /*tail*/
78 #define VMUP_MSG_TAIL (0xFB)
79 
80 
81 /*msg_type*/
83 #define VMUP_MSG_TYPE_CMD_UP (0xA0)
84 #define VMUP_MSG_TYPE_CMD_DOWN (0xA1)
86 #define VMUP_MSG_TYPE_ACK (0xA2)
88 #define VMUP_MSG_TYPE_NOTIFY (0xA3)
90 
91 
92 /*msg_cmd*/
94 #define VMUP_MSG_CMD_ASR_RESULT (0x91)
95 #define VMUP_MSG_CMD_PLAY_VOICE (0x92)
97 #define VMUP_MSG_CMD_GET_FLASHUID (0x93)
99 #define VMUP_MSG_CMD_GET_VERSION (0x94)
101 #define VMUP_MSG_CMD_RESET_MODULE (0x95)
103 #define VMUP_MSG_CMD_SET_CONFIG (0x96)
105 //#define VMUP_MSG_CMD_ENTER_OTA_MODE (0x97) //进入升级模式
107 #define VMUP_MSG_CMD_NOTIFY_STATUS (0x9A)
108 #define VMUP_MSG_CMD_ACK_COMMON (0xAA)
110 /* !!! if user want add please add form VMUP_MSG_CMD_USER_START*/
111 // #define VMUP_MSG_CMD_USER_START (0xB0)
112 
113 
114 /*msg_data msg_cmd:VMUP_MSG_CMD_PLAY_VOICE*/
116 #define VMUP_MSG_DATA_PLAY_START (0x80)
117 #define VMUP_MSG_DATA_PLAY_PAUSE (0x81)
119 #define VMUP_MSG_DATA_PLAY_RESUME (0x82)
121 #define VMUP_MSG_DATA_PLAY_STOP (0x83)
123 
125 #define VMUP_MSG_DATA_PLAY_BY_VOICEID (0x90)
126 #define VMUP_MSG_DATA_PLAY_BY_SEMANTIC_ID (0x91)
128 #define VMUP_MSG_DATA_PLAY_BY_CMD_ID (0x92)
130 
131 
132 /*msg_data msg_cmd:VMUP_MSG_CMD_GET_VERSION*/
134 #define VMUP_MSG_DATA_VER_PROTOCOL (0x80)
135 #define VMUP_MSG_DATA_VER_SDK (0x81)
137 #define VMUP_MSG_DATA_VER_ASR (0x82)
139 #define VMUP_MSG_DATA_VER_PREPROCESS (0x83)
141 #define VMUP_MSG_DATA_VER_PLAYER (0x84)
143 #define VMUP_MSG_DATA_VER_APP (0x8A)
145 
146 
147 /*msg_data msg_cmd:VMUP_MSG_CMD_NOTIFY_STATUS*/
149 #define VMUP_MSG_DATA_NOTIFY_POWERON (0xB0)
150 #define VMUP_MSG_DATA_NOTIFY_WAKEUPENTER (0xB1)
152 #define VMUP_MSG_DATA_NOTIFY_WAKEUPEXIT (0xB2)
154 #define VMUP_MSG_DATA_NOTIFY_PLAYSTART (0xB3)
156 #define VMUP_MSG_DATA_NOTIFY_PLAYEND (0xB4)
158 
159 
160 /*msg_data msg_cmd:VMUP_MSG_CMD_SET_CONFIG*/
162 #define VMUP_MSG_CMD_SET_VOLUME (0x80)
163 #define VMUP_MSG_CMD_SET_ENTERWAKEUP (0x81)
165 // #define VMUP_MSG_CMD_SET_PRT_MID_RST (0x82)
167 #define VMUP_MSG_CMD_SET_MUTE (0x83)
168 // #define VMUP_MSG_CMD_SET_NEEDACK (0x90)
169 // #define VMUP_MSG_CMD_SET_NEEDSTRING (0x91)
170 
171 
172 /*ACK error code*/
174 #define VMUP_MSG_ACK_ERR_NONE (0x0)
175 // #define VMUP_MSG_ACK_ERR_CHECKSUM (0xff)
177 #define VMUP_MSG_ACK_ERR_NOSUPPORT (0xfe)
178 
184 void vmup_receive_packet(uint8_t receive_char);
185 
190 void vmup_communicate_init(void);
191 
197 void vmup_send_notify(uint8_t notify_event);
209 void userapp_deal_com_msg(sys_msg_t *sys_msg);
210 // void userapp_send_com_test(void);
211 
218 void vmup_send_asr_result_cmd(cmd_handle_t cmd_handle, uint8_t asr_score);
219 
220 void send_baudrate_sync_req(void);
221 
224 #ifdef __cplusplus
225 }
226 #endif
227 
228 #endif //#if (UART_PROTOCOL_VER == 2)
229 
230 #endif
231 
uint8_t msg_seq
协议序列号
Definition: voice_module_uart_protocol.h:57
uint16_t data_length
数据长度
Definition: voice_module_uart_protocol.h:51
#define VMUP_MSG_DATA_MAX_SIZE
协议数据最大长度,可配置
Definition: voice_module_uart_protocol.h:39
void vmup_send_asr_result_cmd(cmd_handle_t cmd_handle, uint8_t asr_score)
报告语音识别结果
Definition: voice_module_uart_protocol.c:467
void send_baudrate_sync_req(void)
uint16_t header
协议头
Definition: voice_module_uart_protocol.h:49
此模块用于查询和读取命令词信息(来源于命令词信息excel表格).
uint8_t msg_type
协议类型
Definition: voice_module_uart_protocol.h:53
UART驱动文件
void vmup_send_notify(uint8_t notify_event)
发送通知类协议
Definition: voice_module_uart_protocol.c:436
uint8_t msg_cmd
协议命令
Definition: voice_module_uart_protocol.h:55
void userapp_deal_com_msg(sys_msg_t *sys_msg)
用户层解析RX接收到的协议,根据协议类型分开处理
Definition: voice_module_uart_protocol.c:829
void vmup_communicate_init(void)
2代串口协议初始化
Definition: voice_module_uart_protocol.c:418
void userapp_deal_cmd(com_msg_data_t *msg)
根据协议命令控制不同的功能
Definition: voice_module_uart_protocol.c:675
void vmup_receive_packet(uint8_t receive_char)
串口RX中断接收协议,发送到消息处理任务
Definition: voice_module_uart_protocol.c:225
void * cmd_handle_t
定义命令词信息结构的句柄类型。
Definition: command_info_v2.h:54
sdk配置文件
2代串口协议结构体定义
Definition: voice_module_uart_protocol.h:46