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"
|
xf.li | 7ccf837 | 2024-03-07 00:08:02 -0800 | [diff] [blame] | 9 | //#define VOICE_IPC_CONTROL_CHANNEL_SIZE 256
|
| 10 | #define VOICE_IPC_CONTROL_CHANNEL_SIZE (8 * 1024 + 256) //À©´óÒԱ㴫Êävoice_nvrw.bin
|
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 11 |
|
| 12 | #define VOICE_HEAD_LEN (2 * sizeof(int))
|
| 13 | #define VOICE_CONTROL_MAX_LEN 32
|
xf.li | 7ccf837 | 2024-03-07 00:08:02 -0800 | [diff] [blame] | 14 | #define VOICE_NVRW_MAX_LEN (8 * 1024)
|
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 15 |
|
xf.li | 742dd02 | 2023-06-08 01:43:32 -0700 | [diff] [blame] | 16 | enum voice_ipc_func_type{
|
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 17 | 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.li | 742dd02 | 2023-06-08 01:43:32 -0700 | [diff] [blame] | 29 | 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.li | 7ccf837 | 2024-03-07 00:08:02 -0800 | [diff] [blame] | 33 | IPC_UPDATE_VOICE_NVRW = 16,
|
xf.li | f233062 | 2024-05-15 18:17:18 -0700 | [diff] [blame^] | 34 | 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.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 38 |
|
| 39 | IPC_VOICE_FUNC_MAX
|
| 40 | };
|
| 41 |
|
xf.li | 742dd02 | 2023-06-08 01:43:32 -0700 | [diff] [blame] | 42 | enum voice_msg_cmd{
|
| 43 | MSG_CMD_CAP_VALSA_OPEN = MSG_CMD_VOICE_BASE + 0x0, //37070
|
| 44 | MSG_CMD_CAP_VALSA_CLOSE
|
| 45 | };
|
| 46 |
|
| 47 | typedef struct{
|
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 48 | int func_id;
|
| 49 | int param_len;
|
| 50 | unsigned char param[VOICE_CONTROL_MAX_LEN];
|
| 51 | }voice_ipc_control_msg;
|
| 52 |
|
xf.li | 742dd02 | 2023-06-08 01:43:32 -0700 | [diff] [blame] | 53 | //msg
|
| 54 | int cap_alsa_voice_open(int vmode);
|
| 55 | int cap_alsa_voice_close(int vmode);
|
| 56 | int recv_msg_proc(MSG_BUF msg);
|
| 57 | void recv_cap_voice_alsa(void);
|
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 58 |
|
xf.li | 742dd02 | 2023-06-08 01:43:32 -0700 | [diff] [blame] | 59 | //voice ipc interface
|
| 60 | int voice_ipc_init(void);
|
| 61 | int Voice_Ctrl_Rpmsg_Send(int func_id, int *msg);
|
| 62 | void Voice_Ctrl_Rpmsg_Recv(void);
|
| 63 | void voice_ipc_recv_proc(voice_ipc_control_msg msg);
|
| 64 |
|
| 65 | //send message to cap
|
| 66 | int ipc_cap_alsa_voice_open(int vmode);
|
| 67 | int ipc_cap_alsa_voice_close(int vmode);
|
| 68 |
|
| 69 | //receive message from cap
|
| 70 | void ipc_set_voice_device_mode_rcv(voice_ipc_control_msg msg);
|
| 71 | void ipc_get_voice_device_mode_rcv(voice_ipc_control_msg msg);
|
| 72 | void ipc_set_rx_voice_vol_rcv(voice_ipc_control_msg msg);
|
| 73 | void ipc_get_rx_voice_vol_rcv(voice_ipc_control_msg msg);
|
xf.li | f233062 | 2024-05-15 18:17:18 -0700 | [diff] [blame^] | 74 | void ipc_set_rx_voice_vol_gain_rcv(voice_ipc_control_msg msg);
|
| 75 | void ipc_get_rx_voice_vol_gain_rcv(voice_ipc_control_msg msg);
|
| 76 | void ipc_set_tx_voice_vol_gain_rcv(voice_ipc_control_msg msg);
|
| 77 | void ipc_get_tx_voice_vol_gain_rcv(voice_ipc_control_msg msg);
|
xf.li | 742dd02 | 2023-06-08 01:43:32 -0700 | [diff] [blame] | 78 | void ipc_set_tx_voice_vol_rcv(voice_ipc_control_msg msg);
|
| 79 | void ipc_get_tx_voice_vol_rcv(voice_ipc_control_msg msg);
|
| 80 | void ipc_set_tx_voice_mute_state_rcv(voice_ipc_control_msg msg);
|
| 81 | void ipc_get_tx_voice_mute_state_rcv(voice_ipc_control_msg msg);
|
| 82 | void ipc_set_rx_voice_mute_state_rcv(voice_ipc_control_msg msg);
|
| 83 | void ipc_get_rx_voice_mute_state_rcv(voice_ipc_control_msg msg);
|
| 84 | void ipc_set_loopback_enable_state_rcv(voice_ipc_control_msg msg);
|
| 85 | void ipc_get_loopback_enable_state_rcv(voice_ipc_control_msg msg);
|
| 86 | #ifdef _USE_VOICE_ALSA
|
| 87 | void ipc_ap_alsa_voice_open_rcv(voice_ipc_control_msg msg);
|
| 88 | void ipc_ap_alsa_voice_close_rcv(voice_ipc_control_msg msg);
|
| 89 | #endif
|
xf.li | bdd93d5 | 2023-05-12 07:10:14 -0700 | [diff] [blame] | 90 |
|
| 91 | #endif
|