FreeBSD/Linux Kernel Cross Reference
sys/dev/fb/splashreg.h
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
5 * 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 as
12 * the first lines of this file unmodified.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * $FreeBSD: releng/12.0/sys/dev/fb/splashreg.h 326255 2017-11-27 14:52:40Z pfg $
29 */
30
31 #ifndef _DEV_FB_SPLASHREG_H_
32 #define _DEV_FB_SPLASHREG_H_
33
34 #define SPLASH_IMAGE "splash_image_data"
35
36 struct video_adapter;
37
38 struct image_decoder {
39 char *name;
40 int (*init)(struct video_adapter *adp);
41 int (*term)(struct video_adapter *adp);
42 int (*splash)(struct video_adapter *adp, int on);
43 char *data_type;
44 void *data;
45 size_t data_size;
46 };
47
48 typedef struct image_decoder splash_decoder_t;
49 typedef struct image_decoder scrn_saver_t;
50
51 #define SPLASH_DECODER(name, sw) \
52 static int name##_modevent(module_t mod, int type, void *data) \
53 { \
54 switch ((modeventtype_t)type) { \
55 case MOD_LOAD: \
56 return splash_register(&sw); \
57 case MOD_UNLOAD: \
58 return splash_unregister(&sw); \
59 default: \
60 return EOPNOTSUPP; \
61 break; \
62 } \
63 return 0; \
64 } \
65 static moduledata_t name##_mod = { \
66 #name, \
67 name##_modevent, \
68 NULL \
69 }; \
70 DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_ANY); \
71 MODULE_DEPEND(name, splash, 1, 1, 1)
72
73 #define SAVER_MODULE(name, sw) \
74 static int name##_modevent(module_t mod, int type, void *data) \
75 { \
76 switch ((modeventtype_t)type) { \
77 case MOD_LOAD: \
78 return splash_register(&sw); \
79 case MOD_UNLOAD: \
80 return splash_unregister(&sw); \
81 default: \
82 return EOPNOTSUPP; \
83 break; \
84 } \
85 return 0; \
86 } \
87 static moduledata_t name##_mod = { \
88 #name, \
89 name##_modevent, \
90 NULL \
91 }; \
92 DECLARE_MODULE(name, name##_mod, SI_SUB_PSEUDO, SI_ORDER_MIDDLE); \
93 MODULE_DEPEND(name, splash, 1, 1, 1)
94
95 /* entry point for the splash image decoder */
96 int splash_register(splash_decoder_t *decoder);
97 int splash_unregister(splash_decoder_t *decoder);
98
99 /* entry points for the console driver */
100 int splash_init(video_adapter_t *adp, int (*callback)(int, void *),
101 void *arg);
102 int splash_term(video_adapter_t *adp);
103 int splash(video_adapter_t *adp, int on);
104
105 /* event types for the callback function */
106 #define SPLASH_INIT 0
107 #define SPLASH_TERM 1
108
109 #endif /* _DEV_FB_SPLASHREG_H_ */
Cache object: c99ed049728b878ae2c9dad814160cc2
|