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

📄 8_5.htm

📁 浙江大学计算机学院计算机组成教材《计算机组成与设计》(潘学增)的课堂教学课件。
💻 HTM
📖 第 1 页 / 共 2 页
字号:
<html>

<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>I/O设备与存储器、CPU及操作系统的接口</title>
<meta name="Microsoft Theme" content="arcs 001">
</head>

<body stylesrc="buses总线.htm"><h2 align="center"><font color="#333333" size="6"><b>8.5&nbsp;   
I/O设备与存储器、CPU及操作系统的接口</b></font></h2>  
  
<p align="right"><font color="#333333"><b><a href="file:///K:/sysq/chapter8/index.htm"><img border="0" src="chapter1/images/back.gif" alt="第八章首页" width="60" height="45" align="left"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;        
<a href="8_4.htm"><img border="0" src="chapter1/images/prev.gif" alt="buses总线" width="60" height="45"></a></b></font></p>           
<p><a href="#一、概论" name="一"><b><font color="#0099FF" size="4">一、概论</font></b></a></p>         
<p><a href="#二、输入/输出设备编址方式"><b><font color="#0099FF" size="4">二、输入/输出设备编址方式</font></b></a></p>         
<p><a href="#三、输入输出接口"><b><font color="#0099FF" size="4">三、输入输出接口</font></b></a></p>         
<p><a href="#四、中断系统"><b><font color="#0099FF" size="4">四、中断系统</font></b></a></p>         
<p><a href="#五、DMA传送"><b><font color="#0099FF" size="4">五、DMA传送</font></b></a></p>         
<p><a name="一、概论"><b><font color="#333333" size="4">一、概论</font></b></a></p>         
<b>         
<font color="#333333" size="4">&nbsp;&nbsp;&nbsp; 总线协议虽然定义了一个字或块数据在一组信号线上的通信规范,但是,I/O设备与存储器、CPU实际上如何完成通信的问题未解决,例如:</font>            
</b>            
<p><font color="#333333" size="4"><b>&nbsp;&nbsp; 1、用户的I/O请求如何转换成设备命令和设备实现通信?</b></font></p>                            
<p><font color="#333333" size="4"><b>&nbsp;&nbsp; 2、数据在存储单元中如何传进传出?</b></font></p>                            
<p><font color="#333333" size="4"><b>&nbsp;&nbsp; 3、操作系统扮演了什么角色?</b></font></p>                            
<font color="#333333" size="4"><b>&nbsp;&nbsp; &nbsp; OS主要作用是处理机I/O,是作为硬件与请求I/O传送的程序的接口,OS的职责来自I/O系统的三类特征:</b></font>            
<p><font color="#333333" size="4"><b>&nbsp;&nbsp;&nbsp; 1、I/O系统由正使用CPU的多道程序分享;</b></font></p>                            
<p><font color="#333333" size="4"><b>&nbsp;&nbsp;&nbsp;          
2、I/O系统经常使用中断传输有关I/O操作的信息,中断使控制转为管态,必须由OS处理;</b></font></p>                           
<p><font color="#333333" size="4"><b>&nbsp;&nbsp;&nbsp; 3、I/O的低级控制很复杂,原因是要求管理一系列并发事件及对设备正确控制要求非常详细。</b></font></p>                            
<b>                            
<font color="#333333" size="4">&nbsp;&nbsp;&nbsp; 为此,OS必须提供下列四个功能:</font>            
</b>            
<p><font color="#333333" size="4"><b>&nbsp;&nbsp;&nbsp; 1、OS提供存储保护功能,用户程序不能直接执行I/O操作;</b></font></p>                            
<p><font color="#333333" size="4"><b>&nbsp;&nbsp;&nbsp; 2、对访问设备提供抽象功能,即提供提供能处理低级操作的I/O例程</b></font></p>                            
<p><font color="#333333" size="4"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 逻辑设备--物理设备控制由子例程实现</b></font></p>                            
<p><font color="#333333" size="4"><b>&nbsp;&nbsp;&nbsp; 3、中断处理功能,处理I/O设备产生的中断;</b></font></p>                            
<p><font color="#333333" size="4"><b>&nbsp;&nbsp;&nbsp; 4、为了提高增强系统吞吐率,OS要合理调度访问及对分享资源提供公正的访问;</b></font></p>                            
<b>                            
<font color="#333333" size="4">&nbsp;&nbsp;&nbsp; 为了实现有利于用户程序的这些功能,OS必须管理与I/O设备的通讯,要求有三类通讯:</font>            
</b>            
<p><font color="#333333" size="4"><b>&nbsp;&nbsp;&nbsp; 1、OS能提供I/O设备的如下的命令:读、写及其他控制命令,如seek;</b></font></p>                            
<p><font color="#333333" size="4"><b>&nbsp;&nbsp;&nbsp; 2、当完成了指定的操作,或遇到出错,I/O设备必须能通知OS;</b></font></p>                            
<p><font color="#333333" size="4"><b>&nbsp;&nbsp;&nbsp; 3、数据必须能在I/O和Memory之间传送。</b></font></p>                            
<b>                            
<font color="#333333" size="4">&nbsp; &nbsp; I/O系统的基本功能是:</font>             
</b>             
<p><font color="#333333" size="4"><b>&nbsp;&nbsp;&nbsp; 1、为数据传输操作选择输入设备;</b></font></p>                            
<p><font color="#333333" size="4"><b>&nbsp;&nbsp;&nbsp; 2、在选择的输入输出设备和CPU(或主存)之间交换数据</b></font></p>                            
<p><b><font color="#333333"><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;          
<a href="#一"></a></font></font>          
<font size="4">          
<a href="#一"><font color="#66CCFF">返回页首</font></a></font></b></p>                          
<p> </p>                          
<h3><a name="二、输入/输出设备编址方式"><b><font color="#333333" size="4">二、输入/输出设备编址方式</font></b></a></h3>                    
<p><b><font color="#333333" size="4">命令==&gt;I/O设备&nbsp;&nbsp;&nbsp;                              
命令传给哪个设备?</font></b></p>                             
<p><font color="#333333" size="4"><b>(1)要对I/O设备接口进行编址</b></font></p>                           
<blockquote>              
  <p><font color="#333333" size="4"><b>&nbsp;a、单独编址方式</b></font></p>              
  <blockquote>              
    <p><font color="#333333" size="4"><b>计算机系统专设输入输出指令,例如PC机</b></font></p>              
  </blockquote>              
</blockquote>              
<p><font color="#333333" size="4"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IN&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; AL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                              
PORT&nbsp;&nbsp;                              
;从外设PROT口读数据=>AL寄存器</b></font></p>                
<p><font color="#333333" size="4"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OUT&nbsp;&nbsp;&nbsp; PORT&nbsp;&nbsp;&nbsp;                              
AL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;                              
;输出,AL值=>外设PORT口</b></font></p>                
<blockquote>                
  <blockquote>                
    <p><font color="#333333" size="4"><b>特点是不占内存地址空间。</b></font></p>              
  </blockquote>              
<p><font color="#333333" size="4"><b>&nbsp; b、存储器统一编址memory mapping</b></font></p>                             
  <blockquote>                
    <blockquote>                
<p><font color="#333333" size="4"><b>不要专门I/O设备,但占用存储器地址空间。</b></font></p>                           
    </blockquote>              
  </blockquote>              
</blockquote>              
<p><font color="#333333" size="4"><b>(2)每个I/O设备都有一个控制接口,例如打印机接口,并行口。</b></font></p>                           
<p><font color="#333333" size="4"><b><img border="0" src="_derived/IO设备与存储器、CPU及操作系统的接口.htm_txt_11.gif" width="480" height="178"></b></font></p>                      
<p><font color="#333333" size="4"><b>每个寄存器给一个地址,称为口地址。</b></font></p>                      
<p><b><font color="#333333"><font size="4">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;          
<a href="#一"></a></font></font>          
<font size="4">          
<a href="#一"><font color="#66CCFF">返回页首</font></a></font></b></p>                          
<p> </p>                          
<h3><a name="三、输入输出接口"><b><font color="#333333" size="4">三、输入输出接口</font></b></a></h3>                    
<p><font color="#333333" size="4"><b><img border="0" src="_derived/IO设备与存储器、CPU及操作系统的接口.htm_txt_6.gif" width="448" height="101"></b></font></p>                 
<p><font color="#333333" size="4"><b>1、接口 (Interface)的基本功能:</b></font></p>                             
<blockquote>                
  <p><font color="#333333" size="4"><b>1)通信联络控制:同步、异步,设备选择和中断,或DMA控制;</b></font></p>              
<p><font color="#333333" size="4"><b>2)数据缓冲,实现主机与外设速度匹配;</b></font></p>                           
<p><font color="#333333" size="4"><b>3)接受主机命令,提供设备及接口状态。</b></font></p>                           
</blockquote>              
<p><font color="#333333" size="4"><b>2、接口类型</b></font></p>                           
<blockquote>              
<p><font color="#333333" size="4"><b>1)按数据传送位宽分:</b></font></p>                           
  <blockquote>              
<p><font color="#333333" size="4"><b>串行口--逐位传送数据,1bit1bit传送,RS232-C接口,网卡。</b></font></p>                         
<p><font color="#333333" size="4"><b>并行口--将一个字节或几个字节同时传送,如打印机接口。</b></font></p>                         
  </blockquote>             
<p><font color="#333333" size="4"><b>2)按传送控制方式分:</b></font></p>                         
  <blockquote>             
<p><font color="#333333" size="4"><b>程序控制输入输出口,程序中断I/O口,DMA方式</b></font></p>                         
  </blockquote>             
</blockquote>             
<p><font color="#333333" size="4"><b>3、数据传送控制方式:</b></font></p>                         
<blockquote>             
<p><font color="#333333" size="4"><b>A、程序控制I/O传送方式,也称polling</b></font></p>                         
</blockquote>             
<blockquote>        
  <blockquote>        
<p><font color="#333333" size="4"><b><img border="0" src="_derived/IO设备与存储器、CPU及操作系统的接口.htm_txt_12.gif" width="549" height="252"></b></font></p>    
<p><font color="#333333" size="4"><b>例如:从一缓冲区输出一批数据到打印机,缓冲首址First,数据长度LEN,状态口为LPRSTATUS,数据寄存口地址LPRPOUT。</b></font></p>    
<p><font color="#333333" size="4"><b>&nbsp;<img border="0" src="_derived/IO设备与存储器、CPU及操作系统的接口.htm_txt_u.gif" width="507" height="414"></b></font></p>    
<p><font color="#333333" size="4"><b>程序传送接口:&nbsp; <img border="0" src="_derived/IO设备与存储器、CPU及操作系统的接口.htm_txt_x.gif" align="top" width="482" height="259"></b></font></p>     
<p><font color="#333333" size="4"><b>polling 程序查询</b></font></p>                           
<p><font color="#333333" size="4"><b>Programed Drict Cotrol程序直接控制</b></font></p>                           
<p><font color="#333333" size="4"><b>优点:接口电路简单;</b></font></p>                         
<p><font color="#333333" size="4"><b>缺点:CPU总是等待外设,浪费时间</b></font></p>                         
  </blockquote>              
<p><font color="#333333" size="4"><b>B、程序中断控制传送方式</b></font></p>                         
<p><font color="#333333" size="4"><b>C、DMA传送方式&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></font></p>                        
<p><b><font size="4"><font color="#333333">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   
</font>        
<a href="#一"><font color="#66CCFF">返回页首</font></a></font></b></p>                      
<p> </p>                      
</blockquote>          
<p><a name="四、中断系统"><b><font color="#333333" size="4">四、中断系统</font></b></a></p>                     
<p><b><font color="#333333" size="4">中断过程:中断请求;中断响应;中断服务;中断返回。</font></b></p>                     
<blockquote>          

⌨️ 快捷键说明

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