]> rtime.felk.cvut.cz Git - lincan.git/blob - lincan/src/unican_vme.c
Adapted for modified version of VME bridge driver (ca91c042).
[lincan.git] / lincan / src / unican_vme.c
1 /* unican_vme.c
2  * Linux CAN-bus device driver.
3  * Written for new CAN driver version by Pavel Pisa - OCERA team member
4  * email:pisa@cmp.felk.cvut.cz
5  * This software is released under the GPL-License.
6  * Version lincan-0.3  17 Jun 2004
7  */ 
8
9 /* This file is included in unican.c if CAN_ENABLE_VME_SUPPORT is
10  * set. */
11
12
13 /**
14  * unican_vme_init_hw_data - Initialize hardware cards
15  * @candev: Pointer to candevice/board structure
16  *
17  * Return Value: The function always returns zero
18  * File: src/unican.c
19  */
20 int unican_vme_reset(struct candevice_t *candev)
21 {
22         int ret;
23         struct chip_t *chip = candev->chip[0];
24
25         ret = unican_reset(candev);
26
27         /* Setup VME interrupt vector */
28         if (ret == 0) 
29                 unican_writew(chip->chip_irq, chip->chip_base_addr+CL2_VME_INT_VECTOR);
30
31         return ret;
32 }
33
34 /**
35  * unican_vme_init_chip_data - Initialize chips
36  * @candev: Pointer to candevice/board structure
37  * @chipnr: Number of the CAN chip on the hardware card
38  *
39  * Return Value: The function always returns zero
40  * File: src/unican.c
41  */
42 int unican_vme_init_chip_data(struct candevice_t *candev, int chipnr)
43 {
44         struct chip_t *chip = candev->chip[chipnr];
45
46         unican_init_chip_data(candev, chipnr);
47
48         chip->flags |= CHIP_IRQ_VME;
49         chip->chipspecops->irq_handler=unican_irq_handler;
50         return 0;
51 }
52
53
54 int unican_vme_init_hw_data(struct candevice_t *candev) 
55 {
56         unican_init_hw_data(candev);
57         candev->flags |= CANDEV_PROGRAMMABLE_IRQ;
58
59         return 0;
60 }
61
62 int unican_vme_register(struct hwspecops_t *hwspecops)
63 {
64         unican_register(hwspecops);
65
66         hwspecops->init_hw_data = unican_vme_init_hw_data;
67         hwspecops->init_chip_data = unican_vme_init_chip_data;
68         hwspecops->request_io = unican_request_io;
69         hwspecops->reset = unican_vme_reset;
70         hwspecops->release_io = unican_release_io;
71         return 0;
72 }