在linux-4.9.31\Documentation\devicetree下有个usage-model.txt 里面有个网址
[1] http://devicetree.org/Device_Tree_Usage
下面有个目录
1.基本数据结构
2.基本内容(基本概念)
3.如何编码工作
4.中断如何工作
5.设备数特定数据
6.设备树特殊节点
7.设备树高级主题
8.注意事项
1.基本数据格式
/ { node1 { a-string-property = "A string"; a-string-list-property = "first string", "second string"; // hex is implied in byte arrays. no '0x' prefix is required a-byte-data-property = [01 23 34 56]; child-node1 { first-child-property; second-child-property = <1>; a-string-property = "Hello, world"; }; child-node2 { }; }; node2 { an-empty-property; a-cell-property = <1 2 3 4>; /* each number (cell) is a uint32 */ child-node1 { }; }; };
This tree is obviously pretty useless because it doesn't describe anything, but it does show the structure of nodes and properties. There is:
- a single root node: "
/
" - a couple of child nodes: "
node1
" and "node2
" - a couple of children for node1: "
child-node1
" and "child-node2
" - a bunch of properties scattered through the tree.
Properties are simple key-value pairs where the value can either be empty or contain an arbitrary byte stream. While data types are not encoded into the data structure, there are a few fundamental data representations that can be expressed in a device tree source file.
- Text strings (null terminated) are represented with double quotes:
string-property = "a string";
- 'Cells' are 32 bit unsigned integers delimited by angle brackets:
cell-property = <0xbeef 123 0xabcd1234>;
- Binary data is delimited with square brackets:
binary-property = [0x01 0x23 0x45 0x67];
- Data of differing representations can be concatenated together using a comma:
mixed-property = "a string", [0x01 0x23 0x45 0x67], <0x12345678>;
- Commas are also used to create lists of strings:
string-list = "red fish", "blue fish";