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

📄 rtcan.h

📁 Peak-CAN控制器(PCI接口)的驱动程序
💻 H
📖 第 1 页 / 共 3 页
字号:
 * * This service can be called from: * * - Kernel module initialization/cleanup code * - Kernel-based task * - User-space task (RT, non-RT) * * Rescheduling: never. */#define SIOCGCANCUSTOMBITTIME \            _IOWR(RTIOC_TYPE_CAN, 0x04, struct ifreq)/** * Set operation mode of CAN controller * * See @ref CAN_MODE "CAN controller modes" for available modes. * * @param [in] arg Pointer to interface request structure buffer *                 (<TT>struct ifreq</TT> from linux/if.h). *                 <TT>ifr_name</TT> must hold a valid CAN interface name, *                 <TT>ifr_ifru</TT> must be filled with an instance of *                 @ref can_mode_t. * * @return 0 on success, otherwise: * - -EFAULT: It was not possible to access user space memory area at the *            specified address. * - -ENODEV: No device with specified name exists. * - -EAGAIN: (@ref CAN_MODE_START, @ref CAN_MODE_STOP) Could not successfully *            set mode, hardware is busy. Try again. * - -EINVAL: (@ref CAN_MODE_START) Cannot start controller, *            set baud rate first. * - -ENETDOWN: (@ref CAN_MODE_SLEEP) Cannot go into sleep mode because                controller is stopped or bus off. * - -EOPNOTSUPP: unknown mode * * Environments: * * This service can be called from: * * - Kernel module initialization/cleanup code * - Kernel-based task * - User-space task (RT, non-RT) * * @note Setting a CAN controller into normal operation after a bus-off can * take some time (128 occurrences of 11 consecutive recessive bits). * In such a case, although this IOCTL will return immediately with success * and @ref SIOCGCANSTATE will report @ref CAN_STATE_ACTIVE, * bus-off recovery may still be in progress. @n * If a controller is bus-off, setting it into stop mode will return no error * but the controller remains bus-off. * * Rescheduling: possible. */#define SIOCSCANMODE \            _IOW(RTIOC_TYPE_CAN, 0x05, struct ifreq)/** * Get current state of CAN controller * * States are divided into main states and additional error indicators. A CAN * controller is always in exactly one main state. CAN bus errors are * registered by the CAN hardware and collected by the driver. There is one * error indicator (bit) per error type. If this IOCTL is triggered the error * types which occured since the last call of this IOCTL are reported and * thereafter the error indicators are cleared. See also * @ref CAN_STATE "CAN controller states". * * @param [in,out] arg Pointer to interface request structure buffer *                    (<TT>struct ifreq</TT> from linux/if.h). *                    <TT>ifr_name</TT> must hold a valid CAN interface name, *                    <TT>ifr_ifru</TT> will be filled with an instance of *                    @ref can_mode_t. * * @return 0 on success, otherwise: * - -EFAULT: It was not possible to access user space memory area at the *            specified address. * - -ENODEV: No device with specified name exists. * * Environments: * * This service can be called from: * * - Kernel module initialization/cleanup code * - Kernel-based task * - User-space task (RT, non-RT) * * Rescheduling: possible. */#define SIOCGCANSTATE           \            _IOWR(RTIOC_TYPE_CAN, 0x06, struct ifreq)/** * Set special controller modes * * Various special controller modes could be or'ed together (see  * @ref CAN_CTRLMODE for further information).  * * @param [in] arg Pointer to interface request structure buffer *                 (<TT>struct ifreq</TT> from linux/if.h). *                 <TT>ifr_name</TT> must hold a valid CAN interface name, *                 <TT>ifr_ifru</TT> must be filled with an instance of *                 @ref can_ctrlmode_t. * * @return 0 on success, otherwise: * - -EFAULT: It was not possible to access user space memory area at the *            specified address. * - -ENODEV: No device with specified name exists. * - -EINVAL: No valid baud rate, see @ref can_baudrate_t. * - -EAGAIN: Request could not be successully fulfilled. Try again. * * Environments: * * This service can be called from: * * - Kernel module initialization/cleanup code * - Kernel-based task * - User-space task (RT, non-RT) * * @note Setting specia controlelr modes is a configuration task. It should * be done deliberately or otherwise CAN messages will likely be lost. * * Rescheduling: possible. */#define SIOCSCANCTRLMODE \            _IOW(RTIOC_TYPE_CAN, 0x07, struct ifreq)/** * Get special controller modes * * * @param [in] arg Pointer to interface request structure buffer *                 (<TT>struct ifreq</TT> from linux/if.h). *                 <TT>ifr_name</TT> must hold a valid CAN interface name, *                 <TT>ifr_ifru</TT> must be filled with an instance of *                 @ref can_ctrlmode_t. * * @return 0 on success, otherwise: * - -EFAULT: It was not possible to access user space memory area at the *            specified address. * - -ENODEV: No device with specified name exists. * - -EINVAL: No baud rate was set yet. * * Environments: * * This service can be called from: * * - Kernel module initialization/cleanup code * - Kernel-based task * - User-space task (RT, non-RT) * * Rescheduling: possible. */#define SIOCGCANCTRLMODE        \            _IOWR(RTIOC_TYPE_CAN, 0x08, struct ifreq)/** * Enable or disable storing a high precision timestamp upon reception of * a CAN frame. * * A newly created socket takes no timestamps by default. * * @param [in] arg int variable, see @ref RTCAN_TIMESTAMPS "Timestamp switches" * * @return 0 on success. * * Environments: * * This service can be called from: * * - Kernel module initialization/cleanup code * - Kernel-based task * - User-space task (RT, non-RT) * * @note Activating taking timestamps only has an effect on newly received * CAN messages from the bus. Frames that already are in the socket buffer do * not have timestamps if it was deactivated before. See @ref Recv "Receive" * for more details. * * Rescheduling: never. */#define RTCAN_RTIOC_TAKE_TIMESTAMP      _IOW(RTIOC_TYPE_CAN, 0x09, int)/** * Specify a reception timeout for a socket * * Defines a timeout for all receive operations via a * socket which will take effect when one of the @ref Recv "receive functions" * is called without the @c MSG_DONTWAIT flag set. * * The default value for a newly created socket is an infinite timeout. * * @note The setting of the timeout value is not done atomically to avoid * locks. Please set the value before receiving messages from the socket. * * @param [in] arg Pointer to @ref nanosecs_rel_t variable. The value is *                interpreted as relative timeout in nanoseconds in case *                of a positive value. *                See @ref RTDM_TIMEOUT_xxx "Timeouts" for special timeouts. * * @return 0 on success, otherwise: * - -EFAULT: It was not possible to access user space memory area at the *            specified address. * * Environments: * * This service can be called from: * * - Kernel module initialization/cleanup code * - Kernel-based task * - User-space task (RT, non-RT) * * Rescheduling: never. */#define RTCAN_RTIOC_RCV_TIMEOUT     _IOW(RTIOC_TYPE_CAN, 0x0A, nanosecs_rel_t)/** * Specify a transmission timeout for a socket * * Defines a timeout for all send operations via a * socket which will take effect when one of the @ref Send "send functions" * is called without the @c MSG_DONTWAIT flag set. * * The default value for a newly created socket is an infinite timeout. * * @note The setting of the timeout value is not done atomically to avoid * locks. Please set the value before sending messages to the socket. * * @param [in] arg Pointer to @ref nanosecs_rel_t variable. The value is *                interpreted as relative timeout in nanoseconds in case *                of a positive value. *                See @ref RTDM_TIMEOUT_xxx "Timeouts" for special timeouts. * * @return 0 on success, otherwise: * - -EFAULT: It was not possible to access user space memory area at the *            specified address. * * Environments: * * This service can be called from: * * - Kernel module initialization/cleanup code * - Kernel-based task * - User-space task (RT, non-RT) * * Rescheduling: never. */#define RTCAN_RTIOC_SND_TIMEOUT     _IOW(RTIOC_TYPE_CAN, 0x0B, nanosecs_rel_t)/** @} */#define CAN_ERR_DLC 8 /* dlc for error frames *//*! * @anchor Errors @name Error mask * Error class (mask) in @c can_id field of struct can_frame to * be used with @ref CAN_RAW_ERR_FILTER.  * @{ *//** TX timeout (netdevice driver) */#define CAN_ERR_TX_TIMEOUT   0x00000001U/** Lost arbitration (see @ref Error0 "data[0]") */#define CAN_ERR_LOSTARB      0x00000002U/** Controller problems (see @ref Error1 "data[1]") */#define CAN_ERR_CRTL         0x00000004U/** Protocol violations (see @ref Error2 "data[2]",                              @ref Error3 "data[3]") */#define CAN_ERR_PROT         0x00000008U/** Transceiver status (see @ref Error4 "data[4]")    */#define CAN_ERR_TRX          0x00000010U/** Received no ACK on transmission */#define CAN_ERR_ACK          0x00000020U/** Bus off */#define CAN_ERR_BUSOFF       0x00000040U/** Bus error (may flood!) */#define CAN_ERR_BUSERROR     0x00000080U /** Controller restarted */#define CAN_ERR_RESTARTED    0x00000100U/** Omit EFF, RTR, ERR flags */#define CAN_ERR_MASK         0x1FFFFFFFU /** @} *//*! * @anchor Error0 @name Arbitration lost error * Error in the data[0] field of struct can_frame. * @{ *//* arbitration lost in bit ... / data[0] */#define CAN_ERR_LOSTARB_UNSPEC   0x00 /**< unspecified */                                      /**< else bit number in bitstream *//** @} *//*! * @anchor Error1 @name Controller problems * Error in the data[1] field of struct can_frame. * @{ *//* error status of CAN-controller / data[1] */#define CAN_ERR_CRTL_UNSPEC      0x00 /**< unspecified */#define CAN_ERR_CRTL_RX_OVERFLOW 0x01 /**< RX buffer overflow */#define CAN_ERR_CRTL_TX_OVERFLOW 0x02 /**< TX buffer overflow */#define CAN_ERR_CRTL_RX_WARNING  0x04 /**< reached warning level for RX errors */#define CAN_ERR_CRTL_TX_WARNING  0x08 /**< reached warning level for TX errors */#define CAN_ERR_CRTL_RX_PASSIVE  0x10 /**< reached passive level for RX errors */#define CAN_ERR_CRTL_TX_PASSIVE  0x20 /**< reached passive level for TX errors *//** @} *//*! * @anchor Error2 @name Protocol error type * Error in the data[2] field of struct can_frame. * @{ *//* error in CAN protocol (type) / data[2] */#define CAN_ERR_PROT_UNSPEC      0x00 /**< unspecified */#define CAN_ERR_PROT_BIT         0x01 /**< single bit error */#define CAN_ERR_PROT_FORM        0x02 /**< frame format error */#define CAN_ERR_PROT_STUFF       0x04 /**< bit stuffing error */#define CAN_ERR_PROT_BIT0        0x08 /**< unable to send dominant bit */#define CAN_ERR_PROT_BIT1        0x10 /**< unable to send recessive bit */#define CAN_ERR_PROT_OVERLOAD    0x20 /**< bus overload */#define CAN_ERR_PROT_ACTIVE      0x40 /**< active error announcement */#define CAN_ERR_PROT_TX          0x80 /**< error occured on transmission *//** @} *//*! * @anchor Error3 @name Protocol error location * Error in the data[3] field of struct can_frame. * @{ *//* error in CAN protocol (location) / data[3] */#define CAN_ERR_PROT_LOC_UNSPEC  0x00 /**< unspecified */#define CAN_ERR_PROT_LOC_SOF     0x03 /**< start of frame */#define CAN_ERR_PROT_LOC_ID28_21 0x02 /**< ID bits 28 - 21 (SFF: 10 - 3) */#define CAN_ERR_PROT_LOC_ID20_18 0x06 /**< ID bits 20 - 18 (SFF: 2 - 0 )*/#define CAN_ERR_PROT_LOC_SRTR    0x04 /**< substitute RTR (SFF: RTR) */#define CAN_ERR_PROT_LOC_IDE     0x05 /**< identifier extension */#define CAN_ERR_PROT_LOC_ID17_13 0x07 /**< ID bits 17-13 */#define CAN_ERR_PROT_LOC_ID12_05 0x0F /**< ID bits 12-5 */#define CAN_ERR_PROT_LOC_ID04_00 0x0E /**< ID bits 4-0 */#define CAN_ERR_PROT_LOC_RTR     0x0C /**< RTR */#define CAN_ERR_PROT_LOC_RES1    0x0D /**< reserved bit 1 */#define CAN_ERR_PROT_LOC_RES0    0x09 /**< reserved bit 0 */#define CAN_ERR_PROT_LOC_DLC     0x0B /**< data length code */#define CAN_ERR_PROT_LOC_DATA    0x0A /**< data section */#define CAN_ERR_PROT_LOC_CRC_SEQ 0x08 /**< CRC sequence */#define CAN_ERR_PROT_LOC_CRC_DEL 0x18 /**< CRC delimiter */#define CAN_ERR_PROT_LOC_ACK     0x19 /**< ACK slot */#define CAN_ERR_PROT_LOC_ACK_DEL 0x1B /**< ACK delimiter */#define CAN_ERR_PROT_LOC_EOF     0x1A /**< end of frame */#define CAN_ERR_PROT_LOC_INTERM  0x12 /**< intermission *//** @} *//*! * @anchor Error4 @name Protocol error location * Error in the data[4] field of struct can_frame. * @{ *//* error status of CAN-transceiver / data[4] *//*                                               CANH CANL */#define CAN_ERR_TRX_UNSPEC             0x00 /**< 0000 0000 */#define CAN_ERR_TRX_CANH_NO_WIRE       0x04 /**< 0000 0100 */#define CAN_ERR_TRX_CANH_SHORT_TO_BAT  0x05 /**< 0000 0101 */#define CAN_ERR_TRX_CANH_SHORT_TO_VCC  0x06 /**< 0000 0110 */#define CAN_ERR_TRX_CANH_SHORT_TO_GND  0x07 /**< 0000 0111 */#define CAN_ERR_TRX_CANL_NO_WIRE       0x40 /**< 0100 0000 */#define CAN_ERR_TRX_CANL_SHORT_TO_BAT  0x50 /**< 0101 0000 */#define CAN_ERR_TRX_CANL_SHORT_TO_VCC  0x60 /**< 0110 0000 */#define CAN_ERR_TRX_CANL_SHORT_TO_GND  0x70 /**< 0111 0000 */#define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80 /**< 1000 0000 *//** @} *//* controller specific additional information / data[5..7] *//** @} *//** @} */#endif /* _RTCAN_H */

⌨️ 快捷键说明

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