可以自己去验证
参考方法 : https:
参考 https:
https:
cells 相关
#address-cells = <1>;基地址、片选号等绝对起始地址所占字长(32位)
#size-cells = <1>; 长度所占字长(32位)
字长说的是 多少个 字
而描述 在 reg 中
reg = <addr1 addr2 size1 size2>
一般 addr1 和 size1 为 0
regs
regs = <0x00 0xF4000000 0x00 0x1000>,
...
<0x00 0xF5000000 0x00 0x1000>;
reg = <0x10030000 0x1000>;
struct resource *res = platform_get_resource(pdev,IORESOURCE_MEM,0);
res->start:0x10030000
res->end:0x10030fff
res->name:/node-platform
res->flags:0x200
devm_platform_get_and_ioremap_resource
devm_platform_ioremap_resource
devm_platform_ioremap_resource_byname
interrupts
表示中断控制器是GPIO2,使用GPIO2的第5号中断,
这里的第5号中断指的是5号引脚,
1是指中断触发的方式为上升沿触发,
详见内核代码中的头文件include/dt-bindings/interrupt-controller/irq.h
interrupt-parent = <&gpio2>;
interrupts = <5 1>;
---
interrupts = <GIC_SPI 66 1>;
IPI:inter-processer interrupt 中断号0~15
PPI:per processor interrupts 中断号16~31
SPI:shared processor interrupts 中断号 32 ~ 1019
SGI:software generated interrupts (SGI).
所以上述示例表示中断类型为共享处理器中断(SPI),中断号为SPI中断类型中的第66号中断号,
计算出来的实际中断号即为32+66=98号中断,
1表示上升沿触发中断
interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
int linux_irq = of_irq_get(pdev->dev.of_node,0);
int trigger_type = irq_get_trigger_type(linux_irq );
request_irq(linux_irq , (irq_handler_t) irq_int_handler,trigger_type , "node_platform", NULL);
struct resource r;
of_irq_to_resource(pdev->dev.of_node, 0, &r);
获取到的 r.start 和 r.end 是相等的,且都为 软件中断号
interrupts = <0 55 4>;
struct resource *res = platform_get_resource(pdev,IORESOURCE_IRQ,0);
res->start:17
res->end:17
res->name:/node-platform
res->flags:0x404
of_irq_count
platform_irq_count(pdev);
platform_get_irq(pdev,index);
platform_get_irq_by_name(pdev,name);
platform_get_resource(pdev,IORESOURCE_IRQ,index);
platform_get_resource_byname(pdev,IORESOURCE_IRQ,name);
-------------------------
devm 开头的函数不是给irq 用的,而是给 内存用的
时钟相关
自定义 等号表达式
dts----------------
self_defined = "abcd"
c-code-------------------------
char * xxx;
device_property_read_string(dev,"self_defined",&xxx);
of_property_read_string
自定义 bool表达式
dts-------------
self_defined;
c-code-------------------
unsigned tmp:1;
tmp = device_property_read_bool(dev,"self_defined",&xxx);