blob: befbcf496b952d93d3f460873367ab93f5127d93 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001/******************************************************************************
2*(C) Copyright 2014 Marvell International Ltd.
3* All Rights Reserved
4******************************************************************************/
5/* -------------------------------------------------------------------------------------------------------------------
6 *
7 * Filename: audio_if_api.h
8 *
9 * Authors: tzahi stern
10 *
11 * Description: audio_if api to send commands to audio-HAL and VCM
12 *
13 * HISTORY:
14 *
15 *
16 * Notes:
17 *
18 ******************************************************************************/
19#ifndef AUDIO_IF_API_H
20#define AUDIO_IF_API_H
21
22#define ID_RIFF 0x46464952
23#define ID_WAVE 0x45564157
24#define ID_FMT 0x20746d66
25#define ID_DATA 0x61746164
26
27struct riff_wave_header {
28 unsigned int riff_id;
29 unsigned int riff_sz;
30 unsigned int wave_id;
31};
32
33struct chunk_header {
34 unsigned int id;
35 unsigned int sz;
36};
37
38struct chunk_fmt {
39 unsigned short audio_format;
40 unsigned short num_channels;
41 unsigned int sample_rate;
42 unsigned int byte_rate;
43 unsigned short block_align;
44 unsigned short bits_per_sample;
45};
46
47struct wav_header {
48 unsigned int riff_id;
49 unsigned int riff_sz;
50 unsigned int riff_fmt;
51 unsigned int fmt_id;
52 unsigned int fmt_sz;
53 unsigned short audio_format;
54 unsigned short num_channels;
55 unsigned int sample_rate;
56 unsigned int byte_rate;
57 unsigned short block_align;
58 unsigned short bits_per_sample;
59 unsigned int data_id;
60 unsigned int data_sz;
61};
62
63typedef enum
64{
65 PCM_SWITCH_TYPE_PCM_OFF = 0, /* with slic, off the PCM */
66 PCM_SWITCH_TYPE_PCM_ON, /* with slic, on the PCM, and NB */
67 PCM_SWITCH_TYPE_PCM_ON_WB, /* with slic, on the PCM, and WB */
68 PCM_SWITCH_TYPE_PCM_OFF_WITHOUT_SLIC, /* without slic, off the PCM */
69 PCM_SWITCH_TYPE_PCM_OFF_WITH_CODEC, /* with codec, Off the PCM */
70 PCM_SWITCH_TYPE_PCM_ON_WITH_CODEC, /* with codec, On the PCM */
71
72 MAX_PCM_SWITCH_TYPE = PCM_SWITCH_TYPE_PCM_ON_WITH_CODEC
73} PCM_SWITCH_TYPE;
74
75typedef enum
76{
77 DTMF_DETECTION_TX_OFF = 0, /* OFF TX DTMF DETECTION */
78 DTMF_DETECTION_TX_ON, /* ON TX DTMF DETECTION */
79 DTMF_DETECTION_RX_OFF, /* OFF RX DTMF DETECTION */
80 DTMF_DETECTION_RX_ON, /* ON RX DTMF DETECTION */
81} DTMF_DETECTION_TYPE;
82
83#define UNUSEDPARAM(param) (void)param;
84#define UNUSEDFUNC(func) (void)&func;
85
86/**************** functions for methods invokation ************/
87int audio_if_audio_mode_set(struct ubus_context *ctx, struct ubus_object *obj,
88 struct ubus_request_data *req, const char *method,
89 struct blob_attr *msg);
90int audio_if_audio_mode_status(struct ubus_context *ctx, struct ubus_object *obj,
91 struct ubus_request_data *req, const char *method,
92 struct blob_attr *msg);
93int audio_if_audio_device_set(struct ubus_context *ctx, struct ubus_object *obj,
94 struct ubus_request_data *req, const char *method,
95 struct blob_attr *msg);
96int audio_if_audio_device_status(struct ubus_context *ctx, struct ubus_object *obj,
97 struct ubus_request_data *req, const char *method,
98 struct blob_attr *msg);
99int audio_if_tty_set(struct ubus_context *ctx, struct ubus_object *obj,
100 struct ubus_request_data *req, const char *method,
101 struct blob_attr *msg);
102int audio_if_volume_set(struct ubus_context *ctx, struct ubus_object *obj,
103 struct ubus_request_data *req, const char *method,
104 struct blob_attr *msg);
105int audio_if_volume_status(struct ubus_context *ctx, struct ubus_object *obj,
106 struct ubus_request_data *req, const char *method,
107 struct blob_attr *msg);
108int audio_if_mute_set(struct ubus_context *ctx, struct ubus_object *obj,
109 struct ubus_request_data *req, const char *method,
110 struct blob_attr *msg);
111int audio_if_mute_status(struct ubus_context *ctx, struct ubus_object *obj,
112 struct ubus_request_data *req, const char *method,
113 struct blob_attr *msg);
114
115/* eCall control */
116int audio_if_ecall_data_set(struct ubus_context *ctx, struct ubus_object *obj,
117 struct ubus_request_data *req, const char *method,
118 struct blob_attr *msg);
119int audio_if_ecall_data_status(struct ubus_context *ctx, struct ubus_object *obj,
120 struct ubus_request_data *req, const char *method,
121 struct blob_attr *msg);
122int audio_if_ecall_voice_set(struct ubus_context *ctx, struct ubus_object *obj,
123 struct ubus_request_data *req, const char *method,
124 struct blob_attr *msg);
125int audio_if_ecall_voice_status(struct ubus_context *ctx, struct ubus_object *obj,
126 struct ubus_request_data *req, const char *method,
127 struct blob_attr *msg);
128
129void audio_if_ecall_data_status_response(void * p_atc_ecall_msg);
130void audio_if_ecall_voice_status_response(void * p_atc_ecall_msg);
131
132int audio_if_switch_pcm(struct ubus_context *ctx, struct ubus_object *obj,
133 struct ubus_request_data *req, const char *method,
134 struct blob_attr *msg);
135
136
137/* CP audio path control (play/rec/loopback) */
138int audio_if_vcm_rec_start(struct ubus_context *ctx, struct ubus_object *obj,
139 struct ubus_request_data *req, const char *method,
140 struct blob_attr *msg);
141int audio_if_vcm_rec_stop(struct ubus_context *ctx, struct ubus_object *obj,
142 struct ubus_request_data *req, const char *method,
143 struct blob_attr *msg);
144int audio_if_vcm_play_start(struct ubus_context *ctx, struct ubus_object *obj,
145 struct ubus_request_data *req, const char *method,
146 struct blob_attr *msg);
147int audio_if_vcm_play_stop(struct ubus_context *ctx, struct ubus_object *obj,
148 struct ubus_request_data *req, const char *method,
149 struct blob_attr *msg);
150int audio_if_cp_loopback_enable(struct ubus_context *ctx, struct ubus_object *obj,
151 struct ubus_request_data *req, const char *method,
152 struct blob_attr *msg);
153int audio_if_cp_loopback_disable(struct ubus_context *ctx, struct ubus_object *obj,
154 struct ubus_request_data *req, const char *method,
155 struct blob_attr *msg);
156int audio_if_vcm_configure(struct ubus_context *ctx, struct ubus_object *obj,
157 struct ubus_request_data *req, const char *method,
158 struct blob_attr *msg);
159int audio_if_DTMFDetection(struct ubus_context *ctx, struct ubus_object *obj,
160 struct ubus_request_data *req, const char *method,
161 struct blob_attr *msg);
162
163int audio_if_pcmloopback_start(struct ubus_context *ctx, struct ubus_object *obj,
164 struct ubus_request_data *req, const char *method,
165 struct blob_attr *msg);
166int audio_if_pcmloopback_stop(struct ubus_context *ctx, struct ubus_object *obj,
167 struct ubus_request_data *req, const char *method,
168 struct blob_attr *msg);
169int audio_if_config_pcm(struct ubus_context *ctx, struct ubus_object *obj,
170 struct ubus_request_data *req, const char *method,
171 struct blob_attr *msg);
172int audio_if_config_dspgain(struct ubus_context *ctx, struct ubus_object *obj,
173 struct ubus_request_data *req, const char *method,
174 struct blob_attr *msg);
175int audio_if_config_pcmexpert(struct ubus_context *ctx, struct ubus_object *obj,
176 struct ubus_request_data *req, const char *method,
177 struct blob_attr *msg);
178int audio_if_DTMFControl(struct ubus_context *ctx, struct ubus_object *obj,
179 struct ubus_request_data *req, const char *method,
180 struct blob_attr *msg);
181int audio_if_report_voice_status(struct ubus_context *ctx, struct ubus_object *obj,
182 struct ubus_request_data *req, const char *method,
183 struct blob_attr *msg);
184
185int audio_if_reload_nvm(struct ubus_context *ctx, struct ubus_object *obj,
186 struct ubus_request_data *req, const char *method,
187 struct blob_attr *msg);
188
189int audio_if_config_pa(struct ubus_context *ctx, struct ubus_object *obj,
190 struct ubus_request_data *req, const char *method,
191 struct blob_attr *msg);
192
193#ifdef TARGET_mmp_asr1901_KSTR901
194int audio_if_adsp_set(struct ubus_context *ctx, struct ubus_object *obj,
195 struct ubus_request_data *req, const char *method,
196 struct blob_attr *msg);
197int audio_if_adsp_send_ve(struct ubus_context *ctx, struct ubus_object *obj,
198 struct ubus_request_data *req, const char *method,
199 struct blob_attr *msg);
200int audio_if_adsp_dump_full_ddr(struct ubus_context *ctx, struct ubus_object *obj,
201 struct ubus_request_data *req, const char *method,
202 struct blob_attr *msg);
203#endif
204
205#endif //AUDIO_IF_API_H