]> rtime.felk.cvut.cz Git - lincan.git/commitdiff
Implemented selection of simplified IO access methods (port or mem only).
authorppisa <ppisa>
Sun, 14 Mar 2004 00:58:31 +0000 (00:58 +0000)
committerppisa <ppisa>
Sun, 14 Mar 2004 00:58:31 +0000 (00:58 +0000)
lincan/include/main.h
lincan/src/Makefile.std

index 2fa81ced2d4dc640e6e9eaa363ad73dfc111fd5a..f92d1c4a700d2112eff25bf1ac355d84fa093da4 100644 (file)
@@ -11,6 +11,7 @@
 #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,\
@@ -373,6 +374,52 @@ extern struct msgobj_t *objects_p[MAX_TOT_MSGOBJS];
 
 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.
  */
@@ -406,6 +453,8 @@ extern inline unsigned canobj_read_reg(const struct chip_t *chip, const struct m
        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);
index 0346c8aa39ed00149b16ee09a278a2c17f72cb38..f7405048fa700d4569e3b53d8466c9c58031ff68 100644 (file)
@@ -145,7 +145,7 @@ L_OBJS       =
 # Kernel only objects with exported symbols (-DEXPORT_SYMTAB)
 LX_OBJS      = 
 # Additional CFLAGS
-EXTRA_CFLAGS +=
+EXTRA_CFLAGS += -I .
 
 # Linux 2.4.2 and newer build system needs next
 can-objs = $(O_OBJS)