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

📄 cpcore.h.svn-base

📁 canpie 一个can bus的协议栈 - CAN interface for embedded control - CAN interface for PC (without local
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:
** \param   ubDlcV         Data Length Code
**
** \return  Error code taken from the CpErr enumeration. If no error
**          occured, the function will return CpErr_OK.
**
** This function sets the Data Length Code (DLC) of the selected buffer
** ubBufferV. The DLC must be in the range from 0 to 8.
*/
_TvCpStatus CpCoreBufferSetDlc(  _TsCpPort * ptsPortV, _U08 ubBufferIdxV,
                                 _U08 ubDlcV);


/*!
** \brief   Send message out of FullCAN buffer
** \param   ubChannelV     CAN channel of the hardware
** \param   ubBufferV      Buffer number
**
** \return  Error code taken from the CpErr enumeration. If no error
**          occured, the function will return CpErr_OK.
**
** This function will send a message out of a FullCAN buffer. The
** buffer has to be configured by a call to CpCoreAllocBuffer() before.
** In contrast to the function CpCoreBufferTransmit() no data is
** copied, which makes this function quite fast.
**
*/
_TvCpStatus CpCoreBufferSend(_TsCpPort * ptsPortV, _U08 ubBufferIdxV);


/*!
** \brief   Set state of CAN controller
** \param   ubChannelV     CAN channel of the hardware
** \param   ubModeV        Mode of the controller
** \return  Error code taken from the CpErr enumeration. If no error
**          occured, the function will return CpErr_OK.
**
** This function changes the operating mode of the CAN controller.
** Possible values for mode are defined in the #CP_MODE enumaration.
*/
_TvCpStatus CpCoreCanMode(_TsCpPort * ptsPortV, _U08 ubModeV);


/*!
** \brief   Retrive status of CAN controller
** \param   ubChannelV     CAN channel of the hardware
** \param	pubStatusV     Pointer to status variable
** \return  Error code taken from the CpErr enumeration. If no error
**          occured, the function will return CpErr_OK.
**
** This function retrieved the present state of the CAN controller. Possible
** values are defined in the #CP_STATE enumeration. The state of the CAN
**	controller is copied to the variable pointer 'pubStateV'.
*/
_TvCpStatus CpCoreCanStatus(_TsCpPort * ptsPortV, _U08 * pubStateV);


/*!
** \brief   Initialize the CAN driver
** \param   ubChannelV     CAN channel of the hardware
**
** \return  Error code taken from the CpErr enumeration. Possible
**          return values are:
**          <ul>
**          <li>CpErr_HARDWARE - Hardware failure occured, initialisation
**              is not possible
**          <li>CpErr_INIT_FAIL - Software failure occured, initialisation
**              is not possible
**          <li>CpErr_OK - Function returned without error condition
**          </ul>
**
** The implementation of this function is dependant on the operating
** system. Typical tasks might be:
** <ul>
** <li>open a path/file to the hardware
** <li>install an interrupt vector
** </ul>
**
*/
_TvCpStatus CpCoreDriverInit(_U08 ubLogIfV, _TsCpPort * ptsPortV);


/*!
** \brief   Release the CAN driver
** \param   ubChannelV     CAN channel of the hardware
**
** \return  Error code taken from the CpErr enumeration. If no error
**          occured, the function will return CpErr_OK.
**
** 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>
**
*/
_TvCpStatus CpCoreDriverRelease(_TsCpPort * ptsPortV);


/*!
** \brief   Set global hardware filter for CAN messages
** \param   ubChannelV     CAN channel of the hardware
** \param   enable         TRUE for accepting all identifiers,
**                         FALSE for rejecting all identifiers
**
** \return  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>
**
** This function sets up a hardware CAN identifier filter. The filter
** might be a firmware on an intelligent PC card.
**
*/
_TvCpStatus CpCoreFilterAll(_U08 ubChannelV, _BIT enable);


/*!
** \brief Hardware filter for CAN messages
** \param   ubChannelV     CAN channel of the hardware
** \param   id             value of the identifier
** \param   enable         TRUE for accepting an identifier,
**                         FALSE for rejecting an identifier
**
** \return  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>
**
** This function sets a filter for CAN messages. If the flag <b>enable</b>
** is set to TRUE, the CAN identifier <b>id</b> is accepted. If the flag
** <b>enable</b> is set to FALSE, the reception of messages with the
** identifier <b>id</b> is not possible. Please notice that this function
** only works for standard messages (2.0A, 11 bit identifier).
**
*/
_TvCpStatus CpCoreFilterMsg(  _U08 ubChannelV, _U16 id, _BIT enable);


/*!
** \brief   Get hardware description information
** \param   ubChannelV     CAN channel of the hardware
** \param   hdi            Pointer to the Hardware Description Interface
**                         structure (CpStruct_HDI)
**
** \return  Error code taken from the CpErr enumeration. If no error
**          occured, the function will return CpErr_OK.
**
** This function retrieves information about the used hardware.
**
*/
_TvCpStatus CpCoreHDI(_TsCpPort * ptsPortV, _TsCpHDI * ptsHdiV);

_TvCpStatus CpCoreIntFunctions(  _TsCpPort * ptsPortV,
                                 _U08 (* pfnRcvHandler) (_TsCpCanMsg *, _U08),
                                 _U08 (* pfnTrmHandler) (_TsCpCanMsg *, _U08),
                                 _U08 (* pfnErrHandler) (_U08)                );


/*!
** \brief   Read a CAN message from controller
** \param   ubChannelV     CAN channel of the hardware
**
** \return  Error code taken from the CpErr enumeration. If no error
**          occured, the function will return CpErr_OK.
**
** This function reads the receive buffer of a CAN controller and
** builds a CAN message from that information. The function is also
** responsible to generate the time stamp for the CAN message. The
** complete CAN message is then transferred to the Receive FIFO.
*/
_TvCpStatus CpCoreMsgRead( _TsCpPort * ptsPortV, _TsCpCanMsg * ptsCanMsgV,
                           _U16 * puwMsgCntV);



/*!
** \brief   Transmit a CAN message
** \param   ubChannelV     CAN channel of the hardware
**
** \return  Error code taken from the CpErr enumeration. If no error
**          occured, the function will return CpErr_OK.
**
** This function gets the next CAN message out of the Transmit
** FIFO and writes it to the appropriate registers of the CAN
** controller.
*/
_TvCpStatus CpCoreMsgWrite(_TsCpPort * ptsPortV, _TsCpCanMsg * ptsCanMsgV,
                           _U16 * puwMsgCntV);


/*!
** \brief   Read from CAN controller register
** \param   ubChannelV     CAN channel of the hardware
** \param   uwRegAdrV      Register address relative to the base address
**                         of the CAN controller.
** \param   pubValueV      Pointer to a variable of type BYTE, which will
**                         hold the result of the read process
**
** \return  Error code taken from the CpErr enumeration. Possible
**          return values are:
**          <ul>
**          <li>CpErr_CHANNEL - Channel number is out of range
**          <li>CpErr_REGISTER - Register address is out of range
**          <li>CpErr_SUPPORTED - Function is not supported
**          <li>CpErr_OK - Function returned without error condition
**          </ul>
**
** This function will read a value from a CAN controller register. The
** first register starts at address 0.
**
*/
_TvCpStatus CpCoreRegRead( _TsCpPort * ptsPortV, _U16 uwRegAdrV,
                           _U08 * pubValueV);


/*!
** \brief   Write to CAN controller register
** \param   ubChannelV     CAN channel of the hardware
** \param   uwRegAdrV      Register address relative to the base address
**                         of the CAN controller.
** \param   ubValueV       Value to write
**
** \return  Error code taken from the CpErr enumeration. Possible
**          return values are:
**          <ul>
**          <li>CpErr_CHANNEL - Channel number is out of range
**          <li>CpErr_REGISTER - Register address is out of range
**          <li>CpErr_SUPPORTED - Function is not supported
**          <li>CpErr_OK - Function returned without error condition
**          </ul>
**
** This function will write a value to a CAN controller register. The
** first register starts at address 0.

**
*/
_TvCpStatus CpCoreRegWrite(_TsCpPort * ptsPortV, _U16 uwRegAdrV,
                           _U08 ubValueV);



_TvCpStatus CpCoreStatistic(_TsCpPort * ptsPortV, _TsCpStats * ptsStatsV);


#endif   /* _CP_CORE_H_ */

⌨️ 快捷键说明

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