]> rtime.felk.cvut.cz Git - lincan.git/blob - 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
1 /**************************************************************************/
2 /* File: unican_vme.c - Unicontrols VME board additional support          */
3 /*                                                                        */
4 /* LinCAN - (Not only) Linux CAN bus driver                               */
5 /* Copyright (C) 2002-2009 DCE FEE CTU Prague <http://dce.felk.cvut.cz>   */
6 /* Copyright (C) 2002-2009 Pavel Pisa <pisa@cmp.felk.cvut.cz>             */
7 /* Funded by OCERA and FRESCOR IST projects                               */
8 /* Based on CAN driver code by Arnaud Westenberg <arnaud@wanadoo.nl>      */
9 /*                                                                        */
10 /* LinCAN is free software; you can redistribute it and/or modify it      */
11 /* under terms of the GNU General Public License as published by the      */
12 /* Free Software Foundation; either version 2, or (at your option) any    */
13 /* later version.  LinCAN is distributed in the hope that it will be      */
14 /* useful, but WITHOUT ANY WARRANTY; without even the implied warranty    */
15 /* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU    */
16 /* General Public License for more details. You should have received a    */
17 /* copy of the GNU General Public License along with LinCAN; see file     */
18 /* COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,  */
19 /* Cambridge, MA 02139, USA.                                              */
20 /*                                                                        */
21 /* To allow use of LinCAN in the compact embedded systems firmware        */
22 /* and RT-executives (RTEMS for example), main authors agree with next    */
23 /* special exception:                                                     */
24 /*                                                                        */
25 /* Including LinCAN header files in a file, instantiating LinCAN generics */
26 /* or templates, or linking other files with LinCAN objects to produce    */
27 /* an application image/executable, does not by itself cause the          */
28 /* resulting application image/executable to be covered by                */
29 /* the GNU General Public License.                                        */
30 /* This exception does not however invalidate any other reasons           */
31 /* why the executable file might be covered by the GNU Public License.    */
32 /* Publication of enhanced or derived LinCAN files is required although.  */
33 /**************************************************************************/
34 /* This file is included in unican.c if CAN_ENABLE_VME_SUPPORT is
35  * set. */
36
37
38 /**
39  * unican_vme_init_hw_data - Initialize hardware cards
40  * @candev: Pointer to candevice/board structure
41  *
42  * Return Value: The function always returns zero
43  * File: src/unican.c
44  */
45 int unican_vme_reset(struct candevice_t *candev)
46 {
47         int ret;
48         struct canchip_t *chip = candev->chip[0];
49
50         ret = unican_reset(candev);
51
52         /* Setup VME interrupt vector */
53         if (ret == 0) 
54                 unican_writew(chip->chip_irq, chip->chip_base_addr+CL2_VME_INT_VECTOR);
55
56         return ret;
57 }
58
59 /**
60  * unican_vme_init_chip_data - Initialize chips
61  * @candev: Pointer to candevice/board structure
62  * @chipnr: Number of the CAN chip on the hardware card
63  *
64  * Return Value: The function always returns zero
65  * File: src/unican.c
66  */
67 int unican_vme_init_chip_data(struct candevice_t *candev, int chipnr)
68 {
69         struct canchip_t *chip = candev->chip[chipnr];
70
71         unican_init_chip_data(candev, chipnr);
72
73         chip->flags |= CHIP_IRQ_VME;
74         /*chip->chipspecops->irq_handler=unican_irq_handler;*/
75         return 0;
76 }
77
78
79 int unican_vme_init_hw_data(struct candevice_t *candev) 
80 {
81         unican_init_hw_data(candev);
82         candev->flags |= CANDEV_PROGRAMMABLE_IRQ;
83
84         return 0;
85 }
86
87 int unican_vme_register(struct hwspecops_t *hwspecops)
88 {
89         unican_register(hwspecops);
90
91         hwspecops->init_hw_data = unican_vme_init_hw_data;
92         hwspecops->init_chip_data = unican_vme_init_chip_data;
93         hwspecops->request_io = unican_request_io;
94         hwspecops->reset = unican_vme_reset;
95         hwspecops->release_io = unican_release_io;
96         return 0;
97 }