xref: /netbsd-src/sys/dev/hpc/hpckbdvar.h (revision ce099b40997c43048fb78bd578195f81d2456523)
1*ce099b40Smartin /*	$NetBSD: hpckbdvar.h,v 1.2 2008/04/28 20:23:48 martin Exp $ */
2659f65e0Such 
3659f65e0Such /*-
4659f65e0Such  * Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
5659f65e0Such  * All rights reserved.
6659f65e0Such  *
7659f65e0Such  * This code is derived from software contributed to The NetBSD Foundation
8659f65e0Such  * by UCHIYAMA Yasushi.
9659f65e0Such  *
10659f65e0Such  * Redistribution and use in source and binary forms, with or without
11659f65e0Such  * modification, are permitted provided that the following conditions
12659f65e0Such  * are met:
13659f65e0Such  * 1. Redistributions of source code must retain the above copyright
14659f65e0Such  *    notice, this list of conditions and the following disclaimer.
15659f65e0Such  * 2. Redistributions in binary form must reproduce the above copyright
16659f65e0Such  *    notice, this list of conditions and the following disclaimer in the
17659f65e0Such  *    documentation and/or other materials provided with the distribution.
18659f65e0Such  *
19659f65e0Such  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20659f65e0Such  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21659f65e0Such  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22659f65e0Such  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23659f65e0Such  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24659f65e0Such  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25659f65e0Such  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26659f65e0Such  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27659f65e0Such  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28659f65e0Such  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29659f65e0Such  * POSSIBILITY OF SUCH DAMAGE.
30659f65e0Such  */
31659f65e0Such 
32659f65e0Such /*
33659f65e0Such  * chip interface
34659f65e0Such  */
35659f65e0Such struct hpckbd_if;
36659f65e0Such struct hpckbd_ic_if {
37659f65e0Such 	void	*hii_ctx;
38659f65e0Such 	int	(*hii_establish)(void *, struct hpckbd_if *);
39659f65e0Such 	int	(*hii_poll)(void *);
40659f65e0Such };
41659f65e0Such 
42659f65e0Such #define hpckbd_ic_establish(ic, kbdif)					\
43659f65e0Such 	(*(ic)->hii_establish)((ic)->hii_ctx, (kbdif))
44659f65e0Such #define hpckbd_ic_poll(ic)						\
45659f65e0Such 	(*(ic)->hii_poll)((ic)->hii_ctx)
46659f65e0Such 
47659f65e0Such /*
48659f65e0Such  * hpckbd interface
49659f65e0Such  */
50659f65e0Such struct hpckbd_if {
51659f65e0Such 	void	*hi_ctx;
52659f65e0Such 	void	(*hi_input_hook)(void *);
53659f65e0Such 	int	(*hi_input)(void *, int, int);
54659f65e0Such };
55659f65e0Such 
56659f65e0Such #define hpckbd_input_hook(i)						\
57659f65e0Such 	(*(i)->hi_input_hook)((i)->hi_ctx)
58659f65e0Such #define hpckbd_input(i, f, a)						\
59659f65e0Such 	(*(i)->hi_input)((i)->hi_ctx, (f), (a))
60659f65e0Such 
61659f65e0Such struct hpckbd_attach_args {
62659f65e0Such 	struct hpckbd_ic_if *haa_ic;
63659f65e0Such };
64659f65e0Such 
65659f65e0Such int	hpckbd_print(void *, const char *);
66659f65e0Such int	hpckbd_cnattach(struct hpckbd_ic_if *);
67