[Feature][task-view-306]merge P56U08(patch6) version
Only Configure: No
Affected branch: master
Affected module: unknow
Is it affected on both ZXIC and MTK: only ZXIC
Self-test: Yes
Doc Update: No
Change-Id: I8e809511ac30c97228dd110c304b4a08f4af36d7
diff --git a/ap/lib/libvoice/Makefile b/ap/lib/libvoice/Makefile
index 7d677fb..48061f2 100755
--- a/ap/lib/libvoice/Makefile
+++ b/ap/lib/libvoice/Makefile
@@ -25,11 +25,14 @@
LIB_STATIC = libvoice.a
ifeq ($(USE_VOICE_ALSA),yes)
OBJS = voice.o alsa_call.o voice_api.o voiceipc.o
-else ifeq ($(USE_VOICE_BUFFER_IN_AP),yes)
-OBJS = voice.o voice_buffer.o
+
else
OBJS = voice.o
endif
+
+ifeq ($(USE_VOICE_BUFFER_IN_AP),yes)
+OBJS += voice_buffer.o
+endif
CFLAGS += -g
LDFLAGS += -lpthread
diff --git a/ap/lib/libvoice/include/voice_lib.h b/ap/lib/libvoice/include/voice_lib.h
index 4023dc3..2238b6b 100755
--- a/ap/lib/libvoice/include/voice_lib.h
+++ b/ap/lib/libvoice/include/voice_lib.h
@@ -55,6 +55,10 @@
int voice_Vploop(int *path);
int zDrvVolte_PreOpen(T_ZDrvVolte_Cfg *cfgParam);
void zDrvVolte_PreClose(void);
+ int voice_SetVoiceProcess(int *vp);
+ int voice_GetVoiceProcess(void);
+
+
#ifdef _VBUFF_IN_SINGLE_CORE
int vbuffer_stream_start(void);
diff --git a/ap/lib/libvoice/voice.c b/ap/lib/libvoice/voice.c
index 61b9c1e..6af0fa6 100755
--- a/ap/lib/libvoice/voice.c
+++ b/ap/lib/libvoice/voice.c
@@ -167,7 +167,7 @@
}
ret = ioctl(fd, VOICE_IOCTL_VPLOOP, path);
if (ret) {
- printf("voice_Vploop: ret=%d,path=%p.\n", ret, path);
+ printf("voice_Vploop: ret=%d,path=%d.\n", ret, *path);
close(fd);
return -1;
}
@@ -224,18 +224,20 @@
}
}
#if defined(_VBUFF_IN_SINGLE_CORE) || defined(_VBUFF_IN_MULTI_CORE)
- printf("%s: use voice buffer,return!\n",__func__);
+ printf("%s: ap use voice buffer,return!\n",__func__);
return 0;
#endif
#if defined(_ALSA_CODEC_IN_CAP) && defined(_USE_ALSA_AT_INTF)
+ printf("%s:_ALSA_CODEC_IN_CAP and at intf!\n",__func__);
- printf("%s: i2s and codec not need config,return!\n",__func__);
+ printf("%s:ap i2s and codec not need config,return!\n",__func__);
return 0;
#elif defined(_ALSA_CODEC_IN_CAP)
+ printf("%s:_ALSA_CODEC_IN_CAP!\n",__func__);
if(cfgParam->clock_rate == 8000){
@@ -261,6 +263,7 @@
#endif
+ printf("%s:ap do mixer and pcm opt!\n",__func__);
//open mixer dev for codec control
voice_mixer = mixer_open(0);
@@ -390,6 +393,93 @@
}
+int voice_SetVoiceProcess(int *vp)
+{
+ int ret = 0;
+ int fd = -1;
+ printf("%s: start vp=%d!\n",__func__,*vp);
+ fd = open(VOICE_DEV_NAME, O_RDONLY);
+ if (fd < 0) {
+ printf("%s: open voice device error.\n",__func__);
+ return -1;
+ }
+ ret = ioctl(fd, VOICE_IOCTL_SET_VP, vp);
+ if (ret) {
+ printf("%s: ret=%d,vp=%d.\n",__func__, ret, *vp);
+ close(fd);
+ return -1;
+ }
+ close(fd);
+ return 0;
+
+}
+int voice_GetVoiceProcess(void)
+{
+ int ret = 0;
+ int fd = -1;
+ int vp = 0;
+ fd = open(VOICE_DEV_NAME, O_RDONLY);
+ if (fd < 0) {
+ printf("%s: open voice device error.\n",__func__);
+ return -1;
+ }
+ ret = ioctl(fd, VOICE_IOCTL_GET_VP, &vp);
+ if (ret) {
+ printf("%s: ret=%d,vp=%d.\n",__func__, ret, vp);
+ close(fd);
+ return -1;
+ }
+ close(fd);
+ printf("%s: vp=%d!\n",__func__,vp);
+
+ return vp;
+
+}
+
+int voice_SetVoiceBuffer(T_VoiceBuf_Para *vb)
+{
+ int ret = 0;
+ int fd = -1;
+ printf("%s: start enable=%d,type=%d!\n",__func__,vb->enable,vb->type);
+ fd = open(VOICE_DEV_NAME, O_RDONLY);
+ if (fd < 0) {
+ printf("%s: open voice device error.\n",__func__);
+ return -1;
+ }
+ ret = ioctl(fd, VOICE_IOCTL_SET_VBUF, vb);
+ if (ret) {
+ printf("%s: ret=%d.\n",__func__, ret);
+ close(fd);
+ return -1;
+ }
+ close(fd);
+ return 0;
+
+}
+
+int voice_GetVoiceBuffer(T_VoiceBuf_Para *vb)
+{
+ int ret = 0;
+ int fd = -1;
+ fd = open(VOICE_DEV_NAME, O_RDONLY);
+ if (fd < 0) {
+ printf("%s: open voice device error.\n",__func__);
+ return -1;
+ }
+ ret = ioctl(fd, VOICE_IOCTL_GET_VBUF, vb);
+ if (ret) {
+ printf("%s: ret=%d.\n",__func__, ret);
+ close(fd);
+ return -1;
+ }
+ close(fd);
+ printf("%s: start fs=%d enable=%d,type=%d!\n",__func__,vb->fs,vb->enable,vb->type);
+
+
+ return ret;
+
+}
+