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_platform_if.h"
9
10 #define HDF_LOG_TAG HDF_AUDIO_KADM
11
AudioDmaBufAlloc(struct PlatformData * data,enum AudioStreamType streamType)12 int32_t AudioDmaBufAlloc(struct PlatformData *data, enum AudioStreamType streamType)
13 {
14 if (data != NULL && data->ops != NULL && data->ops->DmaBufAlloc != NULL) {
15 return data->ops->DmaBufAlloc(data, streamType);
16 }
17 return HDF_FAILURE;
18 }
19
AudioDmaBufFree(struct PlatformData * data,enum AudioStreamType streamType)20 int32_t AudioDmaBufFree(struct PlatformData *data, enum AudioStreamType streamType)
21 {
22 if (data != NULL && data->ops != NULL && data->ops->DmaBufFree != NULL) {
23 return data->ops->DmaBufFree(data, streamType);
24 }
25 return HDF_FAILURE;
26 }
27
AudioDmaRequestChannel(struct PlatformData * data,enum AudioStreamType streamType)28 int32_t AudioDmaRequestChannel(struct PlatformData *data, enum AudioStreamType streamType)
29 {
30 if (data != NULL && data->ops != NULL && data->ops->DmaRequestChannel != NULL) {
31 return data->ops->DmaRequestChannel(data, streamType);
32 }
33 return HDF_FAILURE;
34 }
35
AudioDmaConfigChannel(struct PlatformData * data,enum AudioStreamType streamType)36 int32_t AudioDmaConfigChannel(struct PlatformData *data, enum AudioStreamType streamType)
37 {
38 if (data != NULL && data->ops != NULL && data->ops->DmaConfigChannel != NULL) {
39 return data->ops->DmaConfigChannel(data, streamType);
40 }
41 return HDF_FAILURE;
42 }
43
AudioDmaPrep(struct PlatformData * data,enum AudioStreamType streamType)44 int32_t AudioDmaPrep(struct PlatformData *data, enum AudioStreamType streamType)
45 {
46 if (data != NULL && data->ops != NULL && data->ops->DmaPrep != NULL) {
47 return data->ops->DmaPrep(data, streamType);
48 }
49 return HDF_FAILURE;
50 }
51
AudioDmaSubmit(struct PlatformData * data,enum AudioStreamType streamType)52 int32_t AudioDmaSubmit(struct PlatformData *data, enum AudioStreamType streamType)
53 {
54 if (data != NULL && data->ops != NULL && data->ops->DmaSubmit != NULL) {
55 return data->ops->DmaSubmit(data, streamType);
56 }
57 return HDF_FAILURE;
58 }
59
AudioDmaPending(struct PlatformData * data,enum AudioStreamType streamType)60 int32_t AudioDmaPending(struct PlatformData *data, enum AudioStreamType streamType)
61 {
62 if (data != NULL && data->ops != NULL && data->ops->DmaPending != NULL) {
63 return data->ops->DmaPending(data, streamType);
64 }
65 return HDF_FAILURE;
66 }
67
AudioDmaPause(struct PlatformData * data,enum AudioStreamType streamType)68 int32_t AudioDmaPause(struct PlatformData *data, enum AudioStreamType streamType)
69 {
70 if (data != NULL && data->ops != NULL && data->ops->DmaPause != NULL) {
71 return data->ops->DmaPause(data, streamType);
72 }
73 return HDF_FAILURE;
74 }
75
AudioDmaResume(struct PlatformData * data,enum AudioStreamType streamType)76 int32_t AudioDmaResume(struct PlatformData *data, enum AudioStreamType streamType)
77 {
78 if (data != NULL && data->ops != NULL && data->ops->DmaResume != NULL) {
79 return data->ops->DmaResume(data, streamType);
80 }
81 return HDF_FAILURE;
82 }
83
AudioDmaPointer(struct PlatformData * data,enum AudioStreamType streamType,uint32_t * pointer)84 int32_t AudioDmaPointer(struct PlatformData *data, enum AudioStreamType streamType, uint32_t *pointer)
85 {
86 if (data != NULL && data->ops != NULL && data->ops->DmaPointer != NULL) {
87 return data->ops->DmaPointer(data, streamType, pointer);
88 }
89 return HDF_FAILURE;
90 }
91