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

📄 cp_core.h.svn-base

📁 canpie 一个can bus的协议栈 - CAN interface for embedded control - CAN interface for PC (without local
💻 SVN-BASE
📖 第 1 页 / 共 2 页
字号:


/*!
** \brief   Send message out of FullCAN buffer
** \param   ptsPortV       CAN channel of the hardware
** \param   ubBufferIdxV   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   ptsPortV       CAN channel of the hardware
** \param   ubModeV        Mode selection
** \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 enumeration.
*/
_TvCpStatus CpCoreCanMode(_TsCpPort * ptsPortV, _U08 ubModeV);


/*!
** \brief   Retrive status of CAN controller
** \param   ptsPortV       CAN channel of the hardware
** \param   pubStateV      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);



//-------------------------------------------------------------------
// When the option CP_SMALL_CODE is set, the following function
// has no parameters. Inside the header file it must have the
// parameter type *void* then. The function is re-defined after-
// wards!
//
#if   CP_SMALL_CODE == 1
#define  CpCoreDriverInit(A, CH)             CpCoreDriverInit(void)
#endif
/*!
** \brief   Initialize the CAN driver
** \param   ubLogIfV     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);
//-------------------------------------------------------------------
// Re-define the function for proper compilation.
//
#if   CP_SMALL_CODE == 1
#undef   CpCoreDriverInit
#define  CpCoreDriverInit(A, CH)             CpCoreDriverInit()
#endif



//-------------------------------------------------------------------
// When the option CP_SMALL_CODE is set, the following function
// has no parameters. Inside the header file it must have the
// parameter type *void* then. The function is re-defined after-
// wards!
//
#if   CP_SMALL_CODE == 1
#define  CpCoreDriverRelease(CH)             CpCoreDriverRelease(void)
#endif
/*!
** \brief   Release the CAN driver
** \param   ptsPortV       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);
//-------------------------------------------------------------------
// Re-define the function for proper compilation.
//
#if   CP_SMALL_CODE == 1
#undef   CpCoreDriverRelease
#define  CpCoreDriverRelease(CH)             CpCoreDriverRelease()
#endif



/*!
** \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   ptsPortV       CAN channel of the hardware
** \param   ptsHdiV        Pointer to the Hardware Description Interface
**                         structure (_TsCpHdi)
**
** \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   ptsPortV       CAN channel of the hardware
** \param   ptsCanMsgV     Pointer to a CAN message structure
** \param   puwMsgCntV     Pointer to size variable
**
** \return  Error code taken from the CpErr enumeration. If no error
**          occured, the function will return CpErr_OK.
**
** This function reads the receive queue from a CAN controller.
*/
_TvCpStatus CpCoreMsgRead( _TsCpPort * ptsPortV, _TsCpCanMsg * ptsCanMsgV,
                           _U16 * puwMsgCntV);



/*!
** \brief   Transmit a CAN message
** \param   ptsPortV       CAN channel of the hardware
** \param   ptsCanMsgV     Pointer to a CAN message structure
** \param   puwMsgCntV     Pointer to size variable
**
** \return  Error code taken from the CpErr enumeration. If no error
**          occured, the function will return CpErr_OK.
**
** This function writes to the transmit queue of a CAN controller.
*/
_TvCpStatus CpCoreMsgWrite(_TsCpPort * ptsPortV, _TsCpCanMsg * ptsCanMsgV,
                           _U16 * puwMsgCntV);


/*!
** \brief   Read CAN controller statistics
** \param   ptsPortV       CAN channel of the hardware
** \param   ptsStatsV      Pointer to statistic data structure
**
** \return  Error code taken from the CpErr enumeration. Possible
**          return values are:
**          <ul>
**          <li>CpErr_CHANNEL - Channel number is out of range
**          <li>CpErr_OK - Function returned without error condition
**          </ul>
**
** This function copies CAN statistic information to the structure
** pointed by ptsStatsV.
**
*/
_TvCpStatus CpCoreStatistic(_TsCpPort * ptsPortV, _TsCpStats * ptsStatsV);


#endif   /* _CP_CORE_H_ */

⌨️ 快捷键说明

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