📄 windowsce_net 420串口驱动分析(3)--jesse.htm
字号:
lang=EN-US>)</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">。当提交中断处理发送后待到</SPAN><SPAN
lang=EN-US>pSerialHead->hTransmitEvent</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">被设置或是异常或超时后就结束了发送流程,在这部分的最后。与</SPAN><SPAN
lang=EN-US>COM_Read</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类似需要处理一些异常情况,当然如果使用了硬件流控制还需要在这里清除掉发送请求信号,当这些状态处理完成以后发送</SPAN><SPAN
lang=EN-US>EV_TXEMPTY</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">事件通告所有</SPAN><SPAN
lang=EN-US>open</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">的句柄发送结束就完成了该部分的流程。</SPAN>
<BR><BR><B style="mso-bidi-font-weight: normal"><SPAN
lang=EN-US>COM_PowerUp/ COM_PowerDown<O:P></O:P></SPAN></B>
<BR><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">这两个函数的调用都由</SPAN><SPAN
lang=EN-US>CE</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><BR><B style="mso-bidi-font-weight: normal"><SPAN
lang=EN-US>COM_IOControl<O:P></O:P></SPAN></B> <BR><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">该函数用于实现向设备发送命令的功能。由于代码本身没有什么流程或逻辑性可言,全都是单独的实现,下面就用列表的方式大致的说一下这些命令字和其实现。</SPAN></P>
<TABLE class=MsoNormalTable
style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; BACKGROUND: #99ccff; MARGIN-LEFT: 6.75pt; BORDER-LEFT: medium none; WIDTH: 443pt; MARGIN-RIGHT: 6.75pt; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse; mso-padding-alt: 0cm 5.4pt 0cm 5.4pt; mso-border-alt: solid white .5pt; mso-border-insideh: .5pt solid white; mso-border-insidev: .5pt solid white; mso-table-lspace: 9.0pt; mso-table-rspace: 9.0pt; mso-table-anchor-vertical: paragraph; mso-table-anchor-horizontal: margin; mso-table-left: left; mso-table-top: -2.05pt"
cellSpacing=0 cellPadding=0 width=591 align=left border=1>
<TBODY>
<TR
style="HEIGHT: 7.5pt; mso-yfti-irow: 0; mso-yfti-firstrow: yes">
<TD
style="BORDER-RIGHT: white 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: white 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: white 1pt solid; WIDTH: 195.4pt; COLOR: #ffffff; PADDING-TOP: 0cm; BORDER-BOTTOM: white 1pt solid; HEIGHT: 7.5pt; mso-border-alt: solid white .5pt"
vAlign=top width=261>
<P class=MsoNormal
style="MARGIN: 0cm 4.6pt 0pt 0cm; mso-element: frame; mso-element-wrap: around; mso-element-anchor-horizontal: margin; mso-element-top: -2.05pt; mso-height-rule: exactly; mso-element-anchor-vertical: paragraph; mso-element-frame-hspace: 9.0pt"><SPAN
lang=EN-US>Command</SPAN> </P></TD>
<TD
style="BORDER-RIGHT: white 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: white 1pt solid; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; WIDTH: 247.6pt; COLOR: #ffffff; PADDING-TOP: 0cm; BORDER-BOTTOM: white 1pt solid; HEIGHT: 7.5pt; mso-border-alt: solid white .5pt; mso-border-left-alt: solid white .5pt"
vAlign=top width=330>
<P class=MsoNormal
style="MARGIN-LEFT: 0cm; mso-element: frame; mso-element-wrap: around; mso-element-anchor-horizontal: margin; mso-element-top: -2.05pt; mso-height-rule: exactly; mso-element-anchor-vertical: paragraph; mso-element-frame-hspace: 9.0pt"><SPAN
lang=EN-US>Note</SPAN> </P></TD></TR>
<TR style="HEIGHT: 3.5pt; mso-yfti-irow: 1">
<TD
style="BORDER-RIGHT: white 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: white 1pt solid; WIDTH: 195.4pt; COLOR: #ffffff; PADDING-TOP: 0cm; BORDER-BOTTOM: white 1pt solid; HEIGHT: 3.5pt; mso-border-alt: solid white .5pt; mso-border-top-alt: solid white .5pt"
vAlign=top width=261>
<P class=MsoNormal
style="MARGIN: 0cm 4.6pt 0pt 0cm; mso-element: frame; mso-element-wrap: around; mso-element-anchor-horizontal: margin; mso-element-top: -2.05pt; mso-height-rule: exactly; mso-element-anchor-vertical: paragraph; mso-element-frame-hspace: 9.0pt"><SPAN
lang=EN-US>IOCTL_PSL_NOTIFY</SPAN> </P></TD>
<TD
style="BORDER-RIGHT: white 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; WIDTH: 247.6pt; COLOR: #ffffff; PADDING-TOP: 0cm; BORDER-BOTTOM: white 1pt solid; HEIGHT: 3.5pt; mso-border-alt: solid white .5pt; mso-border-left-alt: solid white .5pt; mso-border-top-alt: solid white .5pt"
width=330>
<P class=MsoNormal
style="TEXT-JUSTIFY: inter-ideograph; MARGIN: 0cm 22.2pt 0pt 0cm; TEXT-ALIGN: justify; mso-element: frame; mso-element-wrap: around; mso-element-anchor-horizontal: margin; mso-element-top: -2.05pt; mso-height-rule: exactly; mso-element-anchor-vertical: paragraph; mso-element-frame-hspace: 9.0pt"><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在调用驱动的进程退出时产生,并不是串行驱动专有的</SPAN><SPAN
lang=EN-US>IO</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">命令。这里会调用</SPAN>
<SPAN lang=EN-US>ProcessExiting</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">函数进行处理。这个函数的内容放到后面来看。</SPAN>
</P></TD></TR>
<TR style="HEIGHT: 11.25pt; mso-yfti-irow: 2">
<TD
style="BORDER-RIGHT: white 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: white 1pt solid; WIDTH: 195.4pt; COLOR: #ffffff; PADDING-TOP: 0cm; BORDER-BOTTOM: white 1pt solid; HEIGHT: 11.25pt; mso-border-alt: solid white .5pt; mso-border-top-alt: solid white .5pt"
vAlign=top width=261>
<P class=MsoNormal
style="MARGIN: 0cm 4.6pt 0pt 0cm; mso-element: frame; mso-element-wrap: around; mso-element-anchor-horizontal: margin; mso-element-top: -2.05pt; mso-height-rule: exactly; mso-element-anchor-vertical: paragraph; mso-element-frame-hspace: 9.0pt"><SPAN
lang=EN-US>IOCTL_SERIAL_SET_BREAK_ON </SPAN></P></TD>
<TD
style="BORDER-RIGHT: white 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; WIDTH: 247.6pt; COLOR: #ffffff; PADDING-TOP: 0cm; BORDER-BOTTOM: white 1pt solid; HEIGHT: 11.25pt; mso-border-alt: solid white .5pt; mso-border-left-alt: solid white .5pt; mso-border-top-alt: solid white .5pt"
vAlign=top width=330>
<P class=MsoNormal
style="MARGIN: 0cm 22.2pt 0pt 0cm; mso-element: frame; mso-element-wrap: around; mso-element-anchor-horizontal: margin; mso-element-top: -2.05pt; mso-height-rule: exactly; mso-element-anchor-vertical: paragraph; mso-element-frame-hspace: 9.0pt"><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中断</SPAN><SPAN
lang=EN-US>(</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">暂停</SPAN><SPAN
lang=EN-US>)serial</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>
</P></TD></TR>
<TR style="HEIGHT: 11.25pt; mso-yfti-irow: 3">
<TD
style="BORDER-RIGHT: white 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: white 1pt solid; WIDTH: 195.4pt; COLOR: #ffffff; PADDING-TOP: 0cm; BORDER-BOTTOM: white 1pt solid; HEIGHT: 11.25pt; mso-border-alt: solid white .5pt; mso-border-top-alt: solid white .5pt"
vAlign=top width=261>
<P class=MsoNormal
style="MARGIN: 0cm 4.6pt 0pt 0cm; mso-element: frame; mso-element-wrap: around; mso-element-anchor-horizontal: margin; mso-element-top: -2.05pt; mso-height-rule: exactly; mso-element-anchor-vertical: paragraph; mso-element-frame-hspace: 9.0pt"><SPAN
lang=EN-US>IOCTL_SERIAL_SET_BREAK_OFF </SPAN></P></TD>
<TD
style="BORDER-RIGHT: white 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; WIDTH: 247.6pt; COLOR: #ffffff; PADDING-TOP: 0cm; BORDER-BOTTOM: white 1pt solid; HEIGHT: 11.25pt; mso-border-alt: solid white .5pt; mso-border-left-alt: solid white .5pt; mso-border-top-alt: solid white .5pt"
vAlign=top width=330>
<P class=MsoNormal
style="MARGIN: 0cm 22.2pt 0pt 0cm; mso-element: frame; mso-element-wrap: around; mso-element-anchor-horizontal: margin; mso-element-top: -2.05pt; mso-height-rule: exactly; mso-element-anchor-vertical: paragraph; mso-element-frame-hspace: 9.0pt"><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>
</P></TD></TR>
<TR style="HEIGHT: 10.5pt; mso-yfti-irow: 4">
<TD
style="BORDER-RIGHT: white 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: white 1pt solid; WIDTH: 195.4pt; COLOR: #ffffff; PADDING-TOP: 0cm; BORDER-BOTTOM: white 1pt solid; HEIGHT: 10.5pt; mso-border-alt: solid white .5pt; mso-border-top-alt: solid white .5pt"
vAlign=top width=261>
<P class=MsoNormal
style="MARGIN: 0cm 4.6pt 0pt 0cm; mso-element: frame; mso-element-wrap: around; mso-element-anchor-horizontal: margin; mso-element-top: -2.05pt; mso-height-rule: exactly; mso-element-anchor-vertical: paragraph; mso-element-frame-hspace: 9.0pt"><SPAN
lang=EN-US>IOCTL_SERIAL_SET_DTR</SPAN> </P></TD>
<TD
style="BORDER-RIGHT: white 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; WIDTH: 247.6pt; COLOR: #ffffff; PADDING-TOP: 0cm; BORDER-BOTTOM: white 1pt solid; HEIGHT: 10.5pt; mso-border-alt: solid white .5pt; mso-border-left-alt: solid white .5pt; mso-border-top-alt: solid white .5pt"
vAlign=top width=330>
<P class=MsoNormal
style="MARGIN: 0cm 22.2pt 0pt 0cm; mso-element: frame; mso-element-wrap: around; mso-element-anchor-horizontal: margin; mso-element-top: -2.05pt; mso-height-rule: exactly; mso-element-anchor-vertical: paragraph; mso-element-frame-hspace: 9.0pt"><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将</SPAN><SPAN
lang=EN-US>DTR</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">引线拉高。</SPAN><SPAN
lang=EN-US>(</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>)</SPAN> </P></TD></TR>
<TR style="HEIGHT: 6.75pt; mso-yfti-irow: 5">
<TD
style="BORDER-RIGHT: white 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: white 1pt solid; WIDTH: 195.4pt; COLOR: #ffffff; PADDING-TOP: 0cm; BORDER-BOTTOM: white 1pt solid; HEIGHT: 6.75pt; mso-border-alt: solid white .5pt; mso-border-top-alt: solid white .5pt"
vAlign=top width=261>
<P class=MsoNormal
style="MARGIN: 0cm 4.6pt 0pt 0cm; mso-element: frame; mso-element-wrap: around; mso-element-anchor-horizontal: margin; mso-element-top: -2.05pt; mso-height-rule: exactly; mso-element-anchor-vertical: paragraph; mso-element-frame-hspace: 9.0pt"><SPAN
lang=EN-US>IOCTL_SERIAL_CLR_DTR</SPAN> </P></TD>
<TD
style="BORDER-RIGHT: white 1pt solid; PADDING-RIGHT: 5.4pt; BORDER-TOP: medium none; PADDING-LEFT: 5.4pt; PADDING-BOTTOM: 0cm; BORDER-LEFT: medium none; WIDTH: 247.6pt; COLOR: #ffffff; PADDING-TOP: 0cm; BORDER-BOTTOM: white 1pt solid; HEIGHT: 6.75pt; mso-border-alt: solid white .5pt; mso-border-left-alt: solid white .5pt; mso-border-top-alt: solid white .5pt"
vAlign=top width=330>
<P class=MsoNormal
style="MARGIN: 0cm 22.2pt 0pt 0cm; mso-element: frame; mso-element-wrap: around; mso-element-anchor-horizontal: margin; mso-element-top: -2.05pt; mso-height-rule: exactly; mso-element-anchor-vertical: paragraph; mso-element-frame-hspace: 9.0pt"><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">将</SPAN><SPAN
lang=EN-US>DTR</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">引线拉低。</SPAN><SPAN
lang=EN-US>(</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">直接调用</SPAN><SPAN
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -