RTEMS 7.0-rc1
Loading...
Searching...
No Matches
Functions
can-bus.c File Reference

This file is part of CAN/CAN FD bus common support and implements common IO operations. More...

#include <rtems/imfs.h>
#include <rtems/malloc.h>
#include <rtems/timespec.h>
#include <rtems/score/basedefs.h>
#include <dev/can/can-helpers.h>
#include <dev/can/can-devcommon.h>
#include <dev/can/can.h>
#include <stdlib.h>
#include <string.h>

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 file is part of CAN/CAN FD bus common support and implements common IO operations.

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.