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