]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/include/main.h
The first enhanced version of Linux CAN-bus driver for OCERA project
[lincan.git] / lincan / include / main.h
index 53fb78378a53fb12c5bdabc4fc28130a46344198..c811d8719bdd1be28ac7b38c5baecc336fef1c84 100644 (file)
 
 #define CANMSG(fmt,args...) printk(KERN_ERR "can.o: " fmt,##args)
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,7))
+
 #define MINOR_NR \
        (MINOR(file->f_dentry->d_inode->i_rdev))
 
+#else /* Linux kernel > 2.5.7 */
+
+#define MINOR_NR \
+       (minor(file->f_dentry->d_inode->i_rdev))
+#endif /* Linux kernel > 2.5.7 */
+
 #define MSG_OFFSET(object) ((object)*0x10)
 
 struct canhardware_t {
@@ -159,7 +167,7 @@ struct mem_addr {
  * The rx/tx_in_progress entries are used to determine whether the device is 
  * already set up for transmission.
  */
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,2,19))
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,0))
 struct canfifo_t {
        struct wait_queue *readq, *writeq; 
        struct canmsg_t *buf_tx_entry;
@@ -170,7 +178,7 @@ struct canfifo_t {
        struct canmsg_t *rx_readp;
        int rx_size, tx_size;
        volatile int rx_in_progress, tx_in_progress;
-       int head, tail; //TEMP!!!
+       /*int head, tail;*/ /* removed */
 };
 #else
 struct canfifo_t {
@@ -184,7 +192,7 @@ struct canfifo_t {
        struct canmsg_t *rx_readp;
        int rx_size, tx_size;
        volatile int rx_in_progress, tx_in_progress;
-       int head, tail; //TEMP!!!
+       /*int head, tail;*/ /* removed */
 };
 #endif
 
@@ -192,7 +200,7 @@ struct canfifo_t {
 struct rtr_id {
        unsigned long id;
        struct canmsg_t *rtr_message;
-#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,2,19))
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,0))
        struct wait_queue *rtr_wq;
 #else
        struct __wait_queue_head rtr_wq;
@@ -218,7 +226,7 @@ extern struct mem_addr *mem_head;
 /* 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.
  */
-extern inline void can_write_reg(struct chip_t *chip, unsigned char data, unsigned short address)
+extern inline void can_write_reg(const struct chip_t *chip, unsigned char data, unsigned short address)
 {
        unsigned short segment_number;
        unsigned long address_to_write;
@@ -233,7 +241,7 @@ extern inline void can_write_reg(struct chip_t *chip, unsigned char data, unsign
        chip->hostdevice->hwspecops->write_register(data, address_to_write);
 }
 
-extern inline unsigned can_read_reg(struct chip_t *chip, unsigned short address)
+extern inline unsigned can_read_reg(const struct chip_t *chip, unsigned short address)
 {
        unsigned short segment_number;
        unsigned long address_to_read;