/****************************************************************************/
// 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;
}
int pcan_dongle_reset(struct candevice_t *candev)
{
int i=0;
- struct chip_t *chip;
+ struct canchip_t *chip;
int chipnr;
unsigned cdr;
candev->chip[chipnr]->sja_cdr_reg = sjaCDR_CBP | sjaCDR_CLK_OFF;
candev->chip[chipnr]->sja_ocr_reg = sjaOCR_MODE_NORMAL | sjaOCR_TX0_LH;
- candev->chip[chipnr]->flags |= CHIP_IRQ_VME; // I don't want setup call request_irq
+ candev->chip[chipnr]->flags |= CHIP_IRQ_CUSTOM; // I don't want setup call request_irq
// I'm going to do it through parport_register_device
}
* Return Value: The function always returns zero
* File: src/template.c
*/
-int pcan_dongle_init_obj_data(struct chip_t *chip, int objnr)
+int pcan_dongle_init_obj_data(struct canchip_t *chip, int objnr)
{
chip->msgobj[objnr]->obj_base_addr=chip->chip_base_addr;
chip->msgobj[objnr]->obj_flags=0;