OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [io/] [framebuf/] [current/] [include/] [framebuf.inl] - Blame information for rev 825

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#include 
2
#ifndef CYGONCE_IO_FRAMEBUF_INL
3
#define CYGONCE_IO_FRAMEBUF_INL
4
 
5
//=============================================================================
6
//
7
//      framebuf.inl
8
//
9
//      Inline functions for manipulating linear framebuffers
10
//
11
//=============================================================================
12
// ####ECOSGPLCOPYRIGHTBEGIN####
13
// -------------------------------------------
14
// This file is part of eCos, the Embedded Configurable Operating System.
15
// Copyright (C) 2008 Free Software Foundation, Inc.
16
//
17
// eCos is free software; you can redistribute it and/or modify it under
18
// the terms of the GNU General Public License as published by the Free
19
// Software Foundation; either version 2 or (at your option) any later
20
// version.
21
//
22
// eCos is distributed in the hope that it will be useful, but WITHOUT
23
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
24
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
25
// for more details.
26
//
27
// You should have received a copy of the GNU General Public License
28
// along with eCos; if not, write to the Free Software Foundation, Inc.,
29
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
30
//
31
// As a special exception, if other files instantiate templates or use
32
// macros or inline functions from this file, or you compile this file
33
// and link it with other works to produce a work based on this file,
34
// this file does not by itself cause the resulting work to be covered by
35
// the GNU General Public License. However the source code for this file
36
// must still be made available in accordance with section (3) of the GNU
37
// General Public License v2.
38
//
39
// This exception does not invalidate any other reasons why a work based
40
// on this file might be covered by the GNU General Public License.
41
// -------------------------------------------
42
// ####ECOSGPLCOPYRIGHTEND####
43
//=============================================================================
44
//####DESCRIPTIONBEGIN####
45
//
46
// Author(s):   bartv
47
// Date:        2005-03-29
48
//####DESCRIPTIONEND####
49
//=============================================================================
50
 
51
// There are numerous ways of implementing the functions in this file.
52
// For example for depths >= 8 many operations can be performed using
53
// memset()/memcpy()/memmove(), or
54
// __builtin_memset()/__builtin_memcpy()/ memmove(), or by explicit
55
// direct accesses to framebuffer memory. The first of these can be
56
// discarded because the builtins are never worse than explicit
57
// function calls. The choice between the builtins and direct accesses
58
// is not so clear. On the one hand the library functions may well
59
// involve architecture-specific optimizations. On the other hand
60
// function calls are not free. This decision really needs to be taken
61
// on a per-architecture basis after careful measurements.
62
//
63
// A similar question arises regarding the handling of row numbers.
64
// One implementation involves multiplying by the width. Another
65
// involves keeping a table of pointers to the start of each row,
66
// avoiding a multiplication but adding a memory access. Again the
67
// trade off is not immediately obvious.
68
//
69
// For direct accesses the bus width is an issue. Typically the frame
70
// buffer will not be cached so the framebuffer memory accesses will
71
// account for much of the inner loop. For now 32-bit accesses are
72
// preferred. If the target has h/w support for 64-bit accesses that
73
// would improve performance, at the cost of extra code to handle
74
// alignments. If the video device is accessed via a 16-bit bus then
75
// it is assumed that the h/w will fix up 32->16 bit accesses faster
76
// than any s/w workaround.
77
//
78
// For now the code prefers builtins and multiplies.
79
 
80
#ifdef __cplusplus
81
extern "C" {
82
#endif
83
 
84
// ----------------------------------------------------------------------------
85
// Macro definitions for the pixel manipulation.
86
// Little-endian means pixel 0 occupies bit 0 within a byte
87
// Big-endian means pixel 0 occupies bit 7
88
#define CYG_FB_PIXELx_VARx_1LE(  _fb_, _id_)
89
#define CYG_FB_PIXELx_SETx_1LE(  _fb_, _id_, _fbaddr_, _stride_, _x_, _y_)
90
#define CYG_FB_PIXELx_GETx_1LE(  _fb_, _id_, _fbaddr_, _stride_, _x_ ,_y_)
91
#define CYG_FB_PIXELx_ADDx_1LE(  _fb_, _id_, _stride_, _incr_)
92
#define CYG_FB_PIXELx_ADDx_1LE(  _fb_, _id_, _stride_, _incr_)
93
#define CYG_FB_PIXELx_WRITEx_1LE(_fb_, _id_, _colour_)
94
#define CYG_FB_PIXELx_READx_1LE( _fb_, _id_)
95
#define CYG_FB_PIXELx_FLUSHABS_1LE(_fb_, _which_, _x0_, _y0_, _x1_, _y1_)
96
#define CYG_FB_PIXELx_FLUSHREL_1LE(_fb_, _which_, _x0_, _y0_, _dx_, _dy_)
97
 
98
#define CYG_FB_PIXELx_VARx_1BE(  _fb_, _id_)
99
#define CYG_FB_PIXELx_SETx_1BE(  _fb_, _id_, _fbaddr_, _stride_, _x_, _y_)
100
#define CYG_FB_PIXELx_GETx_1BE(  _fb_, _id_, _fbaddr_, _stride_, _x_ ,_y_)
101
#define CYG_FB_PIXELx_ADDXx_1BE( _fb_, _id_, _stride_, _incr_)
102
#define CYG_FB_PIXELx_ADDYx_1BE( _fb_, _id_, _stride_, _incr_)
103
#define CYG_FB_PIXELx_WRITEx_1BE(_fb_, _id_, _colour_)
104
#define CYG_FB_PIXELx_READx_1BE( _fb_, _id_)
105
#define CYG_FB_PIXELx_FLUSHABS_1BE(_fb_, _which_, _x0_, _y0_, _x1_, _y1_)
106
#define CYG_FB_PIXELx_FLUSHREL_1BE(_fb_, _which_, _x0_, _y0_, _dx_, _dy_)
107
 
108
#define CYG_FB_PIXELx_VARx_2LE(  _fb_, _id_, _which_)
109
#define CYG_FB_PIXELx_SETx_2LE(  _fb_, _id_, _fbaddr_, _stride_, _x_, _y_)
110
#define CYG_FB_PIXELx_GETx_2LE(  _fb_, _id_, _fbaddr_, _stride_, _x_ ,_y_)
111
#define CYG_FB_PIXELx_ADDx_2LE(  _fb_, _id_, _stride_, _incr_)
112
#define CYG_FB_PIXELx_ADDx_2LE(  _fb_, _id_, _stride_, _incr_)
113
#define CYG_FB_PIXELx_WRITEx_2LE(_fb_, _id_, _colour_)
114
#define CYG_FB_PIXELx_READx_2LE( _fb_, _id_)
115
#define CYG_FB_PIXELx_FLUSHABS_2LE(_fb_, _which_, _x0_, _y0_, _x1_, _y1_)
116
#define CYG_FB_PIXELx_FLUSHREL_2LE(_fb_, _which_, _x0_, _y0_, _dx_, _dy_)
117
 
118
#define CYG_FB_PIXELx_VARx_2BE(  _fb_, _id_)
119
#define CYG_FB_PIXELx_SETx_2BE(  _fb_, _id_, _fbaddr_, _stride_, _x_, _y_)
120
#define CYG_FB_PIXELx_GETx_2BE(  _fb_, _id_, _fbaddr_, _stride_, _x_ ,_y_)
121
#define CYG_FB_PIXELx_ADDXx_2BE( _fb_, _id_, _stride_, _incr_)
122
#define CYG_FB_PIXELx_ADDYx_2BE( _fb_, _id_, _stride_, _incr_)
123
#define CYG_FB_PIXELx_WRITEx_2BE(_fb_, _id_, _colour_)
124
#define CYG_FB_PIXELx_READx_2BE( _fb_, _id_)
125
#define CYG_FB_PIXELx_FLUSHABS_2BE(_fb_, _which_, _x0_, _y0_, _x1_, _y1_)
126
#define CYG_FB_PIXELx_FLUSHREL_2BE(_fb_, _which_, _x0_, _y0_, _dx_, _dy_)
127
 
128
#define CYG_FB_PIXELx_VARx_4LE(  _fb_, _id_, _which_)
129
#define CYG_FB_PIXELx_SETx_4LE(  _fb_, _id_, _fbaddr_, _stride_, _x_, _y_)
130
#define CYG_FB_PIXELx_GETx_4LE(  _fb_, _id_, _fbaddr_, _stride_, _x_ ,_y_)
131
#define CYG_FB_PIXELx_ADDx_4LE(  _fb_, _id_, _stride_, _incr_)
132
#define CYG_FB_PIXELx_ADDx_4LE(  _fb_, _id_, _stride_, _incr_)
133
#define CYG_FB_PIXELx_WRITEx_4LE(_fb_, _id_, _colour_)
134
#define CYG_FB_PIXELx_READx_4LE( _fb_, _id_)
135
#define CYG_FB_PIXELx_FLUSHABS_4LE(_fb_, _which_, _x0_, _y0_, _x1_, _y1_)
136
#define CYG_FB_PIXELx_FLUSHREL_4LE(_fb_, _which_, _x0_, _y0_, _dx_, _dy_)
137
 
138
#define CYG_FB_PIXELx_VARx_4BE(  _fb_, _id_)
139
#define CYG_FB_PIXELx_SETx_4BE(  _fb_, _id_, _fbaddr_, _stride_, _x_, _y_)
140
#define CYG_FB_PIXELx_GETx_4BE(  _fb_, _id_, _fbaddr_, _stride_, _x_ ,_y_)
141
#define CYG_FB_PIXELx_ADDXx_4BE( _fb_, _id_, _stride_, _incr_)
142
#define CYG_FB_PIXELx_ADDYx_4BE( _fb_, _id_, _stride_, _incr_)
143
#define CYG_FB_PIXELx_WRITEx_4BE(_fb_, _id_, _colour_)
144
#define CYG_FB_PIXELx_READx_4BE( _fb_, _id_)
145
#define CYG_FB_PIXELx_FLUSHABS_4BE(_fb_, _which_, _x0_, _y0_, _x1_, _y1_)
146
#define CYG_FB_PIXELx_FLUSHREL_4BE(_fb_, _which_, _x0_, _y0_, _dx_, _dy_)
147
 
148
 
149
// ----------------------------------------------------------------------------
150
#define CYG_FB_PIXELx_VAR_8(_fb_, _which_)    cyg_uint8*  _cyg_fb_pixelpos8_ ## _fb_ ## _which_
151
#define CYG_FB_PIXELx_SET_8(_fb_, _which_, _fbaddr_, _stride_, _x_, _y_)            \
152
    CYG_MACRO_START                                                                 \
153
    _cyg_fb_pixelpos8_ ## _fb_ ## _which_  = (cyg_uint8*)_fbaddr_;                  \
154
    _cyg_fb_pixelpos8_ ## _fb_ ## _which_ += ((_stride_) * (_y_));                  \
155
    _cyg_fb_pixelpos8_ ## _fb_ ## _which_ += (_x_);                                 \
156
    CYG_MACRO_END
157
 
158
#define CYG_FB_PIXELx_GET_8(_fb_, _which_, _fbaddr_, _stride_, _x_ ,_y_)            \
159
    CYG_MACRO_START                                                                 \
160
    cyg_uint32 _offset_;                                                            \
161
    _offset_ = (_cyg_fb_pixelpos8_ ## _fb_ ## _which_) - (cyg_uint8*)(_fbaddr_);    \
162
    _y_ = _offset_ / (_stride_);                                                    \
163
    _x_ = _offset_ % (_stride_);                                                    \
164
    CYG_MACRO_END
165
 
166
#define CYG_FB_PIXELx_ADDX_8(_fb_, _which_, _stride_, _incr_)                       \
167
    CYG_MACRO_START                                                                 \
168
    _cyg_fb_pixelpos8_ ## _fb_ ## _which_ += (_incr_);                              \
169
    CYG_MACRO_END
170
 
171
#define CYG_FB_PIXELx_ADDY_8(_fb_, _which_, _stride_, _incr_)                       \
172
    CYG_MACRO_START                                                                 \
173
    _cyg_fb_pixelpos8_ ## _fb_ ## _which_ += ((_incr_) * (_stride_));               \
174
    CYG_MACRO_END
175
 
176
#define CYG_FB_PIXELx_WRITE_8(_fb_, _which_, _colour_)                              \
177
    CYG_MACRO_START                                                                 \
178
    * _cyg_fb_pixelpos8_ ## _fb_ ## _which_ = (_colour_);                           \
179
    CYG_MACRO_END
180
 
181
#define CYG_FB_PIXELx_READ_8(_fb_, _which_) ({ * _cyg_fb_pixelpos8_ ## _fb_ ## _which_; })
182
 
183
#define CYG_FB_PIXELx_FLUSHABS_8(_fb_, _which_, _x0_, _y0_, _x1_, _y1_)             \
184
    CYG_MACRO_START                                                                 \
185
    CYG_MACRO_END
186
 
187
#define CYG_FB_PIXELx_FLUSHREL_8(_fb_, _which_, _x0_, _y0_, _dx_, _dy_)             \
188
    CYG_MACRO_START                                                                 \
189
    CYG_MACRO_END
190
 
191
// ----------------------------------------------------------------------------
192
#define CYG_FB_PIXELx_VAR_16(_fb_, _which_)    cyg_uint16*  _cyg_fb_pixelpos16_ ## _fb_ ## _which_
193
#define CYG_FB_PIXELx_SET_16(_fb_, _which_, _fbaddr_, _stride8_, _x_, _y_)                                              \
194
    CYG_MACRO_START                                                                                                     \
195
    _cyg_fb_pixelpos16_ ## _fb_ ## _which_  = ((cyg_uint16*)(((cyg_uint8*)_fbaddr_) + ((_stride8_) * (_y_)))) + (_x_);  \
196
    CYG_MACRO_END
197
 
198
#define CYG_FB_PIXELx_GET_16(_fb_, _which_, _fbaddr_, _stride8_, _x_ ,_y_)          \
199
    CYG_MACRO_START                                                                 \
200
    cyg_ucount16 _stride_ = (_stride8_) >> 1;                                       \
201
    cyg_uint32   _offset_;                                                          \
202
    _offset_ = (_cyg_fb_pixelpos16_ ## _fb_ ## _which_) - (cyg_uint16*)(_fbaddr_);  \
203
    _y_ = _offset_ / (_stride_);                                                    \
204
    _x_ = _offset_ % (_stride_);                                                    \
205
    CYG_MACRO_END
206
 
207
#define CYG_FB_PIXELx_ADDX_16(_fb_, _which_, _stride8_, _incr_)                     \
208
    CYG_MACRO_START                                                                 \
209
    _cyg_fb_pixelpos16_ ## _fb_ ## _which_ += (_incr_);                             \
210
    CYG_MACRO_END
211
 
212
#define CYG_FB_PIXELx_ADDY_16(_fb_, _which_, _stride8_, _incr_)                     \
213
    CYG_MACRO_START                                                                 \
214
    _cyg_fb_pixelpos16_ ## _fb_ ## _which_ += ((_incr_) * ((_stride8_) >> 1));      \
215
    CYG_MACRO_END
216
 
217
#define CYG_FB_PIXELx_WRITE_16(_fb_, _which_, _colour_)                             \
218
    CYG_MACRO_START                                                                 \
219
    * _cyg_fb_pixelpos16_ ## _fb_ ## _which_ = (_colour_);                          \
220
    CYG_MACRO_END
221
 
222
#define CYG_FB_PIXELx_READ_16(_fb_, _which_)                                        \
223
    ({ * _cyg_fb_pixelpos16_ ## _fb_ ## _which_; })
224
 
225
#define CYG_FB_PIXELx_FLUSHABS_16(_fb_, _which_, _x0_, _y0_, _x1_, _y1_)            \
226
    CYG_MACRO_START                                                                 \
227
    CYG_MACRO_END
228
 
229
#define CYG_FB_PIXELx_FLUSHREL_16(_fb_, _which_, _x0_, _y0_, _dx_, _dy_)            \
230
    CYG_MACRO_START                                                                 \
231
    CYG_MACRO_END
232
 
233
// ----------------------------------------------------------------------------
234
#define CYG_FB_PIXELx_VAR_32(_fb_, _which_)    cyg_uint32*  _cyg_fb_pixelpos32_ ## _fb_ ## _which_
235
#define CYG_FB_PIXELx_SET_32(_fb_, _which_, _fbaddr_, _stride8_, _x_, _y_)                                              \
236
    CYG_MACRO_START                                                                                                     \
237
    _cyg_fb_pixelpos32_ ## _fb_ ## _which_  = ((cyg_uint32*)(((cyg_uint8*)_fbaddr_) + ((_stride8_) * (_y_)))) + (_x_);  \
238
    CYG_MACRO_END
239
 
240
#define CYG_FB_PIXELx_GET_32(_fb_, _which_, _fbaddr_, _stride8_, _x_ ,_y_)          \
241
    CYG_MACRO_START                                                                 \
242
    cyg_ucount16 _stride_ = (_stride8_) >> 2;                                       \
243
    cyg_uint32   _offset_;                                                          \
244
    _offset_ = (_cyg_fb_pixelpos32_ ## _fb_ ## _which_) - (cyg_uint32*)(_fbaddr_);  \
245
    _y_ = _offset_ / (_stride_);                                                    \
246
    _x_ = _offset_ % (_stride_);                                                    \
247
    CYG_MACRO_END
248
 
249
#define CYG_FB_PIXELx_ADDX_32(_fb_, _which_, _stride8_, _incr_)                     \
250
    CYG_MACRO_START                                                                 \
251
    _cyg_fb_pixelpos32_ ## _fb_ ## _which_ += (_incr_);                             \
252
    CYG_MACRO_END
253
 
254
#define CYG_FB_PIXELx_ADDY_32(_fb_, _which_, _stride8_, _incr_)                     \
255
    CYG_MACRO_START                                                                 \
256
    _cyg_fb_pixelpos32_ ## _fb_ ## _which_ += ((_incr_) * ((_stride8_) >> 2));      \
257
    CYG_MACRO_END
258
 
259
#define CYG_FB_PIXELx_WRITE_32(_fb_, _which_, _colour_)                             \
260
    CYG_MACRO_START                                                                 \
261
    * _cyg_fb_pixelpos32_ ## _fb_ ## _which_ = (_colour_);                          \
262
    CYG_MACRO_END
263
 
264
#define CYG_FB_PIXELx_READ_32(_fb_, _which_) ({ * _cyg_fb_pixelpos32_ ## _fb_ ## _which_; })
265
 
266
#define CYG_FB_PIXELx_FLUSHABS_32(_fb_, _which_, _x0_, _y0_, _x1_, _y1_)            \
267
    CYG_MACRO_START                                                                 \
268
    CYG_MACRO_END
269
 
270
#define CYG_FB_PIXELx_FLUSHREL_32(_fb_, _which_, _x0_, _y0_, _dx_, _dy_)            \
271
    CYG_MACRO_START                                                                 \
272
    CYG_MACRO_END
273
 
274
// ----------------------------------------------------------------------------
275
// Some of the functions could be speeded up by using 32-bit accesses
276
// instead of byte accesses, but that would introduce another endianness
277
// complication.
278
 
279
// The always_inline attribute must be a applied to a declaration, not a
280
// definition, so combine the two via a single macro.
281
#define CYG_FB_LINEAR_INLINE_FN(_type_, _name_, _args_)                     \
282
static __inline__ _type_ _name_ _args_ __attribute__((__always_inline__));  \
283
static __inline__ _type_ _name_ _args_
284
 
285
CYG_FB_LINEAR_INLINE_FN(void,
286
                        cyg_fb_linear_write_pixel_1LE_inl,
287
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_fb_colour _colour_))
288
{
289
    cyg_uint8*  _ptr8_  = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + (_x_ >> 3);
290
    cyg_uint8   _mask_  = 0x0001 << (_x_ & 0x07);
291
    if (_colour_) {
292
        *_ptr8_ |= _mask_;
293
    } else {
294
        *_ptr8_ &= ~_mask_;
295
    }
296
}
297
 
298
CYG_FB_LINEAR_INLINE_FN(void,
299
                        cyg_fb_linear_write_pixel_1BE_inl,
300
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_fb_colour _colour_))
301
{
302
    cyg_uint8*  _ptr8_  = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + (_x_ >> 3);
303
    cyg_uint8   _mask_  = 0x0080 >> (_x_ & 0x07);
304
    if (_colour_) {
305
        *_ptr8_ |= _mask_;
306
    } else {
307
        *_ptr8_ &= ~_mask_;
308
    }
309
}
310
 
311
CYG_FB_LINEAR_INLINE_FN(cyg_fb_colour,
312
                        cyg_fb_linear_read_pixel_1LE_inl,
313
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_))
314
{
315
    cyg_uint8*  _ptr8_  = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + (_x_ >> 3);
316
    cyg_uint8   _mask_  = 0x0001 << (_x_ & 0x07);
317
    return (*_ptr8_ & _mask_) ? 1 : 0;
318
}
319
 
320
CYG_FB_LINEAR_INLINE_FN(cyg_fb_colour,
321
                        cyg_fb_linear_read_pixel_1BE_inl,
322
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_))
323
{
324
    cyg_uint8*  _ptr8_  = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + (_x_ >> 3);
325
    cyg_uint8   _mask_  = 0x0080 >> (_x_ & 0x07);
326
    return (*_ptr8_ & _mask_) ? 1 : 0;
327
}
328
 
329
CYG_FB_LINEAR_INLINE_FN(void,
330
                        cyg_fb_linear_write_vline_1LE_inl,
331
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _len_, cyg_fb_colour _colour_))
332
{
333
    cyg_uint8*  _ptr8_  = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + (_x_ >> 3);
334
    cyg_uint8   _mask_  = 0x0001 << (_x_ & 0x07);
335
    if (_colour_) {
336
        for ( ; _len_; _len_--) {
337
            *_ptr8_ |= _mask_;
338
            _ptr8_  += _stride_;
339
        }
340
    } else {
341
        _mask_  = ~_mask_;
342
        for ( ; _len_; _len_--) {
343
            *_ptr8_ &= _mask_;
344
            _ptr8_  += _stride_;
345
        }
346
    }
347
}
348
 
349
CYG_FB_LINEAR_INLINE_FN(void,
350
                        cyg_fb_linear_write_vline_1BE_inl,
351
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _len_, cyg_fb_colour _colour_))
352
{
353
    cyg_uint8*  _ptr8_  = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + (_x_ >> 3);
354
    cyg_uint8   _mask_  = 0x0080 >> (_x_ & 0x07);
355
    if (_colour_) {
356
        for ( ; _len_; _len_--) {
357
            *_ptr8_ |= _mask_;
358
            _ptr8_  += _stride_;
359
        }
360
    } else {
361
        _mask_  = ~_mask_;
362
        for ( ; _len_; _len_--) {
363
            *_ptr8_ &= _mask_;
364
            _ptr8_  += _stride_;
365
        }
366
    }
367
}
368
 
369
// ----------------------------------------------------------------------------
370
 
371
CYG_FB_LINEAR_INLINE_FN(void,
372
                        cyg_fb_linear_write_pixel_2LE_inl,
373
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_fb_colour _colour_))
374
{
375
    cyg_uint8*  _ptr8_  = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + (_x_ >> 2);
376
    cyg_uint8   _shift_ = (_x_ & 0x03) << 1;
377
 
378
    *_ptr8_ = (*_ptr8_ & ~(0x03 << _shift_)) | (_colour_ << _shift_);
379
}
380
 
381
CYG_FB_LINEAR_INLINE_FN(void,
382
                        cyg_fb_linear_write_pixel_2BE_inl,
383
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_fb_colour _colour_))
384
{
385
    cyg_uint8*  _ptr8_  = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + (_x_ >> 2);
386
    cyg_uint8   _shift_ = 6 - ((_x_ & 0x03) << 1);
387
 
388
    *_ptr8_ = (*_ptr8_ & ~(0x03 << _shift_)) | (_colour_ << _shift_);
389
}
390
 
391
CYG_FB_LINEAR_INLINE_FN(cyg_fb_colour,
392
                        cyg_fb_linear_read_pixel_2LE_inl,
393
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_))
394
{
395
    cyg_uint8*  _ptr8_  = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + (_x_ >> 2);
396
    cyg_uint8   _shift_ = (_x_ & 0x03) << 1;
397
 
398
    return (*_ptr8_ >> _shift_) & 0x03;
399
}
400
 
401
CYG_FB_LINEAR_INLINE_FN(cyg_fb_colour,
402
                        cyg_fb_linear_read_pixel_2BE_inl,
403
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_))
404
{
405
    cyg_uint8*  _ptr8_  = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + (_x_ >> 2);
406
    cyg_uint8   _shift_ = 6 - ((_x_ & 0x03) << 1);
407
 
408
    return (*_ptr8_ >> _shift_) & 0x03;
409
}
410
 
411
CYG_FB_LINEAR_INLINE_FN(void,
412
                        cyg_fb_linear_write_vline_2LE_inl,
413
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _len_, cyg_fb_colour _colour_))
414
{
415
    cyg_uint8*  _ptr8_  = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + (_x_ >> 2);
416
    cyg_uint8   _shift_ = (_x_ & 0x03) << 1;
417
    cyg_uint8   _mask_  = ~(0x03 << _shift_);
418
    _colour_    <<= _shift_;
419
 
420
    for ( ; _len_; _len_--) {
421
        *_ptr8_  = (*_ptr8_ & _mask_) | _colour_;
422
        _ptr8_  += _stride_;
423
    }
424
}
425
 
426
CYG_FB_LINEAR_INLINE_FN(void,
427
                        cyg_fb_linear_write_vline_2BE_inl,
428
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _len_, cyg_fb_colour _colour_))
429
{
430
    cyg_uint8*  _ptr8_  = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + (_x_ >> 2);
431
    cyg_uint8   _shift_ = 6 - ((_x_ & 0x03) << 1);
432
    cyg_uint8   _mask_  = ~(0x03 << _shift_);
433
    _colour_    <<= _shift_;
434
 
435
    for ( ; _len_; _len_--) {
436
        *_ptr8_  = (*_ptr8_ & _mask_) | _colour_;
437
        _ptr8_  += _stride_;
438
    }
439
}
440
 
441
// ----------------------------------------------------------------------------
442
 
443
CYG_FB_LINEAR_INLINE_FN(void,
444
                        cyg_fb_linear_write_pixel_4LE_inl,
445
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_fb_colour _colour_))
446
{
447
    cyg_uint8*  _ptr8_  = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + (_x_ >> 1);
448
    if (_x_ & 0x01) {
449
        *_ptr8_ = (*_ptr8_ & 0x000F) | (_colour_ << 4);
450
    } else {
451
        *_ptr8_ = (*_ptr8_ & 0x00F0) | _colour_;
452
    }
453
}
454
 
455
CYG_FB_LINEAR_INLINE_FN(void,
456
                        cyg_fb_linear_write_pixel_4BE_inl,
457
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_fb_colour _colour_))
458
{
459
    cyg_uint8*  _ptr8_  = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + (_x_ >> 1);
460
    if (_x_ & 0x01) {
461
        *_ptr8_ = (*_ptr8_ & 0x00F0) | _colour_;
462
    } else {
463
        *_ptr8_ = (*_ptr8_ & 0x000F) | (_colour_ << 4);
464
    }
465
}
466
 
467
CYG_FB_LINEAR_INLINE_FN(cyg_fb_colour,
468
                        cyg_fb_linear_read_pixel_4LE_inl,
469
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_))
470
{
471
    cyg_uint8*  _ptr8_  = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + (_x_ >> 1);
472
    if (_x_ & 0x01) {
473
        return (*_ptr8_ >> 4) & 0x000F;
474
    } else {
475
        return *_ptr8_ & 0x000F;
476
    }
477
}
478
 
479
CYG_FB_LINEAR_INLINE_FN(cyg_fb_colour,
480
                        cyg_fb_linear_read_pixel_4BE_inl,
481
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_))
482
{
483
    cyg_uint8*  _ptr8_  = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + (_x_ >> 1);
484
    if (_x_ & 0x01) {
485
        return *_ptr8_ & 0x000F;
486
    } else {
487
        return (*_ptr8_ >> 4) & 0x000F;
488
    }
489
}
490
 
491
CYG_FB_LINEAR_INLINE_FN(void,
492
                        cyg_fb_linear_write_vline_4LE_inl,
493
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _len_, cyg_fb_colour _colour_))
494
{
495
    cyg_uint8*  _ptr8_  = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + (_x_ >> 2);
496
    if (_x_ & 0x01) {
497
        _colour_ <<= 4;
498
        for ( ; _len_; _len_--) {
499
            *_ptr8_  = (*_ptr8_ & 0x000F) | _colour_;
500
            _ptr8_  += _stride_;
501
        }
502
    } else {
503
        for ( ; _len_; _len_--) {
504
            *_ptr8_ = (*_ptr8_ & 0x00F0) | _colour_;
505
        }
506
    }
507
}
508
 
509
CYG_FB_LINEAR_INLINE_FN(void,
510
                        cyg_fb_linear_write_vline_4BE_inl,
511
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _len_, cyg_fb_colour _colour_))
512
{
513
    cyg_uint8*  _ptr8_  = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + (_x_ >> 2);
514
    if (_x_ & 0x01) {
515
        for ( ; _len_; _len_--) {
516
            *_ptr8_ = (*_ptr8_ & 0x00F0) | _colour_;
517
        }
518
    } else {
519
        _colour_ <<= 4;
520
        for ( ; _len_; _len_--) {
521
            *_ptr8_  = (*_ptr8_ & 0x000F) | _colour_;
522
            _ptr8_  += _stride_;
523
        }
524
    }
525
}
526
 
527
// ----------------------------------------------------------------------------
528
CYG_FB_LINEAR_INLINE_FN(void,
529
                        cyg_fb_linear_write_pixel_8_inl,
530
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_fb_colour _colour_))
531
{
532
    cyg_uint8*  _ptr8_ = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + _x_;
533
    *_ptr8_ = _colour_;
534
}
535
 
536
CYG_FB_LINEAR_INLINE_FN(cyg_fb_colour,
537
                        cyg_fb_linear_read_pixel_8_inl,
538
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_))
539
{
540
    cyg_uint8*  _ptr8_ = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + _x_;
541
    return *_ptr8_;
542
}
543
 
544
CYG_FB_LINEAR_INLINE_FN(void,
545
                        cyg_fb_linear_write_hline_8_inl,
546
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _len_, cyg_fb_colour _colour_))
547
{
548
    cyg_uint8*  _ptr8_ = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + _x_;
549
    __builtin_memset(_ptr8_, _colour_, _len_);
550
}
551
 
552
CYG_FB_LINEAR_INLINE_FN(void,
553
                        cyg_fb_linear_write_vline_8_inl,
554
                        (void* _fbaddr_, cyg_ucount16 _stride_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _len_, cyg_fb_colour _colour_))
555
{
556
    cyg_uint8*  _ptr8_ = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + _x_;
557
    for ( ; _len_; _len_--) {
558
        *_ptr8_  = _colour_;
559
        _ptr8_  += _stride_;
560
    }
561
}
562
 
563
CYG_FB_LINEAR_INLINE_FN(void,
564
                        cyg_fb_linear_fill_block_8_inl,
565
                        (void* _fbaddr_, cyg_ucount16 _stride_,
566
                         cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_, cyg_fb_colour _colour_))
567
{
568
    cyg_uint8*  _ptr8_ = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + _x_;
569
    for ( ; _height_; _height_--) {
570
        __builtin_memset(_ptr8_, _colour_, _width_);
571
        _ptr8_ += _stride_;
572
    }
573
}
574
 
575
CYG_FB_LINEAR_INLINE_FN(void,
576
                        cyg_fb_linear_write_block_8_inl,
577
                        (void* _fbaddr_, cyg_ucount16 _stride_,
578
                         cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_,
579
                         const void* _source_,
580
                         cyg_ucount16 _offset_, cyg_ucount16 _source_stride_))
581
{
582
    cyg_uint8*  _ptr8_ = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + _x_;
583
    cyg_uint8*  _src8_ = ((cyg_uint8*) _source_) + _offset_;
584
 
585
    for ( ; _height_; _height_--) {
586
        __builtin_memcpy(_ptr8_, _src8_, _width_);
587
        _ptr8_  += _stride_;
588
        _src8_  += _source_stride_;
589
    }
590
}
591
 
592
CYG_FB_LINEAR_INLINE_FN(void,
593
                        cyg_fb_linear_read_block_8_inl,
594
                        (void* _fbaddr_, cyg_ucount16 _stride_,
595
                         cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_,
596
                         void* _dest_,
597
                         cyg_ucount16 _offset_, cyg_ucount16 _dest_stride_))
598
{
599
    cyg_uint8*  _ptr8_  = ((cyg_uint8*)_fbaddr_) + (_stride_ * _y_) + _x_;
600
    cyg_uint8*  _dst8_  = ((cyg_uint8*)_dest_) + _offset_;
601
 
602
    for ( ; _height_; _height_--) {
603
        __builtin_memcpy(_dst8_, _ptr8_, _width_);
604
        _ptr8_  += _stride_;
605
        _dst8_  += _dest_stride_;
606
    }
607
}
608
 
609
// ----------------------------------------------------------------------------
610
 
611
CYG_FB_LINEAR_INLINE_FN(void,
612
                        cyg_fb_linear_write_pixel_16_inl,
613
                        (void* _fbaddr_, cyg_ucount16 _stride8_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_fb_colour _colour_))
614
{
615
    cyg_uint16* _ptr16_ = ((cyg_uint16*)(((cyg_uint8*)_fbaddr_) + (_stride8_ * _y_))) + _x_;
616
    *_ptr16_ = _colour_;
617
}
618
 
619
CYG_FB_LINEAR_INLINE_FN(cyg_fb_colour,
620
                        cyg_fb_linear_read_pixel_16_inl,
621
                        (void* _fbaddr_, cyg_ucount16 _stride8_, cyg_ucount16 _x_, cyg_ucount16 _y_))
622
{
623
    cyg_uint16* _ptr16_ = ((cyg_uint16*)(((cyg_uint8*)_fbaddr_) + (_stride8_ * _y_))) + _x_;
624
    return *_ptr16_;
625
}
626
 
627
CYG_FB_LINEAR_INLINE_FN(void,
628
                        cyg_fb_linear_write_hline_16_inl,
629
                        (void* _fbaddr_, cyg_ucount16 _stride8_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _len_, cyg_fb_colour _colour_))
630
{
631
    cyg_uint16* _ptr16_ = ((cyg_uint16*)(((cyg_uint8*)_fbaddr_) + (_stride8_ * _y_))) + _x_;
632
    cyg_uint32* _ptr32_;
633
    cyg_bool    _right_;
634
 
635
    if (_x_ & 0x01) {
636
        *_ptr16_++ = _colour_;
637
        _len_      -= 1;
638
    }
639
    _ptr32_   = (cyg_uint32*) _ptr16_;
640
    _colour_ |= (_colour_ << 16);
641
    _right_   = (_len_ & 0x01);
642
    for ( _len_ >>= 1; _len_; _len_--) {
643
        *_ptr32_++ = _colour_;
644
    }
645
    if (_right_) {
646
        *((cyg_uint16*)_ptr32_) = _colour_;
647
    }
648
}
649
 
650
CYG_FB_LINEAR_INLINE_FN(void,
651
                        cyg_fb_linear_write_vline_16_inl,
652
                        (void* _fbaddr_, cyg_ucount16 _stride8_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _len_, cyg_fb_colour _colour_))
653
{
654
    cyg_uint16* _ptr16_ = ((cyg_uint16*)(((cyg_uint8*)_fbaddr_) + (_stride8_ * _y_))) + _x_;
655
    for ( ; _len_; _len_--) {
656
        *_ptr16_     = _colour_;
657
        _ptr16_      = (cyg_uint16*)(((cyg_uint8*)_ptr16_) + _stride8_);
658
    }
659
}
660
 
661
CYG_FB_LINEAR_INLINE_FN(void,
662
                        cyg_fb_linear_fill_block_16_inl,
663
                        (void* _fbaddr_, cyg_ucount16 _stride8_,
664
                         cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_, cyg_fb_colour _colour_))
665
{
666
    cyg_bool        _left_, _right_;
667
    cyg_uint16*     _ptr16_;
668
    cyg_uint32*     _ptr32_;
669
    cyg_ucount16    _stride32_;
670
 
671
    _ptr16_       = ((cyg_uint16*)(((cyg_uint8*)_fbaddr_) + (_stride8_ * _y_))) + _x_;
672
    _left_ = (_x_ & 0x01);
673
    if (_left_) {
674
        _width_  -= 1;
675
    }
676
    _right_       = (_width_ & 0x01);
677
 
678
    if (_left_) {
679
        _ptr32_ = (cyg_uint32*) &(_ptr16_[1]);
680
        for (_y_ = _height_; _y_; _y_--) {
681
            *_ptr16_    = _colour_;
682
            _ptr16_     = (cyg_uint16*)(((cyg_uint8*)_ptr16_) + _stride8_);
683
        }
684
    } else {
685
        _ptr32_ = (cyg_uint32*) _ptr16_;
686
    }
687
    _width_     >>= 1;
688
    _stride32_    = _stride8_ - (_width_ << 2);
689
    _colour_     |= (_colour_ << 16);
690
    _ptr16_       = (cyg_uint16*) &(_ptr32_[_width_]);
691
 
692
    for ( _y_ = _height_; _y_; _y_--) {
693
        for ( _x_ = _width_; _x_; _x_--) {
694
            *_ptr32_++ = _colour_;
695
        }
696
        _ptr32_ = (cyg_uint32*)(((cyg_uint8*)_ptr32_) + _stride32_);
697
    }
698
    if (_right_) {
699
        for (_y_ = _height_; _y_; _y_--) {
700
            *_ptr16_    = _colour_;
701
            _ptr16_     = (cyg_uint16*)(((cyg_uint8*)_ptr16_) + _stride8_);
702
        }
703
    }
704
}
705
 
706
CYG_FB_LINEAR_INLINE_FN(void,
707
                        cyg_fb_linear_write_block_16_inl,
708
                        (void* _fbaddr_, cyg_ucount16 _stride8_,
709
                         cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_,
710
                         const void* _source_,
711
                         cyg_ucount16 _offset_, cyg_ucount16 _source_stride8_))
712
{
713
    cyg_uint16* _ptr16_ = ((cyg_uint16*)(((cyg_uint8*)_fbaddr_) + (_stride8_ * _y_))) + _x_;
714
    cyg_uint16* _src16_ = ((cyg_uint16*) _source_) + _offset_;
715
 
716
    _width_ <<= 1;
717
    for ( ; _height_; _height_--) {
718
        __builtin_memcpy(_ptr16_, _src16_, _width_);
719
        _ptr16_ = (cyg_uint16*)(((cyg_uint8*)_ptr16_) + _stride8_);
720
        _src16_ = (cyg_uint16*)(((cyg_uint8*)_src16_) + _source_stride8_);
721
    }
722
}
723
 
724
CYG_FB_LINEAR_INLINE_FN(void,
725
                        cyg_fb_linear_read_block_16_inl,
726
                        (void* _fbaddr_, cyg_ucount16 _stride8_,
727
                         cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_,
728
                         void* _dest_,
729
                         cyg_ucount16 _offset_, cyg_ucount16 _dest_stride8_))
730
{
731
    cyg_uint16* _ptr16_ = ((cyg_uint16*)(((cyg_uint8*)_fbaddr_) + (_stride8_ * _y_))) + _x_;
732
    cyg_uint16* _dst16_ = ((cyg_uint16*)_dest_) + _offset_;
733
 
734
    _width_ <<= 1;
735
    for ( ; _height_; _height_--) {
736
        __builtin_memcpy(_dst16_, _ptr16_, _width_);
737
        _ptr16_ = (cyg_uint16*)(((cyg_uint8*)_ptr16_) + _stride8_);
738
        _dst16_ = (cyg_uint16*)(((cyg_uint8*)_dst16_) + _dest_stride8_);
739
    }
740
}
741
 
742
// ----------------------------------------------------------------------------
743
 
744
CYG_FB_LINEAR_INLINE_FN(void,
745
                        cyg_fb_linear_write_pixel_32_inl,
746
                        (void* _fbaddr_, cyg_ucount16 _stride8_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_fb_colour _colour_))
747
{
748
    cyg_uint32* _ptr32_ = ((cyg_uint32*)(((cyg_uint8*)_fbaddr_) + (_stride8_ * _y_))) + _x_;
749
    *_ptr32_ = _colour_;
750
}
751
 
752
CYG_FB_LINEAR_INLINE_FN(cyg_fb_colour,
753
                        cyg_fb_linear_read_pixel_32_inl,
754
                        (void* _fbaddr_, cyg_ucount16 _stride8_, cyg_ucount16 _x_, cyg_ucount16 _y_))
755
{
756
    cyg_uint32* _ptr32_ = ((cyg_uint32*)(((cyg_uint8*)_fbaddr_) + (_stride8_ * _y_))) + _x_;
757
    return *_ptr32_;
758
}
759
 
760
CYG_FB_LINEAR_INLINE_FN(void,
761
                        cyg_fb_linear_write_hline_32_inl,
762
                        (void* _fbaddr_, cyg_ucount16 _stride8_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _len_, cyg_fb_colour _colour_))
763
{
764
    cyg_uint32* _ptr32_ = ((cyg_uint32*)(((cyg_uint8*)_fbaddr_) + (_stride8_ * _y_))) + _x_;
765
    while (_len_--) {
766
        *_ptr32_++ = _colour_;
767
    }
768
}
769
 
770
CYG_FB_LINEAR_INLINE_FN(void,
771
                        cyg_fb_linear_write_vline_32_inl,
772
                        (void* _fbaddr_, cyg_ucount16 _stride8_, cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _len_, cyg_fb_colour _colour_))
773
{
774
    cyg_uint32* _ptr32_ = ((cyg_uint32*)(((cyg_uint8*)_fbaddr_) + (_stride8_ * _y_))) + _x_;
775
    while (_len_--) {
776
        *_ptr32_    = _colour_;
777
        _ptr32_     = (cyg_uint32*)(((cyg_uint8*)_ptr32_) + _stride8_);
778
    }
779
}
780
 
781
CYG_FB_LINEAR_INLINE_FN(void,
782
                        cyg_fb_linear_fill_block_32_inl,
783
                        (void* _fbaddr_, cyg_ucount16 _stride8_,
784
                         cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_, cyg_fb_colour _colour_))
785
{
786
    cyg_uint32*     _ptr32_ = ((cyg_uint32*)(((cyg_uint8*)_fbaddr_) + (_stride8_ * _y_))) + _x_;
787
    cyg_ucount16    _len_;
788
 
789
    _stride8_   -= (_width_ << 2);
790
    for ( ; _height_; _height_--) {
791
        for (_len_ = _width_; _len_; _len_--) {
792
            *_ptr32_++ = _colour_;
793
        }
794
        _ptr32_ = (cyg_uint32*)(((cyg_uint8*)_ptr32_) + _stride8_);
795
    }
796
}
797
 
798
CYG_FB_LINEAR_INLINE_FN(void,
799
                        cyg_fb_linear_write_block_32_inl,
800
                        (void* _fbaddr_, cyg_ucount16 _stride8_,
801
                         cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_,
802
                         const void* _source_,
803
                         cyg_ucount16 _offset_, cyg_ucount16 _source_stride8_))
804
{
805
    cyg_uint32* _ptr32_ = ((cyg_uint32*)(((cyg_uint8*)_fbaddr_) + (_stride8_ * _y_))) + _x_;
806
    cyg_uint32* _src32_ = ((cyg_uint32*) _source_) + _offset_;
807
 
808
    _width_ <<= 2;
809
    for ( ; _height_; _height_--) {
810
        __builtin_memcpy(_ptr32_, _src32_, _width_);
811
        _ptr32_ = (cyg_uint32*)(((cyg_uint8*)_ptr32_) + _stride8_);
812
        _src32_ = (cyg_uint32*)(((cyg_uint8*)_src32_) + _source_stride8_);
813
    }
814
}
815
 
816
CYG_FB_LINEAR_INLINE_FN(void,
817
                        cyg_fb_linear_read_block_32_inl,
818
                        (void* _fbaddr_, cyg_ucount16 _stride8_,
819
                         cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_,
820
                         void* _dest_,
821
                         cyg_ucount16 _offset_, cyg_ucount16 _dest_stride8_))
822
{
823
    cyg_uint32* _ptr32_ = ((cyg_uint32*)(((cyg_uint8*)_fbaddr_) + (_stride8_ * _y_))) + _x_;
824
    cyg_uint32* _dst32_  = ((cyg_uint32*)_dest_) + _offset_;
825
 
826
    _width_ <<= 2;
827
    for ( ; _height_; _height_--) {
828
        __builtin_memcpy(_dst32_, _ptr32_, _width_);
829
        _ptr32_ = (cyg_uint32*)(((cyg_uint8*)_ptr32_) + _stride8_);
830
        _dst32_ = (cyg_uint32*)(((cyg_uint8*)_dst32_) + _dest_stride8_);
831
    }
832
}
833
 
834
// ----------------------------------------------------------------------------
835
// The actual move block functions are not inlined, but it is convenient to
836
// have dummy _inl functions anyway.
837
 
838
extern void cyg_fb_linear_move_block_1LE_impl(void*, cyg_ucount16 /* stride */,
839
                                              cyg_ucount16, cyg_ucount16,
840
                                              cyg_ucount16, cyg_ucount16,
841
                                              cyg_ucount16, cyg_ucount16);
842
extern void cyg_fb_linear_move_block_1BE_impl(void*, cyg_ucount16 /* stride */,
843
                                              cyg_ucount16, cyg_ucount16,
844
                                              cyg_ucount16, cyg_ucount16,
845
                                              cyg_ucount16, cyg_ucount16);
846
extern void cyg_fb_linear_move_block_2LE_impl(void*, cyg_ucount16 /* stride */,
847
                                              cyg_ucount16, cyg_ucount16,
848
                                              cyg_ucount16, cyg_ucount16,
849
                                              cyg_ucount16, cyg_ucount16);
850
extern void cyg_fb_linear_move_block_2BE_impl(void*, cyg_ucount16 /* stride */,
851
                                              cyg_ucount16, cyg_ucount16,
852
                                              cyg_ucount16, cyg_ucount16,
853
                                              cyg_ucount16, cyg_ucount16);
854
extern void cyg_fb_linear_move_block_4LE_impl(void*, cyg_ucount16 /* stride */,
855
                                              cyg_ucount16, cyg_ucount16,
856
                                              cyg_ucount16, cyg_ucount16,
857
                                              cyg_ucount16, cyg_ucount16);
858
extern void cyg_fb_linear_move_block_4BE_impl(void*, cyg_ucount16 /* stride */,
859
                                              cyg_ucount16, cyg_ucount16,
860
                                              cyg_ucount16, cyg_ucount16,
861
                                              cyg_ucount16, cyg_ucount16);
862
extern void cyg_fb_linear_move_block_8_impl(void*, cyg_ucount16 /* stride */,
863
                                            cyg_ucount16, cyg_ucount16,
864
                                            cyg_ucount16, cyg_ucount16,
865
                                            cyg_ucount16, cyg_ucount16);
866
extern void cyg_fb_linear_move_block_16_impl(void*, cyg_ucount16 /* stride */,
867
                                             cyg_ucount16, cyg_ucount16,
868
                                             cyg_ucount16, cyg_ucount16,
869
                                             cyg_ucount16, cyg_ucount16);
870
extern void cyg_fb_linear_move_block_32_impl(void*, cyg_ucount16 /* stride */,
871
                                             cyg_ucount16, cyg_ucount16,
872
                                             cyg_ucount16, cyg_ucount16,
873
                                             cyg_ucount16, cyg_ucount16);
874
 
875
CYG_FB_LINEAR_INLINE_FN(void,
876
                        cyg_fb_linear_move_block_1LE_inl,
877
                        (void* _fbaddr_, cyg_ucount16 _stride_,
878
                         cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_,
879
                         cyg_ucount16 _new_x_, cyg_ucount16 _new_y_))
880
{
881
    cyg_fb_linear_move_block_1LE_impl(_fbaddr_, _stride_, _x_, _y_, _width_, _height_, _new_x_, _new_y_);
882
}
883
 
884
CYG_FB_LINEAR_INLINE_FN(void,
885
                        cyg_fb_linear_move_block_1BE_inl,
886
                        (void* _fbaddr_, cyg_ucount16 _stride_,
887
                         cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_,
888
                         cyg_ucount16 _new_x_, cyg_ucount16 _new_y_))
889
{
890
    cyg_fb_linear_move_block_1BE_impl(_fbaddr_, _stride_, _x_, _y_, _width_, _height_, _new_x_, _new_y_);
891
}
892
 
893
CYG_FB_LINEAR_INLINE_FN(void,
894
                        cyg_fb_linear_move_block_2LE_inl,
895
                        (void* _fbaddr_, cyg_ucount16 _stride_,
896
                         cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_,
897
                         cyg_ucount16 _new_x_, cyg_ucount16 _new_y_))
898
{
899
    cyg_fb_linear_move_block_2LE_impl(_fbaddr_, _stride_, _x_, _y_, _width_, _height_, _new_x_, _new_y_);
900
}
901
 
902
CYG_FB_LINEAR_INLINE_FN(void,
903
                        cyg_fb_linear_move_block_2BE_inl,
904
                        (void* _fbaddr_, cyg_ucount16 _stride_,
905
                         cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_,
906
                         cyg_ucount16 _new_x_, cyg_ucount16 _new_y_))
907
{
908
    cyg_fb_linear_move_block_2BE_impl(_fbaddr_, _stride_, _x_, _y_, _width_, _height_, _new_x_, _new_y_);
909
}
910
 
911
CYG_FB_LINEAR_INLINE_FN(void,
912
                        cyg_fb_linear_move_block_4LE_inl,
913
                        (void* _fbaddr_, cyg_ucount16 _stride_,
914
                         cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_,
915
                         cyg_ucount16 _new_x_, cyg_ucount16 _new_y_))
916
{
917
    cyg_fb_linear_move_block_4LE_impl(_fbaddr_, _stride_, _x_, _y_, _width_, _height_, _new_x_, _new_y_);
918
}
919
 
920
CYG_FB_LINEAR_INLINE_FN(void,
921
                        cyg_fb_linear_move_block_4BE_inl,
922
                        (void* _fbaddr_, cyg_ucount16 _stride_,
923
                         cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_,
924
                         cyg_ucount16 _new_x_, cyg_ucount16 _new_y_))
925
{
926
    cyg_fb_linear_move_block_4BE_impl(_fbaddr_, _stride_, _x_, _y_, _width_, _height_, _new_x_, _new_y_);
927
}
928
 
929
CYG_FB_LINEAR_INLINE_FN(void,
930
                        cyg_fb_linear_move_block_8_inl,
931
                        (void* _fbaddr_, cyg_ucount16 _stride_,
932
                         cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_,
933
                         cyg_ucount16 _new_x_, cyg_ucount16 _new_y_))
934
{
935
    cyg_fb_linear_move_block_8_impl(_fbaddr_, _stride_, _x_, _y_, _width_, _height_, _new_x_, _new_y_);
936
}
937
 
938
CYG_FB_LINEAR_INLINE_FN(void,
939
                        cyg_fb_linear_move_block_16_inl,
940
                        (void* _fbaddr_, cyg_ucount16 _stride_,
941
                         cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_,
942
                         cyg_ucount16 _new_x_, cyg_ucount16 _new_y_))
943
{
944
    cyg_fb_linear_move_block_16_impl(_fbaddr_, _stride_, _x_, _y_, _width_, _height_, _new_x_, _new_y_);
945
}
946
 
947
CYG_FB_LINEAR_INLINE_FN(void,
948
                        cyg_fb_linear_move_block_32_inl,
949
                        (void* _fbaddr_, cyg_ucount16 _stride_,
950
                         cyg_ucount16 _x_, cyg_ucount16 _y_, cyg_ucount16 _width_, cyg_ucount16 _height_,
951
                         cyg_ucount16 _new_x_, cyg_ucount16 _new_y_))
952
{
953
    cyg_fb_linear_move_block_32_impl(_fbaddr_, _stride_, _x_, _y_, _width_, _height_, _new_x_, _new_y_);
954
}
955
 
956
#ifdef __cplusplus
957
}   /* extern "C" */
958
#endif
959
 
960
#endif // ifndef CYGONCE_IO_FRAMEBUF_H
961
// End of framebuf.h

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.