CAN_DEVCTL_SET_PRIO

Set the priority for transmitted messages

Synopsis:

#include <sys/can_dcmd.h>

#define CAN_DEVCTL_SET_PRIO   __DIOT(_DCMD_MISC, CAN_CMD_CODE + 5, uint32_t)

Arguments to devctl():

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

Description:

This command sets the priority of messages for a transmit mailbox. The hardware uses these priorities to determine which CAN message to transmit first if there are multiple messages waiting to be transmitted.

Note: Some devices use fixed priorities for the mailboxes. For example, the first message object (i.e., the one that RX0 receives) might have the highest priority, and the last might have the lowest.

Input:

The new priority, which must not exceed the maximum for the device (usually defined as a constant whose name is in the form board_CANMCF_TPL_MAXVAL).

Output:

None.

Example:

int      ret;
uint32_t val;

if( (fd = open( "/dev/can1/tx3", O_RDWR)) == -1 )
{
    printf("open of %s failed \n", devname);
    exit(EXIT_FAILURE);
}

/* Get the new priority. */
val = strtoul(optarg, NULL, 0);

if(EOK != (ret = devctl(fd, CAN_DEVCTL_SET_PRIO, &val, sizeof(val), NULL)))
{
    fprintf(stderr, "devctl CAN_DEVCTL_SET_PRIO: %s\n", strerror(ret));
}

See also:

CAN_DEVCTL_GET_PRIO

devctl() in the QNX Neutrino C Library Reference

canctl in the Utilities Reference