1 |
786 |
skrzyp |
//==========================================================================
|
2 |
|
|
//
|
3 |
|
|
// panel_test.c
|
4 |
|
|
//
|
5 |
|
|
// Cirrus Logic EDB7xxx eval board LCD touch panel test code
|
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: 1999-09-06
|
45 |
|
|
// Description: Tool used to test LCD touch panel
|
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_edb7xxx.h> // Board definitions
|
53 |
|
|
|
54 |
|
|
#include <cyg/hal/hal_io.h> // IO macros
|
55 |
|
|
#include <cyg/hal/hal_arch.h> // Register state info
|
56 |
|
|
#include <cyg/hal/hal_diag.h>
|
57 |
|
|
#include <cyg/hal/hal_intr.h> // HAL interrupt macros
|
58 |
|
|
#include <cyg/hal/drv_api.h> // HAL ISR support
|
59 |
|
|
|
60 |
|
|
#ifndef FALSE
|
61 |
|
|
#define FALSE 0
|
62 |
|
|
#define TRUE 1
|
63 |
|
|
#endif
|
64 |
|
|
|
65 |
|
|
#define STACK_SIZE 4096
|
66 |
|
|
static char stack[STACK_SIZE];
|
67 |
|
|
static cyg_thread thread_data;
|
68 |
|
|
static cyg_handle_t thread_handle;
|
69 |
|
|
|
70 |
|
|
#include "lcd_support.c"
|
71 |
|
|
#include "lcd_panel_support.c"
|
72 |
|
|
|
73 |
|
|
// FUNCTIONS
|
74 |
|
|
|
75 |
|
|
static void
|
76 |
|
|
cyg_test_exit(void)
|
77 |
|
|
{
|
78 |
|
|
while (TRUE) ;
|
79 |
|
|
}
|
80 |
|
|
|
81 |
|
|
static void
|
82 |
|
|
panel_exercise(cyg_addrword_t p)
|
83 |
|
|
{
|
84 |
|
|
int i;
|
85 |
|
|
cyg_uint32 val;
|
86 |
|
|
|
87 |
|
|
diag_printf("LCD touch panel test here!\n");
|
88 |
|
|
|
89 |
|
|
lcd_panel_init();
|
90 |
|
|
|
91 |
|
|
for (i = 0; i < 50; i++) {
|
92 |
|
|
diag_printf("Please touch screen now:\n");
|
93 |
|
|
val = (cyg_uint32)cyg_mbox_get(lcd_panel_events_mbox_handle);
|
94 |
|
|
diag_printf("val = %x, X = %d, Y = %d\n", val, (val>>16), val & 0xFFFF);
|
95 |
|
|
}
|
96 |
|
|
|
97 |
|
|
diag_printf("All done!\n");
|
98 |
|
|
cyg_test_exit();
|
99 |
|
|
}
|
100 |
|
|
|
101 |
|
|
externC void
|
102 |
|
|
cyg_start( void )
|
103 |
|
|
{
|
104 |
|
|
// Create a main thread, so we can run the scheduler and have time 'pass'
|
105 |
|
|
cyg_thread_create(10, // Priority - just a number
|
106 |
|
|
panel_exercise, // entry
|
107 |
|
|
0, // initial parameter
|
108 |
|
|
"LCD_panel_thread", // Name
|
109 |
|
|
&stack[0], // Stack
|
110 |
|
|
STACK_SIZE, // Size
|
111 |
|
|
&thread_handle, // Handle
|
112 |
|
|
&thread_data // Thread data structure
|
113 |
|
|
);
|
114 |
|
|
cyg_thread_resume(thread_handle); // Start it
|
115 |
|
|
cyg_scheduler_start();
|
116 |
|
|
} // cyg_package_start()
|
117 |
|
|
|