summaryrefslogtreecommitdiffstats
path: root/share/man/man9/ppbconf.9
blob: 9b95e7287593ec4a8f62a7e6f5dd399503e75e68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
.\" Copyright (c) 1998, Nicolas Souchu
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"
.Dd April 5, 1998
.Dt PPBCONF 9
.Os FreeBSD
.Sh NAME
.Nm ppbconf
.Nd
ppbus developer's guide
.Sh SYNOPSIS
.Fd "#include <dev/ppbus/ppbconf.h>"
.Sh DESCRIPTION
See
.Xr ppbus 4
for ppbus description.
.Sh PPBUS STRUCTURES
Each ppbus layer
.Po
.Em adapter ,
.Em ppbus
and
.Em device
.Pc
is described by one or more C structure.
.Ss The adapter layer
.Bd -literal
struct ppb_adapter {

        void (*intr_handler)(int);
        void (*reset_epp_timeout)(int);
        void (*ecp_sync)(int);

        int (*exec_microseq)(int, struct ppb_microseq *, int *);

        int (*setmode)(int, int);

        void (*outsb_epp)(int, char *, int);
        void (*outsw_epp)(int, char *, int);
        void (*outsl_epp)(int, char *, int);
        void (*insb_epp)(int, char *, int);
        void (*insw_epp)(int, char *, int);
        void (*insl_epp)(int, char *, int);

        char (*r_dtr)(int);
        char (*r_str)(int);
        char (*r_ctr)(int);
        char (*r_epp)(int);
        char (*r_ecr)(int);
        char (*r_fifo)(int);

        void (*w_dtr)(int, char);
        void (*w_str)(int, char);
        void (*w_ctr)(int, char);
        void (*w_epp)(int, char);
        void (*w_ecr)(int, char);
        void (*w_fifo)(int, char);
};
.Ed
.Pp
This structure is the interface between
.Xr ppc 4
layer and upper ppbus system levels. For each ppc device, this
structure is filled with generic i/o functions that may be redefined if
needed for particular chipsets.
.Pp
Developers are really encouraged to use the
exec_microseq entry to avoid indirect function call overhead. See
.Xr microseq 9
for more info.
.Ss The ppbus layer
.Bd -literal
struct ppb_driver
{       
        struct ppb_device   *(*probe)(struct ppb_data *ppb);
        int                 (*attach)(struct ppb_device *pdp);
        char                *name;
};      
.Ed
.Bd -literal
struct ppb_data {

#define PPB_PnP_PRINTER 0
#define PPB_PnP_MODEM   1
#define PPB_PnP_NET     2
#define PPB_PnP_HDC     3
#define PPB_PnP_PCMCIA  4
#define PPB_PnP_MEDIA   5
#define PPB_PnP_FDC     6
#define PPB_PnP_PORTS   7
#define PPB_PnP_SCANNER 8         
#define PPB_PnP_DIGICAM 9
#define PPB_PnP_UNKNOWN 10    
        int     class_id;       /* not a PnP device if class_id < 0 */

	ushort mode;				/* IEEE 1284-1994 mode
						 * NIBBLE, PS2, EPP, ECP */
	ushort avm;				/* IEEE 1284-1994 available
						 * modes */

        struct ppb_link *ppb_link;         /* link to the adapter */
        struct ppb_device *ppb_owner;      /* device which owns the bus */
        LIST_HEAD(, ppb_device) ppb_devs;  /* list of devices on the bus */
        LIST_ENTRY(ppb_data)    ppb_chain; /* list of busses */
};
.Ed
.Ss The device layer
.Bd -literal
/* microseqences used for GET/PUT operations */
struct ppb_xfer {
	struct ppb_microseq *prolog;		/* loop prologue */
	struct ppb_microseq *body;		/* loop body */
	struct ppb_microseq *epilog;		/* loop epilogue */
};
.Ed
.Bd -literal
struct ppb_context {
        int valid;                      /* 1 if the struct is valid */  
        int mode;                       /* operating mode */

	struct microseq *curpc;		/* pc in curmsq */
	struct microseq *curmsq;	/* currently executed microseq */
}; 
.Ed
.Bd -literal
struct ppb_device {
        
        int id_unit;                    /* unit of the device */
        char *name;                     /* name of the device */

	ushort mode;			/* current mode of the device */
	ushort avm;			/* available modes of the device */
    
        struct ppb_context ctx;         /* context of the device */

					/* mode dependent get msq. If NULL,
					 * IEEE1284 code is used */
	struct ppb_xfer
		get_xfer[PPB_MAX_XFER];

					/* mode dependent put msq. If NULL,
					 * IEEE1284 code is used */
	struct ppb_xfer
		put_xfer[PPB_MAX_XFER];

        void (*intr)(int);              /* interrupt handler */

        struct ppb_data *ppb;           /* link to the ppbus */

        LIST_ENTRY(ppb_device)  chain;  /* list of devices on the bus */
};
.Ed
.Ss Linking these structures all together
.Bd -literal
struct ppb_link {

        int adapter_unit;               /* unit of the adapter */
        int base;                       /* base address of the port */
        int id_irq;                     /* != 0 if irq enabled */

#define EPP_1_9         0x0             /* default */
#define EPP_1_7         0x1
        int epp_protocol;               /* EPP protocol: 0=1.9, 1=1.7 */

        struct ppb_adapter *adapter;    /* link to the ppc adapter */
        struct ppb_data *ppbus;         /* link to the ppbus */
};      
.Ed
.Sh EXAMPLE
See vpo.c source file.
.Sh SEE ALSO
.Xr ppbus 4 ,
.Xr ppi 4 ,
.Xr microseq 9
.Sh HISTORY
The
.Nm
manual page first appeared in
.Fx 3.0 .
.Sh AUTHOR
This
manual page was written by
.An Nicolas Souchu .
OpenPOWER on IntegriCloud