#include "./constants.h"
#include "./can_sysdep.h"
#include "./can_queue.h"
+#include "lincan_config.h"
#ifdef CAN_DEBUG
#define DEBUGMSG(fmt,args...) can_printk(KERN_ERR "can.o (debug): " fmt,\
* @chip: array of pointers to the chip structures
* @hwspecops: pointer to board specific operations
* @hosthardware_p: pointer to the root hardware structure
+ * @sysdevptr: union reserved for pointer to bus specific
+ * device structure (case @pcidev is used for PCI devices)
*
* The structure represent configuration and state of associated board.
* The driver infrastructure prepares this structure and calls
* @chipspecops: pointer to the set of chip specific object filled by init_chip_data() function
* @hostdevice: pointer to chip hosting board
* @max_objects: maximal number of communication objects connected to this chip
+ * @chip_lock: reserved for synchronization of the chip supporting routines
+ * (not used in the current driver version)
+ * @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_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
* @obj_used: counter of users (associated file structures for Linux
* userspace clients) of this object
* @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
+ * is running inside TX activation processing code
*/
struct msgobj_t {
unsigned long obj_base_addr;
* @remote_request: configures message object and asks for RTR message
* @check_tx_stat: checks state of transmission engine
* @wakeup_tx: wakeup TX processing
+ * @set_filter: if
* @enable_configuration: enable chip configuration mode
* @disable_configuration: disable chip configuration mode
* @set_btregs: configures bitrate registers
int (*remote_request)(struct chip_t *chip, struct msgobj_t *obj);
int (*check_tx_stat)(struct chip_t *chip);
int (*wakeup_tx)(struct chip_t *chip, struct msgobj_t *obj);
+ int (*filtch_rq)(struct chip_t *chip, struct msgobj_t *obj);
int (*enable_configuration)(struct chip_t *chip);
int (*disable_configuration)(struct chip_t *chip);
int (*set_btregs)(struct chip_t *chip, unsigned short btr0,
extern struct mem_addr *mem_head;
+
+#if defined(CONFIG_OC_LINCAN_PORTIO_ONLY)
+extern inline void can_write_reg(const struct chip_t *chip, unsigned char data, unsigned address)
+{
+ outb(data, chip->chip_base_addr+address);
+}
+extern inline unsigned can_read_reg(const struct chip_t *chip, unsigned address)
+{
+ return inb(chip->chip_base_addr+address);
+}
+extern inline void canobj_write_reg(const struct chip_t *chip, const struct msgobj_t *obj,
+ unsigned char data, unsigned address)
+{
+ outb(data, obj->obj_base_addr+address);
+}
+extern inline unsigned canobj_read_reg(const struct chip_t *chip, const struct msgobj_t *obj,
+ unsigned address)
+{
+ return inb(obj->obj_base_addr+address);
+}
+
+#elif defined(CONFIG_OC_LINCAN_MEMIO_ONLY)
+extern inline void can_write_reg(const struct chip_t *chip, unsigned char data, unsigned address)
+{
+ writeb(data, chip->chip_base_addr+address);
+}
+extern inline unsigned can_read_reg(const struct chip_t *chip, unsigned address)
+{
+ return readb(chip->chip_base_addr+address);
+}
+extern inline void canobj_write_reg(const struct chip_t *chip, const struct msgobj_t *obj,
+ unsigned char data, unsigned address)
+{
+ writeb(data, obj->obj_base_addr+address);
+}
+extern inline unsigned canobj_read_reg(const struct chip_t *chip, const struct msgobj_t *obj,
+ unsigned address)
+{
+ return readb(obj->obj_base_addr+address);
+}
+
+#else /*CONFIG_OC_LINCAN_DYNAMICIO*/
+#ifndef CONFIG_OC_LINCAN_DYNAMICIO
+#define CONFIG_OC_LINCAN_DYNAMICIO
+#endif
+
/* Inline function to write to the hardware registers. The argument address is
* relative to the memory map of the chip and not the absolute memory address.
*/
return chip->read_register(address_to_read);
}
+#endif /*CONFIG_OC_LINCAN_DYNAMICIO*/
+
int can_base_addr_fixup(struct candevice_t *candev, unsigned long new_base);
int can_request_io_region(unsigned long start, unsigned long n, const char *name);
void can_release_io_region(unsigned long start, unsigned long n);