[译]5.3. Basic Goals of NIC Initialization NIC初始化的基本目的
目录:http://www.cnblogs.com/WuCountry/archive/2008/11/15/1333960.html
[不提供插图,读者最好从网上下载源书]
5.3. Basic Goals of NIC Initialization NIC初始化的基本目的
Each network device is represented in the Linux kernel by an instance of the net_device data structure. In Chapter 8, you will see how net_device data structures are allocated and how their fields are initialized, partly by the device driver and partly by core kernel routines. In this chapter, we focus on how device drivers allocate the resources needed to establish device/kernel communication, such as:
每一个网络设备在Linux内核中都要以net_device数据结构的形式表现出来。在第8章中,你会看到net_device数据结构是如何被分配的,以及它们的字段中如何初始化的,一部份是由设备驱动程序初始化的,一部份是内核例程初始化的。在这一章里,我们集中于设备驱动是 如何分配资源的,这些资源是在创建设备/内核交互中必须的:例如:
IRQ line IRQ线
As you will see in the section "Interaction Between Devices and Kernel," NICs need to be assigned an IRQ and to use it to call for the kernel's attention when needed. Virtual devices, however, do not need to be assigned an IRQ: the loopback device is an example because its activity is totally internal (see the later section "Virtual Devices").
正如你在"Interaction Between Devices and Kernel,"中所看到的,NIC须要指定一个IRQ,以便内核在必要时可以调用它。然而,虚拟设备不须要指定一个IRQ,环回设备就是一个例子,因为实际上完全是内部的(参见后面的一节“Virtual Devices”)。
The two functions used to request and release IRQ lines are introduced in the later section "Hardware Interrupts." As you will see in the later section "Tuning via /proc Filesystem," the /proc/interrupts file can be used to view the status of the current assignments.
在后面的一节“Hardware Interrupts.”中会介绍两个函数用于申请和释放IRQ线。你会在“Tuning via /proc Filesystem,”中看到,通过/proc/interrupts文件你可以看到当前系统已经指定的(中断的)状态。
I/O ports and memory registration I/O端口和内存注册
It is common for a driver to map an area of its device's memory (its configuration registers, for example) into the system memory so that read/write operations by the driver will be made on system memory addresses directly; this can simplify the code. I/O ports and memory are registered and released with request_region and release_region, respectively.
通常,设备在系统内存中映射一块它自己的设备内存(例如,它的配置注册),这样设备的读和写操作就可以通过直接访问内存来完成;这样可以简化代码。I/O端口和内存通过request_region 和release_region分别注册和释放。
/\_/\
(=^o^=) Wu.Country@侠缘
(~)@(~) 一辈子,用心做一件事!
--------------------------------
学而不思则罔,思而不学则怠!
================================
posted on 2008-12-15 22:36 Wu.Country@侠缘 阅读(281) 评论(0) 编辑 收藏 举报