Fix the keyboard lockup problem. There were two big clues: The first was a
[dragonfly.git] / sys / dev / video / fb / splashreg.h
1 /*-
2  * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer as
10  *    the first lines of this file unmodified.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  *
26  * $FreeBSD: src/sys/dev/fb/splashreg.h,v 1.4 1999/08/28 00:41:41 peter Exp $
27  * $DragonFly: src/sys/dev/video/fb/splashreg.h,v 1.2 2003/06/17 04:28:25 dillon Exp $
28  */
29
30 #ifndef _DEV_FB_SPLASHREG_H_
31 #define _DEV_FB_SPLASHREG_H_
32
33 #define SPLASH_IMAGE    "splash_image_data"
34
35 struct video_adapter;
36
37 struct image_decoder {
38         char            *name;
39         int             (*init)(struct video_adapter *adp);
40         int             (*term)(struct video_adapter *adp);
41         int             (*splash)(struct video_adapter *adp, int on);
42         char            *data_type;
43         void            *data;
44         size_t          data_size;
45 };
46
47 typedef struct image_decoder    splash_decoder_t;
48 typedef struct image_decoder    scrn_saver_t;
49
50 #define SPLASH_DECODER(name, sw)                                \
51         static int name##_modevent(module_t mod, int type, void *data) \
52         {                                                       \
53                 switch ((modeventtype_t)type) {                 \
54                 case MOD_LOAD:                                  \
55                         return splash_register(&sw);            \
56                 case MOD_UNLOAD:                                \
57                         return splash_unregister(&sw);          \
58                 default:                                        \
59                         break;                                  \
60                 }                                               \
61                 return 0;                                       \
62         }                                                       \
63         static moduledata_t name##_mod = {                      \
64                 #name,                                          \
65                 name##_modevent,                                \
66                 NULL                                            \
67         };                                                      \
68         DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_ANY)
69
70 #define SAVER_MODULE(name, sw)                                  \
71         static int name##_modevent(module_t mod, int type, void *data) \
72         {                                                       \
73                 switch ((modeventtype_t)type) {                 \
74                 case MOD_LOAD:                                  \
75                         return splash_register(&sw);            \
76                 case MOD_UNLOAD:                                \
77                         return splash_unregister(&sw);          \
78                 default:                                        \
79                         break;                                  \
80                 }                                               \
81                 return 0;                                       \
82         }                                                       \
83         static moduledata_t name##_mod = {                      \
84                 #name,                                          \
85                 name##_modevent,                                \
86                 NULL                                            \
87         };                                                      \
88         DECLARE_MODULE(name, name##_mod, SI_SUB_PSEUDO, SI_ORDER_MIDDLE)
89
90 /* entry point for the splash image decoder */
91 int     splash_register(splash_decoder_t *decoder);
92 int     splash_unregister(splash_decoder_t *decoder);
93
94 /* entry points for the console driver */
95 int     splash_init(video_adapter_t *adp, int (*callback)(int, void *),
96                     void *arg);
97 int     splash_term(video_adapter_t *adp);
98 int     splash(video_adapter_t *adp, int on);
99
100 /* event types for the callback function */
101 #define SPLASH_INIT     0
102 #define SPLASH_TERM     1
103
104 #endif /* _DEV_FB_SPLASHREG_H_ */