![]() |
RT-Thread RTOS
An open source embedded real-time operating system
|
#include <dev_can.h>
Data Fields | |
| rt_err_t(* | configure )(struct rt_can_device *can, struct can_configure *cfg) |
| rt_err_t(* | control )(struct rt_can_device *can, int cmd, void *arg) |
| rt_ssize_t(* | sendmsg )(struct rt_can_device *can, const void *buf, rt_uint32_t boxno) |
| rt_ssize_t(* | recvmsg )(struct rt_can_device *can, void *buf, rt_uint32_t fifo) |
| rt_ssize_t(* | sendmsg_nonblocking )(struct rt_can_device *can, const void *buf) |
The CAN device driver operations structure.
This structure contains pointers to the low-level functions that implement the CAN functionality. It must be provided when registering a CAN device.
| rt_err_t(* rt_can_ops::configure) (struct rt_can_device *can, struct can_configure *cfg) |
Configures the CAN controller with the specified settings.
| [in] | can | A pointer to the CAN device structure. |
| [in] | cfg | A pointer to the configuration structure. |
RT_EOK on success, or a negative error code on failure. | rt_err_t(* rt_can_ops::control) (struct rt_can_device *can, int cmd, void *arg) |
Sends control commands to the CAN device.
| [in] | can | A pointer to the CAN device structure. |
| [in] | cmd | The control command (e.g., RT_CAN_CMD_SET_FILTER). |
| [in] | arg | A pointer to the arguments for the command. |
RT_EOK on success, or a negative error code on failure. | rt_ssize_t(* rt_can_ops::sendmsg) (struct rt_can_device *can, const void *buf, rt_uint32_t boxno) |
Low-level blocking function to send a CAN message.
| [in] | can | A pointer to the CAN device structure. |
| [in] | buf | A pointer to the rt_can_msg to be sent. |
| [in] | boxno | The hardware mailbox number to use for transmission. |
| rt_ssize_t(* rt_can_ops::recvmsg) (struct rt_can_device *can, void *buf, rt_uint32_t fifo) |
Low-level function to receive a CAN message.
| [in,out] | can | A pointer to the CAN device structure. |
| [out] | buf | A pointer to the buffer to store the received rt_can_msg. |
| [in] | fifo | The hardware FIFO number to read from. |
| rt_ssize_t(* rt_can_ops::sendmsg_nonblocking) (struct rt_can_device *can, const void *buf) |
Low-level, hardware-specific function to send a CAN message non-blockingly.
This function attempts to place a message into a hardware transmission mailbox and returns immediately without waiting for the transmission to complete.
| [in] | can | A pointer to the CAN device structure. |
| [in] | buf | A pointer to the rt_can_msg to be sent. |
RT_EOK if the message was successfully accepted by the hardware.-RT_EBUSY if all hardware mailboxes are currently full.