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 --- 21 unchanged lines hidden (view full) --- 30 31#if NSPLASH > 0 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/kernel.h> 36#include <sys/malloc.h> 37#include <sys/linker.h> |
38#include <sys/fbio.h> |
39 |
40#include <dev/fb/fbreg.h> 41#include <dev/fb/splashreg.h> 42 43/* video adapter and image decoder */ 44static video_adapter_t *splash_adp; 45static splash_decoder_t *splash_decoder; 46 47/* decoder candidates */ 48static int decoders; 49static splash_decoder_t **decoder_set; 50#define DECODER_ARRAY_DELTA 4 51 52/* console driver callback */ |
53static int (*splash_callback)(int, void *); 54static void *splash_arg; |
55 56static int 57splash_find_data(splash_decoder_t *decoder) 58{ 59 caddr_t image_module; 60 caddr_t p; 61 62 if (decoder->data_type == NULL) --- 30 unchanged lines hidden (view full) --- 93 return 0; 94} 95 96static void 97splash_new(splash_decoder_t *decoder) 98{ 99 splash_decoder = decoder; 100 if (splash_callback != NULL) |
101 (*splash_callback)(SPLASH_INIT, splash_arg); |
102} 103 104int 105splash_register(splash_decoder_t *decoder) 106{ 107 splash_decoder_t **p; 108 int error; 109 int i; --- 44 unchanged lines hidden (view full) --- 154 if (splash_decoder == decoder) { 155 if ((error = splash_term(splash_adp)) != 0) 156 return error; 157 } 158 return 0; 159} 160 161int |
162splash_init(video_adapter_t *adp, int (*callback)(int, void *), void *arg) |
163{ 164 int i; 165 166 splash_adp = adp; 167 splash_callback = callback; |
168 splash_arg = arg; |
169 170 splash_decoder = NULL; 171 for (i = 0; i < decoders; ++i) { 172 if (decoder_set[i] == NULL) 173 continue; 174 if (splash_test(decoder_set[i]) == 0) { 175 splash_new(decoder_set[i]); 176 break; --- 6 unchanged lines hidden (view full) --- 183 return 0; 184} 185 186int 187splash_term(video_adapter_t *adp) 188{ 189 int error = 0; 190 |
191 if (splash_adp != adp) 192 return EINVAL; |
193 if (splash_decoder != NULL) { 194 if (splash_callback != NULL) |
195 error = (*splash_callback)(SPLASH_TERM, splash_arg); |
196 if (error == 0) 197 error = (*splash_decoder->term)(adp); 198 if (error == 0) 199 splash_decoder = NULL; 200 } 201 return error; 202} 203 204int 205splash(video_adapter_t *adp, int on) 206{ 207 if (splash_decoder != NULL) 208 return (*splash_decoder->splash)(adp, on); 209 return ENODEV; 210} 211 212#endif /* NSPLASH > 0 */ |