?? developing a device driver.mht
字號:
From: <Saved by Windows Internet Explorer 7>
Subject: Developing a Device Driver
Date: Sun, 25 Feb 2007 15:05:24 +0530
MIME-Version: 1.0
Content-Type: multipart/related;
type="text/html";
boundary="----=_NextPart_000_0032_01C758EE.608247C0"
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028
This is a multi-part message in MIME format.
------=_NextPart_000_0032_01C758EE.608247C0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Location: http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut5.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Developing a Device Driver</TITLE>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3DNOFOLLOW name=3DROBOTS>
<META=20
content=3D"Writing Device Drivers Tutorial: DIGITAL UNIX Version 4.0B =
documentation set"=20
name=3DDESCRIPTION>
<META=20
content=3D"Copyright (c) Digital Equipment Corporation 1996. All Rights =
Reserved."=20
name=3DAUTHOR>
<META content=3D"MSHTML 6.00.6000.16414" name=3DGENERATOR></HEAD>
<BODY><A name=3DDesSimple></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/drivertut4.html"><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> <IMG=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/BLANK.GIF"=20
border=3D0> <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut5.html#gather_info"><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/drivertut6.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>
<H1>2 Developing a Device Driver</H1>
<P>This chapter discusses how you develop a device driver. Included is a =
simple=20
example called <TT>/dev/none</TT>, which is written by a fictitious =
third-party=20
driver company called EasyDriver Incorporated. The <TT>/dev/none</TT> =
device=20
device=20
driver interfaces. Note, however, that the <TT>/dev/none</TT> driver =
does not=20
control a real hardware device.=20
<P><A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut29.html#dev_drv_wrkshts">Appendix=20
C</A> provides worksheets to illustrate the kinds of information you =
need to=20
gather to make developing the device driver easier. These worksheets are =
filled=20
in for the <TT>/dev/none</TT> driver. <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut29.html#dev_drv_wrkshts">Appendix=20
C</A> also provides these same worksheets for use in developing your own =
device=20
drivers. If you use the worksheets for your driver development, consider =
organizing them in a device driver project binder. This will make them =
available=20
to systems engineers who need to maintain the driver.=20
<P>Specifically, the chapter describes the following tasks associated =
with=20
developing any device driver:=20
<UL>
<P>
<LI>Gathering information=20
<P></P>
<LI>Designing the device driver=20
<P></P>
<LI>Understanding system data and address types that device drivers =
use=20
<P></P>
<LI>Specifying the method for registering device interrupt handlers=20
<P></P>
<LI>Specifying the method for identifying bus, controller, and device=20
information=20
<P></P>
<LI>Determining the structure allocation technique=20
<P></P>
<LI>Creating a device driver development environment </LI></UL>
<P><A name=3Dgather_info></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/drivertut5.html#DesSimple"><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> <IMG=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
D-TE_html/BLANK.GIF"=20
border=3D0> <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut5.html#specinfo_abouthostsys"><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/drivertut6.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>2.1 Gathering Information </H2>
<P>The first task in writing a device driver is to gather pertinent =
information=20
about the host system and the device for which you are writing the =
driver. You=20
need to:=20
<UL>
<P>
<LI>Specify information about the host system=20
<P></P>
<LI>Identify the conventions used in writing the driver=20
<P></P>
<LI>Specify characteristics of the device=20
<P></P>
<LI>Describe device usage=20
<P></P>
<LI>Provide a description of the device registers=20
<P></P>
<LI>Identify support in writing the driver </LI></UL>
<P>The following sections describe how you would fill out the worksheets =
provided for each of these tasks, using the <TT>/dev/none</TT> device =
driver as=20
an example. <A name=3Dspecinfo_abouthostsys></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/drivertut5.html#DesSimple"><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/drivertut5.html#gather_info"><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/drivertut5.html#SpecHostCPU"><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/drivertut6.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>
<H3>2.1.1 Specifying Information About the Host =
System=20
</H3>
<P><A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut29.html#hostsys_wkshtfordevnone">Figure=20
C-1</A> and <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut29.html#hostsys2_wkshtfordevnone">Figure=20
C-2</A> show the host system information associated with the =
<TT>/dev/none</TT>=20
driver. <A name=3Dnx_id_33></A>As the worksheets show, you gather the =
following=20
information about the host system:=20
<UL>
<P>
<LI>The host CPU or CPUs your driver operates on=20
<P></P>
<LI>The operating system or systems your driver operates on=20
<P></P>
<LI>The bus or buses that your driver connects to </LI></UL>
<P><A name=3DSpecHostCPU></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/drivertut5.html#DesSimple"><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/drivertut5.html#specinfo_abouthostsys"><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/drivertut5.html#SpecOperateSys"><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/drivertut6.html"><IMG=20
alt=3D"[Next Chapter]"=20
src=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBV=
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -