RTEMS 7.0-rc1
Loading...
Searching...
No Matches
Data Structures | Functions
can-bus.h File Reference

This header file is part of CAN/CAN FD bus common support. It declares structures and functions used for CAN bus registration. More...

#include <rtems.h>
#include <stdint.h>
#include <stdatomic.h>
#include <sys/ioccom.h>
#include <rtems/thread.h>

Go to the source code of this file.

Data Structures

struct  rtems_can_bus
 This structure represents CAN bus device. This is the main structure passed throught file system during read/write/ioctl/close operations. More...
 

Functions

int rtems_can_bus_notify_chip_stop (struct rtems_can_chip *chip)
 This function notifies all users the chip was stopped.
 
int rtems_can_bus_register (struct rtems_can_bus *bus, const char *bus_path)
 This function registers CAN device into /dev namespace.
 

Detailed Description

This header file is part of CAN/CAN FD bus common support. It declares structures and functions used for CAN bus registration.

Implementation is based on original LinCAN - Linux CAN bus driver Part of OrtCAN project https://ortcan.sourceforge.net/

Function Documentation

◆ rtems_can_bus_notify_chip_stop()

int rtems_can_bus_notify_chip_stop ( struct rtems_can_chip chip)

This function notifies all users the chip was stopped.

This should be called from the chip's stop function once all frames are either aborted or flushed from the FIFOs. It basically unblocks users waiting on a blocking read.

Parameters
chipPointer to rtems_can_chip structure.
Returns
Zero on success, negative value on error.

◆ rtems_can_bus_register()

int rtems_can_bus_register ( struct rtems_can_bus bus,
const char *  bus_path 
)

This function registers CAN device into /dev namespace.

This should be called with already allocated rtems_can_bus structure and initialized controller to be registered.

Parameters
busPointer to rtems_can_bus structure.
bus_pathEntire path to which the device should be registered (i.e /dev/can0, /dev/my_can etc.).
Returns
Zero on success, negative value on error.