42#ifndef _DEV_CAN_CAN_DEVCOMMON_H
43#define _DEV_CAN_CAN_DEVCOMMON_H
48#include <sys/ioccom.h>
49#include <rtems/thread.h>
75TAILQ_HEAD( can_user_list_t,
can_user );
100 ioctl_command_t command,
284 rtems_binary_semaphore worker_sem
This header file is part of CAN/CAN FD bus common support. It declares structures and functions used ...
int canqueue_ends_init_chip(struct canque_ends_dev_t *qends_dev, struct can_chip *chip, rtems_binary_semaphore worker_sem)
This function initializes ends from chip's side.
Definition: can-devcommon.c:88
int canqueue_ends_init_user(struct canque_ends_user_t *qends)
Userspace clients specific ends initialization.
Definition: can-quekern.c:210
int rtems_can_bitrate2bittiming(struct can_chip *chip, struct can_bittiming *bt, const struct can_bittiming_const *btc)
This function calculates CAN bit timing for given bit rate.
Definition: can-bittiming.c:125
void rtems_can_filltimestamp(uint64_t *timestamp)
This function fills timestamping with current monotonic time.
Definition: can-devcommon.c:116
int rtems_can_chip_start(struct can_chip *chip)
This function starts the controller.
Definition: can-devcommon.c:134
This file is part of CAN/CAN FD bus common support and implements CAN FIFOs and generic hubs/ends for...
This file is part of CAN/CAN FD bus common support and defines generic CAN structures used for common...
This structure is used to represent CAN bit timing constants.
Definition: can-bittiming.h:85
This structure is used to represent CAN bit timing.
Definition: can-bittiming.h:129
This structure represents CAN bus device. This is the main structure passed throught file system duri...
Definition: can-bus.h:59
struct can_chip * chip
This member holds the pointer to can_chip structure. Controller specific initialization function shou...
Definition: can-bus.h:65
This structure represents CAN controller operations. These provides interface from IOCTL calls to con...
Definition: can-devcommon.h:84
int(* set_chip_mode)(struct can_chip *chip, uint32_t mode)
Sets controller mode defined in input argument. Called with RTEMS_CAN_CHIP_SET_MODE.
Definition: can-devcommon.h:138
int(* stop_chip)(struct can_chip *chip)
Stops the chip. Called with RTEMS_CAN_CHIP_STOP ioctl.
Definition: can-devcommon.h:92
int(* start_chip)(struct can_chip *chip)
Starts the chip. Called with RTEMS_CAN_CHIP_START ioctl.
Definition: can-devcommon.h:88
int(* calc_bittiming)(struct can_chip *chip, int type, struct can_bittiming *bt)
Calculates bit timing from given bit rate and saves the values to controller's registers....
Definition: can-devcommon.h:119
int(* check_and_set_bittiming)(struct can_chip *chip, int type, struct can_bittiming *bt)
Checks bit timing given by user and saves it to controller's registers. Called with RTEMS_CAN_SET_BIT...
Definition: can-devcommon.h:129
int(* get_chip_info)(struct can_chip *chip, int what)
Obtains controller's information specified by input integer argument. Called with RTEMS_CAN_CHIP_GET_...
Definition: can-devcommon.h:112
int(* get_chip_timestamp)(struct can_chip *chip, uint64_t *timestamp)
Obtains timestamp from the controller. Called with RTEMS_CAN_CHIP_GET_TIMESTAMP ioctl.
Definition: can-devcommon.h:107
int(* chip_ioctl)(struct can_chip *chip, ioctl_command_t command, void *arg)
Unrecognized ioctl calls are passed to chip specific function to handle them. This way chip specific ...
Definition: can-devcommon.h:98
This structure represents one CAN controller.
Definition: can-devcommon.h:144
const struct can_bittiming_const * data_bittiming_const
This member holds data bit timing constants (max/min values)
Definition: can-devcommon.h:188
struct can_user_list_t can_users
This member holds the list of chip's users.
Definition: can-devcommon.h:208
struct canque_ends_dev_t * qends_dev
This member holds chip's side of queue ends.
Definition: can-devcommon.h:204
uint32_t ctrlmode_supported
This member holds modes supported by the controller. Controller's device driver should set this field...
Definition: can-devcommon.h:180
const char * type
This member holds controller's type/name.
Definition: can-devcommon.h:148
atomic_uint used
This member holds the number of users using the controller.
Definition: can-devcommon.h:169
bool close_nonblock
This member informs whether close operation is blocking or nonblocking. This can be set with RTEMS_CA...
Definition: can-devcommon.h:161
struct can_stats chip_stats
This member holds the chip's statistics.
Definition: can-devcommon.h:212
atomic_uint flags
This member holds controller's flags.
Definition: can-devcommon.h:165
uint32_t ctrlmode
This member holds the currently set mode. Controller's device driver may set initial modes if needed.
Definition: can-devcommon.h:174
const struct can_bittiming_const * bittiming_const
This member holds nominal bit timing constants (max/min values)
Definition: can-devcommon.h:184
struct can_chip_ops chip_ops
This member holds chip operations.
Definition: can-devcommon.h:200
struct can_bittiming bittiming
This member holds currently set nominal btt timing values.
Definition: can-devcommon.h:192
struct can_bittiming data_bittiming
This member holds currently set data btt timing values.
Definition: can-devcommon.h:196
rtems_vector_number irq
This member holds controller's interrupt number.
Definition: can-devcommon.h:152
void * priv
This member holds chip's specific private structure. This structur defines non generic fields and set...
Definition: can-devcommon.h:217
unsigned freq
This member holds controller's base clock frequency.
Definition: can-devcommon.h:156
This structure is used to represent CAN statistics.
Definition: can-stats.h:51
This structure represents one CAN user (application).
Definition: can-devcommon.h:248
TAILQ_ENTRY(can_user) peers
This member holds TAILQ entry.
struct can_bus * bus
This member holds pointer to can_bus structure.
Definition: can-devcommon.h:264
int magic
This member holds user magic value. It should be set to RTEMS_CAN_USER_MAGIC value.
Definition: can-devcommon.h:269
unsigned long flags
This member holds user's flags.
Definition: can-devcommon.h:252
struct canque_ends_user_t * qends_user
This member holds user's side of queue's ends.
Definition: can-devcommon.h:260
This structure holds the controller's (application) side of queue's ends.
Definition: can-devcommon.h:58
struct can_chip * chip
This member holds the chip's structure.
Definition: can-devcommon.h:66
struct canque_ends_t base
This member holds base canque_ends_t structure.
Definition: can-devcommon.h:62
rtems_binary_semaphore worker_sem
This member holds the worker semaphore used to trigger controller when there is a new message to be t...
Definition: can-devcommon.h:71
This structure represents place to connect edges to for CAN communication entity. The zero,...
Definition: can-queue.h:603
This structure holds the user's (application) side of queue's ends.
Definition: can-devcommon.h:223
rtems_binary_semaphore sem_sync
This member holds semaphore synchronizing queues during close operation. It informs all messages were...
Definition: can-devcommon.h:242
rtems_binary_semaphore sem_write
This member holds semaphore informing the user's side there is a free space to write message.
Definition: can-devcommon.h:237
struct canque_ends_t base
This member holds base canque_ends_t structure.
Definition: can-devcommon.h:227
rtems_binary_semaphore sem_read
This member holds semaphore informing the user's side there is a new message to be read.
Definition: can-devcommon.h:232