• 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 "audio_host_test.h"
10 #include "audio_host.h"
11 #include "devsvc_manager_clnt.h"
12 
13 #define HDF_LOG_TAG audio_host_test
14 
15 const static char *g_audioServiceName[] = {
16     "codec_service_0",
17     "codec_service_1",
18     "dma_service_0",
19     "dai_service",
20     "audio_service_0",
21     "audio_service_1",
22     "render_service",
23     "capture_service",
24     "control_service",
25 };
26 
AudioHostCreateAndBindTest(void)27 int32_t AudioHostCreateAndBindTest(void)
28 {
29     int i;
30     struct HdfDeviceObject *device = NULL;
31     HDF_LOGI("%s: enter", __func__);
32 
33     if (AudioHostCreateAndBind(NULL) != NULL) {
34         HDF_LOGE("%s_[%d] codecDevice is not NULL", __func__, __LINE__);
35         return HDF_FAILURE;
36     }
37 
38     for (i = 0; i < sizeof(g_audioServiceName) / sizeof(g_audioServiceName[0]); ++i) {
39         device = DevSvcManagerClntGetDeviceObject(g_audioServiceName[i]);
40         if (AudioHostCreateAndBind(device) == NULL) {
41             HDF_LOGE("audiohost:%s create and bind fail!", g_audioServiceName[i]);
42         }
43     }
44 
45     HDF_LOGI("%s: success", __func__);
46     return HDF_SUCCESS;
47 }
48 
GetCardInstanceTest(void)49 int32_t GetCardInstanceTest(void)
50 {
51     int i;
52     HDF_LOGI("%s: enter", __func__);
53 
54     for (i = 0; i < sizeof(g_audioServiceName) / sizeof(g_audioServiceName[0]); ++i) {
55         if (GetCardInstance(g_audioServiceName[i]) == NULL) {
56             HDF_LOGE("%s: get %s fail!", __func__, g_audioServiceName[i]);
57         }
58     }
59 
60     HDF_LOGI("%s: success", __func__);
61     return HDF_SUCCESS;
62 }
63