1 | /* |
---|
2 | ///////////////////////////////////////////////////////////////////////////// |
---|
3 | // $Header$ |
---|
4 | // |
---|
5 | // Copyright (c) 2000 - Rosimildo da Silva |
---|
6 | // |
---|
7 | // MODULE DESCRIPTION: |
---|
8 | // Micro FrameBuffer interface for Embedded Systems. |
---|
9 | // |
---|
10 | // MODIFICATION/HISTORY: |
---|
11 | // |
---|
12 | // $Log$ |
---|
13 | // |
---|
14 | ///////////////////////////////////////////////////////////////////////////// |
---|
15 | */ |
---|
16 | #ifndef _MW_FB_H |
---|
17 | #define _MW_FB_H |
---|
18 | |
---|
19 | #ifdef __cplusplus |
---|
20 | extern "C" { |
---|
21 | #endif |
---|
22 | |
---|
23 | /* ioctls |
---|
24 | 0x46 is 'F' */ |
---|
25 | #define FB_SCREENINFO 0x4601 |
---|
26 | #define FB_GETPALETTE 0x4602 |
---|
27 | #define FB_SETPALETTE 0x4603 |
---|
28 | #define FB_EXEC_FUNCTION 0x4604 |
---|
29 | |
---|
30 | |
---|
31 | #define FB_TYPE_PACKED_PIXELS 0 /* Packed Pixels */ |
---|
32 | #define FB_TYPE_PLANES 1 /* Non interleaved planes */ |
---|
33 | #define FB_TYPE_INTERLEAVED_PLANES 2 /* Interleaved planes */ |
---|
34 | #define FB_TYPE_TEXT 3 /* Text/attributes */ |
---|
35 | #define FB_TYPE_VGA_PLANES 4 /* EGA/VGA planes */ |
---|
36 | #define FB_TYPE_VIRTUAL_BUFFER 5 /* Virtual Buffer */ |
---|
37 | |
---|
38 | |
---|
39 | #define FB_VISUAL_MONO01 0 /* Monochr. 1=Black 0=White */ |
---|
40 | #define FB_VISUAL_MONO10 1 /* Monochr. 1=White 0=Black */ |
---|
41 | #define FB_VISUAL_TRUECOLOR 2 /* True color */ |
---|
42 | #define FB_VISUAL_PSEUDOCOLOR 3 /* Pseudo color (like atari) */ |
---|
43 | #define FB_VISUAL_DIRECTCOLOR 4 /* Direct color */ |
---|
44 | #define FB_VISUAL_STATIC_PSEUDOCOLOR 5 /* Pseudo color readonly */ |
---|
45 | |
---|
46 | #define FB_ACCEL_NONE 0 /* no hardware accelerator */ |
---|
47 | |
---|
48 | /* no dependency on any other header file */ |
---|
49 | typedef unsigned long __u32; |
---|
50 | typedef unsigned short __u16; |
---|
51 | |
---|
52 | struct fb_screeninfo { |
---|
53 | __u32 xres; /* visible resolution */ |
---|
54 | __u32 yres; |
---|
55 | __u32 bits_per_pixel; /* guess what */ |
---|
56 | __u32 line_length; /* number of chars per line */ |
---|
57 | volatile char *smem_start; /* Start of frame buffer mem */ |
---|
58 | /* (physical address) */ |
---|
59 | __u32 smem_len; /* Length of frame buffer mem */ |
---|
60 | __u32 type; /* see FB_TYPE_* */ |
---|
61 | __u32 visual; /* see FB_VISUAL_* */ |
---|
62 | |
---|
63 | }; |
---|
64 | |
---|
65 | struct fb_cmap { |
---|
66 | __u32 start; /* First entry */ |
---|
67 | __u32 len; /* Number of entries */ |
---|
68 | __u16 *red; /* Red values */ |
---|
69 | __u16 *green; |
---|
70 | __u16 *blue; |
---|
71 | __u16 *transp; /* transparency, can be NULL */ |
---|
72 | }; |
---|
73 | |
---|
74 | /* type of function to be executed at the driver level */ |
---|
75 | #define FB_FUNC_ENTER_GRAPHICS 0 |
---|
76 | #define FB_FUNC_EXIT_GRAPHICS 1 |
---|
77 | #define FB_FUNC_IS_DIRTY 2 |
---|
78 | #define FB_FUNC_GET_MODE 3 |
---|
79 | |
---|
80 | struct fb_exec_function |
---|
81 | { |
---|
82 | int func_no; |
---|
83 | void *param; |
---|
84 | }; |
---|
85 | |
---|
86 | |
---|
87 | /* Micro Framebuffer API Wrapper */ |
---|
88 | |
---|
89 | /* |
---|
90 | * This function returns the information regarding the display. |
---|
91 | * It is called just after the driver be opened to get all needed |
---|
92 | * information about the driver. No change in the mode of operation |
---|
93 | * of the driver is done with this call. |
---|
94 | */ |
---|
95 | extern int ufb_get_screen_info( int fd, struct fb_screeninfo *info ); |
---|
96 | |
---|
97 | |
---|
98 | /* |
---|
99 | * Returns the mode of the graphics subsystem |
---|
100 | */ |
---|
101 | extern int ufb_get_mode( int fd, int *mode ); |
---|
102 | |
---|
103 | |
---|
104 | /* |
---|
105 | * Returns the current collor pallete |
---|
106 | */ |
---|
107 | extern int ufb_get_palette( int fd, struct fb_cmap *color ); |
---|
108 | |
---|
109 | /* |
---|
110 | * Set the current collor pallete |
---|
111 | */ |
---|
112 | extern int ufb_set_palette( int fd, struct fb_cmap *color ); |
---|
113 | |
---|
114 | /* |
---|
115 | * Does all necessary initialization to put the device in |
---|
116 | * graphics mode |
---|
117 | */ |
---|
118 | extern int ufb_enter_graphics( int fd, int mode ); |
---|
119 | |
---|
120 | |
---|
121 | /* |
---|
122 | * Switch the device back to the default mode of operation. |
---|
123 | * In most cases it put the device back to plain text mode. |
---|
124 | */ |
---|
125 | extern int ufb_exit_graphics( int fd ); |
---|
126 | |
---|
127 | |
---|
128 | /* |
---|
129 | * Tell the driver that the "virtual buffer" is dirty, and an update |
---|
130 | * of it to the real device, maybe a serial/parallel LCD or whatever |
---|
131 | * is required |
---|
132 | */ |
---|
133 | extern int ufb_buffer_is_dirty( int fd ); |
---|
134 | |
---|
135 | |
---|
136 | /* |
---|
137 | * This function maps the physical ( kernel mode ) address of the framebuffer device |
---|
138 | * and maps it to the user space address. |
---|
139 | */ |
---|
140 | int ufb_mmap_to_user_space( int fd, void **fb_addr, void *physical_addr, unsigned long size ); |
---|
141 | |
---|
142 | |
---|
143 | |
---|
144 | /* |
---|
145 | * This function unmaps memory of the FB from the user's space |
---|
146 | */ |
---|
147 | int ufb_unmmap_from_user_space( int fd, void *addr ); |
---|
148 | |
---|
149 | #ifdef __cplusplus |
---|
150 | } |
---|
151 | #endif |
---|
152 | |
---|
153 | #endif /* _MW_FB_H */ |
---|