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

This header file is part of CAN/CAN FD bus common support. It declares structures and functions used for controller's side of FIFO operations. More...

#include <rtems.h>
#include <stdint.h>
#include <stdatomic.h>
#include <sys/ioccom.h>
#include <rtems/thread.h>
#include <dev/can/can.h>
#include <dev/can/can-bus.h>
#include <dev/can/can-impl.h>

Go to the source code of this file.

Data Structures

struct  rtems_can_queue_ends_dev
 This structure holds the controller's (application) side of queue's ends. More...
 
struct  rtems_can_chip_ops
 This structure represents CAN controller operations. These provides interface from IOCTL calls to controller functions and should be registered during controller initialization. More...
 
struct  rtems_can_chip
 This structure represents one CAN controller. More...
 
struct  rtems_can_queue_ends_user_t
 This structure holds the user's (application) side of queue's ends. More...
 
struct  rtems_can_user
 This structure represents one CAN user (application). More...
 

Functions

 TAILQ_HEAD (rtems_can_user_list_t, rtems_can_user)
 
int rtems_can_chip_start (struct rtems_can_chip *chip)
 This function starts the controller.
 
int rtems_can_bitrate2bittiming (struct rtems_can_chip *chip, struct rtems_can_bittiming *bt, const struct rtems_can_bittiming_const *btc)
 This function calculates CAN bit timing for given bit rate.
 
uint64_t rtems_can_fill_timestamp (void)
 This function fills timestamping with current monotonic time.
 
int rtems_can_queue_ends_init_user (struct rtems_can_queue_ends_user_t *qends)
 Userspace clients specific ends initialization.
 
int rtems_can_queue_ends_init_chip (struct rtems_can_chip *chip, const char *name)
 This function initializes ends from chip's side.
 

Detailed Description

This header file is part of CAN/CAN FD bus common support. It declares structures and functions used for controller's side of FIFO operations.

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

Function Documentation

◆ rtems_can_bitrate2bittiming()

int rtems_can_bitrate2bittiming ( struct rtems_can_chip chip,
struct rtems_can_bittiming bt,
const struct rtems_can_bittiming_const btc 
)

This function calculates CAN bit timing for given bit rate.

This calculates bit timing values for given bit rate (provided in bt input argument) and controller's maximum/minimal values given by btc argument.

Parameters
chipPointer to rtems_can_chip structure.
btPointer to rtems_can_bittiming structure. Calculated values are stored here.
btcPointer to rtems_can_bittiming_const structure. This provides maximum and minimal bit timing values of the controller.
Returns
Zero on success (and filled bt argument), negative value on error.

◆ rtems_can_chip_start()

int rtems_can_chip_start ( struct rtems_can_chip chip)

This function starts the controller.

Provides common interface to start controller based on rtems_can_chip structure passed as input parameter.

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

◆ rtems_can_fill_timestamp()

uint64_t rtems_can_fill_timestamp ( void  )

This function fills timestamping with current monotonic time.

Returns
64-bit timestamp value.

◆ rtems_can_queue_ends_init_chip()

int rtems_can_queue_ends_init_chip ( struct rtems_can_chip chip,
const char *  name 
)

This function initializes ends from chip's side.

It should be called by CAN controller to initialize its ends.

Parameters
chipPointer to rtems_can_chip structure
nameName of the controller's worker semaphore
Returns
Zero on success, negative value on error.

◆ rtems_can_queue_ends_init_user()

int rtems_can_queue_ends_init_user ( struct rtems_can_queue_ends_user_t qends)

Userspace clients specific ends initialization.

Parameters
qends_userPointer to rtems_can_queue_ends_user_t structure.
Returns
Zero on success; -1 otherwise.