RTEMS 7.0-rc1
Loading...
Searching...
No Matches
Data Fields
rtems_can_chip_ops Struct Reference

This structure represents CAN controller operations. These provides interface from IOCTL calls to controller functions and should be registered during controller initialization. More...

#include <can-devcommon.h>

Data Fields

int(* start_chip )(struct rtems_can_chip *chip)
 Starts the chip. Called with RTEMS_CAN_CHIP_START ioctl.
 
int(* stop_chip )(struct rtems_can_chip *chip, struct timespec *ts)
 Stops the chip. Called with RTEMS_CAN_CHIP_STOP ioctl.
 
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 ioctl calls can be implemented.
 
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.
 
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_INFO ioctl.
 
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. Called with RTEMS_CAN_SET_BITRATE ioctl if RTEMS_CAN_BITTIME_FROM_BITRATE is set.
 
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_BITRATE ioctl if RTEMS_CAN_BITTIME_FROM_PRECOMPUTED is set.
 
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.
 

Detailed Description

This structure represents CAN controller operations. These provides interface from IOCTL calls to controller functions and should be registered during controller initialization.

Field Documentation

◆ calc_bittiming

int(* rtems_can_chip_ops::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. Called with RTEMS_CAN_SET_BITRATE ioctl if RTEMS_CAN_BITTIME_FROM_BITRATE is set.

Parameters
chipPointer to chip structure.
typeBittiming type (nominal, FD)
btPointer to rtems_can_bittiming structure
Returns
0 on success, negated errno on error.
Return values
-EPERMChip is already started, cannot change bittiming.
-EINVALIncorrect bit time type.

◆ check_and_set_bittiming

int(* rtems_can_chip_ops::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_BITRATE ioctl if RTEMS_CAN_BITTIME_FROM_PRECOMPUTED is set.

Parameters
chipPointer to chip structure.
typeBittiming type (nominal, FD)
btPointer to rtems_can_bittiming structure
Returns
0 on success, negated errno on error.
Return values
-EPERMChip is already started, cannot change bittiming.
-EINVALIncorrect bit time type.

◆ chip_ioctl

int(* rtems_can_chip_ops::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 ioctl calls can be implemented.

Parameters
chipPointer to chip structure.
commandIOCTL command
argVoid pointer to IOCL argument
Returns
0 on success, negative value otherwise.

◆ get_chip_info

int(* rtems_can_chip_ops::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_INFO ioctl.

Parameters
chipPointer to chip structure.
whatInteger specifying what info should be retrieved. Refer to CANChip info defines.

◆ get_chip_timestamp

int(* rtems_can_chip_ops::get_chip_timestamp) (struct rtems_can_chip *chip, uint64_t *timestamp)

Obtains timestamp from the controller. Called with RTEMS_CAN_CHIP_GET_TIMESTAMP ioctl.

Parameters
chipPointer to chip structure.
timestampPointer to uint64_t integer where timestamp is stored
Returns
0 on success, negative value otherwise.

◆ set_chip_mode

int(* rtems_can_chip_ops::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.

Parameters
chipPointer to chip structure.
modeModes to be set.
Returns
0 on success, negated errno on error.

◆ start_chip

int(* rtems_can_chip_ops::start_chip) (struct rtems_can_chip *chip)

Starts the chip. Called with RTEMS_CAN_CHIP_START ioctl.

The function should atomically set RTEMS_CAN_CHIP_RUNNING flag in flags field of rtems_can_chip structure and abort all currently filled HW buffers.

Parameters
chipPointer to chip structure.
Returns
0 on success, negative value otherwise.

◆ stop_chip

int(* rtems_can_chip_ops::stop_chip) (struct rtems_can_chip *chip, struct timespec *ts)

Stops the chip. Called with RTEMS_CAN_CHIP_STOP ioctl.

The function should atomically clear RTEMS_CAN_CHIP_RUNNING flag in flags field of rtems_can_chip structure.

The function is blocking and passed with an option argument that provides the timeout (not blocking at all if argument is NULL). The function should abort all outgoing TX frames and clear the FIFO queues, returning the frames to the user as TX error frames. The flush takes places if those frames are not returned within the specified timeout.

Parameters
chipPointer to rtems_can_chip structure.
tsPointer to the stop operation timeout.
Returns
0 on success, negative value otherwise.

The documentation for this struct was generated from the following file: