xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 1 | #ifdef USE_CAP_SUPPORT
|
xf.li | 742dd02 | 2023-06-08 01:43:32 -0700 | [diff] [blame] | 2 | #include "message.h"
|
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 3 |
|
| 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.li | 742dd02 | 2023-06-08 01:43:32 -0700 | [diff] [blame] | 14 | enum voice_ipc_func_type{
|
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 15 | 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.li | 742dd02 | 2023-06-08 01:43:32 -0700 | [diff] [blame] | 27 | 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.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 31 |
|
| 32 | IPC_VOICE_FUNC_MAX
|
| 33 | };
|
| 34 |
|
xf.li | 742dd02 | 2023-06-08 01:43:32 -0700 | [diff] [blame] | 35 | enum voice_msg_cmd{
|
| 36 | MSG_CMD_CAP_VALSA_OPEN = MSG_CMD_VOICE_BASE + 0x0, //37070
|
| 37 | MSG_CMD_CAP_VALSA_CLOSE
|
| 38 | };
|
| 39 |
|
| 40 | typedef struct{
|
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 41 | int func_id;
|
| 42 | int param_len;
|
| 43 | unsigned char param[VOICE_CONTROL_MAX_LEN];
|
| 44 | }voice_ipc_control_msg;
|
| 45 |
|
xf.li | 742dd02 | 2023-06-08 01:43:32 -0700 | [diff] [blame] | 46 | //msg
|
| 47 | int cap_alsa_voice_open(int vmode);
|
| 48 | int cap_alsa_voice_close(int vmode);
|
| 49 | int recv_msg_proc(MSG_BUF msg);
|
| 50 | void recv_cap_voice_alsa(void);
|
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 51 |
|
xf.li | 742dd02 | 2023-06-08 01:43:32 -0700 | [diff] [blame] | 52 | //voice ipc interface
|
| 53 | int voice_ipc_init(void);
|
| 54 | int Voice_Ctrl_Rpmsg_Send(int func_id, int *msg);
|
| 55 | void Voice_Ctrl_Rpmsg_Recv(void);
|
| 56 | void voice_ipc_recv_proc(voice_ipc_control_msg msg);
|
| 57 |
|
| 58 | //send message to cap
|
| 59 | int ipc_cap_alsa_voice_open(int vmode);
|
| 60 | int ipc_cap_alsa_voice_close(int vmode);
|
| 61 |
|
| 62 | //receive message from cap
|
| 63 | void ipc_set_voice_device_mode_rcv(voice_ipc_control_msg msg);
|
| 64 | void ipc_get_voice_device_mode_rcv(voice_ipc_control_msg msg);
|
| 65 | void ipc_set_rx_voice_vol_rcv(voice_ipc_control_msg msg);
|
| 66 | void ipc_get_rx_voice_vol_rcv(voice_ipc_control_msg msg);
|
| 67 | void ipc_set_tx_voice_vol_rcv(voice_ipc_control_msg msg);
|
| 68 | void ipc_get_tx_voice_vol_rcv(voice_ipc_control_msg msg);
|
| 69 | void ipc_set_tx_voice_mute_state_rcv(voice_ipc_control_msg msg);
|
| 70 | void ipc_get_tx_voice_mute_state_rcv(voice_ipc_control_msg msg);
|
| 71 | void ipc_set_rx_voice_mute_state_rcv(voice_ipc_control_msg msg);
|
| 72 | void ipc_get_rx_voice_mute_state_rcv(voice_ipc_control_msg msg);
|
| 73 | void ipc_set_loopback_enable_state_rcv(voice_ipc_control_msg msg);
|
| 74 | void ipc_get_loopback_enable_state_rcv(voice_ipc_control_msg msg);
|
| 75 | #ifdef _USE_VOICE_ALSA
|
| 76 | void ipc_ap_alsa_voice_open_rcv(voice_ipc_control_msg msg);
|
| 77 | void ipc_ap_alsa_voice_close_rcv(voice_ipc_control_msg msg);
|
| 78 | #endif
|
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 79 |
|
| 80 | #endif
|