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

📄 linux网络驱动程序编写(二).htm

📁 Dm9000网络接口驱动大全
💻 HTM
📖 第 1 页 / 共 2 页
字号:
    <TD vAlign=top align=middle>
      <TABLE cellSpacing=2 cellPadding=0 width=550 border=0>
        <TBODY>
        <TR>
          <TD align=middle><B><FONT class=BHEAD 
            color=#333399>Linux网络驱动程序编写(二)</FONT></B></TD></TR>
        <TR>
          <TD bgColor=#bbbbbb height=1></TD></TR>
        <TR>
          <TD align=middle><FONT face="Arial, Helvetica, sans-serif"><SPAN 
            class=nava>2001-06-15· ·Bordi··饮水思源站<BR><BR></SPAN></FONT></TD></TR>
        <TR>
          <TD>
            <P align=right><FONT color=red>1 <A 
            href="http://www.yesky.com/SoftChannel/72350081327562752/20010615/185124_1.shtml">2</A> 
            <A 
            href="http://www.yesky.com/SoftChannel/72350081327562752/20010615/185124_2.shtml">3</A> 
            <A 
            href="http://www.yesky.com/SoftChannel/72350081327562752/20010615/185124_3.shtml">4</A> 
            <A 
            href="http://www.yesky.com/SoftChannel/72350081327562752/20010615/185124_4.shtml">5</A> 
            &nbsp;<A 
            href="http://www.yesky.com/SoftChannel/72350081327562752/20010615/185124_1.shtml">下一页</A></FONT></P><SPAN 
            class=txt><B><FONT 
            color=#0000ff>二.Linux系统网络设备驱动程序</FONT></B><BR><B><BR>2.1&nbsp;网络驱动程序的结构</B><BR>&nbsp;&nbsp;&nbsp;&nbsp;<BR>  所有的Linux网络驱动程序遵循通用的接口。设计时采用的是面向对象的方法。一个设备就是一个对象(device&nbsp;结构),它内部有自己的数据和方法。每一个设备的方法被调用时的第一个参数都是这个设备对象本身。这样这个方法就可以存取自身的数据(类似面向对象程序设计时的this引用)。一个网络设备最基本的方法有初始化、发送和接收。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-------------------&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp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&nbsp;&nbsp;|<BR>&nbsp;&nbsp;&nbsp;&nbsp;-------------------------------------------------------<BR>&nbsp;&nbsp;&nbsp;|&nbsp;methods&nbsp;and&nbsp;variables(initialize,open,close,hard_xmit,|<BR>&nbsp;&nbsp;&nbsp;|&nbsp;interrupt&nbsp;handler,config,resources,status...)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<BR>&nbsp;&nbsp;&nbsp;&nbsp;-------------------------------------------------------<BR>&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;<BR>&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;|<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-----------------&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;----------------------<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp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bsp;&nbsp;hardware&nbsp;media&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-----------------------------------------------------<BR>&nbsp;&nbsp;&nbsp;&nbsp;  初始化程序完成硬件的初始化、device中变量的初始化和系统资源的申请、发送程序是在驱动程序的上层协议层有数据要发送时自动调用的。一般驱动程序中不对发送数据进行缓存,而是直接使用硬件的发送功能把数据发送出去。接收数据一般是通过硬件中断来通知的。在中断处理程序里,把硬件帧信息填入一个skbuff结构中,然后调用netif_rx()传递给上层处理。</SPAN>
            <P align=right><FONT color=red>1 <A 
            href="http://www.yesky.com/SoftChannel/72350081327562752/20010615/185124_1.shtml">2</A> 
            <A 
            href="http://www.yesky.com/SoftChannel/72350081327562752/20010615/185124_2.shtml">3</A> 
            <A 
            href="http://www.yesky.com/SoftChannel/72350081327562752/20010615/185124_3.shtml">4</A> 
            <A 
            href="http://www.yesky.com/SoftChannel/72350081327562752/20010615/185124_4.shtml">5</A> 
            &nbsp;<A 
            href="http://www.yesky.com/SoftChannel/72350081327562752/20010615/185124_1.shtml">下一页</A></FONT></P></TD></TR>
        <TR>
          <TD>
            <DIV align=right>【责任编辑:yk】 <BR>
            <SCRIPT src="Linux网络驱动程序编写(二).files/dell.js"></SCRIPT>
            <IMG height=10 src="Linux网络驱动程序编写(二).files/kong.gif" 
            width=100></IMG><A href="javascript:sendemail()"><IMG height=13 
            src="Linux网络驱动程序编写(二).files/ms_020220.gif" width=73 
            border=0></IMG></A><A 
            href="http://bbs.yesky.com/servlet/IBBS2.ListTopic?forumID=123">【发表评论】</A><A 
            href="javascript:window.close()"><FONT 
            color=#000000>【关闭窗口】</FONT></A></DIV></TD></TR>
        <TR>
          <TD><IFRAME src="Linux网络驱动程序编写(二).files/softwaresv.htm" 
            frameBorder=0 width=550 scrolling=no height=80></IFRAME>
            <TABLE cellSpacing=0 cellPadding=0 width=550 border=0>
              <TBODY>
              <TR>
                <TD width=1 bgColor=#000000 rowSpan=5></TD>
                <TD bgColor=#000000 height=1></TD>
                <TD width=1 bgColor=#000000 rowSpan=5></TD></TR>
              <TR>
                <TD bgColor=#a0d0d0>■ 相关内容</TD></TR>
              <TR>
                <TD bgColor=#000000 height=1></TD></TR>
              <TR>
                <TD> <A 
                  href="http://www.yesky.com/SoftChannel/72342371928899584/20010704/187876.shtml"><FONT 
                  color=#000000>浅谈C++函数的参数</FONT></A><BR> <A 
                  href="http://www.yesky.com/SoftChannel/72350081327562752/20010615/185130.shtml"><FONT 
                  color=#000000>Linux网络驱动程序编写(四)</FONT></A><BR> <A 
                  href="http://www.yesky.com/SoftChannel/72350081327562752/20010615/185126.shtml"><FONT 
                  color=#000000>Linux网络驱动程序编写(三)</FONT></A><BR> <A 
                  href="http://www.yesky.com/SoftChannel/72350081327562752/20010615/185122.shtml"><FONT 
                  color=#000000>Linux网络驱动程序编写(一)</FONT></A><BR></TD></TR>
              <TR>
                <TD bgColor=#000000 height=1></TD></TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD align=middle><A href="http://www.yesky.com/hdong/zz.htm" 
            target=_blank><FONT 
            color=#000000>感谢访问天极网,如果您觉得该文章涉及版权问题,请看这里!</FONT></A><BR><BR></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width=760 bgColor=#4e4e4e border=0>
  <TBODY>
  <TR>
    <TD height=3></TD></TR></TBODY></TABLE>
<DIV class=floor776>
<SCRIPT src="Linux网络驱动程序编写(二).files/yindexfloor.js"></SCRIPT>
</DIV>
<SCRIPT src="Linux网络驱动程序编写(二).files/yesky-richmedia.js"></SCRIPT>
<SPAN id=span_ad1><IFRAME src="Linux网络驱动程序编写(二).files/scolumn.htm" frameBorder=0 
width=500 scrolling=no height=90></IFRAME></SPAN>
<SCRIPT>document.getElementById("ad1").innerHTML=document.getElementById("span_ad1").innerHTML;document.getElementById("span_ad1").innerHTML="";</SCRIPT>

<SCRIPT language=Javascript>document.write("<img src='http://counter.yesky.com/servlet/counter.counter?CID=72350081327562752&AID=185124&refer="+escape(document.referrer)+"&cur="+escape(document.URL)+"' border='0' alt='' width='0' height='0'>");</SCRIPT>
<BR></DIV></BODY></HTML>

⌨️ 快捷键说明

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