CAN_DEVCTL_RX_FRAME_RAW_NOBLOCK

Get a message in raw frame mode (nonblocking)

Synopsis:

#include <sys/can_dcmd.h>

#define CAN_DEVCTL_RX_FRAME_RAW_NOBLOCK __DIOF(_DCMD_MISC, CAN_CMD_CODE + 9, struct can_msg)

Arguments to devctl():

Argument Value
filedes A file descriptor that you obtained by opening the device. This must be for a receive mailbox (e.g., /dev/can1/rx2).
dcmd CAN_DEVCTL_RX_FRAME_RAW_NOBLOCK
dev_data_ptr A pointer to a struct can_msg
n_bytes sizeof(struct can_msg)
dev_info_ptr NULL

Description:

This command gets the next valid received message from the queue when the driver is in raw frame mode. If there are no messages, the command doesn't block. Not all CAN drivers support raw mode.

Input:

None.

Output:

A filled-in can_msg structure, which is defined in <sys/can_dcmd.h> as follows:

#define CAN_MSG_DATA_MAX  0x8 /* Max number of data bytes in a CAN message
                                 as defined by CAN spec */

/* Extended CAN Message */
typedef struct can_msg_ext {
    uint32_t        timestamp;         /* CAN message timestamp */
    uint32_t        is_extended_mid;   /* 1=29-bit MID, 0=11-bit MID */
    uint32_t        is_remote_frame;   /* 1=remote frame request, 0=data frame */
} CAN_MSG_EXT;

/* CAN Message */
typedef struct can_msg {
        /* Pre-allocate CAN messages to the max data size */
        uint8_t        dat[CAN_MSG_DATA_MAX];  /* CAN message data */
        uint8_t        len;                    /* Actual CAN message data length */
        uint32_t       mid;                    /* CAN message identifier */
        CAN_MSG_EXT    ext;                    /* Extended CAN message info */
} CAN_MSG;

Errors:

The devctl() function can return the following, in addition to the error codes listed in its entry in the C Library Reference:

EAGAIN
There are no messages in the queue.

See also:

CAN_DEVCTL_READ_CANMSG_EXT, CAN_DEVCTL_RX_FRAME_RAW_BLOCK, CAN_DEVCTL_TX_FRAME_RAW, CAN_DEVCTL_WRITE_CANMSG_EXT

devctl() in the QNX Neutrino C Library Reference

canctl in the Utilities Reference