bluetoothlover_doc
bluetoothlover_doc copied to clipboard
[devicetree] 设备树运行逻辑
研究一下设备树运行逻辑
/**
* @brief Call "fn" on all nodes with compatible DT_DRV_COMPAT
* and status "okay"
*
* This macro calls "fn(inst)" on each "inst" number that refers to a
* node with status "okay". Whitespace is added between invocations.
*
* Example devicetree fragment:
*
* a {
* compatible = "vnd,device";
* status = "okay";
* label = "DEV_A";
* };
*
* b {
* compatible = "vnd,device";
* status = "okay";
* label = "DEV_B";
* };
*
* c {
* compatible = "vnd,device";
* status = "disabled";
* label = "DEV_C";
* };
* Example usage:
*
* #define DT_DRV_COMPAT vnd_device
* #define MY_FN(inst) DT_INST_LABEL(inst),
*
* DT_INST_FOREACH_STATUS_OKAY(MY_FN)
*
* This expands to:
*
* MY_FN(0) MY_FN(1)
*
* and from there, to either this:
*
* "DEV_A", "DEV_B",
*
* or this:
*
* "DEV_B", "DEV_A",
*
* No guarantees are made about the order that a and b appear in the
* expansion.
*
* Note that "fn" is responsible for adding commas, semicolons, or
* other separators or terminators.
*
* Device drivers should use this macro whenever possible to
* instantiate a struct device for each enabled node in the devicetree
* of the driver's compatible DT_DRV_COMPAT.
* @param fn Macro to call for each enabled node. Must accept an
* instance number as its only parameter.
*/
【Zephyr设备树保姆级上手教程【上】】 https://www.bilibili.com/video/BV1q44y1R7hV/?share_source=copy_web&vd_source=26080c5bc3a16e88ddba49dec018a584
devicetree 标准 https://github.com/devicetree-org/devicetree-specification
https://github.com/devicetree-org/devicetree-specification/releases/download/v0.4/devicetree-specification-v0.4.pdf
最新的: https://github.com/devicetree-org/devicetree-specification/releases
【详解Zephyr设备数与设备驱动模型】 https://www.bilibili.com/video/BV1L94y1F7qS/?share_source=copy_web&vd_source=26080c5bc3a16e88ddba49dec018a584
https://docs.zephyrproject.org/latest/build/dts/index.html
https://docs.zephyrproject.org/latest/hardware/peripherals/spi.html 一些外设标准接口定义