]> rtime.felk.cvut.cz Git - lincan.git/blob - lincan/include/pcan_dongle.h
Merge: Correction for 2.6.23-git kernel - unregister_chrdev() does not return value.
[lincan.git] / lincan / include / pcan_dongle.h
1 #ifndef __PCAN_DONGLE_H__
2 #define __PCAN_DONGLE_H__
3
4 /****************************************************************************/
5 // Ingenieria Almudi (www.almudi.com)
6 // Ported to LinCAN by Jose Pascual Ramírez (josepascual@almudi.com)
7 //
8 //
9 // Copyright (C) 2001,2002,2003,2004  PEAK System-Technik GmbH
10 //
11 // linux@peak-system.com
12 // www.peak-system.com
13 //
14 // This program is free software; you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation; either version 2 of the License, or
17 // (at your option) any later version.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 //
28 // Maintainer(s): Klaus Hitschler (klaus.hitschler@gmx.de)
29 /****************************************************************************/
30
31 /****************************************************************************/
32 //
33 // all parts to handle device interface specific parts of pcan-dongle
34 //
35 // Revision 1.13  2004/04/11 22:03:29  klaus
36 // cosmetic changes
37 //
38 // Revision 1.12  2003/03/02 10:58:07  klaus
39 // merged USB thread into main path
40 //
41 // Revision 1.11  2003/03/02 10:58:07  klaus
42 // merged USB thread into main path
43 //
44 // Revision 1.10.2.3  2003/01/29 20:34:20  klaus
45 // release_20030129_a and release_20030129_u released
46 //
47 // Revision 1.10.2.2  2003/01/29 20:34:19  klaus
48 // release_20030129_a and release_20030129_u released
49 //
50 // Revision 1.10.2.1  2003/01/28 23:28:26  klaus
51 // reorderd pcan_usb.c and pcan_usb_kernel.c, tidied up
52 //
53 // Revision 1.10  2002/01/30 20:54:27  klaus
54 // simple source file header change
55 //
56 /****************************************************************************/
57
58 /****************************************************************************/
59 // parameter wHardwareType, used by open 
60 #define HW_ISA             1 // not supported with LINUX, 82C200 chip 
61 #define HW_DONGLE_SJA      5
62 #define HW_DONGLE_SJA_EPP  6 
63 #define HW_DONGLE_PRO      7 // not yet supported with LINUX
64 #define HW_DONGLE_PRO_EPP  8 // not yet supported with LINUX
65 #define HW_ISA_SJA         9 // use this also for PC/104
66 #define HW_PCI                  10 // PCI carries always SJA1000 chips
67 #define HW_USB            11 // don't know if this is common over peak products
68
69
70 struct DONGLE_PORT
71 {
72   u32  dwPort;                                             // the port of the transport layer
73   u16  wIrq;                                               // the associated irq 
74   struct pardevice *pardev;                                // points to the associated parallel port (PARPORT subsytem)
75   u16  wEcr;                                               // ECR register in case of EPP
76   u8   ucOldDataContent;                                   // the overwritten contents of the port registers
77   u8   ucOldControlContent;
78   u8   ucOldECRContent;
79
80
81   u16  wInitStep;                                          // device specific init state
82   u16  wType;                                              // (number type) to distinguish sp and epp
83   int  nMinor;                                             // the associated minor
84   char *type;                                              // the literal type of the device, info only
85
86   struct canchip_t *chip;
87 };
88
89
90 /****************************************************************************/
91 // DEFINES
92
93 int pcan_dongle_request_io(struct candevice_t *candev);
94 int pcan_dongle_release_io(struct candevice_t *candev);
95 int pcan_dongle_reset(struct candevice_t *candev); 
96 int pcan_dongle_init_hw_data(struct candevice_t *candev);
97 int pcan_dongle_init_chip_data(struct candevice_t *candev, int chipnr);
98 int pcan_dongle_init_obj_data(struct canchip_t *chip, int objnr);
99 void pcan_dongle_write_register(unsigned data, can_ioptr_t address);
100 unsigned pcan_dongle_read_register(can_ioptr_t address);
101 int pcan_dongle_program_irq(struct candevice_t *candev);
102
103 #endif // __PCAN_DONGLE_H__