pckbportvar.h revision 1.3.4.4 1 1.3.4.4 skrll /* $NetBSD: pckbportvar.h,v 1.3.4.4 2004/09/21 13:32:19 skrll Exp $ */
2 1.3.4.2 skrll
3 1.3.4.2 skrll /*
4 1.3.4.2 skrll * Copyright (c) 2004 Ben Harris
5 1.3.4.2 skrll * Copyright (c) 1998
6 1.3.4.2 skrll * Matthias Drochner. All rights reserved.
7 1.3.4.2 skrll *
8 1.3.4.2 skrll * Redistribution and use in source and binary forms, with or without
9 1.3.4.2 skrll * modification, are permitted provided that the following conditions
10 1.3.4.2 skrll * are met:
11 1.3.4.2 skrll * 1. Redistributions of source code must retain the above copyright
12 1.3.4.2 skrll * notice, this list of conditions and the following disclaimer.
13 1.3.4.2 skrll * 2. Redistributions in binary form must reproduce the above copyright
14 1.3.4.2 skrll * notice, this list of conditions and the following disclaimer in the
15 1.3.4.2 skrll * documentation and/or other materials provided with the distribution.
16 1.3.4.2 skrll *
17 1.3.4.2 skrll * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 1.3.4.2 skrll * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 1.3.4.2 skrll * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 1.3.4.2 skrll * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 1.3.4.2 skrll * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 1.3.4.2 skrll * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 1.3.4.2 skrll * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 1.3.4.2 skrll * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 1.3.4.2 skrll * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 1.3.4.2 skrll * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 1.3.4.2 skrll *
28 1.3.4.2 skrll */
29 1.3.4.2 skrll
30 1.3.4.2 skrll #ifndef _DEV_PCKBPORT_PCKBPORTVAR_H_
31 1.3.4.2 skrll #define _DEV_PCKBPORT_PCKBPORTVAR_H_
32 1.3.4.2 skrll
33 1.3.4.2 skrll #include <sys/callout.h>
34 1.3.4.2 skrll
35 1.3.4.2 skrll typedef struct pckbport_tag *pckbport_tag_t;
36 1.3.4.2 skrll typedef int pckbport_slot_t;
37 1.3.4.2 skrll
38 1.3.4.2 skrll #define PCKBPORT_KBD_SLOT 0
39 1.3.4.2 skrll #define PCKBPORT_AUX_SLOT 1
40 1.3.4.2 skrll #define PCKBPORT_NSLOTS 2
41 1.3.4.2 skrll
42 1.3.4.2 skrll typedef void (*pckbport_inputfcn)(void *, int);
43 1.3.4.2 skrll
44 1.3.4.2 skrll struct pckbport_accessops {
45 1.3.4.2 skrll /* Functions to be provided by controller driver (eg pckbc) */
46 1.3.4.2 skrll int (*t_xt_translation)(void *, pckbport_slot_t, int);
47 1.3.4.2 skrll int (*t_send_devcmd) (void *, pckbport_slot_t, u_char);
48 1.3.4.2 skrll int (*t_poll_data1) (void *, pckbport_slot_t);
49 1.3.4.2 skrll void (*t_slot_enable) (void *, pckbport_slot_t, int);
50 1.3.4.2 skrll void (*t_intr_establish)(void *, pckbport_slot_t);
51 1.3.4.2 skrll void (*t_set_poll) (void *, pckbport_slot_t, int);
52 1.3.4.2 skrll };
53 1.3.4.2 skrll
54 1.3.4.2 skrll /*
55 1.3.4.2 skrll * external representation (pckbport_tag_t),
56 1.3.4.2 skrll * needed early for console operation
57 1.3.4.2 skrll */
58 1.3.4.2 skrll struct pckbport_tag {
59 1.3.4.2 skrll struct pckbport_slotdata *t_slotdata[PCKBPORT_NSLOTS];
60 1.3.4.2 skrll
61 1.3.4.2 skrll struct callout t_cleanup;
62 1.3.4.2 skrll
63 1.3.4.2 skrll pckbport_inputfcn t_inputhandler[PCKBPORT_NSLOTS];
64 1.3.4.2 skrll void *t_inputarg[PCKBPORT_NSLOTS];
65 1.3.4.2 skrll char *t_subname[PCKBPORT_NSLOTS];
66 1.3.4.2 skrll
67 1.3.4.2 skrll struct pckbport_accessops const *t_ops;
68 1.3.4.2 skrll /* First argument to all those */
69 1.3.4.2 skrll void *t_cookie;
70 1.3.4.2 skrll };
71 1.3.4.2 skrll
72 1.3.4.2 skrll struct pckbport_attach_args {
73 1.3.4.2 skrll pckbport_tag_t pa_tag;
74 1.3.4.2 skrll pckbport_slot_t pa_slot;
75 1.3.4.2 skrll };
76 1.3.4.2 skrll
77 1.3.4.2 skrll extern const char * const pckbport_slot_names[];
78 1.3.4.2 skrll extern struct pckbport_tag pckbport_consdata;
79 1.3.4.2 skrll extern int pckbport_console_attached;
80 1.3.4.2 skrll
81 1.3.4.2 skrll /* Calls from pckbd etc */
82 1.3.4.2 skrll void pckbport_set_inputhandler(pckbport_tag_t, pckbport_slot_t,
83 1.3.4.2 skrll pckbport_inputfcn, void *, char *);
84 1.3.4.2 skrll
85 1.3.4.2 skrll void pckbport_flush(pckbport_tag_t, pckbport_slot_t);
86 1.3.4.2 skrll int pckbport_poll_cmd(pckbport_tag_t, pckbport_slot_t, u_char *, int,
87 1.3.4.2 skrll int, u_char *, int);
88 1.3.4.2 skrll int pckbport_enqueue_cmd(pckbport_tag_t, pckbport_slot_t, u_char *, int,
89 1.3.4.2 skrll int, int, u_char *);
90 1.3.4.2 skrll int pckbport_poll_data(pckbport_tag_t, pckbport_slot_t);
91 1.3.4.2 skrll void pckbport_set_poll(pckbport_tag_t, pckbport_slot_t, int);
92 1.3.4.2 skrll int pckbport_xt_translation(pckbport_tag_t, pckbport_slot_t, int);
93 1.3.4.2 skrll void pckbport_slot_enable(pckbport_tag_t, pckbport_slot_t, int);
94 1.3.4.2 skrll
95 1.3.4.2 skrll /* calls from pckbc etc */
96 1.3.4.2 skrll int pckbport_cnattach(void *, struct pckbport_accessops const *,
97 1.3.4.2 skrll pckbport_slot_t);
98 1.3.4.2 skrll pckbport_tag_t pckbport_attach(void *,
99 1.3.4.2 skrll struct pckbport_accessops const *);
100 1.3.4.2 skrll struct device *pckbport_attach_slot(struct device *, pckbport_tag_t,
101 1.3.4.2 skrll pckbport_slot_t);
102 1.3.4.2 skrll void pckbportintr(pckbport_tag_t, pckbport_slot_t, int);
103 1.3.4.2 skrll
104 1.3.4.2 skrll /* md hook for use without mi wscons */
105 1.3.4.2 skrll int pckbport_machdep_cnattach(pckbport_tag_t, pckbport_slot_t);
106 1.3.4.2 skrll
107 1.3.4.2 skrll #endif /* _DEV_PCKBPORT_PCKBPORTVAR_H_ */
108