* Rewritten for new CAN queues by Pavel Pisa - OCERA team member
* email:pisa@cmp.felk.cvut.cz
* This software is released under the GPL-License.
- * Version lincan-0.2 9 Jul 2003
+ * Version lincan-0.3 17 Jun 2004
*/
#include "../include/can.h"
int smartcan_irq=-1;
unsigned long smartcan_base=0x0;
+static can_spinlock_t smartcan_port_lock=SPIN_LOCK_UNLOCKED;
+
int smartcan_request_io(struct candevice_t *candev)
{
if (!can_request_io_region(candev->io_addr,0x04,DEVICE_NAME)) {
}
-void smartcan_write_register(unsigned char data, unsigned long address)
+void smartcan_write_register(unsigned data, unsigned long address)
{
- can_disable_irq(smartcan_irq);
+ can_spin_irqflags_t flags;
+ can_spin_lock_irqsave(&smartcan_port_lock,flags);
outb(address-smartcan_base,smartcan_base);
outb(data,smartcan_base+1);
- can_enable_irq(smartcan_irq);
+ can_spin_unlock_irqrestore(&smartcan_port_lock,flags);
}
unsigned smartcan_read_register(unsigned long address)
{
unsigned ret;
- can_disable_irq(smartcan_irq);
+ can_spin_irqflags_t flags;
+ can_spin_lock_irqsave(&smartcan_port_lock,flags);
outb(address-smartcan_base,smartcan_base);
ret=inb(smartcan_base+1);
- can_enable_irq(smartcan_irq);
+ can_spin_unlock_irqrestore(&smartcan_port_lock,flags);
return ret;
}