1 /* 2 * Copyright (c) 2020-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 HCS_TREE_IF_H 10 #define HCS_TREE_IF_H 11 12 #include "device_resource_if.h" 13 #include "hdf_base.h" 14 15 #ifdef __cplusplus 16 #if __cplusplus 17 extern "C" { 18 #endif 19 #endif /* __cplusplus */ 20 21 #define HCS_MATCH_ATTR "match_attr" 22 23 const struct DeviceResourceNode *HcsGetRootNode(void); 24 bool HcsGetBool(const struct DeviceResourceNode *node, const char *attrName); 25 int32_t HcsGetUint8(const struct DeviceResourceNode *node, const char *attrName, uint8_t *value, uint8_t def); 26 int32_t HcsGetUint8ArrayElem(const struct DeviceResourceNode *node, const char *attrName, uint32_t index, 27 uint8_t *value, uint8_t def); 28 int32_t HcsGetUint8Array(const struct DeviceResourceNode *node, const char *attrName, uint8_t *value, uint32_t len, 29 uint8_t def); 30 int32_t HcsGetUint16(const struct DeviceResourceNode *node, const char *attrName, uint16_t *value, uint16_t def); 31 int32_t HcsGetUint16ArrayElem(const struct DeviceResourceNode *node, const char *attrName, uint32_t index, 32 uint16_t *value, uint16_t def); 33 int32_t HcsGetUint16Array(const struct DeviceResourceNode *node, const char *attrName, uint16_t *value, uint32_t len, 34 uint16_t def); 35 int32_t HcsGetUint32(const struct DeviceResourceNode *node, const char *attrName, uint32_t *value, uint32_t def); 36 int32_t HcsGetUint32ArrayElem(const struct DeviceResourceNode *node, const char *attrName, uint32_t index, 37 uint32_t *value, uint32_t def); 38 int32_t HcsGetUint32Array(const struct DeviceResourceNode *node, const char *attrName, uint32_t *value, 39 uint32_t len, uint32_t def); 40 int32_t HcsGetUint64(const struct DeviceResourceNode *node, const char *attrName, uint64_t *value, uint64_t def); 41 int32_t HcsGetUint64ArrayElem(const struct DeviceResourceNode *node, const char *attrName, uint32_t index, 42 uint64_t *value, uint64_t def); 43 int32_t HcsGetUint64Array(const struct DeviceResourceNode *node, const char *attrName, uint64_t *value, 44 uint32_t len, uint64_t def); 45 int32_t HcsGetStringArrayElem(const struct DeviceResourceNode *node, const char *attrName, uint32_t index, 46 const char **value, const char *def); 47 int32_t HcsGetString(const struct DeviceResourceNode *node, const char *attrName, const char **value, const char *def); 48 int32_t HcsGetElemNum(const struct DeviceResourceNode *node, const char *attrName); 49 const struct DeviceResourceNode *HcsGetNodeByMatchAttr(const struct DeviceResourceNode *node, const char *attrValue); 50 const struct DeviceResourceNode *HcsGetChildNode(const struct DeviceResourceNode *node, const char *nodeName); 51 const struct DeviceResourceNode *HcsGetNodeByRefAttr(const struct DeviceResourceNode *node, const char *attrName); 52 53 #ifdef __cplusplus 54 #if __cplusplus 55 } 56 #endif 57 #endif /* __cplusplus */ 58 59 #endif /* HCS_TREE_IF_H */