blob: c8297a09f397dd26e11c722b722e8da56209d9b5 [file] [log] [blame]
xf.libdd93d52023-05-12 07:10:14 -07001#ifdef USE_CAP_SUPPORT
xf.li742dd022023-06-08 01:43:32 -07002#include "message.h"
xf.libdd93d52023-05-12 07:10:14 -07003
4#define VOICEIPC_OK 0
5#define VOICEIPC_ERROR -1
6#define VOICE_WAIT_MSG_FROM_CAP -2 //waitting msg from cap
7
8#define VOICE_IPC_CONTROL_CHANNEL "/dev/rpmsg6"
xf.li7ccf8372024-03-07 00:08:02 -08009//#define VOICE_IPC_CONTROL_CHANNEL_SIZE 256
10#define VOICE_IPC_CONTROL_CHANNEL_SIZE (8 * 1024 + 256) //À©´óÒԱ㴫Êävoice_nvrw.bin
xf.libdd93d52023-05-12 07:10:14 -070011
12#define VOICE_HEAD_LEN (2 * sizeof(int))
13#define VOICE_CONTROL_MAX_LEN 32
xf.li7ccf8372024-03-07 00:08:02 -080014#define VOICE_NVRW_MAX_LEN (8 * 1024)
xf.libdd93d52023-05-12 07:10:14 -070015
xf.li742dd022023-06-08 01:43:32 -070016enum voice_ipc_func_type{
xf.libdd93d52023-05-12 07:10:14 -070017 IPC_SET_VOICE_DEVICE_MODE = 0,
18 IPC_GET_VOICE_DEVICE_MODE = 1,
19 IPC_SET_RX_VOICE_VOL = 2,
20 IPC_GET_RX_VOICE_VOL = 3,
21 IPC_SET_TX_VOICE_VOL = 4,
22 IPC_GET_TX_VOICE_VOL = 5,
23 IPC_SET_TX_VOICE_MUTE_STATE = 6,
24 IPC_GET_TX_VOICE_MUTE_STATE = 7,
25 IPC_SET_RX_VOICE_MUTE_STATE = 8,
26 IPC_GET_RX_VOICE_MUTE_STATE = 9,
27 IPC_SET_LOOPBACK_ENABLE_STATE = 10,
28 IPC_GET_LOOPBACK_ENABLE_STATE = 11,
xf.li742dd022023-06-08 01:43:32 -070029 IPC_AP_ALSA_VOICE_OPEN = 12,
30 IPC_AP_ALSA_VOICE_CLOSE = 13,
31 IPC_CAP_ALSA_VOICE_OPEN = 14,
32 IPC_CAP_ALSA_VOICE_CLOSE = 15,
xf.li7ccf8372024-03-07 00:08:02 -080033 IPC_UPDATE_VOICE_NVRW = 16,
xf.lif2330622024-05-15 18:17:18 -070034 IPC_SET_RX_VOICE_VOL_GAIN = 17,
35 IPC_GET_RX_VOICE_VOL_GAIN = 18,
36 IPC_SET_TX_VOICE_VOL_GAIN = 19,
37 IPC_GET_TX_VOICE_VOL_GAIN = 20,
xf.libdd93d52023-05-12 07:10:14 -070038
39 IPC_VOICE_FUNC_MAX
40};
41
xf.li742dd022023-06-08 01:43:32 -070042enum voice_msg_cmd{
43 MSG_CMD_CAP_VALSA_OPEN = MSG_CMD_VOICE_BASE + 0x0, //37070
44 MSG_CMD_CAP_VALSA_CLOSE
45};
46
47typedef struct{
xf.libdd93d52023-05-12 07:10:14 -070048 int func_id;
49 int param_len;
50 unsigned char param[VOICE_CONTROL_MAX_LEN];
51}voice_ipc_control_msg;
52
xf.li742dd022023-06-08 01:43:32 -070053//msg
54int cap_alsa_voice_open(int vmode);
55int cap_alsa_voice_close(int vmode);
56int recv_msg_proc(MSG_BUF msg);
57void recv_cap_voice_alsa(void);
xf.libdd93d52023-05-12 07:10:14 -070058
xf.li742dd022023-06-08 01:43:32 -070059//voice ipc interface
60int voice_ipc_init(void);
61int Voice_Ctrl_Rpmsg_Send(int func_id, int *msg);
62void Voice_Ctrl_Rpmsg_Recv(void);
63void voice_ipc_recv_proc(voice_ipc_control_msg msg);
64
65//send message to cap
66int ipc_cap_alsa_voice_open(int vmode);
67int ipc_cap_alsa_voice_close(int vmode);
68
69//receive message from cap
70void ipc_set_voice_device_mode_rcv(voice_ipc_control_msg msg);
71void ipc_get_voice_device_mode_rcv(voice_ipc_control_msg msg);
72void ipc_set_rx_voice_vol_rcv(voice_ipc_control_msg msg);
73void ipc_get_rx_voice_vol_rcv(voice_ipc_control_msg msg);
xf.lif2330622024-05-15 18:17:18 -070074void ipc_set_rx_voice_vol_gain_rcv(voice_ipc_control_msg msg);
75void ipc_get_rx_voice_vol_gain_rcv(voice_ipc_control_msg msg);
76void ipc_set_tx_voice_vol_gain_rcv(voice_ipc_control_msg msg);
77void ipc_get_tx_voice_vol_gain_rcv(voice_ipc_control_msg msg);
xf.li742dd022023-06-08 01:43:32 -070078void ipc_set_tx_voice_vol_rcv(voice_ipc_control_msg msg);
79void ipc_get_tx_voice_vol_rcv(voice_ipc_control_msg msg);
80void ipc_set_tx_voice_mute_state_rcv(voice_ipc_control_msg msg);
81void ipc_get_tx_voice_mute_state_rcv(voice_ipc_control_msg msg);
82void ipc_set_rx_voice_mute_state_rcv(voice_ipc_control_msg msg);
83void ipc_get_rx_voice_mute_state_rcv(voice_ipc_control_msg msg);
84void ipc_set_loopback_enable_state_rcv(voice_ipc_control_msg msg);
85void ipc_get_loopback_enable_state_rcv(voice_ipc_control_msg msg);
86#ifdef _USE_VOICE_ALSA
87void ipc_ap_alsa_voice_open_rcv(voice_ipc_control_msg msg);
88void ipc_ap_alsa_voice_close_rcv(voice_ipc_control_msg msg);
89#endif
xf.libdd93d52023-05-12 07:10:14 -070090
91#endif