设备树中ranges属性分析(1)
作者
软件环境
概述
正文
一、设备树
/ {
#address-cells = <>;
#size-cells = <>;
demo_level0 {
compatible = "simple-bus";
ranges = <0x0 0x3000000 0x3000>;
#address-cells = <>;
#size-cells = <>;
range@ {
compatible = "range";
reg = <0x100 0x200>;
reg-names = "range0";
};
range@ {
compatible = "range";
reg = <0x300 0x200>;
reg-names = "range1";
};
range@ {
compatible = "range";
reg = <0x600 0x200>;
reg-names = "range2";
};
demo_level1 {
compatible = "simple-bus";
ranges = <0x0 0x1000 0x1000>;
#address-cells = <>;
#size-cells = <>;
range@ {
compatible = "range";
reg = <0x100 0x200>;
reg-names = "range3";
};
demo_level1- {
compatible = "simple-bus";
ranges = <0x0 0x300 0x500>;
#address-cells = <>;
#size-cells = <>;
range@ {
compatible = "range";
reg = <0x100 0x200>;
reg-names = "range4";
};
range@ {
compatible = "range";
reg = <0x300 0x100>;
reg-names = "range5";
};
demo_level1-- {
compatible = "simple-bus";
ranges = <0x0 0x400 0x100>;
#address-cells = <>;
#size-cells = <>;
range@ {
compatible = "range";
reg = <0x50 0x30>;
reg-names = "range6";
};
demo_level1--- {
compatible = "simple-bus";
ranges = <0x0 0x20 0x20>;
#address-cells = <>;
#size-cells = <>;
range@ {
compatible = "range";
reg = <0x10 0x10>;
reg-names = "range7";
};
range@ {
compatible = "range";
reg = <0x0 0x10>;
reg-names = "range8";
};
};
};
};
range@ {
compatible = "range";
reg = <0x800 0x50>;
reg-names = "range9";
};
demo_level1- {
compatible = "simple-bus";
ranges = <0x0 0x900 0x100>;
#address-cells = <>;
#size-cells = <>;
range@ {
compatible = "range";
reg = <0x0 0x50>;
reg-names = "range10";
};
demo_level1-- {
compatible = "simple-bus";
ranges;
#address-cells = <>;
#size-cells = <>;
range@ {
compatible = "range";
reg = <0x50 0x30>;
reg-names = "range11";
};
};
};
};
demo_level2 {
compatible = "simple-bus";
ranges;
#address-cells = <>;
#size-cells = <>;
range@ {
compatible = "range";
reg = <0x2000 0x1000>;
reg-names = "range12";
};
};
}
};
二、驱动
#include <linux/init.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/of.h> static int demo_range_probe(struct platform_device *pdev)
{
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, ); printk(KERN_INFO "%s start: 0x%x, end: 0x%x\n",
res->name, res->start, res->end + ); return ;
} static int demo_range_remove(struct platform_device *pdev)
{
return ;
} static const struct of_device_id demo_range_of_match[] = {
{ .compatible = "range"},
{},
}; static struct platform_driver demo_range_driver = {
.driver = {
.name = "demo_range",
.owner = THIS_MODULE,
.of_match_table = demo_range_of_match,
},
.probe = demo_range_probe,
.remove = demo_range_remove,
};
module_platform_driver(demo_range_driver); MODULE_LICENSE("GPL v2");
三、验证
[root@vexpress mnt]# insmod demo_range.ko
[ 382.940402] range0 start: 0x3000100, end: 0x3000300
[ 382.940697] range1 start: 0x3000300, end: 0x3000500
[ 382.941448] range2 start: 0x3000600, end: 0x3000800
[ 382.941657] range3 start: 0x3001100, end: 0x3001300
[ 382.941855] range4 start: 0x3001400, end: 0x3001600
[ 382.942057] range5 start: 0x3001600, end: 0x3001700
[ 382.942262] range6 start: 0x3001750, end: 0x3001780
[ 382.942470] range7 start: 0x3001730, end: 0x3001740
[ 382.942684] range8 start: 0x3001720, end: 0x3001730
[ 382.949796] range9 start: 0x3001800, end: 0x3001850
[ 382.950023] range10 start: 0x3001900, end: 0x3001950
[ 382.950603] range11 start: 0x3001950, end: 0x3001980
[ 382.950805] range12 start: 0x3002000, end: 0x3003000
四、示意图
设备树中ranges属性分析(1)的更多相关文章
- of_alias_get_id 函数与设备树中aliases节点的关系【转】
转自:https://blog.csdn.net/qq_30145093/article/details/78053823?locationNum=10&fps=1 转自http://www. ...
- 我眼中的Linux设备树(三 属性)
三 属性(property)device_type = "memory"就是一个属性,等号前边是属性,后边是值.节点是一个逻辑上相对独立的实体,属性是用来描述节点特性的,根据需要一 ...
- Linux设备树(三 属性)
三 属性(property) device_type = "memory"就是一个属性,等号前边是属性,后边是值.节点是一个逻辑上相对独立的实体,属性是用来描述节点特性的,根据需要 ...
- xx系统属性分析
在本周的课程学习当中,我们简单了解到系统的一些属性,同时在课下也对<大型网站技术架构:核心原理与案例分析>进行了初步的阅读. 在书籍中我看到了许多其他的知识,也对课堂学习的知识有了巩固,现 ...
- 设备树中的interrupts属性解析
interrupts属性会有两种不同的参数: 1. 带两个参数的情形 示例: interrupt-parent = <&gpio2>; interrupts = <5 1& ...
- OpenStack_Swift源代码分析——创建Ring及加入�设备源代码算法具体分析
1 创建Ring 代码具体分析 在OpenStack_Swift--Ring组织架构中我们具体分析了Ring的具体工作过程,以下就Ring中添加�设备,删除设备,已经又一次平衡的实现过程作具体的介绍. ...
- Android中<uses-sdk>属性和target属性分析
1. 概要 <uses-sdk> 用来描述该应用程序可以运行的最小和最大API级别,以及应用程序开发者设计期望运行的平台版本.通过在manifest清单文件中添加该属性,我们可以更好的控制 ...
- iOS获取用户设备崩溃日志并分析
项目最近发布,部分用户在内侧使用,正好遇到一些问题,由于用户在其他城市,所以对于用户设备产生的崩溃日志,不好直接拿设备连接电脑. 对于这种情况,我们可以这样: 1.引导用户开启iOS设备设置-> ...
- Linux块设备加密之dm-crypt分析
相关的分析工作一年前就做完了,一直懒得写下来.现在觉得还是写下来,以来怕自己忘记了,二来可以给大家分享一下自己的研究经验. 这篇文章算是<Device Mapper代码分析>的后续篇,因为 ...
随机推荐
- 基于Golang设计一套微服务架构[转]
article- @嘟嘟噜- May/26/2018 18:35:30 如何基于Golang设计一套微服务架构 微服务(Microservices),这个近几年我们经常听到.那么现在市面上的的微服 ...
- OCM_第二天课程:Section1 —》配置 Oracle 网络环境
注:本文为原著(其内容来自 腾科教育培训课堂).阅读本文注意事项如下: 1:所有文章的转载请标注本文出处. 2:本文非本人不得用于商业用途.违者将承当相应法律责任. 3:该系列文章目录列表: 一:&l ...
- JS实现购物车01
需求 使用JS实现购物车功能01 具体代码 <!DOCTYPE html> <html lang="en"> <head> <meta c ...
- LeetCode(35):搜索插入位置
Easy! 题目描述: 给定一个排序数组和一个目标值,在数组中找到目标值,并返回其索引.如果目标值不存在于数组中,返回它将会被按顺序插入的位置. 你可以假设数组中无重复元素. 示例 1: 输入: [1 ...
- 并发之AQS原理(三) 如何保证并发
并发之AQS原理(三) 如何保证并发 1. 如何保证并发 AbstractQueuedSynchronizer 维护了一个state(代表了共享资源)和一个FIFO线程等待队列(多线程竞争资源被阻塞时 ...
- IntelliJ IDEA 下的SVN使用
最近公司的很多同事开始使用IntelliJ Idea,便尝试了一下,虽然快捷键与eclipse 有些不同,但是强大的搜索功能与“漂亮的界面”(个人认为没有eclipse好看 ),还是值得我们去使用的. ...
- 步步为营-30-AES加密与解密
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...
- jsp+servlet实现最基本的注册登陆功能
源码和数据库下载地址:http://download.csdn.net/detail/biexiansheng/9759722 1:首先需要设计好数据库和数据表,这里简单截图说明我创建的字段和类型. ...
- spring 中常用的两种事务配置方式以及事务的传播性、隔离级别
一.注解式事务 1.注解式事务在平时的开发中使用的挺多,工作的两个公司中看到很多项目使用了这种方式,下面看看具体的配置demo. 2.事务配置实例 (1).spring+mybatis 事务配置 &l ...
- bzoj3687
3687: 简单题 Time Limit: 10 Sec Memory Limit: 512 MBSubmit: 700 Solved: 319[Submit][Status][Discuss] ...