]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/unican_vme.c
The LinCAN driver license unified according to DCE FEE CTU head and superiors request.
[lincan.git] / lincan / src / unican_vme.c
index d171c48aed02746714f7a21dd5a27c704d1901e0..cbf78ca2d80af3ff5a3cde7166324f5b27f1d901 100644 (file)
@@ -1,80 +1,39 @@
-/* unican_vme.c
- * Linux CAN-bus device driver.
- * Written for new CAN driver version 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
- */ 
-
-/* This file is included in unican.c when CAN_ENABLE_VME_SUPPORT is
+/**************************************************************************/
+/* File: unican_vme.c - Unicontrols VME board additional support          */
+/*                                                                        */
+/* 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>             */
+/* Funded by OCERA and FRESCOR IST projects                               */
+/* Based on CAN driver code by Arnaud Westenberg <arnaud@wanadoo.nl>      */
+/*                                                                        */
+/* 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.  */
+/**************************************************************************/
+/* This file is included in unican.c if CAN_ENABLE_VME_SUPPORT is
  * set. */
 
-#include "ca91c042.h"
-
-#define UNICAN_VME_IRQ 1
-
-/* Used to pass chip pointer to irq handler. This sould be done in VME
- * bridge driver */
-#define VME_CHIPS_SIZE 8
-struct chip_t *vme_chips[VME_CHIPS_SIZE];
-
-can_irqreturn_t unican_vme_irq_handler(int vmeirq, int vector, void *dev_id, struct pt_regs *regs)
-{
-/*     struct chip_t *chip = vme_chips[vector < VME_CHIPS_SIZE && vector >= 0 ? vector : 0]; */
-       struct chip_t *chip = vme_chips[0];
-
-       DEBUGMSG("unican_vme_irq_handler: vmeirq=0x%08x vector=0x%08x\n", vmeirq, vector);
-       return  unican_irq_handler(vmeirq, chip, regs);
-}
-
-/**
- * unican_program_irq - program interrupts
- * @candev: Pointer to candevice/board structure
- *
- * Return value: The function returns zero on success or %-ENODEV on failure
- * File: src/unican.c
- */
-int unican_vme_program_irq(struct candevice_t *candev)
-{
-       struct chip_t *chip = candev->chip[0];
-
-       if (chip->chip_irq < 0 || chip->chip_irq >= VME_CHIPS_SIZE) {
-               CANMSG("Bad irq parameter. Maximum is %d.\n", VME_CHIPS_SIZE-1);
-               return -EINVAL;
-       }
-
-/*     vme_chips[chip->chip_irq] = chip; */
-       vme_chips[0] = chip;
-
-       request_vmeirq(UNICAN_VME_IRQ, unican_vme_irq_handler);
-       enable_vmeirq(UNICAN_VME_IRQ);
-
-       return 0;
-}
-
-int unican_vme_request_io(struct candevice_t *candev)
-{
-       unican_request_io(candev);
-
-       return 0;
-}
-
-/**
- * unican_vme_release_io - free reserved io memory range
- * @candev: pointer to candevice/board which releases io
- *
- * Return Value: The function always returns zero
- * File: src/unican.c
- */
-int unican_vme_release_io(struct candevice_t *candev)
-{
-       disable_vmeirq(UNICAN_VME_IRQ);
-       free_vmeirq(UNICAN_VME_IRQ);
-
-       unican_release_io(candev);
-
-       return 0;
-}
 
 /**
  * unican_vme_init_hw_data - Initialize hardware cards
@@ -86,14 +45,13 @@ int unican_vme_release_io(struct candevice_t *candev)
 int unican_vme_reset(struct candevice_t *candev)
 {
        int ret;
-       struct chip_t *chip = candev->chip[0];
+       struct canchip_t *chip = candev->chip[0];
 
        ret = unican_reset(candev);
 
        /* Setup VME interrupt vector */
        if (ret == 0) 
-               unican_writew(0x1234/* chip->chip_irq */,chip->chip_base_addr+CL2_VME_INT_VECTOR);
-
+               unican_writew(chip->chip_irq, chip->chip_base_addr+CL2_VME_INT_VECTOR);
 
        return ret;
 }
@@ -108,12 +66,12 @@ int unican_vme_reset(struct candevice_t *candev)
  */
 int unican_vme_init_chip_data(struct candevice_t *candev, int chipnr)
 {
-       struct chip_t *chip = candev->chip[chipnr];
+       struct canchip_t *chip = candev->chip[chipnr];
 
        unican_init_chip_data(candev, chipnr);
 
        chip->flags |= CHIP_IRQ_VME;
-       chip->chipspecops->irq_handler=unican_vme_irq_handler;
+       /*chip->chipspecops->irq_handler=unican_irq_handler;*/
        return 0;
 }
 
@@ -132,9 +90,8 @@ int unican_vme_register(struct hwspecops_t *hwspecops)
 
        hwspecops->init_hw_data = unican_vme_init_hw_data;
        hwspecops->init_chip_data = unican_vme_init_chip_data;
-       hwspecops->request_io = unican_vme_request_io;
+       hwspecops->request_io = unican_request_io;
        hwspecops->reset = unican_vme_reset;
-       hwspecops->program_irq = unican_vme_program_irq;
-       hwspecops->release_io = unican_vme_release_io;
+       hwspecops->release_io = unican_release_io;
        return 0;
 }