cpi_nubusvar.h revision 1.2.22.2 1 1.2.22.2 yamt /* $NetBSD: cpi_nubusvar.h,v 1.2.22.2 2009/05/04 08:11:27 yamt Exp $ */
2 1.2.22.2 yamt
3 1.2.22.2 yamt /*-
4 1.2.22.2 yamt * Copyright (c) 2008 Hauke Fath
5 1.2.22.2 yamt *
6 1.2.22.2 yamt * Redistribution and use in source and binary forms, with or without
7 1.2.22.2 yamt * modification, are permitted provided that the following conditions
8 1.2.22.2 yamt * are met:
9 1.2.22.2 yamt * 1. Redistributions of source code must retain the above copyright
10 1.2.22.2 yamt * notice, this list of conditions and the following disclaimer.
11 1.2.22.2 yamt * 2. Redistributions in binary form must reproduce the above copyright
12 1.2.22.2 yamt * notice, this list of conditions and the following disclaimer in the
13 1.2.22.2 yamt * documentation and/or other materials provided with the distribution.
14 1.2.22.2 yamt *
15 1.2.22.2 yamt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 1.2.22.2 yamt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 1.2.22.2 yamt * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 1.2.22.2 yamt * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 1.2.22.2 yamt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 1.2.22.2 yamt * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 1.2.22.2 yamt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 1.2.22.2 yamt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 1.2.22.2 yamt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 1.2.22.2 yamt * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 1.2.22.2 yamt */
26 1.2.22.2 yamt
27 1.2.22.2 yamt #ifndef CPI_NUBUSVAR_H
28 1.2.22.2 yamt #define CPI_NUBUSVAR_H
29 1.2.22.2 yamt
30 1.2.22.2 yamt /* Where we find the Z8536 CIO in Nubus slot space */
31 1.2.22.2 yamt #define CIO_BASE_OFFSET 0x060010
32 1.2.22.2 yamt
33 1.2.22.2 yamt /* Max. length of card name string */
34 1.2.22.2 yamt #define CPI_CARD_NAME_LEN 64
35 1.2.22.2 yamt
36 1.2.22.2 yamt /* The CIO lives on the top 8 bit of the 32 bit data bus. */
37 1.2.22.2 yamt enum cio_regs {
38 1.2.22.2 yamt CIO_PORTC = 0x03,
39 1.2.22.2 yamt CIO_PORTB = 0x07,
40 1.2.22.2 yamt CIO_PORTA = 0x0b,
41 1.2.22.2 yamt CIO_CTRL = 0x0f
42 1.2.22.2 yamt };
43 1.2.22.2 yamt
44 1.2.22.2 yamt #define CPI_UNIT(c) (minor(c) & 0x1f)
45 1.2.22.2 yamt
46 1.2.22.2 yamt enum lp_state {
47 1.2.22.2 yamt LP_INITIAL = 0, /* device is closed */
48 1.2.22.2 yamt LP_OPENING, /* device is about to be opened */
49 1.2.22.2 yamt LP_OPEN, /* device is open */
50 1.2.22.2 yamt LP_BUSY, /* busy with data output */
51 1.2.22.2 yamt LP_ASLEEP, /* waiting for output completion */
52 1.2.22.2 yamt };
53 1.2.22.2 yamt
54 1.2.22.2 yamt /* Bit masks for Centronics status + handshake lines */
55 1.2.22.2 yamt enum hsk_lines {
56 1.2.22.2 yamt CPI_RESET = 0x01, /* PB0 */
57 1.2.22.2 yamt CPI_STROBE = 0x08, /* PC3 */
58 1.2.22.2 yamt CPI_BUSY = 0x40, /* PC0 */
59 1.2.22.2 yamt CPI_SELECT = 0x20, /* PB5 */
60 1.2.22.2 yamt CPI_FAULT = 0x02, /* PB1 */
61 1.2.22.2 yamt CPI_PAPER_EMPTY = 0x02, /* PC1 */
62 1.2.22.2 yamt CPI_ACK = 0x04 /* PC2 */
63 1.2.22.2 yamt };
64 1.2.22.2 yamt
65 1.2.22.2 yamt struct cpi_softc {
66 1.2.22.2 yamt struct device sc_dev;
67 1.2.22.2 yamt
68 1.2.22.2 yamt nubus_slot sc_slot; /* Nubus slot number */
69 1.2.22.2 yamt char cardname[CPI_CARD_NAME_LEN];
70 1.2.22.2 yamt
71 1.2.22.2 yamt bus_addr_t sc_basepa; /* base physical address */
72 1.2.22.2 yamt bus_space_tag_t sc_bst;
73 1.2.22.2 yamt bus_space_handle_t sc_bsh;
74 1.2.22.2 yamt
75 1.2.22.2 yamt ulong sc_intcount; /* Hard interrupts */
76 1.2.22.2 yamt ulong sc_bytestoport; /* Bytes written to port */
77 1.2.22.2 yamt
78 1.2.22.2 yamt struct callout sc_wakeupchan;
79 1.2.22.2 yamt
80 1.2.22.2 yamt #define CPI_BUFSIZE 0x0800
81 1.2.22.2 yamt char *sc_printbuf; /* Driver's print buffer */
82 1.2.22.2 yamt size_t sc_bufbytes; /* # of bytes in buffer */
83 1.2.22.2 yamt u_char *sc_cp; /* Next byte to send */
84 1.2.22.2 yamt
85 1.2.22.2 yamt u_char sc_lpstate;
86 1.2.22.2 yamt };
87 1.2.22.2 yamt
88 1.2.22.2 yamt #endif /* CPI_NUBUSVAR_H */
89