1 /* 2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef AUDIO_INTERFACE_LIB_COMMON_H 17 #define AUDIO_INTERFACE_LIB_COMMON_H 18 19 #include "audio_interface_lib_mixer.h" 20 #include "audio_internal.h" 21 #include "hdf_sbuf.h" 22 23 #define SERVIC_NAME_MAX_LEN 32 24 #define AUDIO_MIN_DEVICENUM 1 25 26 #define AUDIODRV_CTL_ELEM_IFACE_MIXER 2 /* virtual mixer control */ 27 28 enum AudioCriBuffStatus { 29 CIR_BUFF_NORMAL = -1, 30 CIR_BUFF_FULL = -2, 31 CIR_BUFF_EMPTY = -3, 32 }; 33 34 struct AudioCtlElemId { 35 const char *cardServiceName; 36 const char *itemName; /* ASCII name of item */ 37 int32_t iface; 38 }; 39 40 struct AudioCtlElemValue { 41 struct AudioCtlElemId id; 42 int32_t value[2]; 43 }; 44 45 struct AudioCtrlElemInfo { 46 struct AudioCtlElemId id; 47 uint32_t count; /* count of values */ 48 int32_t type; /* Read: value type - AudioCtlElemType */ 49 int32_t min; /* Read: minimum value */ 50 int32_t max; /* Read: maximum value */ 51 }; 52 53 int32_t AudioServiceDispatch(void *obj, int cmdId, struct HdfSBuf *sBuf, struct HdfSBuf *reply); 54 55 int32_t AudioGetElemValue(struct HdfSBuf *reply, struct AudioCtrlElemInfo *volThreshold); 56 int32_t AudioSetElemValue(struct HdfSBuf *sBuf, const struct AudioCtlElemValue *elemValue, bool isSendData); 57 58 int32_t AudioAllocHdfSBuf(struct HdfSBuf **reply, struct HdfSBuf **sBuf); 59 void AudioFreeHdfSBuf(struct HdfSBuf *sBuf, struct HdfSBuf *reply); 60 61 struct DevHandle *AudioBindService(const char *name); 62 void AudioCloseService(const struct DevHandle *handle); 63 64 #endif /* AUDIO_INTERFACE_LIB_COMMON_H */ 65