首页 > 系统相关 >2023.7.18 linux 设备树

2023.7.18 linux 设备树

时间:2023-07-19 19:33:59浏览次数:46  
标签:node resource struct 18 tree 2023.7 linux device path

CONFIG_OF   此内核配置启用设备树,使用相关 api 需要包含:

#include <linux/of.h>

#include <linux/of_device.h>

 查看API:  https://docs.kernel.org/devicetree/kernel-api.html

 

An introduction to the concept of aliases, labels, phandles, and paths

 When using of_find_node_by_path() or of_find_node_opts_by_ path() to find a node given its path, if the supplied path does not start with /, then the first element of the path must be a property name in the /aliases node. That element is replaced with the full path from the alias.

Labeling a node is only useful if the node is intended to be referenced from the property of another node. You can consider a label as a pointer to a node, either by the path or by the reference.

 

Understanding overwriting nodes and properties     #操 这也有重载吗?

 比如以上的,后面的  I2C1 的status 值会覆盖前面的值。

 

Device tree sources and compilers

The device tree (also referred to as DT) comes in two forms. The first is the textual form, which represents the sources (also referred to as DTS). And the second is the binary blob form, which represents the compiled device tree, also referred to as DTB (for device tree blob) or FDT (for flattened device tree). Source files have a .dts extension, while the binary forms have either a .dtb or .dtbo extension. .dtbo is a particular extension that is used for compiled device tree overlays (DTBO means device tree blob for overlay), as we will see in the next section. There are also .dtsi text files (where the i at the end means "include"). These host SoC-level definitions and are intended to be included in .dts files, hosting the board-level definitions.

dtsi 用法?把soc的相关写在一个文件比如 rk3588.dtsi, 其他开发板也用了 3588 的,就可以直接include 这个rk3588.dtsi;

 dts在源码中的位置:arch/arm/boot/dts/   arch/arm64/boot/dts/

DTC 在源码中的位置:  scripts/dtc/

make dtbs,

 

The device tree overlay 

可以在运行时在线修改添加更新节点或节点数据,只是不能删除节点

 

 

 Building device tree overlays

 

 Loading device tree overlays via configfs

 

 

 

Representing and addressing devices

设备地址 reg

#address-cells and #size-cells

 

Handling SPI and I2C device addressing

SPI 和 I2C 都是非内存映射设备,其父节点是 bus 每一个spi或i2c设备 都是 i2c控制器或 spi控制器的子节点

non-memory-mapped device, the #size-cells property is 0;and the size element in the addressing tuple is empty. This means that the reg property for this kind of device is always one cell. The following is an example:

 Documentation/devicetree/ bindings/spi.

 Memory-mapped devices and device addressing

reg = <base0 length0 [base1 length1] [address2 length2] ... >. Here, each tuple represents an address range used by the device.

 

The struct resource

 

 struct resource *platform_get_resource( struct platform_device *dev, unsigned int type, unsigned int num)

struct resource *platform_get_resource_byname( struct platform_device *dev, unsigned int type, const char *name)

 

The concept of named resources

 

 

Extracting string properties  

 

 Reading cells and unsigned 32-bit integers

 

 

 Handling Boolean properties

 

 Extracting and parsing sub-nodes

 

 

标签:node,resource,struct,18,tree,2023.7,linux,device,path
From: https://www.cnblogs.com/yangdinshan/p/17562151.html

相关文章

  • 瑞芯微|如何让拥有双网口的Linux设备实现数据包转发?【超实用】
    本文主要讲解如何,解决基于3568实现双网口互通问题。一、组网如下图所示:rk3568自带2个千兆以太口,对应网卡名称为:eth0、eth1pc1和pc2分别连接这2个网口pc1与eth0连接,网段:192.168.30.0pc2与eth1连接,网段:192.168.40.0目标:实现pc1与pc2互通。组网也可以简化为:......
  • 暑假周记(7.18)
    唉,昨天又忘写了,被小孩们调皮捣蛋气的,中午买饭还跟路边一个车(车主开门不看环境,直接就开,我没反应过来,直接撞到人家车门上了,疼的我差点饭吃不下去,浑身冒冷汗,得亏我骑得不快)碰了,郁闷的一上午,下午教那个小升初的,数学咋教也不会,哎。......
  • 7.17~7.18 DP专场
    CF1814EChainChips好久没写这种题了~~不带修时,为了让总距离和最短,考虑让相邻的车互换位置,但如果单纯这样有可能剩下一辆车,那就让相邻的三辆车换一下。发现当车的个数\(x\ge4\)时,都可以拆成\(2\)辆或\(3\)辆车。对应到边就是只能选相邻的一条边或两条边。设\(dp_i\)......
  • Linux中JVM内存调整大小
    linux修改jvm内存大小第一:要修改Linux上JVM的内存大小,可以按照以下步骤进行:1.打开JVM的配置文件,一般是在JVM安装目录下的bin目录中,文件名为java或者jvm.cfg。2.找到-Xmx和-Xms参数,它们分别表示JVM的最大内存和初始内存大小。可以根据需要修改这两个参数的值,例如将-Xmx设为2G将-X......
  • Alibaba Cloud Linux 3 docker 开通2375
    AlibabaCloudLinux3上开通Docker2375端口Docker是一种开源的容器化平台,可以帮助开发者将应用程序和依赖项打包到一个独立的容器中,以便在任何地方运行。在AlibabaCloudLinux3上开通Docker2375端口可以让我们通过远程API访问Docker服务,方便地管理和监控容器。步骤......
  • Linux安装新版本Python3.9.0
    Linux自带的python版本过低,无法满足需要,遂安装一个Python3.9。在Linux系统上安装新版本的Python,可以通过以下步骤进行操作:1.下载新版本前往Python官方网站(https://www.python.org/downloads/source/),选择适合你的系统的最新版本的源代码进行下载。解压源代码包。使用命令行......
  • 第18天
    一、二维数组。动态初始化。内存图原理二、练习。 ......
  • Linux的nm查看动态和静态库中的符号
    功能列出.o.a.so中的符号信息,包括诸如符号的值,符号类型及符号名称等。所谓符号,通常指定义出的函数,全局变量等等。 使用nm[option(s)][file(s)]有用的options:-A在每个符号信息的前面打印所在对象文件名称;-C输出demangle过了的符号名称;-D打印动态符号;-l使用对......
  • VMware Workstation 18 Tech Preview - 增强的 Windows 11 虚拟机安全性
    VMwareWorkstation18TechPreview-增强的Windows11虚拟机安全性VMwareWorkstationTechPreview2023请访问原文链接:https://sysin.org/blog/vmware-workstation-18/,查看最新版。原创作品,转载请保留出处。作者主页:sysin.org原文作者:MichaelRoyJuly13,2023准备......
  • Linux uevent分析、用户接收uevent以及mdev分析
    intmdev_main(intargc,char**argv)MAIN_EXTERNALLY_VISIBLE;intmdev_main(intargcUNUSED_PARAM,char**argv){RESERVE_CONFIG_BUFFER(temp,PATH_MAX+SCRATCH_SIZE);INIT_G();ifENABLE_FEATURE_MDEV_CONFG.filename="/etc/mdev.conf";endif......