📄 cpcore.h
字号:
/*!** \brief Set state of CAN controller** \param ubChannelV CAN channel of the hardware** \param mode 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:** \li CP_MODE_STOP - stop the CAN controller** \li CP_MODE_START - start the CAN controller***/Cp_EXPORT _U08 Cp_PREFIX CpCoreCANMode(_U08 ubChannelV, _U08 mode);/*!** \brief Retrive state of CAN controller** \param ubChannelV CAN channel of the hardware** \return Error code taken from the CpErr enumeration**** This function returns the present state of the CAN controller. Possible** return codes are:** \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*****/Cp_EXPORT _U08 Cp_PREFIX CpCoreCANState(_U08 ubChannelV);/*!** \brief Free message buffer of FullCAN controller** \param ubChannelV CAN channel of the hardware** \param msg_buffer requested message buffer of the CAN controller**** \return Error code taken from the CpErr enumeration. If no error** occured, the function will return CpErr_OK.***/#if CP_FULL_CAN == 1Cp_EXPORT _U08 Cp_PREFIX CpCoreDeAllocBuffer( _U08 ubChannelV, _U08 msg_buffer);#endif/*!** \brief De-Initialize 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>***/Cp_EXPORT _U08 Cp_PREFIX CpCoreDeInitDriver(_U08 ubChannelV);/*!** \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.***/Cp_EXPORT _U08 Cp_PREFIX 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).***/Cp_EXPORT _U08 Cp_PREFIX 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.***/Cp_EXPORT _U08 Cp_PREFIX CpCoreHDI(_U08 ubChannelV, CpStruct_HDI* hdi);/*!** \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>***/Cp_EXPORT _U08 Cp_PREFIX CpCoreInitDriver(_U08 ubChannelV);/*!** \brief CAN Interrupt Request (IRQ) Handler**** The CAN IRQ Handler is responsible for calling core functions** and sending signals (events) to the application whenever an** interrupt signal of the CAN controller occurs. This function** is not intended to be used by the application program.** <b>** Do not call this function by the application program. The** implementation of this function is system dependend.** </b>***/void CpCoreIntHandler(void);/*!** \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.** <b>** Do not call this function by the application program. The** implementation of this function is system dependent.** </b>***/Cp_EXPORT _U08 Cp_PREFIX CpCoreMsgReceive(_U08 ubChannelV);/*!** \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.** <b>** Do not call this function by the application program. The** implementation of this function is system dependent.** </b>***/Cp_EXPORT _U08 Cp_PREFIX CpCoreMsgTransmit(_U08 ubChannelV);/*!** \brief Read from CAN controller register** \param ubChannelV CAN channel of the hardware** \param regAdr Register address relative to the base address** of the CAN controller.** \param valuePtr 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.***/Cp_EXPORT _U08 Cp_PREFIX CpCoreRegRead( _U08 ubChannelV, _U16 regAdr, _U08 * valuePtr);/*!** \brief Write to CAN controller register** \param ubChannelV CAN channel of the hardware** \param regAdr Register address relative to the base address** of the CAN controller.** \param value 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.***/Cp_EXPORT _U08 Cp_PREFIX CpCoreRegWrite(_U08 ubChannelV, _U16 regAdr, _U08 value);#endif /* _CANpie_Core_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -