struct kobject kobj;
unsigned long _flags;
void *data;
#if defined(CONFIG_SPARC)
const char *path_component_name;
unsigned int unique_id;
struct of_irq_controller *irq_trans;
#endif
};
节点的属性信息里面保存了驱动所需要的内容,因此对于属性值的提取非常重要,Linux 内核中使用结
构体 property 表示属性,此结构体同样定义在文件 include/linux/of.h 中,内容如下:
struct property
{
char *name; /* 属性名字 */
int length; /* 属性长度 */
void *value; /* 属性值 */
struct property *next; /* 下一个属性 */
unsigned long _flags;
unsigned int unique_id;
struct bin_attribute attr;
};
获得设备树文件节点里面资源的步骤:
步骤一:查找我们要找的节点。
步骤二:获取我们需要的属性值。
与查找节点有关的 OF 函数有 3 个,我们依次来看一下。
联系客服