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