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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [arm/] [sa11x0/] [cerfpda/] [v2_0/] [misc/] [lcd_test.c] - Blame information for rev 27

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

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//
3
//        lcd_test.c
4
//
5
//        SA1110/CerfCube - LCD test
6
//
7
//==========================================================================
8
//####ECOSGPLCOPYRIGHTBEGIN####
9
// -------------------------------------------
10
// This file is part of eCos, the Embedded Configurable Operating System.
11
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12
//
13
// eCos is free software; you can redistribute it and/or modify it under
14
// the terms of the GNU General Public License as published by the Free
15
// Software Foundation; either version 2 or (at your option) any later version.
16
//
17
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
19
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20
// for more details.
21
//
22
// You should have received a copy of the GNU General Public License along
23
// with eCos; if not, write to the Free Software Foundation, Inc.,
24
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25
//
26
// As a special exception, if other files instantiate templates or use macros
27
// or inline functions from this file, or you compile this file and link it
28
// with other works to produce a work based on this file, this file does not
29
// by itself cause the resulting work to be covered by the GNU General Public
30
// License. However the source code for this file must still be made available
31
// in accordance with section (3) of the GNU General Public License.
32
//
33
// This exception does not invalidate any other reasons why a work based on
34
// this file might be covered by the GNU General Public License.
35
//
36
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37
// at http://sources.redhat.com/ecos/ecos-license/
38
// -------------------------------------------
39
//####ECOSGPLCOPYRIGHTEND####
40
//==========================================================================
41
//#####DESCRIPTIONBEGIN####
42
//
43
// Author(s):     gthomas
44
// Contributors:  gthomas
45
// Date:          2000-06-05
46
// Description:   Tool used to test LCD stuff
47
//####DESCRIPTIONEND####
48
 
49
#include <pkgconf/kernel.h>       // Configuration header
50
#include <cyg/kernel/kapi.h>
51
#include <cyg/infra/diag.h>
52
 
53
#include <cyg/hal/hal_io.h>       // IO macros
54
#include <cyg/hal/hal_arch.h>     // Register state info
55
#include <cyg/hal/hal_intr.h>     // HAL interrupt macros
56
 
57
#include <cyg/hal/hal_sa11x0.h>   // Board definitions
58
#include <cyg/hal/cerf.h>
59
#include <cyg/hal/hal_cache.h>
60
 
61
#include "eCos.xpm"
62
#include "eCos2.xpm"
63
#include "redhat.xpm"
64
#include "redhat2.xpm"
65
#include "redboot.xpm"
66
#include "escw.xpm"
67
#include "logo.xpm"
68
 
69
#ifndef FALSE
70
#define FALSE 0
71
#define TRUE  1
72
#endif
73
 
74
#define STACK_SIZE 4096
75
static char stack[STACK_SIZE];
76
static cyg_thread thread_data;
77
static cyg_handle_t thread_handle;
78
 
79
// FUNCTIONS
80
 
81
static void
82
cyg_test_exit(void)
83
{
84
    while (TRUE) ;
85
}
86
 
87
static void
88
lcd_test(cyg_addrword_t p)
89
{
90
    int i, pix, row, col;
91
    int on;
92
 
93
    diag_printf("LCD test here\n");
94
 
95
    lcd_init(16);
96
#if 0
97
    for (i = 0;  i < 16;  i++) {
98
        on = true;
99
        diag_printf("Fill with 0x%x\n", i);
100
        for (row = 0;  row < 240;  row++) {
101
            for (col = 0;  col < 320/2;  col++) {
102
                if (on) {
103
                    fp->pixels[row][col] = RGB_RED(i)|RGB_GREEN(i)|RGB_BLUE(i);
104
                } else {
105
                    fp->pixels[row][col] = 0xFFFF;
106
                }
107
            }
108
            for (col = 320/2;  col < 320;  col++) {
109
                if (!on) {
110
                    fp->pixels[row][col] = RGB_RED(i)|RGB_GREEN(i)|RGB_BLUE(i);
111
                } else {
112
                    fp->pixels[row][col] = 0xFFFF;
113
                }
114
            }
115
            if ((row & 0x0F) == 0x0F) {
116
                if (on) {
117
                    on = false;
118
                } else {
119
                    on = true;
120
                }
121
            }
122
        }
123
        cyg_thread_delay(100);
124
    }
125
#endif
126
#if 0
127
    for (i = 0;  i < 4;  i++) {
128
        for (row = 0;  row < 240;  row++) {
129
            for (col = 0;  col < 320;  col++) {
130
                switch (row/40) {
131
                case 0:
132
                    pix = col / 20;  // 0..15
133
                    fp->pixels[row][col] = RGB_RED(pix);
134
                    break;
135
                case 1:
136
                    pix = col / 10;  // 0..31
137
                    fp->pixels[row][col] = RGB_GREEN(pix);
138
                    break;
139
                case 2:
140
                    pix = col / 20;  // 0..15
141
                    fp->pixels[row][col] = RGB_BLUE(pix);
142
                    break;
143
                case 3:
144
                    pix = col / 20;  // 0..15
145
                    fp->pixels[row][col] = RGB_BLUE(pix) | RGB_GREEN(pix);
146
                    break;
147
                case 4:
148
                    pix = col / 20;  // 0..15
149
                    fp->pixels[row][col] = RGB_BLUE(15) | RGB_GREEN(pix);
150
                    break;
151
                case 5:
152
                    fp->pixels[row][col] = 0xFFFF;
153
                    break;
154
                }
155
            }
156
        }
157
        cyg_thread_delay(100);
158
#if 0
159
        for (row = 0;  row < 240;  row++) {
160
            for (col = 0;  col < 320;  col++) {
161
                pix = col / 20;  // 0..15
162
                switch (row/60) {
163
                case 0:
164
                    fp->pixels[row][col] = RGB_RED(pix);
165
                    break;
166
                case 1:
167
                    fp->pixels[row][col] = RGB_GREEN(pix);
168
                    break;
169
                case 2:
170
                    fp->pixels[row][col] = RGB_BLUE(pix);
171
                    break;
172
                case 3:
173
                    fp->pixels[row][col] = 0xFFFF;
174
                    break;
175
                }
176
            }
177
        }
178
        cyg_thread_delay(100);
179
#endif
180
#if 0
181
        on = true;
182
        for (row = 0;  row < 240;  row++) {
183
            for (col = 0;  col < 320/2;  col++) {
184
                if (on) {
185
                    fp->pixels[row][col] = RGB_GREEN(15);
186
                } else {
187
                    fp->pixels[row][col] = RGB_BLUE(8);
188
                }
189
            }
190
            for (col = 320/2;  col < 320;  col++) {
191
                if (!on) {
192
                    fp->pixels[row][col] = RGB_GREEN(15);
193
                } else {
194
                    fp->pixels[row][col] = RGB_BLUE(8);
195
                }
196
            }
197
            if ((row & 0x0F) == 0x0F) {
198
                if (on) {
199
                    on = false;
200
                } else {
201
                    on = true;
202
                }
203
            }
204
        }
205
#endif
206
    }
207
#endif
208
#if 0
209
    for (row = 0;  row < 240;  row++) {
210
        for (col = 0;  col < 320;  col++) {
211
            if (col == 59) {
212
                fp->pixels[row][col] = 0x0000;
213
            } else {
214
                fp->pixels[row][col] = 0xFFFF;
215
            }
216
        }
217
    }
218
    cyg_thread_delay(100);
219
#endif
220
#if 0
221
    for (i = 0;  i < 16;  i++) {
222
        diag_printf("Value 0x%04x\n", (1<<i));
223
        for (row = 0;  row < 240;  row++) {
224
            for (col = 0;  col < 320;  col++) {
225
                fp->pixels[row][col] = (1<<i);
226
            }
227
        }
228
        cyg_thread_delay(500);
229
    }
230
#endif
231
#if 0
232
    for (i = 0;  i < 32;  i++) {
233
        diag_printf("Red at %d\n", i);
234
        for (row = 0;  row < 240;  row++) {
235
            for (col = 0;  col < 320;  col++) {
236
                fp->pixels[row][col] = RGB_RED(i);
237
            }
238
        }
239
        cyg_thread_delay(100);
240
    }
241
#endif
242
#if 0
243
    for (i = 0;  i < 64;  i++) {
244
        diag_printf("Green at %d\n", i);
245
        for (row = 0;  row < 240;  row++) {
246
            for (col = 0;  col < 320;  col++) {
247
                fp->pixels[row][col] = RGB_GREEN(i);
248
            }
249
        }
250
        cyg_thread_delay(100);
251
    }
252
#endif
253
#if 0
254
    for (i = 0;  i < 32;  i++) {
255
        diag_printf("BLUE at %d\n", i);
256
        for (row = 0;  row < 240;  row++) {
257
            for (col = 0;  col < 320;  col++) {
258
                fp->pixels[row][col] = RGB_BLUE(i);
259
            }
260
        }
261
        cyg_thread_delay(100);
262
    }
263
#endif
264
 
265
    while (true) {
266
    for (i = 0;  i < 1;  i++) {
267
        show_xpm(redboot_xpm);
268
        cyg_thread_delay(15);
269
        show_xpm(eCos_xpm);
270
        cyg_thread_delay(25);
271
        show_xpm(redboot_xpm);
272
        cyg_thread_delay(15);
273
        show_xpm(redhat_xpm);
274
        cyg_thread_delay(25);
275
        show_xpm(redboot_xpm);
276
        cyg_thread_delay(25);
277
        show_xpm(redboot_xpm);
278
        cyg_thread_delay(15);
279
        show_xpm(escw_xpm);
280
        cyg_thread_delay(25);
281
        show_xpm(redboot_xpm);
282
        cyg_thread_delay(15);
283
        show_xpm(eCos2_xpm);
284
        cyg_thread_delay(25);
285
        show_xpm(redboot_xpm);
286
        cyg_thread_delay(15);
287
        show_xpm(redhat2_xpm);
288
        cyg_thread_delay(25);
289
        show_xpm(logo_xpm);
290
        cyg_thread_delay(25);
291
        show_xpm(redboot_xpm);
292
        cyg_thread_delay(50);
293
    }
294
 
295
#if 0
296
    // This doesn't seem to do anything on my unit
297
    cerf_BCR(SA1110_BCR_MOTOR, SA1110_BCR_MOTOR_ON);
298
    cyg_thread_delay(2*100);
299
    cerf_BCR(SA1110_BCR_MOTOR, SA1110_BCR_MOTOR_OFF);
300
#endif
301
 
302
        show_xpm(redboot_xpm);
303
        cyg_thread_delay(15);
304
    lcd_clear();
305
    lcd_printf("\n\n**** Hello world!\n");
306
    cyg_thread_delay(5);
307
    for (i = 0;  i < 64;  i++) {
308
        lcd_printf("... testing line #%d\n", i);
309
    }
310
    cyg_thread_delay(50);
311
 
312
        show_xpm(redboot_xpm);
313
        cyg_thread_delay(15);
314
    set_bg(0,0,0);
315
    set_fg(31,63,0);
316
    lcd_clear();
317
    for (i = 0;  i < 32;  i++) {
318
        lcd_printf("... testing line #%d\n", i);
319
    }
320
    cyg_thread_delay(50);
321
    }  // while
322
 
323
    lcd_clear();
324
    lcd_printf("*****");
325
    cyg_thread_delay(200);
326
 
327
    cyg_test_exit();
328
}
329
 
330
externC void
331
cyg_start( void )
332
{
333
    // Create a main thread, so we can run the scheduler and have time 'pass'
334
    cyg_thread_create(10,                // Priority - just a number
335
                      lcd_test,          // entry
336
                      0,                 // entry parameter
337
                      "LCD test",        // Name
338
                      &stack[0],         // Stack
339
                      STACK_SIZE,        // Size
340
                      &thread_handle,    // Handle
341
                      &thread_data       // Thread data structure
342
            );
343
    cyg_thread_resume(thread_handle);  // Start it
344
    cyg_scheduler_start();
345
} // cyg_package_start()

powered by: WebSVN 2.1.0

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