1 /* $NetBSD: config_hook.h,v 1.4 2000/07/02 10:01:31 takemura 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 #define CONFIG_HOOK_POWERCONTROL_LCD 5 62 63 #define CONFIG_HOOK_BUTTONEVENT 1 64 #define CONFIG_HOOK_BUTTONEVENT_POWER 0 65 #define CONFIG_HOOK_BUTTONEVENT_OK 1 66 #define CONFIG_HOOK_BUTTONEVENT_CANCEL 2 67 #define CONFIG_HOOK_BUTTONEVENT_UP 3 68 #define CONFIG_HOOK_BUTTONEVENT_DOWN 4 69 #define CONFIG_HOOK_BUTTONEVENT_REC 5 70 #define CONFIG_HOOK_BUTTONEVENT_COVER 6 71 #define CONFIG_HOOK_BUTTONEVENT_LIGHT 7 72 #define CONFIG_HOOK_BUTTONEVENT_CONTRAST 8 73 #define CONFIG_HOOK_BUTTONEVENT_APP0 9 74 #define CONFIG_HOOK_BUTTONEVENT_APP1 10 75 #define CONFIG_HOOK_BUTTONEVENT_APP2 11 76 #define CONFIG_HOOK_BUTTONEVENT_APP3 12 77 #define CONFIG_HOOK_BUTTONEVENT_LEFT 13 78 #define CONFIG_HOOK_BUTTONEVENT_RIGHT 14 79 #define CONFIG_HOOK_BUTTONEVENT_CONTRAST_UP 15 80 #define CONFIG_HOOK_BUTTONEVENT_CONTRAST_DOWN 16 81 #define CONFIG_HOOK_BUTTONEVENT_LIGHT_UP 17 82 #define CONFIG_HOOK_BUTTONEVENT_LIGHT_DOWN 18 83 84 #define CONFIG_HOOK_PMEVENT 2 85 #define CONFIG_HOOK_PMEVENT_STANDBYREQ 0 86 #define CONFIG_HOOK_PMEVENT_SUSPENDREQ 1 87 88 #define CONFIG_HOOK_NTYPES 3 89 90 /* 91 * nicknames for including from configration file. 92 */ 93 #ifdef CONFIG_HOOK_DEFINE_NICKNAME 94 #define PWCTL_COM0 CONFIG_HOOK_POWERCONTROL_COM0 95 #define PWCTL_COM1 CONFIG_HOOK_POWERCONTROL_COM1 96 #define PWCTL_COM2 CONFIG_HOOK_POWERCONTROL_COM2 97 #define PWCTL_COM3 CONFIG_HOOK_POWERCONTROL_COM3 98 #define PWCTL_LCDLIGHT CONFIG_HOOK_POWERCONTROL_LCDLIGHT 99 #define PWCTL_LCD CONFIG_HOOK_POWERCONTROL_LCD 100 #define BTN_POWER CONFIG_HOOK_BUTTONEVENT_POWER 101 #define BTN_OK CONFIG_HOOK_BUTTONEVENT_OK 102 #define BTN_CANCEL CONFIG_HOOK_BUTTONEVENT_CANCEL 103 #define BTN_UP CONFIG_HOOK_BUTTONEVENT_UP 104 #define BTN_DOWN CONFIG_HOOK_BUTTONEVENT_DOWN 105 #define BTN_REC CONFIG_HOOK_BUTTONEVENT_REC 106 #define BTN_COVER CONFIG_HOOK_BUTTONEVENT_COVER 107 #define BTN_LIGHT CONFIG_HOOK_BUTTONEVENT_LIGHT 108 #define BTN_CONTRAST CONFIG_HOOK_BUTTONEVENT_CONTRAST 109 #define BTN_APP0 CONFIG_HOOK_BUTTONEVENT_APP0 110 #define BTN_APP1 CONFIG_HOOK_BUTTONEVENT_APP1 111 #define BTN_APP2 CONFIG_HOOK_BUTTONEVENT_APP2 112 #define BTN_APP3 CONFIG_HOOK_BUTTONEVENT_APP3 113 #define BTN_LEFT CONFIG_HOOK_BUTTONEVENT_LEFT 114 #define BTN_RIGHT CONFIG_HOOK_BUTTONEVENT_RIGHT 115 #define BTN_CONTRAST_UP CONFIG_HOOK_BUTTONEVENT_CONTRAST_UP 116 #define BTN_CONTRAST_DN CONFIG_HOOK_BUTTONEVENT_CONTRAST_DOWN 117 #define BTN_LIGHT_UP CONFIG_HOOK_BUTTONEVENT_LIGHT_UP 118 #define BTN_LIGHT_DN CONFIG_HOOK_BUTTONEVENT_LIGHT_DOWN 119 #endif /* CONFIG_HOOK_DEFINE_NICKNAME */ 120