-/* nsi.c
- * Linux CAN-bus device driver.
- * nsi_canpci.c - support for NSI CAN PCI card
- * The card support added by Eric Pennamen <pennamen@gmail.com>
- * Based on code from Arnaud Westenberg email:arnaud@wanadoo.nl
- * Ake Hedman, eurosource, akhe@eurosource.se ,
- * and Pavel Pisa - OCERA team member email:pisa@cmp.felk.cvut.cz
- * This software is released under the GPL-License.
- * Version lincan-0.3 17 Jun 2004
- */
+/**************************************************************************/
+/* File: nsi_canpci.c - NSI CAN PCI card (2xi82527) */
+/* */
+/* LinCAN - (Not only) Linux CAN bus driver */
+/* Copyright (C) 2002-2009 DCE FEE CTU Prague <http://dce.felk.cvut.cz> */
+/* Copyright (C) 2002-2009 Pavel Pisa <pisa@cmp.felk.cvut.cz> */
+/* Copyright (C) 2004 Eric Pennamen <pennamen@gmail.com> */
+/* Funded by OCERA and FRESCOR IST projects */
+/* Based on CAN driver code by Arnaud Westenberg <arnaud@wanadoo.nl> */
+/* and Ake Hedman, eurosource <akhe@eurosource.se> */
+/* */
+/* LinCAN is free software; you can redistribute it and/or modify it */
+/* under terms of the GNU General Public License as published by the */
+/* Free Software Foundation; either version 2, or (at your option) any */
+/* later version. LinCAN is distributed in the hope that it will be */
+/* useful, but WITHOUT ANY WARRANTY; without even the implied warranty */
+/* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
+/* General Public License for more details. You should have received a */
+/* copy of the GNU General Public License along with LinCAN; see file */
+/* COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, */
+/* Cambridge, MA 02139, USA. */
+/* */
+/* To allow use of LinCAN in the compact embedded systems firmware */
+/* and RT-executives (RTEMS for example), main authors agree with next */
+/* special exception: */
+/* */
+/* Including LinCAN header files in a file, instantiating LinCAN generics */
+/* or templates, or linking other files with LinCAN objects to produce */
+/* an application image/executable, does not by itself cause the */
+/* resulting application image/executable to be covered by */
+/* the GNU General Public License. */
+/* This exception does not however invalidate any other reasons */
+/* why the executable file might be covered by the GNU Public License. */
+/* Publication of enhanced or derived LinCAN files is required although. */
+/**************************************************************************/
#include "../include/can.h"
#include "../include/can_sysdep.h"
#include <linux/module.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10))
- #define ioread32 readl
- #define iowrite32 writel
- #define ioread8 readb
- #define iowrite8 writeb
+ #define ioread32 can_readl
+ #define iowrite32 can_writel
+ #define ioread8 can_readb
+ #define iowrite8 can_writeb
#else
#endif
DEBUGMSG("starting interrupt on chip 1\n");
it_mask=8;
}
- candev=(struct candevice_t *)chip->chip_data;
+ candev=chip->hostdevice;
it_reg = ioread32( (void*)(candev->io_addr+PLX_INTCSR));
it_reg|=it_mask|0x40;
iowrite32(it_reg,(void*)(candev->io_addr+PLX_INTCSR));
DEBUGMSG("stoping interrupt on chip 1\n");
it_mask=8;
}
- candev=(struct candevice_t *)chip->chip_data;
+ candev=chip->hostdevice;
it_reg = ioread32( (void*)(candev->io_addr+PLX_INTCSR));
it_reg&=~it_mask;
iowrite32(it_reg,(void*)(candev->io_addr+PLX_INTCSR));
DEBUGMSG("starting chip 1\n");
it_mask=8;
}
- candev=(struct candevice_t *)chip->chip_data;
+ candev=chip->hostdevice;
it_reg = ioread32( (void*)(candev->io_addr+PLX_INTCSR));
rmb();
it_reg|=it_mask|0x40;
DEBUGMSG("stoping chip 1\n");
it_mask=8;
}
- candev=(struct candevice_t *)chip->chip_data;
+ candev=chip->hostdevice;
it_reg = ioread32( (void*)(candev->io_addr+PLX_INTCSR));
rmb();
it_reg&=~it_mask;
int retcode;
unsigned long it_reg;
struct candevice_t *candev;
- candev=(struct candevice_t *)chip->chip_data;
+ candev=chip->hostdevice;
retcode = CANCHIP_IRQ_NONE;
it_reg = ioread32( (void*)(candev->io_addr+PLX_INTCSR));
rmb();
candev->chip[chipnr]->chipspecops->stop_chip=nsi_canpci_stop_chip;
candev->chip[chipnr]->chipspecops->config_irqs=nsi_canpci_config_irqs;
candev->chip[chipnr]->chipspecops->irq_handler=nsi_canpci_irq_handler;
- candev->chip[chipnr]->chip_data =candev;
+ /*candev->chip[chipnr]->chip_data = NULL;*/
candev->chip[chipnr]->chip_base_addr= (unsigned long) (((t_CardArray*)(candev->dev_base_addr))->addr_BAR_remap[chipnr+2]);
candev->chip[chipnr]->clock = iCLOCK;
* on the CAN chip. You should only have to edit this function if your hardware
* uses some specific write process.
*/
-void nsi_canpci_write_register(unsigned data, unsigned long address)
+void nsi_canpci_write_register(unsigned data, can_ioptr_t address)
{
iowrite8((u8)data,(void*)address);
}
* on the CAN chip. You should only have to edit this function if your hardware
* uses some specific read process.
*/
-unsigned nsi_canpci_read_register(unsigned long address)
+unsigned nsi_canpci_read_register(can_ioptr_t address)
{
- /* this is the same thing that the function write_register.
- We use the two register, we write the address where we
- want to read in a first time. In a second time we read the
- data */
return ioread8((void*)address);
}