2008-05-27 Robert Bragg <bob@o-hand.com>
[profile/ivi/psplash.git] / psplash.h
1 /* 
2  *  pslash - a lightweight framebuffer splashscreen for embedded devices. 
3  *
4  *  Copyright (c) 2006 Matthew Allum <mallum@o-hand.com>
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2, or (at your option)
9  *  any later version.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  */
17
18 #ifndef _HAVE_PSPLASH_H
19 #define _HAVE_PSPLASH_H
20
21 #define _GNU_SOURCE 1
22 #include <assert.h>
23 #include <errno.h>
24 #include <fcntl.h>
25 #include <limits.h>
26 #include <linux/fb.h>
27 #include <linux/kd.h>
28 #include <linux/vt.h>
29 #include <signal.h>
30 #include <stdarg.h>
31 #include <stdio.h>
32 #include <stdlib.h>
33 #include <string.h>
34 #if defined(__i386__) || defined(__alpha__)
35 #include <sys/io.h>
36 #endif
37 #include <sys/ioctl.h>
38 #include <sys/mman.h>
39 #include <sys/stat.h>
40 #include <sys/time.h>
41 #include <sys/types.h>
42 #include <termios.h>
43 #include <unistd.h>
44
45 typedef unsigned char  uint8;
46 typedef unsigned short uint16;
47 typedef int            bool;
48
49 #ifndef FALSE
50 #define FALSE 0
51 #endif
52
53 #ifndef TRUE
54 #define TRUE 1
55 #endif
56
57 #define PSPLASH_FIFO "psplash_fifo"
58
59 #define CLAMP(x, low, high) \
60    (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
61
62 #define DEBUG 0
63
64 #if DEBUG
65 #define DBG(x, a...) \
66    { printf ( __FILE__ ":%d,%s() " x "\n", __LINE__, __func__, ##a); }
67 #else
68 #define DBG(x, a...) do {} while (0)
69 #endif
70
71 typedef struct PSplashFont
72 {
73     char *name;                         /* Font name. */
74     int   height;                       /* Height in pixels. */
75     int   index_mask;                   /* ((1 << N) - 1). */
76     int  *offset;                       /* (1 << N) offsets into index. */
77     int  *index;
78     u_int32_t *content;
79 }
80 PSplashFont;
81
82
83 #include "psplash-fb.h"
84 #include "psplash-console.h"
85
86 #endif