1 /*
2 parallel.h - miscellaneous parallel port functions
3 
4 Copyright (c) 1999 - 2001             NoisyB
5 Copyright (c) 2001 - 2004, 2015, 2017 dbjh
6 
7 
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22 #ifndef MISC_PARALLEL_H
23 #define MISC_PARALLEL_H
24 
25 #ifdef  HAVE_CONFIG_H
26 #include "config.h"
27 #endif
28 
29 
30 #ifdef  USE_PARALLEL
31 
32 #define PARPORT_DATA     0                      // output
33 #define PARPORT_STATUS   1                      // input
34 #define PARPORT_CONTROL  2
35 #define PARPORT_EADDRESS 3                      // EPP address
36 #define PARPORT_EDATA    4                      // EPP output/input
37 
38 #define PARPORT_INPUT_MASK 0x78
39 
40 #define PARPORT_IBUSY  0x80
41 #define PARPORT_STROBE 1
42 
43 #define PARPORT_UNKNOWN ((unsigned short) -1)
44 
45 typedef enum { PPMODE_SPP, PPMODE_SPP_BIDIR, PPMODE_EPP } parport_mode_t;
46 
47 // DJGPP (DOS) has these, but it's better that all platforms use the same code.
48 extern unsigned char inportb (unsigned short port);
49 extern unsigned short inportw (unsigned short port);
50 extern void outportb (unsigned short port, unsigned char byte);
51 extern void outportw (unsigned short port, unsigned short word);
52 
53 extern unsigned short parport_open (unsigned short port);
54 extern void parport_close (void);
55 extern parport_mode_t parport_setup (unsigned short port, parport_mode_t mode);
56 extern void parport_reset_timeout (unsigned short port);
57 extern void parport_print_info (void);
58 #endif // USE_PARALLEL
59 
60 #endif // MISC_PARALLEL_H
61