xref: /netbsd-src/sys/arch/hpcmips/include/config_hook.h (revision 89c5a767f8fc7a4633b2d409966e2becbb98ff92)
1 /*	$NetBSD: config_hook.h,v 1.2 2000/03/13 01:52:00 sato Exp $	*/
2 
3 /*-
4  * Copyright (c) 1999
5  *         Shin Takemura and PocketBSD Project. All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. All advertising materials mentioning features or use of this software
16  *    must display the following acknowledgement:
17  *	This product includes software developed by the PocketBSD project
18  *	and its contributors.
19  * 4. Neither the name of the project nor the names of its contributors
20  *    may be used to endorse or promote products derived from this software
21  *    without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  *
35  */
36 
37 enum config_hook_mode {
38 	CONFIG_HOOK_SHARE,
39 	CONFIG_HOOK_REPLACE,
40 	CONFIG_HOOK_EXCLUSIVE,
41 };
42 
43 typedef void *config_hook_tag;
44 
45 void	config_hook_init __P((void));
46 config_hook_tag	config_hook __P((int type, long id, enum config_hook_mode mode,
47 				 int (*func) __P((void*, int, long, void*)),
48 				 void *ctx));
49 void	config_unhook __P((config_hook_tag));
50 int	config_hook_call __P((int type, long id, void *msg));
51 
52 /*
53  * hook types and IDs
54  */
55 #define CONFIG_HOOK_POWERCONTROL	0
56 #define CONFIG_HOOK_POWERCONTROL_COM0		0
57 #define CONFIG_HOOK_POWERCONTROL_COM1		1
58 #define CONFIG_HOOK_POWERCONTROL_COM2		2
59 #define CONFIG_HOOK_POWERCONTROL_COM3		3
60 #define CONFIG_HOOK_POWERCONTROL_LCDLIGHT	4
61 
62 #define CONFIG_HOOK_BUTTONEVENT		1
63 #define CONFIG_HOOK_BUTTONEVENT_POWER		0
64 #define CONFIG_HOOK_BUTTONEVENT_OK		1
65 #define CONFIG_HOOK_BUTTONEVENT_CANCEL		2
66 #define CONFIG_HOOK_BUTTONEVENT_UP		3
67 #define CONFIG_HOOK_BUTTONEVENT_DOWN		4
68 #define CONFIG_HOOK_BUTTONEVENT_REC		5
69 #define CONFIG_HOOK_BUTTONEVENT_COVER		6
70 #define CONFIG_HOOK_BUTTONEVENT_LIGHT		7
71 #define CONFIG_HOOK_BUTTONEVENT_CONTRAST	8
72 #define CONFIG_HOOK_BUTTONEVENT_APP0		9
73 #define CONFIG_HOOK_BUTTONEVENT_APP1		10
74 #define CONFIG_HOOK_BUTTONEVENT_APP2		11
75 #define CONFIG_HOOK_BUTTONEVENT_APP3		12
76 
77 #define CONFIG_HOOK_NTYPES 		2
78 
79 /*
80  * nicknames for including from configration file.
81  */
82 #ifdef CONFIG_HOOK_DEFINE_NICKNAME
83 #define PWCTL_COM0	CONFIG_HOOK_POWERCONTROL_COM0
84 #define PWCTL_COM1	CONFIG_HOOK_POWERCONTROL_COM1
85 #define PWCTL_COM2	CONFIG_HOOK_POWERCONTROL_COM2
86 #define PWCTL_COM3	CONFIG_HOOK_POWERCONTROL_COM3
87 #define PWCTL_LCDLIGHT	CONFIG_HOOK_POWERCONTROL_LCDLIGHT
88 #define BTN_POWER	CONFIG_HOOK_BUTTONEVENT_POWER
89 #define BTN_OK		CONFIG_HOOK_BUTTONEVENT_OK
90 #define BTN_CANCEL	CONFIG_HOOK_BUTTONEVENT_CANCEL
91 #define BTN_UP		CONFIG_HOOK_BUTTONEVENT_UP
92 #define BTN_DOWN	CONFIG_HOOK_BUTTONEVENT_DOWN
93 #define BTN_REC		CONFIG_HOOK_BUTTONEVENT_REC
94 #define BTN_COVER	CONFIG_HOOK_BUTTONEVENT_COVER
95 #define BTN_LIGHT	CONFIG_HOOK_BUTTONEVENT_LIGHT
96 #define BTN_CONTRAST	CONFIG_HOOK_BUTTONEVENT_CONTRAST
97 #define BTN_APP0	CONFIG_HOOK_BUTTONEVENT_APP0
98 #define BTN_APP1	CONFIG_HOOK_BUTTONEVENT_APP1
99 #define BTN_APP2	CONFIG_HOOK_BUTTONEVENT_APP2
100 #define BTN_APP3	CONFIG_HOOK_BUTTONEVENT_APP3
101 #endif /* CONFIG_HOOK_DEFINE_NICKNAME */
102