自動(dòng)化專業(yè)畢業(yè)論文外文翻譯--輸入輸出訪問(wèn)_第1頁(yè)
已閱讀1頁(yè),還剩13頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、<p><b>  附錄A:英文資料</b></p><p>  Input/Output Accessing</p><p>  In this article, we will look at the three basic methods of I/O accessing - programmed I/O, interrupt-driven I/O,

2、and direct memory access (DMA). The key issue that distinguishes these three methods is how deeply the processor is involved in I/O operations. The discussion emphasizes interrupt-driven I/O, because it is based on the c

3、oncept of interrupt handling, which is a general problem that goes beyond Input/Output operations. The study of interrupt handling also aids in understanding the gene</p><p>  Addressing I/O Registers </p

4、><p>  Input/Output devices communicate with a processor through Input/Output ports. Through the input ports, s processor receives data from the I/O devices. Through the output ports, a processor sends data to

5、the I/O devices. Each I/O port consists of a small set of registers, such as data buffer registers (the input buffer and/or the output buffer), the status register, and the control register. The processor must have some

6、means to address these registers while communicating with them. There are two</p><p>  1.Memory-Mapped I/O</p><p>  Memory-mapped I/O maps the I/O registers and main memory into a unified addre

7、ss space in the computer system. I/O registers share the same address space with main memory, but are mapped to a specific section that is reserved just for I/O. Thus, the I/O register can be addressed in ordinary memory

8、 reference instructions as if they are part of the main memory locations. There are no specially designed I/O instructions in the instruction set of the system. Any instruction that references a location</p><p

9、>  2.Direct I/O</p><p>  The method of addressing I/O registers directly without sharing the address space with the main memory is called direct I/O or I/O-mapped I/O. In other words, I/O registers are n

10、ot mapped to the same address space with the main memory. Each I/O register has an independent address space. As a result, instructions that reference the main memory space cannot be used for Input/Output. In the instruc

11、tion set of the computer system, special I/O instructions must be designed for I/O operations. In thes</p><p>  We can compare memory-mapped I/O and the direct I/O and the direct I/O as follows:</p>&

12、lt;p>  ●Memory-mapped I/O uses ordinary memory reference instructions to access I/O, so it provides flexibility for I/O programming and simplifies I/O software. Direct I/O does not provide any flexibility in I/O prog

13、ramming, since only a small set of special I/O instructions are allowed to reference I/O registers.</p><p>  ●for memory-mapped I/O, the processor uses the same address lines to access all the addressable I

14、/O registers and the same data lines to send/receive data to/form these registers. This simplifies the connection between I/O port and the processor, and thus leads to a low-cost hardware design and implementation. For d

15、irect I/O, the connection between I/O ports and the processor may be more expensive. This is because either (1) special hardware is needed to implement separate I/O address lines or </p><p>  ● In spite of

16、 the advantage of using ordinary memory reference instructions to access I/O registers, memory-mapped I/O may complicate the control unit design in regards to the implementation of I/O-related instructions. This is becau

17、se usually the I/O bus cycles need to be longer than the equivalent memory bus cycles, and this means that the design of different timing control logic is required. This can be used to explain why memory-mapped I/O benef

18、its programmers, but not electronics engineer</p><p>  ●Direct I/O addressing has another advantage over memory-mapped I/O in that low-level debugging on a differentiated addressing system may be easier, be

19、cause break-points or error traps can be imposed more generally.</p><p>  ●with memory-mapped I/O, I/O registers share the same address space with main memory; hence, the memory space available for programs

20、 and data is reduced. For direct I/O addressing, I/O does not share memory space with main memory, and a single contiguous memory space can be maintained and used by programmers.</p><p>  Programmed I/O</

21、p><p>  Programmed I/O requires that all data transfer operations be put under the complete control of the processor when executing programs. It is sometimes called polling, because the program repeatedly polls

22、 (checks) the status flag of an I/O device, so that its input/output operation can be synchronized with the processor. A general flowchart of such a program is shown in Figure 1. The program continuously polls the status

23、 of an I/O device to find out whether (1) data is available in the input buffe</p><p>  The operational mode lf programmed I/O stated above is characterized by the busy waiting loop of the program, during wh

24、ich the processor spends time polling an I/O device. Because of the dedication of the processor to a single task, this mode of programmed I/O is called dedicated polling or spin polling. Although dedicated polling is hig

25、hly inefficient, sometimes it is necessary and even unavoidable. In a particular case, if an urgent event needs an immediate response without delay, then dedicat</p><p>  Another mode of operation of program

26、med I/O is called intermittent polling or timed polling. In this mode, the processor may poll the device at a regular timed interval, which can be expected or prescheduled. Such a device can be found in many embedded sys

27、tems where a special-purpose computer is used for process control, data acquisition, environmental monitoring, traffic counting, etc. these devices, which measure, collect, or record data, are usually polled periodically

28、 in a regular schedule d</p><p>  Interrupt-Driven I/O </p><p>  Interrupt-driven I/O is a means to avoid the inefficient busy-waiting loops, which characterize programmed I/O. Instead of waitin

29、g while the I/O device is busy doing its job of input/output, the processor can run other programs. When the I/O device completes its job and its status becomes “available”, it will issue an interrupt request to the proc

30、essor, asking for CPU service. In response, the processor suspends whatever it is currently doing, in order to attend to the needs of that I/O device.</p><p>  In respond to an interrupt request, the process

31、or will first save the contents of both the program counter and the status register for the running program, and then transfer the control to the corresponding interrupt service routine to perform the required data input

32、/output operation. When the interrupt service routine has completed its execution and if no more interrupt requests are pending, the processor will resume the execution of the previously interrupted program and restore t

33、he contents o</p><p>  If multiple interrupt requests are issued by different devices at the same time, the processor should have some means to identify the interrupt sources and handle their interrupt reque

34、sts by some policy, typically by priority. Only one request with the highest priority can be serviced at the current time, while all others are put into a waiting queue. Upon the completion of the service performed by an

35、 interrupt service routine, the processor should search the waiting queue for all the pending in</p><p>  Direct Memory Access</p><p>  Although interrupt I/O is more efficient than the programm

36、ed I/O, it still suffers from a relatively high overhead with respect to handling the interrupt. This overhead includes resolving the conflict among multiple interrupt requests, saving and restoring the program contexts,

37、 pooling for interrupt identification, branching to/from the interrupt service routine, etc. Using an interrupt is a wasteful activity that can take several microseconds to complete.</p><p>  Direct memory a

38、ccess (DMA) is a method that can input/output a block of data directly to/form main memory with a speed of one data item per memory cycle, without continuous involvement of the processor. The entire process is implemente

39、d by the hardware of a DMA controller, which takes the place of the processor and communicates directly with main memory. As a result, the block diagram of the computer system changes form processor-centered to memory-ce

40、ntered. Hence, from the viewpoint of I/O proc</p><p>  The DMA controller can work in two different modes. Normally, it works concurrently with the processor, competing for individual memory bus cycles to in

41、put/output successive words of a data block. If the I/O speed is not very high, the memory accesses by the processor and the DMA controller can be interwoven. Time is accrued on a cycle-by-cycle basis. Neither the proces

42、sor nor the DMA controller can continuously use all the memory bus cycles during any time interval. This operational mode of the</p><p>  The following registers are necessary for the DMA to transfer a block

43、 of data:</p><p>  ● Data buffer register (DBR) - it can be implemented as two registers, one for input and the other for output, or even a set of registers comprising a data storage buffer.</p><

44、p>  ● DMA address register (DAR) - used to store the starting address of the memory buffer area where the block of data is to be read or written.</p><p>  ● Word counter (WC) - the contents specify the

45、number of words in the block of data remaining to be transferred and it is automatically decremented after each word is transferred.</p><p>  ● Control/status register (CSR) - used by the processor to send

46、control information to the DMA controller and to collect the statuses and error information of the DMA controller and the I/O devices attached to it.</p><p>  Using these registers, the DMA controller knows

47、the addresses of the source and destination data blocks, as well as the quantity of data to be transferred. Once the DMA controller acquires the memory bus, the block transfer operation can be performed autonomously usin

48、g the information contained in these registers, without the continuous involvement of the processor.</p><p>  Besides the above-listed registers, the DMA controller should contain the control logic of a bus

49、request facility, which performs bus arbitration using the signals of DMA request (DMAR) and DMA acknowledge (DMAA). Bus arbitration is the process of resolving the contention among multiple concurrently operating DMA co

50、ntrollers for acquisition of the memory bus. The selection of the bus master is usually based on the priorities of various DMD devices. Among different DMA devices, the priority order</p><p>  Although the t

51、ransfer of the data block is performed by the DMA without involvement of the processor, the overall operation of the DMA controller is still determined by the CPU via interrupts. It serves two purposes as follows: (1) Be

52、fore the DMA controller starts the data transfer, all the registers must be initialized by the processor. (2) When the DMA finishes a block transfer operation, it should inform the processor of completion by issuing an i

53、nterrupt, which allows the processor to post-p</p><p>  DNA relieves the processor form the burden of I/O function, except for the initialization of the transfer of parameters and the post-processing of data

54、. It is very efficient when serving high-speed I/O devices. However, the role of DMA is not limited to the area of input/output. In contemporary computer systems, DMA has been developed into a general technique of time-s

55、haring the main memory bandwidth between I/O subsystem processing and CPU processing. In the I/O subsystem, high-speed I/O device</p><p>  附錄B:英文資料翻譯</p><p><b>  輸入/輸出訪問(wèn)</b></p>

56、;<p>  在這一篇文章中,我們將會(huì)研究三種基本的輸入/輸出訪問(wèn)方法:程控I/O、中斷驅(qū)動(dòng)I/O以及直接存儲(chǔ)器訪問(wèn)(DMA)。 區(qū)別這三個(gè)方法的關(guān)鍵問(wèn)題是處理器以怎樣的深度介入I/O操作。討論的重點(diǎn)是中斷驅(qū)動(dòng)I/O,這是因?yàn)樗幕A(chǔ)是中斷處理概念,而這是一個(gè)超過(guò)輸入輸出操作之外的普遍性問(wèn)題。學(xué)習(xí)中斷</p><p>  處理也有助于了解異常事件處理這一普遍性概念,其重要性不但有關(guān)I/O,而且有關(guān)計(jì)

57、算機(jī)與其他系統(tǒng)控制函數(shù)的接口。 </p><p><b>  I/O寄存器的尋址</b></p><p>  輸入/ 輸出設(shè)備經(jīng)過(guò)輸入/ 輸出端口與一個(gè)處理機(jī)通信。經(jīng)過(guò)輸入端口,處理器接受來(lái)自輸入/輸出裝置的數(shù)據(jù)。經(jīng)過(guò)輸出端口,處理器送數(shù)據(jù)給輸入/輸出裝置。每個(gè)輸入/輸出端口包含一個(gè)小的寄存器組, 如數(shù)據(jù)緩沖寄存器 (輸入緩沖器和/或輸出緩沖器)、狀態(tài)寄存器和控制寄存

58、器。處理器必須有某種方法尋</p><p>  址這些寄存器,同時(shí)與它們通信。尋址輸入/輸出寄存器有存儲(chǔ)器映射輸入/輸出和直接輸入/輸出兩種方法。 </p><p>  1.存儲(chǔ)器映射的輸入/輸出</p><p>  存儲(chǔ)器映射的輸入/輸出將輸入/輸出寄存器和存儲(chǔ)器一起映射到計(jì)算機(jī)系統(tǒng)的統(tǒng)一的住址空間。輸入/輸出寄存器共享主存儲(chǔ)器的同一個(gè)地址空間, 但是被映射到一個(gè)

59、特定的專為輸入/輸出預(yù)留的存儲(chǔ)器區(qū)段。因此,輸入/輸出寄存器能在普通的存儲(chǔ)器訪問(wèn)指令中得到尋址,好像它們就是主存儲(chǔ)器位置的一部份。在計(jì)算機(jī)的指令系統(tǒng)中沒(méi)有專門設(shè)計(jì)的 輸入/輸出指令。任何訪問(wèn)這一地區(qū)中某個(gè)位置的指令便是一條輸入/輸出指令。任何的一條可以指定存儲(chǔ)器地址的指令都可以執(zhí)行輸入/輸出操作。摩托羅拉 MC68000 就是使用這種尋址方法的計(jì)算機(jī)系統(tǒng)的一個(gè)例子。</p><p>  2. 直接輸入/輸出&

60、lt;/p><p>  直接地向輸入/輸出寄存器尋址而不和主存儲(chǔ)器共享地址空間的尋址方法叫做直接輸入/輸出或輸入/輸出映射輸入/輸出。換句話說(shuō),輸入/輸出寄存器不和主存儲(chǔ)器映射到同一個(gè)地址空間。每個(gè)輸入/輸出寄存器有一個(gè)獨(dú)立的地址空間。其結(jié)果是:訪問(wèn)主存儲(chǔ)器空間的指令不能夠作用于輸入/輸出。在計(jì)算機(jī)系統(tǒng)的指令系統(tǒng)中,必須為輸入/輸出操作 設(shè)計(jì)專門的指令。在這些輸入/輸出指令中,必須用各自不同的標(biāo)號(hào)來(lái)尋址不同的輸入/輸

61、出交換通道。它們被稱作端口號(hào)。輸入/輸出端口的輸入/輸出寄存器連接到系統(tǒng)輸入/輸出總線上,處理器經(jīng)過(guò)它可以直接訪問(wèn)輸入/輸出寄存器向 / 從輸入/輸出裝置發(fā)送 / 接收數(shù)據(jù)。使用端口號(hào)的方式和使用存儲(chǔ)器地址的方式相同,但不同的是端口號(hào)不是來(lái)自主存儲(chǔ)器的同一地址。 Pentium 是使用直接輸入/輸出尋址法的計(jì)算機(jī)系統(tǒng)的例子。它有 64 GB 存儲(chǔ)地址空間 (32 位住址),同時(shí),還有一個(gè) 64 KB 輸入/輸出地址空間 (16 位輸入/

62、輸出住址/ 端口號(hào))。</p><p>  我們能依下列各項(xiàng)比較存儲(chǔ)器映射輸入/輸出和直接輸入/輸出::</p><p>  ● 存儲(chǔ)器映射輸入/輸出使用普通的存儲(chǔ)器訪問(wèn)指令訪問(wèn)輸入/輸出,因 </p><p>  此它提供輸入/輸出編程的靈活性,并簡(jiǎn)化輸入/輸出軟件。直接輸入/ </p><

63、;p>  輸出不具備輸入/輸出編程的靈活性,因?yàn)橹挥幸粋€(gè)小的特殊輸入/輸</p><p>  出指令被允許訪問(wèn)輸入/輸出寄存器。</p><p>  ● 有存儲(chǔ)器映射輸入/輸出時(shí),處理器使用相同的住址線訪問(wèn)所有的可尋 </p><p>  址輸入/輸出寄存器和用相同的數(shù)據(jù)線向 / 從這些寄存器發(fā)送 / 接收數(shù)據(jù)。這樣簡(jiǎn)化了輸入/輸出端口和處理器之間的連接

64、,因而導(dǎo)致廉價(jià)的硬件設(shè)計(jì)和實(shí)現(xiàn)。對(duì)于直接輸入/輸出,輸入/輸出端口和處理器之間的連接可能成本比較高。 這是因?yàn)樾枰獙iT的硬件實(shí)現(xiàn)分開的輸入/輸出住址線,或者當(dāng)存儲(chǔ)器地址線用于輸入/輸出的時(shí)候,需要一個(gè)特殊的標(biāo)志來(lái)指出所要求的住址是為了輸入/輸出操作的。</p><p>  ● 盡管使用普通的存儲(chǔ)器訪問(wèn)指令訪問(wèn)輸入/輸出寄存器有它的優(yōu)點(diǎn),但 </p><p>  存儲(chǔ)器映射輸入/輸出可能

65、會(huì)使控制器的設(shè)計(jì)較復(fù)雜一些,這涉及與輸 </p><p>  入/輸出相關(guān)的指令的實(shí)現(xiàn)。這是因?yàn)橥ǔ]斎耄敵隹偩€周期比較等</p><p>  價(jià)的存儲(chǔ)器總線周期要長(zhǎng)一些,需要循環(huán),而這意味著需要設(shè)計(jì)不同的</p><p>  時(shí)序控制邏輯。這能用來(lái)解釋為什么存儲(chǔ)器映射輸入/輸出有利于程序</p><p>  設(shè)計(jì)師, 但是不是電子學(xué)工程

66、師。</p><p>  ● 直接輸入/輸出尋址有另一個(gè)高于存儲(chǔ)器映射輸入/輸出的優(yōu)點(diǎn),即低 </p><p>  級(jí)程序調(diào)試在用分開尋址系統(tǒng)中可能要更容易些, 因?yàn)閿帱c(diǎn)和錯(cuò)誤陷阱的設(shè)置比較通用。</p><p>  在存儲(chǔ)器映射輸入/輸出中,輸入/輸出寄存器和主存儲(chǔ)器共享同一地 </p><p>  址空間, 因此,程序和數(shù)據(jù)可以使用的

67、存儲(chǔ)空間就減少了。對(duì)于直接 </p><p>  輸入/輸出尋址,輸入/輸出不用和主存儲(chǔ)器共享存儲(chǔ)空間,可以維持</p><p>  一個(gè)單獨(dú)的連續(xù)存儲(chǔ)空間給程序員使用。</p><p><b>  程控輸入/輸出</b></p><p>  程控輸入/輸出需要全部數(shù)據(jù)操作處于處理機(jī)執(zhí)行程序的完全控制之下。因?yàn)槌绦蛑?/p>

68、復(fù)地巡查 (檢查) 一個(gè)輸入/輸出裝置的狀態(tài)標(biāo)志,所以有時(shí)它被稱為巡查,而且它的輸入/ 輸出操作能與處理器同步。程序不斷地巡查一個(gè)輸入/輸出裝置的狀態(tài),以發(fā)現(xiàn)數(shù)據(jù)是否是已在輸入緩沖中或輸出裝置有沒(méi)有為接收從來(lái)自處理器的數(shù)據(jù)做好準(zhǔn)備。 如果狀態(tài)顯示 " 已備好 " ,則程序?qū)?zhí)行一條數(shù)據(jù)傳輸指令以完成該輸入/輸出操作;否則,輸入/輸出裝置的忙碌狀態(tài)將會(huì)強(qiáng)迫程序在一個(gè)忙碌等待回路中循環(huán),直到狀態(tài)變成“已備好”為止。這樣一

69、個(gè)如此不斷地巡查“數(shù)據(jù)已備好“狀態(tài) (對(duì)于輸入) 或巡查“設(shè)備已備好“狀態(tài) (對(duì)于輸出),它形成程控輸入/輸出的典型程序結(jié)構(gòu)。正是這個(gè)浪費(fèi)時(shí)間的忙碌等待回路消耗處理機(jī)時(shí)間,而造成程控輸入/輸出效率很低。處理器必須連續(xù)的介入整個(gè)的輸入/輸出過(guò)程當(dāng)中。在這一時(shí)間間隔內(nèi),處理器不能夠運(yùn)行任何的有用計(jì)算, 而僅服務(wù)于單獨(dú)一個(gè)輸入/輸出裝置。對(duì)于某些慢速輸入/輸出裝置, </p><p>  這一忙碌等待回路的時(shí)間可能很長(zhǎng)

70、,足夠處理機(jī)在輸入/輸出事件發(fā)生之前,運(yùn)行數(shù)以百萬(wàn)計(jì)指令,如在鍵盤上的一次按鍵動(dòng)作。</p><p>  上面敘述的程控輸入/輸出操作模式是以程序的忙碌等待回路為特征的, 在它運(yùn)行時(shí)處理器花費(fèi)時(shí)間巡查一個(gè)輸入/輸出裝置。因?yàn)樘幚砥鲗W⒂谝粋€(gè)單一的作業(yè),這種程控輸入/輸出模式被稱為專注式巡查或回旋式巡查。雖然專注式巡查十分低效, 但是有時(shí)它是必需的,甚至是不可避免的。在一個(gè)特別的情形中,如果一件緊急的事件需要沒(méi)有延

71、遲立即響應(yīng),則用一臺(tái)專門的計(jì)算機(jī)做專注式巡查可能是最好的處理方法。一旦預(yù)期的事件發(fā)生, 處理器可以立刻反應(yīng)。舉例來(lái)說(shuō), 某些實(shí)時(shí)系統(tǒng) (如雷達(dá)回波處理系統(tǒng)) 需要對(duì)收入的數(shù)據(jù)極快的反應(yīng),甚至是一次中斷反應(yīng)都嫌太慢。在這樣的環(huán)境之下,只有專注式巡查回路才足夠應(yīng)付。</p><p>  程控輸入/輸出的另一個(gè)操作模式叫做間歇式巡查或定時(shí)巡查。在這一個(gè)模式中,處理器可在有規(guī)則的(預(yù)期的或事先規(guī)劃的)時(shí)間間隔巡查設(shè)備。這

72、種設(shè)備在許多嵌入式系統(tǒng)中可以看到,其中一臺(tái)專用計(jì)算機(jī)用于過(guò)程控制、數(shù)據(jù)采集、環(huán)境監(jiān)測(cè)、流量計(jì)數(shù)等。這些設(shè)備量測(cè)、收集或記錄數(shù)據(jù),通常是按照有規(guī)則的時(shí)間表進(jìn)行周期性的巡查,其規(guī)劃由應(yīng)用對(duì)象的需要決定。這種間歇式巡查方法可以有助于節(jié)省回旋式巡查所浪費(fèi)的時(shí)間,并且避免中斷處理的復(fù)雜性。然而應(yīng)該注意,間歇式巡查可能不適用某些特別的情形, 只有一個(gè)裝置被巡查而正確的</p><p>  巡查又一定要借助一個(gè)由中斷驅(qū)動(dòng)的時(shí)鐘

73、才能得到。在這種情況使用定時(shí)巡查只能是簡(jiǎn)單的交替一次又一次中斷需求。</p><p>  中斷驅(qū)動(dòng)輸入/輸出 </p><p>  中斷驅(qū)動(dòng)輸入/輸出是一種能避免程控輸入 / 輸出特有的低效忙碌等待回路的方法。當(dāng)輸入 / 輸出設(shè)備忙于它的輸入輸出作業(yè)時(shí),處理機(jī)不是等待,而是可以運(yùn)行其他的程序。當(dāng)輸入/輸出設(shè)備完成它的作業(yè)而使其狀態(tài)變?yōu)椤耙褌浜谩?lt;/p><p>

74、;  時(shí),它將向處理機(jī)發(fā)出一個(gè)中斷請(qǐng)求,要求CPU的服務(wù)。作為響應(yīng),處理機(jī)掛起它正在做的任何工作,以便照顧該輸入 / 輸出設(shè)備的需要。</p><p>  為了響應(yīng)中斷請(qǐng)求, 處理器將會(huì)首先為正在運(yùn)行中的程序保存好程序計(jì)數(shù)器和狀態(tài)計(jì)數(shù)器的內(nèi)容,然后轉(zhuǎn)移控制到對(duì)應(yīng)的中斷服務(wù)程序,以執(zhí)行要求的輸入/輸出操作。當(dāng)中斷服務(wù)程序已經(jīng)執(zhí)行完畢時(shí),如果沒(méi)有更多的中斷請(qǐng)求在等待,處理器將恢復(fù)狀態(tài)寄存器和程序計(jì)數(shù)器的內(nèi)容,恢復(fù)執(zhí)行

75、原先被中斷的程序。處理器的硬件應(yīng)該在每條指令執(zhí)行結(jié)束時(shí) 檢查中斷請(qǐng)求信號(hào)。如果有多個(gè)裝置同時(shí)發(fā)行它們的中斷請(qǐng)求,處理器必須利用某些方法選擇哪一個(gè)首先服務(wù), 然后再根據(jù)優(yōu)先權(quán)的次序逐個(gè)的服務(wù)所有其他的中斷請(qǐng)求。只有當(dāng)所有的中斷請(qǐng)求都已得到服務(wù),CPU 才返回被中斷的用戶程序。這樣,處理器能并發(fā)的服務(wù)于多個(gè)輸入/輸出裝置,而且用較多的時(shí)間做有用的工作, 而不去運(yùn)行一個(gè)忙碌等待回路為單 個(gè)裝置服務(wù)。因此,中斷驅(qū)動(dòng)輸入 / 輸出在處理慢速和中

76、速輸入 / 輸出/設(shè)備方面是很有效的。此外,中斷的觀念可以被推廣到處理任何由硬件或軟件從內(nèi)部或外部產(chǎn)生的事件。這一普遍性問(wèn)題稱為異常事件處理。 </p><p>  如果多個(gè)中斷請(qǐng)求有不同的設(shè)備同時(shí)發(fā)出,處理器應(yīng)該有某種方法識(shí)別中斷來(lái)源而且按照某種策略(典型的是按優(yōu)先權(quán))處理它們的中斷請(qǐng)求。現(xiàn)時(shí)只能有一個(gè)帶最高優(yōu)先權(quán)的請(qǐng)求可以得到服務(wù), 所有其它的請(qǐng)求都放入一個(gè)候補(bǔ)等待的隊(duì)伍之內(nèi)。在中斷服務(wù)程序執(zhí)行服務(wù)完畢,處理

77、器應(yīng)該搜索等待的隊(duì)列,找出所有正在等待中的舊的或新的中斷請(qǐng)求, 并按照優(yōu)先權(quán)逐個(gè)繼續(xù)為它們服務(wù),直到等待的隊(duì)伍變空為止。 只有當(dāng)所有等待著的中斷請(qǐng)求都已經(jīng)得到服務(wù),才會(huì)喚回被中斷的用戶程序。 雖然這一個(gè)情形包含了多個(gè)中斷請(qǐng)求, 但是它仍然是一個(gè)被單一化的情形。假定:所有的中斷服務(wù)程序一旦被處理器一個(gè)接一個(gè)的啟動(dòng),它們便必須完成而不再由中斷或所謂搶占發(fā)生。滿足這一假設(shè)的中斷過(guò)程稱為非搶占中斷。 在真實(shí)的環(huán)境中,中斷驅(qū)動(dòng)輸入/輸出的過(guò)程比

78、這個(gè)簡(jiǎn)化過(guò)程更為復(fù)雜。每個(gè)正在處理機(jī)中運(yùn)行的中斷服務(wù)程序可以被新來(lái)的中斷請(qǐng)求所搶占(中斷),只需它的優(yōu)先權(quán)比現(xiàn)有的優(yōu)先權(quán)高。這一個(gè)環(huán)境將會(huì)引起主程序和所</p><p>  有被要求的中斷服務(wù)程序之間有一個(gè)復(fù)雜的相互關(guān)系。允許中斷服務(wù)程序被較高優(yōu)先權(quán)的中斷服務(wù)程序所強(qiáng)占的中斷過(guò)程叫做搶占中斷。 </p><p><b>  直接存儲(chǔ)器訪問(wèn)</b></p>

79、<p>  雖然中斷驅(qū)動(dòng)輸入/輸出比被程控輸入/輸出有效率, 但是它仍然受限于較高的與中斷處理有關(guān)的開銷。這一開銷包括解決多個(gè)中斷請(qǐng)求之中的沖突、保存和恢復(fù)程序現(xiàn)場(chǎng)、用于中斷辨認(rèn)的巡查、中斷服務(wù)程序的來(lái)回轉(zhuǎn)移等。使用中斷是一個(gè)浪費(fèi)的活動(dòng),它費(fèi)時(shí)好幾個(gè)微秒才能完成。</p><p>  直接存儲(chǔ)器訪問(wèn)(DMA) 是一個(gè)向 / 從主存儲(chǔ)器直接輸入輸出字塊的方法,速度是每一存儲(chǔ)周期一個(gè)數(shù)據(jù)項(xiàng),而無(wú)需處理機(jī)的

80、連續(xù)參與。整個(gè)過(guò)程由DMA控制器的硬件實(shí)現(xiàn), 它代替處理器而直接與主存儲(chǔ)器通信。結(jié)果,計(jì)算機(jī)系統(tǒng)的框圖由以處理機(jī)為中心變?yōu)橐源鎯?chǔ)器為中心。因此,從輸入/輸出處理的觀點(diǎn)來(lái)看,處理器不再是計(jì)算機(jī)的中心, 而只是一個(gè)伙伴,輸入/輸出子系統(tǒng)和它競(jìng)爭(zhēng)存儲(chǔ)器總線周期,向 / 從主存儲(chǔ)器輸入輸出數(shù)據(jù)。然而,DMA控制器是設(shè)計(jì)成</p><p>  以字塊交換數(shù)據(jù),因此,它能很好的和大容量高速度面向字塊的輸入/輸出裝置, 例如高

81、速磁盤通信網(wǎng)絡(luò),一起工作。.</p><p>  DMA控制器能在兩個(gè)不同的模式下工作。正常情況下,它與處理器并發(fā)的工作, 競(jìng)爭(zhēng)零星的存儲(chǔ)器總線周期,以輸入輸出一個(gè)字塊的連續(xù)的字。如果輸入/輸出速度不是很高,處理器的存儲(chǔ)器訪問(wèn)和DMA 控制器訪問(wèn)可以交叉進(jìn)行。時(shí)間可以在周期到周期的基礎(chǔ)上增加。在任何一個(gè)時(shí)間段,處理器或DMA控制器都不能連續(xù)的使用所有的存儲(chǔ)器總線周期。 DMA控制器的這一操作模式叫做周期竊取。如此

82、命名是因?yàn)檩斎耄敵鲎酉到y(tǒng)實(shí)質(zhì)上是從處理器“竊取”存儲(chǔ)器總線周期。這一個(gè)模式把直接內(nèi)存存取的存儲(chǔ)器訪問(wèn)整合在CPU活動(dòng)中,避免嚴(yán)重的打擾主要的處理任務(wù)。另一方面,對(duì)于更高的輸入/輸出傳輸率,直接內(nèi)存存取操作需要總線時(shí)間能安排在成塊的周期內(nèi),這稱為爆發(fā)。在存儲(chǔ)周期的爆發(fā)中,處理器完全地被排斥在存儲(chǔ)器訪問(wèn)之外。直接內(nèi)存存取控制器被給與主存儲(chǔ)器的排他性訪問(wèn),連續(xù)的輸入輸出數(shù)據(jù)字塊,其速度可以和存儲(chǔ)器速度相比較。直接內(nèi)存存取控制器的這一操作模式

83、被稱為字塊模式或爆發(fā)模式。為這一操作模式設(shè)計(jì)的直接內(nèi)存存取控制器通常結(jié)合一個(gè)數(shù)據(jù)存儲(chǔ)緩沖器,其容量至少與一個(gè)</p><p>  字塊相匹配。當(dāng)DMA控制器利用存儲(chǔ)器總線時(shí),它可以直接在它的數(shù)據(jù)存儲(chǔ)緩沖器和主存儲(chǔ)器之間交換一個(gè)字塊。</p><p>  下列各寄存器對(duì)于DMA 傳輸一個(gè)字塊是必要的: </p><p>  ● 數(shù)據(jù)緩沖寄存器 (DBR) ——它可以

84、實(shí)現(xiàn)為兩個(gè)寄存器, 一個(gè)用于輸 入,另一個(gè)用于輸出, 或者甚至于一個(gè)寄存器組,組成一個(gè)數(shù)據(jù)存儲(chǔ)</p><p><b>  緩沖器。</b></p><p>  ● DMA 地址寄存器 (DAR) —— 用來(lái)存放存儲(chǔ)器緩沖區(qū)(用來(lái)讀寫字 </p><p><b>  塊)的起始地址。 </b></p>

85、<p>  ● 字計(jì)數(shù)器 (WC) ——由它的內(nèi)容指定字塊中余下尚待傳輸?shù)淖謹(jǐn)?shù),每</p><p>  一個(gè)字傳輸以后字?jǐn)?shù)自動(dòng)減值。</p><p>  ● 控制 / 狀態(tài)寄存器 (CSR)——處理器用來(lái)發(fā)送控制信息給直接內(nèi)存存取控制器并且收集直接內(nèi)存存取控制器和它所連輸入/輸出裝置的狀態(tài)和出錯(cuò)信號(hào)。 </p><p>  利用這些寄存器,直接內(nèi)存

86、存取控制器能知道源字塊和目的字塊, 以及將要傳輸?shù)臄?shù)據(jù)量。一旦直接內(nèi)存存取控制器獲得了存儲(chǔ)器總線,便可以利用這些寄存器中包含的信息,自主地執(zhí)行字塊傳輸操作,而無(wú)需處理器的連續(xù)介入。</p><p>  在上列寄存器之外,直接內(nèi)存存取控制器還應(yīng)該包含總線請(qǐng)求設(shè)備的控制邏</p><p>  輯, 它利用直接內(nèi)存存取請(qǐng)求 (DMAR) 和直接內(nèi)存存取回答 (DMAA)信號(hào)執(zhí)行總線仲裁??偩€仲裁

87、是一個(gè)分解沖突的過(guò)程,用來(lái)解決多個(gè)并發(fā)請(qǐng)求之間產(chǎn)生的沖突,這些請(qǐng)求都想要操作直接內(nèi)存存取控制器以獲取存儲(chǔ)器總線??偩€主方的確定通常是基于不同的DMA 裝置具有的優(yōu)先權(quán)。在不同的直接內(nèi)存存取裝置之中,由裝置接收直接內(nèi)存存取服務(wù)的緊迫程度,也就是它們的速度需求,來(lái)安排優(yōu)先權(quán)次序。為直接內(nèi)存存取裝置進(jìn)行總線仲裁有兩個(gè)方法——集中式和分布式,它們和利用中斷請(qǐng)求 (INTR) 和中斷應(yīng)答 (INTA)信號(hào)以辨認(rèn)中斷源的方法是相似的。</p&

88、gt;<p>  雖然直接內(nèi)存存取執(zhí)行字塊傳輸沒(méi)有處理機(jī)參加, 但是直接內(nèi)存存取控制器的總體操作仍然是由CPU 通過(guò)中斷來(lái)決定的。它有兩個(gè)目的:(1)在直接內(nèi)存存取控制器啟動(dòng)數(shù)據(jù)傳輸之前,所有的寄存器必須由處理器設(shè)定初值;(2) 當(dāng)直接內(nèi)存存取完成一個(gè)字塊傳輸操作時(shí),它應(yīng)該發(fā)出一個(gè)中斷告知處理器操作完成,以允許處理器在存儲(chǔ)器緩沖區(qū)進(jìn)行數(shù)據(jù)的后處理或者處理可能的錯(cuò)誤情況。 因此,直接內(nèi)存存取控制器時(shí)常發(fā)出中斷請(qǐng)求 (INTR

89、) 和接受中斷的回答 (INTA) 信號(hào)。</p><p>  DMA 減輕處理器在輸入/輸出功能上的負(fù)擔(dān),但叁數(shù)傳輸初始化和數(shù)據(jù)的后處理除外。當(dāng)服務(wù)高速的輸入/輸出裝置的時(shí)候,這是非常有效的。然而,直接內(nèi)存存取的作用并不限于輸入輸出區(qū)域。在現(xiàn)代的計(jì)算機(jī)系統(tǒng)中,直接內(nèi)存存取已經(jīng)發(fā)展為一個(gè)通用的技術(shù),它在輸入/輸出子系統(tǒng)處理和CPU 處理之間進(jìn)行主存儲(chǔ)器帶寬的分時(shí)。在輸入/輸出子系統(tǒng)中,高速的輸入/輸出裝置,像磁盤

90、,CD-ROM,DVD,圖像,視頻設(shè)備和高速網(wǎng)絡(luò)都要經(jīng)過(guò)直接內(nèi)存存取分享主主存儲(chǔ)器的帶寬。在中央處理和主存儲(chǔ)器范圍,運(yùn)行中的程序、操作系統(tǒng)以及動(dòng)態(tài)隨機(jī)存取儲(chǔ)存器的再生都要分享主存儲(chǔ)器帶寬。直接內(nèi)存存取是一個(gè)適當(dāng)?shù)姆椒▉?lái)實(shí)現(xiàn)這種分時(shí)。比較快速的16位Ultra DMA 現(xiàn)在已經(jīng)代替舊式的8位設(shè)備?,F(xiàn)在可用的商售直接內(nèi)存存取控制器芯片及已經(jīng)提供多個(gè)通道,允許并發(fā)的數(shù)據(jù)傳輸。例如,一個(gè)通道可以保留給動(dòng)態(tài)隨機(jī)存取儲(chǔ)存器再生,另外的一個(gè)通道能執(zhí)行

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 眾賞文庫(kù)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論