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

Subversion Repositories openmsp430

[/] [openmsp430/] [trunk/] [fpga/] [altera_de0_nano_soc/] [software/] [apps/] [gfx_demo/] [demo_16bpp.c] - Blame information for rev 221

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 221 olivier.gi
#include "demo.h"
2
#include "timerA.h"
3
#include "gfx_controller.h"
4
 
5
//---------------------------------------------------//
6
// STRUCTURE AND DATA TABLE
7
//---------------------------------------------------//
8
 
9
typedef struct {
10
        uint16_t color;
11
        uint8_t  index;
12
        uint8_t  palette;
13
        uint8_t  line_nr_start;
14
} grad_color;
15
 
16
//                                             FIRST   LAST    END     INCR
17
static unsigned int color_table[4][10][4] = {{{0x0001, 0x001F, 0x001F, 0x0001} ,
18
                                              {0x003F, 0x03FF, 0x03FF, 0x0020} ,
19
                                              {0x041F, 0x07DF, 0x07FF, 0x0020} ,
20
                                              {0x07FE, 0x07E0, 0x07E0, 0xFFFF} ,
21
                                              {0x0FE0, 0xFFE0, 0xFFE0, 0x0800} ,
22
                                              {0xFFE1, 0xFFFF, 0xFFFF, 0x0001} ,
23
                                              {0xFFDF, 0xFC1F, 0xFC1F, 0xFFE0} ,
24
                                              {0xFBFF, 0xF83F, 0xF81F, 0xFFE0} ,
25
                                              {0xF81E, 0xF800, 0xF800, 0xFFFF} ,
26
                                              {0xF000, 0x0000, 0x0000, 0xF800}},
27
//                                             FIRST   LAST    END     INCR
28
                                             {{0x0001, 0x001F, 0x001F, 0x0001} ,
29
                                              {0x081F, 0xF81F, 0xF81F, 0x0800} ,
30
                                              {0xF81E, 0xF800, 0xF800, 0xFFFF} ,
31
                                              {0xF820, 0xFBE0, 0xFBE0, 0x0020} ,
32
                                              {0xFC00, 0xFFC0, 0xFFE0, 0x0020} ,
33
                                              {0xFFE1, 0xFFFF, 0xFFFF, 0x0001} ,
34
                                              {0xF7FF, 0x07FF, 0x07FF, 0xF800} ,
35
                                              {0x07FE, 0x07E0, 0x07E0, 0xFFFF} ,
36
                                              {0x07C0, 0x0400, 0x0400, 0xFFE0} ,
37
                                              {0x03E0, 0x0020, 0x0000, 0xFFE0}},
38
//                                             FIRST   LAST    END     INCR
39
                                             {{0x0800, 0xF800, 0xF800, 0x0800} ,
40
                                              {0xF801, 0xF81F, 0xF81F, 0x0001} ,
41
                                              {0xF01F, 0x001F, 0x001F, 0xF800} ,
42
                                              {0x003F, 0x03FF, 0x03FF, 0x0020} ,
43
                                              {0x041F, 0x07DF, 0x07FF, 0x0020} ,
44
                                              {0x0FFF, 0xFFFF, 0xFFFF, 0x0800} ,
45
                                              {0xFFFE, 0xFFE0, 0xFFE0, 0xFFFF} ,
46
                                              {0xF7E0, 0x07E0, 0x07E0, 0xF800} ,
47
                                              {0x07C0, 0x0400, 0x0400, 0xFFE0} ,
48
                                              {0x03E0, 0x0020, 0x0000, 0xFFE0}},
49
//                                             FIRST   LAST    END     INCR
50
                                             {{0x0800, 0xF800, 0xF800, 0x0800} ,
51
                                              {0xF820, 0xFBE0, 0xFBE0, 0x0020} ,
52
                                              {0xFC00, 0xFFC0, 0xFFE0, 0x0020} ,
53
                                              {0xF7E0, 0x07E0, 0x07E0, 0xF800} ,
54
                                              {0x07E1, 0x07FF, 0x07FF, 0x0001} ,
55
                                              {0x0FFF, 0xFFFF, 0xFFFF, 0x0800} ,
56
                                              {0xFFDF, 0xFC1F, 0xFC1F, 0xFFE0} ,
57
                                              {0xFBFF, 0xF83F, 0xF81F, 0xFFE0} ,
58
                                              {0xF01F, 0x001F, 0x001F, 0xF800} ,
59
                                              {0x001E, 0x0000, 0x0000, 0xFFFF}}};
60
 
61
//---------------------------------------------------//
62
// BASIC FUNCTIONS
63
//---------------------------------------------------//
64
 
65
void draw_block(uint32_t addr, uint16_t width, uint16_t length, uint16_t color, uint16_t swap_configuration, uint16_t use_gpu) {
66
 
67
  unsigned int line, column;
68
 
69
  if (use_gpu) { // Hardware FILL
70
 
71
    gpu_fill (addr, width, length, color, swap_configuration);
72
 
73
  } else {       // Software FILL
74
    VID_RAM0_CFG   = VID_RAM_WIN_MODE | VID_RAM_MSK_MODE | swap_configuration;
75
    VID_RAM0_WIDTH = width;
76
    VID_RAM0_ADDR  = addr;
77
 
78
    for( line = 0; line < length; line = line + 1 ) {
79
      for( column = 0; column < width; column = column + 1 ) {
80
        VID_RAM0_DATA = color;
81
      }
82
    }
83
  }
84
}
85
 
86
 
87
grad_color increment_gradient(grad_color mycolor) {
88
 
89
  if (mycolor.color==color_table[mycolor.palette][mycolor.index][1]) {
90
    if (mycolor.index==9) {
91
      mycolor.index = 0;
92
      if (mycolor.palette==3) {
93
        mycolor.palette = 0;
94
      } else {
95
        mycolor.palette++;
96
      }
97
    } else {
98
      mycolor.index++;
99
    }
100
    mycolor.color         = color_table[mycolor.palette][mycolor.index][0]-color_table[mycolor.palette][mycolor.index][3];
101
    mycolor.line_nr_start = 31;
102
  } else {
103
    mycolor.color         = mycolor.color+color_table[mycolor.palette][mycolor.index][3];
104
    mycolor.line_nr_start--;
105
  }
106
  return mycolor;
107
}
108
 
109
 
110
grad_color draw_gradient(grad_color mycolor, uint16_t width, int length, int incr_index) {
111
 
112
  unsigned int column;
113
  unsigned int nr_lines;
114
 
115
  nr_lines = length;
116
 
117
  // Fill the color gradient segment
118
  while (nr_lines!=0) {
119
    mycolor.color = mycolor.color+color_table[mycolor.palette][mycolor.index][3];
120
    for( column = 0; column < width; column = column + 1 ) {
121
      VID_RAM0_DATA = mycolor.color;
122
    }
123
    nr_lines--;
124
  };
125
 
126
  // Re-init values if we move to the next index
127
  if (incr_index) {
128
    mycolor.color = color_table[mycolor.palette][mycolor.index][2];
129
    if (mycolor.index==9) {mycolor.index = 0;}
130
    else                  {mycolor.index++;  }
131
  }
132
 
133
  return mycolor;
134
}
135
 
136
//---------------------------------------------------//
137
// 16BPP DEMO
138
//---------------------------------------------------//
139
 
140
void demo_16bpp(void) {
141
 
142
  unsigned int  loop;
143
  unsigned int  width;
144
  unsigned int  gpu_pxop;
145
  grad_color    omsp_color;
146
  unsigned int  m_color;
147
  unsigned int  s_color;
148
  unsigned int  p_color;
149
  grad_color    ogfx_color;
150
  unsigned int  g_color;
151
  unsigned int  f_color;
152
  unsigned int  x_color;
153
  unsigned int  use_gpu     =  0;
154
 
155
  const uint16_t offset_x   = 35;
156
  const uint16_t offset_y   = 95;
157
  const uint16_t char_width =  7;
158
 
159
  // Screen introduction
160
  gpu_fill (PIX_ADDR(0,                                    0                    ), 320,          240,          0x0000, DST_SWAP_NONE); // Background
161
 
162
  gpu_fill (PIX_ADDR(offset_x+0*6*char_width+2*char_width, offset_y+0*char_width), 1*char_width, 6*char_width, 0x001F, DST_SWAP_NONE); // 1
163
  gpu_fill (PIX_ADDR(offset_x+0*6*char_width+1*char_width, offset_y+1*char_width), 1*char_width, 1*char_width, 0x001F, DST_SWAP_NONE);
164
  gpu_fill (PIX_ADDR(offset_x+0*6*char_width+1*char_width, offset_y+6*char_width), 3*char_width, 1*char_width, 0x001F, DST_SWAP_NONE);
165
 
166
  gpu_fill (PIX_ADDR(offset_x+1*6*char_width+2*char_width, offset_y+0*char_width), 2*char_width, 1*char_width, 0x001F, DST_SWAP_NONE); // 6
167
  gpu_fill (PIX_ADDR(offset_x+1*6*char_width+1*char_width, offset_y+1*char_width), 1*char_width, 1*char_width, 0x001F, DST_SWAP_NONE);
168
  gpu_fill (PIX_ADDR(offset_x+1*6*char_width+0*char_width, offset_y+2*char_width), 1*char_width, 4*char_width, 0x001F, DST_SWAP_NONE);
169
  gpu_fill (PIX_ADDR(offset_x+1*6*char_width+1*char_width, offset_y+3*char_width), 3*char_width, 1*char_width, 0x001F, DST_SWAP_NONE);
170
  gpu_fill (PIX_ADDR(offset_x+1*6*char_width+1*char_width, offset_y+6*char_width), 3*char_width, 1*char_width, 0x001F, DST_SWAP_NONE);
171
  gpu_fill (PIX_ADDR(offset_x+1*6*char_width+4*char_width, offset_y+4*char_width), 1*char_width, 2*char_width, 0x001F, DST_SWAP_NONE);
172
 
173
  gpu_fill (PIX_ADDR(offset_x+3*6*char_width+0*char_width, offset_y+0*char_width), 1*char_width, 6*char_width, 0x001F, DST_SWAP_NONE); // b
174
  gpu_fill (PIX_ADDR(offset_x+3*6*char_width+1*char_width, offset_y+6*char_width), 3*char_width, 1*char_width, 0x001F, DST_SWAP_NONE);
175
  gpu_fill (PIX_ADDR(offset_x+3*6*char_width+1*char_width, offset_y+4*char_width), 1*char_width, 1*char_width, 0x001F, DST_SWAP_NONE);
176
  gpu_fill (PIX_ADDR(offset_x+3*6*char_width+2*char_width, offset_y+3*char_width), 2*char_width, 1*char_width, 0x001F, DST_SWAP_NONE);
177
  gpu_fill (PIX_ADDR(offset_x+3*6*char_width+4*char_width, offset_y+4*char_width), 1*char_width, 2*char_width, 0x001F, DST_SWAP_NONE);
178
 
179
  gpu_fill (PIX_ADDR(offset_x+4*6*char_width+0*char_width, offset_y+2*char_width), 1*char_width, 5*char_width, 0x001F, DST_SWAP_NONE); // p
180
  gpu_fill (PIX_ADDR(offset_x+4*6*char_width+1*char_width, offset_y+2*char_width), 3*char_width, 1*char_width, 0x001F, DST_SWAP_NONE);
181
  gpu_fill (PIX_ADDR(offset_x+4*6*char_width+1*char_width, offset_y+4*char_width), 3*char_width, 1*char_width, 0x001F, DST_SWAP_NONE);
182
  gpu_fill (PIX_ADDR(offset_x+4*6*char_width+4*char_width, offset_y+3*char_width), 1*char_width, 1*char_width, 0x001F, DST_SWAP_NONE);
183
 
184
  gpu_fill (PIX_ADDR(offset_x+5*6*char_width+0*char_width, offset_y+2*char_width), 1*char_width, 5*char_width, 0x001F, DST_SWAP_NONE); // p
185
  gpu_fill (PIX_ADDR(offset_x+5*6*char_width+1*char_width, offset_y+2*char_width), 3*char_width, 1*char_width, 0x001F, DST_SWAP_NONE);
186
  gpu_fill (PIX_ADDR(offset_x+5*6*char_width+1*char_width, offset_y+4*char_width), 3*char_width, 1*char_width, 0x001F, DST_SWAP_NONE);
187
  gpu_fill (PIX_ADDR(offset_x+5*6*char_width+4*char_width, offset_y+3*char_width), 1*char_width, 1*char_width, 0x001F, DST_SWAP_NONE);
188
 
189
  ta_wait_no_lpm(WT_500MS);
190
  ta_wait_no_lpm(WT_500MS);
191
  ta_wait_no_lpm(WT_500MS);
192
  ta_wait_no_lpm(WT_500MS);
193
 
194
  gpu_fill (PIX_ADDR(0,                                    0                    ), 320,          240,          0x0000, DST_SWAP_NONE); // Background
195
 
196
  loop = 0;
197
  while (loop <4) {
198
 
199
    // Wait for on-going GPU operation to be done before moving on
200
    gpu_wait_done();
201
 
202
    // Select rotation & GPU use
203
    switch(loop & 0x0003) {
204
    case 0 : DISPLAY_CFG = DST_SWAP_CL;      use_gpu = 0;
205
             break;
206
    case 1 : DISPLAY_CFG = DST_SWAP_CL;      use_gpu = 1;
207
             break;
208
    case 2 : DISPLAY_CFG = DST_SWAP_X_Y_CL;  use_gpu = 0;
209
             break;
210
    default: DISPLAY_CFG = DST_SWAP_X_Y_CL;  use_gpu = 1;
211
             break;
212
    }
213
    loop++;
214
    move_to_next_mode = 0;
215
 
216
    // Initialize colors
217
    omsp_color.color           = 0x0000;
218
    omsp_color.index           = 0;
219
    omsp_color.palette         = 0;
220
    omsp_color.line_nr_start   = 31;
221
 
222
    ogfx_color.color           = 0x0000;
223
    ogfx_color.index           = 0;
224
    ogfx_color.palette         = 2;
225
    ogfx_color.line_nr_start   = 31;
226
 
227
    // Play the demo
228
    while (!move_to_next_mode) {
229
 
230
      //-----------------------------------------
231
      // DRAW 'RGB' FLAG
232
      //-----------------------------------------
233
      // Note that the drawing is done using the window mode
234
 
235
      VID_RAM0_WIDTH = 5;
236
      draw_block      (PIX_ADDR( 0, 0), 5, 15, 0xF800, DST_SWAP_NONE, use_gpu);
237
      draw_block      (PIX_ADDR( 5, 0), 5, 15, 0x07E0, DST_SWAP_NONE, use_gpu);
238
      draw_block      (PIX_ADDR(10, 0), 5, 15, 0x001F, DST_SWAP_NONE, use_gpu);
239
 
240
      //-----------------------------------------
241
      // Draw 'O' of Omsp
242
      //-----------------------------------------
243
 
244
      // Set width and increment color
245
      width   = 15;
246
      omsp_color = increment_gradient(omsp_color);
247
      ogfx_color = increment_gradient(ogfx_color);
248
 
249
      VID_RAM0_WIDTH = width;
250
 
251
      // Top bar
252
      VID_RAM0_CFG   = VID_RAM_WIN_MODE | DST_SWAP_Y_CL;
253
      VID_RAM0_ADDR  = PIX_ADDR(31, 118);
254
 
255
      omsp_color     = draw_gradient(omsp_color,        width, omsp_color.line_nr_start   , 1);
256
      omsp_color     = draw_gradient(omsp_color,        width, 31                         , 1);
257
      omsp_color     = draw_gradient(omsp_color,        width, 31-omsp_color.line_nr_start, 0);
258
      draw_block      (PIX_ADDR(31+2*31, 118),          width, width, omsp_color.color, DST_SWAP_Y_CL, use_gpu);
259
 
260
      // Right bar
261
      VID_RAM0_CFG   = VID_RAM_WIN_MODE | DST_SWAP_NONE;
262
      VID_RAM0_ADDR  = PIX_ADDR(31+2*31, 118+1);
263
 
264
      omsp_color     = draw_gradient(omsp_color,        width, omsp_color.line_nr_start   , 1);
265
      omsp_color     = draw_gradient(omsp_color,        width, 31                         , 1);
266
      omsp_color     = draw_gradient(omsp_color,        width, 31                         , 1);
267
      omsp_color     = draw_gradient(omsp_color,        width, 31-omsp_color.line_nr_start, 0);
268
      draw_block      (PIX_ADDR(31+2*31, 118+3*31+1),   width, width, omsp_color.color, DST_SWAP_NONE, use_gpu);
269
 
270
      // Bottom bar
271
      VID_RAM0_CFG   = VID_RAM_WIN_MODE | DST_SWAP_X_CL;
272
      VID_RAM0_ADDR  = PIX_ADDR(31+2*31-1, 118+3*31+1);
273
 
274
      omsp_color     = draw_gradient(omsp_color,        width, omsp_color.line_nr_start   , 1);
275
      omsp_color     = draw_gradient(omsp_color,        width, 31                         , 1);
276
      omsp_color     = draw_gradient(omsp_color,        width, 31-omsp_color.line_nr_start, 0);
277
      draw_block      (PIX_ADDR(31-1, 118+3*31+1),      width, width, omsp_color.color, DST_SWAP_X_CL, use_gpu);
278
 
279
      // Left bar
280
      VID_RAM0_CFG   = VID_RAM_WIN_MODE | DST_SWAP_X_Y;
281
      VID_RAM0_ADDR  = PIX_ADDR(31-1, 118+3*31);
282
 
283
      omsp_color     = draw_gradient(omsp_color,        width, omsp_color.line_nr_start   , 1);
284
      omsp_color     = draw_gradient(omsp_color,        width, 31                         , 1);
285
      omsp_color     = draw_gradient(omsp_color,        width, 31                         , 1);
286
      omsp_color     = draw_gradient(omsp_color,        width, 31-omsp_color.line_nr_start, 0);
287
      draw_block      (PIX_ADDR(31-1, 118),             width, width, omsp_color.color, DST_SWAP_X_Y, use_gpu);
288
 
289
      //-----------------------------------------
290
      // Draw 'MSP'
291
      //-----------------------------------------
292
      VID_RAM0_WIDTH = 8;
293
 
294
      // Probe the colors for the 'M', 'S' and 'P'
295
      gpu_wait_done();
296
      VID_RAM0_ADDR  = PIX_ADDR(31+2*31, 118+3*31+2);
297
      __nop();
298
      __nop();
299
      m_color        = VID_RAM0_DATA;
300
      VID_RAM0_ADDR  = PIX_ADDR(31+2*31, 118+3*31+2-20);
301
      __nop();
302
      s_color        = VID_RAM0_DATA;
303
      VID_RAM0_ADDR  = PIX_ADDR(31+2*31, 118+3*31+2-40);
304
      __nop();
305
      p_color        = VID_RAM0_DATA;
306
 
307
      // 'M'
308
      draw_block      (PIX_ADDR(130    , 169    ), 8, 56, m_color, DST_SWAP_NONE, use_gpu);
309
      draw_block      (PIX_ADDR(130+  8, 169+  8), 8,  8, m_color, DST_SWAP_NONE, use_gpu);
310
      draw_block      (PIX_ADDR(130+2*8, 169+2*8), 8, 16, m_color, DST_SWAP_NONE, use_gpu);
311
      draw_block      (PIX_ADDR(130+3*8, 169+  8), 8,  8, m_color, DST_SWAP_NONE, use_gpu);
312
      draw_block      (PIX_ADDR(130+4*8, 169    ), 8, 56, m_color, DST_SWAP_NONE, use_gpu);
313
 
314
      // 'S'
315
      draw_block      (PIX_ADDR(180    , 169+  8), 8, 16, s_color, DST_SWAP_NONE, use_gpu);
316
      draw_block      (PIX_ADDR(180+4*8, 169+4*8), 8, 16, s_color, DST_SWAP_NONE, use_gpu);
317
      draw_block      (PIX_ADDR(180+  8, 169    ), 8, 32, s_color, DST_SWAP_CL  , use_gpu);
318
      draw_block      (PIX_ADDR(180+  8, 169+3*8), 8, 24, s_color, DST_SWAP_CL  , use_gpu);
319
      draw_block      (PIX_ADDR(180    , 169+6*8), 8, 32, s_color, DST_SWAP_CL  , use_gpu);
320
 
321
      // 'P'
322
      draw_block      (PIX_ADDR(230    , 169    ), 8, 56, p_color, DST_SWAP_NONE, use_gpu);
323
      draw_block      (PIX_ADDR(230+4*8, 169+  8), 8, 16, p_color, DST_SWAP_NONE, use_gpu);
324
      draw_block      (PIX_ADDR(230+  8, 169    ), 8, 24, p_color, DST_SWAP_CL  , use_gpu);
325
      draw_block      (PIX_ADDR(230+  8, 169+3*8), 8, 24, p_color, DST_SWAP_CL  , use_gpu);
326
 
327
      //-----------------------------------------
328
      // Draw 'O' of Ogfx
329
      //-----------------------------------------
330
      width = 15;
331
 
332
      gpu_pxop           = GPU_PXOP_1;
333
 
334
      VID_RAM0_WIDTH     = width;
335
 
336
      // Top bar
337
      if (use_gpu==0) {    // Software update
338
        VID_RAM0_CFG     = VID_RAM_WIN_MODE | DST_SWAP_X_Y_CL;
339
        VID_RAM0_ADDR    = PIX_ADDR(289, 30);
340
        ogfx_color       = draw_gradient(ogfx_color,          width, ogfx_color.line_nr_start   , 1);
341
        ogfx_color       = draw_gradient(ogfx_color,          width, 31                         , 1);
342
        ogfx_color       = draw_gradient(ogfx_color,          width, 31-ogfx_color.line_nr_start, 0);
343
      } else {             // Hardware update
344
        gpu_copy          (PIX_ADDR(1*31, 118), PIX_ADDR(289   , 30), width, 31, gpu_pxop | SRC_SWAP_Y_CL | DST_SWAP_X_Y_CL);
345
        gpu_copy          (PIX_ADDR(2*31, 118), PIX_ADDR(289-31, 30), width, 31, gpu_pxop | SRC_SWAP_Y_CL | DST_SWAP_X_Y_CL);
346
        gpu_wait_done();
347
        VID_RAM0_ADDR    = PIX_ADDR(289-2*31+1, 30);
348
        ogfx_color.color = VID_RAM0_DATA;
349
      }
350
      draw_block          (PIX_ADDR(289-2*31, 30),            width, width, ogfx_color.color, DST_SWAP_X_Y_CL, use_gpu);
351
 
352
      // Left bar
353
      if (use_gpu==0) {    // Software update
354
        VID_RAM0_CFG     = VID_RAM_WIN_MODE | DST_SWAP_X;
355
        VID_RAM0_ADDR    = PIX_ADDR(289-2*31, 31);
356
        ogfx_color       = draw_gradient(ogfx_color,          width, ogfx_color.line_nr_start   , 1);
357
        ogfx_color       = draw_gradient(ogfx_color,          width, 31                         , 1);
358
        ogfx_color       = draw_gradient(ogfx_color,          width, 31                         , 1);
359
        ogfx_color       = draw_gradient(ogfx_color,          width, 31-ogfx_color.line_nr_start, 0);
360
      } else {             // Hardware update
361
        gpu_copy          (PIX_ADDR(30+2*31+1, 118+1+0*31), PIX_ADDR(289-2*31, 30+1+0*31), width, 31, gpu_pxop | SRC_SWAP_NONE | DST_SWAP_X);
362
        gpu_copy          (PIX_ADDR(30+2*31+1, 118+1+1*31), PIX_ADDR(289-2*31, 30+1+1*31), width, 31, gpu_pxop | SRC_SWAP_NONE | DST_SWAP_X);
363
        gpu_copy          (PIX_ADDR(30+2*31+1, 118+1+2*31), PIX_ADDR(289-2*31, 30+1+2*31), width, 31, gpu_pxop | SRC_SWAP_NONE | DST_SWAP_X);
364
        gpu_wait_done();
365
        VID_RAM0_ADDR    = PIX_ADDR(289-2*31, 30+3*31);
366
        ogfx_color.color = VID_RAM0_DATA;
367
      }
368
      draw_block          (PIX_ADDR(289-2*31, 30+1+3*31),    width, width, ogfx_color.color, DST_SWAP_X, use_gpu);
369
 
370
      // Bottom bar
371
      if (use_gpu==0) {    // Software update
372
        VID_RAM0_CFG     = VID_RAM_WIN_MODE | DST_SWAP_CL;
373
        VID_RAM0_ADDR    = PIX_ADDR(290-2*31, 30+1+3*31);
374
        ogfx_color       = draw_gradient(ogfx_color,          width, ogfx_color.line_nr_start   , 1);
375
        ogfx_color       = draw_gradient(ogfx_color,          width, 31                         , 1);
376
        ogfx_color       = draw_gradient(ogfx_color,          width, 31-ogfx_color.line_nr_start, 0);
377
      } else {             // Hardware update
378
        gpu_copy          (PIX_ADDR(30+2*31   , 118+3*31+1), PIX_ADDR(290-2*31, 30+1+3*31), width, 31, gpu_pxop | SRC_SWAP_X_CL | DST_SWAP_CL);
379
        gpu_copy          (PIX_ADDR(30+2*31-31, 118+3*31+1), PIX_ADDR(290-1*31, 30+1+3*31), width, 31, gpu_pxop | SRC_SWAP_X_CL | DST_SWAP_CL);
380
        gpu_wait_done();
381
        VID_RAM0_ADDR    = PIX_ADDR(290-1, 30+1+3*31);
382
        ogfx_color.color = VID_RAM0_DATA;
383
      }
384
      draw_block          (PIX_ADDR(290, 30+3*31+1),          width, width, ogfx_color.color, DST_SWAP_CL, use_gpu);
385
 
386
      // Right bar
387
      if (use_gpu==0) {    // Software update
388
        VID_RAM0_CFG     = VID_RAM_WIN_MODE | DST_SWAP_Y;
389
        VID_RAM0_ADDR    = PIX_ADDR(290, 30+3*31);
390
        ogfx_color       = draw_gradient(ogfx_color,          width, ogfx_color.line_nr_start   , 1);
391
        ogfx_color       = draw_gradient(ogfx_color,          width, 31                         , 1);
392
        ogfx_color       = draw_gradient(ogfx_color,          width, 31                         , 1);
393
        ogfx_color       = draw_gradient(ogfx_color,          width, 31-ogfx_color.line_nr_start, 0);
394
      } else {             // Hardware update
395
        gpu_copy          (PIX_ADDR(30, 118+3*31), PIX_ADDR(290, 30+3*31), width, 31, gpu_pxop | SRC_SWAP_X_Y | DST_SWAP_Y);
396
        gpu_copy          (PIX_ADDR(30, 118+2*31), PIX_ADDR(290, 30+2*31), width, 31, gpu_pxop | SRC_SWAP_X_Y | DST_SWAP_Y);
397
        gpu_copy          (PIX_ADDR(30, 118+1*31), PIX_ADDR(290, 30+1*31), width, 31, gpu_pxop | SRC_SWAP_X_Y | DST_SWAP_Y);
398
        gpu_wait_done();
399
        VID_RAM0_ADDR    = PIX_ADDR(290, 30+1);
400
        ogfx_color.color = VID_RAM0_DATA;
401
      }
402
      draw_block          (PIX_ADDR(290, 30), width, width, ogfx_color.color, DST_SWAP_Y, use_gpu);
403
 
404
      //-----------------------------------------
405
      // Draw 'GFX'
406
      //-----------------------------------------
407
      VID_RAM0_WIDTH   = 8;
408
 
409
      // Probe the colors for the 'G', 'F' and 'X'
410
      gpu_wait_done();
411
      VID_RAM0_ADDR    = PIX_ADDR(289-2*31   , 30-1);
412
      __nop();
413
      __nop();
414
      g_color          = VID_RAM0_DATA;
415
      VID_RAM0_ADDR    = PIX_ADDR(289-2*31+20, 30-1);
416
      __nop();
417
      f_color          = VID_RAM0_DATA;
418
      VID_RAM0_ADDR    = PIX_ADDR(289-2*31+40, 30-1);
419
      __nop();
420
      x_color          = VID_RAM0_DATA;
421
 
422
      // 'G'
423
      draw_block   (PIX_ADDR(150    , 15    ), 8, 32, g_color, DST_SWAP_NONE, use_gpu);
424
      draw_block   (PIX_ADDR(150    , 15+5*8), 8,  8, g_color, DST_SWAP_NONE, use_gpu);
425
      draw_block   (PIX_ADDR(150+4*8, 15+  8), 8, 40, g_color, DST_SWAP_NONE, use_gpu);
426
      draw_block   (PIX_ADDR(150+  8, 15    ), 8, 24, g_color, DST_SWAP_CL  , use_gpu);
427
      draw_block   (PIX_ADDR(150+  8, 15+3*8), 8, 16, g_color, DST_SWAP_CL  , use_gpu);
428
      draw_block   (PIX_ADDR(150+  8, 15+6*8), 8, 24, g_color, DST_SWAP_CL  , use_gpu);
429
 
430
      // 'F'
431
      draw_block   (PIX_ADDR(100+4*8, 15    ), 8, 56, f_color, DST_SWAP_NONE, use_gpu);
432
      draw_block   (PIX_ADDR(100+  8, 15+3*8), 8, 24, f_color, DST_SWAP_CL  , use_gpu);
433
      draw_block   (PIX_ADDR(100    , 15+6*8), 8, 32, f_color, DST_SWAP_CL  , use_gpu);
434
 
435
      // 'X'
436
      draw_block   (PIX_ADDR(50     , 15    ), 8, 16, x_color, DST_SWAP_NONE, use_gpu);
437
      draw_block   (PIX_ADDR(50+4*8 , 15    ), 8, 16, x_color, DST_SWAP_NONE, use_gpu);
438
      draw_block   (PIX_ADDR(50     , 15+5*8), 8, 16, x_color, DST_SWAP_NONE, use_gpu);
439
      draw_block   (PIX_ADDR(50+4*8 , 15+5*8), 8, 16, x_color, DST_SWAP_NONE, use_gpu);
440
      draw_block   (PIX_ADDR(50+  8 , 15+2*8), 8,  8, x_color, DST_SWAP_NONE, use_gpu);
441
      draw_block   (PIX_ADDR(50+3*8 , 15+2*8), 8,  8, x_color, DST_SWAP_NONE, use_gpu);
442
      draw_block   (PIX_ADDR(50+2*8 , 15+3*8), 8,  8, x_color, DST_SWAP_NONE, use_gpu);
443
      draw_block   (PIX_ADDR(50+  8 , 15+4*8), 8,  8, x_color, DST_SWAP_NONE, use_gpu);
444
      draw_block   (PIX_ADDR(50+3*8 , 15+4*8), 8,  8, x_color, DST_SWAP_NONE, use_gpu);
445
    }
446
  }
447
}

powered by: WebSVN 2.1.0

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