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

📄 hw activities.htm

📁 What is this ``device driver stuff anyway? Here s a very short introduction to the concept.
💻 HTM
📖 第 1 页 / 共 3 页
字号:
</p><p></p><hr><p>
</p><h3>
16.1.4.5&nbsp;&nbsp;&nbsp;&nbsp;DMA and non-DMA Devices
</h3>
<p>
<a name="nx_id_695"></a>
A direct memory access (DMA) device is one that can directly access
(read from and write to) CPU memory, without CPU intervention.
Non-DMA devices cannot directly access CPU memory. 
<a name="nx_id_696"></a>
The object of DMA is faster data transfer.
When character drivers perform DMA, they do it to or from the user's
address space.
When block drivers perform DMA, they do it to or from the buffer cache.
<br>
<a name="HardwareActiv"></a>
</p><p></p><hr><p align="center">
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digital_UNIX_Bookshelf.html"><img src="HW%20activities_files/BOOKSHELF.GIF" alt="[Return to Library]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/TOC.html"><img src="HW%20activities_files/TOC.GIF" alt="[Contents]" border="0"></a>
<a href="#HWComponents"><img src="HW%20activities_files/REW.GIF" alt="[Previous Chapter]" border="0"></a>
<a href="#DMAandNonDMADevices"><img src="HW%20activities_files/PREV.GIF" alt="[Previous Section]" border="0"></a>
<a href="#HowDrvAccessDevReg"><img src="HW%20activities_files/NEXT.GIF" alt="[Next Section]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut23.html"><img src="HW%20activities_files/FF.GIF" alt="[Next Chapter]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/INDEX.html"><img src="HW%20activities_files/INDEX.GIF" alt="[Index]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.html"><img src="HW%20activities_files/HELP.GIF" alt="[Help]" border="0"></a>
</p><p></p><hr><p>
</p><h2>
16.2&nbsp;&nbsp;&nbsp;&nbsp;Hardware Activities
</h2>
<p>
<a name="nx_id_697"></a>
When writing device drivers, you need to consider the following
hardware-related activities:
</p><ul>
<p></p><li>
How a device driver accesses device registers
<p></p></li><li>
How the device uses the registers
<p></p></li><li>
How the device driver interrupts the CPU
</li></ul><p>
The following sections discuss each of these activities as they relate
to device drivers.
<a name="HowDrvAccessDevReg"></a>
</p><p></p><hr><p align="center">
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digital_UNIX_Bookshelf.html"><img src="HW%20activities_files/BOOKSHELF.GIF" alt="[Return to Library]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/TOC.html"><img src="HW%20activities_files/TOC.GIF" alt="[Contents]" border="0"></a>
<a href="#HWComponents"><img src="HW%20activities_files/REW.GIF" alt="[Previous Chapter]" border="0"></a>
<a href="#HardwareActiv"><img src="HW%20activities_files/PREV.GIF" alt="[Previous Section]" border="0"></a>
<a href="#HowtheDeviceUsesRegs"><img src="HW%20activities_files/NEXT.GIF" alt="[Next Section]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut23.html"><img src="HW%20activities_files/FF.GIF" alt="[Next Chapter]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/INDEX.html"><img src="HW%20activities_files/INDEX.GIF" alt="[Index]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.html"><img src="HW%20activities_files/HELP.GIF" alt="[Help]" border="0"></a>
</p><p></p><hr><p>
</p><h3>
16.2.1&nbsp;&nbsp;&nbsp;&nbsp;How a Device Driver Accesses Device Registers
</h3>
<p>
<a name="nx_id_698"></a>
Alpha CPU platforms vary in the mechanisms available to access
device registers.
Some platforms, such as the DEC 4000 and DEC 7000 series, use the
mailbox mechanism.
Other platforms, such as the DEC 3000 series, allow ``direct'' access to
device registers through special address spaces.
The following discussion applies to those platforms that use special
address spaces.
</p><p>
Alpha CPUs can access longwords (32 bits) and quadwords (64 bits)
atomically.
However, many devices have CSRs that are only 16- or 8-bits wide.
Program fragments accessing those CSRs will actually be sequences of
Alpha instructions that fetch longwords and mask out bytes.
For example, for adjacent 16-bit CSRs this longword access is probably
not what is intended.
The fetch of the longword may result in the reading of multiple CSRs,
with unwanted side effects.
<a name="HowtheDeviceUsesRegs"></a>
</p><p></p><hr><p align="center">
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digital_UNIX_Bookshelf.html"><img src="HW%20activities_files/BOOKSHELF.GIF" alt="[Return to Library]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/TOC.html"><img src="HW%20activities_files/TOC.GIF" alt="[Contents]" border="0"></a>
<a href="#HWComponents"><img src="HW%20activities_files/REW.GIF" alt="[Previous Chapter]" border="0"></a>
<a href="#HowDrvAccessDevReg"><img src="HW%20activities_files/PREV.GIF" alt="[Previous Section]" border="0"></a>
<a href="#HowDrvInterptsCPU"><img src="HW%20activities_files/NEXT.GIF" alt="[Next Section]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut23.html"><img src="HW%20activities_files/FF.GIF" alt="[Next Chapter]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/INDEX.html"><img src="HW%20activities_files/INDEX.GIF" alt="[Index]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.html"><img src="HW%20activities_files/HELP.GIF" alt="[Help]" border="0"></a>
</p><p></p><hr><p>
</p><h3>
16.2.2&nbsp;&nbsp;&nbsp;&nbsp;How a Device Uses the Registers
</h3>
<p>
<a name="nx_id_699"></a>
Devices use their registers to report status and to return data.
DMA devices can move data to or from memory directly.
DMA device drivers typically request this type of data transfer by:
</p><ul>
<p></p><li>
Writing a base address and a count of characters
in the device register to specify what data to move
<p></p></li><li>
Setting a bit that requests that the transfer begin
</li></ul><p>
The device requests access to memory and then manages a sequence of data
transfers to memory.
Upon completion of the transfer, the device:
</p><ul>
<p></p><li>
Sets a bit indicating that the transfer is done
<p></p></li><li>
Issues an interrupt
</li></ul><p>
You do not need to know the details of how the
device and the bus interact to handle these transfers of data.
However, you do need to know the exact register fields to use to make
the request.
This information should be in the hardware manual for the device.
<a name="HowDrvInterptsCPU"></a>
</p><p></p><hr><p align="center">
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digital_UNIX_Bookshelf.html"><img src="HW%20activities_files/BOOKSHELF.GIF" alt="[Return to Library]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/TOC.html"><img src="HW%20activities_files/TOC.GIF" alt="[Contents]" border="0"></a>
<a href="#HWComponents"><img src="HW%20activities_files/REW.GIF" alt="[Previous Chapter]" border="0"></a>
<a href="#HowtheDeviceUsesRegs"><img src="HW%20activities_files/PREV.GIF" alt="[Previous Section]" border="0"></a>
<a href="#PartsofKernAccesHard"><img src="HW%20activities_files/NEXT.GIF" alt="[Next Section]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut23.html"><img src="HW%20activities_files/FF.GIF" alt="[Next Chapter]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/INDEX.html"><img src="HW%20activities_files/INDEX.GIF" alt="[Index]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.html"><img src="HW%20activities_files/HELP.GIF" alt="[Help]" border="0"></a>
</p><p></p><hr><p>
</p><h3>
16.2.3&nbsp;&nbsp;&nbsp;&nbsp;How a Device Driver Interrupts the CPU
</h3>
<p>
<a name="nx_id_700"></a>
The specifics of how interrupts are generated varies from bus to bus and
even from CPU architecture to CPU architecture.
The following is a general description of how interrupts are processed
by the kernel on some systems.
The important point to remember is that the end result of an interrupt
is the calling of the device driver's interrupt handler.
</p><p>
When a device generates an interrupt, it also provides an interrupt
index.
This interrupt index is passed by the bus to the kernel assembly language
interface that does initial handling of interrupts.
That interface uses the interrupt index to determine which entry in the
interrupt vector table contains the address of the interrupt handler for
the device driver that handles this device.
Among other things, the assembly language interface uses that address
to transfer control to the appropriate driver.
Calling the
<tt>handler</tt>
interfaces to dynamically register the interrupt handlers
for a driver causes the
interrupt handlers to be added to this table. 
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut5.html#SpecMethodforRegIntrptHand">Section 2.4</a>
describes the methods for registering device interrupt handlers.
<a name="PartsofKernAccesHard"></a>
</p><p></p><hr><p align="center">
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/Digital_UNIX_Bookshelf.html"><img src="HW%20activities_files/BOOKSHELF.GIF" alt="[Return to Library]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/TOC.html"><img src="HW%20activities_files/TOC.GIF" alt="[Contents]" border="0"></a>
<a href="#HWComponents"><img src="HW%20activities_files/REW.GIF" alt="[Previous Chapter]" border="0"></a>
<a href="#HowDrvInterptsCPU"><img src="HW%20activities_files/PREV.GIF" alt="[Previous Section]" border="0"></a>
<img src="HW%20activities_files/BLANK.GIF" border="0">
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/drivertut23.html"><img src="HW%20activities_files/FF.GIF" alt="[Next Chapter]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/AA-PUBVD-TE_html/INDEX.html"><img src="HW%20activities_files/INDEX.GIF" alt="[Index]" border="0"></a>
<a href="http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/HTML/HELP.html"><img src="HW%20activities_files/HELP.GIF" alt="[Help]" border="0"></a>
</p><p></p><hr><p>
</p><h2>
16.3&nbsp;&nbsp;&nbsp;&nbsp;Parts of the System Accessing Hardware
</h2>
<p>
Only two parts of the system access hardware:
</p><ul>
<p></p><li>
The bus support subsystem
<p>
There are specific bus support interfaces that access the device
registers of the bus adapter.
<a name="nx_id_701"></a>
</p><p></p></li><li>
The device driver subsystem
<p>
There are specific device driver interfaces that access the device
registers of specific devices
attached to a controller.
</p></li></ul><p>
<a name="nx_id_702"></a>
<!--Metrics Tag -->
 <!-- Updated April 22, 2003 --> 
<!-- SiteCatalyst code version: G.0. w/dev site filtering
Copyright 1997-2003 Omniture, Inc. More info available at
http://www.omniture.com --><script language="JavaScript"><!--
/* Specify the Report Suite ID(s) to track here */
var s_account="HPHQGlobal,hphqWWesg,hphqbcs,hphqtru64"
/* Dynamic Report Suite ID Selection Config */
var s_dynamicAccountSelection = true
var s_dynamicAccountList = "hphqwwtrash=dec.com,cpqcorp.net,hpqcorp.net"
/* You may give each page an identifying user friendly name in place of urls. */
var s_pageName="Tru64-" + document.title;
if ( location.pathname.indexOf('/docs' ) != -1 )         { s_pageName = "Tru64-docs-" + document.title; }

/* Regionally assigned variables. */
var s_server=""
var s_channel=""
var s_pageType=""
var s_prop1="Tru64 UNIX"
if ( location.pathname.indexOf('/docs' ) != -1 )         { s_prop1 = "Tru64 documentation"; }
var s_prop2 = "";

   if ( location.search.indexOf('?jumpid=' ) != -1 )
        {
        s_prop2=location.search.substring((location.search.indexOf('?jumpid=' )+8),(location.search.length));
        }
			else
		{ 
		if (location.search.toUpperCase().indexOf('?' ) != -1 )        {
		s_prop2=location.search.toUpperCase().substring((location.search.toUpperCase().indexOf('?' )+1),(location.search.length));
		}
		}
var s_prop6=""
var s_prop7="w1"
var s_prop8="en-us"
var s_prop9="enterprise"
var s_prop10="w1|en-us|enterprise"
var s_prop13="HPHQGlobal,hphqWWesg,hphqbcs,hphqtru64"


/************************ ADDITIONAL FEATURES ************************
     Plugins
*/
/************************** CONFIG SECTION **************************/
/* You may add or alter any code config here.                       */
var s_charSet=""
// Netscape 4.X on Unix uses EUC-JP instead of SHIFT-JIS
if ((navigator.appName.indexOf('Netscape')>=0)&&
    (parseInt(navigator.appVersion)<=4)&&
    (navigator.userAgent.toLowerCase().indexOf('win')<0)&&
    (navigator.userAgent.toLowerCase().indexOf('mac')<0)) {
	s_charSet="EUC-JP"
}
/* E-commerce Config */
var s_eVarCFG=""

/* Link Tracking Config */
var s_trackDownloadLinks=true
var s_trackExternalLinks=true
var s_trackInlineStats=true
var s_linkDownloadFileTypes="exe,zip,wav,mp3,mov,mpg,avi,doc,pdf,xls,cgi,dot,pot,ppt,wmv,cgi,asx,tar,rpm,gz,crypt,sh"
var s_linkInternalFilters="hp,compaq,javascript:"
var s_linkLeaveQueryString=true


/********* INSERT THE DOMAIN AND PATH TO YOUR CODE BELOW ************/
//--></script><script language="JavaScript" src="HW%20activities_files/s_code.js"></script><img src="HW%20activities_files/s52479039338643.gif" name="s_i_hphqglobal" border="0" height="1" width="1">
<!-- End SiteCatalyst code version: G.0. -->

<!--End Tag -->
</p></body></html>

⌨️ 快捷键说明

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