1.int of_property_read_u32_index(const struct device_node *np,
 const char *propname, u32 index, u32 *out_value)
 功能:获取32位无符号整型的值
 参数:
 np:节点结构体指针
 propname:键名
 index:索引号
 out_value:获取到的值
 返回值:成功返回0,失败返回错误码
2.int of_property_read_variable_u32_array(const struct device_node *np,
 const char *propname,
 u32 *out_values,
 size_t sz_min,
 size_t sz_max)
 功能:获取一个u32位数组
 参数:
 np:节点结构体指针
 proname:键名
 out_values:存放数据的数组名
 sz_min:期待读取到的元素的最小个数
 sz_max:期待读取到元素的最大个数
 返回值:成功返回读取到的个数,失败返回错误码
3.int of_property_read_string(const struct device_node *np,
 const char *propname,
 const char **out_string)
 功能:读取字符串类型的值
 参数:np:节点结构体指针
 proname:键名
 out_string:指获取到的字符串的首地址
 返回值:返回值:成功返回0,失败返回错误码
代码示例:
#include <linux/init.h>
#include <linux/module.h>
#include <linux/of.h>
struct device_node *node;
struct property *pr;
int len,i,ret;
const char *p;
unsigned int val;
unsigned int array[2];
//入口函数
static int __init mycdev_init(void)
{
    //通过路径获取设备树节点信息
    node = of_find_node_by_path("/mynode@0x12345678");
    if(node == NULL)
    {
        printk("解析设备树节点失败\n");
        return -EFAULT;
    }
    printk("成功解析设备树节点\n");
    //读取字符串类型的值
    ret = of_property_read_string(node,"astring",&p);
    if(ret)
    {
        printk("获取字符串失败\n");
        return -EFAULT;
    }
    printk("value:=%s\n",p);
    //获取u32的值
    ret = of_property_read_u32_index(node,"uint",1,&val);
    if(ret)
    {
        printk("获取u32值失败\n");
        return -EFAULT;
    }
    printk("value=%#x\n",val);
    //获取u32数组
    ret = of_property_read_variable_u32_array(node,"uint",array,2,2);
    if(ret < 0)
    {
        printk("获取u32数组失败\n");
        return -EFAULT;
    }
    printk("value:%#x,%#x\n",array[0],array[1]);  
    return 0;
}
//出口函数
static void __exit mycdev_exit(void)
{
}
module_init(mycdev_init);
module_exit(mycdev_exit);
// GPL协议
MODULE_LICENSE("GPL");
结果:
 




![[附源码]Python计算机毕业设计大学生社团管理系统](https://img-blog.csdnimg.cn/3d43b2a236ef4e188d4cfd96d847ca24.png)














