1 /**************************************************************************/
2 /* File: pcan_dongle.h - PEAK's printer port dongle addapter */
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 /* Copyright (C) 2005 Klaus Hitschler <klaus.hitschler@gmx.de> */
8 /* Copyright (C) 2005-2006 Jose Pascual RamÃrez <josepascual@almudi.com> */
9 /* Copyright (C) 2001,2002,2003,2004 PEAK System-Technik GmbH */
10 /* Funded by OCERA and FRESCOR IST projects */
11 /* Based on CAN driver code by Arnaud Westenberg <arnaud@wanadoo.nl> */
12 /* Contributions: Marcel Offermans <marcel.offermans@luminis.nl> */
13 /* Philipp Baer <philipp.baer@informatik.uni-ulm.de> */
15 /* LinCAN is free software; you can redistribute it and/or modify it */
16 /* under terms of the GNU General Public License as published by the */
17 /* Free Software Foundation; either version 2, or (at your option) any */
18 /* later version. LinCAN is distributed in the hope that it will be */
19 /* useful, but WITHOUT ANY WARRANTY; without even the implied warranty */
20 /* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */
21 /* General Public License for more details. You should have received a */
22 /* copy of the GNU General Public License along with LinCAN; see file */
23 /* COPYING. If not, write to the Free Software Foundation, 675 Mass Ave, */
24 /* Cambridge, MA 02139, USA. */
26 /* To allow use of LinCAN in the compact embedded systems firmware */
27 /* and RT-executives (RTEMS for example), main authors agree with next */
28 /* special exception: */
30 /* Including LinCAN header files in a file, instantiating LinCAN generics */
31 /* or templates, or linking other files with LinCAN objects to produce */
32 /* an application image/executable, does not by itself cause the */
33 /* resulting application image/executable to be covered by */
34 /* the GNU General Public License. */
35 /* This exception does not however invalidate any other reasons */
36 /* why the executable file might be covered by the GNU Public License. */
37 /* Publication of enhanced or derived LinCAN files is required although. */
38 /**************************************************************************/
40 #ifndef __PCAN_DONGLE_H__
41 #define __PCAN_DONGLE_H__
43 /****************************************************************************/
45 // all parts to handle device interface specific parts of pcan-dongle
47 // Revision 1.13 2004/04/11 22:03:29 klaus
50 // Revision 1.12 2003/03/02 10:58:07 klaus
51 // merged USB thread into main path
53 // Revision 1.11 2003/03/02 10:58:07 klaus
54 // merged USB thread into main path
56 // Revision 1.10.2.3 2003/01/29 20:34:20 klaus
57 // release_20030129_a and release_20030129_u released
59 // Revision 1.10.2.2 2003/01/29 20:34:19 klaus
60 // release_20030129_a and release_20030129_u released
62 // Revision 1.10.2.1 2003/01/28 23:28:26 klaus
63 // reorderd pcan_usb.c and pcan_usb_kernel.c, tidied up
65 // Revision 1.10 2002/01/30 20:54:27 klaus
66 // simple source file header change
68 /****************************************************************************/
70 /****************************************************************************/
71 // parameter wHardwareType, used by open
72 #define HW_ISA 1 // not supported with LINUX, 82C200 chip
73 #define HW_DONGLE_SJA 5
74 #define HW_DONGLE_SJA_EPP 6
75 #define HW_DONGLE_PRO 7 // not yet supported with LINUX
76 #define HW_DONGLE_PRO_EPP 8 // not yet supported with LINUX
77 #define HW_ISA_SJA 9 // use this also for PC/104
78 #define HW_PCI 10 // PCI carries always SJA1000 chips
79 #define HW_USB 11 // don't know if this is common over peak products
84 u32 dwPort; // the port of the transport layer
85 u16 wIrq; // the associated irq
86 struct pardevice *pardev; // points to the associated parallel port (PARPORT subsytem)
87 u16 wEcr; // ECR register in case of EPP
88 u8 ucOldDataContent; // the overwritten contents of the port registers
89 u8 ucOldControlContent;
93 u16 wInitStep; // device specific init state
94 u16 wType; // (number type) to distinguish sp and epp
95 int nMinor; // the associated minor
96 char *type; // the literal type of the device, info only
98 struct canchip_t *chip;
102 /****************************************************************************/
105 int pcan_dongle_request_io(struct candevice_t *candev);
106 int pcan_dongle_release_io(struct candevice_t *candev);
107 int pcan_dongle_reset(struct candevice_t *candev);
108 int pcan_dongle_init_hw_data(struct candevice_t *candev);
109 int pcan_dongle_init_chip_data(struct candevice_t *candev, int chipnr);
110 int pcan_dongle_init_obj_data(struct canchip_t *chip, int objnr);
111 void pcan_dongle_write_register(unsigned data, can_ioptr_t address);
112 unsigned pcan_dongle_read_register(can_ioptr_t address);
113 int pcan_dongle_program_irq(struct candevice_t *candev);
115 #endif // __PCAN_DONGLE_H__