?? developing a device driver.mht
字號:
C-5</A> and <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut29.html#devcharac2_wkshtfordevnone">Figure=20
C-6</A> show the device characteristics for the <TT>NONE</TT> device =
associated=20
with the <TT>/dev/none</TT> driver. <A name=3Dnx_id_49></A>
<P>As the worksheets show, you specify the following characteristics =
associated=20
with the device:=20
<UL>
<P>
<LI>Whether the device is capable of block I/O=20
<P></P>
<LI>Whether the device supports a file system=20
<P></P>
<LI>Whether the device supports byte stream access=20
<P></P>
<LI>Actions to take on interrupts=20
<P></P>
<LI>How to reset the device=20
<P></P>
<LI>Other device characteristics </LI></UL>
<P><A name=3DSpecWhetDevCapBlockIO></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#specchar_ofdev"><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#SpecWhetDevSuppFileSys"><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.3.1 Specifying Whether the Device Is =
Capable of=20
Block I/O </H3>
<P><A name=3Dnx_id_50></A>If the device is capable of block I/O, then =
you would=20
write a block device driver. A block device is one that stores data on =
its media=20
in a standard way. For example, most disk drives store data in disk =
sectors=20
(typically 512 bytes). <A name=3Dnx_id_51></A>Tape drives sometimes =
store data in=20
a standard-size tape record.=20
<P>Typically, block devices are random access devices (that is, disks) =
because=20
the file system does not always perform I/O to sequential disk sectors. =
Tape=20
devices are typically sequential access devices and, therefore, not =
suitable for=20
using as a block device.=20
<P>The <TT>NONE</TT> device is not capable of handling blocks of data so =
the No=20
box on the worksheet shown in <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut29.html#devcharac_wkshtfordevnone">Figure=20
C-5</A> is marked. <A name=3DSpecWhetDevSuppFileSys></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#SpecWhetDevCapBlockIO"><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#SpecWhetDevSuppByteStream"><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.3.2 Specifying Whether the Device =
Supports a File=20
System </H3>
<P><A name=3Dnx_id_52></A>Most block devices can support file systems. =
If a block=20
device supports a file system, it must be able to map between file =
system blocks=20
and the underlying structure on the device. In Digital UNIX, this =
mapping is=20
accomplished through partition tables.=20
<P>The <TT>NONE</TT> device is not capable of supporting file systems, =
so the No=20
box on the worksheet shown in <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut29.html#devcharac_wkshtfordevnone">Figure=20
C-5</A> is marked. <A name=3DSpecWhetDevSuppByteStream></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#SpecWhetDevSuppFileSys"><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#SpecActionsonInterrupts"><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.3.3 Specifying Whether the Device =
Supports Byte=20
Stream Access </H3>
<P><A name=3Dnx_id_53></A>Most devices support byte stream access. You =
can view=20
this access as sequentially accessing data through the device. For =
example, a=20
sequence of characters typed at a terminal constitutes a byte stream. =
Most block=20
devices can also be accessed in this manner. When a block device is =
accessed as=20
a stream of bytes, the access is typically called ``raw'' access. When =
accessed=20
this way, the data on the block device is accessed sequentially without =
any=20
underlying structure being placed on the data (for example, disk =
sectors).=20
<P>For the <TT>NONE</TT> device, the Yes box on the worksheet shown in =
<A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut29.html#devcharac_wkshtfordevnone">Figure=20
C-5</A> is marked. <A name=3DSpecActionsonInterrupts></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#SpecWhetDevSuppByteStream"><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#SpecHowDevReset"><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.3.4 Specifying Actions to Take on =
Interrupts=20
</H3>
<P><A name=3Dnx_id_54></A>Use this space on the worksheet in <A=20
href=3D"http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUB=
VD-TE_html/drivertut29.html#devcharac_wkshtfordevnone">Figure=20
C-5</A> to summarize what the driver interrupt handlers will do when the =
device=20
generates an interrupt. For example, a terminal-type character driver's=20
interrupt handler can receive a character that was typed on a user's =
keyboard.=20
Typically, the interrupt handler must determine the source of the =
interrupt,=20
respond to the interrupt (for example, by reading in the data), and =
perform the=20
appropriate actions to cause the interrupt to be dismissed.=20
<P>Some other issues concerning interrupts are:=20
<UL>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -