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 #ifndef AUDIO_STREAM_DISP_H
10 #define AUDIO_STREAM_DISP_H
11
12 #include "audio_host.h"
13 #include "audio_codec_if.h"
14 #include "audio_platform_if.h"
15 #include "audio_dai_if.h"
16 #include "audio_dsp_if.h"
17
18 #ifdef __cplusplus
19 #if __cplusplus
20 extern "C" {
21 #endif
22 #endif /* __cplusplus */
23
24 #define AUDIO_SERVICE_NAME_MAX_LEN 32
25
26 enum StreamDispMethodCmd {
27 AUDIO_DRV_PCM_IOCTRL_HW_PARAMS,
28 AUDIO_DRV_PCM_IOCTRL_RENDER_PREPARE,
29 AUDIO_DRV_PCM_IOCTRL_CAPTURE_PREPARE,
30 AUDIO_DRV_PCM_IOCTRL_WRITE,
31 AUDIO_DRV_PCM_IOCTRL_READ,
32 AUDIO_DRV_PCM_IOCTRL_RENDER_START,
33 AUDIO_DRV_PCM_IOCTRL_RENDER_STOP,
34 AUDIO_DRV_PCM_IOCTRL_CAPTURE_START,
35 AUDIO_DRV_PCM_IOCTRL_CAPTURE_STOP,
36 AUDIO_DRV_PCM_IOCTRL_RENDER_PAUSE,
37 AUDIO_DRV_PCM_IOCTRL_CAPTURE_PAUSE,
38 AUDIO_DRV_PCM_IOCTRL_RENDER_RESUME,
39 AUDIO_DRV_PCM_IOCTRL_CAPTURE_RESUME,
40 AUDIO_DRV_PCM_IOCTL_MMAP_BUFFER,
41 AUDIO_DRV_PCM_IOCTL_MMAP_BUFFER_CAPTURE,
42 AUDIO_DRV_PCM_IOCTL_MMAP_POSITION,
43 AUDIO_DRV_PCM_IOCTL_MMAP_POSITION_CAPTURE,
44 AUDIO_DRV_PCM_IOCTRL_DSP_DECODE,
45 AUDIO_DRV_PCM_IOCTRL_DSP_ENCODE,
46 AUDIO_DRV_PCM_IOCTRL_DSP_EQUALIZER,
47 AUDIO_DRV_PCM_IOCTRL_BUTT,
48 };
49
50 typedef int32_t (*StreamDispCmdHandle)(const struct HdfDeviceIoClient *client,
51 struct HdfSBuf *data, struct HdfSBuf *reply);
52
53 struct StreamDispCmdHandleList {
54 enum StreamDispMethodCmd cmd;
55 StreamDispCmdHandle func;
56 };
57
58 struct StreamHost {
59 struct IDeviceIoService service;
60 struct HdfDeviceObject *device;
61 void *priv;
62 };
63
StreamHostFromDevice(struct HdfDeviceObject * device)64 static inline struct StreamHost *StreamHostFromDevice(struct HdfDeviceObject *device)
65 {
66 return (device == NULL) ? NULL : (struct StreamHost *)device->service;
67 }
68
69 int32_t StreamDispatch(struct HdfDeviceIoClient *client, int cmdId,
70 struct HdfSBuf *data, struct HdfSBuf *reply);
71
72 #ifdef __cplusplus
73 #if __cplusplus
74 }
75 #endif
76 #endif /* __cplusplus */
77
78 #endif /* AUDIO_STREAM_DISP_H */
79