RTEMS CAN/CAN FD Stack
|
This file is part of CAN/CAN FD bus common support and defines generic CAN structures used for common IO operations. More...
#include <sys/queue.h>
#include <stdatomic.h>
#include <rtems.h>
#include <rtems/seterr.h>
#include <rtems/thread.h>
#include <sys/ioccom.h>
#include <dev/can/can-stats.h>
#include <dev/can/can-bittiming.h>
#include <dev/can/can-frame.h>
#include <dev/can/can-filter.h>
Go to the source code of this file.
Classes | |
struct | rtems_can_queue_param |
This structure represents parameters of FIFO queue. It is used to setup new queues via RTEMS_CAN_CREATE_QUEUE ioctl call. More... | |
Macros | |
#define | CAN_IOC_MAGIC 'd' |
RTEMS CAN Chip Flags | |
#define | RTEMS_CAN_CHIP_CONFIGURED ( 0 ) |
This define provides controller flags determining whether the chip is configured and ready to be started. | |
#define | RTEMS_CAN_CHIP_RUNNING ( 1 ) |
This define provides controller flags determining whether the chip is currently running or not. | |
RTEMS CAN Chip Capabilities | |
#define | RTEMS_CAN_CHIP_CAPABILITIES_FD ( 1 << 0 ) |
This define provides controller flags determining whether the chip is CAN FD capable. | |
#define | RTEMS_CAN_CHIP_CAPABILITIES_TX_TIMESTAMP ( 1 << 1 ) |
This define provides controller flags determining whether the chip has TX timestamping support. | |
#define | RTEMS_CAN_CHIP_CAPABILITIES_RX_TIMESTAMP ( 1 << 2 ) |
This define provides controller flags determining whether the chip has TX timestamping support. | |
RTEMS CAN Chip Info. | |
Arguments that can be used with RTEMS_CAN_CHIP_GET_INFO IOCTL command. | |
#define | RTEMS_CAN_CHIP_BITRATE ( 1 ) |
This define specifies user wants to obtain controller's nominal bitrate via RTEMS_CAN_CHIP_GET_INFO ioctl. | |
#define | RTEMS_CAN_CHIP_DBITRATE ( 2 ) |
This define specifies user wants to obtain controller's data bitrate via RTEMS_CAN_CHIP_GET_INFO ioctl. | |
#define | RTEMS_CAN_CHIP_NUSERS ( 3 ) |
This define specifies user wants to obtain number of users using the controller via RTEMS_CAN_CHIP_GET_INFO ioctl. | |
#define | RTEMS_CAN_CHIP_FLAGS ( 4 ) |
This define specifies user wants to obtain controller's flags via RTEMS_CAN_CHIP_GET_INFO ioctl. Refer to CANChip for flags definitions. | |
#define | RTEMS_CAN_CHIP_MODE ( 5 ) |
This define specifies user wants to obtain currently set controller's modes via RTEMS_CAN_CHIP_GET_INFO ioctl. | |
#define | RTEMS_CAN_CHIP_MODE_SUPPORTED ( 6 ) |
This define specifies user wants to obtain modes supported by the controller via RTEMS_CAN_CHIP_GET_INFO ioctl. | |
RTEMS CAN Queue Direction Helpers | |
#define | RTEMS_CAN_QUEUE_RX ( 1 << 0 ) |
This define can be used to select queue RX (from controller to application) direction. | |
#define | RTEMS_CAN_QUEUE_TX ( 1 << 1 ) |
This define can be used to select queue TX (from application to controller) direction. | |
RTEMS CAN Modes | |
These can be set with RTEMS_CAN_CHIP_SET_MODE command. | |
#define | CAN_CTRLMODE_LOOPBACK ( 1 << 0 ) |
This define is used to set loopback mode via RTEMS_CAN_CHIP_SET_MODE ioctl. | |
#define | CAN_CTRLMODE_LISTENONLY ( 1 << 1 ) |
This define is used to set listen only mode via RTEMS_CAN_CHIP_SET_MODE ioctl. | |
#define | CAN_CTRLMODE_3_SAMPLES ( 1 << 2 ) |
This define is used to set triple sampling mode via RTEMS_CAN_CHIP_SET_MODE ioctl. | |
#define | CAN_CTRLMODE_ONE_SHOT ( 1 << 3 ) |
This define is used to set one shot mode via RTEMS_CAN_CHIP_SET_MODE ioctl. | |
#define | CAN_CTRLMODE_BERR_REPORTING ( 1 << 4 ) |
This define is used to enable bus error reporting via RTEMS_CAN_CHIP_SET_MODE ioctl. | |
#define | CAN_CTRLMODE_FD ( 1 << 5 ) |
This define is used to set CAN FD mode via RTEMS_CAN_CHIP_SET_MODE ioctl. | |
#define | CAN_CTRLMODE_PRESUME_ACK ( 1 << 6 ) |
This define is used to set to ignore missing CAN ack via RTEMS_CAN_CHIP_SET_MODE ioctl. | |
#define | CAN_CTRLMODE_FD_NON_ISO ( 1 << 7 ) |
This define is used to set CAN FD in non-ISO mode via RTEMS_CAN_CHIP_SET_MODE ioctl. | |
#define | CAN_CTRLMODE_CC_LEN8_DLC ( 1 << 8 ) |
This define is used to set classic CAN DLC option via RTEMS_CAN_CHIP_SET_MODE ioctl. | |
#define | CAN_CTRLMODE_TDC_AUTO ( 1 << 9 ) |
This define is used to let CAN transiver automatically calculates TDCV via RTEMS_CAN_CHIP_SET_MODE ioctl. | |
#define | CAN_CTRLMODE_TDC_MANUAL ( 1 << 10 ) |
This define is used to let TDCV calculate manually by user via RTEMS_CAN_CHIP_SET_MODE ioctl. | |
#define | CAN_CTRLMODE_MASK |
RTEMS CAN Stack Supported IOCTL calls. | |
#define | RTEMS_CAN_CHIP_START _IO( CAN_IOC_MAGIC, 1 ) |
This ioctl call starts the controller. This is required in order to perform read/write operations. It has no effect if the chip is already started. | |
#define | RTEMS_CAN_CHIP_STOP _IOW( CAN_IOC_MAGIC, 2, struct timespec ) |
This ioctl call stops the controller. It has no effect if the chip is already stopped. | |
#define | RTEMS_CAN_CLOSE_NONBLOCK _IO( CAN_IOC_MAGIC, 3 ) |
This ioctl call sets close operation to be blocking or nonblocking based on input parameter. | |
#define | RTEMS_CAN_DISCARD_QUEUES _IO( CAN_IOC_MAGIC, 4 ) |
This ioctl call discards all RX/TX queues. Direction can be set with uint8_t parameter, see RTEMS_CAN_QUEUE_RX and RTEMS_CAN_QUEUE_TX. | |
#define | RTEMS_CAN_FLUSH_QUEUES _IO( CAN_IOC_MAGIC, 5 ) |
This ioctl call flushes all RX/TX queues. Direction can be set with uint8_t parameter, see RTEMS_CAN_QUEUE_RX and RTEMS_CAN_QUEUE_TX. | |
#define | RTEMS_CAN_CHIP_SET_MODE _IO( CAN_IOC_MAGIC, 6 ) |
This ioctl call sets controller's mode. Modes are passed uint32_t argument. Writing mode unsupported by the controller results in error as well as setting mode when the chip is already started. | |
#define | RTEMS_CAN_CHIP_GET_INFO _IO( CAN_IOC_MAGIC, 7 ) |
This ioctl call obtains controller's info specified by input integer argument. | |
#define | RTEMS_CAN_WAIT_TX_DONE _IOW( CAN_IOC_MAGIC, 8, struct timespec ) |
This ioctl call waits until all TX messages from all FIFOs are sent to the network or until timeout defined in struct timespec. The timeout is specified as a relative timeout. Passing NULL indicates an infinite timeout. | |
#define | RTEMS_CAN_POLL_TX_READY _IOW( CAN_IOC_MAGIC, 9, struct timespec ) |
This ioctl call waits until there is a free space in any TX FIFO queue or until timeout defined in struct timespec. The timeout is specified as a relative timeout. Passing NULL indicates an infinite timeout. | |
#define | RTEMS_CAN_POLL_RX_AVAIL _IOW( CAN_IOC_MAGIC, 10, struct timespec ) |
This ioctl call waits until there is an available frame in any RX FIFO queue or until timeout defined in struct timespec. The timeout is specified as a relative timeout. Passing NULL indicates an infinite timeout. | |
#define | RTEMS_CAN_CREATE_QUEUE _IOW( CAN_IOC_MAGIC, 11, struct rtems_can_queue_param ) |
This ioctl call creates new queue. Parameters are set with rtems_can_queue_param structure. | |
#define | RTEMS_CAN_SET_BITRATE _IOW( CAN_IOC_MAGIC, 12, struct rtems_can_set_bittiming ) |
This ioctl call sets controller's bitrate. See structure rtems_can_set_bittiming. | |
#define | RTEMS_CAN_CHIP_GET_TIMESTAMP _IOR( CAN_IOC_MAGIC, 13, uint64_t ) |
This ioctl call obtains 64 unsigned timestamp from the controller. | |
#define | RTEMS_CAN_CHIP_STATISTICS _IOR( CAN_IOC_MAGIC, 14, struct rtems_can_stats ) |
This ioctl call obtains controller's statistics via rtems_can_stats. | |
#define | RTEMS_CAN_GET_BITTIMING _IOWR( CAN_IOC_MAGIC, 15, struct rtems_can_get_bittiming ) |
This ioctl call gets controller's bitrate. See structure rtems_can_set_bittiming. | |
This file is part of CAN/CAN FD bus common support and defines generic CAN structures used for common IO operations.
#define CAN_CTRLMODE_MASK |