📄 developing a device driver.htm
字号:
<P>
<H3>2.1.4.1 Listing the Device Documentation </H3>
<P><A name=nx_id_58></A>For a real device, you should have on hand the manual
for the device that is supplied by the manufacturer. The <TT>NONE</TT> device is
a fictitious device; therefore, this section of the worksheet shown in <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut29.html#devuse_wkshtfordevnone">Figure
C-7</A> is left blank. <A name=SpecNumofDeviceTypes></A>
<P>
<HR>
<P align=center><A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digital_UNIX_Bookshelf.html"><IMG
alt="[Return to Library]" src="Developing a Device Driver_files/BOOKSHELF.gif"
border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/TOC.html"><IMG
alt=[Contents] src="Developing a Device Driver_files/TOC.gif" border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut5.html#DesSimple"><IMG
alt="[Previous Chapter]" src="Developing a Device Driver_files/REW.gif"
border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut5.html#ListDevDocs"><IMG
alt="[Previous Section]" src="Developing a Device Driver_files/PREV.gif"
border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut5.html#DescribePurposeofDevice"><IMG
alt="[Next Section]" src="Developing a Device Driver_files/NEXT.gif"
border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut6.html"><IMG
alt="[Next Chapter]" src="Developing a Device Driver_files/FF.gif" border=0></A>
<A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/INDEX.html"><IMG
alt=[Index] src="Developing a Device Driver_files/INDEX.gif" border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.html"><IMG
alt=[Help] src="Developing a Device Driver_files/HELP.gif" border=0></A>
<P>
<HR>
<P>
<H3>2.1.4.2 Specifying the Number of Device Types to
Reside on the System </H3>
<P><A name=nx_id_59></A>The number of devices that can be supported has a direct
effect on the design of the driver. If only one will be supported, the driver
need not worry about determining which device is being accessed. If a small
number (for example, 2 - 5) is supported, the driver can use simple data
structures and indexing to keep track of device access. If a greater number is
to be supported, the driver must use more sophisticated methods to keep track of
which device is being accessed.
<P>The <TT>/dev/none</TT> driver can accommodate more than one instance. The
worksheet shown in <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut29.html#devuse_wkshtfordevnone">Figure
C-7</A> indicates that the <TT>/dev/none</TT> device driver can support a
maximum of eight instances of the <TT>NONE</TT> device. However, the driver
writers at EasyDriver Incorporated ship the <TT>/dev/none</TT> driver product to
support a maximum of one instance. Customers of EasyDriver Incorporated can
change this number by editing the <TT>none:</TT> entry in the
<TT>/etc/sysconfigtab</TT> database. <A name=DescribePurposeofDevice></A>
<P>
<HR>
<P align=center><A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digital_UNIX_Bookshelf.html"><IMG
alt="[Return to Library]" src="Developing a Device Driver_files/BOOKSHELF.gif"
border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/TOC.html"><IMG
alt=[Contents] src="Developing a Device Driver_files/TOC.gif" border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut5.html#DesSimple"><IMG
alt="[Previous Chapter]" src="Developing a Device Driver_files/REW.gif"
border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut5.html#SpecNumofDeviceTypes"><IMG
alt="[Previous Section]" src="Developing a Device Driver_files/PREV.gif"
border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut5.html#provdescof_devreg"><IMG
alt="[Next Section]" src="Developing a Device Driver_files/NEXT.gif"
border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut6.html"><IMG
alt="[Next Chapter]" src="Developing a Device Driver_files/FF.gif" border=0></A>
<A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/INDEX.html"><IMG
alt=[Index] src="Developing a Device Driver_files/INDEX.gif" border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.html"><IMG
alt=[Help] src="Developing a Device Driver_files/HELP.gif" border=0></A>
<P>
<HR>
<P>
<H3>2.1.4.3 Describing the Purpose of the Device </H3>
<P><A name=nx_id_60></A>For this device usage item, enter a short description of
the purpose of the device. For example, the purpose of most disk devices is to
provide storage for user data and files. The purpose of most terminal devices is
to provide a means for interacting with users of the system.
<P>The worksheet shown in <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut29.html#devuse_wkshtfordevnone">Figure
C-7</A> indicates that this item is not applicable to the <TT>NONE</TT> device
because it is a fictitious device. <A name=provdescof_devreg></A>
<P>
<HR>
<P align=center><A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digital_UNIX_Bookshelf.html"><IMG
alt="[Return to Library]" src="Developing a Device Driver_files/BOOKSHELF.gif"
border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/TOC.html"><IMG
alt=[Contents] src="Developing a Device Driver_files/TOC.gif" border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut5.html#DesSimple"><IMG
alt="[Previous Chapter]" src="Developing a Device Driver_files/REW.gif"
border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut5.html#DescribePurposeofDevice"><IMG
alt="[Previous Section]" src="Developing a Device Driver_files/PREV.gif"
border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut5.html#identsup_wrtdrv"><IMG
alt="[Next Section]" src="Developing a Device Driver_files/NEXT.gif"
border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut6.html"><IMG
alt="[Next Chapter]" src="Developing a Device Driver_files/FF.gif" border=0></A>
<A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/INDEX.html"><IMG
alt=[Index] src="Developing a Device Driver_files/INDEX.gif" border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.html"><IMG
alt=[Help] src="Developing a Device Driver_files/HELP.gif" border=0></A>
<P>
<HR>
<P>
<H3>2.1.5 Providing a Description of the Device Registers
</H3>
<P><A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut29.html#devreg_wkshtfordevnone">Figure
C-8</A> and <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut29.html#devreg2_wkshtfordevnone">Figure
C-9</A> show the device register information for the <TT>/dev/none</TT> driver.
<A name=nx_id_61></A><A name=nx_id_62></A><A name=nx_id_63></A>As the worksheets
show, you gather the following information about the device registers:
<UL>
<P>
<LI>A description or sketch of the layout of the device registers
<P>The manual supplied with the device would most likely have the following:
<UL>
<P>
<LI>The layout of the registers and their offset
<P></P>
<LI>How the registers are used </LI></UL>
<P>
<P>The worksheet shown in <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut29.html#devreg_wkshtfordevnone">Figure
C-8</A> indicates a device register offset definition of the device register
for the <TT>NONE</TT> device along with a comment as to its function.
<P></P>
<LI>A mapping of the device register with the memory address </LI></UL>
<P><A name=identsup_wrtdrv></A>
<P>
<HR>
<P align=center><A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digital_UNIX_Bookshelf.html"><IMG
alt="[Return to Library]" src="Developing a Device Driver_files/BOOKSHELF.gif"
border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/TOC.html"><IMG
alt=[Contents] src="Developing a Device Driver_files/TOC.gif" border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut5.html#DesSimple"><IMG
alt="[Previous Chapter]" src="Developing a Device Driver_files/REW.gif"
border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut5.html#provdescof_devreg"><IMG
alt="[Previous Section]" src="Developing a Device Driver_files/PREV.gif"
border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut5.html#desgndev_drv"><IMG
alt="[Next Section]" src="Developing a Device Driver_files/NEXT.gif"
border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut6.html"><IMG
alt="[Next Chapter]" src="Developing a Device Driver_files/FF.gif" border=0></A>
<A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/INDEX.html"><IMG
alt=[Index] src="Developing a Device Driver_files/INDEX.gif" border=0></A> <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.html"><IMG
alt=[Help] src="Developing a Device Driver_files/HELP.gif" border=0></A>
<P>
<HR>
<P>
<H3>2.1.6 Identifying Support in Writing the Driver </H3>
<P><A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut29.html#devsupp_wkshtfordevnone">Figure
C-10</A> shows the support associated with writing the <TT>/dev/none</TT>
driver. <A name=nx_id_64></A>As the worksheet shows, you gather the following
information about device driver support:
<UL>
<P>
<LI>Whether you are writing the driver from scratch
<P><A name=nx_id_65></A>Answering this question can help determine the amount
of time you need to spend writing the driver. Most device drivers are written
by modifying an existing device driver that contains similar functionality.
However, if source code for an existing driver is not available, it may take
you more time to develop the driver. The <TT>/dev/none</TT> driver will be
developed from scratch; therefore, the Yes box on the worksheet shown in <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut29.html#devsupp_wkshtfordevnone">Figure
C-10</A> is marked.
<P></P>
<LI>Whether the driver for the device was written previously for an ULTRIX
system
<P><A name=nx_id_66></A>If the source code is available, you can update the
device driver to reflect the Digital UNIX operating system. <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut7.html#PortingDevDrvs">Section
4.1</A> provides information to help you understand the tasks involved in
porting from an ULTRIX system to Digital UNIX. In this case, no source code is
available so the No box on the worksheet shown in <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut29.html#devsupp_wkshtfordevnone">Figure
C-10</A> is marked.
<P></P>
<LI>Whether the driver for the device was written previously for a UNIX system
<P><A name=nx_id_67></A>If the source code is available, you can begin
updating the device driver by identifying areas that are different from
Digital UNIX. Other versions of the UNIX operating system would probably have
different data structures and some of the kernel interfaces would probably
behave differently and expect different arguments. In this case, no source
code is available so the No box on the worksheet shown in <A
href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut29.html#devsupp_wkshtfordevnone">Figure
C-10</A> is marked.
<P></P>
<LI>Whether the driver for the device was written previously for another
operating system
<P><A name=nx_id_68></A>If the source code is available, you must study the
differences between writing a device driver on that operating system and on
the Digital UNIX operating system. This would probably be more difficult than
the pre
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -