blob: befbcf496b952d93d3f460873367ab93f5127d93 [file] [log] [blame]
/******************************************************************************
*(C) Copyright 2014 Marvell International Ltd.
* All Rights Reserved
******************************************************************************/
/* -------------------------------------------------------------------------------------------------------------------
*
* Filename: audio_if_api.h
*
* Authors: tzahi stern
*
* Description: audio_if api to send commands to audio-HAL and VCM
*
* HISTORY:
*
*
* Notes:
*
******************************************************************************/
#ifndef AUDIO_IF_API_H
#define AUDIO_IF_API_H
#define ID_RIFF 0x46464952
#define ID_WAVE 0x45564157
#define ID_FMT 0x20746d66
#define ID_DATA 0x61746164
struct riff_wave_header {
unsigned int riff_id;
unsigned int riff_sz;
unsigned int wave_id;
};
struct chunk_header {
unsigned int id;
unsigned int sz;
};
struct chunk_fmt {
unsigned short audio_format;
unsigned short num_channels;
unsigned int sample_rate;
unsigned int byte_rate;
unsigned short block_align;
unsigned short bits_per_sample;
};
struct wav_header {
unsigned int riff_id;
unsigned int riff_sz;
unsigned int riff_fmt;
unsigned int fmt_id;
unsigned int fmt_sz;
unsigned short audio_format;
unsigned short num_channels;
unsigned int sample_rate;
unsigned int byte_rate;
unsigned short block_align;
unsigned short bits_per_sample;
unsigned int data_id;
unsigned int data_sz;
};
typedef enum
{
PCM_SWITCH_TYPE_PCM_OFF = 0, /* with slic, off the PCM */
PCM_SWITCH_TYPE_PCM_ON, /* with slic, on the PCM, and NB */
PCM_SWITCH_TYPE_PCM_ON_WB, /* with slic, on the PCM, and WB */
PCM_SWITCH_TYPE_PCM_OFF_WITHOUT_SLIC, /* without slic, off the PCM */
PCM_SWITCH_TYPE_PCM_OFF_WITH_CODEC, /* with codec, Off the PCM */
PCM_SWITCH_TYPE_PCM_ON_WITH_CODEC, /* with codec, On the PCM */
MAX_PCM_SWITCH_TYPE = PCM_SWITCH_TYPE_PCM_ON_WITH_CODEC
} PCM_SWITCH_TYPE;
typedef enum
{
DTMF_DETECTION_TX_OFF = 0, /* OFF TX DTMF DETECTION */
DTMF_DETECTION_TX_ON, /* ON TX DTMF DETECTION */
DTMF_DETECTION_RX_OFF, /* OFF RX DTMF DETECTION */
DTMF_DETECTION_RX_ON, /* ON RX DTMF DETECTION */
} DTMF_DETECTION_TYPE;
#define UNUSEDPARAM(param) (void)param;
#define UNUSEDFUNC(func) (void)&func;
/**************** functions for methods invokation ************/
int audio_if_audio_mode_set(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_audio_mode_status(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_audio_device_set(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_audio_device_status(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_tty_set(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_volume_set(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_volume_status(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_mute_set(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_mute_status(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
/* eCall control */
int audio_if_ecall_data_set(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_ecall_data_status(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_ecall_voice_set(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_ecall_voice_status(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
void audio_if_ecall_data_status_response(void * p_atc_ecall_msg);
void audio_if_ecall_voice_status_response(void * p_atc_ecall_msg);
int audio_if_switch_pcm(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
/* CP audio path control (play/rec/loopback) */
int audio_if_vcm_rec_start(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_vcm_rec_stop(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_vcm_play_start(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_vcm_play_stop(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_cp_loopback_enable(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_cp_loopback_disable(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_vcm_configure(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_DTMFDetection(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_pcmloopback_start(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_pcmloopback_stop(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_config_pcm(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_config_dspgain(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_config_pcmexpert(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_DTMFControl(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_report_voice_status(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_reload_nvm(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_config_pa(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
#ifdef TARGET_mmp_asr1901_KSTR901
int audio_if_adsp_set(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_adsp_send_ve(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
int audio_if_adsp_dump_full_ddr(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg);
#endif
#endif //AUDIO_IF_API_H