/****************************************************************************/
// GLOBALS
-spinlock_t pcan_lock = SPIN_LOCK_UNLOCKED;
+CAN_DEFINE_SPINLOCK(pcan_lock);
/****************************************************************************/
// LOCALS
u16 _PC_ = _PB_ + 1;
u8 b0, b1 ;
u8 irqEnable = inb(_PC_) & 0x10; // don't influence irqEnable
- unsigned long flags;
+ can_spin_irqflags_t flags;
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
- save_flags(flags);
- cli();
- #else
- spin_lock_irqsave(&pcan_lock, flags);
- #endif
+ can_spin_lock_irqsave(&pcan_lock, flags);
outb((0x0B ^ 0x0D) | irqEnable, _PC_);
outb((port & 0x1F) | 0x80, _PA_);
b0=nibble_decode[inb(_PB_)>>3];
outb((0x0B ^ 0x0D) | irqEnable, _PC_);
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
- restore_flags(flags);
- #else
- spin_unlock_irqrestore(&pcan_lock, flags);
- #endif
+ can_spin_unlock_irqrestore(&pcan_lock, flags);
return (b1 << 4) | b0 ;
}
u16 _PA_ = (u16)dng->dwPort;
u16 _PC_ = _PA_ + 2;
u8 irqEnable = inb(_PC_) & 0x10; // don't influence irqEnable
- unsigned long flags;
+ can_spin_irqflags_t flags;
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
- save_flags(flags);
- cli();
- #else
- spin_lock_irqsave(&pcan_lock, flags);
- #endif
+ can_spin_lock_irqsave(&pcan_lock, flags);
outb((0x0B ^ 0x0D) | irqEnable, _PC_);
outb(port & 0x1F, _PA_);
outb(data, _PA_);
outb((0x0B ^ 0x0D) | irqEnable, _PC_);
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
- restore_flags(flags);
- #else
- spin_unlock_irqrestore(&pcan_lock, flags);
- #endif
+ can_spin_unlock_irqrestore(&pcan_lock, flags);
}
// functions for EPP port
u16 _PC_ = _PA_ + 2;
u8 wert;
u8 irqEnable = inb(_PC_) & 0x10; // don't influence irqEnable
- unsigned long flags;
+ can_spin_irqflags_t flags;
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
- save_flags(flags);
- cli();
- #else
- spin_lock_irqsave(&pcan_lock, flags);
- #endif
+ can_spin_lock_irqsave(&pcan_lock, flags);
outb((0x0B ^ 0x0F) | irqEnable, _PC_);
outb((port & 0x1F) | 0x80, _PA_);
wert = inb(_PA_);
outb((0x0B ^ 0x0F) | irqEnable, _PC_);
- #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,18)
- restore_flags(flags);
- #else
- spin_unlock_irqrestore(&pcan_lock, flags);
- #endif
+ can_spin_unlock_irqrestore(&pcan_lock, flags);
return wert;
}