1 /* WARNING: As usual for performance reasons this library generally does not
2 * enable/disable interrupts (cli/sti). To avoid contention with
3 * interrupt handlers the calling program should do that. */
5 #include <conio.h> /* this is where Open Watcom hides the outp() etc. functions */
7 #include <hw/cpu/cpu.h>
10 /* parallel port types */
13 PARPORT_BIDIRECTIONAL,
22 PARPORT_MODE_STANDARD_STROBE_ACK=0, /* not on busy, pulse, wait for ack */
23 PARPORT_MODE_STANDARD_STROBE, /* not on busy, pulse, don't wait for ack */
24 PARPORT_MODE_FIFO, /* switch into FIFO mode, let h/w do handshaking */
25 PARPORT_MODE_ECP, /* switch to ECP mode */
26 PARPORT_MODE_EPP /* switch to EPP mode */
29 #define MAX_PARPORTS 4
31 #define PARPORT_SUPPORTS_EPP(x) ((x) == PARPORT_EPP || (x) == PARPORT_ECP_AND_EPP)
32 #define PARPORT_SUPPORTS_ECP(x) ((x) == PARPORT_ECP || (x) == PARPORT_ECP_AND_EPP)
34 #define PARPORT_IO_DATA 0
35 #define PARPORT_IO_STATUS 1
36 #define PARPORT_IO_CONTROL 2
37 #define PARPORT_IO_EPP_ADDRESS 3
38 #define PARPORT_IO_EPP_DATA 4
40 #define PARPORT_IO_ECP_REG_A 0x400
41 #define PARPORT_IO_ECP_REG_B 0x401
42 #define PARPORT_IO_ECP_CONTROL 0x402
44 #define PARPORT_STATUS_nBUSY (1 << 7)
45 #define PARPORT_STATUS_nACK (1 << 6)
46 #define PARPORT_STATUS_PAPER_OUT (1 << 5)
47 #define PARPORT_STATUS_SELECT (1 << 4)
48 #define PARPORT_STATUS_nERROR (1 << 3)
50 #define PARPORT_CTL_ENABLE_BIDIR (1 << 5)
51 #define PARPORT_CTL_ENABLE_IRQ (1 << 4)
52 #define PARPORT_CTL_SELECT_PRINTER (1 << 3)
53 #define PARPORT_CTL_nINIT (1 << 2)
54 #define PARPORT_CTL_LINEFEED (1 << 1)
55 #define PARPORT_CTL_STROBE (1 << 0)
57 #define STANDARD_PARPORT_PORTS 3
64 uint8_t max_xfer_size:3; /* in bytes */
69 uint8_t output_mode:3;
73 extern const char * parport_type_str[PARPORT_MAX];
74 extern int init_parports;
75 extern int bios_parports;
76 extern uint16_t standard_parport_ports[STANDARD_PARPORT_PORTS];
77 extern struct info_parport info_parport[MAX_PARPORTS];
78 extern int info_parports;
80 uint16_t get_bios_parport(unsigned int index);
81 int already_got_parport(uint16_t port);
82 int probe_parport(uint16_t port);
83 int add_pnp_parport(uint16_t port,int irq,int dma,int type);