• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  *
4  * HDF is dual licensed: you can use it either under the terms of
5  * the GPL, or the BSD license, at your option.
6  * See the LICENSE file in the root of this repository for complete details.
7  */
8 
9 #include "hi3516_codec_impl_test.h"
10 #include "audio_codec_if.h"
11 #include "hdf_base.h"
12 #include "hdf_log.h"
13 #include "hdf_types.h"
14 #include "hi3516_codec_impl.h"
15 
16 #define HDF_LOG_TAG hi3516_codec_impl_test
17 
TestCodecHalSysInit(void)18 int32_t TestCodecHalSysInit(void)
19 {
20     int ret;
21     struct CodecData codeData;
22 
23     HDF_LOGI("%s: enter", __func__);
24     ret = CodecHalSysInit(&codeData);
25 
26     HDF_LOGI("%s: success", __func__);
27     return HDF_SUCCESS;
28 }
29 
TestCodecRegBitsRead(void)30 int32_t TestCodecRegBitsRead(void)
31 {
32     struct AudioMixerControl *regAttr = NULL;
33     uint32_t regValue;
34     int ret;
35     HDF_LOGI("%s: enter", __func__);
36 
37     ret = CodecRegBitsRead(regAttr, &regValue);
38 
39     HDF_LOGI("%s: success", __func__);
40     return HDF_SUCCESS;
41 }
42 
CodecRegBitsUpdateMock(struct AudioMixerControl regAttr)43 static int32_t CodecRegBitsUpdateMock(struct AudioMixerControl regAttr)
44 {
45     HDF_LOGI("%s: success", __func__);
46     return HDF_SUCCESS;
47 }
48 
TestCodecRegBitsUpdate(void)49 int32_t TestCodecRegBitsUpdate(void)
50 {
51     struct AudioMixerControl regAttr;
52     int ret;
53     HDF_LOGI("%s: enter", __func__);
54     regAttr.reg = -1; // -1 is bad value
55     ret = CodecRegBitsUpdateMock(regAttr);
56 
57     HDF_LOGI("%s: success", __func__);
58     return HDF_SUCCESS;
59 }
60 
TestCodecRegDefaultInit(void)61 int32_t TestCodecRegDefaultInit(void)
62 {
63     struct AudioRegCfgGroupNode **regCfgGroup = NULL;
64     int ret;
65     HDF_LOGI("%s: enter", __func__);
66 
67     ret = CodecRegDefaultInit(regCfgGroup);
68 
69     HDF_LOGI("%s: success", __func__);
70     return HDF_SUCCESS;
71 }
72 
TestCodecSetAdcTuneEnable(void)73 int32_t TestCodecSetAdcTuneEnable(void)
74 {
75     struct AudioRegCfgGroupNode **regCfgGroup = NULL;
76     int ret;
77     HDF_LOGI("%s: enter", __func__);
78 
79     ret = CodecSetAdcTuneEnable(regCfgGroup);
80 
81     HDF_LOGI("%s: success", __func__);
82     return HDF_SUCCESS;
83 }
84 
TestCodecDaiParamsUpdate(void)85 int32_t TestCodecDaiParamsUpdate(void)
86 {
87     struct AudioRegCfgGroupNode **regCfgGroup = NULL;
88     struct CodecDaiParamsVal codecDaiParamsVal;
89     int ret;
90     HDF_LOGI("%s: enter", __func__);
91 
92     codecDaiParamsVal.channelVal = 1; // 1 is dam channel
93     ret = CodecDaiParamsUpdate(regCfgGroup, codecDaiParamsVal);
94 
95     HDF_LOGI("%s: success", __func__);
96     return HDF_SUCCESS;
97 }
98 
TestAudioCodecAiaoSetCtrlOps(void)99 int32_t TestAudioCodecAiaoSetCtrlOps(void)
100 {
101     struct AudioKcontrol *kcontrol = NULL;
102     struct AudioCtrlElemValue *elemValue = NULL;
103     int ret;
104     HDF_LOGI("%s: enter", __func__);
105 
106     ret = AudioCodecAiaoSetCtrlOps(kcontrol, elemValue);
107 
108     HDF_LOGI("%s: success", __func__);
109     return HDF_SUCCESS;
110 }
111 
TestAudioCodecAiaoGetCtrlOps(void)112 int32_t TestAudioCodecAiaoGetCtrlOps(void)
113 {
114     struct AudioKcontrol *kcontrol = NULL;
115     struct AudioCtrlElemValue *elemValue = NULL;
116     int ret;
117     HDF_LOGI("%s: enter", __func__);
118 
119     ret = AudioCodecAiaoGetCtrlOps(kcontrol, elemValue);
120 
121     HDF_LOGI("%s: success", __func__);
122     return HDF_SUCCESS;
123 }
124