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