26 #ifndef __RTCAN_DEV_H_ 27 #define __RTCAN_DEV_H_ 32 #include <asm/atomic.h> 33 #include <linux/netdevice.h> 34 #include <linux/semaphore.h> 36 #include "rtcan_list.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 58 struct 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);
142 struct rtcan_recv *recv_list;
146 struct rtcan_recv *empty_list;
150 struct rtcan_recv receivers[RTCAN_MAX_RECEIVERS];
156 unsigned int tx_count;
157 unsigned int rx_count;
158 unsigned int err_count;
160 #ifdef CONFIG_PROC_FS 161 struct proc_dir_entry *proc_root;
163 #ifdef CONFIG_XENO_DRIVERS_CAN_LOOPBACK 164 struct rtcan_skb tx_skb;
165 struct rtcan_socket *tx_socket;
170 extern struct semaphore rtcan_devices_nrt_lock;
173 void rtcan_dev_free(
struct rtcan_device *dev);
175 int rtcan_dev_register(
struct rtcan_device *dev);
176 int rtcan_dev_unregister(
struct rtcan_device *dev);
178 struct rtcan_device *rtcan_dev_alloc(
int sizeof_priv,
int sizeof_board_priv);
179 void rtcan_dev_alloc_name (
struct rtcan_device *dev,
const char *name_mask);
181 struct rtcan_device *rtcan_dev_get_by_name(
const char *if_name);
182 struct rtcan_device *rtcan_dev_get_by_index(
int ifindex);
184 #ifdef RTCAN_USE_REFCOUNT 185 #define rtcan_dev_reference(dev) atomic_inc(&(dev)->refcount) 186 #define rtcan_dev_dereference(dev) atomic_dec(&(dev)->refcount) 188 #define rtcan_dev_reference(dev) do {} while(0) 189 #define rtcan_dev_dereference(dev) do {} while(0) 192 #ifdef CONFIG_PROC_FS 193 int rtcan_dev_create_proc(
struct rtcan_device* dev);
194 void rtcan_dev_remove_proc(
struct rtcan_device* dev);
196 static inline int rtcan_dev_create_proc(
struct rtcan_device* dev)
200 static inline void rtcan_dev_remove_proc(
struct rtcan_device* dev) { }
ipipe_spinlock_t rtdm_lock_t
Lock variable.
Definition: driver.h:551
Custom CAN bit-time definition.
Definition: can.h:151
uint32_t can_baudrate_t
Baudrate definition in bits per second.
Definition: can.h:110
Raw CAN frame.
Definition: can.h:313
Copyright © 2011 Gilles Chanteperdrix gilles.chanteperdrix@xenomai.org.
Definition: atomic.h:24
int can_ctrlmode_t
See CAN_CTRLMODE.
Definition: can.h:221
enum CAN_STATE can_state_t
See CAN_STATE.
Definition: can.h:258
unsigned long rtdm_lockctx_t
Variable to save the context while holding a lock.
Definition: driver.h:554
enum CAN_MODE can_mode_t
See CAN_MODE.
Definition: can.h:187