CAN_DEVCTL_WRITE_CANMSG_EXT

Write an extended CAN message

Synopsis:

#include <sys/can_dcmd.h>

#define CAN_DEVCTL_WRITE_CANMSG_EXT   __DIOT(_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
dcmd CAN_DEVCTL_WRITE_CANMSG_EXT
dev_data_ptr A pointer to a struct can_msg
n_bytes sizeof(struct can_msg)
dev_info_ptr NULL

Description:

This command writes an extended CAN message with an arbitrary message ID.

Input:

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;

Output:

None.

Errors:

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

EAGAIN
The transmit queue is currently full.
EINVAL
The file descriptor doesn't correspond to a transmit mailbox.

See also:

CAN_DEVCTL_READ_CANMSG_EXT, CAN_DEVCTL_RX_FRAME_RAW_BLOCK, CAN_DEVCTL_RX_FRAME_RAW_NOBLOCK, CAN_DEVCTL_TX_FRAME_RAW

devctl() in the QNX Neutrino C Library Reference

canctl in the Utilities Reference