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

📄 windowsce_net 420串口驱动分析(2)--jesse.htm

📁 WinCE下串口编程应用实例
💻 HTM
📖 第 1 页 / 共 5 页
字号:
                  <SCRIPT 
                  src="windowsCE_net 420串口驱动分析(2)--jesse.files/show_info.htm"></SCRIPT>
                  </DIV></TD></TR></TBODY></TABLE>
            <P align=center>
            <SCRIPT 
            src="windowsCE_net 420串口驱动分析(2)--jesse.files/show_xml.htm"></SCRIPT>
            <BR></P>
            <DIV align=center></DIV>
            <DIV align=center><BR></DIV></TD></TR></TBODY></TABLE></TD>
    <TD vAlign=top align=middle><BR><BR>
      <DIV id=saveurl><A 
      href="http://www.embeddedhelp.com/oblog/user1/6/index.html">首页</A> | <A 
      href="http://www.embeddedhelp.com/oblog/go.asp?action=up&amp;logid=11&amp;userid=6">上一篇</A> 
      | <A 
      href="http://www.embeddedhelp.com/oblog/go.asp?action=down&amp;logid=11&amp;userid=6">下一篇</A></DIV>
      <TABLE style="TABLE-LAYOUT: fixed; WORD-BREAK: break-all" cellSpacing=1 
      cellPadding=3 width="98%" bgColor=#cccccc border=0>
        <TBODY>
        <TR bgColor=#f8f8f8>
          <TD><FONT 
            size=4><STRONG>windowsCE.net&nbsp;420串口驱动分析(2)</STRONG></FONT><BR>jesse 
            发表于 2005-10-9 13:15:39 </TD></TR>
        <TR bgColor=#ffffff>
          <TD height=0>
            <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
              <TBODY>
              <TR>
                <TD>
                  <TABLE class=MsoNormalTable 
                  style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BACKGROUND: #0c0c0c; MARGIN-LEFT: 40.4pt; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid windowtext .5pt; mso-border-insideh: .5pt solid windowtext; mso-border-insidev: .5pt solid windowtext" 
                  cellSpacing=0 cellPadding=0 border=1>
                    <TBODY>
                    <TR 
                    style="HEIGHT: 3.5pt; mso-yfti-irow: 0; mso-yfti-firstrow: yes; mso-yfti-lastrow: yes">
                      <TD 
                      style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: windowtext 1pt solid; WIDTH: 260.25pt; COLOR: #ffffff; PADDING-TOP: 0cm; BORDER-BOTTOM: windowtext 1pt solid; HEIGHT: 3.5pt; mso-border-alt: solid windowtext .5pt" 
                      vAlign=top width=347>
                        <H1 style="MARGIN-LEFT: 7pt"><SPAN 
                        style="COLOR: #ffffff; FONT-FAMILY: 幼圆; mso-ascii-font-family: Arial">代码分析</SPAN></H1></TD></TR></TBODY></TABLE>
                  <H1><SPAN lang=EN-US><O:P>&nbsp;</O:P></SPAN></H1>
                  <P class=MsoBodyText><SPAN lang=EN-US><O:P>&nbsp;</O:P></SPAN> 
                  </P>
                  <P class=MsoBodyText><SPAN 
                  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在开始具体代码之前我们先来看看,相关的一些结构。</SPAN> 
                  <SPAN lang=EN-US>HWOBJ</SPAN><SPAN 
                  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">是相应的硬件设备操作的抽象集合。结构的定义后的注释与实际的用途有点点出入,</SPAN><SPAN 
                  lang=EN-US>BandFlags</SPAN><SPAN 
                  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">指定</SPAN><SPAN 
                  lang=EN-US>IST</SPAN><SPAN 
                  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的启动时间,可选为在初始化过程启动或是在打开设备的时候起动</SPAN><SPAN 
                  lang=EN-US>ISR.</SPAN><SPAN 
                  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">而第二个参数则是指定拦截的具体的系统中断号。最后一个参数是一个结构,该结构定义了硬件操作的各式行为函数的指针,</SPAN><SPAN 
                  lang=EN-US>MDD</SPAN><SPAN 
                  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">正是通过这些函数来访问具体的</SPAN><SPAN 
                  lang=EN-US>PDD</SPAN><SPAN 
                  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">操作。</SPAN> 
                  <BR><SPAN lang=EN-US style="FONT-SIZE: 8pt">typedef struct 
                  __HWOBJ {<O:P></O:P></SPAN> </P>
                  <P class=MsoBodyText 
                  style="MARGIN: 0cm -17.85pt 0pt 41.95pt"><SPAN lang=EN-US 
                  style="FONT-SIZE: 8pt"><SPAN 
                  style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>ULONG<SPAN 
                  style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                  </SPAN>BindFlags; // Flags controlling MDD behaviour.<SPAN 
                  style="mso-spacerun: yes">&nbsp; </SPAN>Se 
                  above.<O:P></O:P></SPAN> </P>
                  <P class=MsoBodyText 
                  style="MARGIN: 0cm -17.85pt 0pt 41.95pt"><SPAN lang=EN-US 
                  style="FONT-SIZE: 8pt"><SPAN 
                  style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>DWORD<SPAN 
                  style="mso-spacerun: yes">&nbsp; </SPAN><SPAN 
                  style="mso-spacerun: yes">&nbsp;</SPAN><SPAN 
                  style="mso-spacerun: yes">&nbsp;</SPAN>dwIntID;<SPAN 
                  style="mso-spacerun: yes">&nbsp;&nbsp; </SPAN>// Interrupt 
                  Identifier used if THREAD_AT_INIT or 
                  THREAD_AT_OPEN<O:P></O:P></SPAN> </P>
                  <P class=MsoBodyText 
                  style="MARGIN: 0cm -17.85pt 0pt 41.95pt"><SPAN lang=EN-US 
                  style="FONT-SIZE: 8pt"><SPAN 
                  style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; 
                  </SPAN>PHW_VTBL<SPAN style="mso-tab-count: 1"> 
                  </SPAN>pFuncTbl;<O:P></O:P></SPAN> </P>
                  <P class=MsoBodyText 
                  style="MARGIN: 0cm -17.85pt 0pt 41.95pt; TEXT-INDENT: 16.5pt" 
                  align=left><SPAN lang=EN-US style="FONT-SIZE: 8pt">} HWOBJ, 
                  *PHWOBJ;<O:P></O:P></SPAN> <BR><BR><SPAN 
                  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">而</SPAN><SPAN 
                  lang=EN-US>HW_VTBL</SPAN><SPAN 
                  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">则是代表具体硬件操作函数指针的集合,该结构所指向的函数包括了初始化、打开、关闭、接收、发送、设置</SPAN><SPAN 
                  lang=EN-US>Baudrate</SPAN><SPAN 
                  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">等一系列操作。结构存在就像纽带一样联系着</SPAN><SPAN 
                  lang=EN-US>PDD</SPAN><SPAN 
                  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中的具体实现和</SPAN><SPAN 
                  lang=EN-US>MDD</SPAN><SPAN 
                  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中的抽象操作。</SPAN><SPAN 
                  lang=EN-US>PDD</SPAN><SPAN 
                  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的实现必须遵循</SPAN><SPAN 
                  lang=EN-US>HW_VTBL</SPAN><SPAN 
                  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中所描述的函数形式,并构造出相应的</SPAN><SPAN 
                  lang=EN-US>HW_VTBL</SPAN><SPAN 
                  style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">实例。驱动的编写就是针对这些函数来一一进行实现。</SPAN> 
                  </P>
                  <P class=MsoBodyText style="MARGIN: 0cm -17.85pt 0pt 41.95pt" 
                  align=left><SPAN lang=EN-US style="FONT-SIZE: 8pt">typedef 
                  struct __HW_VTBL<SPAN 
                  style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; 
                  </SPAN>{<O:P></O:P></SPAN> </P>
                  <P class=MsoBodyText style="MARGIN: 0cm -17.85pt 0pt 41.95pt" 
                  align=left><SPAN lang=EN-US style="FONT-SIZE: 8pt"><SPAN 
                  style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>PVOID<SPAN 
                  style="mso-tab-count: 1"> </SPAN><SPAN 
                  style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                  </SPAN>(*HWInit)(ULONG Identifier, PVOID pMDDContext, PHWOBJ 
                  pHWObj);<O:P></O:P></SPAN> </P>
                  <P class=MsoBodyText style="MARGIN: 0cm -17.85pt 0pt 41.95pt" 
                  align=left><SPAN lang=EN-US style="FONT-SIZE: 8pt"><SPAN 
                  style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>BOOL<SPAN 
                  style="mso-tab-count: 1">&nbsp; </SPAN><SPAN 
                  style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                  </SPAN>(*HWPostInit)(PVOID pHead);<O:P></O:P></SPAN> </P>
                  <P class=MsoBodyText style="MARGIN: 0cm -17.85pt 0pt 41.95pt" 
                  align=left><SPAN lang=EN-US style="FONT-SIZE: 8pt"><SPAN 
                  style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>ULONG<SPAN 
                  style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                  </SPAN>(*HWDeinit)(PVOID pHead);<O:P></O:P></SPAN> </P>
                  <P class=MsoBodyText style="MARGIN: 0cm -17.85pt 0pt 41.95pt" 
                  align=left><SPAN lang=EN-US style="FONT-SIZE: 8pt"><SPAN 
                  style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>BOOL<SPAN 
                  style="mso-tab-count: 1">&nbsp; </SPAN><SPAN 
                  style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                  </SPAN>(*HWOpen)(PVOID pHead);<O:P></O:P></SPAN> </P>
                  <P class=MsoBodyText style="MARGIN: 0cm -17.85pt 0pt 41.95pt" 
                  align=left><SPAN lang=EN-US style="FONT-SIZE: 8pt"><SPAN 
                  style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>ULONG<SPAN 
                  style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                  </SPAN>(*HWClose)(PVOID pHead);<O:P></O:P></SPAN> </P>
                  <P class=MsoBodyText style="MARGIN: 0cm -17.85pt 0pt 41.95pt" 
                  align=left><SPAN lang=EN-US style="FONT-SIZE: 8pt"><SPAN 
                  style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; 
                  </SPAN>INTERRUPT_TYPE (*HWGetIntrType)(PVOID 
                  pHead);<O:P></O:P></SPAN> </P>
                  <P class=MsoBodyText style="MARGIN: 0cm -17.85pt 0pt 41.95pt" 
                  align=left><SPAN lang=EN-US style="FONT-SIZE: 8pt"><SPAN 
                  style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>ULONG<SPAN 
                  style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                  </SPAN>(*HWRxIntrHandler)(PVOID pHead, PUCHAR pTarget, PULONG 
                  pBytes);<O:P></O:P></SPAN> </P>
                  <P class=MsoBodyText style="MARGIN: 0cm -17.85pt 0pt 41.95pt" 
                  align=left><SPAN lang=EN-US style="FONT-SIZE: 8pt"><SPAN 
                  style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>VOID<SPAN 
                  style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN><SPAN 
                  style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                  </SPAN>(*HWTxIntrHandler)(PVOID pHead, PUCHAR pSrc, PULONG 
                  pBytes);<O:P></O:P></SPAN> </P>
                  <P class=MsoBodyText style="MARGIN: 0cm -17.85pt 0pt 41.95pt" 
                  align=left><SPAN lang=EN-US style="FONT-SIZE: 8pt"><SPAN 
                  style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>VOID<SPAN 
                  style="mso-tab-count: 1">&nbsp;&nbsp; </SPAN><SPAN 
                  style="mso-tab-count: 1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
                  </SPAN>(*HWModemIntrHandler)(PVOID pHead);<O:P></O:P></SPAN> 
                  </P>
                  <P class=MsoBodyText style="MARGIN: 0cm -17.85pt 0pt 41.95pt" 
                  align=left><SPAN lang=EN-US style="FONT-SIZE: 8pt"><SPAN 

⌨️ 快捷键说明

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