Socket CAN driver (Zephyr)
Interface Functions
-
int csp_can_open_and_add_interface(const struct device *device, const char *ifname, uint16_t address, uint32_t bitrate, uint16_t filter_addr, uint16_t filter_mask, csp_iface_t **return_iface)
[source] Open CAN and add CSP interface.
- Parameters:
device – CAN device structure.
ifname – CSP interface name.
address – CSP address of the interface.
bitrate – CAN bitrate.
filter_addr – Destination address you want to set in the RX filter.
filter_mask – Bit mask you want to set in the RX filter.
return_iface – Added interface
- Returns:
#CSP_ERR_NONE on success, otherwise an error code.
-
int csp_can_set_rx_filter(csp_iface_t *iface, uint16_t filter_addr, uint16_t filter_mask)
[source] Set CAN RX filter based on destination address and bit mask.
- Parameters:
iface – Interface to set the RX filter.
filter_addr – Destination address you want to set in the RX filter.
filter_mask – Bit mask you want to set in the RX filter.
- Returns:
Filter ID, a negative value on failure.
-
int csp_can_stop(csp_iface_t *iface)
[source] Stop the CAN and RX thread
- Parameters:
iface – Interface to stop.
- Returns:
#CSP_ERR_NONE on success, otherwise an error code.