1 /* $NetBSD: dtvar.h,v 1.4 2005/12/11 12:18:41 christos Exp $ */
4 * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
35 #define DT_DEVICE_NO(a) (((a) - DT_ADDR_FIRST) >> 1)
36 #define DT_GET_SHORT(b0, b1) (((b0) << 8) | (b1))
43 /* varzise, checksum byte at end */
44 uint8_t body
[DT_MAX_MSG_SIZE
-3];
47 SLIST_ENTRY(dt_msg
) slist
;
48 SIMPLEQ_ENTRY(dt_msg
) simpleq
;
52 #define DT_CTL(l, s, p) \
53 ((l & 0x1f) | ((s & 0x03) << 5) | ((p & 0x01) << 7))
54 #define DT_CTL_P(c) ((c >> 7) & 0x01)
55 #define DT_CTL_SUBADDR(c) ((c >> 5) & 0x03)
56 #define DT_CTL_LEN(c) (c & 0x1f)
59 struct device
*dtdv_dv
;
60 void (*dtdv_handler
)(void *, struct dt_msg
*);
64 volatile u_int
*ds_data
;
65 volatile u_int
*ds_poll
;
77 SLIST_HEAD(, dt_msg
) sc_free
;
78 SIMPLEQ_HEAD(, dt_msg
) sc_queue
;
81 struct dt_attach_args
{
85 #define DT_GET_ERROR -1
87 #define DT_GET_NOTYET 1
90 int dt_identify(int, struct dt_ident
*);
91 int dt_msg_get(struct dt_msg
*, int);
92 void dt_msg_dump(struct dt_msg
*);
93 int dt_establish_handler(struct dt_softc
*, struct dt_device
*,
94 struct device
*, void (*)(void *, struct dt_msg
*));
96 extern int dt_kbd_addr
;
97 extern struct dt_device dt_kbd_dv
;
98 extern int dt_ms_addr
;
99 extern struct dt_device dt_ms_dv
;
100 extern struct dt_state dt_state
;
102 #endif /* !_DTVAR_H_ */