32#include <asm/atomic.h>
33#include <linux/mutex.h>
34#include <linux/netdevice.h>
36#include "rtcan_list.h"
37#include "rtcan_ethtool.h"
40#define RTCAN_MAX_DEVICES CONFIG_XENO_DRIVERS_CAN_MAX_DEVICES
44#define RTCAN_MAX_RECEIVERS CONFIG_XENO_DRIVERS_CAN_MAX_RECEIVERS
49#if defined(CONFIG_MODULES) && defined(CONFIG_MODULE_UNLOAD)
50#define RTCAN_USE_REFCOUNT
58struct can_bittiming_const {
78 unsigned long base_addr;
79 rtdm_irq_t irq_handle;
82#ifdef RTCAN_USE_REFCOUNT
90 struct semaphore nrt_lock;
104 unsigned int can_sys_clock;
112 const struct can_bittiming_const *bittiming_const;
127 int (*hard_start_xmit)(
struct rtcan_device *dev,
129 int (*do_set_mode)(
struct rtcan_device *dev,
132 can_state_t (*do_get_state)(
struct rtcan_device *dev);
133 int (*do_set_bit_time)(
struct rtcan_device *dev,
136#ifdef CONFIG_XENO_DRIVERS_CAN_BUS_ERR
137 void (*do_enable_bus_err)(
struct rtcan_device *dev);
140 const struct rtcan_ethtool_ops *ethtool_ops;
144 struct rtcan_recv *recv_list;
148 struct rtcan_recv *empty_list;
152 struct rtcan_recv receivers[RTCAN_MAX_RECEIVERS];
158 unsigned int tx_count;
159 unsigned int rx_count;
160 unsigned int err_count;
163 struct proc_dir_entry *proc_root;
165#ifdef CONFIG_XENO_DRIVERS_CAN_LOOPBACK
166 struct rtcan_skb tx_skb;
167 struct rtcan_socket *tx_socket;
172extern struct mutex rtcan_devices_nrt_lock;
175void rtcan_dev_free(
struct rtcan_device *dev);
177int rtcan_dev_register(
struct rtcan_device *dev);
178int rtcan_dev_unregister(
struct rtcan_device *dev);
180struct rtcan_device *rtcan_dev_alloc(
int sizeof_priv,
int sizeof_board_priv);
181void rtcan_dev_alloc_name (
struct rtcan_device *dev,
const char *name_mask);
183struct rtcan_device *rtcan_dev_get_by_name(
const char *if_name);
184struct rtcan_device *rtcan_dev_get_by_index(
int ifindex);
186#ifdef RTCAN_USE_REFCOUNT
187#define rtcan_dev_reference(dev) atomic_inc(&(dev)->refcount)
188#define rtcan_dev_dereference(dev) atomic_dec(&(dev)->refcount)
190#define rtcan_dev_reference(dev) do {} while(0)
191#define rtcan_dev_dereference(dev) do {} while(0)
195int rtcan_dev_create_proc(
struct rtcan_device* dev);
196void rtcan_dev_remove_proc(
struct rtcan_device* dev);
198static inline int rtcan_dev_create_proc(
struct rtcan_device* dev)
202static inline void rtcan_dev_remove_proc(
struct rtcan_device* dev) { }
enum CAN_STATE can_state_t
See CAN_STATE.
Definition can.h:258
uint32_t can_baudrate_t
Baudrate definition in bits per second.
Definition can.h:110
enum CAN_MODE can_mode_t
See CAN_MODE.
Definition can.h:187
int can_ctrlmode_t
See CAN_CTRLMODE.
Definition can.h:221
unsigned long rtdm_lockctx_t
Variable to save the context while holding a lock.
Definition driver.h:555
pipeline_spinlock_t rtdm_lock_t
Lock variable.
Definition driver.h:552
Copyright © 2011 Gilles Chanteperdrix gilles.chanteperdrix@xenomai.org.
Definition atomic.h:24
Custom CAN bit-time definition.
Definition can.h:151
Raw CAN frame.
Definition can.h:313