Chinese translated version of Documentation/zorro.txt
If you have any comment or update to the content, please contact the
original document maintainer directly. However, if you have a problem
communicating in English you can also ask the Chinese maintainer for
help. Contact the Chinese maintainer if this translation is outdated
or if there is a problem with the translation.
Chinese maintainer: 秦芹 18768122412@163.com
---------------------------------------------------------------------
Documentation/zorro.txt的中文翻译
如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
译存在问题,请联系中文版维护者。
中文版维护者: 秦芹 18768122412@163.com
中文版翻译者:秦芹 18768122412@163.com
以下为正文
---------------------------------------------------------------------
Writing Device Drivers for Zorro Devices
为Zorro设备编写设备驱动程序
----------------------------------------
Written by Geert Uytterhoeven <geert@linux-m68k.org>
以下原文由Geert Uytterhoeven编写,作者邮箱为:geert@linux-m68k.org
Last revised: September 5, 2003
最后修订时间为:2003年9月5日
1. Introduction
介绍(引言)
---------------
The Zorro bus is the bus used in the Amiga family of computers. Thanks to
AutoConfig(tm), it's 100% Plug-and-Play.
Zorro总线是在Amiga计算机系列中使用的总线。由于自动配置(低层)计算机
中的板卡和其他设备,所以该总线设备完全能实现即插即用。
There are two types of Zorro busses, Zorro II and Zorro III:
这里有两种类型的Zerro总线,分别是Zerro2和Zerro3:
- The Zorro II address space is 24-bit and lies within the first 16 MB of the
Amiga's address map.
- Zerro2的地址空间是24位,并且Amiga的地址映射范围在0-16MB之间。
- Zorro III is a 32-bit extension of Zorro II, which is backwards compatible
with Zorro II. The Zorro III address space lies outside the first 16 MB.
- Zerro3是基于Zerro2的扩展,地址空间为32位,与Zerro2向后兼容。
Zerro3的地址空间位于第一个16MB外的的空间。
2. Probing for Zorro Devices
Zerro设备的探测
----------------------------
Zorro devices are found by calling `zorro_find_device()', which returns a
pointer to the `next' Zorro device with the specified Zorro ID. A probe loop
for the board with Zorro ID `ZORRO_PROD_xxx' looks like:
Zorro设备通过调用‘zerro_find_device()’方法被发现,它返回一个指针,
根据具体的Zerro ID指向下一个Zerro设备。根据Zerro ID
(如:‘ZERRO_PROD_xxx’)循环探测,模版如下:
struct zorro_dev *z = NULL;
while ((z = zorro_find_device(ZORRO_PROD_xxx, z))) {
if (!zorro_request_region(z->resource.start+MY_START, MY_SIZE,
"My explanation"))
...
}
`ZORRO_WILDCARD' acts as a wildcard and finds any Zorro device. If your driver
supports different types of boards, you can use a construct like:
`ZORRO_WILDCARD'作为一个通配符,查找任何Zorro设备。如果你的驱动支持不
同类型的模版,你可以使用如下结构:
struct zorro_dev *z = NULL;
while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {
if (z->id != ZORRO_PROD_xxx1 && z->id != ZORRO_PROD_xxx2 && ...)
continue;
if (!zorro_request_region(z->resource.start+MY_START, MY_SIZE,
"My explanation"))
...
}
3. Zorro Resources
Zorro资源
------------------
Before you can access a Zorro device's registers, you have to make sure it's
not yet in use. This is done using the I/O memory space resource management
functions:
你访问Zorro设备寄存器之前,你必须确保这个寄存器没有被使用。这是通过使
用I/O内存空间资源管理功能函数完成的,函数如下:
request_mem_region()
请求内存区域函数
release_mem_region()
释放内存区域函数
Shortcuts to claim the whole device's address space are provided as well:
快捷方式要求整个设备的地址空间也被提供:
zorro_request_device
Zorro请求设备地址空间
zorro_release_device
Zorro释放设备地址空间
4. Accessing the Zorro Address Space
访问Zorro地址空间
------------------------------------
The address regions in the Zorro device resources are Zorro bus address
regions. Due to the identity bus-physical address mapping on the Zorro bus,
they are CPU physical addresses as well.
Zorro设备资源的地址区域是Zorro总线地址区域。因为映射到Zorro总线的标
识物理总线地址也是CPU的物理地址。
The treatment of these regions depends on the type of Zorro space:
这些区域的处理依赖于不同类型的Zorro空间:
- Zorro II address space is always mapped and does not have to be mapped
explicitly using z_ioremap().
- Zorro2地址空间总是被映射,而不必明确使用z_ioremap()函数进行映射。
Conversion from bus/physical Zorro II addresses to kernel virtual addresses
and vice versa is done using:
从总线或者Zorro2物理地址到内核虚拟地址的转换,反之亦然适用,通过使用如下方式完成:
virt_addr = ZTWO_VADDR(bus_addr);
bus_addr = ZTWO_PADDR(virt_addr);
- Zorro III address space must be mapped explicitly using z_ioremap() first
before it can be accessed:
- Zorro3地址空间被访问前,首先必须明确使用z_ioremap()函数来实现映射:
virt_addr = z_ioremap(bus_addr, size);
...
z_iounmap(virt_addr);
5. References
参考文献
-------------
linux/include/linux/zorro.h
linux/include/asm-{m68k,ppc}/zorro.h
linux/include/linux/zorro_ids.h
linux/drivers/zorro
/proc/bus/zorro