Home | History | Annotate | Line # | Download | only in include
config_hook.h revision 1.7
      1 /*	$NetBSD: config_hook.h,v 1.7 2000/10/03 03:08:33 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 #define CONFIG_HOOK_POWERCONTROL_LED		7
     67 
     68 #define CONFIG_HOOK_BUTTONEVENT		1
     69 #define CONFIG_HOOK_BUTTONEVENT_POWER		0
     70 #define CONFIG_HOOK_BUTTONEVENT_OK		1
     71 #define CONFIG_HOOK_BUTTONEVENT_CANCEL		2
     72 #define CONFIG_HOOK_BUTTONEVENT_UP		3
     73 #define CONFIG_HOOK_BUTTONEVENT_DOWN		4
     74 #define CONFIG_HOOK_BUTTONEVENT_REC		5
     75 #define CONFIG_HOOK_BUTTONEVENT_COVER		6
     76 #define CONFIG_HOOK_BUTTONEVENT_LIGHT		7
     77 #define CONFIG_HOOK_BUTTONEVENT_CONTRAST	8
     78 #define CONFIG_HOOK_BUTTONEVENT_APP0		9
     79 #define CONFIG_HOOK_BUTTONEVENT_APP1		10
     80 #define CONFIG_HOOK_BUTTONEVENT_APP2		11
     81 #define CONFIG_HOOK_BUTTONEVENT_APP3		12
     82 #define CONFIG_HOOK_BUTTONEVENT_LEFT		13
     83 #define CONFIG_HOOK_BUTTONEVENT_RIGHT		14
     84 #define CONFIG_HOOK_BUTTONEVENT_CONTRAST_UP	15
     85 #define CONFIG_HOOK_BUTTONEVENT_CONTRAST_DOWN	16
     86 #define CONFIG_HOOK_BUTTONEVENT_LIGHT_UP	17
     87 #define CONFIG_HOOK_BUTTONEVENT_LIGHT_DOWN	18
     88 
     89 #define CONFIG_HOOK_PMEVENT		2
     90 #define CONFIG_HOOK_PMEVENT_STANDBYREQ		0
     91 #define CONFIG_HOOK_PMEVENT_SUSPENDREQ		1
     92 #define CONFIG_HOOK_PMEVENT_HARDPOWER		2
     93 #define CONFIG_HOOK_PMEVENT_BATTERY		3
     94 #define CONFIG_HOOK_PMEVENT_AC			4
     95 
     96 #define CONFIG_HOOK_NTYPES 		3
     97 
     98 /*
     99  * nicknames for including from configration file.
    100  */
    101 #ifdef CONFIG_HOOK_DEFINE_NICKNAME
    102 #define PWCTL_COM0	CONFIG_HOOK_POWERCONTROL_COM0
    103 #define PWCTL_COM1	CONFIG_HOOK_POWERCONTROL_COM1
    104 #define PWCTL_COM2	CONFIG_HOOK_POWERCONTROL_COM2
    105 #define PWCTL_COM3	CONFIG_HOOK_POWERCONTROL_COM3
    106 #define PWCTL_LCDLIGHT	CONFIG_HOOK_POWERCONTROL_LCDLIGHT
    107 #define PWCTL_LCD	CONFIG_HOOK_POWERCONTROL_LCD
    108 #define PWCTL_SPEAKER	CONFIG_HOOK_POWERCONTROL_SPEAKER
    109 #define PWCTL_LED	CONFIG_HOOK_POWERCONTROL_LED
    110 #define BTN_POWER	CONFIG_HOOK_BUTTONEVENT_POWER
    111 #define BTN_OK		CONFIG_HOOK_BUTTONEVENT_OK
    112 #define BTN_CANCEL	CONFIG_HOOK_BUTTONEVENT_CANCEL
    113 #define BTN_UP		CONFIG_HOOK_BUTTONEVENT_UP
    114 #define BTN_DOWN	CONFIG_HOOK_BUTTONEVENT_DOWN
    115 #define BTN_REC		CONFIG_HOOK_BUTTONEVENT_REC
    116 #define BTN_COVER	CONFIG_HOOK_BUTTONEVENT_COVER
    117 #define BTN_LIGHT	CONFIG_HOOK_BUTTONEVENT_LIGHT
    118 #define BTN_CONTRAST	CONFIG_HOOK_BUTTONEVENT_CONTRAST
    119 #define BTN_APP0	CONFIG_HOOK_BUTTONEVENT_APP0
    120 #define BTN_APP1	CONFIG_HOOK_BUTTONEVENT_APP1
    121 #define BTN_APP2	CONFIG_HOOK_BUTTONEVENT_APP2
    122 #define BTN_APP3	CONFIG_HOOK_BUTTONEVENT_APP3
    123 #define BTN_LEFT	CONFIG_HOOK_BUTTONEVENT_LEFT
    124 #define BTN_RIGHT	CONFIG_HOOK_BUTTONEVENT_RIGHT
    125 #define BTN_CONTRAST_UP	CONFIG_HOOK_BUTTONEVENT_CONTRAST_UP
    126 #define BTN_CONTRAST_DN	CONFIG_HOOK_BUTTONEVENT_CONTRAST_DOWN
    127 #define BTN_LIGHT_UP	CONFIG_HOOK_BUTTONEVENT_LIGHT_UP
    128 #define BTN_LIGHT_DN	CONFIG_HOOK_BUTTONEVENT_LIGHT_DOWN
    129 #endif /* CONFIG_HOOK_DEFINE_NICKNAME */
    130 
    131 /*
    132  * POWERCONTROL value
    133  */
    134 #define PWCTL_ON	((void *)1)
    135 #define PWCTL_OFF	((void *)0)
    136 
    137 /*
    138  * POWERCTONROL_LED value
    139  */
    140 #define PWCTL_LED_OFF		PWCTL_OFF
    141 #define PWCTL_LED_ON		PWCTL_ON
    142 #define PWCTL_LED_FLASH		((void *)2)	/* flash 100msec */
    143 #define PWCTL_LED_FLASH2	((void *)3)	/* flash 200msec */
    144 #define PWCTL_LED_FLASH5	((void *)4)	/* flash 500msec */
    145 #define PWCTL_LED_BLINK		((void *)5)	/* blink 1sec interval */
    146 #define PWCTL_LED_BLINK2	((void *)6)	/* blink 2sec interval */
    147 
    148 /*
    149  * PMEVENT_AC event value
    150  */
    151 #define PMEVENT_AC_OFF		((void *)0)
    152 #define PMEVENT_AC_ON_CHARGE	((void *)1)
    153 #define PMEVENT_AC_ON_NOCHARGE	((void *)2)
    154 
    155 /*
    156  * PMEVENT_BATTERY event value
    157  */
    158 #define PMEVENT_BATT_CRITICAL	((void *)0)
    159 #define PMEVENT_BATT_LOW	((void *)1)
    160 #define PMEVENT_BATT_1BY4	((void *)2)
    161 #define PMEVENT_BATT_HALF	((void *)3)
    162 #define PMEVENT_BATT_3BY4	((void *)4)
    163 #define PMEVENT_BATT_FULL	((void *)5)
    164 #endif /* _CONFIG_HOOK_H_ */
    165