CAN_DEVCTL_ERROR

Get error information

Synopsis:

#include <sys/can_dcmd.h>

#define CAN_DEVCTL_ERROR   __DIOF(_DCMD_MISC, CAN_CMD_CODE + 100, struct can_devctl_error)

Arguments to devctl():

Argument Value
filedes A file descriptor that you obtained by opening the device
dcmd CAN_DEVCTL_ERROR
dev_data_ptr A pointer to a CAN_DEVCTL_ERROR structure
n_bytes sizeof(CAN_DEVCTL_ERROR)
dev_info_ptr NULL

Description:

This command gets driver-specific error information. The driver might reset some of the information when you use this command; see src/hardware/can/board_name/board_namecan.readme in your BSP.

Input:

None.

Output:

The error information. The CAN_DEVCTL_ERROR structure is defined as follows:

typedef struct can_devctl_error {
        uint32_t                drvr1;     
        uint32_t                drvr2;     
        uint32_t                drvr3;     
        uint32_t                drvr4;     
} CAN_DEVCTL_ERROR;

For details, see src/hardware/can/board_name/board_namecan.readme in your Board Support Package.

Example:

int      ret;
struct can_devctl_error derror;

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

if(EOK != (ret = devctl(fd, CAN_DEVCTL_ERROR, &derror, sizeof(derror), NULL)))
{
    fprintf(stderr, "devctl CAN_DEVCTL_ERROR: %s\n", strerror(ret));
} else {
    printf("ERROR drvr1 = 0x%X\n", derror.drvr1);
    printf("ERROR drvr2 = 0x%X\n", derror.drvr2);
    printf("ERROR drvr3 = 0x%X\n", derror.drvr3);
    printf("ERROR drvr4 = 0x%X\n", derror.drvr4);
}

See also:

devctl() in the QNX Neutrino C Library Reference

canctl in the Utilities Reference