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_CONTROL_DISPATCH_H 10 #define AUDIO_CONTROL_DISPATCH_H 11 12 #include "audio_host.h" 13 14 #ifdef __cplusplus 15 #if __cplusplus 16 extern "C" { 17 #endif 18 #endif /* __cplusplus */ 19 20 21 #define AUDIODRV_CTRL_ELEM_TYPE_INTEGER 2 /* integer type */ 22 23 enum ControlDispMethodCmd { 24 AUDIODRV_CTRL_IOCTRL_ELEM_INFO, 25 AUDIODRV_CTRL_IOCTRL_ELEM_READ, 26 AUDIODRV_CTRL_IOCTRL_ELEM_WRITE, 27 AUDIODRV_CTRL_IOCTRL_ELEM_BUTT, 28 }; 29 30 typedef int32_t (*ControlDispCmdHandle)(const struct HdfDeviceIoClient *client, 31 struct HdfSBuf *data, struct HdfSBuf *reply); 32 33 struct ControlDispCmdHandleList { 34 enum ControlDispMethodCmd cmd; 35 ControlDispCmdHandle func; 36 }; 37 38 struct ControlHost { 39 struct IDeviceIoService service; 40 struct HdfDeviceObject *device; 41 void *priv; 42 }; 43 ControlHostFromDevice(struct HdfDeviceObject * device)44static inline struct ControlHost *ControlHostFromDevice(struct HdfDeviceObject *device) 45 { 46 return (device == NULL) ? NULL : (struct ControlHost *)device->service; 47 } 48 49 #ifdef __cplusplus 50 #if __cplusplus 51 } 52 #endif 53 #endif /* __cplusplus */ 54 55 #endif /* AUDIO_CONTROL_H */ 56