1 Star 0 Fork 4.9K

Lin_bruin / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
DriverConfig.md 14.52 KB
一键复制 编辑 原始数据 按行查看 历史
wenjun 提交于 2020-09-08 10:08 . add OpenHarmony 1.0 baseline

DriverConfig

Overview

Defines an API for HDF driver developers to read driver configuration information.

During version compilation of the device resource source file defined by developers, the compilation tool (for example, the compilation tool of the HCS file is hc-gen) generates bytecodes. When the HDF starts, it transfers the bytecode memory to the DriverConfig module. The DriverConfig module converts the bytecodes into a configuration tree and provides an API for developers to query the tree.

Since:

1.0

Version:

1.0

Summary

Files

File Name

Description

device_resource_if.h

Declares the API for querying the configuration tree.

Data Structures

Data Structure Name

Description

DeviceResourceAttr

Defines the attributes of a tree node in the configuration tree.

DeviceResourceNode

Defines a tree node in the configuration tree.

DeviceResourceIface

Provides functions for obtaining information about the device resource configuration tree.

Macros

Macro Name and Value

Description

DEV_RES_NODE_FOR_EACH_ATTR(node, attr)   for ((attr) = (node)->attrData; (attr) != NULL; (attr) = (attr)->next)

Traverses the attributes of the current configuration tree node.

DEV_RES_NODE_FOR_EACH_CHILD_NODE(node, childNode)   for ((childNode) = (node)->child; (childNode) != NULL; (childNode) = (childNode)->sibling)

Traverses the child nodes of the current configuration tree node.

Enumerations

Enumeration Name

Description

DeviceResourceType { HDF_CONFIG_SOURCE = 0, INVALID }

Enumerates configuration file types.

Functions

Function Name

Description

DeviceResourceGetIfaceInstance (DeviceResourceType type)

struct DeviceResourceIface

Obtains the device resource interface handle of the corresponding configuration tree type.

Details

Macro Definition Documentation

DEV_RES_NODE_FOR_EACH_ATTR

#define DEV_RES_NODE_FOR_EACH_ATTR( node,  attr )   for ((attr) = (node)->attrData; (attr) != [NULL](zh-cn_topic_0000001055198076.md#ga070d2ce7b6bb7e5c05602aa8c308d0c4); (attr) = (attr)->next)

Description:

Traverses the attributes of the current configuration tree node.

This operation is a for loop in essence.

Parameters:

Name

Description

node Indicates the configuration tree node to traverse.
attr Indicates the traversed attributes.

DEV_RES_NODE_FOR_EACH_CHILD_NODE

#define DEV_RES_NODE_FOR_EACH_CHILD_NODE( node,  childNode )   for ((childNode) = (node)->child; (childNode) != [NULL](zh-cn_topic_0000001055198076.md#ga070d2ce7b6bb7e5c05602aa8c308d0c4); (childNode) = (childNode)->sibling)

Description:

Traverses the child nodes of the current configuration tree node.

This operation is a for loop in essence.

Parameters:

Name

Description

node Indicates the configuration tree node to traverse.
childNode Indicates the traversed child nodes.

Enumeration Type Documentation

DeviceResourceType

enum [DeviceResourceType](DriverConfig.md#ga09c9585a5d95c79fd5ee4bd8863ba66a)

Description:

Enumerates configuration file types.

Enumerator

Description

HDF_CONFIG_SOURCE 

HDF configuration file

INVALID 

Invalid configuration file type

Function Documentation

DeviceResourceGetIfaceInstance()

struct [DeviceResourceIface](DeviceResourceIface.md)* DeviceResourceGetIfaceInstance ([DeviceResourceType](DriverConfig.md#ga09c9585a5d95c79fd5ee4bd8863ba66a) type)

Description:

Obtains the device resource interface handle of the corresponding configuration tree type.

You can use the obtained handle to use the device resource interface.

Parameters:

Name

Description

type Indicates the type of the device resource interface handle to obtain.

Returns:

Returns the device resource interface handle if the operation is successful; returns NULL otherwise.

1
https://gitee.com/dreaminghell/docs.git
git@gitee.com:dreaminghell/docs.git
dreaminghell
docs
docs
master

搜索帮助