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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [arm/] [sa11x0/] [cerfpda/] [current/] [misc/] [lcd_test.c] - Blame information for rev 786

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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