42#ifndef _DEV_CAN_CAN_DEVCOMMON_H
43#define _DEV_CAN_CAN_DEVCOMMON_H
48#include <sys/ioccom.h>
49#include <rtems/thread.h>
129 ioctl_command_t command,
This header file is part of CAN/CAN FD bus common support. It declares structures and functions used ...
int rtems_can_queue_ends_init_user(struct rtems_can_queue_ends_user_t *qends)
Userspace clients specific ends initialization.
Definition: can-quekern.c:208
int rtems_can_chip_start(struct rtems_can_chip *chip)
This function starts the controller.
Definition: can-devcommon.c:110
int rtems_can_queue_ends_init_chip(struct rtems_can_chip *chip, const char *name)
This function initializes ends from chip's side.
Definition: can-devcommon.c:84
uint64_t rtems_can_fill_timestamp(void)
This function fills timestamping with current monotonic time.
Definition: can-devcommon.c:103
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.
Definition: can-bittiming.c:109
This file is part of CAN/CAN FD bus common support and implements internal functions for CAN queues h...
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 rtems_can_chip * chip
This member holds the pointer to rtems_can_chip structure. Controller specific initialization functio...
Definition: can-bus.h:65
This structure represents CAN controller operations. These provides interface from IOCTL calls to con...
Definition: can-devcommon.h:85
int(* chip_ioctl)(struct rtems_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:127
int(* get_chip_timestamp)(struct rtems_can_chip *chip, uint64_t *timestamp)
Obtains timestamp from the controller. Called with RTEMS_CAN_CHIP_GET_TIMESTAMP ioctl.
Definition: can-devcommon.h:141
int(* start_chip)(struct rtems_can_chip *chip)
Starts the chip. Called with RTEMS_CAN_CHIP_START ioctl.
Definition: can-devcommon.h:97
int(* set_chip_mode)(struct rtems_can_chip *chip, uint32_t mode)
Sets controller mode defined in input argument. Called with RTEMS_CAN_CHIP_SET_MODE.
Definition: can-devcommon.h:199
int(* calc_bittiming)(struct rtems_can_chip *chip, int type, struct rtems_can_bittiming *bt)
Calculates bit timing from given bit rate and saves the values to controller's registers....
Definition: can-devcommon.h:168
int(* get_chip_info)(struct rtems_can_chip *chip, int what)
Obtains controller's information specified by input integer argument. Called with RTEMS_CAN_CHIP_GET_...
Definition: can-devcommon.h:153
int(* stop_chip)(struct rtems_can_chip *chip, struct timespec *ts)
Stops the chip. Called with RTEMS_CAN_CHIP_STOP ioctl.
Definition: can-devcommon.h:115
int(* check_and_set_bittiming)(struct rtems_can_chip *chip, int type, struct rtems_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:186
This structure represents one CAN controller.
Definition: can-devcommon.h:205
struct rtems_can_queue_ends_dev * qends_dev
This member holds chip's side of queue ends.
Definition: can-devcommon.h:278
uint32_t ctrlmode
This member holds the currently set mode. Controller's device driver may set initial modes if needed.
Definition: can-devcommon.h:235
atomic_uint flags
This member holds controller's flags.
Definition: can-devcommon.h:226
struct rtems_can_chip_ops chip_ops
This member holds chip operations.
Definition: can-devcommon.h:274
rtems_vector_number irq
This member holds controller's interrupt number.
Definition: can-devcommon.h:213
const struct rtems_can_bittiming_const * bittiming_const
This member holds nominal bit timing constants (max/min values)
Definition: can-devcommon.h:258
struct rtems_can_stats chip_stats
This member holds the chip's statistics.
Definition: can-devcommon.h:286
const char * type
This member holds controller's type/name.
Definition: can-devcommon.h:209
rtems_binary_semaphore stop_sem
This member is used by the worker to notify the closed operation is finished.
Definition: can-devcommon.h:254
uint32_t capabilities
This member holds controller's capabilities.
Definition: can-devcommon.h:245
bool close_nonblock
This member informs whether close operation is blocking or nonblocking. This can be set with RTEMS_CA...
Definition: can-devcommon.h:222
void * internal
This member holds chip's specific private structure. This structure defines non generic fields and se...
Definition: can-devcommon.h:291
const struct rtems_can_bittiming_const * data_bittiming_const
This member holds data bit timing constants (max/min values)
Definition: can-devcommon.h:262
atomic_uint used
This member holds the number of users using the controller.
Definition: can-devcommon.h:230
struct rtems_can_user_list_t can_users
This member holds the list of chip's users.
Definition: can-devcommon.h:282
rtems_mutex lock
This member holds the lock to ensure atomicity of chip operations.
Definition: can-devcommon.h:249
struct rtems_can_bittiming bittiming
This member holds currently set nominal btt timing values.
Definition: can-devcommon.h:266
uint32_t freq
This member holds controller's base clock frequency.
Definition: can-devcommon.h:217
struct rtems_can_bittiming data_bittiming
This member holds currently set data btt timing values.
Definition: can-devcommon.h:270
uint32_t ctrlmode_supported
This member holds modes supported by the controller. Controller's device driver should set this field...
Definition: can-devcommon.h:241
This structure holds the controller's (application) side of queue's ends.
Definition: can-devcommon.h:59
struct rtems_can_queue_ends base
This member holds base rtems_can_queue_ends structure.
Definition: can-devcommon.h:63
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:72
struct rtems_can_chip * chip
This member holds the chip's structure.
Definition: can-devcommon.h:67
This structure holds the user's (application) side of queue's ends.
Definition: can-devcommon.h:297
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:306
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:311
struct rtems_can_queue_ends base
This member holds base rtems_can_queue_ends structure.
Definition: can-devcommon.h:301
rtems_binary_semaphore sem_sync
This member holds semaphore synchronizing queues during close operation. It informs all messages were...
Definition: can-devcommon.h:316
This structure represents place to connect edges to for CAN communication entity. The zero,...
Definition: can-queue.h:298
This structure is used to represent CAN statistics.
Definition: can-stats.h:89
This structure represents one CAN user (application).
Definition: can-devcommon.h:322
unsigned long flags
This member holds user's flags.
Definition: can-devcommon.h:326
struct rtems_can_queue_ends_user_t * qends_user
This member holds user's side of queue's ends.
Definition: can-devcommon.h:334
TAILQ_ENTRY(rtems_can_user) peers
This member holds TAILQ entry.
int magic
This member holds user magic value. It should be set to RTEMS_CAN_USER_MAGIC value.
Definition: can-devcommon.h:343
struct rtems_can_bus * bus
This member holds pointer to rtems_can_bus structure.
Definition: can-devcommon.h:338