1 |
786 |
skrzyp |
#ifndef CYGONCE_IO_FRAMEBUF_H
|
2 |
|
|
#define CYGONCE_IO_FRAMEBUF_H
|
3 |
|
|
|
4 |
|
|
//=============================================================================
|
5 |
|
|
//
|
6 |
|
|
// framebuf.h
|
7 |
|
|
//
|
8 |
|
|
// Generic API for accessing framebuffers
|
9 |
|
|
//
|
10 |
|
|
//=============================================================================
|
11 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
12 |
|
|
// -------------------------------------------
|
13 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
14 |
|
|
// Copyright (C) 2008 Free Software Foundation, Inc.
|
15 |
|
|
//
|
16 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
17 |
|
|
// the terms of the GNU General Public License as published by the Free
|
18 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
19 |
|
|
// version.
|
20 |
|
|
//
|
21 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
22 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
23 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
24 |
|
|
// for more details.
|
25 |
|
|
//
|
26 |
|
|
// You should have received a copy of the GNU General Public License
|
27 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
28 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
29 |
|
|
//
|
30 |
|
|
// As a special exception, if other files instantiate templates or use
|
31 |
|
|
// macros or inline functions from this file, or you compile this file
|
32 |
|
|
// and link it with other works to produce a work based on this file,
|
33 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
34 |
|
|
// the GNU General Public License. However the source code for this file
|
35 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
36 |
|
|
// General Public License v2.
|
37 |
|
|
//
|
38 |
|
|
// This exception does not invalidate any other reasons why a work based
|
39 |
|
|
// on this file might be covered by the GNU General Public License.
|
40 |
|
|
// -------------------------------------------
|
41 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
42 |
|
|
//=============================================================================
|
43 |
|
|
//####DESCRIPTIONBEGIN####
|
44 |
|
|
//
|
45 |
|
|
// Author(s): bartv
|
46 |
|
|
// Date: 2005-03-29
|
47 |
|
|
//####DESCRIPTIONEND####
|
48 |
|
|
//=============================================================================
|
49 |
|
|
|
50 |
|
|
#include <pkgconf/infra.h>
|
51 |
|
|
#include <pkgconf/io_framebuf.h>
|
52 |
|
|
#include <cyg/infra/cyg_type.h>
|
53 |
|
|
|
54 |
|
|
#ifdef __cplusplus
|
55 |
|
|
extern "C" {
|
56 |
|
|
#endif
|
57 |
|
|
|
58 |
|
|
// ----------------------------------------------------------------------------
|
59 |
|
|
// The colour data type. For now this is a cyg_ucount32. On 16-bit targets
|
60 |
|
|
// where the display depth is less than 32bpp a cyg_ucount16 would suffice
|
61 |
|
|
// and be more efficient. A separate cyg_fb_colour type is used to allow this
|
62 |
|
|
// change to be made in future.
|
63 |
|
|
typedef cyg_ucount32 cyg_fb_colour;
|
64 |
|
|
typedef cyg_fb_colour cyg_fb_color;
|
65 |
|
|
|
66 |
|
|
// ----------------------------------------------------------------------------
|
67 |
|
|
// Each framebuffer device exports one of these structures
|
68 |
|
|
typedef struct cyg_fb {
|
69 |
|
|
#ifdef CYGPKG_INFRA_DEBUG
|
70 |
|
|
cyg_ucount32 fb_magic;
|
71 |
|
|
#endif
|
72 |
|
|
cyg_ucount16 fb_depth; // 1, 2, 4, 8, 16, or 32 bits per pixel
|
73 |
|
|
cyg_ucount16 fb_format; // detailed format, e.g. 8-bit paletted, or 32-bit 0888
|
74 |
|
|
cyg_ucount16 fb_width; // of the framebuffer, not the viewport
|
75 |
|
|
cyg_ucount16 fb_height;
|
76 |
|
|
#ifdef CYGHWR_IO_FRAMEBUF_FUNCTIONALITY_VIEWPORT
|
77 |
|
|
cyg_ucount16 fb_viewport_width;
|
78 |
|
|
cyg_ucount16 fb_viewport_height;
|
79 |
|
|
#endif
|
80 |
|
|
void* fb_base; // Base address of the framebuffer, or 0 if not directly accessible
|
81 |
|
|
cyg_ucount16 fb_stride; // number of bytes per line
|
82 |
|
|
cyg_uint32 fb_flags0;
|
83 |
|
|
cyg_uint32 fb_flags1;
|
84 |
|
|
cyg_uint32 fb_flags2;
|
85 |
|
|
cyg_uint32 fb_flags3;
|
86 |
|
|
|
87 |
|
|
CYG_ADDRWORD fb_driver0; // Driver private fields
|
88 |
|
|
CYG_ADDRWORD fb_driver1;
|
89 |
|
|
CYG_ADDRWORD fb_driver2;
|
90 |
|
|
CYG_ADDRWORD fb_driver3;
|
91 |
|
|
|
92 |
|
|
int (*fb_on_fn)(struct cyg_fb*);
|
93 |
|
|
int (*fb_off_fn)(struct cyg_fb*);
|
94 |
|
|
int (*fb_ioctl_fn)( struct cyg_fb*, cyg_ucount16, void*, size_t*);
|
95 |
|
|
#ifdef CYGHWR_IO_FRAMEBUF_FUNCTIONALITY_DOUBLE_BUFFER
|
96 |
|
|
void (*fb_synch_fn)( struct cyg_fb*, cyg_ucount16);
|
97 |
|
|
#endif
|
98 |
|
|
#ifdef CYGHWR_IO_FRAMEBUF_FUNCTIONALITY_PALETTE
|
99 |
|
|
void (*fb_read_palette_fn)(struct cyg_fb*, cyg_ucount32, cyg_ucount32, void*);
|
100 |
|
|
#endif
|
101 |
|
|
#ifdef CYGHWR_IO_FRAMEBUF_FUNCTIONALITY_WRITEABLE_PALETTE
|
102 |
|
|
void (*fb_write_palette_fn)(struct cyg_fb*, cyg_ucount32, cyg_ucount32, const void*, cyg_ucount16);
|
103 |
|
|
#endif
|
104 |
|
|
#ifdef CYGHWR_IO_FRAMEBUF_FUNCTIONALITY_TRUE_COLOUR
|
105 |
|
|
cyg_fb_colour (*fb_make_colour_fn)(struct cyg_fb*, cyg_ucount8, cyg_ucount8, cyg_ucount8);
|
106 |
|
|
void (*fb_break_colour_fn)(struct cyg_fb*, cyg_fb_colour, cyg_ucount8*, cyg_ucount8*, cyg_ucount8*);
|
107 |
|
|
#endif
|
108 |
|
|
|
109 |
|
|
void (*fb_write_pixel_fn)(struct cyg_fb*, cyg_ucount16, cyg_ucount16, cyg_fb_colour);
|
110 |
|
|
cyg_fb_colour (*fb_read_pixel_fn)( struct cyg_fb*, cyg_ucount16, cyg_ucount16);
|
111 |
|
|
void (*fb_write_hline_fn)(struct cyg_fb*, cyg_ucount16, cyg_ucount16, cyg_ucount16, cyg_fb_colour);
|
112 |
|
|
void (*fb_write_vline_fn)(struct cyg_fb*, cyg_ucount16, cyg_ucount16, cyg_ucount16, cyg_fb_colour);
|
113 |
|
|
void (*fb_fill_block_fn)( struct cyg_fb*, cyg_ucount16, cyg_ucount16, cyg_ucount16, cyg_ucount16, cyg_fb_colour);
|
114 |
|
|
void (*fb_write_block_fn)(struct cyg_fb*, cyg_ucount16, cyg_ucount16, cyg_ucount16, cyg_ucount16, const void*, cyg_ucount16, cyg_ucount16);
|
115 |
|
|
void (*fb_read_block_fn)( struct cyg_fb*, cyg_ucount16, cyg_ucount16, cyg_ucount16, cyg_ucount16, void*, cyg_ucount16, cyg_ucount16);
|
116 |
|
|
void (*fb_move_block_fn)( struct cyg_fb*, cyg_ucount16, cyg_ucount16, cyg_ucount16, cyg_ucount16, cyg_ucount16, cyg_ucount16);
|
117 |
|
|
} cyg_fb;
|
118 |
|
|
|
119 |
|
|
// A magic number used to validate an fb pointer
|
120 |
|
|
#define CYG_FB_MAGIC 0xC201e147
|
121 |
|
|
|
122 |
|
|
// The various supported colour formats. A 16-bit value.
|
123 |
|
|
#define CYG_FB_FORMAT_1BPP_MONO_0_BLACK 0x0000
|
124 |
|
|
#define CYG_FB_FORMAT_1BPP_MONO_0_WHITE 0x0001
|
125 |
|
|
#define CYG_FB_FORMAT_1BPP_PAL888 0x0002
|
126 |
|
|
|
127 |
|
|
#define CYG_FB_FORMAT_2BPP_GREYSCALE_0_BLACK 0x0100
|
128 |
|
|
#define CYG_FB_FORMAT_2BPP_GRAYSCALE_0_BLACK 0x0100
|
129 |
|
|
#define CYG_FB_FORMAT_2BPP_GREYSCALE_0_WHITE 0x0101
|
130 |
|
|
#define CYG_FB_FORMAT_2BPP_GRAYSCALE_0_WHITE 0x0101
|
131 |
|
|
#define CYG_FB_FORMAT_2BPP_PAL888 0x0102
|
132 |
|
|
|
133 |
|
|
#define CYG_FB_FORMAT_4BPP_GREYSCALE_0_BLACK 0x0200
|
134 |
|
|
#define CYG_FB_FORMAT_4BPP_GRAYSCALE_0_BLACK 0x0200
|
135 |
|
|
#define CYG_FB_FORMAT_4BPP_GREYSCALE_0_WHITE 0x0201
|
136 |
|
|
#define CYG_FB_FORMAT_4BPP_GRAYSCALE_0_WHITE 0x0202
|
137 |
|
|
#define CYG_FB_FORMAT_4BPP_PAL888 0x0203
|
138 |
|
|
|
139 |
|
|
#define CYG_FB_FORMAT_8BPP_PAL888 0x0300
|
140 |
|
|
#define CYG_FB_FORMAT_8BPP_TRUE_332 0x0301
|
141 |
|
|
|
142 |
|
|
#define CYG_FB_FORMAT_16BPP_TRUE_565 0x0400
|
143 |
|
|
#define CYG_FB_FORMAT_16BPP_TRUE_555 0x0401
|
144 |
|
|
|
145 |
|
|
#define CYG_FB_FORMAT_32BPP_TRUE_0888 0x0500
|
146 |
|
|
|
147 |
|
|
// Flags indicating exactly what the device driver can support.
|
148 |
|
|
// Each fb structure has four flags fields for a maximum of
|
149 |
|
|
// 128 flags, allowing for future expansion at a relatively
|
150 |
|
|
// low cost.
|
151 |
|
|
|
152 |
|
|
// The framebuffer memory is directly accessible and organized in a
|
153 |
|
|
// conventional fashion, i.e. increasing x means the addresses
|
154 |
|
|
// increase by 1 bit/nibble/byte/short/int as appropriate, and
|
155 |
|
|
// increasing y means adding n bytes/shorts/ints
|
156 |
|
|
#define CYG_FB_FLAGS0_LINEAR_FRAMEBUFFER (0x01 << 0)
|
157 |
|
|
// Only relevant for 1bpp, 2bpp and 4bpp displays. Little-endian
|
158 |
|
|
// means that pixel (0,0) occupies bit 0 of framebuffer byte 0.
|
159 |
|
|
// 0. Big-endian means that pixel(0,0) occupies bit 7.
|
160 |
|
|
#define CYG_FB_FLAGS0_LE (0x01 << 1)
|
161 |
|
|
|
162 |
|
|
#define CYG_FB_FLAGS0_TRUE_COLOUR (0x01 << 8)
|
163 |
|
|
#define CYG_FB_FLAGS0_TRUE_COLOR (0x01 << 8)
|
164 |
|
|
#define CYG_FB_FLAGS0_PALETTE (0x01 << 9)
|
165 |
|
|
#define CYG_FB_FLAGS0_WRITEABLE_PALETTE (0x01 << 10)
|
166 |
|
|
|
167 |
|
|
#define CYG_FB_FLAGS0_DELAYED_PALETTE_UPDATE (0x01 << 16)
|
168 |
|
|
#define CYG_FB_FLAGS0_VIEWPORT (0x01 << 17)
|
169 |
|
|
#define CYG_FB_FLAGS0_DOUBLE_BUFFER (0x01 << 18)
|
170 |
|
|
#define CYG_FB_FLAGS0_PAGE_FLIPPING (0x01 << 19)
|
171 |
|
|
#define CYG_FB_FLAGS0_BLANK (0x01 << 20)
|
172 |
|
|
#define CYG_FB_FLAGS0_BACKLIGHT (0x01 << 21)
|
173 |
|
|
#define CYG_FB_FLAGS0_MUST_BE_ON (0x01 << 22)
|
174 |
|
|
|
175 |
|
|
// Some operations including updating the palette, double-buffer
|
176 |
|
|
// synch, page flipping and moving the viewport take an argument
|
177 |
|
|
// to specify when the operation should happen. Driver support
|
178 |
|
|
// for this is optional.
|
179 |
|
|
#define CYG_FB_UPDATE_NOW 0x0000
|
180 |
|
|
#define CYG_FB_UPDATE_VERTICAL_RETRACE 0x0001
|
181 |
|
|
|
182 |
|
|
// ----------------------------------------------------------------------------
|
183 |
|
|
// Macro to define a framebuffer. A couple of auxiliary macros are used
|
184 |
|
|
// for the conditional fields.
|
185 |
|
|
#ifdef CYGPKG_INFRA_DEBUG
|
186 |
|
|
# define CYG_FB_FRAMEBUFFER_DEBUG \
|
187 |
|
|
.fb_magic = CYG_FB_MAGIC,
|
188 |
|
|
#else
|
189 |
|
|
# define CYG_FB_FRAMEBUFFER_DEBUG
|
190 |
|
|
#endif
|
191 |
|
|
|
192 |
|
|
#ifdef CYGHWR_IO_FRAMEBUF_FUNCTIONALITY_VIEWPORT
|
193 |
|
|
# define CYG_FB_FRAMEBUFFER_VIEWPORT(_width_, _height_) \
|
194 |
|
|
.fb_viewport_width = _width_, \
|
195 |
|
|
.fb_viewport_height = _height_,
|
196 |
|
|
#else
|
197 |
|
|
# define CYG_FB_FRAMEBUFFER_VIEWPORT(_width_, _height_)
|
198 |
|
|
#endif
|
199 |
|
|
|
200 |
|
|
#ifdef CYGHWR_IO_FRAMEBUF_FUNCTIONALITY_DOUBLE_BUFFER
|
201 |
|
|
# define CYG_FB_FRAMEBUFFER_SYNCH_FN(_fn_) \
|
202 |
|
|
.fb_synch_fn = _fn_,
|
203 |
|
|
#else
|
204 |
|
|
# define CYG_FB_FRAMEBUFFER_SYNCH_FN(_fn_)
|
205 |
|
|
#endif
|
206 |
|
|
|
207 |
|
|
#ifdef CYGHWR_IO_FRAMEBUF_FUNCTIONALITY_PALETTE
|
208 |
|
|
# define CYG_FB_FRAMEBUFFER_READ_PALETTE_FN(_fn_) \
|
209 |
|
|
.fb_read_palette_fn = _fn_,
|
210 |
|
|
#else
|
211 |
|
|
# define CYG_FB_FRAMEBUFFER_READ_PALETTE_FN(_fn_)
|
212 |
|
|
#endif
|
213 |
|
|
|
214 |
|
|
#ifdef CYGHWR_IO_FRAMEBUF_FUNCTIONALITY_WRITEABLE_PALETTE
|
215 |
|
|
# define CYG_FB_FRAMEBUFFER_WRITE_PALETTE_FN(_fn_) \
|
216 |
|
|
.fb_write_palette_fn = _fn_,
|
217 |
|
|
#else
|
218 |
|
|
# define CYG_FB_FRAMEBUFFER_WRITE_PALETTE_FN(_fn_)
|
219 |
|
|
#endif
|
220 |
|
|
|
221 |
|
|
#ifdef CYGHWR_IO_FRAMEBUF_FUNCTIONALITY_TRUE_COLOUR
|
222 |
|
|
# define CYG_FB_FRAMEBUFFER_MAKE_COLOUR_FN(_fn_) \
|
223 |
|
|
.fb_make_colour_fn = _fn_,
|
224 |
|
|
# define CYG_FB_FRAMEBUFFER_BREAK_COLOUR_FN(_fn_) \
|
225 |
|
|
.fb_break_colour_fn = _fn_,
|
226 |
|
|
#else
|
227 |
|
|
# define CYG_FB_FRAMEBUFFER_MAKE_COLOUR_FN(_fn_)
|
228 |
|
|
# define CYG_FB_FRAMEBUFFER_BREAK_COLOUR_FN(_fn_)
|
229 |
|
|
#endif
|
230 |
|
|
|
231 |
|
|
#define CYG_FB_FRAMEBUFFER(_name_, _depth_, _format_, \
|
232 |
|
|
_width_, _height_, _viewport_width_, _viewport_height_, \
|
233 |
|
|
_base_, _stride_, \
|
234 |
|
|
_flags0_, _flags1_, _flags2_, _flags3_, \
|
235 |
|
|
_driver0_, _driver1_, _driver2_, _driver3_, \
|
236 |
|
|
_on_fn_, _off_fn_, _ioctl_fn_, _synch_fn_, \
|
237 |
|
|
_read_palette_fn_, _write_palette_fn_, \
|
238 |
|
|
_make_colour_fn_, _break_colour_fn_, \
|
239 |
|
|
_write_pixel_fn_, _read_pixel_fn_, _write_hline_fn_, _write_vline_fn_, \
|
240 |
|
|
_fill_block_fn_, _write_block_fn_, _read_block_fn_, _move_block_fn_, \
|
241 |
|
|
_spare0_, _spare1_, _spare2_, _spare3_ ) \
|
242 |
|
|
struct cyg_fb _name_ = { \
|
243 |
|
|
CYG_FB_FRAMEBUFFER_DEBUG \
|
244 |
|
|
.fb_depth = _depth_, \
|
245 |
|
|
.fb_format = _format_, \
|
246 |
|
|
.fb_width = _width_, \
|
247 |
|
|
.fb_height = _height_, \
|
248 |
|
|
CYG_FB_FRAMEBUFFER_VIEWPORT(_viewport_width_, _viewport_height_) \
|
249 |
|
|
.fb_stride = _stride_, \
|
250 |
|
|
.fb_base = _base_, \
|
251 |
|
|
.fb_flags0 = _flags0_, \
|
252 |
|
|
.fb_flags1 = _flags1_, \
|
253 |
|
|
.fb_flags2 = _flags2_, \
|
254 |
|
|
.fb_flags3 = _flags3_, \
|
255 |
|
|
.fb_driver0 = _driver0_, \
|
256 |
|
|
.fb_driver1 = _driver1_, \
|
257 |
|
|
.fb_driver2 = _driver2_, \
|
258 |
|
|
.fb_driver3 = _driver3_, \
|
259 |
|
|
.fb_on_fn = _on_fn_, \
|
260 |
|
|
.fb_off_fn = _off_fn_, \
|
261 |
|
|
.fb_ioctl_fn = _ioctl_fn_, \
|
262 |
|
|
CYG_FB_FRAMEBUFFER_SYNCH_FN(_synch_fn_) \
|
263 |
|
|
CYG_FB_FRAMEBUFFER_READ_PALETTE_FN(_read_palette_fn_) \
|
264 |
|
|
CYG_FB_FRAMEBUFFER_WRITE_PALETTE_FN(_write_palette_fn_) \
|
265 |
|
|
CYG_FB_FRAMEBUFFER_MAKE_COLOUR_FN(_make_colour_fn_) \
|
266 |
|
|
CYG_FB_FRAMEBUFFER_BREAK_COLOUR_FN(_break_colour_fn_) \
|
267 |
|
|
.fb_write_pixel_fn = _write_pixel_fn_, \
|
268 |
|
|
.fb_read_pixel_fn = _read_pixel_fn_, \
|
269 |
|
|
.fb_write_hline_fn = _write_hline_fn_, \
|
270 |
|
|
.fb_write_vline_fn = _write_vline_fn_, \
|
271 |
|
|
.fb_fill_block_fn = _fill_block_fn_, \
|
272 |
|
|
.fb_write_block_fn = _write_block_fn_, \
|
273 |
|
|
.fb_read_block_fn = _read_block_fn_, \
|
274 |
|
|
.fb_move_block_fn = _move_block_fn_ \
|
275 |
|
|
}
|
276 |
|
|
|
277 |
|
|
|
278 |
|
|
// ----------------------------------------------------------------------------
|
279 |
|
|
// ioctl() operations: these are defined by a 16-bit key. The top byte
|
280 |
|
|
// gives a category, with values of 0x8000 onwards reserved for use by
|
281 |
|
|
// individual device drivers. The bottom byte defines the actual
|
282 |
|
|
// operation. This gives 128 generic ioctl categories.
|
283 |
|
|
|
284 |
|
|
# define CYG_FB_IOCTL_VIEWPORT_GET_POSITION 0x0100
|
285 |
|
|
# define CYG_FB_IOCTL_VIEWPORT_SET_POSITION 0x0101
|
286 |
|
|
|
287 |
|
|
typedef struct cyg_fb_ioctl_viewport {
|
288 |
|
|
cyg_ucount16 fbvp_x; // position of top-left corner of the viewport within
|
289 |
|
|
cyg_ucount16 fbvp_y; // the framebuffer
|
290 |
|
|
cyg_ucount16 fbvp_when; // set-only, now or vert retrace
|
291 |
|
|
} cyg_fb_ioctl_viewport;
|
292 |
|
|
|
293 |
|
|
# define CYG_FB_IOCTL_PAGE_FLIPPING_GET_PAGES 0x0200
|
294 |
|
|
# define CYG_FB_IOCTL_PAGE_FLIPPING_SET_PAGES 0x0201
|
295 |
|
|
|
296 |
|
|
typedef struct cyg_fb_ioctl_page_flip {
|
297 |
|
|
cyg_uint32 fbpf_number_pages;
|
298 |
|
|
cyg_uint32 fbpf_visible_page;
|
299 |
|
|
cyg_uint32 fbpf_drawable_page;
|
300 |
|
|
cyg_ucount16 fbpf_when; // set-only, now or vert retrace
|
301 |
|
|
} cyg_fb_ioctl_page_flip;
|
302 |
|
|
|
303 |
|
|
# define CYG_FB_IOCTL_BLANK_GET 0x0300
|
304 |
|
|
# define CYG_FB_IOCTL_BLANK_SET 0x0301
|
305 |
|
|
|
306 |
|
|
typedef struct cyg_fb_ioctl_blank {
|
307 |
|
|
cyg_bool fbbl_on;
|
308 |
|
|
} cyg_fb_ioctl_blank;
|
309 |
|
|
|
310 |
|
|
# define CYG_FB_IOCTL_BACKLIGHT_GET 0x0400
|
311 |
|
|
# define CYG_FB_IOCTL_BACKLIGHT_SET 0x0401
|
312 |
|
|
|
313 |
|
|
typedef struct cyg_fb_ioctl_backlight {
|
314 |
|
|
cyg_ucount32 fbbl_current;
|
315 |
|
|
cyg_ucount32 fbbl_max;
|
316 |
|
|
} cyg_fb_ioctl_backlight;
|
317 |
|
|
|
318 |
|
|
// ----------------------------------------------------------------------------
|
319 |
|
|
// The functional API. This can be implemented either by inlines or by
|
320 |
|
|
// explicit functions, the latter allowing extra assertions.
|
321 |
|
|
|
322 |
|
|
#if defined(CYGPKG_INFRA_DEBUG) || defined(__CYG_FB_IN_FRAMEBUF_C)
|
323 |
|
|
|
324 |
|
|
extern int cyg_fb_on(cyg_fb*);
|
325 |
|
|
extern int cyg_fb_off(cyg_fb*);
|
326 |
|
|
extern void cyg_fb_write_pixel( cyg_fb*,
|
327 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
328 |
|
|
cyg_fb_colour);
|
329 |
|
|
extern cyg_fb_colour cyg_fb_read_pixel( cyg_fb*,
|
330 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */);
|
331 |
|
|
extern void cyg_fb_write_hline( cyg_fb*,
|
332 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
333 |
|
|
cyg_ucount16 /* len */,
|
334 |
|
|
cyg_fb_colour);
|
335 |
|
|
extern void cyg_fb_write_vline( cyg_fb*,
|
336 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
337 |
|
|
cyg_ucount16 /* len */,
|
338 |
|
|
cyg_fb_colour);
|
339 |
|
|
extern void cyg_fb_fill_block( cyg_fb*,
|
340 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
341 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
342 |
|
|
cyg_fb_colour);
|
343 |
|
|
extern void cyg_fb_write_block( cyg_fb*,
|
344 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
345 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
346 |
|
|
const void* /* source */,
|
347 |
|
|
cyg_ucount16 /* offset */, cyg_ucount16 /* source stride */);
|
348 |
|
|
extern void cyg_fb_read_block( cyg_fb*,
|
349 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
350 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
351 |
|
|
void* /* dest */,
|
352 |
|
|
cyg_ucount16 /* offset */, cyg_ucount16 /* source stride */);
|
353 |
|
|
extern void cyg_fb_move_block( cyg_fb*,
|
354 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
355 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
356 |
|
|
cyg_ucount16 /* new_x */, cyg_ucount16 /* new_y */);
|
357 |
|
|
extern int cyg_fb_ioctl( cyg_fb*,
|
358 |
|
|
cyg_uint16 /* key */,
|
359 |
|
|
void* /* data */,
|
360 |
|
|
size_t* /* len */);
|
361 |
|
|
|
362 |
|
|
extern void cyg_fb_synch( cyg_fb*,
|
363 |
|
|
cyg_ucount16 /* when */);
|
364 |
|
|
|
365 |
|
|
extern void cyg_fb_write_palette( cyg_fb*,
|
366 |
|
|
cyg_ucount32 /* first */,
|
367 |
|
|
cyg_ucount32 /* count */,
|
368 |
|
|
const void* /* source */,
|
369 |
|
|
cyg_ucount16 /* when */);
|
370 |
|
|
extern void cyg_fb_read_palette( cyg_fb*,
|
371 |
|
|
cyg_ucount32 /* first */,
|
372 |
|
|
cyg_ucount32 /* count */,
|
373 |
|
|
void* /* dest */);
|
374 |
|
|
|
375 |
|
|
extern cyg_fb_colour cyg_fb_make_colour( cyg_fb*,
|
376 |
|
|
cyg_ucount8 /* r */, cyg_ucount8 /* g */, cyg_ucount8 /* b */);
|
377 |
|
|
|
378 |
|
|
extern void cyg_fb_break_colour( cyg_fb*,
|
379 |
|
|
cyg_fb_colour,
|
380 |
|
|
cyg_ucount8* /* r */, cyg_ucount8* /* g */, cyg_ucount8* /* b */);
|
381 |
|
|
|
382 |
|
|
#else
|
383 |
|
|
|
384 |
|
|
extern __inline__ int
|
385 |
|
|
cyg_fb_on(cyg_fb* _fb_)
|
386 |
|
|
{
|
387 |
|
|
return (*(_fb_->fb_on_fn))(_fb_);
|
388 |
|
|
}
|
389 |
|
|
|
390 |
|
|
extern __inline__ int
|
391 |
|
|
cyg_fb_off(cyg_fb* _fb_)
|
392 |
|
|
{
|
393 |
|
|
return (*(_fb_->fb_off_fn))(_fb_);
|
394 |
|
|
}
|
395 |
|
|
|
396 |
|
|
extern __inline__ void
|
397 |
|
|
cyg_fb_write_pixel(cyg_fb* _fb_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_count32 _colour_)
|
398 |
|
|
{
|
399 |
|
|
(*(_fb_->fb_write_pixel_fn))(_fb_, _x_, _y_, _colour_);
|
400 |
|
|
}
|
401 |
|
|
|
402 |
|
|
extern __inline__ cyg_fb_colour
|
403 |
|
|
cyg_fb_read_pixel(cyg_fb* _fb_, cyg_ucount16 _x_, cyg_ucount16 _y_)
|
404 |
|
|
{
|
405 |
|
|
return (*(_fb_->fb_read_pixel_fn))(_fb_, _x_, _y_);
|
406 |
|
|
}
|
407 |
|
|
|
408 |
|
|
extern __inline__ void
|
409 |
|
|
cyg_fb_write_hline(cyg_fb* _fb_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _len_, cyg_fb_colour _colour_)
|
410 |
|
|
{
|
411 |
|
|
(*(_fb_->fb_write_hline_fn))(_fb_, _x_, _y_, _len_, _colour_);
|
412 |
|
|
}
|
413 |
|
|
|
414 |
|
|
extern __inline__ void
|
415 |
|
|
cyg_fb_write_vline(cyg_fb* _fb_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _len_, cyg_fb_colour _colour_)
|
416 |
|
|
{
|
417 |
|
|
(*(_fb_->fb_write_vline_fn))(_fb_, _x_, _y_, _len_, _colour_);
|
418 |
|
|
}
|
419 |
|
|
|
420 |
|
|
extern __inline__ void
|
421 |
|
|
cyg_fb_fill_block(cyg_fb* _fb_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_, cyg_fb_colour _colour_)
|
422 |
|
|
{
|
423 |
|
|
(*(_fb_->fb_fill_block_fn))(_fb_, _x_, _y_, _width_, _height_, _colour_);
|
424 |
|
|
}
|
425 |
|
|
|
426 |
|
|
extern __inline__ void
|
427 |
|
|
cyg_fb_write_block(cyg_fb* _fb_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_,
|
428 |
|
|
const void* _source_, cyg_ucount16 _offset_, cyg_ucount16 _stride_)
|
429 |
|
|
{
|
430 |
|
|
(*(_fb_->fb_write_block_fn))(_fb_, _x_, _y_, _width_, _height_, _source_, _offset_, _stride_);
|
431 |
|
|
}
|
432 |
|
|
|
433 |
|
|
extern __inline__ void
|
434 |
|
|
cyg_fb_read_block(cyg_fb* _fb_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_,
|
435 |
|
|
void* _dest_, cyg_ucount16 _offset_, cyg_ucount16 _stride_)
|
436 |
|
|
{
|
437 |
|
|
(*((_fb_)->fb_read_block_fn))(_fb_, _x_, _y_, _width_, _height_, _dest_, _offset_, _stride_);
|
438 |
|
|
}
|
439 |
|
|
|
440 |
|
|
extern __inline__ void
|
441 |
|
|
cyg_fb_move_block(cyg_fb* _fb_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_, cyg_ucount16 _newx_, cyg_ucount16 _newy_)
|
442 |
|
|
{
|
443 |
|
|
(*(_fb_->fb_move_block_fn))(_fb_, _x_, _y_, _width_, _height_, _newx_, _newy_);
|
444 |
|
|
}
|
445 |
|
|
|
446 |
|
|
extern __inline__ int
|
447 |
|
|
cyg_fb_ioctl(cyg_fb* _fb_, cyg_uint16 _key_, void* _data_, size_t* _len_)
|
448 |
|
|
{
|
449 |
|
|
int result = (*(_fb_->fb_ioctl_fn))(_fb_, _key_, _data_, _len_);
|
450 |
|
|
return result;
|
451 |
|
|
}
|
452 |
|
|
|
453 |
|
|
extern __inline__ void
|
454 |
|
|
cyg_fb_synch(cyg_fb* _fb_, cyg_ucount16 _when_)
|
455 |
|
|
{
|
456 |
|
|
#ifdef CYGHWR_IO_FRAMEBUF_FUNCTIONALITY_DOUBLE_BUFFER
|
457 |
|
|
(*(_fb_->fb_synch_fn))(_fb_, _when_);
|
458 |
|
|
#else
|
459 |
|
|
// Synch is a no-op
|
460 |
|
|
#endif
|
461 |
|
|
}
|
462 |
|
|
|
463 |
|
|
extern __inline__ void
|
464 |
|
|
cyg_fb_read_palette(cyg_fb* _fb_, cyg_ucount32 _first_, cyg_ucount32 _count_, void* _dest_)
|
465 |
|
|
{
|
466 |
|
|
#ifdef CYGHWR_IO_FRAMEBUF_FUNCTIONALITY_PALETTE
|
467 |
|
|
(*(_fb_->fb_read_palette_fn))(_fb_, _first_, _count_, _dest_);
|
468 |
|
|
#else
|
469 |
|
|
CYG_UNUSED_PARAM(cyg_fb*, _fb_);
|
470 |
|
|
CYG_UNUSED_PARAM(cyg_ucount32, _first_);
|
471 |
|
|
CYG_UNUSED_PARAM(cyg_ucount32, _count_);
|
472 |
|
|
CYG_UNUSED_PARAM(void*, _dest_);
|
473 |
|
|
#endif
|
474 |
|
|
}
|
475 |
|
|
|
476 |
|
|
extern __inline__ void
|
477 |
|
|
cyg_fb_write_palette(cyg_fb* _fb_, cyg_ucount32 _first_, cyg_ucount32 _count_, const void* _dest_, cyg_ucount16 _when_)
|
478 |
|
|
{
|
479 |
|
|
#ifdef CYGHWR_IO_FRAMEBUF_FUNCTIONALITY_WRITEABLE_PALETTE
|
480 |
|
|
(*(_fb_->fb_write_palette_fn))(_fb_, _first_, _count_, _dest_, _when_);
|
481 |
|
|
#else
|
482 |
|
|
CYG_UNUSED_PARAM(cyg_fb*, _fb_);
|
483 |
|
|
CYG_UNUSED_PARAM(cyg_ucount32, _first_);
|
484 |
|
|
CYG_UNUSED_PARAM(cyg_ucount32, _count_);
|
485 |
|
|
CYG_UNUSED_PARAM(const void*, _dest_);
|
486 |
|
|
CYG_UNUSED_PARAM(cyg_ucount16, _when_);
|
487 |
|
|
#endif
|
488 |
|
|
}
|
489 |
|
|
|
490 |
|
|
extern __inline__ cyg_fb_colour
|
491 |
|
|
cyg_fb_make_colour(cyg_fb* _fb_, cyg_ucount8 _r_, cyg_ucount8 _g_, cyg_ucount8 _b_)
|
492 |
|
|
{
|
493 |
|
|
#ifdef CYGHWR_IO_FRAMEBUF_FUNCTIONALITY_TRUE_COLOUR
|
494 |
|
|
return (*(_fb_->fb_make_colour_fn))(_fb_, _r_, _g_, _b_);
|
495 |
|
|
#else
|
496 |
|
|
CYG_UNUSED_PARAM(cyg_fb*, _fb_);
|
497 |
|
|
CYG_UNUSED_PARAM(cyg_ucount8, _r_);
|
498 |
|
|
CYG_UNUSED_PARAM(cyg_ucount8, _g_);
|
499 |
|
|
CYG_UNUSED_PARAM(cyg_ucount8, _b_);
|
500 |
|
|
return 0;
|
501 |
|
|
#endif
|
502 |
|
|
}
|
503 |
|
|
|
504 |
|
|
extern __inline__ void
|
505 |
|
|
cyg_fb_break_colour(cyg_fb* _fb_, cyg_fb_colour _colour_, cyg_ucount8* _r_, cyg_ucount8* _g_, cyg_ucount8* _b_)
|
506 |
|
|
{
|
507 |
|
|
#ifdef CYGHWR_IO_FRAMEBUF_FUNCTIONALITY_TRUE_COLOUR
|
508 |
|
|
(*(_fb_->fb_break_colour_fn))(_fb_, _colour_, _r_, _g_, _b_);
|
509 |
|
|
#else
|
510 |
|
|
CYG_UNUSED_PARAM(cyg_fb*, _fb_);
|
511 |
|
|
CYG_UNUSED_PARAM(cyg_fb_colour, _colour_);
|
512 |
|
|
CYG_UNUSED_PARAM(cyg_ucount8*, _r_);
|
513 |
|
|
CYG_UNUSED_PARAM(cyg_ucount8*, _g_);
|
514 |
|
|
CYG_UNUSED_PARAM(cyg_ucount8*, _b_);
|
515 |
|
|
#endif
|
516 |
|
|
}
|
517 |
|
|
|
518 |
|
|
#endif // defined(CYGPKG_INFRA_DEBUG) || defined(__CYG_FB_IN_FRAMEBUF_C)
|
519 |
|
|
|
520 |
|
|
// ----------------------------------------------------------------------------
|
521 |
|
|
// The MACRO API
|
522 |
|
|
#define CYG_FB__AUX(_fb_, _field_) CYG_FB_ ## _fb_ ## _field_
|
523 |
|
|
|
524 |
|
|
#define CYG_FB_STRUCT(_fb_) CYG_FB__AUX(_fb_, _STRUCT)
|
525 |
|
|
#define CYG_FB_DEPTH(_fb_) CYG_FB__AUX(_fb_, _DEPTH)
|
526 |
|
|
#define CYG_FB_FORMAT(_fb_) CYG_FB__AUX(_fb_, _FORMAT)
|
527 |
|
|
#define CYG_FB_WIDTH(_fb_) CYG_FB__AUX(_fb_, _WIDTH)
|
528 |
|
|
#define CYG_FB_HEIGHT(_fb_) CYG_FB__AUX(_fb_, _HEIGHT)
|
529 |
|
|
#define CYG_FB_VIEWPORT_WIDTH(_fb_) CYG_FB__AUX(_fb_, _VIEWPORT_WIDTH)
|
530 |
|
|
#define CYG_FB_VIEWPORT_HEIGHT(_fb_) CYG_FB__AUX(_fb_, _VIEWPORT_HEIGHT)
|
531 |
|
|
#define CYG_FB_STRIDE(_fb_) CYG_FB__AUX(_fb_, _STRIDE)
|
532 |
|
|
#define CYG_FB_BASE(_fb_) CYG_FB__AUX(_fb_, _BASE)
|
533 |
|
|
#define CYG_FB_FLAGS0(_fb_) CYG_FB__AUX(_fb_, _FLAGS0)
|
534 |
|
|
#define CYG_FB_FLAGS1(_fb_) CYG_FB__AUX(_fb_, _FLAGS1)
|
535 |
|
|
#define CYG_FB_FLAGS2(_fb_) CYG_FB__AUX(_fb_, _FLAGS2)
|
536 |
|
|
#define CYG_FB_FLAGS3(_fb_) CYG_FB__AUX(_fb_, _FLAGS3)
|
537 |
|
|
|
538 |
|
|
#define CYG_FB_PIXELx_VAR( _fb_, _id_) CYG_FB__AUX(_fb_, _PIXELx_VAR)( _fb_, _id_)
|
539 |
|
|
#define CYG_FB_PIXELx_SET( _fb_, _id_, _x_, _y_) CYG_FB__AUX(_fb_, _PIXELx_SET)( _fb_, _id_, _x_, _y_)
|
540 |
|
|
#define CYG_FB_PIXELx_GET( _fb_, _id_, _x_, _y_) CYG_FB__AUX(_fb_, _PIXELx_GET)( _fb_, _id_, _x_, _y_)
|
541 |
|
|
#define CYG_FB_PIXELx_ADDX( _fb_, _id_, _incr_) CYG_FB__AUX(_fb_, _PIXELx_ADDX)( _fb_, _id_, _incr_)
|
542 |
|
|
#define CYG_FB_PIXELx_ADDY( _fb_, _id_, _incr_) CYG_FB__AUX(_fb_, _PIXELx_ADDY)( _fb_, _id_, _incr_)
|
543 |
|
|
#define CYG_FB_PIXELx_WRITE(_fb_, _id_, _colour_) CYG_FB__AUX(_fb_, _PIXELx_WRITE)( _fb_, _id_, _colour_)
|
544 |
|
|
#define CYG_FB_PIXELx_READ( _fb_, _id_) CYG_FB__AUX(_fb_, _PIXELx_READ)( _fb_, _id_)
|
545 |
|
|
#define CYG_FB_PIXELx_FLUSHABS(_fb_, _id_, _x0_, _y0_, _width_, _height_) CYG_FB__AUX(_fb_, _PIXELx_FLUSHABS)( _fb_, _id_, _x0_, _y0_, _x1_, _y1_)
|
546 |
|
|
#define CYG_FB_PIXELx_FLUSHREL(_fb_, _id_, _x0_, _y0_, _dx_, _dy_) CYG_FB__AUX(_fb_, _PIXELx_FLUSHREL)( _fb_, _id_, _x0_, _y0_, _dx_, _dy_)
|
547 |
|
|
|
548 |
|
|
#define CYG_FB_PIXEL0_VAR( _fb_) CYG_FB_PIXELx_VAR( _fb_, 0)
|
549 |
|
|
#define CYG_FB_PIXEL0_SET( _fb_, _x_, _y_) CYG_FB_PIXELx_SET( _fb_, 0, _x_, _y_)
|
550 |
|
|
#define CYG_FB_PIXEL0_GET( _fb_, _x_, _y_) CYG_FB_PIXELx_GET( _fb_, 0, _x_, _y_)
|
551 |
|
|
#define CYG_FB_PIXEL0_ADDX( _fb_, _incr_) CYG_FB_PIXELx_ADDX( _fb_, 0, _incr_)
|
552 |
|
|
#define CYG_FB_PIXEL0_ADDY( _fb_, _incr_) CYG_FB_PIXELx_ADDY( _fb_, 0, _incr_)
|
553 |
|
|
#define CYG_FB_PIXEL0_WRITE(_fb_, _colour_) CYG_FB_PIXELx_WRITE(_fb_, 0, _colour_)
|
554 |
|
|
#define CYG_FB_PIXEL0_READ( _fb_) CYG_FB_PIXELx_READ( _fb_, 0)
|
555 |
|
|
#define CYG_FB_PIXEL0_FLUSHABS( _fb_, _x0_, _y0_, _width_, _height_) CYG_FB_PIXELx_FLUSHABS( _fb_, 0, _x0_, _y0_, _width_, _height_)
|
556 |
|
|
#define CYG_FB_PIXEL0_FLUSHREL( _fb_, _x0_, _y0_, _dx_, _dy_) CYG_FB_PIXELx_FLUSHREL( _fb_, 0, _x0_, _y0_, _dx_, _dy_)
|
557 |
|
|
|
558 |
|
|
#define CYG_FB_PIXEL1_VAR( _fb_) CYG_FB_PIXELx_VAR( _fb_, 1)
|
559 |
|
|
#define CYG_FB_PIXEL1_SET( _fb_, _x_, _y_) CYG_FB_PIXELx_SET( _fb_, 1, _x_, _y_)
|
560 |
|
|
#define CYG_FB_PIXEL1_GET( _fb_, _x_, _y_) CYG_FB_PIXELx_GET( _fb_, 1, _x_, _y_)
|
561 |
|
|
#define CYG_FB_PIXEL1_ADDX( _fb_, _incr_) CYG_FB_PIXELx_ADDX( _fb_, 1, _incr_)
|
562 |
|
|
#define CYG_FB_PIXEL1_ADDY( _fb_, _incr_) CYG_FB_PIXELx_ADDY( _fb_, 1, _incr_)
|
563 |
|
|
#define CYG_FB_PIXEL1_WRITE(_fb_, _colour_) CYG_FB_PIXELx_WRITE(_fb_, 1, _colour_)
|
564 |
|
|
#define CYG_FB_PIXEL1_READ( _fb_) CYG_FB_PIXELx_READ( _fb_, 1)
|
565 |
|
|
#define CYG_FB_PIXEL1_FLUSHABS( _fb_, _x0_, _y0_, _width_, _height_) CYG_FB_PIXELx_FLUSHABS( _fb_, 1, _x0_, _y0_, _width_, _height_)
|
566 |
|
|
#define CYG_FB_PIXEL1_FLUSHREL( _fb_, _x0_, _y0_, _dx_, _dy_) CYG_FB_PIXELx_FLUSHREL( _fb_, 1, _x0_, _y0_, _dx_, _dy_)
|
567 |
|
|
|
568 |
|
|
#define CYG_FB_PIXEL2_VAR( _fb_) CYG_FB_PIXELx_VAR( _fb_, 2)
|
569 |
|
|
#define CYG_FB_PIXEL2_SET( _fb_, _x_, _y_) CYG_FB_PIXELx_SET( _fb_, 2, _x_, _y_)
|
570 |
|
|
#define CYG_FB_PIXEL2_GET( _fb_, _x_, _y_) CYG_FB_PIXELx_GET( _fb_, 2, _x_, _y_)
|
571 |
|
|
#define CYG_FB_PIXEL2_ADDX( _fb_, _incr_) CYG_FB_PIXELx_ADDX( _fb_, 2, _incr_)
|
572 |
|
|
#define CYG_FB_PIXEL2_ADDY( _fb_, _incr_) CYG_FB_PIXELx_ADDY( _fb_, 2, _incr_)
|
573 |
|
|
#define CYG_FB_PIXEL2_WRITE(_fb_, _colour_) CYG_FB_PIXELx_WRITE(_fb_, 2, _colour_)
|
574 |
|
|
#define CYG_FB_PIXEL2_READ( _fb_) CYG_FB_PIXELx_READ( _fb_, 2)
|
575 |
|
|
#define CYG_FB_PIXEL2_FLUSHABS( _fb_, _x0_, _y0_, _width_, _height_) CYG_FB_PIXELx_FLUSHABS( _fb_, 2, _x0_, _y0_, _width_, _height_)
|
576 |
|
|
#define CYG_FB_PIXEL2_FLUSHREL( _fb_, _x0_, _y0_, _dx_, _dy_) CYG_FB_PIXELx_FLUSHREL( _fb_, 2, _x0_, _y0_, _dx_, _dy_)
|
577 |
|
|
|
578 |
|
|
#define CYG_FB_PIXEL3_VAR( _fb_) CYG_FB_PIXELx_VAR( _fb_, 3)
|
579 |
|
|
#define CYG_FB_PIXEL3_SET( _fb_, _x_, _y_) CYG_FB_PIXELx_SET( _fb_, 3, _x_, _y_)
|
580 |
|
|
#define CYG_FB_PIXEL3_GET( _fb_, _x_, _y_) CYG_FB_PIXELx_GET( _fb_, 3, _x_, _y_)
|
581 |
|
|
#define CYG_FB_PIXEL3_ADDX( _fb_, _incr_) CYG_FB_PIXELx_ADDX( _fb_, 3, _incr_)
|
582 |
|
|
#define CYG_FB_PIXEL3_ADDY( _fb_, _incr_) CYG_FB_PIXELx_ADDY( _fb_, 3, _incr_)
|
583 |
|
|
#define CYG_FB_PIXEL3_WRITE(_fb_, _colour_) CYG_FB_PIXELx_WRITE(_fb_, 3, _colour_)
|
584 |
|
|
#define CYG_FB_PIXEL3_READ( _fb_) CYG_FB_PIXELx_READ( _fb_, 3)
|
585 |
|
|
#define CYG_FB_PIXEL3_FLUSHABS( _fb_, _x0_, _y0_, _width_, _height_) CYG_FB_PIXELx_FLUSHABS( _fb_, 3, _x0_, _y0_, _width_, _height_)
|
586 |
|
|
#define CYG_FB_PIXEL3_FLUSHREL( _fb_, _x0_, _y0_, _dx_, _dy_) CYG_FB_PIXELx_FLUSHREL( _fb_, 3, _x0_, _y0_, _dx_, _dy_)
|
587 |
|
|
|
588 |
|
|
#define CYG_FB_ON(_fb_) ({ cyg_fb_on(& CYG_FB_STRUCT(_fb_)); })
|
589 |
|
|
#define CYG_FB_OFF(_fb_) ({ cyg_fb_off(& CYG_FB_STRUCT(_fb_)); })
|
590 |
|
|
#define CYG_FB_IOCTL(_fb_, _key_, _data_, _len_) ({ cyg_fb_ioctl(& CYG_FB_STRUCT(_fb_), _key_, _data_, _len_); })
|
591 |
|
|
#define CYG_FB_SYNCH(_fb_, _when_) \
|
592 |
|
|
CYG_MACRO_START \
|
593 |
|
|
cyg_fb_synch(& CYG_FB_STRUCT(_fb_), _when_); \
|
594 |
|
|
CYG_MACRO_END
|
595 |
|
|
#define CYG_FB_WRITE_PALETTE(_fb_, _first_, _count_, _data_, _when_) \
|
596 |
|
|
CYG_MACRO_START \
|
597 |
|
|
cyg_fb_write_palette(& CYG_FB_STRUCT(_fb_), _first_, _count_, _data_, _when_); \
|
598 |
|
|
CYG_MACRO_END
|
599 |
|
|
#define CYG_FB_READ_PALETTE(_fb_, _first_, _count_, _data_) \
|
600 |
|
|
CYG_MACRO_START \
|
601 |
|
|
cyg_fb_read_palette(& CYG_FB_STRUCT(_fb_), _first_, _count_, _data_); \
|
602 |
|
|
CYG_MACRO_END
|
603 |
|
|
|
604 |
|
|
#define CYG_FB_WRITE_PIXEL(_fb_, _x_, _y_, _colour_) \
|
605 |
|
|
CYG_FB__AUX(_fb_, _WRITE_PIXEL)(_x_, _y_, _colour_)
|
606 |
|
|
#define CYG_FB_READ_PIXEL(_fb_, _x_, _y_) \
|
607 |
|
|
CYG_FB__AUX(_fb_, _READ_PIXEL)(_x_, _y_)
|
608 |
|
|
#define CYG_FB_WRITE_HLINE(_fb_, _x_, _y_, _len_, _colour_) \
|
609 |
|
|
CYG_FB__AUX(_fb_, _WRITE_HLINE)(_x_, _y_, _len_, _colour_)
|
610 |
|
|
#define CYG_FB_WRITE_VLINE(_fb_, _x_, _y_, _len_, _colour_) \
|
611 |
|
|
CYG_FB__AUX(_fb_, _WRITE_VLINE)(_x_, _y_, _len_, _colour_)
|
612 |
|
|
#define CYG_FB_FILL_BLOCK(_fb_, _x_, _y_, _width_, _height_, _colour_) \
|
613 |
|
|
CYG_FB__AUX(_fb_, _FILL_BLOCK)(_x_, _y_, _width_, _height_, _colour_)
|
614 |
|
|
#define CYG_FB_WRITE_BLOCK(_fb_, _x_, _y_, _width_, _height_, _data_, _offset_, _stride_) \
|
615 |
|
|
CYG_FB__AUX(_fb_, _WRITE_BLOCK)(_x_, _y_, _width_, _height_, _data_, _offset_, _stride_)
|
616 |
|
|
#define CYG_FB_READ_BLOCK(_fb_, _x_, _y_, _width_, _height_, _data_, _offset_, _stride_) \
|
617 |
|
|
CYG_FB__AUX(_fb_, _READ_BLOCK)(_x_, _y_, _width_, _height_, _data_, _offset_, _stride_)
|
618 |
|
|
#define CYG_FB_MOVE_BLOCK(_fb_, _x_, _y_, _width_, _height_, _new_x_, _new_y_) \
|
619 |
|
|
CYG_FB__AUX(_fb_, _MOVE_BLOCK)(_x_, _y_, _width_, _height_, _new_x_, _new_y_)
|
620 |
|
|
#define CYG_FB_MAKE_COLOUR(_fb_, _r_, _g_, _b_) \
|
621 |
|
|
CYG_FB__AUX(_fb_, _MAKE_COLOUR)(_r_, _g_, _b_)
|
622 |
|
|
#define CYG_FB_MAKE_COLOR(_fb_, _r_, _g_, _b_) \
|
623 |
|
|
CYG_FB__AUX(_fb_, _MAKE_COLOUR)(_r_, _g_, _b_)
|
624 |
|
|
#define CYG_FB_BREAK_COLOUR(_fb_, _colour_, _r_, _g_, _b_) \
|
625 |
|
|
CYG_FB__AUX(_fb_, _BREAK_COLOUR)(_colour_, _r_, _g_, _b_)
|
626 |
|
|
#define CYG_FB_BREAK_COLOR(_fb_, _colour_, _r_, _g_, _b_) \
|
627 |
|
|
CYG_FB__AUX(_fb_, _BREAK_COLOUR)(_colour_, _r_, _g_, _b_)
|
628 |
|
|
|
629 |
|
|
// ----------------------------------------------------------------------------
|
630 |
|
|
// Default implementations of some of the per-device functions for linear
|
631 |
|
|
// framebuffers. Control operations like initialization are always
|
632 |
|
|
// device-specific and cannot be implemented by the generic package.
|
633 |
|
|
|
634 |
|
|
extern void cyg_fb_linear_write_pixel_1LE( cyg_fb*,
|
635 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
636 |
|
|
cyg_fb_colour);
|
637 |
|
|
extern void cyg_fb_linear_write_pixel_1BE( cyg_fb*,
|
638 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
639 |
|
|
cyg_fb_colour);
|
640 |
|
|
extern void cyg_fb_linear_write_pixel_2LE( cyg_fb*,
|
641 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
642 |
|
|
cyg_fb_colour);
|
643 |
|
|
extern void cyg_fb_linear_write_pixel_2BE( cyg_fb*,
|
644 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
645 |
|
|
cyg_fb_colour);
|
646 |
|
|
extern void cyg_fb_linear_write_pixel_4LE( cyg_fb*,
|
647 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
648 |
|
|
cyg_fb_colour);
|
649 |
|
|
extern void cyg_fb_linear_write_pixel_4BE( cyg_fb*,
|
650 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
651 |
|
|
cyg_fb_colour);
|
652 |
|
|
extern void cyg_fb_linear_write_pixel_8( cyg_fb*,
|
653 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
654 |
|
|
cyg_fb_colour);
|
655 |
|
|
extern void cyg_fb_linear_write_pixel_16( cyg_fb*,
|
656 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
657 |
|
|
cyg_fb_colour);
|
658 |
|
|
extern void cyg_fb_linear_write_pixel_32( cyg_fb*,
|
659 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
660 |
|
|
cyg_fb_colour);
|
661 |
|
|
|
662 |
|
|
extern cyg_fb_colour cyg_fb_linear_read_pixel_1LE( cyg_fb*,
|
663 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */);
|
664 |
|
|
extern cyg_fb_colour cyg_fb_linear_read_pixel_1BE( cyg_fb*,
|
665 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */);
|
666 |
|
|
extern cyg_fb_colour cyg_fb_linear_read_pixel_2LE( cyg_fb*,
|
667 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */);
|
668 |
|
|
extern cyg_fb_colour cyg_fb_linear_read_pixel_2BE( cyg_fb*,
|
669 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */);
|
670 |
|
|
extern cyg_fb_colour cyg_fb_linear_read_pixel_4LE( cyg_fb*,
|
671 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */);
|
672 |
|
|
extern cyg_fb_colour cyg_fb_linear_read_pixel_4BE( cyg_fb*,
|
673 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */);
|
674 |
|
|
extern cyg_fb_colour cyg_fb_linear_read_pixel_8( cyg_fb*,
|
675 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */);
|
676 |
|
|
extern cyg_fb_colour cyg_fb_linear_read_pixel_16( cyg_fb*,
|
677 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */);
|
678 |
|
|
extern cyg_fb_colour cyg_fb_linear_read_pixel_32( cyg_fb*,
|
679 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */);
|
680 |
|
|
|
681 |
|
|
extern void cyg_fb_linear_write_hline_1LE( cyg_fb*,
|
682 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
683 |
|
|
cyg_ucount16 /* len */,
|
684 |
|
|
cyg_fb_colour);
|
685 |
|
|
extern void cyg_fb_linear_write_hline_1BE( cyg_fb*,
|
686 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
687 |
|
|
cyg_ucount16 /* len */,
|
688 |
|
|
cyg_fb_colour);
|
689 |
|
|
extern void cyg_fb_linear_write_hline_2LE( cyg_fb*,
|
690 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
691 |
|
|
cyg_ucount16 /* len */,
|
692 |
|
|
cyg_fb_colour);
|
693 |
|
|
extern void cyg_fb_linear_write_hline_2BE( cyg_fb*,
|
694 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
695 |
|
|
cyg_ucount16 /* len */,
|
696 |
|
|
cyg_fb_colour);
|
697 |
|
|
extern void cyg_fb_linear_write_hline_4LE( cyg_fb*,
|
698 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
699 |
|
|
cyg_ucount16 /* len */,
|
700 |
|
|
cyg_fb_colour);
|
701 |
|
|
extern void cyg_fb_linear_write_hline_4BE( cyg_fb*,
|
702 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
703 |
|
|
cyg_ucount16 /* len */,
|
704 |
|
|
cyg_fb_colour);
|
705 |
|
|
extern void cyg_fb_linear_write_hline_8( cyg_fb*,
|
706 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
707 |
|
|
cyg_ucount16 /* len */,
|
708 |
|
|
cyg_fb_colour);
|
709 |
|
|
extern void cyg_fb_linear_write_hline_16( cyg_fb*,
|
710 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
711 |
|
|
cyg_ucount16 /* len */,
|
712 |
|
|
cyg_fb_colour);
|
713 |
|
|
extern void cyg_fb_linear_write_hline_32( cyg_fb*,
|
714 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
715 |
|
|
cyg_ucount16 /* len */,
|
716 |
|
|
cyg_fb_colour);
|
717 |
|
|
|
718 |
|
|
extern void cyg_fb_linear_write_vline_1LE( cyg_fb*,
|
719 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
720 |
|
|
cyg_ucount16 /* len */,
|
721 |
|
|
cyg_fb_colour);
|
722 |
|
|
extern void cyg_fb_linear_write_vline_1BE( cyg_fb*,
|
723 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
724 |
|
|
cyg_ucount16 /* len */,
|
725 |
|
|
cyg_fb_colour);
|
726 |
|
|
extern void cyg_fb_linear_write_vline_2LE( cyg_fb*,
|
727 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
728 |
|
|
cyg_ucount16 /* len */,
|
729 |
|
|
cyg_fb_colour);
|
730 |
|
|
extern void cyg_fb_linear_write_vline_2BE( cyg_fb*,
|
731 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
732 |
|
|
cyg_ucount16 /* len */,
|
733 |
|
|
cyg_fb_colour);
|
734 |
|
|
extern void cyg_fb_linear_write_vline_4LE( cyg_fb*,
|
735 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
736 |
|
|
cyg_ucount16 /* len */,
|
737 |
|
|
cyg_fb_colour);
|
738 |
|
|
extern void cyg_fb_linear_write_vline_4BE( cyg_fb*,
|
739 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
740 |
|
|
cyg_ucount16 /* len */,
|
741 |
|
|
cyg_fb_colour);
|
742 |
|
|
extern void cyg_fb_linear_write_vline_8( cyg_fb*,
|
743 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
744 |
|
|
cyg_ucount16 /* len */,
|
745 |
|
|
cyg_fb_colour);
|
746 |
|
|
extern void cyg_fb_linear_write_vline_16( cyg_fb*,
|
747 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
748 |
|
|
cyg_ucount16 /* len */,
|
749 |
|
|
cyg_fb_colour);
|
750 |
|
|
extern void cyg_fb_linear_write_vline_32( cyg_fb*,
|
751 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
752 |
|
|
cyg_ucount16 /* len */,
|
753 |
|
|
cyg_fb_colour);
|
754 |
|
|
|
755 |
|
|
extern void cyg_fb_linear_fill_block_1LE( cyg_fb*,
|
756 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
757 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
758 |
|
|
cyg_fb_colour);
|
759 |
|
|
extern void cyg_fb_linear_fill_block_1BE( cyg_fb*,
|
760 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
761 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
762 |
|
|
cyg_fb_colour);
|
763 |
|
|
extern void cyg_fb_linear_fill_block_2LE( cyg_fb*,
|
764 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
765 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
766 |
|
|
cyg_fb_colour);
|
767 |
|
|
extern void cyg_fb_linear_fill_block_2BE( cyg_fb*,
|
768 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
769 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
770 |
|
|
cyg_fb_colour);
|
771 |
|
|
extern void cyg_fb_linear_fill_block_4LE( cyg_fb*,
|
772 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
773 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
774 |
|
|
cyg_fb_colour);
|
775 |
|
|
extern void cyg_fb_linear_fill_block_4BE( cyg_fb*,
|
776 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
777 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
778 |
|
|
cyg_fb_colour);
|
779 |
|
|
extern void cyg_fb_linear_fill_block_8( cyg_fb*,
|
780 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
781 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
782 |
|
|
cyg_fb_colour);
|
783 |
|
|
extern void cyg_fb_linear_fill_block_16( cyg_fb*,
|
784 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
785 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
786 |
|
|
cyg_fb_colour);
|
787 |
|
|
extern void cyg_fb_linear_fill_block_32( cyg_fb*,
|
788 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
789 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
790 |
|
|
cyg_fb_colour);
|
791 |
|
|
|
792 |
|
|
extern void cyg_fb_linear_write_block_1LE( cyg_fb*,
|
793 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
794 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
795 |
|
|
const void* /* source */,
|
796 |
|
|
cyg_ucount16 /* offset */, cyg_ucount16 /* stride */);
|
797 |
|
|
extern void cyg_fb_linear_write_block_1BE( cyg_fb*,
|
798 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
799 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
800 |
|
|
const void* /* source */,
|
801 |
|
|
cyg_ucount16 /* offset */, cyg_ucount16 /* stride */);
|
802 |
|
|
extern void cyg_fb_linear_write_block_2LE( cyg_fb*,
|
803 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
804 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
805 |
|
|
const void* /* source */,
|
806 |
|
|
cyg_ucount16 /* offset */, cyg_ucount16 /* stride */);
|
807 |
|
|
|
808 |
|
|
extern void cyg_fb_linear_write_block_2BE( cyg_fb*,
|
809 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
810 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
811 |
|
|
const void* /* source */,
|
812 |
|
|
cyg_ucount16 /* offset */, cyg_ucount16 /* stride */);
|
813 |
|
|
extern void cyg_fb_linear_write_block_4LE( cyg_fb*,
|
814 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
815 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
816 |
|
|
const void* /* source */,
|
817 |
|
|
cyg_ucount16 /* offset */, cyg_ucount16 /* stride */);
|
818 |
|
|
extern void cyg_fb_linear_write_block_4BE( cyg_fb*,
|
819 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
820 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
821 |
|
|
const void* /* source */,
|
822 |
|
|
cyg_ucount16 /* offset */, cyg_ucount16 /* stride */);
|
823 |
|
|
extern void cyg_fb_linear_write_block_8( cyg_fb*,
|
824 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
825 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
826 |
|
|
const void* /* source */,
|
827 |
|
|
cyg_ucount16 /* offset */, cyg_ucount16 /* stride */);
|
828 |
|
|
extern void cyg_fb_linear_write_block_16( cyg_fb*,
|
829 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
830 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
831 |
|
|
const void* /* source */,
|
832 |
|
|
cyg_ucount16 /* offset */, cyg_ucount16 /* stride */);
|
833 |
|
|
extern void cyg_fb_linear_write_block_32( cyg_fb*,
|
834 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
835 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
836 |
|
|
const void* /* source */,
|
837 |
|
|
cyg_ucount16 /* offset */, cyg_ucount16 /* stride */);
|
838 |
|
|
|
839 |
|
|
extern void cyg_fb_linear_read_block_1LE( cyg_fb*,
|
840 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
841 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
842 |
|
|
void* /* dest */,
|
843 |
|
|
cyg_ucount16 /* offset */, cyg_ucount16 /* stride */);
|
844 |
|
|
extern void cyg_fb_linear_read_block_1BE( cyg_fb*,
|
845 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
846 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
847 |
|
|
void* /* dest */,
|
848 |
|
|
cyg_ucount16 /* offset */, cyg_ucount16 /* stride */);
|
849 |
|
|
extern void cyg_fb_linear_read_block_2LE( cyg_fb*,
|
850 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
851 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
852 |
|
|
void* /* dest */,
|
853 |
|
|
cyg_ucount16 /* offset */, cyg_ucount16 /* stride */);
|
854 |
|
|
extern void cyg_fb_linear_read_block_2BE( cyg_fb*,
|
855 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
856 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
857 |
|
|
void* /* dest */,
|
858 |
|
|
cyg_ucount16 /* offset */, cyg_ucount16 /* stride */);
|
859 |
|
|
extern void cyg_fb_linear_read_block_4LE( cyg_fb*,
|
860 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
861 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
862 |
|
|
void* /* dest */,
|
863 |
|
|
cyg_ucount16 /* offset */, cyg_ucount16 /* stride */);
|
864 |
|
|
extern void cyg_fb_linear_read_block_4BE( cyg_fb*,
|
865 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
866 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
867 |
|
|
void* /* dest */,
|
868 |
|
|
cyg_ucount16 /* offset */, cyg_ucount16 /* stride */);
|
869 |
|
|
extern void cyg_fb_linear_read_block_8( cyg_fb*,
|
870 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
871 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
872 |
|
|
void* /* dest */,
|
873 |
|
|
cyg_ucount16 /* offset */, cyg_ucount16 /* stride */);
|
874 |
|
|
extern void cyg_fb_linear_read_block_16( cyg_fb*,
|
875 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
876 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
877 |
|
|
void* /* dest */,
|
878 |
|
|
cyg_ucount16 /* offset */, cyg_ucount16 /* stride */);
|
879 |
|
|
extern void cyg_fb_linear_read_block_32( cyg_fb*,
|
880 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
881 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
882 |
|
|
void* /* dest */,
|
883 |
|
|
cyg_ucount16 /* offset */, cyg_ucount16 /* stride */);
|
884 |
|
|
|
885 |
|
|
extern void cyg_fb_linear_move_block_1LE( cyg_fb*,
|
886 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
887 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
888 |
|
|
cyg_ucount16 /* new_x */, cyg_ucount16 /* new_y */);
|
889 |
|
|
extern void cyg_fb_linear_move_block_1BE( cyg_fb*,
|
890 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
891 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
892 |
|
|
cyg_ucount16 /* new_x */, cyg_ucount16 /* new_y */);
|
893 |
|
|
extern void cyg_fb_linear_move_block_2LE( cyg_fb*,
|
894 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
895 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
896 |
|
|
cyg_ucount16 /* new_x */, cyg_ucount16 /* new_y */);
|
897 |
|
|
extern void cyg_fb_linear_move_block_2BE( cyg_fb*,
|
898 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
899 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
900 |
|
|
cyg_ucount16 /* new_x */, cyg_ucount16 /* new_y */);
|
901 |
|
|
extern void cyg_fb_linear_move_block_4LE( cyg_fb*,
|
902 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
903 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
904 |
|
|
cyg_ucount16 /* new_x */, cyg_ucount16 /* new_y */);
|
905 |
|
|
extern void cyg_fb_linear_move_block_4BE( cyg_fb*,
|
906 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
907 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
908 |
|
|
cyg_ucount16 /* new_x */, cyg_ucount16 /* new_y */);
|
909 |
|
|
extern void cyg_fb_linear_move_block_8( cyg_fb*,
|
910 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
911 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
912 |
|
|
cyg_ucount16 /* new_x */, cyg_ucount16 /* new_y */);
|
913 |
|
|
extern void cyg_fb_linear_move_block_16( cyg_fb*,
|
914 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
915 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
916 |
|
|
cyg_ucount16 /* new_x */, cyg_ucount16 /* new_y */);
|
917 |
|
|
extern void cyg_fb_linear_move_block_32( cyg_fb*,
|
918 |
|
|
cyg_ucount16 /* x */, cyg_ucount16 /* y */,
|
919 |
|
|
cyg_ucount16 /* width */, cyg_ucount16 /* height */,
|
920 |
|
|
cyg_ucount16 /* new_x */, cyg_ucount16 /* new_y */);
|
921 |
|
|
|
922 |
|
|
// ----------------------------------------------------------------------------
|
923 |
|
|
// Dummy implementations of various device functions
|
924 |
|
|
|
925 |
|
|
extern int cyg_fb_nop_on(cyg_fb*);
|
926 |
|
|
extern int cyg_fb_nop_off(cyg_fb*);
|
927 |
|
|
extern int cyg_fb_nop_ioctl(cyg_fb*, cyg_uint16, void*, size_t*);
|
928 |
|
|
extern void cyg_fb_nop_synch(cyg_fb*, cyg_ucount16);
|
929 |
|
|
extern void cyg_fb_nop_write_palette(cyg_fb*, cyg_ucount32, cyg_ucount32, const void*, cyg_ucount16);
|
930 |
|
|
extern void cyg_fb_nop_read_palette( cyg_fb*, cyg_ucount32, cyg_ucount32, void*);
|
931 |
|
|
extern cyg_fb_colour cyg_fb_nop_make_colour(cyg_fb*, cyg_ucount8, cyg_ucount8, cyg_ucount8);
|
932 |
|
|
extern cyg_fb_colour cyg_fb_nop_make_color(cyg_fb*, cyg_ucount8, cyg_ucount8, cyg_ucount8);
|
933 |
|
|
extern void cyg_fb_nop_break_colour(cyg_fb*, cyg_fb_colour, cyg_ucount8*, cyg_ucount8*, cyg_ucount8*);
|
934 |
|
|
extern void cyg_fb_nop_break_color(cyg_fb*, cyg_fb_colour, cyg_ucount8*, cyg_ucount8*, cyg_ucount8*);
|
935 |
|
|
|
936 |
|
|
// ----------------------------------------------------------------------------
|
937 |
|
|
// Standard palettes. The generic framebuffer package provides EGA and VGA
|
938 |
|
|
// palettes.
|
939 |
|
|
extern const cyg_uint8 cyg_fb_palette_ega[16 * 3];
|
940 |
|
|
extern const cyg_uint8 cyg_fb_palette_vga[256 * 3];
|
941 |
|
|
|
942 |
|
|
#define CYG_FB_DEFAULT_PALETTE_BLACK 0x00
|
943 |
|
|
#define CYG_FB_DEFAULT_PALETTE_BLUE 0x01
|
944 |
|
|
#define CYG_FB_DEFAULT_PALETTE_GREEN 0x02
|
945 |
|
|
#define CYG_FB_DEFAULT_PALETTE_CYAN 0x03
|
946 |
|
|
#define CYG_FB_DEFAULT_PALETTE_RED 0x04
|
947 |
|
|
#define CYG_FB_DEFAULT_PALETTE_MAGENTA 0x05
|
948 |
|
|
#define CYG_FB_DEFAULT_PALETTE_BROWN 0x06
|
949 |
|
|
#define CYG_FB_DEFAULT_PALETTE_LIGHTGREY 0x07
|
950 |
|
|
#define CYG_FB_DEFAULT_PALETTE_LIGHTGRAY 0x07
|
951 |
|
|
#define CYG_FB_DEFAULT_PALETTE_DARKGREY 0x08
|
952 |
|
|
#define CYG_FB_DEFAULT_PALETTE_DARKGRAY 0x08
|
953 |
|
|
#define CYG_FB_DEFAULT_PALETTE_LIGHTBLUE 0x09
|
954 |
|
|
#define CYG_FB_DEFAULT_PALETTE_LIGHTGREEN 0x0A
|
955 |
|
|
#define CYG_FB_DEFAULT_PALETTE_LIGHTCYAN 0x0B
|
956 |
|
|
#define CYG_FB_DEFAULT_PALETTE_LIGHTRED 0x0C
|
957 |
|
|
#define CYG_FB_DEFAULT_PALETTE_LIGHTMAGENTA 0x0D
|
958 |
|
|
#define CYG_FB_DEFAULT_PALETTE_YELLOW 0x0E
|
959 |
|
|
#define CYG_FB_DEFAULT_PALETTE_WHITE 0x0F
|
960 |
|
|
|
961 |
|
|
// ----------------------------------------------------------------------------
|
962 |
|
|
// Support for some common true colour modes
|
963 |
|
|
#define CYG_FB_MAKE_COLOUR_8BPP_TRUE_332(_r_, _g_, _b_) \
|
964 |
|
|
({ cyg_fb_colour _colour_; \
|
965 |
|
|
_colour_ = ((((_r_) & 0x00E0) >> 0) | (((_g_) & 0x00E0) >> 3) | (((_b_) & 0x00C0) >> 6)); \
|
966 |
|
|
_colour_; })
|
967 |
|
|
|
968 |
|
|
#define CYG_FB_BREAK_COLOUR_8BPP_TRUE_332(_colour_, _r_, _g_, _b_ ) \
|
969 |
|
|
CYG_MACRO_START \
|
970 |
|
|
*(_r_) = ((_colour_) << 0) & 0x00E0; \
|
971 |
|
|
*(_g_) = ((_colour_) << 3) & 0x00E0; \
|
972 |
|
|
*(_g_) = ((_colour_) << 6) & 0x00C0; \
|
973 |
|
|
CYG_MACRO_END
|
974 |
|
|
|
975 |
|
|
#define CYG_FB_MAKE_COLOUR_16BPP_TRUE_565(_r_, _g_, _b_) \
|
976 |
|
|
({ ((((_r_) & 0x00F8) << 8) | (((_g_) & 0x00FC) << 3) | (((_b_) & 0x00F8) >> 3)); })
|
977 |
|
|
|
978 |
|
|
#define CYG_FB_BREAK_COLOUR_16BPP_TRUE_565(_colour_, _r_, _g_, _b_) \
|
979 |
|
|
CYG_MACRO_START \
|
980 |
|
|
*(_r_) = ((_colour_) >> 8) & 0x00F8; \
|
981 |
|
|
*(_g_) = ((_colour_) >> 3) & 0x00FC; \
|
982 |
|
|
*(_b_) = ((_colour_) << 3) & 0x00F8; \
|
983 |
|
|
CYG_MACRO_END
|
984 |
|
|
|
985 |
|
|
#define CYG_FB_MAKE_COLOUR_16BPP_TRUE_555(_r_, _g_, _b_) \
|
986 |
|
|
({ ((((_r_) & 0x00F8) << 7) | (((_g_) & 0x00F8) << 2) | (((_b_) & 0x00F8) >> 3)); })
|
987 |
|
|
|
988 |
|
|
#define CYG_FB_BREAK_COLOUR_16BPP_TRUE_555(_colour_, _r_, _g_, _b_) \
|
989 |
|
|
CYG_MACRO_START \
|
990 |
|
|
*(_r_) = ((_colour_) >> 7) & 0x00F8; \
|
991 |
|
|
*(_g_) = ((_colour_) >> 2) & 0x00F8; \
|
992 |
|
|
*(_b_) = ((_colour_) << 3) & 0x00F8; \
|
993 |
|
|
CYG_MACRO_END
|
994 |
|
|
|
995 |
|
|
#define CYG_FB_MAKE_COLOUR_32BPP_TRUE_0888(_r_, _g_, _b_) \
|
996 |
|
|
({ (((_r_) << 16) | ((_g_) << 8) | (_b_)); })
|
997 |
|
|
|
998 |
|
|
#define CYG_FB_BREAK_COLOUR_32BPP_TRUE_0888(_colour_, _r_, _g_, _b_) \
|
999 |
|
|
CYG_MACRO_START \
|
1000 |
|
|
*(_r_) = ((_colour_) >> 16) & 0x00FF; \
|
1001 |
|
|
*(_g_) = ((_colour_) >> 8) & 0x00FF; \
|
1002 |
|
|
*(_b_) = ((_colour_) ) & 0x00FF; \
|
1003 |
|
|
CYG_MACRO_END
|
1004 |
|
|
|
1005 |
|
|
extern cyg_fb_colour cyg_fb_dev_make_colour_8bpp_true_332(cyg_fb*, cyg_ucount8, cyg_ucount8, cyg_ucount8);
|
1006 |
|
|
extern void cyg_fb_dev_break_colour_8bpp_true_332(cyg_fb*, cyg_fb_colour, cyg_ucount8*, cyg_ucount8*, cyg_ucount8*);
|
1007 |
|
|
extern cyg_fb_colour cyg_fb_dev_make_colour_16bpp_true_565(cyg_fb*, cyg_ucount8, cyg_ucount8, cyg_ucount8);
|
1008 |
|
|
extern void cyg_fb_dev_break_colour_16bpp_true_565(cyg_fb*, cyg_fb_colour, cyg_ucount8*, cyg_ucount8*, cyg_ucount8*);
|
1009 |
|
|
extern cyg_fb_colour cyg_fb_dev_make_colour_16bpp_true_555(cyg_fb*, cyg_ucount8, cyg_ucount8, cyg_ucount8);
|
1010 |
|
|
extern void cyg_fb_dev_break_colour_16bpp_true_555(cyg_fb*, cyg_fb_colour, cyg_ucount8*, cyg_ucount8*, cyg_ucount8*);
|
1011 |
|
|
extern cyg_fb_colour cyg_fb_dev_make_colour_32bpp_true_0888(cyg_fb*, cyg_ucount8, cyg_ucount8, cyg_ucount8);
|
1012 |
|
|
extern void cyg_fb_dev_break_colour_32bpp_true_0888(cyg_fb*, cyg_fb_colour, cyg_ucount8*, cyg_ucount8*, cyg_ucount8*);
|
1013 |
|
|
|
1014 |
|
|
// ----------------------------------------------------------------------------
|
1015 |
|
|
// A custom build step combines all the header files from the various
|
1016 |
|
|
// framebuffer devices (usually just one) into a single header. This
|
1017 |
|
|
// makes it easier for portable higher-level code to work with
|
1018 |
|
|
// whatever devices happen to be available.
|
1019 |
|
|
#include <cyg/io/framebufs/framebufs.h>
|
1020 |
|
|
|
1021 |
|
|
//-----------------------------------------------------------------------------
|
1022 |
|
|
#ifdef __cplusplus
|
1023 |
|
|
} /* extern "C" */
|
1024 |
|
|
#endif
|
1025 |
|
|
|
1026 |
|
|
#endif // ifndef CYGONCE_IO_FRAMEBUF_H
|
1027 |
|
|
// End of framebuf.h
|