]> git.karo-electronics.de Git - mv-sheeva.git/blob - drivers/staging/sm7xx/smtc2d.h
staging: fix typos "couter" -> "counter"
[mv-sheeva.git] / drivers / staging / sm7xx / smtc2d.h
1 /*
2  * Silicon Motion SM712 2D drawing engine functions.
3  *
4  * Copyright (C) 2006 Silicon Motion Technology Corp.
5  * Author: Ge Wang, gewang@siliconmotion.com
6  *
7  * Copyright (C) 2009 Lemote, Inc.
8  * Author: Wu Zhangjin, wuzj@lemote.com
9  *
10  *  This file is subject to the terms and conditions of the GNU General Public
11  *  License. See the file COPYING in the main directory of this archive for
12  *  more details.
13  */
14
15 #ifndef NULL
16 #define NULL     0
17 #endif
18
19 /* Internal macros */
20
21 #define _F_START(f)             (0 ? f)
22 #define _F_END(f)               (1 ? f)
23 #define _F_SIZE(f)              (1 + _F_END(f) - _F_START(f))
24 #define _F_MASK(f)              (((1ULL << _F_SIZE(f)) - 1) << _F_START(f))
25 #define _F_NORMALIZE(v, f)      (((v) & _F_MASK(f)) >> _F_START(f))
26 #define _F_DENORMALIZE(v, f)    (((v) << _F_START(f)) & _F_MASK(f))
27
28 /* Global macros */
29
30 #define FIELD_GET(x, reg, field) \
31 ( \
32     _F_NORMALIZE((x), reg ## _ ## field) \
33 )
34
35 #define FIELD_SET(x, reg, field, value) \
36 ( \
37     (x & ~_F_MASK(reg ## _ ## field)) \
38     | _F_DENORMALIZE(reg ## _ ## field ## _ ## value, reg ## _ ## field) \
39 )
40
41 #define FIELD_VALUE(x, reg, field, value) \
42 ( \
43     (x & ~_F_MASK(reg ## _ ## field)) \
44     | _F_DENORMALIZE(value, reg ## _ ## field) \
45 )
46
47 #define FIELD_CLEAR(reg, field) \
48 ( \
49     ~_F_MASK(reg ## _ ## field) \
50 )
51
52 /* Field Macros                        */
53
54 #define FIELD_START(field)      (0 ? field)
55 #define FIELD_END(field)        (1 ? field)
56 #define FIELD_SIZE(field) \
57         (1 + FIELD_END(field) - FIELD_START(field))
58
59 #define FIELD_MASK(field) \
60         (((1 << (FIELD_SIZE(field)-1)) \
61         | ((1 << (FIELD_SIZE(field)-1)) - 1)) \
62         << FIELD_START(field))
63
64 #define FIELD_NORMALIZE(reg, field) \
65         (((reg) & FIELD_MASK(field)) >> FIELD_START(field))
66
67 #define FIELD_DENORMALIZE(field, value) \
68         (((value) << FIELD_START(field)) & FIELD_MASK(field))
69
70 #define FIELD_INIT(reg, field, value) \
71         FIELD_DENORMALIZE(reg ## _ ## field, \
72                 reg ## _ ## field ## _ ## value)
73
74 #define FIELD_INIT_VAL(reg, field, value) \
75         (FIELD_DENORMALIZE(reg ## _ ## field, value))
76
77 #define FIELD_VAL_SET(x, r, f, v) ({ \
78         x = (x & ~FIELD_MASK(r ## _ ## f)) \
79         | FIELD_DENORMALIZE(r ## _ ## f, r ## _ ## f ## _ ## v) \
80 })
81
82 #define RGB(r, g, b)    ((unsigned long)(((r) << 16) | ((g) << 8) | (b)))
83
84 /* Transparent info definition */
85 typedef struct {
86         unsigned long match;    /* Matching pixel is OPAQUE/TRANSPARENT */
87         unsigned long select;   /* Transparency controlled by SRC/DST */
88         unsigned long control;  /* ENABLE/DISABLE transparency */
89         unsigned long color;    /* Transparent color */
90 } Transparent, *pTransparent;
91
92 #define PIXEL_DEPTH_1_BP        0       /* 1 bit per pixel */
93 #define PIXEL_DEPTH_8_BPP       1       /* 8 bits per pixel */
94 #define PIXEL_DEPTH_16_BPP      2       /* 16 bits per pixel */
95 #define PIXEL_DEPTH_32_BPP      3       /* 32 bits per pixel */
96 #define PIXEL_DEPTH_YUV422      8       /* 16 bits per pixel YUV422 */
97 #define PIXEL_DEPTH_YUV420      9       /* 16 bits per pixel YUV420 */
98
99 #define PATTERN_WIDTH           8
100 #define PATTERN_HEIGHT          8
101
102 #define TOP_TO_BOTTOM           0
103 #define BOTTOM_TO_TOP           1
104 #define RIGHT_TO_LEFT           BOTTOM_TO_TOP
105 #define LEFT_TO_RIGHT           TOP_TO_BOTTOM
106
107 /* Constants used in Transparent structure */
108 #define MATCH_OPAQUE            0x00000000
109 #define MATCH_TRANSPARENT       0x00000400
110 #define SOURCE                  0x00000000
111 #define DESTINATION             0x00000200
112
113 /* 2D registers. */
114
115 #define DE_SOURCE                       0x000000
116 #define DE_SOURCE_WRAP                  31 : 31
117 #define DE_SOURCE_WRAP_DISABLE          0
118 #define DE_SOURCE_WRAP_ENABLE           1
119 #define DE_SOURCE_X_K1                  29 : 16
120 #define DE_SOURCE_Y_K2                  15 : 0
121
122 #define DE_DESTINATION                  0x000004
123 #define DE_DESTINATION_WRAP             31 : 31
124 #define DE_DESTINATION_WRAP_DISABLE     0
125 #define DE_DESTINATION_WRAP_ENABLE      1
126 #define DE_DESTINATION_X                28 : 16
127 #define DE_DESTINATION_Y                15 : 0
128
129 #define DE_DIMENSION                    0x000008
130 #define DE_DIMENSION_X                  28 : 16
131 #define DE_DIMENSION_Y_ET               15 : 0
132
133 #define DE_CONTROL                      0x00000C
134 #define DE_CONTROL_STATUS               31 : 31
135 #define DE_CONTROL_STATUS_STOP          0
136 #define DE_CONTROL_STATUS_START         1
137 #define DE_CONTROL_PATTERN              30 : 30
138 #define DE_CONTROL_PATTERN_MONO         0
139 #define DE_CONTROL_PATTERN_COLOR        1
140 #define DE_CONTROL_UPDATE_DESTINATION_X         29 : 29
141 #define DE_CONTROL_UPDATE_DESTINATION_X_DISABLE 0
142 #define DE_CONTROL_UPDATE_DESTINATION_X_ENABLE  1
143 #define DE_CONTROL_QUICK_START                  28 : 28
144 #define DE_CONTROL_QUICK_START_DISABLE          0
145 #define DE_CONTROL_QUICK_START_ENABLE           1
146 #define DE_CONTROL_DIRECTION                    27 : 27
147 #define DE_CONTROL_DIRECTION_LEFT_TO_RIGHT      0
148 #define DE_CONTROL_DIRECTION_RIGHT_TO_LEFT      1
149 #define DE_CONTROL_MAJOR                        26 : 26
150 #define DE_CONTROL_MAJOR_X                      0
151 #define DE_CONTROL_MAJOR_Y                      1
152 #define DE_CONTROL_STEP_X                       25 : 25
153 #define DE_CONTROL_STEP_X_POSITIVE              1
154 #define DE_CONTROL_STEP_X_NEGATIVE              0
155 #define DE_CONTROL_STEP_Y                       24 : 24
156 #define DE_CONTROL_STEP_Y_POSITIVE              1
157 #define DE_CONTROL_STEP_Y_NEGATIVE              0
158 #define DE_CONTROL_STRETCH                      23 : 23
159 #define DE_CONTROL_STRETCH_DISABLE              0
160 #define DE_CONTROL_STRETCH_ENABLE               1
161 #define DE_CONTROL_HOST                         22 : 22
162 #define DE_CONTROL_HOST_COLOR                   0
163 #define DE_CONTROL_HOST_MONO                    1
164 #define DE_CONTROL_LAST_PIXEL                   21 : 21
165 #define DE_CONTROL_LAST_PIXEL_OFF               0
166 #define DE_CONTROL_LAST_PIXEL_ON                1
167 #define DE_CONTROL_COMMAND                      20 : 16
168 #define DE_CONTROL_COMMAND_BITBLT               0
169 #define DE_CONTROL_COMMAND_RECTANGLE_FILL       1
170 #define DE_CONTROL_COMMAND_DE_TILE              2
171 #define DE_CONTROL_COMMAND_TRAPEZOID_FILL       3
172 #define DE_CONTROL_COMMAND_ALPHA_BLEND          4
173 #define DE_CONTROL_COMMAND_RLE_STRIP            5
174 #define DE_CONTROL_COMMAND_SHORT_STROKE         6
175 #define DE_CONTROL_COMMAND_LINE_DRAW            7
176 #define DE_CONTROL_COMMAND_HOST_WRITE           8
177 #define DE_CONTROL_COMMAND_HOST_READ            9
178 #define DE_CONTROL_COMMAND_HOST_WRITE_BOTTOM_UP 10
179 #define DE_CONTROL_COMMAND_ROTATE               11
180 #define DE_CONTROL_COMMAND_FONT                 12
181 #define DE_CONTROL_COMMAND_TEXTURE_LOAD         15
182 #define DE_CONTROL_ROP_SELECT                   15 : 15
183 #define DE_CONTROL_ROP_SELECT_ROP3              0
184 #define DE_CONTROL_ROP_SELECT_ROP2              1
185 #define DE_CONTROL_ROP2_SOURCE                  14 : 14
186 #define DE_CONTROL_ROP2_SOURCE_BITMAP           0
187 #define DE_CONTROL_ROP2_SOURCE_PATTERN          1
188 #define DE_CONTROL_MONO_DATA                    13 : 12
189 #define DE_CONTROL_MONO_DATA_NOT_PACKED         0
190 #define DE_CONTROL_MONO_DATA_8_PACKED           1
191 #define DE_CONTROL_MONO_DATA_16_PACKED          2
192 #define DE_CONTROL_MONO_DATA_32_PACKED          3
193 #define DE_CONTROL_REPEAT_ROTATE                11 : 11
194 #define DE_CONTROL_REPEAT_ROTATE_DISABLE        0
195 #define DE_CONTROL_REPEAT_ROTATE_ENABLE         1
196 #define DE_CONTROL_TRANSPARENCY_MATCH           10 : 10
197 #define DE_CONTROL_TRANSPARENCY_MATCH_OPAQUE            0
198 #define DE_CONTROL_TRANSPARENCY_MATCH_TRANSPARENT       1
199 #define DE_CONTROL_TRANSPARENCY_SELECT                  9 : 9
200 #define DE_CONTROL_TRANSPARENCY_SELECT_SOURCE           0
201 #define DE_CONTROL_TRANSPARENCY_SELECT_DESTINATION      1
202 #define DE_CONTROL_TRANSPARENCY                         8 : 8
203 #define DE_CONTROL_TRANSPARENCY_DISABLE                 0
204 #define DE_CONTROL_TRANSPARENCY_ENABLE                  1
205 #define DE_CONTROL_ROP                                  7 : 0
206
207 /* Pseudo fields. */
208
209 #define DE_CONTROL_SHORT_STROKE_DIR                     27 : 24
210 #define DE_CONTROL_SHORT_STROKE_DIR_225                 0
211 #define DE_CONTROL_SHORT_STROKE_DIR_135                 1
212 #define DE_CONTROL_SHORT_STROKE_DIR_315                 2
213 #define DE_CONTROL_SHORT_STROKE_DIR_45                  3
214 #define DE_CONTROL_SHORT_STROKE_DIR_270                 4
215 #define DE_CONTROL_SHORT_STROKE_DIR_90                  5
216 #define DE_CONTROL_SHORT_STROKE_DIR_180                 8
217 #define DE_CONTROL_SHORT_STROKE_DIR_0                   10
218 #define DE_CONTROL_ROTATION                             25 : 24
219 #define DE_CONTROL_ROTATION_0                           0
220 #define DE_CONTROL_ROTATION_270                         1
221 #define DE_CONTROL_ROTATION_90                          2
222 #define DE_CONTROL_ROTATION_180                         3
223
224 #define DE_PITCH                                        0x000010
225 #define DE_PITCH_DESTINATION                            28 : 16
226 #define DE_PITCH_SOURCE                                 12 : 0
227
228 #define DE_FOREGROUND                                   0x000014
229 #define DE_FOREGROUND_COLOR                             31 : 0
230
231 #define DE_BACKGROUND                                   0x000018
232 #define DE_BACKGROUND_COLOR                             31 : 0
233
234 #define DE_STRETCH_FORMAT                               0x00001C
235 #define DE_STRETCH_FORMAT_PATTERN_XY                    30 : 30
236 #define DE_STRETCH_FORMAT_PATTERN_XY_NORMAL             0
237 #define DE_STRETCH_FORMAT_PATTERN_XY_OVERWRITE          1
238 #define DE_STRETCH_FORMAT_PATTERN_Y                     29 : 27
239 #define DE_STRETCH_FORMAT_PATTERN_X                     25 : 23
240 #define DE_STRETCH_FORMAT_PIXEL_FORMAT                  21 : 20
241 #define DE_STRETCH_FORMAT_PIXEL_FORMAT_8                0
242 #define DE_STRETCH_FORMAT_PIXEL_FORMAT_16               1
243 #define DE_STRETCH_FORMAT_PIXEL_FORMAT_24               3
244 #define DE_STRETCH_FORMAT_PIXEL_FORMAT_32               2
245 #define DE_STRETCH_FORMAT_ADDRESSING                    19 : 16
246 #define DE_STRETCH_FORMAT_ADDRESSING_XY                 0
247 #define DE_STRETCH_FORMAT_ADDRESSING_LINEAR             15
248 #define DE_STRETCH_FORMAT_SOURCE_HEIGHT                 11 : 0
249
250 #define DE_COLOR_COMPARE                                0x000020
251 #define DE_COLOR_COMPARE_COLOR                          23 : 0
252
253 #define DE_COLOR_COMPARE_MASK                           0x000024
254 #define DE_COLOR_COMPARE_MASK_MASKS                     23 : 0
255
256 #define DE_MASKS                                        0x000028
257 #define DE_MASKS_BYTE_MASK                              31 : 16
258 #define DE_MASKS_BIT_MASK                               15 : 0
259
260 #define DE_CLIP_TL                                      0x00002C
261 #define DE_CLIP_TL_TOP                                  31 : 16
262 #define DE_CLIP_TL_STATUS                               13 : 13
263 #define DE_CLIP_TL_STATUS_DISABLE                       0
264 #define DE_CLIP_TL_STATUS_ENABLE                        1
265 #define DE_CLIP_TL_INHIBIT                              12 : 12
266 #define DE_CLIP_TL_INHIBIT_OUTSIDE                      0
267 #define DE_CLIP_TL_INHIBIT_INSIDE                       1
268 #define DE_CLIP_TL_LEFT                                 11 : 0
269
270 #define DE_CLIP_BR                                      0x000030
271 #define DE_CLIP_BR_BOTTOM                               31 : 16
272 #define DE_CLIP_BR_RIGHT                                12 : 0
273
274 #define DE_MONO_PATTERN_LOW                             0x000034
275 #define DE_MONO_PATTERN_LOW_PATTERN                     31 : 0
276
277 #define DE_MONO_PATTERN_HIGH                            0x000038
278 #define DE_MONO_PATTERN_HIGH_PATTERN                    31 : 0
279
280 #define DE_WINDOW_WIDTH                                 0x00003C
281 #define DE_WINDOW_WIDTH_DESTINATION                     28 : 16
282 #define DE_WINDOW_WIDTH_SOURCE                          12 : 0
283
284 #define DE_WINDOW_SOURCE_BASE                           0x000040
285 #define DE_WINDOW_SOURCE_BASE_EXT                       27 : 27
286 #define DE_WINDOW_SOURCE_BASE_EXT_LOCAL                 0
287 #define DE_WINDOW_SOURCE_BASE_EXT_EXTERNAL              1
288 #define DE_WINDOW_SOURCE_BASE_CS                        26 : 26
289 #define DE_WINDOW_SOURCE_BASE_CS_0                      0
290 #define DE_WINDOW_SOURCE_BASE_CS_1                      1
291 #define DE_WINDOW_SOURCE_BASE_ADDRESS                   25 : 0
292
293 #define DE_WINDOW_DESTINATION_BASE                      0x000044
294 #define DE_WINDOW_DESTINATION_BASE_EXT                  27 : 27
295 #define DE_WINDOW_DESTINATION_BASE_EXT_LOCAL            0
296 #define DE_WINDOW_DESTINATION_BASE_EXT_EXTERNAL         1
297 #define DE_WINDOW_DESTINATION_BASE_CS                   26 : 26
298 #define DE_WINDOW_DESTINATION_BASE_CS_0                 0
299 #define DE_WINDOW_DESTINATION_BASE_CS_1                 1
300 #define DE_WINDOW_DESTINATION_BASE_ADDRESS              25 : 0
301
302 #define DE_ALPHA                                        0x000048
303 #define DE_ALPHA_VALUE                                  7 : 0
304
305 #define DE_WRAP                                         0x00004C
306 #define DE_WRAP_X                                       31 : 16
307 #define DE_WRAP_Y                                       15 : 0
308
309 #define DE_STATUS                                       0x000050
310 #define DE_STATUS_CSC                                   1 : 1
311 #define DE_STATUS_CSC_CLEAR                             0
312 #define DE_STATUS_CSC_NOT_ACTIVE                        0
313 #define DE_STATUS_CSC_ACTIVE                            1
314 #define DE_STATUS_2D                                    0 : 0
315 #define DE_STATUS_2D_CLEAR                              0
316 #define DE_STATUS_2D_NOT_ACTIVE                         0
317 #define DE_STATUS_2D_ACTIVE                             1
318
319 /* Color Space Conversion registers. */
320
321 #define CSC_Y_SOURCE_BASE                               0x0000C8
322 #define CSC_Y_SOURCE_BASE_EXT                           27 : 27
323 #define CSC_Y_SOURCE_BASE_EXT_LOCAL                     0
324 #define CSC_Y_SOURCE_BASE_EXT_EXTERNAL                  1
325 #define CSC_Y_SOURCE_BASE_CS                            26 : 26
326 #define CSC_Y_SOURCE_BASE_CS_0                          0
327 #define CSC_Y_SOURCE_BASE_CS_1                          1
328 #define CSC_Y_SOURCE_BASE_ADDRESS                       25 : 0
329
330 #define CSC_CONSTANTS                                   0x0000CC
331 #define CSC_CONSTANTS_Y                                 31 : 24
332 #define CSC_CONSTANTS_R                                 23 : 16
333 #define CSC_CONSTANTS_G                                 15 : 8
334 #define CSC_CONSTANTS_B                                 7 : 0
335
336 #define CSC_Y_SOURCE_X                                  0x0000D0
337 #define CSC_Y_SOURCE_X_INTEGER                          26 : 16
338 #define CSC_Y_SOURCE_X_FRACTION                         15 : 3
339
340 #define CSC_Y_SOURCE_Y                                  0x0000D4
341 #define CSC_Y_SOURCE_Y_INTEGER                          27 : 16
342 #define CSC_Y_SOURCE_Y_FRACTION                         15 : 3
343
344 #define CSC_U_SOURCE_BASE                               0x0000D8
345 #define CSC_U_SOURCE_BASE_EXT                           27 : 27
346 #define CSC_U_SOURCE_BASE_EXT_LOCAL                     0
347 #define CSC_U_SOURCE_BASE_EXT_EXTERNAL                  1
348 #define CSC_U_SOURCE_BASE_CS                            26 : 26
349 #define CSC_U_SOURCE_BASE_CS_0                          0
350 #define CSC_U_SOURCE_BASE_CS_1                          1
351 #define CSC_U_SOURCE_BASE_ADDRESS                       25 : 0
352
353 #define CSC_V_SOURCE_BASE                               0x0000DC
354 #define CSC_V_SOURCE_BASE_EXT                           27 : 27
355 #define CSC_V_SOURCE_BASE_EXT_LOCAL                     0
356 #define CSC_V_SOURCE_BASE_EXT_EXTERNAL                  1
357 #define CSC_V_SOURCE_BASE_CS                            26 : 26
358 #define CSC_V_SOURCE_BASE_CS_0                          0
359 #define CSC_V_SOURCE_BASE_CS_1                          1
360 #define CSC_V_SOURCE_BASE_ADDRESS                       25 : 0
361
362 #define CSC_SOURCE_DIMENSION                            0x0000E0
363 #define CSC_SOURCE_DIMENSION_X                          31 : 16
364 #define CSC_SOURCE_DIMENSION_Y                          15 : 0
365
366 #define CSC_SOURCE_PITCH                                0x0000E4
367 #define CSC_SOURCE_PITCH_Y                              31 : 16
368 #define CSC_SOURCE_PITCH_UV                             15 : 0
369
370 #define CSC_DESTINATION                                 0x0000E8
371 #define CSC_DESTINATION_WRAP                            31 : 31
372 #define CSC_DESTINATION_WRAP_DISABLE                    0
373 #define CSC_DESTINATION_WRAP_ENABLE                     1
374 #define CSC_DESTINATION_X                               27 : 16
375 #define CSC_DESTINATION_Y                               11 : 0
376
377 #define CSC_DESTINATION_DIMENSION                       0x0000EC
378 #define CSC_DESTINATION_DIMENSION_X                     31 : 16
379 #define CSC_DESTINATION_DIMENSION_Y                     15 : 0
380
381 #define CSC_DESTINATION_PITCH                           0x0000F0
382 #define CSC_DESTINATION_PITCH_X                         31 : 16
383 #define CSC_DESTINATION_PITCH_Y                         15 : 0
384
385 #define CSC_SCALE_FACTOR                                0x0000F4
386 #define CSC_SCALE_FACTOR_HORIZONTAL                     31 : 16
387 #define CSC_SCALE_FACTOR_VERTICAL                       15 : 0
388
389 #define CSC_DESTINATION_BASE                            0x0000F8
390 #define CSC_DESTINATION_BASE_EXT                        27 : 27
391 #define CSC_DESTINATION_BASE_EXT_LOCAL                  0
392 #define CSC_DESTINATION_BASE_EXT_EXTERNAL               1
393 #define CSC_DESTINATION_BASE_CS                         26 : 26
394 #define CSC_DESTINATION_BASE_CS_0                       0
395 #define CSC_DESTINATION_BASE_CS_1                       1
396 #define CSC_DESTINATION_BASE_ADDRESS                    25 : 0
397
398 #define CSC_CONTROL                                     0x0000FC
399 #define CSC_CONTROL_STATUS                              31 : 31
400 #define CSC_CONTROL_STATUS_STOP                         0
401 #define CSC_CONTROL_STATUS_START                        1
402 #define CSC_CONTROL_SOURCE_FORMAT                       30 : 28
403 #define CSC_CONTROL_SOURCE_FORMAT_YUV422                0
404 #define CSC_CONTROL_SOURCE_FORMAT_YUV420I               1
405 #define CSC_CONTROL_SOURCE_FORMAT_YUV420                2
406 #define CSC_CONTROL_SOURCE_FORMAT_YVU9                  3
407 #define CSC_CONTROL_SOURCE_FORMAT_IYU1                  4
408 #define CSC_CONTROL_SOURCE_FORMAT_IYU2                  5
409 #define CSC_CONTROL_SOURCE_FORMAT_RGB565                6
410 #define CSC_CONTROL_SOURCE_FORMAT_RGB8888               7
411 #define CSC_CONTROL_DESTINATION_FORMAT                  27 : 26
412 #define CSC_CONTROL_DESTINATION_FORMAT_RGB565           0
413 #define CSC_CONTROL_DESTINATION_FORMAT_RGB8888          1
414 #define CSC_CONTROL_HORIZONTAL_FILTER                   25 : 25
415 #define CSC_CONTROL_HORIZONTAL_FILTER_DISABLE           0
416 #define CSC_CONTROL_HORIZONTAL_FILTER_ENABLE            1
417 #define CSC_CONTROL_VERTICAL_FILTER                     24 : 24
418 #define CSC_CONTROL_VERTICAL_FILTER_DISABLE             0
419 #define CSC_CONTROL_VERTICAL_FILTER_ENABLE              1
420 #define CSC_CONTROL_BYTE_ORDER                          23 : 23
421 #define CSC_CONTROL_BYTE_ORDER_YUYV                     0
422 #define CSC_CONTROL_BYTE_ORDER_UYVY                     1
423
424 #define DE_DATA_PORT_501                                0x110000
425 #define DE_DATA_PORT_712                                0x400000
426 #define DE_DATA_PORT_722                                0x6000
427
428 /* point to virtual Memory Map IO starting address */
429 extern char *smtc_RegBaseAddress;
430 /* point to virtual video memory starting address */
431 extern char *smtc_VRAMBaseAddress;
432 extern unsigned char smtc_de_busy;
433
434 extern unsigned long memRead32(unsigned long nOffset);
435 extern void memWrite32(unsigned long nOffset, unsigned long nData);
436 extern unsigned long SMTC_read2Dreg(unsigned long nOffset);
437
438 /* 2D functions */
439 extern void deInit(unsigned int nModeWidth, unsigned int nModeHeight,
440                    unsigned int bpp);
441
442 extern void deWaitForNotBusy(void);
443
444 extern void deVerticalLine(unsigned long dst_base,
445         unsigned long dst_pitch,
446         unsigned long nX,
447         unsigned long nY,
448         unsigned long dst_height,
449         unsigned long nColor);
450
451 extern void deHorizontalLine(unsigned long dst_base,
452         unsigned long dst_pitch,
453         unsigned long nX,
454         unsigned long nY,
455         unsigned long dst_width,
456         unsigned long nColor);
457
458 extern void deLine(unsigned long dst_base,
459         unsigned long dst_pitch,
460         unsigned long nX1,
461         unsigned long nY1,
462         unsigned long nX2,
463         unsigned long nY2,
464         unsigned long nColor);
465
466 extern void deFillRect(unsigned long dst_base,
467         unsigned long dst_pitch,
468         unsigned long dst_X,
469         unsigned long dst_Y,
470         unsigned long dst_width,
471         unsigned long dst_height,
472         unsigned long nColor);
473
474 extern void deRotatePattern(unsigned char *pattern_dstaddr,
475         unsigned long pattern_src_addr,
476         unsigned long pattern_BPP,
477         unsigned long pattern_stride,
478         int     patternX,
479         int     patternY);
480
481 extern void deCopy(unsigned long dst_base,
482         unsigned long dst_pitch,
483         unsigned long dst_BPP,
484         unsigned long dst_X,
485         unsigned long dst_Y,
486         unsigned long dst_width,
487         unsigned long dst_height,
488         unsigned long src_base,
489         unsigned long src_pitch,
490         unsigned long src_X,
491         unsigned long src_Y,
492         pTransparent    pTransp,
493         unsigned char nROP2);
494
495 /*
496  * System memory to Video memory monochrome expansion.
497  *
498  * Source is monochrome image in system memory.  This function expands the
499  * monochrome data to color image in video memory.
500  *
501  * @pSrcbuf: pointer to start of source buffer in system memory
502  * @srcDelta: Pitch value (in bytes) of the source buffer, +ive means top
503  *              down and -ive mean button up
504  * @startBit: Mono data can start at any bit in a byte, this value should
505  *              be 0 to 7
506  * @dBase: Address of destination :  offset in frame buffer
507  * @dPitch: Pitch value of destination surface in BYTE
508  * @bpp: Color depth of destination surface
509  * @dx, dy: Starting coordinate of destination surface
510  * @width, height: width and height of rectange in pixel value
511  * @fColor,bColor: Foreground, Background color (corresponding to a 1, 0 in
512  *      the monochrome data)
513  * @rop2: ROP value
514  */
515
516 extern long deSystemMem2VideoMemMonoBlt(
517         const char *pSrcbuf,
518         long srcDelta,
519         unsigned long startBit,
520         unsigned long dBase,
521         unsigned long dPitch,
522         unsigned long bpp,
523         unsigned long dx, unsigned long dy,
524         unsigned long width, unsigned long height,
525         unsigned long fColor,
526         unsigned long bColor,
527         unsigned long rop2);
528
529 extern unsigned long deGetTransparency(void);
530 extern void deSetPixelFormat(unsigned long bpp);