blob: 3b58efb0cc0ed089839ddbbf781dddaefff531d8 [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"
9#define VOICE_IPC_CONTROL_CHANNEL_SIZE 256
10
11#define VOICE_HEAD_LEN (2 * sizeof(int))
12#define VOICE_CONTROL_MAX_LEN 32
13
xf.li742dd022023-06-08 01:43:32 -070014enum voice_ipc_func_type{
xf.libdd93d52023-05-12 07:10:14 -070015 IPC_SET_VOICE_DEVICE_MODE = 0,
16 IPC_GET_VOICE_DEVICE_MODE = 1,
17 IPC_SET_RX_VOICE_VOL = 2,
18 IPC_GET_RX_VOICE_VOL = 3,
19 IPC_SET_TX_VOICE_VOL = 4,
20 IPC_GET_TX_VOICE_VOL = 5,
21 IPC_SET_TX_VOICE_MUTE_STATE = 6,
22 IPC_GET_TX_VOICE_MUTE_STATE = 7,
23 IPC_SET_RX_VOICE_MUTE_STATE = 8,
24 IPC_GET_RX_VOICE_MUTE_STATE = 9,
25 IPC_SET_LOOPBACK_ENABLE_STATE = 10,
26 IPC_GET_LOOPBACK_ENABLE_STATE = 11,
xf.li742dd022023-06-08 01:43:32 -070027 IPC_AP_ALSA_VOICE_OPEN = 12,
28 IPC_AP_ALSA_VOICE_CLOSE = 13,
29 IPC_CAP_ALSA_VOICE_OPEN = 14,
30 IPC_CAP_ALSA_VOICE_CLOSE = 15,
xf.libdd93d52023-05-12 07:10:14 -070031
32 IPC_VOICE_FUNC_MAX
33};
34
xf.li742dd022023-06-08 01:43:32 -070035enum voice_msg_cmd{
36 MSG_CMD_CAP_VALSA_OPEN = MSG_CMD_VOICE_BASE + 0x0, //37070
37 MSG_CMD_CAP_VALSA_CLOSE
38};
39
40typedef struct{
xf.libdd93d52023-05-12 07:10:14 -070041 int func_id;
42 int param_len;
43 unsigned char param[VOICE_CONTROL_MAX_LEN];
44}voice_ipc_control_msg;
45
xf.li742dd022023-06-08 01:43:32 -070046//msg
47int cap_alsa_voice_open(int vmode);
48int cap_alsa_voice_close(int vmode);
49int recv_msg_proc(MSG_BUF msg);
50void recv_cap_voice_alsa(void);
xf.libdd93d52023-05-12 07:10:14 -070051
xf.li742dd022023-06-08 01:43:32 -070052//voice ipc interface
53int voice_ipc_init(void);
54int Voice_Ctrl_Rpmsg_Send(int func_id, int *msg);
55void Voice_Ctrl_Rpmsg_Recv(void);
56void voice_ipc_recv_proc(voice_ipc_control_msg msg);
57
58//send message to cap
59int ipc_cap_alsa_voice_open(int vmode);
60int ipc_cap_alsa_voice_close(int vmode);
61
62//receive message from cap
63void ipc_set_voice_device_mode_rcv(voice_ipc_control_msg msg);
64void ipc_get_voice_device_mode_rcv(voice_ipc_control_msg msg);
65void ipc_set_rx_voice_vol_rcv(voice_ipc_control_msg msg);
66void ipc_get_rx_voice_vol_rcv(voice_ipc_control_msg msg);
67void ipc_set_tx_voice_vol_rcv(voice_ipc_control_msg msg);
68void ipc_get_tx_voice_vol_rcv(voice_ipc_control_msg msg);
69void ipc_set_tx_voice_mute_state_rcv(voice_ipc_control_msg msg);
70void ipc_get_tx_voice_mute_state_rcv(voice_ipc_control_msg msg);
71void ipc_set_rx_voice_mute_state_rcv(voice_ipc_control_msg msg);
72void ipc_get_rx_voice_mute_state_rcv(voice_ipc_control_msg msg);
73void ipc_set_loopback_enable_state_rcv(voice_ipc_control_msg msg);
74void ipc_get_loopback_enable_state_rcv(voice_ipc_control_msg msg);
75#ifdef _USE_VOICE_ALSA
76void ipc_ap_alsa_voice_open_rcv(voice_ipc_control_msg msg);
77void ipc_ap_alsa_voice_close_rcv(voice_ipc_control_msg msg);
78#endif
xf.libdd93d52023-05-12 07:10:14 -070079
80#endif