⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 introduction to device drivers.mht

📁 What is this ``device driver stuff anyway? Here s a very short introduction to the concept.
💻 MHT
📖 第 1 页 / 共 5 页
字号:
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/NEXT.GIF"=20
border=3D0></A> <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut4.html"><IMG=20
alt=3D"[Next Chapter]"=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/FF.GIF"=20
border=3D0></A> <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/INDEX.html"><IMG=20
alt=3D[Index]=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/INDEX.GIF"=20
border=3D0></A> <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.h=
tml"><IMG=20
alt=3D[Help]=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/HELP.GIF"=20
border=3D0></A>=20
<P>
<HR>

<P>
<H2>1.4&nbsp;&nbsp;&nbsp;&nbsp;When a Device Driver Is Called </H2>
<P><A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut3.html#whenkerncalls_drv">Figure=20
1-1</A> shows that the kernel calls a device driver during:=20
<UL>
  <P>
  <LI>Autoconfiguration=20
  <P>The kernel calls a device driver (specifically, the driver's =
<TT>probe</TT>=20
  interface) at autoconfiguration time to determine what devices are =
available=20
  and to initialize them. <BR>
  <P></P>
  <LI>I/O operations=20
  <P>The kernel calls a device driver to perform I/O operations on the =
device.=20
  These operations include opening the device to perform reads and =
writes and=20
  closing the device.=20
  <P></P>
  <LI>Interrupt handling=20
  <P>The kernel calls a device driver to handle interrupts from devices =
capable=20
  of generating them.=20
  <P></P>
  <LI>Special requests=20
  <P>The kernel calls a device driver to handle special requests through =

  <TT>ioctl</TT> calls.=20
  <P></P>
  <LI>Reinitialization=20
  <P>The kernel calls a device driver to reinitialize the driver, the =
device, or=20
  both when the bus (the path from the CPU to the device) is reset.=20
  <P></P>
  <LI>User-level requests to the <TT>sysconfig</TT> utility=20
  <P>The kernel calls a device driver (specifically, the driver's=20
  <TT>configure</TT> interface) to handle requests that result from use =
of the=20
  <TT>sysconfig</TT> utility. The <TT>sysconfig</TT> utility allows a =
system=20
  manager to dynamically configure, unconfigure, query, and reconfigure =
a=20
  device. These requests cause the kernel to call the device driver's=20
  <TT>configure</TT> interface. In addition, the driver's =
<TT>configure</TT>=20
  interface performs one-time initializations when called by the boot =
software=20
  or by the <TT>sysconfig</TT> utility. </P></LI></UL>
<P><A name=3Dwhenkerncalls_drv></A>
<H3>Figure 1-1: When the Kernel Calls a Device Driver</H3>
<P><IMG=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/zk-0200U.gif">
<P><A name=3Dnx_id_15></A>
<P>Some of these requests, such as input or output, result directly or=20
indirectly from corresponding system calls in a user program. Other =
requests,=20
such as the calls at autoconfiguration time, do not result from system =
calls but=20
from activities that occur at boot time. <A =
name=3DDevDrvIntegationOver></A>
<P>
<HR>

<P align=3Dcenter><A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digita=
l_UNIX_Bookshelf.html"><IMG=20
alt=3D"[Return to Library]"=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/BOOKSHELF.GIF"=20
border=3D0></A> <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/TOC.html"><IMG=20
alt=3D[Contents]=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/TOC.GIF"=20
border=3D0></A> <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut3.html#IntrotoDevDrv"><IMG=20
alt=3D"[Previous Chapter]"=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/REW.GIF"=20
border=3D0></A> <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut3.html#whentocall_devdrv"><IMG=20
alt=3D"[Previous Section]"=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/PREV.GIF"=20
border=3D0></A> <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut3.html#placeof_devdrv"><IMG=20
alt=3D"[Next Section]"=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/NEXT.GIF"=20
border=3D0></A> <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut4.html"><IMG=20
alt=3D"[Next Chapter]"=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/FF.GIF"=20
border=3D0></A> <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/INDEX.html"><IMG=20
alt=3D[Index]=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/INDEX.GIF"=20
border=3D0></A> <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.h=
tml"><IMG=20
alt=3D[Help]=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/HELP.GIF"=20
border=3D0></A>=20
<P>
<HR>

<P>
<H2>1.5&nbsp;&nbsp;&nbsp;&nbsp;Device Driver Configuration </H2>
<P>Device driver configuration consists of the tasks necessary to =
incorporate=20
device drivers into the kernel to make them available to system =
management and=20
other utilities. After you write your device driver you need to create a =
single=20
binary module (a file with a <TT>.mod</TT> extension) from the driver =
source=20
file (a file with a <TT>.c</TT> extension). After you create the single =
binary=20
module, you need to configure it into the kernel so that you can test it =
on a=20
running system. There are two methods of device driver configuration: =
static=20
configuration and dynamic configuration. Static configuration consists =
of the=20
tasks and tools necessary to link a device driver (single binary module) =

directly into the kernel at kernel build time. Dynamic configuration =
consists of=20
the tasks and tools necessary to link a device driver (single binary =
module)=20
directly into the kernel at any point in time. <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut19.html#ConfigModuleDynamicDrv">Chapter=20
14</A> describes how to create a single binary module and then how to =
statically=20
and dynamically configure the single binary module (the device driver) =
into the=20
kernel.=20
<P>Do not confuse device driver configuration (static configuration and =
dynamic=20
configuration), which encompasses the tools and steps for configuring =
the driver=20
into the kernel, with autoconfiguration and configuration. =
Autoconfiguration is=20
a process that determines what hardware actually exists during the =
current=20
instance of the running kernel at static configuration time. The=20
autoconfiguration software (specifically, the bus's <TT>confl1</TT> =
interface)=20
calls the driver's <TT>probe</TT>, <TT>attach</TT>, and <TT>slave</TT>=20
interfaces. Thus, the driver's <TT>probe</TT>, <TT>attach</TT>, and=20
<TT>slave</TT> interfaces cooperate with the bus's <TT>confl1</TT> =
interface to=20
determine if devices exist and are functional on a given system.=20
<P>Configuration is a process associated with handling user-level =
requests to=20
the <TT>sysconfig</TT> utility to dynamically configure, unconfigure, =
query, and=20
reconfigure devices. The <TT>cfgmgr</TT> framework calls the driver's=20
<TT>configure</TT> interface as a result of these <TT>sysconfig</TT> =
utility=20
requests. The <TT>cfgmgr</TT> framework also calls the driver's=20
<TT>configure</TT> interface as a result of static configuration =
requests. Thus,=20
the driver's <TT>configure</TT> interface cooperates with the =
<TT>cfgmgr</TT>=20
framework to statically configure and to dynamically configure, =
unconfigure,=20
query, and reconfigure devices. The driver's <TT>configure</TT> =
interface also=20
cooperates with the <TT>cfgmgr</TT> framework to perform one-time =
initialization=20
tasks such as allocating memory, initializing data structures and =
variables, and=20
adding driver entry points to the <TT>dsent</TT> table. A driver's=20
<TT>configure</TT> interface should be implemented to handle static and =
dynamic=20
configuration. <BR><A name=3Dplaceof_devdrv></A>
<P>
<HR>

<P align=3Dcenter><A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digita=
l_UNIX_Bookshelf.html"><IMG=20
alt=3D"[Return to Library]"=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/BOOKSHELF.GIF"=20
border=3D0></A> <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/TOC.html"><IMG=20
alt=3D[Contents]=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/TOC.GIF"=20
border=3D0></A> <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut3.html#IntrotoDevDrv"><IMG=20
alt=3D"[Previous Chapter]"=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/REW.GIF"=20
border=3D0></A> <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut3.html#DevDrvIntegationOver"><IMG=20
alt=3D"[Previous Section]"=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/PREV.GIF"=20
border=3D0></A> <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut3.html#user_prog"><IMG=20
alt=3D"[Next Section]"=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/NEXT.GIF"=20
border=3D0></A> <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut4.html"><IMG=20
alt=3D"[Next Chapter]"=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/FF.GIF"=20
border=3D0></A> <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/INDEX.html"><IMG=20
alt=3D[Index]=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/INDEX.GIF"=20
border=3D0></A> <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.h=
tml"><IMG=20
alt=3D[Help]=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/HELP.GIF"=20
border=3D0></A>=20
<P>
<HR>

<P>
<H2>1.6&nbsp;&nbsp;&nbsp;&nbsp;Place of a Device Driver in Digital UNIX =
</H2>
<P><A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut3.html#placeof_drvinos">Figure=20
1-2</A> shows the place of a device driver in Digital UNIX relative to =
the=20
device:=20
<UL>
  <P>
  <LI>User program or utility=20
  <P>A user program, or utility, makes calls on the kernel but never =
directly=20
  calls a device driver.=20
  <P></P>
  <LI>Kernel=20
  <P>The kernel runs in supervisor mode and does not communicate with a =
device=20
  except through calls to a device driver.=20
  <P></P>
  <LI>Device driver=20
  <P>A device driver communicates with a device by reading and writing =
through a=20
  bus to peripheral device registers.=20
  <P></P>
  <LI>Bus=20
  <P>The bus is the data path between the main processor and the device=20
  controller. <A name=3Dplaceof_drvinos></A>
  <H3>Figure 1-2: Place of a Device Driver in Digital UNIX</H3>
  <P><IMG=20
  =
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/zk-0201U.gif">
  <P><A name=3Dnx_id_16></A>
  <P></P>
  <LI>Controller=20
  <P>A controller is a physical interface for controlling one or more =
devices. A=20
  controller connects to a bus.=20
  <P></P>
  <LI>Peripheral device=20
  <P>A peripheral device is a device that can be connected to a =
controller, for=20
  example, a disk or tape drive. Other devices (for example, the =
network) may be=20
  integral to the controller. </P></LI></UL>
<P>
<P>The following sections describe these parts, with an emphasis on how =
a device=20
driver relates to them. <A name=3Duser_prog></A>
<P>
<HR>

<P align=3Dcenter><A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digita=
l_UNIX_Bookshelf.html"><IMG=20
alt=3D"[Return to Library]"=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/BOOKSHELF.GIF"=20
border=3D0></A> <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/TOC.html"><IMG=20

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -