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