]> rtime.felk.cvut.cz Git - lincan.git/blob - lincan/include/ts7kv.h
The LinCAN driver license unified according to DCE FEE CTU head and superiors request.
[lincan.git] / lincan / include / ts7kv.h
1 /**************************************************************************/
2 /* File: ts7kv.h - support for TS-7KV multifunction 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 TS7KV_ID0               0x41
38 #define TS7KV_ID1               0x20
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 TS7KV_BASE_IO   0xE0
65 #define TS7KV_IO_RANGE  0x8
66 #define TS7KV_CAN_RANGE 0x20
67
68 #define TS7KV_ID0_REG   0x0
69 #define TS7KV_ID1_REG   0x1
70 #define TS7KV_PLD_REG   0x2
71
72 #define TS7KV_CTR1_REG  0x4
73 #define TS7KV_CTR2_REG  0x5
74 #define TS7KV_FPGA_REG  0x6
75 #define TS7KV_JMP_REG   0x7
76 #define TS7KV_WIN_REG   0x1E
77
78 int ts7kv_request_io(struct candevice_t *candev);
79 int ts7kv_release_io(struct candevice_t *candev);
80 int ts7kv_reset(struct candevice_t *candev);
81 int ts7kv_init_hw_data(struct candevice_t *candev);
82 int ts7kv_init_chip_data(struct candevice_t *candev, int chipnr);
83 int ts7kv_init_obj_data(struct canchip_t *chip, int objnr);
84 void ts7kv_write_register(unsigned data, can_ioptr_t address);
85 unsigned ts7kv_read_register(can_ioptr_t address);
86 int ts7kv_program_irq(struct candevice_t *candev);