BBB的cape是如何管理的呢?如下引用“魏来之路”网友的说明,说的很详细: linux
“Beaglebone Black中用一个叫作capemgr的软件管理全部的cape,不论它是实实在在的扩展板,仍是虚拟的cape。这个软件的目录是/sys/devices/bone_capemgr.*/(这里的*是一个每次系统启动可能会不同的数字(与启动顺序有关))” 数据结构
参考网址:http://blog.csdn.net/wyt2013/article/details/16846171 app
从官方的一个WIKI中有详细的说明,也说明了CAPE和DT及Kernel的关系:“BeagleBone and the 3.8 Kernel”(http://elinux.org/BeagleBone_and_the_3.8_Kernel#Cape_Manager_requirements)。 ide
我将其中的关于capemgr,比较重要的翻译了一下。 ui
1: Cape Manager requirements
2:
3: Going over the device tree definition we see that the data structure is referred as parsed at boot-time. Beaglebone capes are not static; a different cape set might be connected each time the board boots, and the only way to find out what kind of cape is connected is to read the serial EEPROM present on each cape which contains identification information.
4:
5: Beaglebone capes are mostly compatible between White and Black, but due to the presence of the eMMC flash and the HDMI framer, some special attention must be paid for capes that use the same resources.
6:
7: The information stored on the EEPROM of each cape are a user readable name, serial number, part number, revision information and others. The only information that the cape manager uses to work are the part-number and the revision.
8:
9: A cape-manager should perform the following:
10:
11: Scan the I2C bus for EEPROMs that correspond to the address defined in the beaglebone SRM. Those addresses are 0x54-0x57 on I2C1 bus, hence the 4 capes limitation.
12: Read the EEPROM contents and parse them according to the spec. Retrieve the part-number and revision information of that cape.
13: Match the PART-NUMBER:REVISION tuple to a configuration that would result in the system state being that as if the cape was directly attached to the base board, and perform any actions that result to it.
14: Additionally we need extra facilities that are useful for people developing capes:
15:
16: An override facility so that prototyping capes with no EEPROM can be supported.
17: An option to load capes at runtime.
18: An option to unload capes at runtime.
19: An option to stop a cape from loading even if detected.
20: To guard against resource conflicts. A cape that uses the same resources as another loaded earlier should not be permitted to load.
21: To be able to forbid cape loading of capes that are not supported by a baseboard revision.
22: To be able to load 'virtual' capes that correspond to peripheral that are present on specific baseboard revisions.
23: To support the notion of a cape priority, so that in case of a conflict, the cape we define as higher priority gets loaded. This is important to allow plug in capes to take preference over capes that are part of the baseboard; i.e. when an LCD cape is attached it takes preference over the onboard HDMI virtual cape.
24: To not require source changes for any driver for a peripheral that resides on cape or onboard , i.e. the drivers should not be modified for use in a cape.
25: No kernel source changes must be required for a new cape to be supported.
26: To not require modification of the boot-loader, or of the base DTS.
纵观DT的定义,咱们了解到DT的数据结构是在系统启动的时候载入的,而BB的cape却不是静态的,不一样的cape可能在不一样的时候接入系统,并且只有经过读取每一个cape上的E2PROM的信息才能肯定cape的种类,这个识别信息是预置于E2PROM中的。 spa
BBB的cape一般与BBW/BBB是兼容的,可是由于BBB内置的eMMC和HDMI功能,使用与其相同资源的cape须要特别予以注意,避免出现资源冲突。 .net
每一个cape中E2PROM的存储的信息主要有名称、序列号、产品号、版本信息及其它内容,而cape的管理器(capemgr)每每使用其中的产品号和版本号。 翻译
Capemgr的工做流程以下: code
1、扫描I2C总线的E2PROM(其地址范围参照SRM的规定),地址范围为0x54-0x57,端口为I2C1,所以可以使用4个cape。 orm
2、读取E2PROM的内容,而且经过其中的part-number和revision信息对其进行识别。
3、经过PART-NUMBER:REVISION的组合,寻找相信的配置信息,而且执行(配置信息中)相应的“规定”动做。
此外,capemagr还支持一些特殊的功能,便于你们开发cape:
a) 可超越控制(手动控制):用于支持无E2PROM的cape原型。
b) 运行时可载入。
c) 运行时可卸载。
d) 即使它已经被系统到也能够中止载入。
e) 防止资源冲突。不一样的cape使用相同的资源时,先到先得。
f) 具有载入虚拟cape的功能(预置于baseboard的,如eMMC等)
g) 防止不支持的cape载入。
h) 支持cape的优先级,当出现冲突时,高优先级的可载入。
i) 不须要改变板载资源或cape的源代码。
j) 增长新cape支持时,无需改变Kernel源代码。
k)无需改变boot-loader或基本的DTS