-/* main.h
- * Header file for the Linux CAN-bus driver.
- * Written by Arnaud Westenberg email:arnaud@wanadoo.nl
- * Rewritten for new CAN queues by Pavel Pisa - OCERA team member
- * email:pisa@cmp.felk.cvut.cz
- * This software is released under the GPL-License.
- * Version lincan-0.3 17 Jun 2004
- */
+/**************************************************************************/
+/* File: main.h - the CAN driver basic data structures and functions */
+/* */
+/* LinCAN - (Not only) Linux CAN bus driver */
+/* Copyright (C) 2002-2009 DCE FEE CTU Prague <http://dce.felk.cvut.cz> */
+/* Copyright (C) 2002-2009 Pavel Pisa <pisa@cmp.felk.cvut.cz> */
+/* Funded by OCERA and FRESCOR IST projects */
+/* Based on CAN driver code by Arnaud Westenberg <arnaud@wanadoo.nl> */
+/* */
+/* LinCAN is free software; you can redistribute it and/or modify it */
+/* under terms of the GNU General Public License as published by the */
+/* Free Software Foundation; either version 2, or (at your option) any */
+/* later version. LinCAN is distributed in the hope that it will be */
+/* useful, but WITHOUT ANY WARRANTY; without even the implied warranty */
+/* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
+/* General Public License for more details. You should have received a */
+/* copy of the GNU General Public License along with LinCAN; see file */
+/* COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, */
+/* Cambridge, MA 02139, USA. */
+/* */
+/* To allow use of LinCAN in the compact embedded systems firmware */
+/* and RT-executives (RTEMS for example), main authors agree with next */
+/* special exception: */
+/* */
+/* Including LinCAN header files in a file, instantiating LinCAN generics */
+/* or templates, or linking other files with LinCAN objects to produce */
+/* an application image/executable, does not by itself cause the */
+/* resulting application image/executable to be covered by */
+/* the GNU General Public License. */
+/* This exception does not however invalidate any other reasons */
+/* why the executable file might be covered by the GNU Public License. */
+/* Publication of enhanced or derived LinCAN files is required although. */
+/**************************************************************************/
#include "./can.h"
#include "./constants.h"
* @flags: board flags: %PROGRAMMABLE_IRQ .. interrupt number
* can be programmed into board
* @nr_all_chips: number of chips present on the board
- * @nr_82527_chips: number of Intel 8257 chips
+ * @nr_82527_chips: number of Intel 8257 chips
* @nr_sja1000_chips: number of Philips SJA100 chips
* @chip: array of pointers to the chip structures
* @hwspecops: pointer to board specific operations
struct hwspecops_t *hwspecops;
struct canhardware_t *hosthardware_p;
-
+
union {
void *anydev;
#ifdef CAN_ENABLE_PCI_SUPPORT
* @worker_thread: chip worker thread ID (RT-Linux specific field)
* @pend_flags: holds information about pending interrupt and tx_wake() operations
* (RT-Linux specific field). Masks values:
- * %MSGOBJ_TX_REQUEST .. some of the message objects requires tx_wake() call,
+ * %MSGOBJ_TX_REQUEST .. some of the message objects requires tx_wake() call,
* %MSGOBJ_IRQ_REQUEST .. chip interrupt processing required
* %MSGOBJ_WORKER_WAKE .. marks, that worker thread should be waked
* for some of above reasons
*
* The fields @write_register and @read_register are copied from
* corresponding fields from @hwspecops structure
- * (chip->hostdevice->hwspecops->write_register and
+ * (chip->hostdevice->hwspecops->write_register and
* chip->hostdevice->hwspecops->read_register)
* to speedup can_write_reg() and can_read_reg() functions.
*/
void (*write_register)(unsigned data, can_ioptr_t address);
unsigned (*read_register)(can_ioptr_t address);
-
+
void *chip_data;
-
+
unsigned short sja_cdr_reg; /* sja1000 only! */
unsigned short sja_ocr_reg; /* sja1000 only! */
unsigned short int_cpu_reg; /* intel 82527 only! */
struct chipspecops_t *chipspecops;
struct candevice_t *hostdevice;
-
+
int max_objects; /* 1 for sja1000, 15 for i82527 */
can_spinlock_t chip_lock;
/**
* struct msgobj_t - structure holding communication object state
- * @obj_base_addr:
+ * @obj_base_addr:
* @minor: associated device minor number
* @object: object number in canchip_t structure +1
* @flags: message object flags
* @obj_users: list of user structures of type &canuser_t.
* @obj_flags: message object specific flags. Masks values:
* %MSGOBJ_TX_REQUEST .. the message object requests TX activation
- * %MSGOBJ_TX_LOCK .. some IRQ routine or callback on some CPU
+ * %MSGOBJ_TX_LOCK .. some IRQ routine or callback on some CPU
* is running inside TX activation processing code
* @rx_preconfig_id: place to store RX message identifier for some chip types
* that reuse same object for TX
can_ioptr_t obj_base_addr;
unsigned int minor; /* associated device minor number */
unsigned int object; /* object number in canchip_t +1 for debug printk */
- unsigned long obj_flags;
+ unsigned long obj_flags;
int ret;
struct canque_ends_t *qends;
struct canque_slot_t *tx_slot;
int tx_retry_cnt;
struct timer_list tx_timeout;
-
+
struct canmsg_t rx_msg;
struct canchip_t *hostchip;
-
+
unsigned long rx_preconfig_id;
atomic_t obj_used;
* @request_io: reserve io or memory range for can board
* @release_io: free reserved io memory range
* @reset: hardware reset routine
- * @init_hw_data: called to initialize &candevice_t structure, mainly
+ * @init_hw_data: called to initialize &candevice_t structure, mainly
* @res_add, @nr_all_chips, @nr_82527_chips, @nr_sja1000_chips
* and @flags fields
* @init_chip_data: called initialize each &canchip_t structure, mainly
* @init_obj_data: called initialize each &msgobj_t structure,
* mainly @obj_base_addr field.
* @program_irq: program interrupt generation hardware of the board
- * if flag %PROGRAMMABLE_IRQ is present for specified device/board
+ * if flag %PROGRAMMABLE_IRQ is present for specified device/board
* @write_register: low level write register routine
* @read_register: low level read register routine
*/
int (*chip_config)(struct canchip_t *chip);
int (*baud_rate)(struct canchip_t *chip, int rate, int clock, int sjw,
int sampl_pt, int flags);
- int (*standard_mask)(struct canchip_t *chip, unsigned short code,
+ int (*standard_mask)(struct canchip_t *chip, unsigned short code,
unsigned short mask);
- int (*extended_mask)(struct canchip_t *chip, unsigned long code,
+ int (*extended_mask)(struct canchip_t *chip, unsigned long code,
unsigned long mask);
- int (*message15_mask)(struct canchip_t *chip, unsigned long code,
+ int (*message15_mask)(struct canchip_t *chip, unsigned long code,
unsigned long mask);
int (*clear_objects)(struct canchip_t *chip);
int (*config_irqs)(struct canchip_t *chip, short irqs);
int (*filtch_rq)(struct canchip_t *chip, struct msgobj_t *obj);
int (*enable_configuration)(struct canchip_t *chip);
int (*disable_configuration)(struct canchip_t *chip);
- int (*set_btregs)(struct canchip_t *chip, unsigned short btr0,
+ int (*set_btregs)(struct canchip_t *chip, unsigned short btr0,
unsigned short btr1);
int (*attach_to_chip)(struct canchip_t *chip);
int (*release_chip)(struct canchip_t *chip);
#define CONFIG_OC_LINCAN_DYNAMICIO
#endif
-/* Inline function to write to the hardware registers. The argument reg_offs is
+/* Inline function to write to the hardware registers. The argument reg_offs is
* relative to the memory map of the chip and not the absolute memory reg_offs.
*/
extern inline void can_write_reg(const struct canchip_t *chip, unsigned char data, unsigned reg_offs)
#ifdef CAN_WITH_RTL
extern int can_rtl_priority;
#endif /*CAN_WITH_RTL*/
+
+extern struct candevice_t* register_usbdev(const char *hwname,void *devdata,void (*chipdataregfnc)(struct canchip_t *chip,void *data));
+extern void cleanup_usbdev(struct candevice_t *dev);