142421Syokota/*-
242503Syokota * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
342503Syokota * All rights reserved.
442503Syokota *
542503Syokota * Redistribution and use in source and binary forms, with or without
642503Syokota * modification, are permitted provided that the following conditions
742503Syokota * are met:
842503Syokota * 1. Redistributions of source code must retain the above copyright
942503Syokota *    notice, this list of conditions and the following disclaimer as
1042503Syokota *    the first lines of this file unmodified.
1142503Syokota * 2. Redistributions in binary form must reproduce the above copyright
1242503Syokota *    notice, this list of conditions and the following disclaimer in the
1342503Syokota *    documentation and/or other materials provided with the distribution.
1442503Syokota *
1542503Syokota * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1642503Syokota * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1742503Syokota * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1842503Syokota * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1942503Syokota * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2042503Syokota * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2142503Syokota * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2242503Syokota * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2342503Syokota * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2442503Syokota * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2542503Syokota *
2650477Speter * $FreeBSD$
2742421Syokota */
2842421Syokota
2942421Syokota#ifndef _DEV_FB_SPLASHREG_H_
3042421Syokota#define _DEV_FB_SPLASHREG_H_
3142421Syokota
3242421Syokota#define SPLASH_IMAGE	"splash_image_data"
3342421Syokota
3442421Syokotastruct video_adapter;
3542421Syokota
3642503Syokotastruct image_decoder {
3742421Syokota	char		*name;
3842503Syokota	int		(*init)(struct video_adapter *adp);
3942421Syokota	int		(*term)(struct video_adapter *adp);
4042421Syokota	int		(*splash)(struct video_adapter *adp, int on);
4142503Syokota	char		*data_type;
4242503Syokota	void		*data;
4342503Syokota	size_t		data_size;
4442503Syokota};
4542421Syokota
4642503Syokotatypedef struct image_decoder	splash_decoder_t;
4742503Syokotatypedef struct image_decoder	scrn_saver_t;
4842503Syokota
4942421Syokota#define SPLASH_DECODER(name, sw)				\
5042421Syokota	static int name##_modevent(module_t mod, int type, void *data) \
5142421Syokota	{							\
5242421Syokota		switch ((modeventtype_t)type) {			\
5342421Syokota		case MOD_LOAD:					\
5442421Syokota			return splash_register(&sw);		\
5542421Syokota		case MOD_UNLOAD:				\
5642421Syokota			return splash_unregister(&sw);		\
5742503Syokota		default:					\
58132199Sphk			return EOPNOTSUPP;			\
5942503Syokota			break;					\
6042421Syokota		}						\
6142421Syokota		return 0;					\
6242421Syokota	}							\
6342421Syokota	static moduledata_t name##_mod = {			\
6442421Syokota		#name, 						\
6542421Syokota		name##_modevent,				\
6642421Syokota		NULL						\
6742421Syokota	};							\
6859754Speter	DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_ANY); \
6959754Speter	MODULE_DEPEND(name, splash, 1, 1, 1)
7042421Syokota
7142503Syokota#define SAVER_MODULE(name, sw)					\
7242503Syokota	static int name##_modevent(module_t mod, int type, void *data) \
7342503Syokota	{							\
7442503Syokota		switch ((modeventtype_t)type) {			\
7542503Syokota		case MOD_LOAD:					\
7642503Syokota			return splash_register(&sw);		\
7742503Syokota		case MOD_UNLOAD:				\
7842503Syokota			return splash_unregister(&sw);		\
7942503Syokota		default:					\
80132199Sphk			return EOPNOTSUPP;			\
8142503Syokota			break;					\
8242503Syokota		}						\
8342503Syokota		return 0;					\
8442503Syokota	}							\
8542503Syokota	static moduledata_t name##_mod = {			\
8642503Syokota		#name, 						\
8742503Syokota		name##_modevent,				\
8842503Syokota		NULL						\
8942503Syokota	};							\
9059754Speter	DECLARE_MODULE(name, name##_mod, SI_SUB_PSEUDO, SI_ORDER_MIDDLE); \
9159754Speter	MODULE_DEPEND(name, splash, 1, 1, 1)
9242503Syokota
9342421Syokota/* entry point for the splash image decoder */
9442421Syokotaint	splash_register(splash_decoder_t *decoder);
9542421Syokotaint	splash_unregister(splash_decoder_t *decoder);
9642421Syokota
9742421Syokota/* entry points for the console driver */
9848104Syokotaint	splash_init(video_adapter_t *adp, int (*callback)(int, void *),
9948104Syokota		    void *arg);
10042421Syokotaint	splash_term(video_adapter_t *adp);
10142421Syokotaint	splash(video_adapter_t *adp, int on);
10242421Syokota
10342421Syokota/* event types for the callback function */
10442421Syokota#define SPLASH_INIT	0
10542421Syokota#define SPLASH_TERM	1
10642421Syokota
10742421Syokota#endif /* _DEV_FB_SPLASHREG_H_ */
108