xref: /netbsd-src/sys/arch/mvme68k/dev/lpt_pccreg.h (revision ce099b40997c43048fb78bd578195f81d2456523)
1*ce099b40Smartin /*	$NetBSD: lpt_pccreg.h,v 1.4 2008/04/28 20:23:29 martin Exp $ */
2a72d37c4Sscw 
3a72d37c4Sscw /*-
4a72d37c4Sscw  * Copyright (c) 1999 The NetBSD Foundation, Inc.
5a72d37c4Sscw  * All rights reserved.
6a72d37c4Sscw  *
7a72d37c4Sscw  * This code is derived from software contributed to The NetBSD Foundation
8a72d37c4Sscw  * by Steve C. Woodford.
9a72d37c4Sscw  *
10a72d37c4Sscw  * Redistribution and use in source and binary forms, with or without
11a72d37c4Sscw  * modification, are permitted provided that the following conditions
12a72d37c4Sscw  * are met:
13a72d37c4Sscw  * 1. Redistributions of source code must retain the above copyright
14a72d37c4Sscw  *    notice, this list of conditions and the following disclaimer.
15a72d37c4Sscw  * 2. Redistributions in binary form must reproduce the above copyright
16a72d37c4Sscw  *    notice, this list of conditions and the following disclaimer in the
17a72d37c4Sscw  *    documentation and/or other materials provided with the distribution.
18a72d37c4Sscw  *
19a72d37c4Sscw  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20a72d37c4Sscw  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21a72d37c4Sscw  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22a72d37c4Sscw  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23a72d37c4Sscw  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24a72d37c4Sscw  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25a72d37c4Sscw  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26a72d37c4Sscw  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27a72d37c4Sscw  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28a72d37c4Sscw  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29a72d37c4Sscw  * POSSIBILITY OF SUCH DAMAGE.
30a72d37c4Sscw  */
31a72d37c4Sscw 
32a72d37c4Sscw /*
33a72d37c4Sscw  * MVME147 Parallel Port Register Definitions
34a72d37c4Sscw  */
359c745dbdSscw #ifndef _MVME68K_LPT_PCCREG_H
369c745dbdSscw #define _MVME68K_LPT_PCCREG_H
37a72d37c4Sscw 
38a72d37c4Sscw /*
39a72d37c4Sscw  * The mvme147's PCC chip has two status/control registers for the
40a72d37c4Sscw  * printer port:
41a72d37c4Sscw  *
429c745dbdSscw  * PCCREG_PRNT_INTR_CTRL Printer interrupt control register
43a72d37c4Sscw  *                0 - 2 Interrupt Level
44a72d37c4Sscw  *                  3   Interrupt Enable
45a72d37c4Sscw  *                  4   ACK Polarity. If set, falling edge of ACK generates
46a72d37c4Sscw  *                      the interrupt. If clear, rising edge of ACK generates
47a72d37c4Sscw  *                      the interrupt.
48a72d37c4Sscw  *                  5   Indicates an ACK interrupt in progress. Cleared by
49a72d37c4Sscw  *                      writing a one, or disabling lpt interrupts.
50a72d37c4Sscw  *                  6   Indicates a FAULT interrupt. Set on falling edge
51a72d37c4Sscw  *                      of printer's fault signal. Cleared by writing a one.
52a72d37c4Sscw  *                  7   Printer Interrupt in progress. Basically just the
53a72d37c4Sscw  *                      logical OR of bits 5 and 6.
54a72d37c4Sscw  */
55a72d37c4Sscw #define	LPI_ENABLE	(1 << 3)
56a72d37c4Sscw #define	LPI_ACKPOL	(1 << 4)
57a72d37c4Sscw #define	LPI_ACKINT	(1 << 5)
58a72d37c4Sscw #define	LPI_FAULTINT	(1 << 6)
59a72d37c4Sscw #define	LPI_INTERRUPT	(1 << 7)
60a72d37c4Sscw 
619c745dbdSscw 
62a72d37c4Sscw /*
639c745dbdSscw  * PCCREG_PRNT_CONTROL  Printer Control Register
64a72d37c4Sscw  *                  0   Selects auto or manual strobe mode. When low, strobe
65a72d37c4Sscw  *                      is automatically generated by a write to the printer
66a72d37c4Sscw  *                      data register. When set, strobe must be generated
67a72d37c4Sscw  *                      manually using bit 2 of this register.
68a72d37c4Sscw  *                  1   Controls strobe timing in auto mode. When low, strobe
69a72d37c4Sscw  *                      time is 6.4uS. When high, strobe time is 1.6uS.
70a72d37c4Sscw  *                  2   Controls strobe in manual mode.
71a72d37c4Sscw  *                  3   Control Input Prime signal. When set, Input Prime
72a72d37c4Sscw  *                      is activated.
73a72d37c4Sscw  *
74a72d37c4Sscw  * Two other registers which are not addressed via the global PCC structure,
75a72d37c4Sscw  * live at 0xfffe2800. This address is virtualised and passed to the driver
76a72d37c4Sscw  * in the pcc_attach_args structure:
77a72d37c4Sscw  */
78a72d37c4Sscw #define	LPC_STROBE_MODE	(1 << 0)
79a72d37c4Sscw #define	LPC_FAST_STROBE	(1 << 1)
80a72d37c4Sscw #define	LPC_STROBE	(1 << 2)
81a72d37c4Sscw #define	LPC_INPUT_PRIME	(1 << 3)
82a72d37c4Sscw 
839c745dbdSscw #define lpt_control_read()	pcc_reg_read(sys_pcc, PCCREG_PRNT_CONTROL)
849c745dbdSscw #define lpt_control_write(v)	pcc_reg_write(sys_pcc, PCCREG_PRNT_CONTROL, v)
859c745dbdSscw 
86a72d37c4Sscw /*
879c745dbdSscw  * Data and status registers appear at the same offset.
889c745dbdSscw  * Write to access the data register. Read to access the status register.
89a72d37c4Sscw  */
909c745dbdSscw #define LPREG_DATA	0x00	/* Write only data register */
919c745dbdSscw #define LPREG_STATUS	0x00	/* Read only status register */
929c745dbdSscw 
939c745dbdSscw #define LPREG_SIZE	0x1
94a72d37c4Sscw 
95a72d37c4Sscw /*
96a72d37c4Sscw  * Access macros for the status register
97a72d37c4Sscw  */
98a72d37c4Sscw #define	LPS_BUSY	(1 << 3)
99a72d37c4Sscw #define	LPS_PAPER_EMPTY	(1 << 4)
100a72d37c4Sscw #define	LPS_SELECT	(1 << 5)
101a72d37c4Sscw #define	LPS_FAULT	(1 << 6)
102a72d37c4Sscw #define	LPS_ACK		(1 << 7)
103a72d37c4Sscw 
1049c745dbdSscw #define lpt_data_write(sc,v)	\
1059c745dbdSscw 	    bus_space_write_1((sc)->sc_bust, (sc)->sc_bush, LPREG_DATA, (v))
1069c745dbdSscw #define lpt_status_read(sc)	\
1079c745dbdSscw 	    bus_space_read_1((sc)->sc_bust, (sc)->sc_bush, LPREG_STATUS)
1089c745dbdSscw 
1099c745dbdSscw #endif /* _MVME68K_LPT_PCCREG_H */
110