考试:Linux/ARM 设备树(Device Tree)的知识自测题
这是针对2017年8月3日晚上参加CSDN学院联合Linuxer直播《CSDN直播:深入探究Linux/VxWorks的设备树(Device Tree)》学员的课前自测题。可以看看自己能考多少分?无论自测结果如何,直播的内容将帮助学员顺利地解答这些问题。
公众号:linuxer
ID:LinuxDev
长按二维码关注我们
选择题
1. ARM是Linux中第一个支持device tree的体系架构
A. 是
B. 否
2. U-Boot中既可以读取,也可能修改Device tree?
A. 是
B. 否
3. DTB文件可以直接紧接在内核zImage之后?
A. 是
B. 否
4. 在支持device tree后,U-Boot引导ARM zImage执行的时候,r1寄存器的作用是?
A. 存放machine type
B. 不再有意义
C. 固定存放0
5. 下面的DT节点中,gpio-controller这个属性的类型是:
chipcommon: chipcommon@0 {
reg = <0x00000000 0x1000>;
gpio-controller;
#gpio-cells = <2>;
};
A. 整数
B. 字符串
C. 布尔
问答题
找出如下DT节点的语法错误,并回答原因
amba {
compatible = "simple-bus";
#address-cells = <1>;
#size-cells = <1>;
ranges;
adc: adc@f8007100 {
compatible = "xlnx,zynq-xadc-1.00.a";
reg = <0x0 0xf8007100 0x20>;
};
};
2. 找出如下DT节点中不恰当的地方,并回答原因:
usb1: usb@e0003000 {
compatible = "chipidea,usb2", "xlnx,zynq-usb-2.20a";
status = "disabled";
clocks = <&clkc 29>;
reg = <0xe0003000 0x1000>;
};
3. 从CPU的视角,下面DT节点中的scu, timer, local-timer, gic: interrupt-controller占用的物理地址范围分别是_____, _______, ______, _________。
mpcore {
compatible = "simple-bus";
ranges = <0x00000000 0x19020000 0x00003000>;
#address-cells = <1>;
#size-cells = <1>;
scu@0000 {
compatible = "arm,cortex-a9-scu";
reg = <0x0000 0x100>;
};
timer@0200 {
compatible = "arm,cortex-a9-global-timer";
reg = <0x0200 0x100>;
interrupts = <GIC_PPI 11 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk_periph>;
};
local-timer@0600 {
compatible = "arm,cortex-a9-twd-timer";
reg = <0x0600 0x100>;
interrupts = <GIC_PPI 13 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk_periph>;
};
gic: interrupt-controller@1000 {
compatible = "arm,cortex-a9-gic";
#interrupt-cells = <3>;
#address-cells = <0>;
interrupt-controller;
reg = <0x1000 0x1000>,
<0x0100 0x100>;
};
}
4. 如下代码,当一个驱动可以支持2种不同外设的情况下:
static const struct of_device_id xxx_of_match[] = {
{ .compatible = "vendor,abc", .data = &abc_data },
{ .compatible = "vendor,def", .data = &def_data },
{},
};
static struct platform_driver xxx_driver = {
.probe = xxx_probe,
.remove = xxx_remove,
.driver = {
.name = DRV_NAME,
.of_match_table = xxx_of_match,
},
};
驱动编程时,通过什么方法可以区分出DT节点是“vendor,abc”还是“vendor,def”,并且根据情况拿到abc_data、def_data这种不同的数据?
5. 观察如下2个dtsi和dts文件:
zynq-7000.dtsi:
sdhci0: sdhci@e0100000 {
compatible = "arasan,sdhci-8.9a";
status = "disabled";
clock-names = "clk_xin", "clk_ahb";
clocks = <&clkc 21>, <&clkc 32>;
interrupt-parent = <&intc>;
interrupts = <0 24 4>;
reg = <0xe0100000 0x1000>;
};
zynq-zed.dts:
/dts-v1/;
/include/ "zynq-7000.dtsi"
/ {
model = "Zynq Zed Development Board";
compatible = "xlnx,zynq-zed", "xlnx,zynq-7000";
&sdhci0 {
status = "okay";
};
}
请问SDHCI0最终的状态是使能还是没有使能?为什么?
直播
报名
CSDN直播:深入探究Linux/VxWorks的设备树(Device Tree)
!!!!!!!扫描二维码即可报名!!!!!!!
往期直播
安卓用户可点击阅读原文,跳转至报名表单