linux设备树用户手册

上传人:第*** 文档编号:61714598 上传时间:2018-12-10 格式:PDF 页数:24 大小:601.69KB
返回 下载 相关 举报
linux设备树用户手册_第1页
第1页 / 共24页
linux设备树用户手册_第2页
第2页 / 共24页
linux设备树用户手册_第3页
第3页 / 共24页
linux设备树用户手册_第4页
第4页 / 共24页
linux设备树用户手册_第5页
第5页 / 共24页
点击查看更多>>
资源描述

《linux设备树用户手册》由会员分享,可在线阅读,更多相关《linux设备树用户手册(24页珍藏版)》请在金锄头文库上搜索。

1、This page walks through how to write a device tree for a new machine. It is intended to provide an overview of device tree concepts and how they are used to describe a machine. 本文将介绍如何为一个新机器编写设备树。我们准备提供一个有关设备树概念的概述和 如何使用这些设备树来描述一个机器。 For a full technical description of device tree data format, refer

2、 to the ePAPR specification. The ePAPR specification covers a lot more detail than the basic topics covered on this page, please refer to it for more advanced usage that isnt covered by this page. 完整的设备树数据格式的技术说明书请参考 ePAPR 规范。ePAPR 规范涵盖了比本文基 本主题更丰富的细节,要查阅本文没有涉及到的高级用法请参考该规范。 - The device tree is a si

3、mple tree structure of nodes and properties. Properties are key-value pairs, and node may contain both properties and child nodes. For example, the following is a simple tree in the .dts format: 设备树是一个包含节点和属性的简单树状结构。属性就是键值对,而节点可以同时包 含属性和子节点。例如,以下就是一个 .dts 格式的简单树: 这棵树显然是没什么用的,因为它并没有描述任何东西,但它确实体现了节点的一

4、些属 性: a single root node: “/“ 一个单独的根节点:“/” a couple of child nodes: “node1“ and “node2“ 两个子节点:“node1”和“node2” a couple of children for node1: “child-node1“ and “child-node2“ 两个 node1 的子节点:“child-node1”和“child-node2” a bunch of properties scattered through the tree. 一堆分散在树里的属性。 Properties are simple

5、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. Device Tree Usage 属性是简单的键值对,它的值可以为空或者包含一个任意字节流。虽然数据

6、类型并没 有编码进数据结构,但在设备树源文件中任有几个基本的数据表示形式。 Text strings (null terminated) are represented with double quotes: 文本字符串(无结束符)可以用双引号表示: 1. string-property = “a string“ Cells are 32 bit unsigned integers delimited by angle brackets: Cells是 32 位无符号整数,用尖括号限定: 1. cell-property = binary data is delimited with squa

7、re brackets: 二进制数据用方括号限定: 1. binary-property = 0x01 0x23 0x45 0x67; Data of differing representations can be concatenated together using a comma: 不同表示形式的数据可以使用逗号连在一起: 1. mixed-property = “a string“, 0x01 0x23 0x45 0x67, ; Commas are also used to create lists of strings: 逗号也可用于创建字符串列表: 1. string-list

8、 = “red fish“, “blue fish“; Basic Concepts 基本概念 - To understand how the device tree is used, we will start with a simple machine and build up a device tree to describe it step by step. 我们将以一个简单机开始,然后通过一步步的建立一个描述这个简单机的设备树,来了 解如何使用设备树。 Sample Machine 模型机模型机 Consider the following imaginary machine (lo

9、osely based on ARM Versatile), manufactured by “Acme“ and named “Coyotes Revenge“: 考虑下面这个假想的机器(大致基于ARM Versatile),制造商为“Acme”,并命名 为“Coyotes Revenge”: One 32bit ARM CPU 一个 32 位 ARM CPU processor local bus attached to memory mapped serial port, spi bus controller, i2c controller, interrupt controller,

10、and external bus bridge 256MB of SDRAM based at 0 256MB SDRAM 起始地址为 0 2 Serial ports based at 0x101F1000 and 0x101F2000 两个串口起始地址:0x101F1000 和 0x101F2000 GPIO controller based at 0x101F3000 GPIO 控制器起始地址:0x101F3000 SPI controller based at 0x10170000 with following devices 带有以下设备的 SPI 控制器起始地址:0x1017000

11、0 MMC slot with SS pin attached to GPIO #1 MMC 插槽的 SS 管脚连接至 GPIO #1 External bus bridge with following devices 外部总线桥挂载以下设备 SMC SMC91111 Ethernet device attached to external bus based at 0x10100000 SMC SMC91111 以太网设备连接到外部总线,起始地址:0x10100000 i2c controller based at 0x10160000 with following devices i2c

12、 控制器起始地址:0x10160000,并挂载以下设备 Maxim DS1338 real time clock. Responds to slave address 1101000 (0x58) Maxim DS1338 实时时钟。响应至从地址 1101000 (0x58) 64MB of NOR flash based at 0x30000000 Initial structure 初始结构初始结构 The first step is to lay down a skeleton structure for the machine. This is the bare minimum str

13、ucture required for a valid device tree. At this stage you want to uniquely identify the machine. 1. / patible = “acme,coyotes-revenge“; 3. ; compatible specifies the name of the system. It contains a string in the form “,. It is important to specify the exact device, and to include the manufacturer

14、 name to avoid namespace collisions. Since the operating system will use the compatible value to make decisions about how to run on the machine, it is very important to put correct data into this property. compatible 指定了系统的名称。它包含了一个“,”形式的字符串。重 要的是要指定一个确切的设备,并且包括制造商的名子,以避免命名空间冲突。由于操 作系统会使用 compatible

15、 的值来决定如何在机器上运行,所以正确的设置这个属性变 得非常重要。 Theoretically, compatible is all the data an OS needs to uniquely identify a machine. If all the machine details are hard coded, then the OS could look specifically for “acme,coyotes-revenge“ in the top level compatible property. CPUs 中央处理器中央处理器 Next step is to describe for each of the CPUs. A container node named “cpus“ is added with a child node for each CPU. In this case the system is a dual-core Cortex A9 system from ARM. / compatible = “acme,coyotes-revenge“; cpus cpu0 compatible = “arm,cortex-a9“; ; cpu1 compatible = “arm,cortex-a9“; ;

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 解决方案

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号