config_hook.h revision 1.6 1 /* $NetBSD: config_hook.h,v 1.6 2000/09/10 15:45:47 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 #ifndef _CONFIG_HOOK_H_
38 #define _CONFIG_HOOK_H_
39
40 enum config_hook_mode {
41 CONFIG_HOOK_SHARE,
42 CONFIG_HOOK_REPLACE,
43 CONFIG_HOOK_EXCLUSIVE,
44 };
45
46 typedef void *config_hook_tag;
47
48 void config_hook_init __P((void));
49 config_hook_tag config_hook __P((int type, long id, enum config_hook_mode mode,
50 int (*func) __P((void*, int, long, void*)),
51 void *ctx));
52 void config_unhook __P((config_hook_tag));
53 int config_hook_call __P((int type, long id, void *msg));
54
55 /*
56 * hook types and IDs
57 */
58 #define CONFIG_HOOK_POWERCONTROL 0
59 #define CONFIG_HOOK_POWERCONTROL_COM0 0
60 #define CONFIG_HOOK_POWERCONTROL_COM1 1
61 #define CONFIG_HOOK_POWERCONTROL_COM2 2
62 #define CONFIG_HOOK_POWERCONTROL_COM3 3
63 #define CONFIG_HOOK_POWERCONTROL_LCDLIGHT 4
64 #define CONFIG_HOOK_POWERCONTROL_LCD 5
65 #define CONFIG_HOOK_POWERCONTROL_SPEAKER 6
66
67 #define CONFIG_HOOK_BUTTONEVENT 1
68 #define CONFIG_HOOK_BUTTONEVENT_POWER 0
69 #define CONFIG_HOOK_BUTTONEVENT_OK 1
70 #define CONFIG_HOOK_BUTTONEVENT_CANCEL 2
71 #define CONFIG_HOOK_BUTTONEVENT_UP 3
72 #define CONFIG_HOOK_BUTTONEVENT_DOWN 4
73 #define CONFIG_HOOK_BUTTONEVENT_REC 5
74 #define CONFIG_HOOK_BUTTONEVENT_COVER 6
75 #define CONFIG_HOOK_BUTTONEVENT_LIGHT 7
76 #define CONFIG_HOOK_BUTTONEVENT_CONTRAST 8
77 #define CONFIG_HOOK_BUTTONEVENT_APP0 9
78 #define CONFIG_HOOK_BUTTONEVENT_APP1 10
79 #define CONFIG_HOOK_BUTTONEVENT_APP2 11
80 #define CONFIG_HOOK_BUTTONEVENT_APP3 12
81 #define CONFIG_HOOK_BUTTONEVENT_LEFT 13
82 #define CONFIG_HOOK_BUTTONEVENT_RIGHT 14
83 #define CONFIG_HOOK_BUTTONEVENT_CONTRAST_UP 15
84 #define CONFIG_HOOK_BUTTONEVENT_CONTRAST_DOWN 16
85 #define CONFIG_HOOK_BUTTONEVENT_LIGHT_UP 17
86 #define CONFIG_HOOK_BUTTONEVENT_LIGHT_DOWN 18
87
88 #define CONFIG_HOOK_PMEVENT 2
89 #define CONFIG_HOOK_PMEVENT_STANDBYREQ 0
90 #define CONFIG_HOOK_PMEVENT_SUSPENDREQ 1
91 #define CONFIG_HOOK_PMEVENT_HARDPOWER 2
92
93 #define CONFIG_HOOK_NTYPES 3
94
95 /*
96 * nicknames for including from configration file.
97 */
98 #ifdef CONFIG_HOOK_DEFINE_NICKNAME
99 #define PWCTL_COM0 CONFIG_HOOK_POWERCONTROL_COM0
100 #define PWCTL_COM1 CONFIG_HOOK_POWERCONTROL_COM1
101 #define PWCTL_COM2 CONFIG_HOOK_POWERCONTROL_COM2
102 #define PWCTL_COM3 CONFIG_HOOK_POWERCONTROL_COM3
103 #define PWCTL_LCDLIGHT CONFIG_HOOK_POWERCONTROL_LCDLIGHT
104 #define PWCTL_LCD CONFIG_HOOK_POWERCONTROL_LCD
105 #define PWCTL_SPEAKER CONFIG_HOOK_POWERCONTROL_SPEAKER
106 #define BTN_POWER CONFIG_HOOK_BUTTONEVENT_POWER
107 #define BTN_OK CONFIG_HOOK_BUTTONEVENT_OK
108 #define BTN_CANCEL CONFIG_HOOK_BUTTONEVENT_CANCEL
109 #define BTN_UP CONFIG_HOOK_BUTTONEVENT_UP
110 #define BTN_DOWN CONFIG_HOOK_BUTTONEVENT_DOWN
111 #define BTN_REC CONFIG_HOOK_BUTTONEVENT_REC
112 #define BTN_COVER CONFIG_HOOK_BUTTONEVENT_COVER
113 #define BTN_LIGHT CONFIG_HOOK_BUTTONEVENT_LIGHT
114 #define BTN_CONTRAST CONFIG_HOOK_BUTTONEVENT_CONTRAST
115 #define BTN_APP0 CONFIG_HOOK_BUTTONEVENT_APP0
116 #define BTN_APP1 CONFIG_HOOK_BUTTONEVENT_APP1
117 #define BTN_APP2 CONFIG_HOOK_BUTTONEVENT_APP2
118 #define BTN_APP3 CONFIG_HOOK_BUTTONEVENT_APP3
119 #define BTN_LEFT CONFIG_HOOK_BUTTONEVENT_LEFT
120 #define BTN_RIGHT CONFIG_HOOK_BUTTONEVENT_RIGHT
121 #define BTN_CONTRAST_UP CONFIG_HOOK_BUTTONEVENT_CONTRAST_UP
122 #define BTN_CONTRAST_DN CONFIG_HOOK_BUTTONEVENT_CONTRAST_DOWN
123 #define BTN_LIGHT_UP CONFIG_HOOK_BUTTONEVENT_LIGHT_UP
124 #define BTN_LIGHT_DN CONFIG_HOOK_BUTTONEVENT_LIGHT_DOWN
125 #endif /* CONFIG_HOOK_DEFINE_NICKNAME */
126
127 #endif /* _CONFIG_HOOK_H_ */
128