]> rtime.felk.cvut.cz Git - lincan.git/blob - lincan/include/tscan1.h
Actual driver code for directly mapped SJA1000 into PCI mem region 0.
[lincan.git] / lincan / include / tscan1.h
1 /**************************************************************************/
2 /* File: tscan1.h - support for TS-CAN1 PC104 card from                   */
3 /*                 Technologic Systems <http://www.embeddedarm.com/>      */
4 /*                                                                        */
5 /* LinCAN - (Not only) Linux CAN bus driver                               */
6 /* Copyright (C) 2002-2009 DCE FEE CTU Prague <http://dce.felk.cvut.cz>   */
7 /* Copyright (C) 2002-2009 Pavel Pisa <pisa@cmp.felk.cvut.cz>             */
8 /* Funded by OCERA and FRESCOR IST projects                               */
9 /* Based on CAN driver code by Arnaud Westenberg <arnaud@wanadoo.nl>      */
10 /*                                                                        */
11 /* LinCAN is free software; you can redistribute it and/or modify it      */
12 /* under terms of the GNU General Public License as published by the      */
13 /* Free Software Foundation; either version 2, or (at your option) any    */
14 /* later version.  LinCAN is distributed in the hope that it will be      */
15 /* useful, but WITHOUT ANY WARRANTY; without even the implied warranty    */
16 /* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU    */
17 /* General Public License for more details. You should have received a    */
18 /* copy of the GNU General Public License along with LinCAN; see file     */
19 /* COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,  */
20 /* Cambridge, MA 02139, USA.                                              */
21 /*                                                                        */
22 /* To allow use of LinCAN in the compact embedded systems firmware        */
23 /* and RT-executives (RTEMS for example), main authors agree with next    */
24 /* special exception:                                                     */
25 /*                                                                        */
26 /* Including LinCAN header files in a file, instantiating LinCAN generics */
27 /* or templates, or linking other files with LinCAN objects to produce    */
28 /* an application image/executable, does not by itself cause the          */
29 /* resulting application image/executable to be covered by                */
30 /* the GNU General Public License.                                        */
31 /* This exception does not however invalidate any other reasons           */
32 /* why the executable file might be covered by the GNU Public License.    */
33 /* Publication of enhanced or derived LinCAN files is required although.  */
34 /**************************************************************************/
35
36 //Ids SECTION
37 #define TSCAN1_ID0              0xF6
38 #define TSCAN1_ID1              0xB9
39
40 //MEMORY SECTION
41 #if defined(CONFIG_TS7800_PLATFORM)
42 #define TSXXX_BASE_IO   0xee000000
43 #elif defined(CONFIG_MACH_TS72XX)
44 #define TSXXX_BASE_IO   0x01E00000
45 #elif defined(CONFIG_X86)
46 #define TSXXX_BASE_IO   0x0
47 #endif
48
49 //IRQs
50 #if defined(CONFIG_TS7800_PLATFORM)
51 #define TSXXX_IRQ5              64+5
52 #define TSXXX_IRQ6              64+6
53 #define TSXXX_IRQ7              64+7
54 #elif defined(CONFIG_MACH_TS72XX)
55 #define TSXXX_IRQ5              22
56 #define TSXXX_IRQ6              33
57 #define TSXXX_IRQ7              40
58 #elif defined(CONFIG_X86)
59 #define TSXXX_IRQ5              5
60 #define TSXXX_IRQ6              6
61 #define TSXXX_IRQ7              7
62 #endif
63
64 #define TSCAN1_BASE_IO  0x150
65 #define TSCAN1_IO_RANGE 0x8
66 #define TSCAN1_CAN_RANGE        0x20
67
68 #define TSCAN1_ID0_REG  0x0
69 #define TSCAN1_ID1_REG  0x1
70 #define TSCAN1_PLD_REG  0x2
71 #define TSCAN1_WIN_REG  0x4
72 #define TSCAN1_MOD_REG  0x5
73 #define TSCAN1_JMP_REG  0x6
74
75 int tscan1_request_io(struct candevice_t *candev);
76 int tscan1_release_io(struct candevice_t *candev);
77 int tscan1_reset(struct candevice_t *candev);
78 int tscan1_init_hw_data(struct candevice_t *candev);
79 int tscan1_init_chip_data(struct candevice_t *candev, int chipnr);
80 int tscan1_init_obj_data(struct canchip_t *chip, int objnr);
81 void tscan1_write_register(unsigned data, can_ioptr_t address);
82 unsigned tscan1_read_register(can_ioptr_t address);
83 int tscan1_program_irq(struct candevice_t *candev);