libnl: CAN

libnl 3.7.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. More...
int | rtnl_link_can_restart (struct rtnl_link *link)
| Restart CAN device. More...
int | rtnl_link_can_freq (struct rtnl_link *link, uint32_t *freq)
| Get CAN base frequency. More...
int | rtnl_link_can_state (struct rtnl_link *link, uint32_t *state)
| Get CAN state. More...
int | rtnl_link_can_berr_rx (struct rtnl_link *link)
| Get CAN RX bus error count. More...
int | rtnl_link_can_berr_tx (struct rtnl_link *link)
| Get CAN TX bus error count. More...
int | rtnl_link_can_berr (struct rtnl_link *link, struct can_berr_counter *berr)
| Get CAN bus error count. More...
int | rtnl_link_can_get_bt_const (struct rtnl_link *link, struct can_bittiming_const *bt_const)
| Get CAN hardware-dependent bit-timing constant. More...
int | rtnl_link_can_get_bittiming (struct rtnl_link *link, struct can_bittiming *bit_timing)
| Get CAN device bit-timing. More...
int | rtnl_link_can_set_bittiming (struct rtnl_link *link, const struct can_bittiming *bit_timing)
| Set CAN device bit-timing. More...
int | rtnl_link_can_get_bitrate (struct rtnl_link *link, uint32_t *bitrate)
| Get CAN device bit-timing. More...
int | rtnl_link_can_set_bitrate (struct rtnl_link *link, uint32_t bitrate)
| Set CAN device bit-rate. More...
int | rtnl_link_can_get_sample_point (struct rtnl_link *link, uint32_t *sp)
| Get CAN device sample point. More...
int | rtnl_link_can_set_sample_point (struct rtnl_link *link, uint32_t sp)
| Set CAN device sample point. More...
int | rtnl_link_can_get_restart_ms (struct rtnl_link *link, uint32_t *interval)
| Get CAN device restart intervall. More...
int | rtnl_link_can_set_restart_ms (struct rtnl_link *link, uint32_t interval)
| Set CAN device restart intervall. More...
int | rtnl_link_can_get_ctrlmode (struct rtnl_link *link, uint32_t *ctrlmode)
| Get CAN control mode. More...
int | rtnl_link_can_set_ctrlmode (struct rtnl_link *link, uint32_t ctrlmode)
| Set a CAN Control Mode. More...
int | rtnl_link_can_unset_ctrlmode (struct rtnl_link *link, uint32_t ctrlmode)
| Unset a CAN Control Mode. More...
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. More...
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. More...
int | rtnl_link_can_get_data_bittiming (struct rtnl_link *link, struct can_bittiming *data_bit_timing)
| Get CAN FD device data bit-timing. More...
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. More...

## 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 389 of file can.c.

## ◆ 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 400 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 419 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 441 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 460 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 478 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 497 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 520 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 544 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 568 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 590 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 613 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 632 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 655 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 674 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 697 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 716 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 739 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 759 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 779 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 803 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 825 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 849 of file can.c.