Linux设备树OF函数使用详解

427 阅读1分钟

1 设备树(纯寄存器模式)

image.png

2 设备树开发第一步:定义dtsled设备结构体

  • device_node对应设备树中一个节点信息 image.png

3 OF函数使用详解

3.1 of_find_node_by_path

image.png

3.2 of_find_property

image.png

3.3 of_property_read_string

image.png

3.4 of_property_read_u32_array

image.png

3.5 of_iomap

image.png

3.6 of_get_named_gpio(gpio子系统)

image.png

  • 设备树 image.png
  • 驱动:定义设备树结构体,使用gpio子系统需要定义gpio编号 image.png
  • gpio_request image.png
  • gpio_set_value image.png
  • gpio_free image.png

3.6 irq_of_parse_and_map

image.png image.png image.png image.png image.png