CAN_DEVCTL_GET_STATS

Get CAN statistics

Synopsis:

#include <sys/can_dcmd.h>

#define CAN_DEVCTL_GET_STATS   __DIOF(_DCMD_MISC, CAN_CMD_CODE + 100,  struct can_devctl_stats)

Arguments to devctl():

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

Description:

This command gets CAN statistics, including some that you can use to monitor CAN bus issues.

Input:

None.

Output:

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

typedef struct can_devctl_stats
{
    uint32_t                    transmitted_frames;
    uint32_t                    received_frames;
    uint32_t                    missing_ack;
    uint32_t                    total_frame_errors;
    uint32_t                    stuff_errors;
    uint32_t                    form_errors;
    uint32_t                    dom_bit_recess_errors;
    uint32_t                    recess_bit_dom_errors;
    uint32_t                    parity_errors;
    uint32_t                    crc_errors;
    uint32_t                    hw_receive_overflows;
    uint32_t                    sw_receive_q_full;
    uint32_t                    error_warning_state_count;
    uint32_t                    error_passive_state_count;
    uint32_t                    bus_off_state_count;
    uint32_t                    bus_idle_count;
    uint32_t                    power_down_count;
    uint32_t                    wake_up_count;
    uint32_t                    rx_interrupts;
    uint32_t                    tx_interrupts;
    uint32_t                    total_interrupts;
} CAN_DEVCTL_STATS;

See also:

CAN_DEVCTL_GET_INFO

devctl() in the QNX Neutrino C Library Reference

canctl in the Utilities Reference