ppbus_1284.h revision 1.5.4.4 1 1.5.4.4 skrll /* $NetBSD: ppbus_1284.h,v 1.5.4.4 2004/09/21 13:32:37 skrll Exp $ */
2 1.5.4.2 skrll
3 1.5.4.2 skrll /*-
4 1.5.4.2 skrll * Copyright (c) 1997 Nicolas Souchu
5 1.5.4.2 skrll * All rights reserved.
6 1.5.4.2 skrll *
7 1.5.4.2 skrll * Redistribution and use in source and binary forms, with or without
8 1.5.4.2 skrll * modification, are permitted provided that the following conditions
9 1.5.4.2 skrll * are met:
10 1.5.4.2 skrll * 1. Redistributions of source code must retain the above copyright
11 1.5.4.2 skrll * notice, this list of conditions and the following disclaimer.
12 1.5.4.2 skrll * 2. Redistributions in binary form must reproduce the above copyright
13 1.5.4.2 skrll * notice, this list of conditions and the following disclaimer in the
14 1.5.4.2 skrll * documentation and/or other materials provided with the distribution.
15 1.5.4.2 skrll *
16 1.5.4.2 skrll * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 1.5.4.2 skrll * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 1.5.4.2 skrll * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 1.5.4.2 skrll * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 1.5.4.2 skrll * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 1.5.4.2 skrll * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 1.5.4.2 skrll * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 1.5.4.2 skrll * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 1.5.4.2 skrll * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 1.5.4.2 skrll * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 1.5.4.2 skrll * SUCH DAMAGE.
27 1.5.4.2 skrll *
28 1.5.4.2 skrll * FreeBSD: src/sys/dev/ppbus/ppb_1284.h,v 1.7 2000/01/14 08:03:14 nsouch Exp
29 1.5.4.2 skrll *
30 1.5.4.2 skrll */
31 1.5.4.2 skrll #ifndef __PPBUS_1284_H
32 1.5.4.2 skrll #define __PPBUS_1284_H
33 1.5.4.2 skrll
34 1.5.4.2 skrll /*
35 1.5.4.2 skrll * IEEE1284 signals
36 1.5.4.2 skrll */
37 1.5.4.2 skrll
38 1.5.4.2 skrll /* host driven signals */
39 1.5.4.2 skrll
40 1.5.4.2 skrll #define nHostClk STROBE
41 1.5.4.2 skrll #define Write STROBE
42 1.5.4.2 skrll
43 1.5.4.2 skrll #define nHostBusy AUTOFEED
44 1.5.4.2 skrll #define nHostAck AUTOFEED
45 1.5.4.2 skrll #define DStrb AUTOFEED
46 1.5.4.2 skrll
47 1.5.4.2 skrll #define nReveseRequest nINIT
48 1.5.4.2 skrll
49 1.5.4.2 skrll #define nActive1284 SELECTIN
50 1.5.4.2 skrll #define AStrb SELECTIN
51 1.5.4.2 skrll
52 1.5.4.2 skrll /* peripheral driven signals */
53 1.5.4.2 skrll
54 1.5.4.2 skrll #define nDataAvail nFAULT
55 1.5.4.2 skrll #define nPeriphRequest nFAULT
56 1.5.4.2 skrll
57 1.5.4.2 skrll #define Xflag SELECT
58 1.5.4.2 skrll
59 1.5.4.2 skrll #define AckDataReq PERROR
60 1.5.4.2 skrll #define nAckReverse PERROR
61 1.5.4.2 skrll
62 1.5.4.2 skrll #define nPtrBusy nBUSY
63 1.5.4.2 skrll #define nPeriphAck nBUSY
64 1.5.4.2 skrll #define Wait nBUSY
65 1.5.4.2 skrll
66 1.5.4.2 skrll #define PtrClk nACK
67 1.5.4.2 skrll #define PeriphClk nACK
68 1.5.4.2 skrll #define Intr nACK
69 1.5.4.2 skrll
70 1.5.4.2 skrll /* request mode values */
71 1.5.4.2 skrll #define NIBBLE_1284_NORMAL 0x0
72 1.5.4.2 skrll #define NIBBLE_1284_REQUEST_ID 0x4
73 1.5.4.2 skrll #define BYTE_1284_NORMAL 0x1
74 1.5.4.2 skrll #define BYTE_1284_REQUEST_ID 0x5
75 1.5.4.2 skrll #define ECP_1284_NORMAL 0x10
76 1.5.4.2 skrll #define ECP_1284_REQUEST_ID 0x14
77 1.5.4.2 skrll #define ECP_1284_RLE 0x30
78 1.5.4.2 skrll #define ECP_1284_RLE_REQUEST_ID 0x34
79 1.5.4.2 skrll #define EPP_1284_NORMAL 0x40
80 1.5.4.2 skrll #define EXT_LINK_1284_NORMAL 0x80
81 1.5.4.2 skrll
82 1.5.4.2 skrll /* ieee1284 mode options */
83 1.5.4.2 skrll #define PPBUS_REQUEST_ID 0x1
84 1.5.4.2 skrll #define PPBUS_USE_RLE 0x2
85 1.5.4.2 skrll #define PPBUS_EXTENSIBILITY_LINK 0x4
86 1.5.4.2 skrll
87 1.5.4.2 skrll /* ieee1284 errors */
88 1.5.4.2 skrll #define PPBUS_NO_ERROR 0
89 1.5.4.2 skrll #define PPBUS_MODE_UNSUPPORTED 1 /* mode not supported by peripheral */
90 1.5.4.2 skrll #define PPBUS_NOT_IEEE1284 2 /* not an IEEE1284 compliant periph. */
91 1.5.4.2 skrll #define PPBUS_TIMEOUT 3 /* timeout */
92 1.5.4.2 skrll #define PPBUS_INVALID_MODE 4 /* current mode is incorrect */
93 1.5.4.2 skrll
94 1.5.4.2 skrll /* ieee1284 host side states */
95 1.5.4.2 skrll #define PPBUS_ERROR 0
96 1.5.4.2 skrll #define PPBUS_FORWARD_IDLE 1
97 1.5.4.2 skrll #define PPBUS_NEGOTIATION 2
98 1.5.4.2 skrll #define PPBUS_SETUP 3
99 1.5.4.2 skrll #define PPBUS_ECP_FORWARD_IDLE 4
100 1.5.4.2 skrll #define PPBUS_FWD_TO_REVERSE 5
101 1.5.4.2 skrll #define PPBUS_REVERSE_IDLE 6
102 1.5.4.2 skrll #define PPBUS_REVERSE_TRANSFER 7
103 1.5.4.2 skrll #define PPBUS_REVERSE_TO_FWD 8
104 1.5.4.2 skrll #define PPBUS_EPP_IDLE 9
105 1.5.4.2 skrll #define PPBUS_TERMINATION 10
106 1.5.4.2 skrll
107 1.5.4.2 skrll /* peripheral side states */
108 1.5.4.2 skrll #define PPBUS_PERIPHERAL_NEGOTIATION 11
109 1.5.4.2 skrll #define PPBUS_PERIPHERAL_IDLE 12
110 1.5.4.2 skrll #define PPBUS_PERIPHERAL_TRANSFER 13
111 1.5.4.2 skrll #define PPBUS_PERIPHERAL_TERMINATION 14
112 1.5.4.2 skrll
113 1.5.4.2 skrll /* Function prototypes */
114 1.5.4.2 skrll
115 1.5.4.2 skrll /* Host functions */
116 1.5.4.2 skrll int ppbus_1284_negotiate(struct device *, int, int);
117 1.5.4.2 skrll int ppbus_1284_terminate(struct device *);
118 1.5.4.2 skrll int ppbus_1284_read_id(struct device *, int, char **, size_t *, size_t *);
119 1.5.4.2 skrll int ppbus_1284_get_state(struct device *);
120 1.5.4.2 skrll int ppbus_1284_set_state(struct device *, int state);
121 1.5.4.2 skrll
122 1.5.4.2 skrll /* Peripheral functions */
123 1.5.4.2 skrll int ppbus_peripheral_terminate(struct device *, int);
124 1.5.4.2 skrll int ppbus_peripheral_negotiate(struct device *, int, int);
125 1.5.4.2 skrll int byte_peripheral_write(struct device *, char *, int, int *);
126 1.5.4.2 skrll
127 1.5.4.2 skrll #endif /* __PPBUS_1284_H */
128