libnl: CAN

libnl 3.12.0

CAN
Routing Library (libnl-route) » Links (Interfaces)

Controller Area Network link module. More...

## Control Mode Translation
char * | rtnl_link_can_ctrlmode2str (int ctrlmode, char *buf, size_t len)
int | rtnl_link_can_str2ctrlmode (const char *name)

## CAN Object
int | rtnl_link_is_can (struct rtnl_link *link)
| Check if link is a CAN link.
int | rtnl_link_can_restart (struct rtnl_link *link)
| Restart CAN device.
int | rtnl_link_can_freq (struct rtnl_link *link, uint32_t *freq)
| Get CAN base frequency.
int | rtnl_link_can_state (struct rtnl_link *link, uint32_t *state)
| Get CAN state.
int | rtnl_link_can_berr_rx (struct rtnl_link *link)
| Get CAN RX bus error count.
int | rtnl_link_can_berr_tx (struct rtnl_link *link)
| Get CAN TX bus error count.
int | rtnl_link_can_berr (struct rtnl_link *link, struct can_berr_counter *berr)
| Get CAN bus error count.
int | rtnl_link_can_get_bt_const (struct rtnl_link *link, struct can_bittiming_const *bt_const)
| Get CAN hardware-dependent bit-timing constant.
int | rtnl_link_can_get_bittiming (struct rtnl_link *link, struct can_bittiming *bit_timing)
| Get CAN device bit-timing.
int | rtnl_link_can_set_bittiming (struct rtnl_link *link, const struct can_bittiming *bit_timing)
| Set CAN device bit-timing.
int | rtnl_link_can_get_bitrate (struct rtnl_link *link, uint32_t *bitrate)
| Get CAN device bit-timing.
int | rtnl_link_can_set_bitrate (struct rtnl_link *link, uint32_t bitrate)
| Set CAN device bit-rate.
int | rtnl_link_can_get_sample_point (struct rtnl_link *link, uint32_t *sp)
| Get CAN device sample point.
int | rtnl_link_can_set_sample_point (struct rtnl_link *link, uint32_t sp)
| Set CAN device sample point.
int | rtnl_link_can_get_restart_ms (struct rtnl_link *link, uint32_t *interval)
| Get CAN device restart intervall.
int | rtnl_link_can_set_restart_ms (struct rtnl_link *link, uint32_t interval)
| Set CAN device restart intervall.
int | rtnl_link_can_get_ctrlmode (struct rtnl_link *link, uint32_t *ctrlmode)
| Get CAN control mode.
int | rtnl_link_can_set_ctrlmode (struct rtnl_link *link, uint32_t ctrlmode)
| Set a CAN Control Mode.
int | rtnl_link_can_unset_ctrlmode (struct rtnl_link *link, uint32_t ctrlmode)
| Unset a CAN Control Mode.
int | rtnl_link_can_get_data_bittiming_const (struct rtnl_link *link, struct can_bittiming_const *data_bt_const)
| Get CAN FD hardware-dependent data bit-timing constant.
int | rtnl_link_can_set_data_bittiming_const (struct rtnl_link *link, const struct can_bittiming_const *data_bt_const)
| Set CAN FD device data bit-timing-const.
int | rtnl_link_can_get_data_bittiming (struct rtnl_link *link, struct can_bittiming *data_bit_timing)
| Get CAN FD device data bit-timing.
int | rtnl_link_can_set_data_bittiming (struct rtnl_link *link, const struct can_bittiming *data_bit_timing)
| Set CAN FD device data bit-timing.
int | rtnl_link_can_get_device_stats (struct rtnl_link *link, struct can_device_stats *device_stats)
| Get CAN device stats.

## Detailed Description

Controller Area Network link module.

Link Type Name: "can"

CAN Documentation (Netlink Routing Development Guide)

## Function Documentation

## ◆ rtnl_link_is_can()

int rtnl_link_is_can | ( | struct rtnl_link * | link | ) |

Check if link is a CAN link.

Parameters

  link | Link object

Returns
  True if link is a CAN link, otherwise false is returned.

Definition at line 417 of file can.c.

References rtnl_link_info_ops::io_name.

## ◆ rtnl_link_can_restart()

int rtnl_link_can_restart | ( | struct rtnl_link * | link | ) |

Restart CAN device.

Parameters

  link | Link object

Returns
  0 on success or a negative error code

Definition at line 428 of file can.c.

## ◆ rtnl_link_can_freq()

int rtnl_link_can_freq | ( | struct rtnl_link * | link,
|  | uint32_t * | freq )

Get CAN base frequency.

Parameters

  link | Link object
  freq | frequency in Hz

Returns
  0 on success or a negative error code

Definition at line 447 of file can.c.

## ◆ rtnl_link_can_state()

int rtnl_link_can_state | ( | struct rtnl_link * | link,
|  | uint32_t * | state )

Get CAN state.

Parameters

  link | Link object
  state | CAN bus state

Returns
  0 on success or a negative error code

Definition at line 469 of file can.c.

## ◆ rtnl_link_can_berr_rx()

int rtnl_link_can_berr_rx | ( | struct rtnl_link * | link | ) |

Get CAN RX bus error count.

Parameters

  link | Link object

Returns
  RX bus error count on success or a negative error code

Definition at line 488 of file can.c.

## ◆ rtnl_link_can_berr_tx()

int rtnl_link_can_berr_tx | ( | struct rtnl_link * | link | ) |

Get CAN TX bus error count.

Parameters

  link | Link object

Returns
  TX bus error count on success or a negative error code

Definition at line 506 of file can.c.

## ◆ rtnl_link_can_berr()

int rtnl_link_can_berr | ( | struct rtnl_link * | link,
|  | struct can_berr_counter * | berr )

Get CAN bus error count.

Parameters

  link | Link object
  berr | Bus error count

Returns
  0 on success or a negative error code

Definition at line 525 of file can.c.

## ◆ rtnl_link_can_get_bt_const()

int rtnl_link_can_get_bt_const | ( | struct rtnl_link * | link,
|  | struct can_bittiming_const * | bt_const )

Get CAN hardware-dependent bit-timing constant.

Parameters

  link | Link object
  bt_const | Bit-timing constant

Returns
  0 on success or a negative error code

Definition at line 548 of file can.c.

## ◆ rtnl_link_can_get_bittiming()

int rtnl_link_can_get_bittiming | ( | struct rtnl_link * | link,
|  | struct can_bittiming * | bit_timing )

Get CAN device bit-timing.

Parameters

  link | Link object
  bit_timing | CAN bit-timing

Returns
  0 on success or a negative error code

Definition at line 572 of file can.c.

## ◆ rtnl_link_can_set_bittiming()

int rtnl_link_can_set_bittiming | ( | struct rtnl_link * | link,
|  | const struct can_bittiming * | bit_timing )

Set CAN device bit-timing.

Parameters

  link | Link object
  bit_timing | CAN bit-timing

Returns
  0 on success or a negative error code

Definition at line 596 of file can.c.

## ◆ rtnl_link_can_get_bitrate()

int rtnl_link_can_get_bitrate | ( | struct rtnl_link * | link,
|  | uint32_t * | bitrate )

Get CAN device bit-timing.

Parameters

  link | Link object
  bitrate | CAN bitrate

Returns
  0 on success or a negative error code

Definition at line 618 of file can.c.

## ◆ rtnl_link_can_set_bitrate()

int rtnl_link_can_set_bitrate | ( | struct rtnl_link * | link,
|  | uint32_t | bitrate )

Set CAN device bit-rate.

Parameters

  link | Link object
  bitrate | CAN bitrate

Returns
  0 on success or a negative error code

Definition at line 641 of file can.c.

## ◆ rtnl_link_can_get_sample_point()

int rtnl_link_can_get_sample_point | ( | struct rtnl_link * | link,
|  | uint32_t * | sp )

Get CAN device sample point.

Parameters

  link | Link object
  sp | CAN sample point

Returns
  0 on success or a negative error code

Definition at line 660 of file can.c.

## ◆ rtnl_link_can_set_sample_point()

int rtnl_link_can_set_sample_point | ( | struct rtnl_link * | link,
|  | uint32_t | sp )

Set CAN device sample point.

Parameters

  link | Link object
  sp | CAN sample point

Returns
  0 on success or a negative error code

Definition at line 683 of file can.c.

## ◆ rtnl_link_can_get_restart_ms()

int rtnl_link_can_get_restart_ms | ( | struct rtnl_link * | link,
|  | uint32_t * | interval )

Get CAN device restart intervall.

Parameters

  link | Link object
  interval | Restart intervall in ms

Returns
  0 on success or a negative error code

Definition at line 702 of file can.c.

## ◆ rtnl_link_can_set_restart_ms()

int rtnl_link_can_set_restart_ms | ( | struct rtnl_link * | link,
|  | uint32_t | interval )

Set CAN device restart intervall.

Parameters

  link | Link object
  interval | Restart intervall in ms

Returns
  0 on success or a negative error code

Definition at line 725 of file can.c.

## ◆ rtnl_link_can_get_ctrlmode()

int rtnl_link_can_get_ctrlmode | ( | struct rtnl_link * | link,
|  | uint32_t * | ctrlmode )

Get CAN control mode.

Parameters

  link | Link object
  ctrlmode | CAN control mode

Returns
  0 on success or a negative error code

Definition at line 744 of file can.c.

## ◆ rtnl_link_can_set_ctrlmode()

int rtnl_link_can_set_ctrlmode | ( | struct rtnl_link * | link,
|  | uint32_t | ctrlmode )

Set a CAN Control Mode.

Parameters

  link | Link object
  ctrlmode | CAN control mode

Returns
  0 on success or a negative error code

Definition at line 767 of file can.c.

## ◆ rtnl_link_can_unset_ctrlmode()

int rtnl_link_can_unset_ctrlmode | ( | struct rtnl_link * | link,
|  | uint32_t | ctrlmode )

Unset a CAN Control Mode.

Parameters

  link | Link object
  ctrlmode | CAN control mode

Returns
  0 on success or a negative error code

Definition at line 787 of file can.c.

## ◆ rtnl_link_can_get_data_bittiming_const()

int rtnl_link_can_get_data_bittiming_const | ( | struct rtnl_link * | link,
|  | struct can_bittiming_const * | data_bt_const )

Get CAN FD hardware-dependent data bit-timing constant.

Parameters

  link | Link object
  data_bt_const | CAN FD data bit-timing constant

Returns
  0 on success or a negative error code

Definition at line 807 of file can.c.

## ◆ rtnl_link_can_set_data_bittiming_const()

int rtnl_link_can_set_data_bittiming_const | ( | struct rtnl_link * | link,
|  | const struct can_bittiming_const * | data_bt_const )

Set CAN FD device data bit-timing-const.

Parameters

  link | Link object
  data_bit_timing | CAN FD data bit-timing

Returns
  0 on success or a negative error code

Definition at line 831 of file can.c.

## ◆ rtnl_link_can_get_data_bittiming()

int rtnl_link_can_get_data_bittiming | ( | struct rtnl_link * | link,
|  | struct can_bittiming * | data_bit_timing )

Get CAN FD device data bit-timing.

Parameters

  link | Link object
  data_bit_timing | CAN FD data bit-timing

Returns
  0 on success or a negative error code

Definition at line 853 of file can.c.

## ◆ rtnl_link_can_set_data_bittiming()

int rtnl_link_can_set_data_bittiming | ( | struct rtnl_link * | link,
|  | const struct can_bittiming * | data_bit_timing )

Set CAN FD device data bit-timing.

Parameters

  link | Link object
  data_bit_timing | CAN FD data bit-timing

Returns
  0 on success or a negative error code

Definition at line 877 of file can.c.

## ◆ rtnl_link_can_get_device_stats()

int rtnl_link_can_get_device_stats | ( | struct rtnl_link * | link,
|  | struct can_device_stats * | device_stats )

Get CAN device stats.

Parameters

  link | Link object
  device_stats | CAN device stats

Returns
  0 on success or a negative error code

Definition at line 899 of file can.c.

## ◆ rtnl_link_can_ctrlmode2str()

char * rtnl_link_can_ctrlmode2str | ( | int | ctrlmode,
|  | char * | buf,
|  | size_t | len )

Definition at line 934 of file can.c.

## ◆ rtnl_link_can_str2ctrlmode()

int rtnl_link_can_str2ctrlmode | ( | const char * | name | ) |

Definition at line 940 of file can.c.