22 #ifndef LELY_IO2_INTERN_LINUX_CAN_ERR_H_
23 #define LELY_IO2_INTERN_LINUX_CAN_ERR_H_
36 #include <linux/can/error.h>
42 static int can_frame2can_err(
43 const struct can_frame *frame,
struct can_err *err);
46 can_frame2can_err(
const struct can_frame *frame,
struct can_err *err)
50 if (!(frame->can_id & CAN_ERR_FLAG))
53 if (frame->can_dlc != CAN_ERR_DLC) {
61 if (frame->can_id & CAN_ERR_RESTARTED)
64 if (frame->can_id & CAN_ERR_TX_TIMEOUT)
67 if (frame->can_id & CAN_ERR_CRTL) {
68 #ifdef CAN_ERR_CRTL_ACTIVE
69 if (frame->data[1] & CAN_ERR_CRTL_ACTIVE)
73 if (frame->data[1] & (CAN_ERR_CRTL_RX_PASSIVE
74 | CAN_ERR_CRTL_TX_PASSIVE))
79 if (frame->can_id & CAN_ERR_PROT) {
80 if (frame->data[2] & CAN_ERR_PROT_BIT)
82 if (frame->data[2] & CAN_ERR_PROT_FORM)
84 if (frame->data[2] & CAN_ERR_PROT_STUFF)
87 if (frame->data[2] & (CAN_ERR_PROT_BIT0 | CAN_ERR_PROT_BIT1
88 | CAN_ERR_PROT_OVERLOAD))
91 if (frame->data[2] & CAN_ERR_PROT_ACTIVE)
93 if (frame->data[3] & CAN_ERR_PROT_LOC_CRC_SEQ)
97 if ((frame->can_id & CAN_ERR_TRX) && frame->data[4])
100 if (frame->can_id & CAN_ERR_ACK)
103 if (frame->can_id & CAN_ERR_BUSOFF)
can_error
The error flags of a CAN bus, which are not mutually exclusive.
@ CAN_ERROR_FORM
A form error.
@ CAN_ERROR_BIT
A single bit error.
@ CAN_ERROR_STUFF
A bit stuffing error.
@ CAN_ERROR_ACK
An acknowledgment error.
@ CAN_ERROR_CRC
A CRC sequence error.
@ CAN_ERROR_OTHER
One or more other errors.
can_state
The states of a CAN node, depending on the TX/RX error count.
@ CAN_STATE_BUSOFF
The bus off state (TX/RX error count >= 256).
@ CAN_STATE_PASSIVE
The error passive state (TX/RX error count < 256).
@ CAN_STATE_ACTIVE
The error active state (TX/RX error count < 128).
This header file is part of the I/O library; it contains the CAN bus declarations for Linux.
This is the public header file of the utilities library.
This header file is part of the I/O library; it contains CAN bus error definitions.
This is the internal header file of the Windows-specific I/O declarations.
int state
The state of the CAN node (one of CAN_STATE_ACTIVE, CAN_STATE_PASSIVE or CAN_STATE_BUSOFF).
int error
The error flags of the CAN bus (any combination of CAN_ERROR_BIT, CAN_ERROR_STUFF,...