• 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 #include "audio_sapm_test.h"
9 #include "audio_sapm.h"
10 
11 #define HDF_LOG_TAG audio_host_test
12 
AudioSapmNewComponentsTest(void)13 int32_t AudioSapmNewComponentsTest(void)
14 {
15     struct AudioCard *audioCard = NULL;
16     struct AudioSapmComponent *component = NULL;
17     int32_t maxNum = 0;
18     int32_t ret;
19     HDF_LOGI("%s: enter", __func__);
20 
21     ret = AudioSapmNewComponents(audioCard, component, maxNum);
22     if (ret != HDF_SUCCESS) {
23         HDF_LOGE("%s: audioCart or component is NULL", __func__);
24     }
25 
26     HDF_LOGI("%s: success", __func__);
27     return HDF_SUCCESS;
28 }
29 
AudioSapmAddRoutesTest(void)30 int32_t AudioSapmAddRoutesTest(void)
31 {
32     struct AudioCard *audioCard = NULL;
33     struct AudioSapmRoute *route = NULL;
34     int32_t routeMaxNum = 0;
35     int32_t ret;
36     HDF_LOGI("%s: enter", __func__);
37 
38     ret = AudioSapmAddRoutes(audioCard, route, routeMaxNum);
39     if (ret != HDF_SUCCESS) {
40         HDF_LOGE("%s: audioCard or route is NULL", __func__);
41     }
42 
43     HDF_LOGI("%s: success", __func__);
44     return HDF_SUCCESS;
45 }
46 
AudioSapmNewControlsTest(void)47 int32_t AudioSapmNewControlsTest(void)
48 {
49     struct AudioCard *audioCard = NULL;
50     int32_t ret;
51     HDF_LOGI("%s: enter", __func__);
52 
53     ret = AudioSapmNewControls(audioCard);
54     if (ret != HDF_SUCCESS) {
55         HDF_LOGE("%s: audioCard is NULL", __func__);
56     }
57 
58     HDF_LOGI("%s: success", __func__);
59     return HDF_SUCCESS;
60 }
AudioSapmSleepTest(void)61 int32_t AudioSapmSleepTest(void)
62 {
63     struct AudioCard *audioCard = NULL;
64     int32_t ret;
65     HDF_LOGI("%s: enter", __func__);
66 
67     ret = AudioSapmSleep(audioCard);
68     if (ret != HDF_SUCCESS) {
69         HDF_LOGE("%s: AudioSapmSleep is NULL", __func__);
70     }
71 
72     HDF_LOGI("%s: success", __func__);
73     return HDF_SUCCESS;
74 }
75 
AudioSampPowerUpTest(void)76 int32_t AudioSampPowerUpTest(void)
77 {
78     struct AudioCard *audioCard = NULL;
79     int32_t ret;
80     HDF_LOGI("%s: enter", __func__);
81 
82     ret = AudioSampPowerUp(audioCard);
83     if (ret != HDF_SUCCESS) {
84         HDF_LOGE("%s: AudioSampPowerUp is NULL", __func__);
85     }
86 
87     HDF_LOGI("%s: success", __func__);
88     return HDF_SUCCESS;
89 }
90 
AudioSampSetPowerMonitorTest(void)91 int32_t AudioSampSetPowerMonitorTest(void)
92 {
93     struct AudioCard *audioCard = NULL;
94     int32_t ret;
95     HDF_LOGI("%s: enter", __func__);
96 
97     ret = AudioSampSetPowerMonitor(audioCard, 0);
98     if (ret != HDF_SUCCESS) {
99         HDF_LOGE("%s: AudioSampSetPowerMonitor is NULL", __func__);
100     }
101 
102     HDF_LOGI("%s: success", __func__);
103     return HDF_SUCCESS;
104 }
105 
AudioCodecSapmSetCtrlOpsTest(void)106 int32_t AudioCodecSapmSetCtrlOpsTest(void)
107 {
108     int32_t ret;
109     struct AudioKcontrol *kcontrol = NULL;
110     struct AudioCtrlElemValue *elemValue = NULL;
111     HDF_LOGI("%s: enter", __func__);
112 
113     ret = AudioCodecSapmSetCtrlOps(kcontrol, elemValue);
114     if (ret != HDF_SUCCESS) {
115         HDF_LOGE("%s: AudioCodecSapmSetCtrlOps is NULL", __func__);
116     }
117 
118     HDF_LOGI("%s: success", __func__);
119     return HDF_SUCCESS;
120 }
121 
AudioCodecSapmGetCtrlOpsTest(void)122 int32_t AudioCodecSapmGetCtrlOpsTest(void)
123 {
124     int32_t ret;
125     struct AudioKcontrol *kcontrol = NULL;
126     struct AudioCtrlElemValue *elemValue = NULL;
127     HDF_LOGI("%s: enter", __func__);
128 
129     ret = AudioCodecSapmGetCtrlOps(kcontrol, elemValue);
130     if (ret != HDF_SUCCESS) {
131         HDF_LOGE("%s: AudioCodecSapmGetCtrlOps is NULL", __func__);
132     }
133 
134     HDF_LOGI("%s: success", __func__);
135     return HDF_SUCCESS;
136 }
137 
AudioAccessorySapmSetCtrlOpsTest(void)138 int32_t AudioAccessorySapmSetCtrlOpsTest(void)
139 {
140     int32_t ret;
141     struct AudioKcontrol *kcontrol = NULL;
142     struct AudioCtrlElemValue *elemValue = NULL;
143     HDF_LOGI("%s: enter", __func__);
144 
145     ret = AudioAccessorySapmSetCtrlOps(kcontrol, elemValue);
146     if (ret != HDF_SUCCESS) {
147         HDF_LOGE("%s: AudioAccessorySapmSetCtrlOps is NULL", __func__);
148     }
149 
150     HDF_LOGI("%s: success", __func__);
151     return HDF_SUCCESS;
152 }
153 
AudioAccessorySapmGetCtrlOpsTest(void)154 int32_t AudioAccessorySapmGetCtrlOpsTest(void)
155 {
156     int32_t ret;
157     struct AudioKcontrol *kcontrol = NULL;
158     struct AudioCtrlElemValue *elemValue = NULL;
159     HDF_LOGI("%s: enter", __func__);
160 
161     ret = AudioAccessorySapmGetCtrlOps(kcontrol, elemValue);
162     if (ret != HDF_SUCCESS) {
163         HDF_LOGE("%s: AudioAccessorySapmGetCtrlOps is NULL", __func__);
164     }
165 
166     HDF_LOGI("%s: success", __func__);
167     return HDF_SUCCESS;
168 }
169