📄 rs232_8c.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>WirelessUSB(TM) LS PRoC DVK RS232 Master Application: rs232.c File Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.3.9.1 -->
<div class="qindex"><a class="qindex" href="main.html">Main Page</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Data Structures</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="functions.html">Data Fields</a> | <a class="qindex" href="globals.html">Globals</a></div>
<h1>rs232.c File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
Collection of routines to perform RS232 data transfer using the RS-232 port
<p>
<code>#include "<a class="el" href="protocol_8h.html">protocol.h</a>"</code><br>
<code>#include "rx8_1.h"</code><br>
<code>#include "tx8_1.h"</code><br>
<code>#include "<a class="el" href="rs232_8h.html">rs232.h</a>"</code><br>
<p>
Include dependency graph for rs232.c:<p><center><img src="rs232_8c__incl.png" border="0" usemap="#rs232.c_map" alt="Include dependency graph"></center>
<map name="rs232.c_map">
<area href="protocol_8h.html" shape="rect" coords="133,231,213,258" alt="">
<area href="ls__config_8h.html" shape="rect" coords="125,157,210,183" alt="">
<area href="isr_8h.html" shape="rect" coords="133,82,178,109" alt="">
<area href="timer_8h.html" shape="rect" coords="202,82,266,109" alt="">
<area href="cypdef_8h.html" shape="rect" coords="233,7,305,34" alt="">
<area href="rs232_8h.html" shape="rect" coords="258,157,325,183" alt="">
</map>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="rs232_8c.html#a12">rx8_isr</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="rs232_8c.html#a13">tx8_isr</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="rs232_8c.html#a14">app_init</a> ()</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="cypdef_8h.html#a1">UINT8</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="rs232_8c.html#a15">app_tx_process</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="rs232_8c.html#a16">app_unload_master_packet</a> (void)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="rs232_8c.html#a17">app_packet_transmitted</a> (void)</td></tr>
<tr><td colspan="2"><br><h2>Variables</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">LS_TX_PACKET </td><td class="memItemRight" valign="bottom"><a class="el" href="rs232_8c.html#a0">tx_packet</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">LS_RX_PACKET </td><td class="memItemRight" valign="bottom"><a class="el" href="rs232_8c.html#a1">rx_packet</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">LS_TX_PACKET </td><td class="memItemRight" valign="bottom"><a class="el" href="rs232_8c.html#a2">tx_packet2</a></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="cypdef_8h.html#a1">UINT8</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="rs232_8c.html#a3">serialRxBuffer1</a> [MAX_DATA_LEN]</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="cypdef_8h.html#a1">UINT8</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="rs232_8c.html#a4">serialRxLength1</a> = 0</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="cypdef_8h.html#a1">UINT8</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="rs232_8c.html#a5">serialRxBuffer2</a> [MAX_DATA_LEN]</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="cypdef_8h.html#a1">UINT8</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="rs232_8c.html#a6">serialRxLength2</a> = 0</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="cypdef_8h.html#a1">UINT8</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="rs232_8c.html#a7">gSendBuffer</a> = 1</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="cypdef_8h.html#a1">UINT8</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="rs232_8c.html#a8">gLoadBuffer</a> = 1</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="cypdef_8h.html#a1">UINT8</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="rs232_8c.html#a9">serialTxBuffer</a> [MAX_DATA_LEN]</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="cypdef_8h.html#a1">UINT8</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="rs232_8c.html#a10">serialTxLength</a> = 0</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="cypdef_8h.html#a1">UINT8</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="rs232_8c.html#a11">serialTxByteCounter</a> = 0</td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="a12" doxytag="rs232.c::rx8_isr"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void rx8_isr </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">void </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Description: Once the start bit is detected from the radio receiver and no errors are detected, this routine checks to see what buffer is available and loads it byte by byte. Once the data is loaded in the buffer, the clear-to-send flag is set. If an error is detected the data is dumped.<p>
Inputs: Void<p>
Returns: Void </td>
</tr>
</table>
<a class="anchor" name="a13" doxytag="rs232.c::tx8_isr"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void tx8_isr </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">void </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Description: If a buffer is ready for a packet transmission, the transmit interrupt mode will be set after the packet has transmitted successfully. Then the transmit interrupt will be disabled. If there is no data ready to transmit it will return.<p>
Inputs: Void<p>
Returns: Void </td>
</tr>
</table>
<a class="anchor" name="a14" doxytag="rs232.c::app_init"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void app_init </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">void </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Description: Initialize the RS232 control variables and sets the clear- to-send (CTS) flag.<p>
Inputs: Void<p>
Returns: Void </td>
</tr>
</table>
<a class="anchor" name="a15" doxytag="rs232.c::app_tx_process"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top"><a class="el" href="cypdef_8h.html#a1">UINT8</a> app_tx_process </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">void </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Description: Checks for a transmit packet. If there is no transmit packet, the clear-to-send flag is set and it exits. When valid input data is in the buffer, the receive interrupt is disabled. The data is loaded and a data packet is generated. Then the receive interrupt is enabled.<p>
Inputs: Void<p>
Returns:<ul>
<li>0 - no packet to send</li><li>serialRxLength - length of buffer that was loaded </li></ul>
</td>
</tr>
</table>
<a class="anchor" name="a16" doxytag="rs232.c::app_unload_master_packet"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void app_unload_master_packet </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">void </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Description: This routine disables the transmit interrupt, receives the RS232 packet, loads the app buffer, sets global packet variables, sets the Tx Interrupt Mode bit, reads the Tx Status bits in the Control/Status register, then enables the interrupt<p>
Inputs: Void<p>
Returns: Void </td>
</tr>
</table>
<p>
Here is the call graph for this function:<p><center><img src="rs232_8c_a16_cgraph.png" border="0" usemap="#rs232_8c_a16_cgraph_map" alt=""></center>
<map name="rs232_8c_a16_cgraph_map">
<area href="protocol_8h.html#a97" shape="rect" coords="242,8,405,34" alt="">
</map>
<a class="anchor" name="a17" doxytag="rs232.c::app_packet_transmitted"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void app_packet_transmitted </td>
<td class="md" valign="top">( </td>
<td class="md" nowrap valign="top">void </td>
<td class="mdname1" valign="top" nowrap> </td>
<td class="md" valign="top"> ) </td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Description: After disabling the receive interrupt this routine will set up the right SendBuffer for the next packet and lower the clear-to-send (CTS) flag if there is a length to either RX packet. If there is no length to either one, it will enable the receive interrupt and exit.<p>
Inputs: Void<p>
Returns: Void </td>
</tr>
</table>
<hr><h2>Variable Documentation</h2>
<a class="anchor" name="a0" doxytag="rs232.c::tx_packet"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">LS_TX_PACKET <a class="el" href="rs232_8c.html#a0">tx_packet</a> </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Transmit packet.
<p>
</td>
</tr>
</table>
<a class="anchor" name="a1" doxytag="rs232.c::rx_packet"></a><p>
<table class="mdTable" width="100%" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">LS_RX_PACKET <a class="el" href="rs232_8c.html#a1">rx_packet</a> </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
</td>
<td>
<p>
Receive packet.
<p>
</td>
</tr>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -