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

📄 cpcore_h.html

📁 Controller Area Network Programming Interface Environment Ver0.8。 CanPie版本0.8. CAN总线通讯编程接口源代码。
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<HTML><HEAD><TITLE>cpcore.h File Reference</TITLE><LINK HREF="micro.css" REL="stylesheet" TYPE="text/css"></HEAD><BODY BGCOLOR="#FFFFFF"><a name="PageTop"></a><!------ Document Header -------------------------------------------><table border="0" cellspacing="0" cellpadding="0"><tr><td valign="bottom"><img src="pictures/maphead.gif" vspace="0" border="0" height="20"></td></tr></table><table border="0" cellspacing="0" cellpadding="0"><tr><td valign="bottom"><a href="index.html"><img src="pictures/button_index.gif" vspace="0" border="0" height="25"></a></td><td valign="bottom"><a href="files.html"><img src="pictures/button_files.gif" vspace="0" border="0" height="25"></a></td><td valign="bottom"><a href="globals.html"><img src="pictures/button_funcs.gif" vspace="0" border="0" height="25"></a></td><td valign="bottom" width="80">&nbsp;</td><td valign="bottom"><a href="annotated.html"><img src="pictures/button_structs.gif" vspace="0" border="0" height="25"></a></td><td valign="bottom"><a href="functions.html"><img src="pictures/button_members.gif" vspace="0" border="0" height="25"></a></td></tr></table><hr noshade width=680 size=1 align=left><!------ Document Start --------------------------------------------><table width=680><tr><td><!-- Generated by Doxygen 1.2.6 --><h1>cpcore.h File Reference</h1>CANpie core functions. <a href="#_details">More...</a><p><code>#include "compiler.h"</code><br><code>#include "<a class="el" href="cpconst_h-source.html">cpconst.h</a>"</code><br><p><a href="cpcore_h-source.html">Go to the source code of this file.</a><table border=0 cellpadding=0 cellspacing=0><tr><td colspan=2><br><h2>Functions</h2></td></tr><tr><td nowrap align=right valign=top>Cp_EXPORT _U08 Cp_PREFIX&nbsp;</td><td valign=bottom><a class="el" href="cpcore_h.html#a5">CpCoreBaudrate</a> (_U08 ubChannelV, _U08 btr0, _U08 btr1, _U08 sjw)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Allocate buffer in FullCAN controller Set baudrate of CAN controller.</em> <a href="#a5">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>Cp_EXPORT _U08 Cp_PREFIX&nbsp;</td><td valign=bottom><a class="el" href="cpcore_h.html#a6">CpCoreCANMode</a> (_U08 ubChannelV, _U08 mode)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Get Pointer to data fields Change DLC of specified buffer Send message out of FullCAN buffer Transmit message from a FullCAN buffer Set state of CAN controller.</em> <a href="#a6">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>Cp_EXPORT _U08 Cp_PREFIX&nbsp;</td><td valign=bottom><a class="el" href="cpcore_h.html#a7">CpCoreCANState</a> (_U08 ubChannelV)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Retrive state of CAN controller.</em> <a href="#a7">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>Cp_EXPORT _U08 Cp_PREFIX&nbsp;</td><td valign=bottom><a class="el" href="cpcore_h.html#a8">CpCoreDeInitDriver</a> (_U08 ubChannelV)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Free message buffer of FullCAN controller De-Initialize the CAN driver.</em> <a href="#a8">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>Cp_EXPORT _U08 Cp_PREFIX&nbsp;</td><td valign=bottom><a class="el" href="cpcore_h.html#a9">CpCoreFilterAll</a> (_U08 ubChannelV, _BIT enable)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Set global hardware filter for CAN messages.</em> <a href="#a9">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>Cp_EXPORT _U08 Cp_PREFIX&nbsp;</td><td valign=bottom><a class="el" href="cpcore_h.html#a10">CpCoreFilterMsg</a> (_U08 ubChannelV, _U16 id, _BIT enable)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Hardware filter for CAN messages.</em> <a href="#a10">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>Cp_EXPORT _U08 Cp_PREFIX&nbsp;</td><td valign=bottom><a class="el" href="cpcore_h.html#a11">CpCoreHDI</a> (_U08 ubChannelV, <a class="el" href="struct_CpStruct_HDI.html">CpStruct_HDI</a> *hdi)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Get hardware description information.</em> <a href="#a11">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>Cp_EXPORT _U08 Cp_PREFIX&nbsp;</td><td valign=bottom><a class="el" href="cpcore_h.html#a12">CpCoreInitDriver</a> (_U08 ubChannelV)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Initialize the CAN driver.</em> <a href="#a12">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>void&nbsp;</td><td valign=bottom><a class="el" href="cpcore_h.html#a13">CpCoreIntHandler</a> (void)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>CAN Interrupt Request (IRQ) Handler.</em> <a href="#a13">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>Cp_EXPORT _U08 Cp_PREFIX&nbsp;</td><td valign=bottom><a class="el" href="cpcore_h.html#a14">CpCoreMsgReceive</a> (_U08 ubChannelV)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Read a CAN message from controller.</em> <a href="#a14">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>Cp_EXPORT _U08 Cp_PREFIX&nbsp;</td><td valign=bottom><a class="el" href="cpcore_h.html#a15">CpCoreMsgTransmit</a> (_U08 ubChannelV)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Transmit a CAN message.</em> <a href="#a15">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>Cp_EXPORT _U08 Cp_PREFIX&nbsp;</td><td valign=bottom><a class="el" href="cpcore_h.html#a16">CpCoreRegRead</a> (_U08 ubChannelV, _U16 regAdr, _U08 *valuePtr)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Read from CAN controller register.</em> <a href="#a16">More...</a><em></em></font><br><br></td></tr><tr><td nowrap align=right valign=top>Cp_EXPORT _U08 Cp_PREFIX&nbsp;</td><td valign=bottom><a class="el" href="cpcore_h.html#a17">CpCoreRegWrite</a> (_U08 ubChannelV, _U16 regAdr, _U08 value)</td></tr><tr><td>&nbsp;</td><td><font size=-1><em>Write to CAN controller register.</em> <a href="#a17">More...</a><em></em></font><br><br></td></tr></table><hr><a name="_details"></a><h2>Detailed Description</h2>CANpie core functions.<p> <p> The user functions always call the core functions, they never access the hardware directly. That means the user functions do not have to be modified when implementing the CANpie on an existing hardware. A typical user function is the writing of a CAN message to the FIFO buffer (e.g. <a class="el" href="cpuser_h.html#a8">CpUserMsgWrite</a>() ).<p><hr><h2>Function Documentation</h2><a name="a5" doxytag="cpcore.h::CpCoreBaudrate"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td nowrap valign="top"><b> Cp_EXPORT _U08 Cp_PREFIX CpCoreBaudrate (          </b></td>          <td valign="bottom"><b>_U08 <em>ubChannelV</em>,           </b></td>        </tr>        <tr>          <td></td>          <td><b>_U08 <em>btr0</em>,           </b></td>        </tr>        <tr>          <td></td>          <td><b>_U08 <em>btr1</em>,           </b></td>        </tr>        <tr>          <td></td>          <td><b>_U08 <em>sjw</em>&nbsp;)          </b></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Allocate buffer in FullCAN controller Set baudrate of CAN controller.<p><dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>ubChannelV</em>&nbsp;</td><td>CAN channel of the hardware </td></tr><tr><td valign=top><em>btr0</em>&nbsp;</td><td>Value for Bit Timing Register 0 </td></tr><tr><td valign=top><em>btr1</em>&nbsp;</td><td>Value for Bit Timing Register 1 </td></tr><tr><td valign=top><em>sjw</em>&nbsp;</td><td>Value for Synchronisation Jump Width<p></td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>Error code taken from the CpErr enumeration. If no error occured, the function will return CpErr_OK.<p></dl>This function directly writes to the bit timing registers of the CAN controller. It is called by <a class="el" href="cpuser_h.html#a2">CpUserBaudrate</a>() with pre-defined values for common baudrates.     </td>  </tr></table><a name="a6" doxytag="cpcore.h::CpCoreCANMode"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td nowrap valign="top"><b> Cp_EXPORT _U08 Cp_PREFIX CpCoreCANMode (          </b></td>          <td valign="bottom"><b>_U08 <em>ubChannelV</em>,           </b></td>        </tr>        <tr>          <td></td>          <td><b>_U08 <em>mode</em>&nbsp;)          </b></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Get Pointer to data fields Change DLC of specified buffer Send message out of FullCAN buffer Transmit message from a FullCAN buffer Set state of CAN controller.<p><dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>ubChannelV</em>&nbsp;</td><td>CAN channel of the hardware </td></tr><tr><td valign=top><em>mode</em>&nbsp;</td><td>Mode of the controller </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>Error code taken from the CpErr enumeration. If no error occured, the function will return CpErr_OK.<p></dl>This function changes the operating mode of the CAN controller. Possible values for mode are: <ul><li> CP_MODE_STOP - stop the CAN controller <li> CP_MODE_START - start the CAN controller </ul>    </td>  </tr></table><a name="a7" doxytag="cpcore.h::CpCoreCANState"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td nowrap valign="top"><b> Cp_EXPORT _U08 Cp_PREFIX CpCoreCANState (          </b></td>          <td valign="bottom"><b>_U08 <em>ubChannelV</em>&nbsp;)          </b></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Retrive state of CAN controller.<p><dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>ubChannelV</em>&nbsp;</td><td>CAN channel of the hardware </td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>Error code taken from the CpErr enumeration<p></dl>This function returns the present state of the CAN controller. Possible return codes are: <ul><li> CpErr_OK: CAN controller is active, no error conditions occurred <li> CpErr_BUS_PASSIVE: CAN controller is in bus passive state <li> CpErr_BUS_OFF <li> CpErr_BUS_WARNING </ul>    </td>  </tr></table><a name="a8" doxytag="cpcore.h::CpCoreDeInitDriver"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td nowrap valign="top"><b> Cp_EXPORT _U08 Cp_PREFIX CpCoreDeInitDriver (          </b></td>          <td valign="bottom"><b>_U08 <em>ubChannelV</em>&nbsp;)          </b></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Free message buffer of FullCAN controller De-Initialize the CAN driver.<p><dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>ubChannelV</em>&nbsp;</td><td>CAN channel of the hardware<p></td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>Error code taken from the CpErr enumeration. If no error occured, the function will return CpErr_OK.<p></dl>The implementation of this function is dependant on the operating system. Typical tasks might be: <ul> <li>clear the interrupt vector / routine <li>close all open paths to the hardware </ul>     </td>  </tr></table><a name="a9" doxytag="cpcore.h::CpCoreFilterAll"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td nowrap valign="top"><b> Cp_EXPORT _U08 Cp_PREFIX CpCoreFilterAll (          </b></td>          <td valign="bottom"><b>_U08 <em>ubChannelV</em>,           </b></td>        </tr>        <tr>          <td></td>          <td><b>_BIT <em>enable</em>&nbsp;)          </b></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Set global hardware filter for CAN messages.<p><dl compact><dt><b>Parameters: </b><dd><table border=0 cellspacing=2 cellpadding=0><tr><td valign=top><em>ubChannelV</em>&nbsp;</td><td>CAN channel of the hardware </td></tr><tr><td valign=top><em>enable</em>&nbsp;</td><td>TRUE for accepting all identifiers, FALSE for rejecting all identifiers<p></td></tr></table></dl><dl compact><dt><b>Returns: </b><dd>Error code taken from the CpErr enumeration. Possible return values are: <ul> <li>CpErr_NOT_SUPPORTED - Function is not supported by the driver <li>CpErr_OK - Function returned without error condition </ul><p></dl>This function sets up a hardware CAN identifier filter. The filter might be a firmware on an intelligent PC card.     </td>  </tr></table><a name="a10" doxytag="cpcore.h::CpCoreFilterMsg"></a><p><table width="100%" cellpadding="2" cellspacing="0" border="0">  <tr>    <td class="md">      <table cellpadding="0" cellspacing="0" border="0">        <tr>          <td nowrap valign="top"><b> Cp_EXPORT _U08 Cp_PREFIX CpCoreFilterMsg (          </b></td>          <td valign="bottom"><b>_U08 <em>ubChannelV</em>,           </b></td>        </tr>        <tr>          <td></td>          <td><b>_U16 <em>id</em>,           </b></td>        </tr>        <tr>          <td></td>          <td><b>_BIT <em>enable</em>&nbsp;)          </b></td>        </tr>      </table>    </td>  </tr></table><table cellspacing=5 cellpadding=0 border=0>  <tr>    <td>      &nbsp;    </td>    <td><p>Hardware filter for CAN messages.<p><dl compact><dt>

⌨️ 快捷键说明

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